Advertisement
vitareinforce

Cara nempatin fungsi update alokasi

Apr 24th, 2020
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             if(!this.$route.params.id) {
  2.               result = await Scheduling.create(this.scheduling)
  3.             }
  4.             if(result.status == 200) {
  5.                 let existingAlocation = await Alocations.detail(this.selectedAlocation.Id);
  6.               existingAlocation.TotalSisaQuantity = parseInt(existingAlocation.TotalQuantity) - parseInt(this.scheduling.AlocatedProductQuantity)
  7.               existingAlocation.SisaQuantity100 = parseInt(existingAlocation.SisaQuantity100) - parseInt(this.scheduling.Quantity100)
  8.               existingAlocation.SisaQuantity90 = parseInt(existingAlocation.SisaQuantity90) - parseInt(this.scheduling.Quantity90)
  9.               existingAlocation.SisaQuantity60 = parseInt(existingAlocation.SisaQuantity60) - parseInt(this.scheduling.Quantity60)
  10.               existingAlocation.SisaQuantity30 = parseInt(existingAlocation.SisaQuantity30) - parseInt(this.scheduling.Quantity30)
  11.              
  12.               let alocation = await Alocations.edit(this.selectedAlocation.Id, existingAlocation);
  13.               if(alocation.status == 200) {
  14.                   this.$fire({
  15.                       title: 'Sukses',
  16.                       text: 'Sukses Simpan Sisa ke Alokasi',
  17.                       icon: 'info',
  18.                       showConfirmButton: false
  19.                   })
  20.               }
  21.                 this.$fire({
  22.                   title: 'Sukses',
  23.                   text: 'Input Data Sukses',
  24.                   icon: 'info',
  25.                   showConfirmButton: false
  26.                 })
  27.                
  28.                 this.$router.push({ name: 'DeliveryScheduleManagement.index' })
  29.                 location.reload()
  30.             } else {
  31.                 this.$fire({
  32.                   title: 'Error',
  33.                   text: 'Input Data Gagal',
  34.                   icon: 'error',
  35.                   showConfirmButton: false
  36.                 })
  37.                 console.log(result)
  38.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement