Skip to content

Commit

Permalink
Improved: using function from dxp-component & add productName check(h…
Browse files Browse the repository at this point in the history
  • Loading branch information
R-Sourabh committed Apr 30, 2024
1 parent a4ae986 commit 38a8100
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 60 deletions.
11 changes: 5 additions & 6 deletions src/components/ClosePurchaseOrderModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<DxpShopifyImg size="small" :src="getProduct(item.productId).mainImageUrl" />
</ion-thumbnail>
<ion-label>
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
<ion-buttons>
<ion-checkbox aria-label="itemStatus" slot="end" :modelValue="isPOItemStatusPending(item) ? item.isChecked : true" :disabled="isPOItemStatusPending(item) ? false : true" />
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -215,11 +214,11 @@ export default defineComponent({
checkmarkCircle,
hasPermission,
OrderService,
productHelpers,
router,
saveOutline,
store,
translate
translate,
getProductIdentificationValue
};
}
});
Expand Down
3 changes: 1 addition & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -53,4 +52,4 @@ const handleDateTimeInput = (dateTimeValue: any) => {
return DateTime.fromISO(dateTime).toMillis()
}

export { handleDateTimeInput, showToast, hasError, copyToClipboard, productHelpers }
export { handleDateTimeInput, showToast, hasError, copyToClipboard }
22 changes: 0 additions & 22 deletions src/utils/product/index.ts

This file was deleted.

10 changes: 5 additions & 5 deletions src/views/AddProductModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</ion-thumbnail>
<ion-label>
<!-- Honouring the identifications set by the user on the settings page -->
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) : getProduct(product.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}</p>
</ion-label>
<ion-icon v-if="isProductAvailableInShipment(product.productId)" color="success" :icon="checkmarkCircle" />
<ion-button v-else fill="outline" @click="addtoShipment(product)">{{ translate("Add to Shipment") }}</ion-button>
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -174,7 +174,7 @@ export default defineComponent({
checkmarkCircle,
store,
translate,
productHelpers
getProductIdentificationValue
};
},
});
Expand Down
10 changes: 5 additions & 5 deletions src/views/AddProductToPOModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
</ion-thumbnail>
<ion-label>
<!-- Honouring the identifications set by the user on the settings page -->
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(product.productId)) : getProduct(product.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(product.productId)) }}</p>
</ion-label>
<ion-icon v-if="isProductAvailableInOrder(product.productId)" color="success" :icon="checkmarkCircle" />
<ion-button v-else fill="outline" @click="addtoOrder(product)">{{ translate("Add to Purchase Order") }}</ion-button>
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -165,7 +165,7 @@ export default defineComponent({
checkmarkCircle,
store,
translate,
productHelpers
getProductIdentificationValue,
};
},
});
Expand Down
16 changes: 8 additions & 8 deletions src/views/PurchaseOrderDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<DxpShopifyImg size="small" :src="getProduct(item.productId).mainImageUrl" />
</ion-thumbnail>
<ion-label class="ion-text-wrap">
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
</ion-item>
</div>
Expand Down Expand Up @@ -118,8 +118,8 @@
<DxpShopifyImg size="small" :src="getProduct(item.productId).mainImageUrl" />
</ion-thumbnail>
<ion-label class="ion-text-wrap">
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
</ion-item>
</div>
Expand Down Expand Up @@ -180,15 +180,15 @@ 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"
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({
Expand Down Expand Up @@ -396,12 +396,12 @@ export default defineComponent({
eyeOutline,
hasPermission,
locationOutline,
productHelpers,
router,
saveOutline,
store,
timeOutline,
translate
translate,
getProductIdentificationValue
};
},
});
Expand Down
12 changes: 6 additions & 6 deletions src/views/ReturnDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
<DxpShopifyImg :src="getProduct(item.productId).mainImageUrl" />
</ion-thumbnail>
<ion-label class="ion-text-wrap">
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
</ion-item>
</div>
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -292,9 +292,9 @@ export default defineComponent({
hasPermission,
locationOutline,
store,
productHelpers,
router,
translate
translate,
getProductIdentificationValue
};
},
});
Expand Down
12 changes: 6 additions & 6 deletions src/views/ShipmentDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<DxpShopifyImg :src="getProduct(item.productId).mainImageUrl" />
</ion-thumbnail>
<ion-label class="ion-text-wrap">
<h2>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) }}</h2>
<p>{{ productHelpers.getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) ? getProductIdentificationValue(productIdentificationPref.primaryId, getProduct(item.productId)) : getProduct(item.productId).productName }}</h2>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, getProduct(item.productId)) }}</p>
</ion-label>
</ion-item>
</div>
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -311,9 +311,9 @@ export default defineComponent({
hasPermission,
locationOutline,
store,
productHelpers,
router,
translate
translate,
getProductIdentificationValue
};
},
});
Expand Down

0 comments on commit 38a8100

Please sign in to comment.