From 38535f63efa7d99ac6b6b7475528e14eb6570ed1 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Sun, 7 Jan 2024 08:33:19 +0100 Subject: [PATCH] feat(price create form): move product scanning first (#102) * Price create form: move proof to the end. Seperate product & price * Group price & proof * Update icons --- src/views/AddPriceSingle.vue | 121 ++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 58 deletions(-) diff --git a/src/views/AddPriceSingle.vue b/src/views/AddPriceSingle.vue index b06d612baf9..381eb692ab8 100644 --- a/src/views/AddPriceSingle.vue +++ b/src/views/AddPriceSingle.vue @@ -4,53 +4,17 @@ - + + :style="productFormFilled ? 'border: 1px solid #4CAF50' : 'border: 1px solid transparent'"> - - - Proof - - -

Proof uploaded!

-

Upload a proof

-
- - - -
-
-
-
- - - - - - -

- Product +

@@ -61,7 +25,7 @@

- Scan a barcode + Scan a barcode @@ -102,7 +67,20 @@

Set a product

+
+
+
+ + + + +

Price per kg

@@ -110,6 +88,7 @@ v-model="addPriceSingleForm.price" label="Price" type="number" + hide-details="auto" > @@ -117,9 +96,31 @@ v-model="addPriceSingleForm.currency" label="Currency" :items="currencyList" + hide-details="auto" > + + + Proof + + +

Proof uploaded!

+

Upload a proof

+
+ + + +
@@ -137,7 +138,6 @@

Location

- Find {{ location.display_name }} + Find

Select your location

Date

@@ -223,7 +224,6 @@ export default { dev: import.meta.env.DEV, // price form addPriceSingleForm: { - proof_id: null, product_code: '', category_tag: null, origins_tags: '', @@ -232,14 +232,10 @@ export default { currency: null, // see initPriceSingleForm location_osm_id: null, location_osm_type: '', - date: new Date().toISOString().substr(0, 10) + date: new Date().toISOString().substr(0, 10), + proof_id: null, }, createPriceLoading: false, - // proof data - proofImage: null, - proofImagePreview: null, - createProofLoading: false, - proofSuccessMessage: false, // product data product: null, productModeList: [{key: 'barcode', value: 'Barcode', icon: 'mdi-barcode-scan'}, {key: 'category', value: 'Category', icon: 'mdi-basket-outline'}], @@ -253,14 +249,15 @@ export default { // location data locationSelector: false, locationSelectedDisplayName: '', + // proof data + proofImage: null, + proofImagePreview: null, + createProofLoading: false, + proofSuccessMessage: false, } }, computed: { ...mapStores(useAppStore), - proofFormFilled() { - let keys = ['proof_id'] - return Object.keys(this.addPriceSingleForm).filter(k => keys.includes(k)).every(k => !!this.addPriceSingleForm[k]) - }, productBarcodeFormFilled() { let keys = ['product_code'] return Object.keys(this.addPriceSingleForm).filter(k => keys.includes(k)).every(k => !!this.addPriceSingleForm[k]) @@ -269,8 +266,16 @@ export default { let keys = ['category_tag', 'origins_tags'] return Object.keys(this.addPriceSingleForm).filter(k => keys.includes(k)).every(k => !!this.addPriceSingleForm[k]) }, - productPriceFormFilled() { - return (this.productBarcodeFormFilled || this.productCategoryFormFilled) && !!this.addPriceSingleForm.price && !!this.addPriceSingleForm.currency + productFormFilled() { + return this.productBarcodeFormFilled || this.productCategoryFormFilled + }, + priceProofFormFilled() { + let keys = ['price', 'currency', 'proof_id'] + return Object.keys(this.addPriceSingleForm).filter(k => keys.includes(k)).every(k => !!this.addPriceSingleForm[k]) + }, + proofFormFilled() { + let keys = ['proof_id'] + return Object.keys(this.addPriceSingleForm).filter(k => keys.includes(k)).every(k => !!this.addPriceSingleForm[k]) }, recentLocations() { return this.appStore.getRecentLocations(3) @@ -284,7 +289,7 @@ export default { return Object.keys(this.addPriceSingleForm).filter(k => keys.includes(k)).every(k => !!this.addPriceSingleForm[k]) }, formFilled() { - return this.proofFormFilled && this.productPriceFormFilled && this.locationDateFormFilled + return this.productFormFilled && this.priceProofFormFilled && this.locationDateFormFilled }, }, mounted() {