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

View File

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