Skip to content

Commit

Permalink
Merge pull request #204 from amansinghbais/inventory-count/#178-produ…
Browse files Browse the repository at this point in the history
…ctIdentifier

Implemented: product identifier component in settings page from dxp-components (dxp-178)
  • Loading branch information
ymaheshwari1 authored Jan 9, 2024
2 parents a6b2369 + 06d65c9 commit 3c48286
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@casl/ability": "^6.0.0",
"@hotwax/app-version-info": "^1.0.0",
"@hotwax/apps-theme": "^1.2.6",
"@hotwax/dxp-components": "^1.7.5",
"@hotwax/dxp-components": "^1.8.0",
"@hotwax/oms-api": "^1.10.0",
"@ionic/core": "^7.6.0",
"@ionic/vue": "^7.6.0",
Expand Down
8 changes: 7 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import TabBar from "./components/TabBar.vue"
import { mapGetters, useStore } from 'vuex';
import { initialise, resetConfig } from '@/adapter'
import { useRouter } from 'vue-router';
import { useProductIdentificationStore } from '@hotwax/dxp-components';
export default defineComponent({
name: 'App',
Expand Down Expand Up @@ -77,6 +78,10 @@ export default defineComponent({
});
emitter.on('presentLoader', this.presentLoader);
emitter.on('dismissLoader', this.dismissLoader);
// Get product identification from api using dxp-component
await useProductIdentificationStore().getIdentificationPref(this.currentEComStore?.productStoreId)
.catch((error) => console.error(error));
},
created() {
initialise({
Expand Down Expand Up @@ -107,7 +112,8 @@ export default defineComponent({
},
...mapGetters({
userToken: 'user/getUserToken',
instanceUrl: 'user/getInstanceUrl'
instanceUrl: 'user/getInstanceUrl',
currentEComStore: 'user/getCurrentEComStore'
})
},
setup() {
Expand Down
4 changes: 3 additions & 1 deletion src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { api, client, getConfig, getUserFacilities, initialise, logout, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api'
import { api, client, getConfig, getProductIdentificationPref, getUserFacilities, initialise, logout, resetConfig, setProductIdentificationPref, updateInstanceUrl, updateToken } from '@hotwax/oms-api'

export {
api,
client,
getConfig,
getProductIdentificationPref,
getUserFacilities,
initialise,
logout,
resetConfig,
setProductIdentificationPref,
updateInstanceUrl,
updateToken
}
12 changes: 8 additions & 4 deletions src/components/ProductListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
<ShopifyImg :src="product.mainImageUrl" size="small" />
</ion-thumbnail>
<ion-label>
<p>{{ product.productName }}</p>
<h3>{{ product.sku }}</h3>
<p>{{ getProductIdentificationValue(productIdentificationPref.secondaryId, product) }}</p>
<h3>{{ getProductIdentificationValue(productIdentificationPref.primaryId, product) ? getProductIdentificationValue(productIdentificationPref.primaryId, product) : product.productName }}</h3>
<p>{{$filters.getFeature(product.featureHierarchy, '1/COLOR/')}} {{$filters.getFeature(product.featureHierarchy, '1/COLOR/') && $filters.getFeature(product.featureHierarchy, '1/SIZE/')? "|" : ""}} {{$filters.getFeature(product.featureHierarchy, '1/SIZE/')}}</p>
</ion-label>
</ion-item>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { computed, defineComponent } from 'vue'
import {
IonItem,
IonThumbnail,
IonLabel
} from '@ionic/vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex';
import { ShopifyImg } from '@hotwax/dxp-components';
import { getProductIdentificationValue, ShopifyImg, useProductIdentificationStore } from '@hotwax/dxp-components';
export default defineComponent({
name: "ProductListItem",
Expand All @@ -39,8 +39,12 @@ export default defineComponent({
setup() {
const router = useRouter();
const store = useStore();
const productIdentificationStore = useProductIdentificationStore();
let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref)
return {
getProductIdentificationValue,
productIdentificationPref,
router,
store
}
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import permissionRules from '@/authorization/Rules';
import permissionActions from '@/authorization/Actions';
import { dxpComponents } from '@hotwax/dxp-components'
import { login, logout, loader } from './user-utils';
import { getConfig, initialise } from '@/adapter'
import { getConfig, getProductIdentificationPref, initialise, setProductIdentificationPref } from '@/adapter';

const app = createApp(App)
.use(IonicVue, {
Expand All @@ -53,7 +53,9 @@ const app = createApp(App)
loader,
appLoginUrl: process.env.VUE_APP_LOGIN_URL as string,
getConfig,
initialise
getProductIdentificationPref,
initialise,
setProductIdentificationPref
});

// Filters are removed in Vue 3 and global filter introduced https://v3.vuejs.org/guide/migration/filters.html#global-filters
Expand Down
6 changes: 5 additions & 1 deletion src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
resetPermissions,
setPermissions
} from '@/authorization'
import { useAuthStore } from '@hotwax/dxp-components'
import { useAuthStore, useProductIdentificationStore } from '@hotwax/dxp-components'
import emitter from '@/event-bus'
import store from '@/store'

Expand Down Expand Up @@ -91,6 +91,10 @@ const actions: ActionTree<UserState, RootState> = {
commit(types.USER_PERMISSIONS_UPDATED, appPermissions);
commit(types.USER_VIEW_QOH_CNFG_UPDATED, { currentQOHViewConfig, viewQOH: currentQOHViewConfig.settingValue == "true" })
commit(types.USER_TOKEN_CHANGED, { newToken: token })

// Get product identification from api using dxp-component
await useProductIdentificationStore().getIdentificationPref(currentEComStore?.productStoreId)
.catch((error) => console.error(error));
} catch (err: any) {
// If any of the API call in try block has status code other than 2xx it will be handled in common catch block.
// TODO Check if handling of specific status codes is required.
Expand Down
2 changes: 2 additions & 0 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
<p class="overline">{{ "Built: " + getDateTime(appInfo.builtTime) }}</p>
</div>
<section>
<ProductIdentifier />

<ion-card>
<ion-card-header>
<ion-card-title>
Expand Down
18 changes: 11 additions & 7 deletions src/views/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<ShopifyImg :src="product.mainImageUrl" size="small"/>
</ion-thumbnail>
<ion-label @click="viewProduct(product)">
<p class="overline">{{ product.productName }}</p>
<h2>{{ product.sku }}</h2>
<p class="overline">{{ getProductIdentificationValue(productIdentificationPref.secondaryId, product) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, product) ? getProductIdentificationValue(productIdentificationPref.primaryId, product) : product.productName }}</h2>
</ion-label>
<ion-badge slot="end" color="dark">{{ product.quantity }}</ion-badge>
</ion-item>
Expand Down Expand Up @@ -66,11 +66,11 @@ import {
IonTitle,
IonToolbar,
} from '@ionic/vue';
import { defineComponent } from 'vue';
import { computed, defineComponent } from 'vue';
import { colorPaletteOutline, resize, cloudUploadOutline } from 'ionicons/icons';
import { mapGetters, useStore } from 'vuex';
import { useRouter } from 'vue-router';
import { ShopifyImg } from '@hotwax/dxp-components';
import { getProductIdentificationValue, ShopifyImg , useProductIdentificationStore } from '@hotwax/dxp-components';
import { Actions, hasPermission } from '@/authorization';
import { showToast } from '@/utils';
Expand Down Expand Up @@ -138,15 +138,19 @@ export default defineComponent({
setup() {
const store = useStore();
const router = useRouter();
const productIdentificationStore = useProductIdentificationStore();
let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref)
return {
Actions,
cloudUploadOutline,
colorPaletteOutline,
getProductIdentificationValue,
hasPermission,
store,
productIdentificationPref,
router,
colorPaletteOutline,
resize,
cloudUploadOutline
store,
};
},
});
Expand Down
12 changes: 8 additions & 4 deletions src/views/count.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<div class="product-info">
<ion-item lines="none">
<ion-label>
<p class="overline">{{ product.productName }}</p>
<h2>{{ product.sku }}</h2>
<p class="overline">{{ getProductIdentificationValue(productIdentificationPref.secondaryId, product) }}</p>
<h2>{{ getProductIdentificationValue(productIdentificationPref.primaryId, product) ? getProductIdentificationValue(productIdentificationPref.primaryId, product) : product.productName }}</h2>
</ion-label>
</ion-item>

Expand Down Expand Up @@ -124,13 +124,13 @@
IonToolbar,
pickerController
} from "@ionic/vue";
import { defineComponent } from "vue";
import { computed, defineComponent } from "vue";
import { cloudUploadOutline, colorPaletteOutline, locationOutline, resize, saveOutline } from "ionicons/icons";
import { mapGetters, useStore } from "vuex";
import { hasError, showToast } from "@/utils";
import { translate } from "@/i18n";
import { useRouter } from "vue-router";
import { ShopifyImg } from "@hotwax/dxp-components";
import { getProductIdentificationValue, ShopifyImg, useProductIdentificationStore } from "@hotwax/dxp-components";
import { UtilService } from "@/services/UtilService";
import { ProductService } from '@/services/ProductService';
import { StockService } from '@/services/StockService';
Expand Down Expand Up @@ -372,13 +372,17 @@
setup() {
const store = useStore();
const router = useRouter();
const productIdentificationStore = useProductIdentificationStore();
let productIdentificationPref = computed(() => productIdentificationStore.getProductIdentificationPref)
return {
Actions,
cloudUploadOutline,
colorPaletteOutline,
getProductIdentificationValue,
hasPermission,
locationOutline,
productIdentificationPref,
resize,
router,
saveOutline,
Expand Down

0 comments on commit 3c48286

Please sign in to comment.