(async function () { Vue.prototype.$accounts = window.ctp.accounts; Vue.component('finished-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 }} {{ item.qaStatus }}
` }); let app = new Vue({ el: '#finishedApp', 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(() => { document.getElementById('finishedApp').submit(); }); } }, mounted: function () { console.log(this.$accounts); } }); })(jQuery);