( async function(){ Vue.prototype.$types = window.ctp.types; Vue.prototype.$accounts = window.ctp.accounts; Vue.component('item-rows', { props: ['index', 'item'], methods : { populateCuttingAccount : function (){ return this.$accounts.find(account => account.id === this.item.accountId).title; }, }, template: ` {{item.sku}} {{item.expectedProduction}} {{ populateCuttingAccount() }} ` }); Vue.component ('cut-piece', { props: ['index', 'piece', 'pIndex'], methods: { removePiece: function (e) { e.preventDefault(); this.$emit('piece-remove', this.index) } }, template: `
` }); Vue.component('job-card-details',{ props:[ 'jobCard' ], methods : { }, template : `
Item Item Sku/Title Cut Pieces Expected Production Actual Production Account
` }); let app = new Vue({ el : '#receiveInvApp', data :{ jobCard : {} }, computed: { getStatus: function() { return `badge-${this.jobCard.status}`; }, getInvStatus: function() { return `badge-${this.jobCard.inventoryStatus}`; } }, methods : { onCardSelect : function ( id, card ) { $.ajax({ url: `/ctp/rest/job-cards/find/${id}`, method: 'GET', contentType: 'application/json', dataType: 'json', success: ( data ) => { this.jobCard = data; }, error : function ( err ){ alert( err ); } }) } }, mounted : function () { } }) })(jQuery);