( 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 Account Action
{{item.id}} {{item.itemId}} {{item.sku}} {{item.createdBy}} {{ getFormattedDateTime( item.createdAt) }} {{item.jobCardId}} {{item.barcode}}
`, }) let app = new Vue({ el : '#finishedApp', data : { items : [] }, 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; }, }, mounted : function () { console.log( this.$accounts ) } }) })(jQuery)