(async function () { Vue.component('bundle-table', { props: ['bundles'], methods: { removeBundle: function (idx) { this.$emit('bundle-remove', idx) }, getFormattedDateTime: function (bundle) { if (!!bundle.createdAt) { return bundle.createdAt.split('T')[0] + ' ' + bundle.createdAt.split('T')[1]; } return luxon.DateTime.now().toFormat('yyyy-MM-dd HH:mm:ss'); }, }, template: `
ID Item ID Sku Job Card ID Wrap Quantity Type Action
{{bundle.id}} {{bundle.itemId}} {{bundle.sku}} {{bundle.jobCardId}} {{bundle.wrapQuantity}} {{bundle.type}}
` }) let app = new Vue({ el: "#masterBarcodeApp", data: { bundles: [], }, methods: { removeBundle: function (idx) { this.bundles.splice(idx, 1) }, onBundleSelect: function (id, bundle) { this.bundles.push( bundle ) }, hasMultipleItemSelect : function () { const ids = this.bundles.map(item => item.itemId); const uniqueIds = new Set(ids); return uniqueIds.size > 1; }, hasDuplicates: function () { const ids = this.bundles.map(item => item.id); const uniqueIds = new Set(ids); return ids.length !== uniqueIds.size; } }, mounted: function () { this.bundles = window.ctp.wrapper.bundles; } }); })(jQuery);