(async function () { Vue.component('stitched-item-table', { props: ['items'], methods: { getFormattedDateTime: function (dateTime) { if (!!dateTime) { return dateTime.split('T')[0] + ' ' + dateTime.split('T')[1]; } return luxon.DateTime.now().toFormat('yyyy-MM-dd HH:mm:ss'); }, removeItem: function (index) { this.$emit('remove-item', index) } }, template: `
ID Item ID Sku Created By Created At Job Card ID Barcode Status Action
{{item.id}} {{item.itemId}} {{item.sku}} {{item.createdBy}} {{ getFormattedDateTime( item.createdAt) }} {{item.jobCardId}} {{item.barcode}} NOT PERFORMED {{ item.qaStatus }} {{ item.qaStatus }}
` }); let app = new Vue({ el: '#qcForm', data: { items: [], QaStatus: 'APPROVED' }, methods: { onItemSelect: function (id, item) { this.items.push(item); }, removeItem: function (index) { this.items.splice(index, 1); }, hasDuplicates: function () { const ids = this.items.map(item => item.id); const uniqueIds = new Set(ids); return ids.length !== uniqueIds.size; }, submitWithQaStatus: function (status) { this.QaStatus = status; this.$nextTick(() => { const form = document.getElementById('qcForm'); if (form.checkValidity()) { form.submit(); } else { form.reportValidity(); } }); } }, mounted: function () { } }) })(jQuery);