diff --git a/src/components/ClosePurchaseOrderModal.vue b/src/components/ClosePurchaseOrderModal.vue index 7f118f1b..5f47cd1e 100644 --- a/src/components/ClosePurchaseOrderModal.vue +++ b/src/components/ClosePurchaseOrderModal.vue @@ -23,8 +23,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

@@ -65,8 +65,7 @@ import { closeOutline, checkmarkCircle, arrowBackOutline, saveOutline } from 'io import { defineComponent } from 'vue'; import { mapGetters, useStore } from 'vuex' import { OrderService } from "@/services/OrderService"; -import { productHelpers } from '@/utils'; -import { DxpShopifyImg, translate } from '@hotwax/dxp-components'; +import { DxpShopifyImg, translate, getProductIdentificationValue } from '@hotwax/dxp-components'; import { useRouter } from 'vue-router'; export default defineComponent({ @@ -215,11 +214,11 @@ export default defineComponent({ checkmarkCircle, hasPermission, OrderService, - productHelpers, router, saveOutline, store, - translate + translate, + getProductIdentificationValue }; } }); diff --git a/src/utils/index.ts b/src/utils/index.ts index 81673377..b699b0ca 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,7 +1,6 @@ import { toastController } from '@ionic/vue'; import { translate } from '@hotwax/dxp-components' import { Plugins } from '@capacitor/core'; -import productHelpers from './product' import { DateTime } from "luxon"; // TODO Use separate files for specific utilities @@ -53,4 +52,4 @@ const handleDateTimeInput = (dateTimeValue: any) => { return DateTime.fromISO(dateTime).toMillis() } -export { handleDateTimeInput, showToast, hasError, copyToClipboard, productHelpers } +export { handleDateTimeInput, showToast, hasError, copyToClipboard } diff --git a/src/utils/product/index.ts b/src/utils/product/index.ts deleted file mode 100644 index 04015d8f..00000000 --- a/src/utils/product/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -const getProductIdentificationValue = (productIdentifier: string, product: any) => { - - // handled this case as on page load initially the data is not available, so not to execute furthur code - // untill product are not available - if(!Object.keys(product).length) { - return; - } - - let value = product[productIdentifier] - - // considered that the goodIdentification will always have values in the format "productIdentifier/value" and there will be no entry like "productIdentifier/" - const identification = product['goodIdentifications'].find((identification: string) => identification.startsWith(productIdentifier + "/")) - - if(identification) { - const goodIdentification = identification.split('/') - value = goodIdentification[1] - } - - return value; -} - -export default { getProductIdentificationValue } \ No newline at end of file diff --git a/src/views/AddProductModal.vue b/src/views/AddProductModal.vue index beed23d4..08abfaa0 100644 --- a/src/views/AddProductModal.vue +++ b/src/views/AddProductModal.vue @@ -20,8 +20,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) : getProduct(product.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}

{{ translate("Add to Shipment") }} @@ -69,8 +69,8 @@ import { defineComponent } from 'vue'; import { closeOutline, checkmarkCircle } from 'ionicons/icons'; import { mapGetters } from 'vuex' import { useStore } from "@/store"; -import { DxpShopifyImg, translate } from '@hotwax/dxp-components'; -import { showToast, productHelpers } from '@/utils' +import { DxpShopifyImg, translate, getProductIdentificationValue } from '@hotwax/dxp-components'; +import { showToast } from '@/utils' export default defineComponent({ name: "Modal", @@ -174,7 +174,7 @@ export default defineComponent({ checkmarkCircle, store, translate, - productHelpers + getProductIdentificationValue }; }, }); diff --git a/src/views/AddProductToPOModal.vue b/src/views/AddProductToPOModal.vue index e840b1ad..9a3f1911 100644 --- a/src/views/AddProductToPOModal.vue +++ b/src/views/AddProductToPOModal.vue @@ -19,8 +19,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) : getProduct(product.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}

{{ translate("Add to Purchase Order") }} @@ -60,8 +60,8 @@ import { defineComponent } from 'vue'; import { closeOutline, checkmarkCircle } from 'ionicons/icons'; import { mapGetters } from 'vuex' import { useStore } from "@/store"; -import { DxpShopifyImg, translate } from '@hotwax/dxp-components'; -import { showToast, productHelpers } from '@/utils' +import { DxpShopifyImg, translate, getProductIdentificationValue } from '@hotwax/dxp-components'; +import { showToast } from '@/utils' export default defineComponent({ name: "Modal", @@ -165,7 +165,7 @@ export default defineComponent({ checkmarkCircle, store, translate, - productHelpers + getProductIdentificationValue, }; }, }); diff --git a/src/views/PurchaseOrderDetail.vue b/src/views/PurchaseOrderDetail.vue index afc6d9a5..2c0472cb 100644 --- a/src/views/PurchaseOrderDetail.vue +++ b/src/views/PurchaseOrderDetail.vue @@ -56,8 +56,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

