This commit is contained in:
2021-01-25 21:34:31 +00:00
parent e9680a04b8
commit 0ebf4a07d6
2 changed files with 28 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
<template> <template>
<div> <div>
{{ obj }}
<gz-report-selector ref="reportSelector"></gz-report-selector> <gz-report-selector ref="reportSelector"></gz-report-selector>
<div v-if="formState.ready"> <div v-if="formState.ready">
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error> <gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
@@ -8,7 +9,7 @@
<v-col cols="12"> <v-col cols="12">
<gz-pick-list <gz-pick-list
readonly readonly
v-model="$route.params.recordid" v-model="selectedPartId"
:ayaType="ayaTypes().Part" :ayaType="ayaTypes().Part"
:showEditIcon="true" :showEditIcon="true"
:label="$ay.t('Part')" :label="$ay.t('Part')"
@@ -19,11 +20,11 @@
<v-col cols="12"> <v-col cols="12">
<gz-pick-list <gz-pick-list
v-model="selectedPartWarehouseId" v-model="selectedPartWarehouseId"
:ayaType="ayaTypes().PartWarhouse" :ayaType="ayaTypes().PartWarehouse"
:showEditIcon="true" :showEditIcon="true"
:label="$ay.t('PartWarehouse')" :label="$ay.t('PartSerialWarehouseID')"
ref="selectedPartWarehouseId" ref="partWarehouseId"
data-cy="selectedPartWarehouseId" data-cy="partWarehouseId"
@input="addItem()" @input="addItem()"
></gz-pick-list> ></gz-pick-list>
</v-col> </v-col>
@@ -34,10 +35,10 @@
<thead> <thead>
<tr> <tr>
<th class="text-left"> <th class="text-left">
{{ $ay.t("PartList") }} {{ $ay.t("PartSerialWarehouseID") }}
</th> </th>
<th class="text-left"> <th class="text-left">
{{ $ay.t("WorkOrderItemPartQuantity") }} {{ $ay.t("PartByWarehouseInventoryMinStockLevel") }}
</th> </th>
</tr> </tr>
</thead> </thead>
@@ -52,7 +53,7 @@
" "
> >
<td> <td>
{{ item.partDisplay }} {{ item.partWareHouseDisplay }}
<template v-if="$vuetify.breakpoint.xs"> <template v-if="$vuetify.breakpoint.xs">
<div class="my-3"> <div class="my-3">
<v-icon class="ml-2" @click="openItem(item)"> <v-icon class="ml-2" @click="openItem(item)">
@@ -200,40 +201,41 @@ export default {
return 0; return 0;
} }
return this.obj.items.slice().sort(compare); return this.obj.slice().sort(compare);
}, },
addItem: function() { addItem: function() {
let vm = this; let vm = this;
let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue(); let selectedPartWarehouse = vm.$refs.partWarehouseId.getFullSelectionValue();
if (selectedPartWarehouse == null || selectedPartWarehouse.Id == null) { if (selectedPartWarehouse == null || selectedPartWarehouse.id == null) {
return; return;
} }
let index = vm.obj.items.findIndex( let index = vm.obj.findIndex(
z => z.partWarehouseId == selectedPartWarehouse.Id z => z.partWarehouseId == selectedPartWarehouse.id
); );
if (index != -1) { if (index != -1) {
//already in the list //already in the list
return; return;
} }
vm.obj.items.push({ vm.obj.push({
partId: vm.$route.params.recordid, partId: vm.$route.params.recordid,
partWarehouseId: selectedPartWarehouse.Id, partWarehouseId: selectedPartWarehouse.id,
partWareHouseDisplay: selected.name, partWareHouseDisplay: selectedPartWarehouse.name,
quantity: 1 minimumQuantity: 1
}); });
vm.formState.dirty = true; vm.formState.dirty = true;
}, },
removeItem: function(item) { removeItem: function(item) {
let vm = this; let vm = this;
let index = vm.obj.items.findIndex( let index = vm.obj.findIndex(
z => z.partWarehouseId == item.partWarehouseId z => z.partWarehouseId == item.partWarehouseId
); );
if (index == -1) { if (index == -1) {
return; return;
} }
vm.obj.items.splice(index, 1); vm.obj.splice(index, 1);
vm.formState.dirty = true; vm.formState.dirty = true;
}, },
// openItem: function(item) { // openItem: function(item) {
@@ -245,7 +247,7 @@ export default {
quantityChanged: function(item) { quantityChanged: function(item) {
let vm = this; let vm = this;
if (item.minimumQuantity == null || item.minimumQuantity < 1) { if (item.minimumQuantity == null || item.minimumQuantity < 1) {
let index = vm.obj.items.findIndex( let index = vm.obj.findIndex(
z => z.partWarehouseId == item.partWarehouseId z => z.partWarehouseId == item.partWarehouseId
); );
if (index == -1) { if (index == -1) {
@@ -414,6 +416,10 @@ async function initForm(vm) {
// Ensures UI translated text is available // Ensures UI translated text is available
// //
async function fetchTranslatedText(vm) { async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations(["PartStockingLevels"]); await window.$gz.translation.cacheTranslations([
"PartStockingLevels",
"PartByWarehouseInventoryMinStockLevel",
"PartSerialWarehouseID"
]);
} }
</script> </script>

View File

@@ -714,7 +714,7 @@ async function clickHandler(menuItem) {
break; break;
case "PartStockingLevels": case "PartStockingLevels":
m.vm.$router.push({ m.vm.$router.push({
name: "inv-part-stocking-levels", name: "inv-part-stock-levels",
params: { recordid: m.vm.obj.id } params: { recordid: m.vm.obj.id }
}); });
break; break;
@@ -872,6 +872,7 @@ async function fetchTranslatedText(vm) {
"Part", "Part",
"PartByWarehouseInventoryList", "PartByWarehouseInventoryList",
"PartSerialNumbersAvailable", "PartSerialNumbersAvailable",
"PartStockingLevels",
"PartName", "PartName",
"PartNotes", "PartNotes",
"PartPartNumber", "PartPartNumber",