diff --git a/addon/components/inventory-form-panel.hbs b/addon/components/inventory-form-panel.hbs index d00f7a8d..a30bc745 100644 --- a/addon/components/inventory-form-panel.hbs +++ b/addon/components/inventory-form-panel.hbs @@ -95,8 +95,9 @@ - - + + + diff --git a/addon/components/inventory-form-panel.js b/addon/components/inventory-form-panel.js index 4db412a3..ea8c63b3 100644 --- a/addon/components/inventory-form-panel.js +++ b/addon/components/inventory-form-panel.js @@ -152,13 +152,18 @@ export default class InventoryFormPanelComponent extends Component { @action setDefaultBatchValues() { const currentDate = new Date().toISOString().split('T')[0]; - // unlikely to need but incase batch isn't initialized, do it here if (!this.inventory.batch) { this.inventory.batch = this.store.createRecord('batch'); } this.inventory.batch.set('batch_number', currentDate); - this.inventory.batch.set('expiry_date_at', currentDate); - this.inventory.batch.set('manufacture_date_at', currentDate); + } + + @action setExpiryDate(event) { + const { + target: { value }, + } = event; + + this.inventory.set('expiry_date_at', new Date(value)); } } diff --git a/addon/components/inventory-panel/details.hbs b/addon/components/inventory-panel/details.hbs index afa9998c..b01fc142 100644 --- a/addon/components/inventory-panel/details.hbs +++ b/addon/components/inventory-panel/details.hbs @@ -17,6 +17,14 @@
Batch
{{n-a @inventory.batch.batch_number}}
+
+
Expiry Date
+
{{n-a @inventory.expiry_date_at}}
+
+
+
Manufactured Date
+
{{n-a @inventory.created_at}}
+
\ No newline at end of file diff --git a/addon/components/product-panel.js b/addon/components/product-panel.js index a18642b0..d6e47057 100644 --- a/addon/components/product-panel.js +++ b/addon/components/product-panel.js @@ -89,11 +89,19 @@ export default class ProductPanelComponent extends Component { constructor() { super(...arguments); this.product = this.args.product; - console.log('[this.product]', this.product); + this.getProductSupplier(); this.tab = this.getTabUsingSlug(this.args.tab); applyContextComponentArguments(this); } + getProductSupplier() { + if (this.product.supplier_uuid) { + this.store.findRecord('vendor', this.product.supplier_uuid).then((vendor) => { + this.product.set('supplier', vendor); + }); + } + } + /** * Sets the overlay context. * diff --git a/addon/components/purchase-order-form-panel.hbs b/addon/components/purchase-order-form-panel.hbs index ae236dbc..93535239 100644 --- a/addon/components/purchase-order-form-panel.hbs +++ b/addon/components/purchase-order-form-panel.hbs @@ -30,6 +30,21 @@
+ + + {{model.name}} + +
- + + +