Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented feature to import CSV to reset Inventory(#31a0f22) #187

Merged
merged 62 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
73f5a9d
Initial commit(#31a0f22)
disha1202 Nov 21, 2022
66e8b1f
Implemented inventory details page(#31a0f22)
disha1202 Nov 28, 2022
e879dc5
Implemented logic to fetch facility locations and option to update fa…
disha1202 Dec 2, 2022
5fdc602
Removed unwanted code, implement logic to change locationSeqId and fi…
disha1202 Dec 5, 2022
07ad7be
Added static text in en.json file(#31a0f22)
disha1202 Dec 5, 2022
725b777
Improved code to fetch facility locations on click(#31a0f22)
disha1202 Dec 5, 2022
fee3686
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Dec 5, 2022
e8a388d
Revert "Improved code to fetch facility locations on click(#31a0f22)"
disha1202 Dec 26, 2022
9634bed
Improved code to clear stock state and redirect to inventory page aft…
disha1202 Dec 26, 2022
16d90c3
Updated code to upload csv to oms, set default locationSeqId on chang…
disha1202 Dec 26, 2022
414c73d
Added comments(#31a0f22)
disha1202 Dec 26, 2022
77e837c
Fixed: single product revert and parent product revert not working(#3…
disha1202 Dec 27, 2022
28053a9
Improved code(#31a0f22)
disha1202 Dec 27, 2022
1385720
Fixed indentation and improved component name(#31a0f22)
disha1202 Jan 2, 2023
2e4bc36
Updated code to display toast if file is not upladed or any of the fi…
disha1202 Jan 4, 2023
fd2a157
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Jan 6, 2023
d6293c8
Removed multiple imports from same file and unused variables(#31a0f22)
disha1202 Jan 6, 2023
4c761e7
Updated method name(#31a0f22)
disha1202 Jan 6, 2023
b14e9e8
Improved code formatting and updated method name(#31a0f22)
disha1202 Jan 9, 2023
4a51572
Used mixins for parsing csv file(#31a0f22)
disha1202 Jan 11, 2023
5c0a3ea
Used guard clause for field mapping(#31a0f22)
disha1202 Jan 11, 2023
e67a1c2
Used text to be displayed on alert(#31a0f22)
disha1202 Jan 11, 2023
4e25844
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Jan 11, 2023
d7130a9
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Jan 17, 2023
b29e8a6
Improved code(#31a0f22)
disha1202 Jan 30, 2023
569fc94
fix: disable alert on token expire(#31a0f22)
disha1202 Jan 30, 2023
d9e197a
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Feb 2, 2023
f18d7b4
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Feb 2, 2023
918de31
fix: errors(#31a0f22)
disha1202 Feb 2, 2023
044317c
Merge branch 'fix-select-deselect' into #31a0f22
disha1202 Feb 2, 2023
083cdda
Improved code(#31a0f22)
disha1202 Feb 2, 2023
80b4625
Removed unwanted code(#31a0f22)
disha1202 Feb 2, 2023
2b0d5f8
Updated code(#31a0f22)
disha1202 Feb 2, 2023
5d0158a
Improved code(#31a0f22)
disha1202 Feb 2, 2023
4a04d7e
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Feb 3, 2023
5cd69e2
Implemented bulk inventory adjustment modal(#31a0f22)
disha1202 Feb 6, 2023
d67608a
Implemented logic to map missing facilities(#31a0f22)
disha1202 Feb 6, 2023
c89d258
Implemented logic to update missing skus(#31a0f22)
disha1202 Feb 6, 2023
8a70310
fix: improved the handling of facilityLocations(#31a0f22)
disha1202 Feb 7, 2023
6df5352
Improved handing of facility locations and updated variable name(#31a…
disha1202 Feb 7, 2023
7b6ce26
Removed unwanted code and fixed searched prduts not updating on bulk …
disha1202 Feb 7, 2023
84cac9a
Updated component name(#31a0f22)
disha1202 Feb 7, 2023
37ff0ef
Merge branch 'main' of https://github.com/hotwax/import into #31a0f22
disha1202 Feb 7, 2023
74c4166
fix: searched product not updated on revert all(#31a0f22)
disha1202 Feb 7, 2023
8d7f470
fix: indentation and variable name(#31a0f22)
disha1202 Feb 8, 2023
0961242
fix: revert all not working as expected(#31a0f22)
disha1202 Feb 8, 2023
22c6c2b
Improved variable name(#31a0f22)
disha1202 Feb 8, 2023
24ceb70
refactor: moved logic to map missing facilities in actions(#31a0f22)
disha1202 Feb 8, 2023
6348628
refactor: used separate methods(#31a0f22)
disha1202 Feb 8, 2023
394aaf7
fix: revert on PO review page not working(#31a0f22)
disha1202 Feb 8, 2023
404f82c
refactor: moved facility locations from user state to util state(#31a…
disha1202 Feb 8, 2023
e4fe919
refactor: improved code(#31a0f22)
disha1202 Feb 8, 2023
7a0899a
Merge branch 'main' into #31a0f22
adityasharma7 Feb 13, 2023
e44e96d
Fixed: wrong alert message on page leave (#31a0f22)
adityasharma7 Feb 13, 2023
ab30e0c
Fixed: file upload not working properly as the id was same 2 pages (#…
adityasharma7 Feb 13, 2023
d824e26
Improved: fetchProducts action to return cached products (#31a0f22)
adityasharma7 Feb 13, 2023
3979ebf
Improved: getter & action name and logic to fetch facilities (#31a0f22)
adityasharma7 Feb 14, 2023
9e7ffd3
Improved: logic to show facility name instead of id (#31a0f22)
adityasharma7 Feb 14, 2023
2cadd4b
Improved: logic to get facility locations using facilityId instead of…
adityasharma7 Feb 15, 2023
1f09666
Merge branch 'main' into disha1202-#31a0f22
adityasharma7 Feb 15, 2023
1071ec1
Improved: action name (#31a0f22)
adityasharma7 Feb 15, 2023
37f2989
Merge branch 'disha1202-#31a0f22' of https://github.com/hotwax/import…
adityasharma7 Feb 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions src/components/BulkInventoryAdjustmentModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<template>
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-button @click="closeModal">
<ion-icon :icon="close" />
</ion-button>
</ion-buttons>
<ion-title>{{ $t("Bulk adjustment") }}</ion-title>
</ion-toolbar>
</ion-header>

<ion-content>
<ion-item lines="full">
<ion-label>{{ $t("Buffer quantity") }}</ion-label>
<ion-input v-model="quantityBuffer" type="number" min="0" :placeholder = "$t('Quantity')" />
</ion-item>

<ion-item>
<ion-label>{{ $t("Facility") }}</ion-label>
<ion-select interface="popover" v-model="facilityId">
<ion-select-option v-for="facility in facilities" :key="facility.facilityId" :value="facility.facilityId">{{ facility.facilityName }}</ion-select-option>
</ion-select>
</ion-item>

<ion-fab vertical="bottom" horizontal="end" slot="fixed">
<ion-fab-button @click="save">
<ion-icon :icon="saveOutline" />
</ion-fab-button>
</ion-fab>
</ion-content>
</template>
<script lang="ts">
import {
IonButtons,
IonButton,
IonContent,
IonFab,
IonFabButton,
IonHeader,
IonItem,
IonIcon,
IonInput,
IonLabel,
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar,
modalController,
} from "@ionic/vue";
import { defineComponent } from "vue";
import { close, saveOutline } from "ionicons/icons";
import { useStore } from "@/store";
import { mapGetters } from "vuex";
import { showToast } from "@/utils";
import { translate } from "@/i18n";
export default defineComponent({
name: "BulkInventoryAdjustmentModal",
components: {
IonButtons,
IonButton,
IonContent,
IonFab,
IonFabButton,
IonHeader,
IonIcon,
IonItem,
IonInput,
IonLabel,
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar
},
data() {
return {
quantityBuffer: 0,
facilityId: "",
}
},
computed: {
...mapGetters({
stockItems: 'stock/getStockItems',
facilities: 'util/getFacilities',
})
},
methods: {
closeModal() {
modalController.dismiss({ dismissed: true });
},
async save() {
const facilityLocations = await this.store.dispatch('util/fetchFacilityLocations', [this.facilityId]);
const locationSeqId = facilityLocations[this.facilityId] && facilityLocations[this.facilityId][0] ? facilityLocations[this.facilityId][0].locationSeqId : '';
this.stockItems.parsed.map((item: any) => {
if (item.isSelected) {
item.quantity -= this.quantityBuffer;
if(this.facilityId) {
item.facilityId = this.facilityId;
item.externalFacilityId = "";
item.locationSeqId = locationSeqId;
}
}
})
await this.store.dispatch('stock/updateStockItems', this.stockItems)
this.closeModal();
showToast(translate("Changes have been successfully applied"));
},
},
setup() {
const store = useStore();
return {
close,
saveOutline,
store
};
},
});
</script>
10 changes: 9 additions & 1 deletion src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ import {
} from "@ionic/vue";
import { defineComponent, ref } from "vue";
import { mapGetters } from "vuex";
import { bookmarkOutline, settings, calendar } from "ionicons/icons";

import { albumsOutline, bookmarkOutline, settings, calendar } from "ionicons/icons";
import { useStore } from "@/store";

export default defineComponent({
Expand Down Expand Up @@ -100,6 +101,12 @@ export default defineComponent({
const store = useStore();
const selectedIndex = ref(0);
const appPages = [
{
title: "Inventory",
url: "/inventory",
iosIcon: albumsOutline,
mdIcon: albumsOutline
},
{
title: "Purchase order",
url: "/purchase-order",
Expand All @@ -122,6 +129,7 @@ export default defineComponent({
return {
selectedIndex,
appPages,
albumsOutline,
calendar,
settings,
store
Expand Down
23 changes: 11 additions & 12 deletions src/components/MissingFacilitiesModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default defineComponent({
IonTitle,
IonToolbar
},
props: ["itemsWithMissingFacility", "facilities"],
props: ["itemsWithMissingFacility", "type"],
data() {
return {
itemsByFacilityId: {},
Expand All @@ -79,23 +79,22 @@ export default defineComponent({
},
computed: {
...mapGetters({
purchaseOrders: 'order/getPurchaseOrders'
purchaseOrders: 'order/getPurchaseOrders',
stockItems: 'stock/getStockItems',
facilities: 'util/getFacilities',
})
},
mounted(){
this.groupItemsByFacilityId();
},
methods: {
save(){
Object.keys(this.facilityMapping).map((facilityId: any) => {
Object.values(this.purchaseOrders.parsed).flat().map((item: any) => {
if(item.externalFacilityId === facilityId){
item.externalFacilityId = "";
item.facilityId = this.facilityMapping[facilityId];
}
})
})
this.store.dispatch('order/updatePurchaseOrders', this.purchaseOrders);
async save(){
if(this.type === 'order'){
this.store.dispatch('order/updateMissingFacilities', this.facilityMapping)
} else {
this.store.dispatch('stock/updateMissingFacilities', this.facilityMapping)
}

this.closeModal();
showToast(translate("Changes have been successfully applied"));
},
Expand Down
52 changes: 32 additions & 20 deletions src/components/MissingSkuModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div>
<ion-item id="update-sku" :class="isSkuInvalid ? 'ion-invalid' : ''">
<ion-input v-model="updatedSku" :clear-input="true" :placeholder="$t('Select SKU')" @ionFocus="selectInputText($event)" />
<ion-note v-show="hasSkuUpdated && purchaseOrders.unidentifiedItems.length" slot="helper" color="success">{{ $t("The SKU is successfully changed") }}</ion-note>
<ion-note v-show="hasSkuUpdated && (purchaseOrders.unidentifiedItems.length || stockItems.unidentifiedItems.length)" slot="helper" color="success">{{ $t("The SKU is successfully changed") }}</ion-note>
<ion-note slot="error">{{ $t("This SKU is not available, please try again") }}</ion-note>
</ion-item>
<ion-button @click="update" :disabled="!(unidentifiedProductSku && updatedSku)">{{ $t("Update") }}</ion-button>
Expand Down Expand Up @@ -116,14 +116,20 @@ export default defineComponent({
updatedSku: '',
unidentifiedProductSku: '',
hasSkuUpdated: false,
isSkuInvalid: false
isSkuInvalid: false,
unidentifiedItems: [] as any
}
},
computed: {
...mapGetters({
purchaseOrders: 'order/getPurchaseOrders',
stockItems: 'stock/getStockItems',
})
},
mounted() {
this.unidentifiedItems = this.type ==='order' ? this.purchaseOrders.unidentifiedItems : this.stockItems.unidentifiedItems;
},
props: ['type'],
methods: {
selectInputText(event: any) {
event.target.getInputElement().then((element: any) => {
Expand All @@ -134,13 +140,14 @@ export default defineComponent({
modalController.dismiss({ dismissed: true });
},
getPendingItems(){
return this.purchaseOrders.unidentifiedItems.filter((item: any) => !item.updatedSku);
return this.unidentifiedItems.filter((item: any) => !item.updatedSku);
},
getCompletedItems(){
return this.purchaseOrders.unidentifiedItems.filter((item: any) => item.updatedSku);
return this.unidentifiedItems.filter((item: any) => item.updatedSku);
},
save(){
this.store.dispatch('order/updateUnidentifiedItem', { unidentifiedItems: this.purchaseOrders.unidentifiedItems });
save() {
if(this.type === 'order') this.store.dispatch('order/updateUnidentifiedItem', { unidentifiedItems: this.purchaseOrders.unidentifiedItems });
else this.store.dispatch('stock/updateUnidentifiedItem', { unidentifiedItems: this.stockItems.unidentifiedItems });
this.closeModal();
},
async update() {
Expand All @@ -152,22 +159,27 @@ export default defineComponent({
productIds: [this.updatedSku]
}
const products = await this.store.dispatch("product/fetchProducts", payload);
if (products.length) {
const item = products[0];
const unidentifiedItem = this.purchaseOrders.unidentifiedItems.find((unidentifiedItem: any) => unidentifiedItem.shopifyProductSKU === this.unidentifiedProductSku);

unidentifiedItem.updatedSku = this.updatedSku;
unidentifiedItem.parentProductId = item.parent.id;
unidentifiedItem.pseudoId = item.pseudoId;
unidentifiedItem.parentProductName = item.parent.productName;
unidentifiedItem.imageUrl = item.images.mainImageUrl;
unidentifiedItem.isNewProduct = "N";
unidentifiedItem.isSelected = true;

this.hasSkuUpdated = true;
const product = products[this.updatedSku];
if (!product) {
this.isSkuInvalid = true;
return;
}

const unidentifiedItem = this.unidentifiedItems.find((unidentifiedItem: any) => unidentifiedItem.shopifyProductSKU === this.unidentifiedProductSku);

unidentifiedItem.updatedSku = this.updatedSku;
unidentifiedItem.parentProductId = product.parent.id;
unidentifiedItem.pseudoId = product.pseudoId;
unidentifiedItem.parentProductName = product.parent.productName;
unidentifiedItem.imageUrl = product.images.mainImageUrl;
unidentifiedItem.isSelected = true;

this.hasSkuUpdated = true;
if (this.type === 'order'){
unidentifiedItem.isNewProduct = 'N';
this.store.dispatch('order/updatePurchaseOrders', this.purchaseOrders);
} else {
this.isSkuInvalid = true;
this.store.dispatch('stock/updateStockItems', this.stockItems);
}
},
},
Expand Down
Loading