@@ -118,8 +118,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

@@ -180,7 +180,7 @@ import { import { defineComponent } from 'vue'; import { addOutline, cameraOutline, checkmarkDone, copyOutline, eyeOffOutline, eyeOutline, locationOutline, saveOutline, timeOutline } from 'ionicons/icons'; import ReceivingHistoryModal from '@/views/ReceivingHistoryModal.vue' -import { DxpShopifyImg, translate } from '@hotwax/dxp-components'; +import { DxpShopifyImg, translate, getProductIdentificationValue } from '@hotwax/dxp-components'; import { useStore, mapGetters } from 'vuex'; import { useRouter } from 'vue-router'; import Scanner from "@/components/Scanner.vue" @@ -188,7 +188,7 @@ import AddProductToPOModal from '@/views/AddProductToPOModal.vue' import ClosePurchaseOrderModal from '@/components/ClosePurchaseOrderModal.vue' import LocationPopover from '@/components/LocationPopover.vue' import ImageModal from '@/components/ImageModal.vue'; -import { copyToClipboard, hasError, productHelpers, showToast } from '@/utils'; +import { copyToClipboard, hasError, showToast } from '@/utils'; import { Actions, hasPermission } from '@/authorization' export default defineComponent({ @@ -396,12 +396,12 @@ export default defineComponent({ eyeOutline, hasPermission, locationOutline, - productHelpers, router, saveOutline, store, timeOutline, - translate + translate, + getProductIdentificationValue }; }, }); diff --git a/src/views/ReturnDetails.vue b/src/views/ReturnDetails.vue index a1809d3d..7b848e4b 100644 --- a/src/views/ReturnDetails.vue +++ b/src/views/ReturnDetails.vue @@ -41,8 +41,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

@@ -110,12 +110,12 @@ import { defineComponent } from 'vue'; import { checkmarkDone, barcodeOutline, locationOutline } from 'ionicons/icons'; import { mapGetters, useStore } from "vuex"; import AddProductModal from '@/views/AddProductModal.vue' -import { DxpShopifyImg, translate } from '@hotwax/dxp-components'; +import { DxpShopifyImg, translate, getProductIdentificationValue } from '@hotwax/dxp-components'; import { useRouter } from 'vue-router'; import Scanner from "@/components/Scanner.vue"; import ImageModal from '@/components/ImageModal.vue'; import { hasError } from '@/utils'; -import { showToast, productHelpers } from '@/utils' +import { showToast } from '@/utils' import { Actions, hasPermission } from '@/authorization' export default defineComponent({ @@ -292,9 +292,9 @@ export default defineComponent({ hasPermission, locationOutline, store, - productHelpers, router, - translate + translate, + getProductIdentificationValue }; }, }); diff --git a/src/views/ShipmentDetails.vue b/src/views/ShipmentDetails.vue index 911bf7a7..8795f519 100644 --- a/src/views/ShipmentDetails.vue +++ b/src/views/ShipmentDetails.vue @@ -39,8 +39,8 @@ -

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}

-

{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

+

{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}

+

{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}

@@ -116,12 +116,12 @@ import { defineComponent } from 'vue'; import { add, checkmarkDone, cameraOutline, locationOutline } from 'ionicons/icons'; import { mapGetters, useStore } from "vuex"; import AddProductModal from '@/views/AddProductModal.vue' -import { DxpShopifyImg, translate } from '@hotwax/dxp-components'; +import { DxpShopifyImg, translate, getProductIdentificationValue } from '@hotwax/dxp-components'; import { useRouter } from 'vue-router'; import Scanner from "@/components/Scanner.vue"; import LocationPopover from '@/components/LocationPopover.vue' import ImageModal from '@/components/ImageModal.vue'; -import { hasError, productHelpers, showToast } from '@/utils' +import { hasError, showToast } from '@/utils' import { Actions, hasPermission } from '@/authorization' export default defineComponent({ @@ -311,9 +311,9 @@ export default defineComponent({ hasPermission, locationOutline, store, - productHelpers, router, - translate + translate, + getProductIdentificationValue }; }, });