Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <div v-if="userData.RoleDetails.IsReadInventory" class="dashboard-contents">
- <div class="row">
- <div class="col-lg-4" style="margin-top: 20px;">
- <h2 style="padding:15px; margin-top:10px;">Daftar Inventory</h2>
- </div>
- <div class="col-lg-8" style="padding-top: 15px; margin-top: 20px;">
- <div class="row">
- <div class="col-lg-3"></div>
- <div class="col-lg-3">
- <!-- <router-link v-if="userData.RoleDetails.IsCreateInventory" :to="{name: 'InventoryManagement.import'}" type="button" class="btn btn-info waves-effect waves-circle waves-float pull-right button-import">
- <img src="@/assets/images/file-import-solid.svg" style="width: 10%; height: 100%;" alt="Alternate Text" /> Import
- </router-link> -->
- </div>
- <div class="col-lg-3">
- <download-excel v-if="userData.RoleDetails.IsExportInventory" class="btn waves-effect waves-circle waves-float pull-right button-export"
- worksheet = "Daftar Inventory"
- name = "data_inventory.xls"
- :data = "exportData"
- :fields = "fieldsData">
- <img src="@/assets/images/file-text.png" alt="Alternate Text" /> Export
- </download-excel>
- </div>
- <div class="col-lg-3">
- <router-link v-if="userData.RoleDetails.IsCreateInventory" :to="{name: 'InventoryManagement.create'}" type="button" class="btn waves-effect waves-circle waves-float pull-right button-create">
- <img src="@/assets/images/plus-circle.png" alt="Alternate Text" /> Tambah
- </router-link>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-4"></div>
- <div class="col-lg-8">
- <div class="row">
- <div class="col-lg-6"></div>
- <div class="col-lg-3">
- <!-- <select class="select-dropdown" name="" id="">
- <option value="" disabled selected>Pilih bendera...</option>
- <option value="Semua cabang">Semua bendera</option>
- <option value="Cabang A">Bendera A</option>
- <option value="Cabang B">Bendera B</option>
- </select> -->
- <vue-select v-if="userData.RoleId != 1" :disabled="$route.name.includes('.detail')" v-model="selectedLegalEntity" class="vue-select2" name="role" :options="userData.AccessSettings.filter(x => x.IsSelected == true)" label="Name"></vue-select>
- <vue-select v-if="userData.RoleId == 1" :disabled="$route.name.includes('.detail')" v-model="selectedLegalEntity" class="vue-select2" name="role" :options="legalEntity" label="Name"></vue-select>
- </div>
- <div class="col-lg-3">
- <!-- <select class="select-dropdown" name="" id="">
- <option value="" disabled selected>Pilih cabang...</option>
- <option value="Semua cabang">Semua cabang</option>
- <option value="Cabang A">Cabang A</option>
- <option value="Cabang B">Cabang B</option>
- </select> -->
- <vue-select v-if="selectedLegalEntity" :disabled="$route.name.includes('.detail')" v-model="selectedBranch" class="vue-select2" name="role" :options="selectedLegalEntity.branches" label="Name"></vue-select>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12 second-row">
- <hr/>
- <div class="row">
- <div class="col-lg-6">
- <div class="row">
- <div class="col-lg-10 search-div">
- <input type="text" name="permission" placeholder="Cari inventory..." v-model="key" value="" style="width: 100%; height: 38px; float: right; margin-bottom: 10px; border: 1px solid rgba(184, 55, 62, 0.5); background-color: white; border-radius: 5px; padding: 5px; margin-bottom: 24px;" />
- </div>
- <div class="col-lg-1 search-div">
- <button class="btn btn-primary" @click="search(key)"><span class="fa fa-search"></span></button>
- </div>
- <div class="col-lg-1 search-div">
- <button v-if="key != ''" class="btn btn-erase" @click="deleteSearch()"><span class="fa fa-times"></span></button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12">
- <div class="table-div" style="height: 530px !important;">
- <b-table striped sticky-header hover
- id="inventoryTable"
- :items="inventory"
- :fields="inventoryField"
- :filter="query"
- class="table table-hover table-striped"
- style="margin-top: 10px; max-height: 500px !important">
- <template v-slot:cell(Actions)="data">
- <b-dropdown text="Action" variant="primary" style="width: 120px;" v-if="!data.item.Category.includes('Bundle')">
- <b-dropdown-item v-if="userData.RoleDetails.IsUpdateInventory" @click="edit(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Id)">Edit</b-dropdown-item>
- <b-dropdown-item v-if="userData.RoleDetails.IsDeleteInventory" @click="del(data.item, data.item.Id)">Delete</b-dropdown-item>
- </b-dropdown>
- </template>
- <template v-slot:cell(Code)="data">
- <a v-if="userData.RoleDetails.IsReadInventory && filterPosisiBenderaCabangSaatIni(data.item.inventory_branches, selectorLegalEntity, selectorBranch)" @click="detail(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Id)" style="color: #0059aa; cursor: pointer; font-weight: 700;">{{ data.item.Code }}</a>
- <div v-if="userData.RoleDetails.IsReadInventory && !filterPosisiBenderaCabangSaatIni(data.item.inventory_branches, selectorLegalEntity, selectorBranch)">{{ data.item.Code }}</div>
- </template>
- <template v-slot:cell(Price100)="data">
- {{ data.item.Price100 | currency }}
- </template>
- <template v-slot:cell(Price90)="data">
- {{ data.item.Price90 | currency }}
- </template>
- <template v-slot:cell(Price60)="data">
- {{ data.item.Price60 | currency }}
- </template>
- <template v-slot:cell(Price30)="data">
- {{ data.item.Price30 | currency }}
- </template>
- <template v-if="userData.RoleDetails.IsReadBuyingPriceInventory" v-slot:cell(BuyingPrice100)="data">
- {{ data.item.BuyingPrice100 | currency }}
- </template>
- <template v-if="userData.RoleDetails.IsReadBuyingPriceInventory" v-slot:cell(BuyingPrice90)="data">
- {{ data.item.BuyingPrice90 | currency }}
- </template>
- <template v-if="userData.RoleDetails.IsReadBuyingPriceInventory" v-slot:cell(BuyingPrice60)="data">
- {{ data.item.BuyingPrice60 | currency }}
- </template>
- <template v-if="userData.RoleDetails.IsReadBuyingPriceInventory" v-slot:cell(BuyingPrice30)="data">
- {{ data.item.BuyingPrice30 | currency }}
- </template>
- <template v-slot:cell(Point)="data">
- {{ data.item.Point | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}
- </template>
- <template v-slot:cell(LegalEntityId)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].legal_entity.Name }}</div>
- </template>
- <template v-slot:cell(BranchId)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].branch.Name }}</div>
- </template>
- <template v-slot:cell(Location)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Location }}</div>
- </template>
- <template v-slot:cell(RefurbishQuantity)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].RefurbishQuantity }}</div>
- </template>
- <template v-slot:cell(Quantity100)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Quantity100 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
- </template>
- <template v-slot:cell(Quantity90)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Quantity90 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
- </template>
- <template v-slot:cell(Quantity60)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Quantity60 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
- </template>
- <template v-slot:cell(Quantity30)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].Quantity30 | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
- </template>
- <template v-slot:cell(TotalQuantityC)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">{{ calculateTotal(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0]) | currency({ symbol: '', thousandsSeparator: '.', fractionCount: '', fractionSeparator: '', symbolPosition: '', symbolSpacing: '' }) }}</div>
- </template>
- <template v-slot:cell(SafetyStockStatus)="data">
- <div v-if="filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0] !== undefined">
- <div v-if="parseInt(calculateTotal(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0])) > parseInt(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].SafetyStockLimit)">
- <button type="button" class="btn btn-success">Stock Aman</button>
- </div>
- <div v-if="(parseInt(calculateTotal(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0])) <= parseInt(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0].SafetyStockLimit)) && (parseInt(calculateTotal(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0])) > 0)">
- <button type="button" class="btn btn-warning">Restock</button>
- </div>
- <div v-if="parseInt(calculateTotal(filterBarangCabang(data.item.inventory_branches, selectorLegalEntity, selectorBranch)[0])) <= 0">
- <button type="button" class="btn btn-danger">Stock Habis</button>
- </div>
- </div>
- </template>
- </b-table>
- <div v-if="loading" class="d-flex justify-content-center mb-3">
- <b-spinner label="Loading..."></b-spinner>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import moment from 'moment'
- import $ from 'jquery'
- import DownloadExcel from 'vue-json-excel'
- import VueSelect from 'vue-select'
- import 'vue-select/dist/vue-select.css'
- import Inventories from '@/services/Inventories/Inventory'
- import LegalEntities from '@/services/Companies/LegalEntities'
- import Branches from '@/services/Companies/Branches'
- export default {
- name: 'InventoryManagement.index',
- components: {
- DownloadExcel,
- VueSelect
- },
- computed: {
- rows () {
- //hitung panjang data Inventory
- return this.inventory.length
- },
- filtered: function () {
- // Rule 1, Bundle untuk cabang, pusat all
- // if((this.userData.LegalEntityId == 1) && (this.userData.BranchId == 1)) {
- // return this.inventory
- // } else {
- // return this.inventory.filter(i => i.IsBundle == 1)
- // }
- // // Rule 2, Bundle + satuan punya cabang itu sendiri, pusat all
- // if((this.userData.LegalEntityId == 1) && (this.userData.BranchId == 1)) {
- // return this.inventory
- // } else {
- // return this.inventory.filter(i => i.BranchId == this.userData.BranchId)
- // }
- // Case 1
- // if (this.userData.AccessSettings.branches) {
- // console.log("ga masuk")
- // return this.inventory
- // } else {
- // console.log("masuk")
- // return this.inventory.filter(i => i.BranchId == this.userData.AccessSettings[i].branches)
- // }
- // Case 2
- // return this.inventory.filter(i => i.BranchId == this.userData.BranchId)
- // Case 3
- // return this.inventory.filter(i => i.BranchId == JSON.parse(this.userData.AccessSettings.branches.Id))
- // let arrayToString = JSON.stringify(Object.assign({}, this.userData.AccessSettings))
- // let jsonObject = JSON.parse(arrayToString)
- // console.log(JSON.parse(JSON.stringify(Object.assign({}, this.userData.AccessSettings))))
- // console.log(JSON.parse(JSON.stringify(Object.assign({}, this.userData.AccessSettings.branches))))
- // Case 4
- // for (var i = 0; i < this.inventory.length; i++) {
- // for (var j = 0; j < this.userData.AccessSettings.length; j++) {
- // if ((this.inventory[i].LegalEntityId == this.userData.AccessSettings[j].Id) && (this.inventory[i].BranchId == this.userData.AccessSettings[j].Branches.Id)) {
- // return this.inventory.filter(this.inventory[i].BranchId == this.userData.AccessSettings[j].Branches.Id)
- // }
- // }
- // }
- // Case 5
- // for (var i = 0; i < this.inventory.length; i++) {
- // for (var j = 0; j < this.userData.AccessSettings.length-1; j++) {
- // if ((this.inventory[i].LegalEntityId == this.userData.AccessSettings[j].Id) && (this.inventory[i].BranchId == this.userData.AccessSettings[j].Branches.Id)) {
- // console.log(this.inventory[i].LegalEntityId)
- // return null
- // }
- // }
- // }
- return null
- }
- },
- data () {
- return {
- key: '',
- query: '',
- //Loading
- loading: true,
- //definisikan per page dan halaman current isi 1 untuk awal
- perPage: 10,
- currentPage: 1,
- //selesai
- inventoryField: this.fieldLookup(),
- exportData: [],
- fieldsData: {
- 'Kode': 'Code',
- 'Nama Bendera': 'LegalEntityId',
- 'Nama Cabang': 'BranchId',
- 'Name Barang': 'Name',
- 'Lokasi': 'Location',
- 'Kategori': 'Category',
- 'Jumlah Barang': 'TotalQuantity',
- 'Jumlah Barang Rekondisi': 'RefurbishQuantity',
- 'Jumlah Barang Kondisi 100%': 'Quantity100',
- 'Jumlah Barang Kondisi 90%': 'Quantity90',
- 'Jumlah Barang Kondisi 60%': 'Quantity60',
- 'Jumlah Barang Kondisi 30%': 'Quantity30',
- 'Safety Stock Limit': 'SafetyStockStatus',
- 'Harga Jual 100%': 'Price90',
- 'Harga Jual 90%': 'Price90',
- 'Harga Jual 60%': 'Price60',
- 'Harga Jual 30%': 'Price30',
- 'Harga Jual Owner 100%': 'ExtraPrice90',
- 'Harga Jual Owner 90%': 'ExtraPrice90',
- 'Harga Jual Owner 60%': 'ExtraPrice60',
- 'Harga Jual Owner 30%': 'ExtraPrice30',
- 'Harga Beli 100%': 'BuyingPrice90',
- 'Harga Beli 90%': 'BuyingPrice90',
- 'Harga Beli 60%': 'BuyingPrice60',
- 'Harga Beli 30%': 'BuyingPrice30',
- 'Point': 'Point',
- },
- userData: {},
- inventory: [],
- roles: [],
- selectedLegalEntity: {"Name" : "Pilih bendera..."},
- selectedBranch: {"Name" : "Pilih cabang..."},
- legalEntity: [],
- branch: [],
- dismissSecs: 5,
- dismissCountDown: 0,
- deleted: [],
- selectorLegalEntity: 0,
- selectorBranch: 0,
- buyingPriceAccess: 0,
- }
- },
- beforeUpdate: function() {
- if(this.selectedLegalEntity.Name != 'Pilih bendera...') {
- //this.query = this.selectedLegalEntity.Name
- this.selectorLegalEntity = this.selectedLegalEntity.Id
- } else {
- this.selectorLegalEntity = this.userData.LegalEntityId
- }
- if(this.selectedBranch.Name != 'Pilih cabang...') {
- //this.query = this.selectedBranch.Name
- this.selectorBranch = this.selectedBranch.Id
- } else {
- this.selectorBranch = this.userData.BranchId
- }
- this.buyingPriceAccess = this.userData.RoleDetails.IsReadBuyingPriceInventory
- },
- created: function () {
- this.init()
- },
- mounted: function () {
- window.$ = $
- if(localStorage.userData !== undefined) {
- this.userData = JSON.parse(localStorage.userData)
- } else {
- this.$router.push({ name: 'home' })
- location.reload()
- }
- },
- methods: {
- init: async function () {
- let result = await Inventories.index()
- let legalEntity = await LegalEntities.index()
- let branch = await Branches.index()
- this.inventory = result.data
- this.legalEntity = legalEntity.data
- this.branch = branch.data
- //fungsi export
- this.exportData = this.filterExport(result.data)
- this.loading = false
- },
- fieldLookup() {
- let field = [
- { key: 'Actions', label: 'Actions' },
- { key: 'Code', label: 'Nomor Barang', sortable: true },
- { key: 'LegalEntityId', label: 'Nama Bendera', sortable: true },
- { key: 'BranchId', label: 'Nama Cabang', sortable: true },
- { key: 'Name', label: 'Nama Barang', sortable: true },
- { key: 'Category', label: 'Kategori Barang', sortable: true },
- { key: 'WarehouseCategory', label: 'Kategori Gudang', sortable: true },
- { key: 'Location', label: 'Lokasi', sortable: true },
- { key: 'Point', label: 'Points', sortable: true },
- { key: 'SafetyStockStatus', label: 'Status Stock', sortable: true },
- { key: 'TotalQuantityC', label: 'Jumlah Barang', sortable: true },
- { key: 'Quantity100', label: 'Kondisi 100%', sortable: true },
- { key: 'Quantity90', label: 'Kondisi 90%', sortable: true },
- { key: 'Quantity60', label: 'Kondisi 60%', sortable: true },
- { key: 'Quantity30', label: 'Kondisi dibawah 30%', sortable: true },
- { key: 'RefurbishQuantity', label: 'Jumlah Barang Rekondisi', sortable: true },
- { key: 'Price100', label: 'Harga Jual Kondisi 100%', sortable: true },
- { key: 'Price90', label: 'Harga Jual Kondisi 90%', sortable: true },
- { key: 'Price60', label: 'Harga Jual Kondisi 60%', sortable: true },
- { key: 'Price30', label: 'Harga Jual Kondisi 30%', sortable: true },
- ]
- if(this.buyingPriceAccess == 1) {
- field.push(
- { key: 'BuyingPrice100', label: 'Harga Beli Kondisi 100%', sortable: true },
- { key: 'BuyingPrice90', label: 'Harga Beli Kondisi 90%', sortable: true },
- { key: 'BuyingPrice60', label: 'Harga Beli Kondisi 60%', sortable: true },
- { key: 'BuyingPrice30', label: 'Harga Beli Kondisi 30%', sortable: true }
- )
- }
- return field
- },
- calculateTotal: function(json) {
- let total = parseInt(
- parseInt(json.Quantity100) +
- parseInt(json.Quantity90) +
- parseInt(json.Quantity60) +
- parseInt(json.Quantity30)
- )
- return total
- },
- search: function(key) {
- this.query = key
- },
- deleteSearch: function() {
- this.query = ''
- this.key = ''
- },
- // cekSafetyStock: function(safetyStock, legalEntityId, branchId) {
- // },
- filterBarangCabang: function(json, legalEntityId, branchId) {
- let data = []
- for(var i = 0; i < json.length; i++) {
- if((json[i].LegalEntityId == legalEntityId) && (json[i].BranchId == branchId)) {
- data.push(json[i])
- }
- }
- return data
- },
- filterPosisiBenderaCabangSaatIni: function(json, legalEntityId, branchId) {
- for(var i = 0; i < json.length; i++) {
- if((json[i].LegalEntityId == legalEntityId) && (json[i].BranchId == branchId)) {
- return true
- } else {
- return false
- }
- }
- },
- //Filter data yang mau di export
- filterExport: function (json) {
- let data = []
- for(var i = 0; i< json.length; i++) {
- //Tentukan Kolom Yang Mau Dimasukin Disini
- data.push({
- 'Code': json[i].Code,
- 'LegalEntityId': json[i].legal_entity ? json[i].legal_entity.Name : '-',
- 'BranchId': json[i].branch ? json[i].branch.Name : '-',
- 'Name': json[i].Name,
- 'Location': json[i].Location,
- 'Category': json[i].Category,
- 'TotalQuantity': this.calculateTotal(this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0]),
- 'RefurbishQuantity': this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0].RefurbishQuantity,
- 'Quantity100': this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0].Quantity100,
- 'Quantity90': this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0].Quantity90,
- 'Quantity60': this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0].Quantity60,
- 'Quantity30': this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0].Quantity30,
- 'SafetyStockStatus': this.filterBarangCabang(json[i].inventory_branches, this.selectorLegalEntity, this.selectorBranch)[0].SafetyStockLimit,
- 'Price100': json[i].Price100,
- 'Price90': json[i].Price90,
- 'Price60': json[i].Price60,
- 'Price30': json[i].Price30,
- 'BuyingPrice100': json[i].BuyingPrice100,
- 'BuyingPrice90': json[i].BuyingPrice90,
- 'BuyingPrice60': json[i].BuyingPrice60,
- 'BuyingPrice30': json[i].BuyingPrice30,
- 'ExtraPrice100': json[i].ExtraPrice100,
- 'ExtraPrice90': json[i].ExtraPrice90,
- 'ExtraPrice60': json[i].ExtraPrice60,
- 'ExtraPrice30': json[i].ExtraPrice30,
- 'Point': json[i].Point,
- })
- }
- return data
- },
- itemLookup: function (json) {
- let data = []
- for(var i = 0; i< json.length; i++) {
- data[json[i].Id] = json[i]
- }
- return data
- },
- formatDate(time) {
- var formattedTime = moment(time).format('DD MMMM YYYY HH:mm')
- if(formattedTime == 'Invalid date') {
- formattedTime = '-'
- }
- return formattedTime
- },
- detail: function (id) {
- this.$router.push({ name: 'InventoryManagement.detail', params: { id: id } })
- },
- edit: function (id) {
- this.$router.push({ name: 'InventoryManagement.edit', params: { id: id } })
- },
- del: async function (json, id) {
- let ini = this
- ini.$fire({
- text: "Apakah anda yakin ingin menghapus " + json.Name + "?",
- type: "warning",
- showCancelButton: true,
- confirmButtonText: 'Ya',
- cancelButtonText: 'Tidak',
- showCloseButton: true,
- showLoaderOnConfirm: true,
- }).then(function(isConfirm) {
- if (isConfirm.value) {
- ini.$fire({
- text: "Peringatan terakhir! Apakah anda yakin ingin menghapus " + json.Name + "?",
- type: "warning",
- showCancelButton: true,
- confirmButtonText: 'Ya',
- cancelButtonText: 'Tidak',
- showCloseButton: true,
- showLoaderOnConfirm: true,
- }).then(async function(isConfirm) {
- if (isConfirm.value) {
- json.LoggedUserLegalEntityId = ini.userData.LegalEntityId
- json.LoggedUserBranchId = ini.userData.BranchId
- let result = await Inventories.delete(id, json)
- if(result.status == 200) {
- ini.$fire({
- title: 'Sukses',
- text: 'Hapus Data Sukses',
- // icon: 'info',
- // type: 'success',
- showConfirmButton: false
- })
- ini.$router.push({ name: 'InventoryManagement.index' })
- location.reload()
- } else {
- alert("Delete Gagal")
- location.reload()
- }
- console.log('Keluar')
- }
- })
- } else {
- console.log('cancel')
- }
- })
- },
- countDownChanged(dismissCountDown) {
- this.dismissCountDown = dismissCountDown
- },
- }
- }
- </script>
- <style>
- .table-div {
- height: 500px;
- padding-left: 30px;
- margin-left: 0px !important;
- overflow-x: auto;
- overflow-y: auto;
- }
- .second-row {
- margin-top: 30px;
- padding-left: 30px;
- }
- .select-dropdown {
- width: 100%;
- height: 45px;
- border-color: #0059aa;
- border-radius: 5px;
- }
- .button-export {
- width: 100%;
- height: 45px;
- background-color: #0059aa;
- color:white;
- border-radius: 5px;
- }
- .button-create {
- width: 100%;
- height: 45px;
- background-color: #20c197;
- color:white;
- border-radius: 5px;
- }
- .btn-warning {
- width: 132px;
- }
- .btn-danger {
- margin-left: 0px !important;
- }
- .btn-default {
- width: 132px;
- height: 36px;
- margin-left: 15px;
- margin-right: 15px;
- color: white;
- background-color: red;
- }
- .btn-default:hover {
- color: white;
- background-color: rgb(185, 0, 0);
- }
- .pagination {
- padding: 15px;
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement