diff --git a/ayanova/src/views/inv-part-serials.vue b/ayanova/src/views/inv-part-serials.vue index b76e3fc5..7aa13912 100644 --- a/ayanova/src/views/inv-part-serials.vue +++ b/ayanova/src/views/inv-part-serials.vue @@ -3,6 +3,7 @@
+ {{ obj }} @@ -16,8 +17,45 @@ data-cy="selectedPartId" > - PartSerialNumbersAvailable list here - {{ obj }} + + + + + + + +
@@ -106,7 +144,8 @@ export default { }, rights: window.$gz.role.defaultRightsObject(), ayaType: window.$gz.type.Part, - selectedPartId: Number(this.$route.params.recordid) + selectedPartId: Number(this.$route.params.recordid), + newSerial: null }; }, @@ -128,16 +167,38 @@ export default { } }, methods: { + sortedList: function() { + if (this.obj == null || this.obj.length == 0) { + return []; + } + + return this.obj.slice().sort(); + }, + removeItem: function(index) { + vm.obj.splice(index, 1); + vm.formState.dirty = true; + }, canSave: function() { return this.formState.valid && this.formState.dirty; }, - + addItem: function() { + if (this.newSerial == null || this.newSerial == "") { + return; + } + //add to list, may be in various formats so handle that + let splitted = this.newSerial.split(/[\s,]+/).filter(Boolean); + splitted = [...splitted, ...this.obj]; + let uniqueItems = [...new Set(splitted)]; + uniqueItems.sort(); + console.log(uniqueItems); + //1,2,3,1,014369160,5,3,9,qw + }, ayaTypes: function() { return window.$gz.type; }, - // form() { - // return window.$gz.form; - // }, + form() { + return window.$gz.form; + }, // fieldValueChanged(ref) { // if ( // this.formState.ready && @@ -281,14 +342,14 @@ function generateMenu(vm) { let menuOptions = { isMain: false, readOnly: vm.formState.readOnly, - icon: "$ayiProjectDiagram", - title: "Project", - helpUrl: "form-svc-projects", + icon: null, + title: "PartSerialNumbersAvailable", + helpUrl: "form-inv-part-serials", formData: { - ayaType: window.$gz.type.Project, - recordId: vm.$route.params.recordid, - formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY, - recordName: vm.obj.name + // ayaType: window.$gz.type.Par, + // recordId: vm.$route.params.recordid, + // formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY, + // recordName: vm.obj.name }, menuItems: [] };