From eaf22a1bbfdc49efd041d284817a23c608b7ed54 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Wed, 22 Oct 2025 17:49:52 +0530 Subject: [PATCH 01/37] feat: translations & check design stock for cart --- public/locales/de/common.json | 4 +++- public/locales/en/common.json | 4 +++- public/locales/es/common.json | 4 +++- public/locales/fr/common.json | 4 +++- public/locales/it/common.json | 4 +++- store/slices/cart-slices/cart-local-slice.ts | 2 +- utils/api-sdk-registry/emr_api_sdk_registry.ts | 1 + 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 0fa0668b..d0543d59 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -322,5 +322,7 @@ "Item Selected": "Artikel ausgewählt", "Apply": "Anwenden", "Stock Cart": "Warenkorb", - "profile": "Profil" + "profile": "Profil", + "available_in_stock": "Auf Lager", + "no_item_found": "Kein Artikel gefunden" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index ae736c9d..cc0f2ed0 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -322,5 +322,7 @@ "Item Selected": "Item Selected", "Apply": "Apply", "Stock Cart": "Stock Cart", - "profile": "Profile" + "profile": "Profile", + "available_in_stock": "Available in Stock", + "no_item_found": "No item found" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 3b0cbb0f..526aee1c 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -322,5 +322,7 @@ "Item Selected": "Artículo seleccionado", "Apply": "Aplicar", "Stock Cart": "Carrito de stock", - "profile": "Perfil" + "profile": "Perfil", + "available_in_stock": "Disponible en stock", + "no_item_found": "No se encontró ningún artículo" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 2ab5757e..1a62158a 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -322,5 +322,7 @@ "Item Selected": "Article sélectionné", "Apply": "Appliquer", "Stock Cart": "Panier de stock", - "profile": "Profil" + "profile": "Profil", + "available_in_stock": "Disponible en stock", + "no_item_found": "Aucun article trouvé" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 65a22d2f..0851439c 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -322,5 +322,7 @@ "Item Selected": "Articolo selezionato", "Apply": "Applica", "Stock Cart": "Carrello scorte", - "profile": "Profilo" + "profile": "Profilo", + "available_in_stock": "Disponibile in magazzino", + "no_item_found": "Nessun articolo trovato" } \ No newline at end of file diff --git a/store/slices/cart-slices/cart-local-slice.ts b/store/slices/cart-slices/cart-local-slice.ts index a2d12f4b..d841ca56 100644 --- a/store/slices/cart-slices/cart-local-slice.ts +++ b/store/slices/cart-slices/cart-local-slice.ts @@ -25,7 +25,7 @@ const cartSlice = createSlice({ reducers: { addCartList: (state, action) => { state.items = action.payload?.cartData; - state.cartCount = state?.items?.length || 0; + state.cartCount = action.payload.cartCount; state.grandTotal = action.payload.grandTotal; state.quotation_Id = action?.payload?.quotationId; }, diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index ffb836c3..c0d288cd 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -36,6 +36,7 @@ const emrAPISDKRegistry: any = { 'verify-reset-password-token-api': '/api/verifyLink', 'get-filtered-sales-customer-api' : '/api/getFilteredSalesCustomer', 'get-rate-look-up-options-api': '/api/getPLlist', + 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT' }; export default emrAPISDKRegistry; From 2127737a0ec0a0eee12ead14904ec0a0c1591b59 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 24 Oct 2025 11:32:36 +0530 Subject: [PATCH 02/37] feat: add currentScope state and setCurrentScope reducer to KCSlice --- store/slices/general_slices/kc-slice.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index e7443f7f..30dea920 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -33,6 +33,7 @@ export const KCSlice = createSlice({ 'Stock Cart': { selectedScope: { label: 'Stock Cart', value: 'Stock Cart' } }, Voucher: { selectedScope: { label: 'Voucher', value: 'Voucher' } }, }, + currentScope: 'Database', }, reducers: { setHideFiltersOnFirstLoad: (state, action) => { @@ -65,9 +66,12 @@ export const KCSlice = createSlice({ setFiltersSetOfAPI: (state, action) => { state.filtersSetOfAPI = action.payload; }, + setCurrentScope: (state, action) => { + state.currentScope = action.payload; + }, }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From 0885860dece19b4b633b0cec7ab305cbd9cd6a79 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 20 Nov 2025 17:57:36 +0530 Subject: [PATCH 03/37] feat: transaltions for additional inputs --- public/locales/de/common.json | 3 ++- public/locales/en/common.json | 14 +++++++++++++- public/locales/es/common.json | 3 ++- public/locales/fr/common.json | 3 ++- public/locales/it/common.json | 3 ++- utils/api-sdk-registry/emr_api_sdk_registry.ts | 4 +++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index d0543d59..20f4a6ee 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -324,5 +324,6 @@ "Stock Cart": "Warenkorb", "profile": "Profil", "available_in_stock": "Auf Lager", - "no_item_found": "Kein Artikel gefunden" + "no_item_found": "Kein Artikel gefunden", + "copy_stock_id": "Bestands-ID kopieren" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index cc0f2ed0..6cc7ad7a 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -324,5 +324,17 @@ "Stock Cart": "Stock Cart", "profile": "Profile", "available_in_stock": "Available in Stock", - "no_item_found": "No item found" + "no_item_found": "No item found", + "copy_stock_id": "Copy Stock Id", + "refresh": "Refresh", + "refresh_rate": "Refresh Rate", + "copy_with_rate" : "Copy With Rate", + "rm_category": "Rm Category", + "date": "Date", + "copy_lab_rate": "Copy Lab Rate", + "voucher_odNo": "Voucher OdNo", + "voucher_date": "Voucher Date", + "select": "Select", + "from": "From", + "to": "To" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 526aee1c..6a37a17f 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -324,5 +324,6 @@ "Stock Cart": "Carrito de stock", "profile": "Perfil", "available_in_stock": "Disponible en stock", - "no_item_found": "No se encontró ningún artículo" + "no_item_found": "No se encontró ningún artículo", + "copy_stock_id": "Copiar ID de stock" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 1a62158a..800cf847 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -324,5 +324,6 @@ "Stock Cart": "Panier de stock", "profile": "Profil", "available_in_stock": "Disponible en stock", - "no_item_found": "Aucun article trouvé" + "no_item_found": "Aucun article trouvé", + "copy_stock_id": "Copier l’identifiant du stock" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 0851439c..77272e76 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -324,5 +324,6 @@ "Stock Cart": "Carrello scorte", "profile": "Profilo", "available_in_stock": "Disponibile in magazzino", - "no_item_found": "Nessun articolo trovato" + "no_item_found": "Nessun articolo trovato", + "copy_stock_id": "Copia ID stock" } \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index c0d288cd..724b8247 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -36,7 +36,9 @@ const emrAPISDKRegistry: any = { 'verify-reset-password-token-api': '/api/verifyLink', 'get-filtered-sales-customer-api' : '/api/getFilteredSalesCustomer', 'get-rate-look-up-options-api': '/api/getPLlist', - 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT' + 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT', + 'refresh-voucher-rate-api': '/api/refreshRates', + 'get-refresh-rate-param-api': '/api/getParamList' }; export default emrAPISDKRegistry; From 7166493886287d39417cf2754ea6729eb8734ad6 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 21 Nov 2025 14:01:35 +0530 Subject: [PATCH 04/37] feat: add grade change param list api --- .../useProductDetail.ts | 23 +++++++++++++++++++ public/locales/de/common.json | 14 ++++++++++- public/locales/en/common.json | 3 ++- public/locales/es/common.json | 14 ++++++++++- public/locales/fr/common.json | 14 ++++++++++- public/locales/it/common.json | 14 ++++++++++- 6 files changed, 77 insertions(+), 5 deletions(-) diff --git a/hooks/ProductDetailPageHooks/useProductDetail.ts b/hooks/ProductDetailPageHooks/useProductDetail.ts index e9b1a329..2325bc83 100644 --- a/hooks/ProductDetailPageHooks/useProductDetail.ts +++ b/hooks/ProductDetailPageHooks/useProductDetail.ts @@ -40,6 +40,8 @@ const useProductDetail = () => { quantity: productDetailData?.min_order_qty || 1, }, ]); + const [gradeChangeList, setGradeChangeList] = useState([]); + const handleMultipleQtyChange = (index: number, itemCode: string, value: string) => { setItemList((prevItemList: any) => { if (!Array.isArray(prevItemList)) { @@ -164,6 +166,25 @@ const useProductDetail = () => { } } }; + + const getGradeChangeParamsList = async () => { + const apiData = { + typ: 'CPYRT', + } + const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-refresh-rate-param-api', apiData, TokenFromStore?.token); + if (getGradeChangeParamsData?.status === 200 && getGradeChangeParamsData?.data?.msg === 'success') { + setGradeChangeList(getGradeChangeParamsData?.data?.data.map((item: any) => ( + { + label: item.Pmcd, + value: item.Pmcd, + } + ))); + } else { + const errorMessage = getGradeChangeParamsData?.data?.error + console.error('Error', errorMessage); + } + }; + const debouncedSetValue = debounce((pinCode: string) => { const found = pinCodeData.some((pin) => pin.name === pinCode); setValidPinCode(found); @@ -176,6 +197,7 @@ const useProductDetail = () => { useEffect(() => { fetchProductDetailDataAPI(); + getGradeChangeParamsList(); // }, [query?.productId]); }, [query?.productId, selectedCurrency]); @@ -198,6 +220,7 @@ const useProductDetail = () => { validPinCode, getPincodesList, checkPinCodeExists, + gradeChangeList, }; }; diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 20f4a6ee..20b21f26 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -325,5 +325,17 @@ "profile": "Profil", "available_in_stock": "Auf Lager", "no_item_found": "Kein Artikel gefunden", - "copy_stock_id": "Bestands-ID kopieren" + "copy_stock_id": "Bestands-ID kopieren", + "refresh": "Aktualisieren", + "refresh_rate": "Aktualisierungsrate", + "copy_with_rate": "Mit Rate kopieren", + "rm_category": "RM-Kategorie", + "date": "Datum", + "copy_lab_rate": "Laborsatz kopieren", + "voucher_odNo": "Beleg OdNr", + "voucher_date": "Belegdatum", + "select": "Auswählen", + "from": "Von", + "to": "Bis", + "grade_change": "Gradänderung" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 6cc7ad7a..efed26fe 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -336,5 +336,6 @@ "voucher_date": "Voucher Date", "select": "Select", "from": "From", - "to": "To" + "to": "To", + "grade_change": "Grade Change" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 6a37a17f..008471fe 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -325,5 +325,17 @@ "profile": "Perfil", "available_in_stock": "Disponible en stock", "no_item_found": "No se encontró ningún artículo", - "copy_stock_id": "Copiar ID de stock" + "copy_stock_id": "Copiar ID de stock", + "refresh": "Actualizar", + "refresh_rate": "Frecuencia de actualización", + "copy_with_rate": "Copiar con tasa", + "rm_category": "Categoría RM", + "date": "Fecha", + "copy_lab_rate": "Copiar tasa de laboratorio", + "voucher_odNo": "Voucher OdNo", + "voucher_date": "Fecha del voucher", + "select": "Seleccionar", + "from": "Desde", + "to": "Hasta", + "grade_change": "Cambio de grado" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 800cf847..596ed352 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -325,5 +325,17 @@ "profile": "Profil", "available_in_stock": "Disponible en stock", "no_item_found": "Aucun article trouvé", - "copy_stock_id": "Copier l’identifiant du stock" + "copy_stock_id": "Copier l’identifiant du stock", + "refresh": "Rafraîchir", + "refresh_rate": "Taux de rafraîchissement", + "copy_with_rate": "Copier avec taux", + "rm_category": "Catégorie RM", + "date": "Date", + "copy_lab_rate": "Copier le taux de labo", + "voucher_odNo": "Bon OdNo", + "voucher_date": "Date du bon", + "select": "Sélectionner", + "from": "De", + "to": "À", + "grade_change": "Changement de grade" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 77272e76..e4d73a4f 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -325,5 +325,17 @@ "profile": "Profilo", "available_in_stock": "Disponibile in magazzino", "no_item_found": "Nessun articolo trovato", - "copy_stock_id": "Copia ID stock" + "copy_stock_id": "Copia ID stock", + "refresh": "Aggiorna", + "refresh_rate": "Frequenza di aggiornamento", + "copy_with_rate": "Copia con tariffa", + "rm_category": "Categoria RM", + "date": "Data", + "copy_lab_rate": "Copia tariffa laboratorio", + "voucher_odNo": "Voucher OdNo", + "voucher_date": "Data del voucher", + "select": "Seleziona", + "from": "Da", + "to": "A", + "grade_change": "Cambio di grado" } \ No newline at end of file From 75d7d8d7d82e333404577094dd34451c620e700d Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 21 Nov 2025 14:01:35 +0530 Subject: [PATCH 05/37] feat: add grade change param list api --- .../useProductDetail.ts | 24 +++++++++++++++++++ public/locales/de/common.json | 14 ++++++++++- public/locales/en/common.json | 3 ++- public/locales/es/common.json | 14 ++++++++++- public/locales/fr/common.json | 14 ++++++++++- public/locales/it/common.json | 14 ++++++++++- 6 files changed, 78 insertions(+), 5 deletions(-) diff --git a/hooks/ProductDetailPageHooks/useProductDetail.ts b/hooks/ProductDetailPageHooks/useProductDetail.ts index e9b1a329..94a9c151 100644 --- a/hooks/ProductDetailPageHooks/useProductDetail.ts +++ b/hooks/ProductDetailPageHooks/useProductDetail.ts @@ -40,6 +40,8 @@ const useProductDetail = () => { quantity: productDetailData?.min_order_qty || 1, }, ]); + const [gradeChangeList, setGradeChangeList] = useState([]); + const handleMultipleQtyChange = (index: number, itemCode: string, value: string) => { setItemList((prevItemList: any) => { if (!Array.isArray(prevItemList)) { @@ -164,6 +166,26 @@ const useProductDetail = () => { } } }; + + const getGradeChangeParamsList = async () => { + const apiData = { + mnCd: 'MET', + typ: 'GRDCD' + } + const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-refresh-rate-param-api', apiData, TokenFromStore?.token); + if (getGradeChangeParamsData?.status === 200 && getGradeChangeParamsData?.data?.msg === 'success') { + setGradeChangeList(getGradeChangeParamsData?.data?.data.map((item: any) => ( + { + label: item.Pmcd, + value: item.Pmcd, + } + ))); + } else { + const errorMessage = getGradeChangeParamsData?.data?.error + console.error('Error', errorMessage); + } + }; + const debouncedSetValue = debounce((pinCode: string) => { const found = pinCodeData.some((pin) => pin.name === pinCode); setValidPinCode(found); @@ -176,6 +198,7 @@ const useProductDetail = () => { useEffect(() => { fetchProductDetailDataAPI(); + getGradeChangeParamsList(); // }, [query?.productId]); }, [query?.productId, selectedCurrency]); @@ -198,6 +221,7 @@ const useProductDetail = () => { validPinCode, getPincodesList, checkPinCodeExists, + gradeChangeList, }; }; diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 20f4a6ee..20b21f26 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -325,5 +325,17 @@ "profile": "Profil", "available_in_stock": "Auf Lager", "no_item_found": "Kein Artikel gefunden", - "copy_stock_id": "Bestands-ID kopieren" + "copy_stock_id": "Bestands-ID kopieren", + "refresh": "Aktualisieren", + "refresh_rate": "Aktualisierungsrate", + "copy_with_rate": "Mit Rate kopieren", + "rm_category": "RM-Kategorie", + "date": "Datum", + "copy_lab_rate": "Laborsatz kopieren", + "voucher_odNo": "Beleg OdNr", + "voucher_date": "Belegdatum", + "select": "Auswählen", + "from": "Von", + "to": "Bis", + "grade_change": "Gradänderung" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 6cc7ad7a..efed26fe 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -336,5 +336,6 @@ "voucher_date": "Voucher Date", "select": "Select", "from": "From", - "to": "To" + "to": "To", + "grade_change": "Grade Change" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 6a37a17f..008471fe 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -325,5 +325,17 @@ "profile": "Perfil", "available_in_stock": "Disponible en stock", "no_item_found": "No se encontró ningún artículo", - "copy_stock_id": "Copiar ID de stock" + "copy_stock_id": "Copiar ID de stock", + "refresh": "Actualizar", + "refresh_rate": "Frecuencia de actualización", + "copy_with_rate": "Copiar con tasa", + "rm_category": "Categoría RM", + "date": "Fecha", + "copy_lab_rate": "Copiar tasa de laboratorio", + "voucher_odNo": "Voucher OdNo", + "voucher_date": "Fecha del voucher", + "select": "Seleccionar", + "from": "Desde", + "to": "Hasta", + "grade_change": "Cambio de grado" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 800cf847..596ed352 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -325,5 +325,17 @@ "profile": "Profil", "available_in_stock": "Disponible en stock", "no_item_found": "Aucun article trouvé", - "copy_stock_id": "Copier l’identifiant du stock" + "copy_stock_id": "Copier l’identifiant du stock", + "refresh": "Rafraîchir", + "refresh_rate": "Taux de rafraîchissement", + "copy_with_rate": "Copier avec taux", + "rm_category": "Catégorie RM", + "date": "Date", + "copy_lab_rate": "Copier le taux de labo", + "voucher_odNo": "Bon OdNo", + "voucher_date": "Date du bon", + "select": "Sélectionner", + "from": "De", + "to": "À", + "grade_change": "Changement de grade" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 77272e76..e4d73a4f 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -325,5 +325,17 @@ "profile": "Profilo", "available_in_stock": "Disponibile in magazzino", "no_item_found": "Nessun articolo trovato", - "copy_stock_id": "Copia ID stock" + "copy_stock_id": "Copia ID stock", + "refresh": "Aggiorna", + "refresh_rate": "Frequenza di aggiornamento", + "copy_with_rate": "Copia con tariffa", + "rm_category": "Categoria RM", + "date": "Data", + "copy_lab_rate": "Copia tariffa laboratorio", + "voucher_odNo": "Voucher OdNo", + "voucher_date": "Data del voucher", + "select": "Seleziona", + "from": "Da", + "to": "A", + "grade_change": "Cambio di grado" } \ No newline at end of file From e18c3beea2c6840982b4e04dc6ef0c9bee34a2ce Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 27 Nov 2025 18:15:30 +0530 Subject: [PATCH 06/37] feat: update translations --- .gitignore | 4 +++- public/locales/de/common.json | 6 +++++- public/locales/en/common.json | 6 +++++- public/locales/es/common.json | 6 +++++- public/locales/fr/common.json | 6 +++++- public/locales/it/common.json | 6 +++++- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 4f0fa820..19b06395 100644 --- a/.gitignore +++ b/.gitignore @@ -68,4 +68,6 @@ next-env.d.ts /pages/support /pages/support/* /pages/warranty -/services/config/theme-config.ts \ No newline at end of file +/services/config/theme-config.ts + +kc.code-workspace \ No newline at end of file diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 20b21f26..6c6a35f3 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -337,5 +337,9 @@ "select": "Auswählen", "from": "Von", "to": "Bis", - "grade_change": "Gradänderung" + "grade_change": "Gradänderung", + + "list_view": "Listenansicht", + "grid_view": "Rasteransicht", + "back": "Zurück" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index efed26fe..9d6dce7f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -337,5 +337,9 @@ "select": "Select", "from": "From", "to": "To", - "grade_change": "Grade Change" + "grade_change": "Grade Change", + + "list_view": "List View", + "grid_view": "Grid View", + "back": "Back" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 008471fe..2261b856 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -337,5 +337,9 @@ "select": "Seleccionar", "from": "Desde", "to": "Hasta", - "grade_change": "Cambio de grado" + "grade_change": "Cambio de grado", + + "list_view": "Vista de lista", + "grid_view": "Vista de cuadrícula", + "back": "Atrás" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 596ed352..ef746c3a 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -337,5 +337,9 @@ "select": "Sélectionner", "from": "De", "to": "À", - "grade_change": "Changement de grade" + "grade_change": "Changement de grade", + + "list_view": "Vue en liste", + "grid_view": "Vue en grille", + "back": "Retour" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index e4d73a4f..c1122b3e 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -337,5 +337,9 @@ "select": "Seleziona", "from": "Da", "to": "A", - "grade_change": "Cambio di grado" + "grade_change": "Cambio di grado", + + "list_view": "Vista elenco", + "grid_view": "Vista griglia", + "back": "Indietro" } \ No newline at end of file From 6495b48c2254a891438f0dfcbab27cf077d5937c Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 28 Nov 2025 15:44:27 +0530 Subject: [PATCH 07/37] feat: add diamond change parameters list API --- .../useProductDetail.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hooks/ProductDetailPageHooks/useProductDetail.ts b/hooks/ProductDetailPageHooks/useProductDetail.ts index 7d093fdb..0532776a 100644 --- a/hooks/ProductDetailPageHooks/useProductDetail.ts +++ b/hooks/ProductDetailPageHooks/useProductDetail.ts @@ -41,6 +41,7 @@ const useProductDetail = () => { }, ]); const [gradeChangeList, setGradeChangeList] = useState([]); + const [diamondChangeList, setDiamondChangeList] = useState([]); const handleMultipleQtyChange = (index: number, itemCode: string, value: string) => { setItemList((prevItemList: any) => { @@ -185,6 +186,26 @@ const useProductDetail = () => { console.error('Error', errorMessage); } }; + + const getDiamondChangeParamsList = async () => { + const apiData = { + mnCd: 'DIA', + typ: 'GRDCD' + } + const getDiamondChangeParamsData: any = await fetchProductDetailData('GET', 'get-refresh-rate-param-api', apiData, TokenFromStore?.token); + if (getDiamondChangeParamsData?.status === 200 && getDiamondChangeParamsData?.data?.msg === 'success') { + setDiamondChangeList(getDiamondChangeParamsData?.data?.data.map((item: any) => ( + { + label: item.PScd, + value: item.PScd, + } + ))); + } else { + const errorMessage = getDiamondChangeParamsData?.data?.error + console.error('Error', errorMessage); + } + }; + const debouncedSetValue = debounce((pinCode: string) => { const found = pinCodeData.some((pin) => pin.name === pinCode); setValidPinCode(found); @@ -198,6 +219,7 @@ const useProductDetail = () => { useEffect(() => { fetchProductDetailDataAPI(); getGradeChangeParamsList(); + getDiamondChangeParamsList(); // }, [query?.productId]); }, [query?.productId, selectedCurrency]); @@ -221,6 +243,7 @@ const useProductDetail = () => { getPincodesList, checkPinCodeExists, gradeChangeList, + diamondChangeList, }; }; From fb7bbe9bd0df5587bff2620f022162469d659157 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 1 Dec 2025 23:56:16 +0530 Subject: [PATCH 08/37] feat: integrate user default data handling and update API endpoints --- hooks/AuthHooks/useLoginHook.ts | 6 +++++- hooks/GeneralHooks/KCLanguageHandler.ts | 4 ++-- package.json | 1 + public/locales/en/common.json | 5 ++++- store/slices/general_slices/kc-slice.ts | 10 +++++++++- utils/api-sdk-registry/emr_api_sdk_registry.ts | 4 +++- 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index f4cce8d3..01732e39 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -14,6 +14,7 @@ import { Option } from '../../store/slices/general_slices/multilingual-slice'; import i18n from '../../i18n/i18n'; import useCurrencyLanguageHandler from '../GeneralHooks/LanguageHandler'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; +import { useUserDefaultData } from '../addon-hooks/kc-hooks/useUserData'; const useLoginHook = () => { const { AFTER_LOGIN_REDIRECT_URL } = CONSTANTS; @@ -21,6 +22,7 @@ const useLoginHook = () => { const router = useRouter(); const { t } = useTranslation('common'); const { handleCurrencyShallowUpdate, handleLanguageShallowUpdate } = useCurrencyLanguageHandler(); + const { fetchUserDefaultData } = useUserDefaultData(); const [loginForm, setLoginForm] = useState({ usr: '', pwd: '' }); const [passwordHidden, setPasswordHidden] = useState(true); const [isLoginThroughOTP, setIsLoginThroughOTP] = useState(false); @@ -53,12 +55,14 @@ const useLoginHook = () => { if (tokenData?.data?.isPwdChg !== 0) { dispatch(storeToken(tokenData?.data)); } - + handleLanguageShallowUpdate(languageDisplayOptions.find((opt: Option) => opt?.label === tokenData?.data?.language)!); handleCurrencyShallowUpdate(currencyOptions.find((opt: Option) => opt?.value === tokenData?.data?.currency)!); localStorage.setItem('selected_language', tokenData?.data?.language); localStorage.setItem('selected_currency', tokenData?.data?.currency); + + fetchUserDefaultData(tokenData?.data?.access_token); // Redirect to the home page or any other page after successful login if (tokenData?.data?.isPwdChg === 0) { router.push('/forgot_password'); diff --git a/hooks/GeneralHooks/KCLanguageHandler.ts b/hooks/GeneralHooks/KCLanguageHandler.ts index f9dd6734..fe20c63f 100644 --- a/hooks/GeneralHooks/KCLanguageHandler.ts +++ b/hooks/GeneralHooks/KCLanguageHandler.ts @@ -60,8 +60,8 @@ const useCurrencyLanguageHandler = () => { } useEffect(() => { - handleLanguageShallowUpdate(languageDisplayOptions.find((opt) => opt?.value === 'en')!); - handleCurrencyShallowUpdate(currencyOptions.find((opt) => opt?.value === 'RS')!); + handleLanguageShallowUpdate(selectedLanguage); + handleCurrencyShallowUpdate(selectedCurrency); },[selectedCurrency, selectedLanguage]); return { diff --git a/package.json b/package.json index a87a779e..e5cbf390 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "next": "13.4.1", "react": "18.2.0", "react-bootstrap": "^2.7.4", + "react-datepicker": "^8.10.0", "react-dom": "18.2.0", "react-ga4": "^2.1.0", "react-i18next": "^15.6.0", diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 9d6dce7f..27bf0e2d 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -341,5 +341,8 @@ "list_view": "List View", "grid_view": "Grid View", - "back": "Back" + "back": "Back", + "status": "Status", + "voucher_no": "Voucher No.", + "Stock Ids": "Stock Ids" } \ No newline at end of file diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 30dea920..6f8f9327 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -34,6 +34,8 @@ export const KCSlice = createSlice({ Voucher: { selectedScope: { label: 'Voucher', value: 'Voucher' } }, }, currentScope: 'Database', + userDefaultData: null, + userDefaultLoading: false, }, reducers: { setHideFiltersOnFirstLoad: (state, action) => { @@ -69,9 +71,15 @@ export const KCSlice = createSlice({ setCurrentScope: (state, action) => { state.currentScope = action.payload; }, + setUserDefaultData: (state, action) => { + state.userDefaultData = action.payload; + }, + setUserDefaultLoading: (state, action) => { + state.userDefaultLoading = action.payload; + }, }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index 724b8247..20ba0f18 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -38,7 +38,9 @@ const emrAPISDKRegistry: any = { 'get-rate-look-up-options-api': '/api/getPLlist', 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT', 'refresh-voucher-rate-api': '/api/refreshRates', - 'get-refresh-rate-param-api': '/api/getParamList' + 'get-refresh-rate-param-api': '/api/getParamList', + 'get-user-default-data': '/api/getUserDeafults', + 'post-user-default-data': '/api/postUserDeafults', }; export default emrAPISDKRegistry; From b1d592e0f20a2922e92d6e9a3c691d6ed2b2c494 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Tue, 2 Dec 2025 18:28:25 +0530 Subject: [PATCH 09/37] feat: refactor user default data handling and update state management --- hooks/AuthHooks/useLoginHook.ts | 2 +- hooks/GeneralHooks/KCLanguageHandler.ts | 8 +++++--- store/slices/general_slices/kc-slice.ts | 6 +++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 01732e39..5863c39d 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -14,7 +14,7 @@ import { Option } from '../../store/slices/general_slices/multilingual-slice'; import i18n from '../../i18n/i18n'; import useCurrencyLanguageHandler from '../GeneralHooks/LanguageHandler'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; -import { useUserDefaultData } from '../addon-hooks/kc-hooks/useUserData'; +import useUserDefaultData from '../addon-hooks/kc-hooks/useUserData'; const useLoginHook = () => { const { AFTER_LOGIN_REDIRECT_URL } = CONSTANTS; diff --git a/hooks/GeneralHooks/KCLanguageHandler.ts b/hooks/GeneralHooks/KCLanguageHandler.ts index fe20c63f..6c5e1830 100644 --- a/hooks/GeneralHooks/KCLanguageHandler.ts +++ b/hooks/GeneralHooks/KCLanguageHandler.ts @@ -10,7 +10,7 @@ import { Option } from '../../store/slices/general_slices/multilingual-slice'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; import { useEffect } from 'react'; -const useCurrencyLanguageHandler = () => { +const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCurrency: string, DefLang: string, RefreshRt: string, LabRt: string, RMCtg: string ) => void, userDefaultData?: any) => { const dispatch = useDispatch(); const languageState = useSelector(SelectedLangFromStore)?.selectedLanguage; const TokenFromStore: any = useSelector(get_access_token); @@ -42,7 +42,8 @@ const useCurrencyLanguageHandler = () => { const handleLanguageChange = (value: Option) => { dispatch(setLanguage(value?.value)); - updateUserPreference(value, selectedCurrency); + // updateUserPreference(value, selectedCurrency); + postUserDefaultData && postUserDefaultData(TokenFromStore?.token, languageDisplayOptions.find((opt: Option) => opt?.value === value?.value?.toString())?.label!?.trim(), userDefaultData?.DefCurrency, userDefaultData?.RefreshRt, userDefaultData?.LabRt, userDefaultData?.RMCtg); }; const handleLanguageShallowUpdate = (value: Option) => { @@ -52,7 +53,8 @@ const useCurrencyLanguageHandler = () => { const handleCurrencyChange = (value: Option) => { dispatch(setCurrencyValue(value?.value)); - updateUserPreference(selectedLanguage, value); + // updateUserPreference(selectedLanguage, value); + postUserDefaultData && postUserDefaultData(TokenFromStore?.token, userDefaultData?.DefLang, value?.value.toString().trim(), userDefaultData?.RefreshRt, userDefaultData?.LabRt, userDefaultData?.RMCtg); }; const handleCurrencyShallowUpdate = (value: Option) => { diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 6f8f9327..d5b13172 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -11,6 +11,7 @@ export const KCSlice = createSlice({ // selectedCustomerCode: { value: "", label: "" }, // voucherNo: "", metalRateSidebar: false, + userDefaultSidebar: false, prevCSFilters: {}, gridCols: 4, goldRate: 0, @@ -59,6 +60,9 @@ export const KCSlice = createSlice({ setMetalRateSidebar: (state, action) => { state.metalRateSidebar = action.payload; }, + setUserDefaultSidebar: (state, action) => { + state.userDefaultSidebar = action.payload; + }, setPrevCSFilters: (state, action) => { state.prevCSFilters = action.payload; }, @@ -80,6 +84,6 @@ export const KCSlice = createSlice({ }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From c69a26a076d3f687555761953defe28eaab491f2 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Wed, 3 Dec 2025 18:57:35 +0530 Subject: [PATCH 10/37] feat: add design bank count to login hook and update API registry --- hooks/AuthHooks/useLoginHook.ts | 2 ++ public/locales/de/common.json | 7 ++++++- public/locales/en/common.json | 3 ++- public/locales/es/common.json | 6 +++++- public/locales/fr/common.json | 6 +++++- public/locales/it/common.json | 6 +++++- store/slices/general_slices/kc-slice.ts | 6 +++++- utils/api-sdk-registry/emr_api_sdk_registry.ts | 1 + 8 files changed, 31 insertions(+), 6 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 5863c39d..033237b3 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -15,6 +15,7 @@ import i18n from '../../i18n/i18n'; import useCurrencyLanguageHandler from '../GeneralHooks/LanguageHandler'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; import useUserDefaultData from '../addon-hooks/kc-hooks/useUserData'; +import { setDesignBankCount } from '../../store/slices/general_slices/kc-slice'; const useLoginHook = () => { const { AFTER_LOGIN_REDIRECT_URL } = CONSTANTS; @@ -51,6 +52,7 @@ const useLoginHook = () => { localStorage.setItem('isLoggedIn', 'true'); localStorage.setItem('user', values.usr); localStorage.setItem('party_name', tokenData?.data?.full_name); + dispatch(setDesignBankCount(tokenData?.data?.count)); if (tokenData?.data?.isPwdChg !== 0) { dispatch(storeToken(tokenData?.data)); diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 6c6a35f3..95eb93aa 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -341,5 +341,10 @@ "list_view": "Listenansicht", "grid_view": "Rasteransicht", - "back": "Zurück" + "back": "Zurück", + "status": "Status", + "voucher_no": "Belegnummer", + "Stock Ids": "Bestands-IDs", + "Designs": "Designs" + } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 27bf0e2d..e555f915 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -344,5 +344,6 @@ "back": "Back", "status": "Status", "voucher_no": "Voucher No.", - "Stock Ids": "Stock Ids" + "Stock Ids": "Stock Ids", + "Designs" : "Designs" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 2261b856..e4f08e0b 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -341,5 +341,9 @@ "list_view": "Vista de lista", "grid_view": "Vista de cuadrícula", - "back": "Atrás" + "back": "Atrás", + "status": "Estado", + "voucher_no": "Número de comprobante", + "Stock Ids": "IDs de inventario", + "Designs": "Diseños" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index ef746c3a..01f90952 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -341,5 +341,9 @@ "list_view": "Vue en liste", "grid_view": "Vue en grille", - "back": "Retour" + "back": "Retour", + "status": "Statut", + "voucher_no": "Numéro de reçu", + "Stock Ids": "Identifiants de stock", + "Designs": "Designs" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index c1122b3e..d7278a43 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -341,5 +341,9 @@ "list_view": "Vista elenco", "grid_view": "Vista griglia", - "back": "Indietro" + "back": "Indietro", + "status": "Stato", + "voucher_no": "Numero del voucher", + "Stock Ids": "ID di magazzino", + "Designs": "Design" } \ No newline at end of file diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index d5b13172..4715b0b8 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -37,6 +37,7 @@ export const KCSlice = createSlice({ currentScope: 'Database', userDefaultData: null, userDefaultLoading: false, + designBankCount: 0, }, reducers: { setHideFiltersOnFirstLoad: (state, action) => { @@ -81,9 +82,12 @@ export const KCSlice = createSlice({ setUserDefaultLoading: (state, action) => { state.userDefaultLoading = action.payload; }, + setDesignBankCount: (state, action) => { + state.designBankCount = action.payload; + } }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index 20ba0f18..d7bb8142 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -41,6 +41,7 @@ const emrAPISDKRegistry: any = { 'get-refresh-rate-param-api': '/api/getParamList', 'get-user-default-data': '/api/getUserDeafults', 'post-user-default-data': '/api/postUserDeafults', + 'get-list-data-api': '/api/getList', }; export default emrAPISDKRegistry; From bf7da6afa72a26ea54028b93b56832f1c0d13a49 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 4 Dec 2025 09:36:53 +0530 Subject: [PATCH 11/37] fix: langauge & currency value --- hooks/AuthHooks/useLoginHook.ts | 8 ++++---- hooks/GeneralHooks/KCLanguageHandler.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 033237b3..2696743e 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -58,11 +58,11 @@ const useLoginHook = () => { dispatch(storeToken(tokenData?.data)); } - handleLanguageShallowUpdate(languageDisplayOptions.find((opt: Option) => opt?.label === tokenData?.data?.language)!); - handleCurrencyShallowUpdate(currencyOptions.find((opt: Option) => opt?.value === tokenData?.data?.currency)!); + // handleLanguageShallowUpdate(languageDisplayOptions.find((opt: Option) => opt?.label === tokenData?.data?.language)!); + // handleCurrencyShallowUpdate(currencyOptions.find((opt: Option) => opt?.value === tokenData?.data?.currency)!); - localStorage.setItem('selected_language', tokenData?.data?.language); - localStorage.setItem('selected_currency', tokenData?.data?.currency); + // localStorage.setItem('selected_language', tokenData?.data?.language); + // localStorage.setItem('selected_currency', tokenData?.data?.currency); fetchUserDefaultData(tokenData?.data?.access_token); // Redirect to the home page or any other page after successful login diff --git a/hooks/GeneralHooks/KCLanguageHandler.ts b/hooks/GeneralHooks/KCLanguageHandler.ts index 6c5e1830..46a638ca 100644 --- a/hooks/GeneralHooks/KCLanguageHandler.ts +++ b/hooks/GeneralHooks/KCLanguageHandler.ts @@ -12,9 +12,9 @@ import { useEffect } from 'react'; const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCurrency: string, DefLang: string, RefreshRt: string, LabRt: string, RMCtg: string ) => void, userDefaultData?: any) => { const dispatch = useDispatch(); - const languageState = useSelector(SelectedLangFromStore)?.selectedLanguage; + const languageState = useSelector(SelectedLangFromStore)?.selectedLanguage?.trim(); const TokenFromStore: any = useSelector(get_access_token); - const currencyState = useSelector(currency_selector_state)?.selected_currency_value; + const currencyState = useSelector(currency_selector_state)?.selected_currency_value?.trim(); const handleAuthError = useAuthErrorHandler(); const selectedCurrency = currencyOptions.find((opt) => opt?.value === (currencyState))!; const selectedLanguage = languageDisplayOptions.find((opt) => opt?.value === languageState)!; From 02c2206bfec86df51207511b074415fc10dc5c22 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 5 Dec 2025 12:20:45 +0530 Subject: [PATCH 12/37] feat: add color stone change parameters list and update API endpoints --- .../useProductDetail.ts | 26 +++++++++++++++++-- public/locales/en/common.json | 3 ++- .../api-sdk-registry/emr_api_sdk_registry.ts | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/hooks/ProductDetailPageHooks/useProductDetail.ts b/hooks/ProductDetailPageHooks/useProductDetail.ts index 0532776a..f2ccbdca 100644 --- a/hooks/ProductDetailPageHooks/useProductDetail.ts +++ b/hooks/ProductDetailPageHooks/useProductDetail.ts @@ -42,6 +42,7 @@ const useProductDetail = () => { ]); const [gradeChangeList, setGradeChangeList] = useState([]); const [diamondChangeList, setDiamondChangeList] = useState([]); + const [colorStoneChangeList, setColorStoneChangeList] = useState([]); const handleMultipleQtyChange = (index: number, itemCode: string, value: string) => { setItemList((prevItemList: any) => { @@ -173,7 +174,7 @@ const useProductDetail = () => { mnCd: 'MET', typ: 'GRDCD' } - const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-refresh-rate-param-api', apiData, TokenFromStore?.token); + const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-param-list-api', apiData, TokenFromStore?.token); if (getGradeChangeParamsData?.status === 200 && getGradeChangeParamsData?.data?.msg === 'success') { setGradeChangeList(getGradeChangeParamsData?.data?.data.map((item: any) => ( { @@ -192,7 +193,7 @@ const useProductDetail = () => { mnCd: 'DIA', typ: 'GRDCD' } - const getDiamondChangeParamsData: any = await fetchProductDetailData('GET', 'get-refresh-rate-param-api', apiData, TokenFromStore?.token); + const getDiamondChangeParamsData: any = await fetchProductDetailData('GET', 'get-param-list-api', apiData, TokenFromStore?.token); if (getDiamondChangeParamsData?.status === 200 && getDiamondChangeParamsData?.data?.msg === 'success') { setDiamondChangeList(getDiamondChangeParamsData?.data?.data.map((item: any) => ( { @@ -205,6 +206,25 @@ const useProductDetail = () => { console.error('Error', errorMessage); } }; + + const getColorStoneChangeParamsList = async () => { + const apiData = { + mnCd: 'CS', + typ: 'GRDCD' + } + const getColorStoneChangeParamsData: any = await fetchProductDetailData('GET', 'get-param-list-api', apiData, TokenFromStore?.token); + if (getColorStoneChangeParamsData?.status === 200 && getColorStoneChangeParamsData?.data?.msg === 'success') { + setColorStoneChangeList(getColorStoneChangeParamsData?.data?.data.map((item: any) => ( + { + label: item.PScd, + value: item.PScd, + } + ))); + } else { + const errorMessage = getColorStoneChangeParamsData?.data?.error + console.error('Error', errorMessage); + } + }; const debouncedSetValue = debounce((pinCode: string) => { const found = pinCodeData.some((pin) => pin.name === pinCode); @@ -220,6 +240,7 @@ const useProductDetail = () => { fetchProductDetailDataAPI(); getGradeChangeParamsList(); getDiamondChangeParamsList(); + getColorStoneChangeParamsList(); // }, [query?.productId]); }, [query?.productId, selectedCurrency]); @@ -244,6 +265,7 @@ const useProductDetail = () => { checkPinCodeExists, gradeChangeList, diamondChangeList, + colorStoneChangeList, }; }; diff --git a/public/locales/en/common.json b/public/locales/en/common.json index e555f915..1b2f42ea 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -345,5 +345,6 @@ "status": "Status", "voucher_no": "Voucher No.", "Stock Ids": "Stock Ids", - "Designs" : "Designs" + "Designs" : "Designs", + "colorstone": "Color Stone" } \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index d7bb8142..2634bfa5 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -38,7 +38,7 @@ const emrAPISDKRegistry: any = { 'get-rate-look-up-options-api': '/api/getPLlist', 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT', 'refresh-voucher-rate-api': '/api/refreshRates', - 'get-refresh-rate-param-api': '/api/getParamList', + 'get-param-list-api': '/api/getParamList', 'get-user-default-data': '/api/getUserDeafults', 'post-user-default-data': '/api/postUserDeafults', 'get-list-data-api': '/api/getList', From 3b9e04cedb3e89acfd204d33e33613c56bf88cfd Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 5 Dec 2025 15:00:51 +0530 Subject: [PATCH 13/37] feat: update gradeChange option listing api --- hooks/ProductDetailPageHooks/useProductDetail.ts | 8 ++++---- public/locales/de/common.json | 4 ++-- public/locales/en/common.json | 3 ++- public/locales/es/common.json | 3 ++- public/locales/fr/common.json | 3 ++- public/locales/it/common.json | 3 ++- utils/api-sdk-registry/emr_api_sdk_registry.ts | 1 + 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/hooks/ProductDetailPageHooks/useProductDetail.ts b/hooks/ProductDetailPageHooks/useProductDetail.ts index f2ccbdca..0af535e2 100644 --- a/hooks/ProductDetailPageHooks/useProductDetail.ts +++ b/hooks/ProductDetailPageHooks/useProductDetail.ts @@ -171,14 +171,14 @@ const useProductDetail = () => { const getGradeChangeParamsList = async () => { const apiData = { - mnCd: 'MET', - typ: 'GRDCD' + mnCd: 'GrdG', + typ: 'yCfg' } - const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-param-list-api', apiData, TokenFromStore?.token); + const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-y-param-list-api', apiData, TokenFromStore?.token); if (getGradeChangeParamsData?.status === 200 && getGradeChangeParamsData?.data?.msg === 'success') { setGradeChangeList(getGradeChangeParamsData?.data?.data.map((item: any) => ( { - label: item.PScd, + label: item.PDesc, value: item.PScd, } ))); diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 95eb93aa..25288f8d 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -345,6 +345,6 @@ "status": "Status", "voucher_no": "Belegnummer", "Stock Ids": "Bestands-IDs", - "Designs": "Designs" - + "Designs": "Designs", + "your_stock_cart_for": "Ihr Stockwagen für" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 1b2f42ea..37fb5dc2 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -346,5 +346,6 @@ "voucher_no": "Voucher No.", "Stock Ids": "Stock Ids", "Designs" : "Designs", - "colorstone": "Color Stone" + "colorstone": "Color Stone", + "your_stock_cart_for": "Your Stock Cart for" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index e4f08e0b..aa2a82aa 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -345,5 +345,6 @@ "status": "Estado", "voucher_no": "Número de comprobante", "Stock Ids": "IDs de inventario", - "Designs": "Diseños" + "Designs": "Diseños", + "your_stock_cart_for": "Su carrito de stock para" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 01f90952..0da43797 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -345,5 +345,6 @@ "status": "Statut", "voucher_no": "Numéro de reçu", "Stock Ids": "Identifiants de stock", - "Designs": "Designs" + "Designs": "Designs", + "your_stock_cart_for": "Votre panier de stock pour" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index d7278a43..b2160fe0 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -345,5 +345,6 @@ "status": "Stato", "voucher_no": "Numero del voucher", "Stock Ids": "ID di magazzino", - "Designs": "Design" + "Designs": "Design", + "your_stock_cart_for": "Il tuo carrello stock per" } \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index 2634bfa5..9f9d8f24 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -42,6 +42,7 @@ const emrAPISDKRegistry: any = { 'get-user-default-data': '/api/getUserDeafults', 'post-user-default-data': '/api/postUserDeafults', 'get-list-data-api': '/api/getList', + 'get-y-param-list-api': '/api/getyParamList', }; export default emrAPISDKRegistry; From d91e4a058ddacbee22bfc734cc88dd0af5890d2d Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Tue, 9 Dec 2025 17:18:36 +0530 Subject: [PATCH 14/37] feat: default voucherMode in userdata --- hooks/GeneralHooks/KCLanguageHandler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/GeneralHooks/KCLanguageHandler.ts b/hooks/GeneralHooks/KCLanguageHandler.ts index 46a638ca..8861e2f2 100644 --- a/hooks/GeneralHooks/KCLanguageHandler.ts +++ b/hooks/GeneralHooks/KCLanguageHandler.ts @@ -10,7 +10,7 @@ import { Option } from '../../store/slices/general_slices/multilingual-slice'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; import { useEffect } from 'react'; -const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCurrency: string, DefLang: string, RefreshRt: string, LabRt: string, RMCtg: string ) => void, userDefaultData?: any) => { +const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCurrency: string, DefLang: string, RefreshRt: string, LabRt: string, RMCtg: string, voucherModeType: string ) => void, userDefaultData?: any) => { const dispatch = useDispatch(); const languageState = useSelector(SelectedLangFromStore)?.selectedLanguage?.trim(); const TokenFromStore: any = useSelector(get_access_token); @@ -43,7 +43,7 @@ const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCur const handleLanguageChange = (value: Option) => { dispatch(setLanguage(value?.value)); // updateUserPreference(value, selectedCurrency); - postUserDefaultData && postUserDefaultData(TokenFromStore?.token, languageDisplayOptions.find((opt: Option) => opt?.value === value?.value?.toString())?.label!?.trim(), userDefaultData?.DefCurrency, userDefaultData?.RefreshRt, userDefaultData?.LabRt, userDefaultData?.RMCtg); + postUserDefaultData && postUserDefaultData(TokenFromStore?.token, languageDisplayOptions.find((opt: Option) => opt?.value === value?.value?.toString())?.label!?.trim(), userDefaultData?.DefCurrency, userDefaultData?.RefreshRt, userDefaultData?.LabRt, userDefaultData?.RMCtg, userDefaultData?.voucherModeType); }; const handleLanguageShallowUpdate = (value: Option) => { @@ -54,7 +54,7 @@ const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCur const handleCurrencyChange = (value: Option) => { dispatch(setCurrencyValue(value?.value)); // updateUserPreference(selectedLanguage, value); - postUserDefaultData && postUserDefaultData(TokenFromStore?.token, userDefaultData?.DefLang, value?.value.toString().trim(), userDefaultData?.RefreshRt, userDefaultData?.LabRt, userDefaultData?.RMCtg); + postUserDefaultData && postUserDefaultData(TokenFromStore?.token, userDefaultData?.DefLang, value?.value.toString().trim(), userDefaultData?.RefreshRt, userDefaultData?.LabRt, userDefaultData?.RMCtg, userDefaultData?.voucherModeType); }; const handleCurrencyShallowUpdate = (value: Option) => { From a47e3d0603e31ccb6f5f3a7146df8d6acac7ffc0 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 11 Dec 2025 18:19:17 +0530 Subject: [PATCH 15/37] feat: store filters based on users, metal, diamond, colorstone list fetching --- .../useProductDetail.ts | 67 +--------- public/locales/en/common.json | 7 +- store/slices/general_slices/kc-slice.ts | 118 +++++++++++------- 3 files changed, 81 insertions(+), 111 deletions(-) diff --git a/hooks/ProductDetailPageHooks/useProductDetail.ts b/hooks/ProductDetailPageHooks/useProductDetail.ts index 0af535e2..c071183a 100644 --- a/hooks/ProductDetailPageHooks/useProductDetail.ts +++ b/hooks/ProductDetailPageHooks/useProductDetail.ts @@ -11,6 +11,7 @@ import fetchPinCodesListAPI from '../../services/api/general-apis/get-pin-code-l import debounce from 'debounce'; import useAuthErrorHandler from '../AuthHooks/handleAuthError'; import useCurrencyLanguageHandler from '../GeneralHooks/KCLanguageHandler'; + type PinCodeTypes = { name: string; }; @@ -40,9 +41,6 @@ const useProductDetail = () => { quantity: productDetailData?.min_order_qty || 1, }, ]); - const [gradeChangeList, setGradeChangeList] = useState([]); - const [diamondChangeList, setDiamondChangeList] = useState([]); - const [colorStoneChangeList, setColorStoneChangeList] = useState([]); const handleMultipleQtyChange = (index: number, itemCode: string, value: string) => { setItemList((prevItemList: any) => { @@ -168,63 +166,6 @@ const useProductDetail = () => { } } }; - - const getGradeChangeParamsList = async () => { - const apiData = { - mnCd: 'GrdG', - typ: 'yCfg' - } - const getGradeChangeParamsData: any = await fetchProductDetailData('GET', 'get-y-param-list-api', apiData, TokenFromStore?.token); - if (getGradeChangeParamsData?.status === 200 && getGradeChangeParamsData?.data?.msg === 'success') { - setGradeChangeList(getGradeChangeParamsData?.data?.data.map((item: any) => ( - { - label: item.PDesc, - value: item.PScd, - } - ))); - } else { - const errorMessage = getGradeChangeParamsData?.data?.error - console.error('Error', errorMessage); - } - }; - - const getDiamondChangeParamsList = async () => { - const apiData = { - mnCd: 'DIA', - typ: 'GRDCD' - } - const getDiamondChangeParamsData: any = await fetchProductDetailData('GET', 'get-param-list-api', apiData, TokenFromStore?.token); - if (getDiamondChangeParamsData?.status === 200 && getDiamondChangeParamsData?.data?.msg === 'success') { - setDiamondChangeList(getDiamondChangeParamsData?.data?.data.map((item: any) => ( - { - label: item.PScd, - value: item.PScd, - } - ))); - } else { - const errorMessage = getDiamondChangeParamsData?.data?.error - console.error('Error', errorMessage); - } - }; - - const getColorStoneChangeParamsList = async () => { - const apiData = { - mnCd: 'CS', - typ: 'GRDCD' - } - const getColorStoneChangeParamsData: any = await fetchProductDetailData('GET', 'get-param-list-api', apiData, TokenFromStore?.token); - if (getColorStoneChangeParamsData?.status === 200 && getColorStoneChangeParamsData?.data?.msg === 'success') { - setColorStoneChangeList(getColorStoneChangeParamsData?.data?.data.map((item: any) => ( - { - label: item.PScd, - value: item.PScd, - } - ))); - } else { - const errorMessage = getColorStoneChangeParamsData?.data?.error - console.error('Error', errorMessage); - } - }; const debouncedSetValue = debounce((pinCode: string) => { const found = pinCodeData.some((pin) => pin.name === pinCode); @@ -238,9 +179,6 @@ const useProductDetail = () => { useEffect(() => { fetchProductDetailDataAPI(); - getGradeChangeParamsList(); - getDiamondChangeParamsList(); - getColorStoneChangeParamsList(); // }, [query?.productId]); }, [query?.productId, selectedCurrency]); @@ -263,9 +201,6 @@ const useProductDetail = () => { validPinCode, getPincodesList, checkPinCodeExists, - gradeChangeList, - diamondChangeList, - colorStoneChangeList, }; }; diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 37fb5dc2..3f3df85f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -347,5 +347,10 @@ "Stock Ids": "Stock Ids", "Designs" : "Designs", "colorstone": "Color Stone", - "your_stock_cart_for": "Your Stock Cart for" + "your_stock_cart_for": "Your Stock Cart for", + "delete": "Delete", + "go_to_cart": "Go to Cart", + "go_to_stock_cart": "Go to Stock Cart", + "selected_items_moved_to_": "Selected item(s) were successfully moved to", + "metal_grade": "Metal Grade" } \ No newline at end of file diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 4715b0b8..e494b22a 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -1,44 +1,51 @@ import { createSlice } from "@reduxjs/toolkit"; +interface FiltersState { + currentScope: { [customer: string]: string }; + filters: { [customer: string]: { [scope: string]: any } }; + filtersSetOfAPI: { [customer: string]: { [scope: string]: any } }; + + hideFiltersOnFirstLoad: boolean; + metalRateSidebar: boolean; + userDefaultSidebar: boolean; + prevCSFilters: any; + gridCols: number; + goldRate: number; + palladiumRate: number; + platinumRate: number; + silverRate: number; + userDefaultData: any; + userDefaultLoading: boolean; + designBankCount: number; + gradeChangeList: {label: string, value: string}[]; + diamondChangeList: {label: string, value: string}[]; + colorStoneChangeList: {label: string, value: string}[]; +} + +const initialState: FiltersState = { + hideFiltersOnFirstLoad: true, + metalRateSidebar: false, + userDefaultSidebar: false, + prevCSFilters: {}, + gridCols: 4, + goldRate: 0, + palladiumRate: 0, + platinumRate: 0, + silverRate: 0, + filters: {}, + filtersSetOfAPI: {}, + currentScope: {}, + userDefaultData: null, + userDefaultLoading: false, + designBankCount: 0, + gradeChangeList: [], + diamondChangeList: [], + colorStoneChangeList: [], +}; + export const KCSlice = createSlice({ name: "KC", - initialState: { - // selectedProducts: [], - // hideSelectAllBtn: false, - hideFiltersOnFirstLoad: true, - // actionBtnLoader: false, - // activeScope: "Current Session", - // selectedCustomerCode: { value: "", label: "" }, - // voucherNo: "", - metalRateSidebar: false, - userDefaultSidebar: false, - prevCSFilters: {}, - gridCols: 4, - goldRate: 0, - palladiumRate: 0, - platinumRate: 0, - silverRate: 0, - filters: { - Database: { selectedScope: { label: 'New Session', value: 'Database' } }, - Stock: { selectedScope: { label: 'Stock', value: 'Stock' } }, - 'Current Session': { selectedScope: { label: 'Current Session (QT/CS)', value: 'Current Session' } }, - Cart: { selectedScope: { label: 'Cart (QT/CT)', value: 'Cart' } }, - 'Stock Cart': { selectedScope: { label: 'Stock Cart', value: 'Stock Cart' } }, - Voucher: { selectedScope: { label: 'Voucher', value: 'Voucher' } }, - }, - filtersSetOfAPI: { - Database: { selectedScope: { label: 'New Session', value: 'Database' } }, - Stock: { selectedScope: { label: 'Stock', value: 'Stock' } }, - 'Current Session': { selectedScope: { label: 'Current Session (QT/CS)', value: 'Current Session' } }, - Cart: { selectedScope: { label: 'Cart (QT/CT)', value: 'Cart' } }, - 'Stock Cart': { selectedScope: { label: 'Stock Cart', value: 'Stock Cart' } }, - Voucher: { selectedScope: { label: 'Voucher', value: 'Voucher' } }, - }, - currentScope: 'Database', - userDefaultData: null, - userDefaultLoading: false, - designBankCount: 0, - }, + initialState, reducers: { setHideFiltersOnFirstLoad: (state, action) => { state.hideFiltersOnFirstLoad = action.payload; @@ -67,14 +74,28 @@ export const KCSlice = createSlice({ setPrevCSFilters: (state, action) => { state.prevCSFilters = action.payload; }, + setCurrentScope: (state, action) => { + const { customer, scope } = action.payload; + if (!state.currentScope[customer]) state.currentScope[customer] = scope; + else state.currentScope[customer] = scope; + }, setFilters: (state, action) => { - state.filters = action.payload; + const { customer, scope, data } = action.payload; + + if (!state.filters[customer]) state.filters[customer] = {}; + state.filters[customer][scope] = { + ...(state.filters[customer][scope] || {}), + ...data, + }; }, setFiltersSetOfAPI: (state, action) => { - state.filtersSetOfAPI = action.payload; - }, - setCurrentScope: (state, action) => { - state.currentScope = action.payload; + const { customer, scope, data } = action.payload; + + if (!state.filtersSetOfAPI[customer]) state.filtersSetOfAPI[customer] = {}; + state.filtersSetOfAPI[customer][scope] = { + ...(state.filtersSetOfAPI[customer][scope] || {}), + ...data, + }; }, setUserDefaultData: (state, action) => { state.userDefaultData = action.payload; @@ -84,10 +105,19 @@ export const KCSlice = createSlice({ }, setDesignBankCount: (state, action) => { state.designBankCount = action.payload; - } + }, + setGradeChangeList: (state, action) => { + state.gradeChangeList = action.payload; + }, + setDiamondChangeList: (state, action) => { + state.diamondChangeList = action.payload; + }, + setColorStoneChangeList: (state, action) => { + state.colorStoneChangeList = action.payload; + }, }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From 599f623539e93cdfd05ce7536b4de2bb04c6c630 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 12 Dec 2025 17:06:14 +0530 Subject: [PATCH 16/37] feat: update instructions api & translations --- public/locales/en/common.json | 5 ++++- utils/api-sdk-registry/emr_api_sdk_registry.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 3f3df85f..470e8229 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -352,5 +352,8 @@ "go_to_cart": "Go to Cart", "go_to_stock_cart": "Go to Stock Cart", "selected_items_moved_to_": "Selected item(s) were successfully moved to", - "metal_grade": "Metal Grade" + "metal_grade": "Metal Grade", + "for": "for", + "to_view": "To View", + "scope_for_customer": "for the customer, please select the customer & scope." } \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index 9f9d8f24..ae5b6ef6 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -43,6 +43,7 @@ const emrAPISDKRegistry: any = { 'post-user-default-data': '/api/postUserDeafults', 'get-list-data-api': '/api/getList', 'get-y-param-list-api': '/api/getyParamList', + 'update-item-instruction-api': '/api/updateFields', }; export default emrAPISDKRegistry; From 78b46d4a49ecbbf0a8c2f9785f66a874a6525675 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 12 Dec 2025 18:37:52 +0530 Subject: [PATCH 17/37] feat: fix current scope --- store/slices/general_slices/kc-slice.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index e494b22a..c1d81db3 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -75,9 +75,7 @@ export const KCSlice = createSlice({ state.prevCSFilters = action.payload; }, setCurrentScope: (state, action) => { - const { customer, scope } = action.payload; - if (!state.currentScope[customer]) state.currentScope[customer] = scope; - else state.currentScope[customer] = scope; + state.currentScope = action.payload; }, setFilters: (state, action) => { const { customer, scope, data } = action.payload; From c47b3fbf951ba915c6cb697fca9800bacc3a2f88 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 15 Dec 2025 14:01:34 +0530 Subject: [PATCH 18/37] feat: translations for KC --- public/locales/en/common.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 470e8229..49f91900 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -355,5 +355,7 @@ "metal_grade": "Metal Grade", "for": "for", "to_view": "To View", - "scope_for_customer": "for the customer, please select the customer & scope." + "scope_for_customer": "for the customer, please select the customer & scope.", + "list_display": "List Display", + "selected": "Selected" } \ No newline at end of file From 22e2f89db1e79a2ac485715a69863ca3078ce871 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 15 Dec 2025 18:20:14 +0530 Subject: [PATCH 19/37] feat: product card detail toggle in kc slice --- public/locales/en/common.json | 3 ++- store/slices/general_slices/kc-slice.ts | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 49f91900..c9622f5f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -357,5 +357,6 @@ "to_view": "To View", "scope_for_customer": "for the customer, please select the customer & scope.", "list_display": "List Display", - "selected": "Selected" + "selected": "Selected", + "card_details": "Card Details" } \ No newline at end of file diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index c1d81db3..3c7d709f 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -20,6 +20,7 @@ interface FiltersState { gradeChangeList: {label: string, value: string}[]; diamondChangeList: {label: string, value: string}[]; colorStoneChangeList: {label: string, value: string}[]; + showProductCardDetails: boolean; } const initialState: FiltersState = { @@ -41,6 +42,7 @@ const initialState: FiltersState = { gradeChangeList: [], diamondChangeList: [], colorStoneChangeList: [], + showProductCardDetails: false, }; export const KCSlice = createSlice({ @@ -113,9 +115,12 @@ export const KCSlice = createSlice({ setColorStoneChangeList: (state, action) => { state.colorStoneChangeList = action.payload; }, + setShowProductCardDetails: (state, action) => { + state.showProductCardDetails = action.payload; + }, }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From 5cc06c17b32aa95ab534fd04fe6c4d8c959bcf10 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 22 Dec 2025 18:39:02 +0530 Subject: [PATCH 20/37] feat: translations --- public/locales/en/common.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index c9622f5f..d330e1fc 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -358,5 +358,7 @@ "scope_for_customer": "for the customer, please select the customer & scope.", "list_display": "List Display", "selected": "Selected", - "card_details": "Card Details" + "card_details": "Card Details", + "refresh_from": "Refresh From", + "refreshing_rates": "Refreshing Rates" } \ No newline at end of file From 55bbf39c6462fea143aa9f06975972158924b804 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Tue, 23 Dec 2025 10:55:47 +0530 Subject: [PATCH 21/37] feat: select all variable --- store/slices/general_slices/kc-slice.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 3c7d709f..4f00cbdc 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -21,6 +21,7 @@ interface FiltersState { diamondChangeList: {label: string, value: string}[]; colorStoneChangeList: {label: string, value: string}[]; showProductCardDetails: boolean; + selectAllProducts: boolean; } const initialState: FiltersState = { @@ -43,6 +44,7 @@ const initialState: FiltersState = { diamondChangeList: [], colorStoneChangeList: [], showProductCardDetails: false, + selectAllProducts: false, }; export const KCSlice = createSlice({ @@ -118,9 +120,12 @@ export const KCSlice = createSlice({ setShowProductCardDetails: (state, action) => { state.showProductCardDetails = action.payload; }, + setSelectAllProducts: (state, action) => { + state.selectAllProducts = action.payload; + }, }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From 5bd1855aa5b0907b5d5447092cb37c90ad15e1f1 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Tue, 23 Dec 2025 16:20:53 +0530 Subject: [PATCH 22/37] fix: remove order listing & details page comp for KC --- pages/my-orders/[orderId]/index.tsx | 4 ++-- pages/my-orders/index.tsx | 4 ++-- public/locales/en/common.json | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pages/my-orders/[orderId]/index.tsx b/pages/my-orders/[orderId]/index.tsx index 53ec2076..9133a3c0 100644 --- a/pages/my-orders/[orderId]/index.tsx +++ b/pages/my-orders/[orderId]/index.tsx @@ -5,8 +5,8 @@ import OrderDetails from '../../../components/FallbackOrderComponents/OrderDetai const OrderDetail = () => { return ( <> - {/* */} - + + {/* */} ); }; diff --git a/pages/my-orders/index.tsx b/pages/my-orders/index.tsx index aa374169..36f5accd 100644 --- a/pages/my-orders/index.tsx +++ b/pages/my-orders/index.tsx @@ -6,8 +6,8 @@ import OrderListing from '../../components/FallbackOrderComponents/OrderListing' const MyOrder = () => { return ( <> - {/* */} - + + {/* */} ); }; diff --git a/public/locales/en/common.json b/public/locales/en/common.json index d330e1fc..2ecdc096 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -360,5 +360,6 @@ "selected": "Selected", "card_details": "Card Details", "refresh_from": "Refresh From", - "refreshing_rates": "Refreshing Rates" + "refreshing_rates": "Refreshing Rates", + "updating_items": "Updating Items" } \ No newline at end of file From 5a403bdf2622816119be0e02c90567425a6f1588 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 29 Jan 2026 15:05:16 +0530 Subject: [PATCH 23/37] feat: add translation for new input labels --- public/locales/de/common.json | 3 ++- public/locales/en/common.json | 3 ++- public/locales/es/common.json | 3 ++- public/locales/fr/common.json | 3 ++- public/locales/it/common.json | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 25288f8d..a9f5b19d 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -346,5 +346,6 @@ "voucher_no": "Belegnummer", "Stock Ids": "Bestands-IDs", "Designs": "Designs", - "your_stock_cart_for": "Ihr Stockwagen für" + "your_stock_cart_for": "Ihr Stockwagen für", + "for_pricing_and_vouchers": "für Preisgestaltung und Gutscheine" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 2ecdc096..ec187725 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -361,5 +361,6 @@ "card_details": "Card Details", "refresh_from": "Refresh From", "refreshing_rates": "Refreshing Rates", - "updating_items": "Updating Items" + "updating_items": "Updating Items", + "for_pricing_and_vouchers": "for Pricing and Voucher" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index aa2a82aa..f5f5bbe8 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -346,5 +346,6 @@ "voucher_no": "Número de comprobante", "Stock Ids": "IDs de inventario", "Designs": "Diseños", - "your_stock_cart_for": "Su carrito de stock para" + "your_stock_cart_for": "Su carrito de stock para", + "for_pricing_and_vouchers": "para precios y vales" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 0da43797..2d16cb7a 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -346,5 +346,6 @@ "voucher_no": "Numéro de reçu", "Stock Ids": "Identifiants de stock", "Designs": "Designs", - "your_stock_cart_for": "Votre panier de stock pour" + "your_stock_cart_for": "Votre panier de stock pour", + "for_pricing_and_vouchers": "pour la tarification et les bons" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index b2160fe0..fc9caf9f 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -346,5 +346,6 @@ "voucher_no": "Numero del voucher", "Stock Ids": "ID di magazzino", "Designs": "Design", - "your_stock_cart_for": "Il tuo carrello stock per" + "your_stock_cart_for": "Il tuo carrello stock per", + "for_pricing_and_vouchers": "per prezzi e voucher" } \ No newline at end of file From edbcdaea27a41f67072138b70f323e78c479fcfc Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Tue, 3 Feb 2026 18:15:56 +0530 Subject: [PATCH 24/37] feat: enhance product listing and state management with new scope and customer properties --- .../useProductsDataHook.ts | 1 + store/slices/general_slices/kc-slice.ts | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/hooks/ProductListPageHooks/useProductsDataHook.ts b/hooks/ProductListPageHooks/useProductsDataHook.ts index 73667945..18d7b220 100644 --- a/hooks/ProductListPageHooks/useProductsDataHook.ts +++ b/hooks/ProductListPageHooks/useProductsDataHook.ts @@ -96,6 +96,7 @@ const useProductListing = () => { page: '1', currency: 'INR', sort_by: sortBy, + scope: 'Database' }, }); } diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 4f00cbdc..90a26d4f 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -1,7 +1,9 @@ import { createSlice } from "@reduxjs/toolkit"; interface FiltersState { - currentScope: { [customer: string]: string }; + currentScope: string; + scope: any; + customer: any; filters: { [customer: string]: { [scope: string]: any } }; filtersSetOfAPI: { [customer: string]: { [scope: string]: any } }; @@ -36,7 +38,9 @@ const initialState: FiltersState = { silverRate: 0, filters: {}, filtersSetOfAPI: {}, - currentScope: {}, + currentScope: '', + customer: null, + scope: { label: 'New Session (PDCM Design Bank)', value: 'Database' }, userDefaultData: null, userDefaultLoading: false, designBankCount: 0, @@ -81,6 +85,14 @@ export const KCSlice = createSlice({ setCurrentScope: (state, action) => { state.currentScope = action.payload; }, + setCustomer: (state, action) => { + console.log("gey", action.payload) + state.customer = action.payload; + }, + setScope: (state, action) => { + console.log("tewyu", action.payload); + state.scope = action.payload; + }, setFilters: (state, action) => { const { customer, scope, data } = action.payload; @@ -126,6 +138,6 @@ export const KCSlice = createSlice({ }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setCustomer, setScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From 626210b8bc18540664d86e888b9fd66cebe66d04 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Wed, 4 Feb 2026 15:28:32 +0530 Subject: [PATCH 25/37] fix: set default language & currency --- hooks/GeneralHooks/KCLanguageHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/GeneralHooks/KCLanguageHandler.ts b/hooks/GeneralHooks/KCLanguageHandler.ts index 8861e2f2..d22b7d1f 100644 --- a/hooks/GeneralHooks/KCLanguageHandler.ts +++ b/hooks/GeneralHooks/KCLanguageHandler.ts @@ -16,8 +16,8 @@ const useCurrencyLanguageHandler = (postUserDefaultData?: (token: string, DefCur const TokenFromStore: any = useSelector(get_access_token); const currencyState = useSelector(currency_selector_state)?.selected_currency_value?.trim(); const handleAuthError = useAuthErrorHandler(); - const selectedCurrency = currencyOptions.find((opt) => opt?.value === (currencyState))!; - const selectedLanguage = languageDisplayOptions.find((opt) => opt?.value === languageState)!; + const selectedCurrency = currencyOptions.find((opt) => opt?.value === currencyState || 'INR')!; + const selectedLanguage = languageDisplayOptions.find((opt) => opt?.value === languageState || 'en')!; const updateUserPreference = async (language: Option, currency: Option) => { const languageCode = language?.value.toString(); From 57027335e8dd4bb8ba908b96e856ef4ae07f31a1 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 6 Feb 2026 10:49:12 +0530 Subject: [PATCH 26/37] feat: update EMR API handler to support blob responses and enhance SDK registry with new API keys --- hooks/AuthHooks/useLoginHook.ts | 11 +- public/locales/de/common.json | 6 +- public/locales/en/common.json | 6 +- public/locales/es/common.json | 6 +- public/locales/fr/common.json | 6 +- public/locales/it/common.json | 6 +- services/api-handlers/emr-api-handler.ts | 27 +++-- .../api-sdk-registry/emr_api_sdk_registry.ts | 106 ++++++++++-------- utils/engine-runner.ts | 4 +- utils/http-methods.ts | 101 +++++++++++------ 10 files changed, 174 insertions(+), 105 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 2696743e..6d817fc6 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -15,7 +15,7 @@ import i18n from '../../i18n/i18n'; import useCurrencyLanguageHandler from '../GeneralHooks/LanguageHandler'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; import useUserDefaultData from '../addon-hooks/kc-hooks/useUserData'; -import { setDesignBankCount } from '../../store/slices/general_slices/kc-slice'; +import { setCustomer, setDesignBankCount, setScope } from '../../store/slices/general_slices/kc-slice'; const useLoginHook = () => { const { AFTER_LOGIN_REDIRECT_URL } = CONSTANTS; @@ -58,13 +58,10 @@ const useLoginHook = () => { dispatch(storeToken(tokenData?.data)); } - // handleLanguageShallowUpdate(languageDisplayOptions.find((opt: Option) => opt?.label === tokenData?.data?.language)!); - // handleCurrencyShallowUpdate(currencyOptions.find((opt: Option) => opt?.value === tokenData?.data?.currency)!); - - // localStorage.setItem('selected_language', tokenData?.data?.language); - // localStorage.setItem('selected_currency', tokenData?.data?.currency); - fetchUserDefaultData(tokenData?.data?.access_token); + setCustomer(null); + setScope({ label: 'New Session (PDCM Design Bank)', value: 'Database' }); + // Redirect to the home page or any other page after successful login if (tokenData?.data?.isPwdChg === 0) { router.push('/forgot_password'); diff --git a/public/locales/de/common.json b/public/locales/de/common.json index a9f5b19d..e83e5410 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -347,5 +347,9 @@ "Stock Ids": "Bestands-IDs", "Designs": "Designs", "your_stock_cart_for": "Ihr Stockwagen für", - "for_pricing_and_vouchers": "für Preisgestaltung und Gutscheine" + "for_pricing_and_vouchers": "für Preisgestaltung und Gutscheine", + + "print": "Drucken", + "detailed": "Detailliert", + "overview": "Übersicht" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index ec187725..7b8bcb40 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -362,5 +362,9 @@ "refresh_from": "Refresh From", "refreshing_rates": "Refreshing Rates", "updating_items": "Updating Items", - "for_pricing_and_vouchers": "for Pricing and Voucher" + "for_pricing_and_vouchers": "for Pricing and Voucher", + + "print": "Print", + "detailed": "Detailed", + "overview": "Overview" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index f5f5bbe8..e805ca96 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -347,5 +347,9 @@ "Stock Ids": "IDs de inventario", "Designs": "Diseños", "your_stock_cart_for": "Su carrito de stock para", - "for_pricing_and_vouchers": "para precios y vales" + "for_pricing_and_vouchers": "para precios y vales", + + "print": "Imprimir", + "detailed": "Detallado", + "overview": "Resumen" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 2d16cb7a..1e92020f 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -347,5 +347,9 @@ "Stock Ids": "Identifiants de stock", "Designs": "Designs", "your_stock_cart_for": "Votre panier de stock pour", - "for_pricing_and_vouchers": "pour la tarification et les bons" + "for_pricing_and_vouchers": "pour la tarification et les bons", + + "print": "Imprimer", + "detailed": "Détaillé", + "overview": "Aperçu" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index fc9caf9f..235305ac 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -347,5 +347,9 @@ "Stock Ids": "ID di magazzino", "Designs": "Design", "your_stock_cart_for": "Il tuo carrello stock per", - "for_pricing_and_vouchers": "per prezzi e voucher" + "for_pricing_and_vouchers": "per prezzi e voucher", + + "print": "Stampa", + "detailed": "Dettagliato", + "overview": "Riepilogo" } \ No newline at end of file diff --git a/services/api-handlers/emr-api-handler.ts b/services/api-handlers/emr-api-handler.ts index b0a86757..eb0e42f7 100644 --- a/services/api-handlers/emr-api-handler.ts +++ b/services/api-handlers/emr-api-handler.ts @@ -1,13 +1,26 @@ -import { executeEMRDeleteAPI, executeEMRGetAPI, executeEMRPostAPI, executeEMRPutAPI } from '../../utils/http-methods'; +import { EMRApiKey } from "../../utils/api-sdk-registry/emr_api_sdk_registry"; +import { + executeEMRDeleteAPI, + executeEMRGetAPI, + executeEMRPostAPI, + executeEMRPutAPI, +} from "../../utils/http-methods"; -const executeEMRAPIHandler = (apiMethod: string, apiName: string, apiData: string, token?: string, path?: string) => { - if (apiMethod === 'GET') { - return executeEMRGetAPI(apiName, apiData, token, path); - } else if (apiMethod === 'POST') { +const executeEMRAPIHandler = ( + apiMethod: string, + apiName: EMRApiKey, + apiData: string, + token?: string, + path?: string, + isBlob?: boolean, +) => { + if (apiMethod === "GET") { + return executeEMRGetAPI(apiName, apiData, token, path, isBlob); + } else if (apiMethod === "POST") { return executeEMRPostAPI(apiName, apiData, token, path); - } else if (apiMethod === 'PUT') { + } else if (apiMethod === "PUT") { return executeEMRPutAPI(apiName, apiData, token, path); - } else if (apiMethod === 'DELETE') { + } else if (apiMethod === "DELETE") { return executeEMRDeleteAPI(apiName, apiData, token, path); } }; diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index ae5b6ef6..1dd98aa5 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -1,49 +1,61 @@ -const emrAPISDKRegistry: any = { - 'login-api': '/api/login', - 'get-page-components-list-api': '/api/getComponents', - 'get-collections-list-api': '/api/getDsgCollections', - 'get-current-session-filters-api': '/api/getCsFilters', - 'post-insert-current-session-filters-api': '/api/insertCsFltrs', - 'get-product-listing-filters-api': '/api/getCatalogueFilterMasters', - 'get-product-listing-y-filters-api': '/api/getyCatalogueFilterMasters', - 'get-product-list-api': '/api/getDesigns', - 'delete-current-session-filters-api': '/api/delOrdDsg', - 'post-move-current-session-api': '/api/copyDesign', - 'product-detail-api': '/api/getDesignDetails', - 'cart-list': '/api/getOrdDsgList', - 'update-cart': '/api/updateOrdDsg', - 'delete-cart': '/api/clearOrderDsg', - 'place-order-api': '/api/createOrder', - 'price-list-api': '/api/fetchPrice', - 'get-site-map': '/api/collection-urls', - 'refresh-price-api': '/api/refreshPrice', - 'get-voucher-product-list': '/api/getVoucherDetails', - 'get-product-design-y-options': '/api/getyDsgConfg', - 'get-meta-tags-api': '/api/seo-api', - 'delete-current-session-api': '/api/clearUserData', - 'forgot-password-api': '/api/forgotPwd', - 'sign-up-api': '/api/SignUp', - 'order-list-api': '/api/getListViewData', - 'update-user-preferences': '/api/storeUserPreferences', - 'bom-details-api': '/api/bomChange', - 'get-metal-rate-api': '/api/getMetalRT', - 'post-metal-rate-api': '/api/updateMetalRT', - 'get-sizes-api': '/api/getSizes', - 'copy-stock-design': '/api/copyStckDsg', - 'stock-block-api': '/api/stockBlock', - 'get-voucher-headers-details-api': '/api/getVchHeaderDetails', - 'send-reset-password-email-api': '/api/sendEmail', - 'verify-reset-password-token-api': '/api/verifyLink', - 'get-filtered-sales-customer-api' : '/api/getFilteredSalesCustomer', - 'get-rate-look-up-options-api': '/api/getPLlist', - 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT', - 'refresh-voucher-rate-api': '/api/refreshRates', - 'get-param-list-api': '/api/getParamList', - 'get-user-default-data': '/api/getUserDeafults', - 'post-user-default-data': '/api/postUserDeafults', - 'get-list-data-api': '/api/getList', - 'get-y-param-list-api': '/api/getyParamList', - 'update-item-instruction-api': '/api/updateFields', -}; +const emrAPISDKRegistry = { + 'login-api': '/api/login', + 'get-page-components-list-api': '/api/getComponents', + 'get-collections-list-api': '/api/getDsgCollections', + 'get-current-session-filters-api': '/api/getCsFilters', + 'post-insert-current-session-filters-api': '/api/insertCsFltrs', + 'get-product-listing-filters-api': '/api/getCatalogueFilterMasters', + 'get-product-listing-y-filters-api': '/api/getyCatalogueFilterMasters', + 'get-product-list-api': '/api/getDesigns', + 'delete-current-session-filters-api': '/api/delOrdDsg', + 'post-move-current-session-api': '/api/copyDesign', + 'product-detail-api': '/api/getDesignDetails', + 'cart-list': '/api/getOrdDsgList', + 'update-cart': '/api/updateOrdDsg', + 'delete-cart': '/api/clearOrderDsg', + 'place-order-api': '/api/createOrder', + 'price-list-api': '/api/fetchPrice', + 'get-site-map': '/api/collection-urls', + 'refresh-price-api': '/api/refreshPrice', + 'get-product-design-y-options': '/api/getyDsgConfg', + 'get-user-default-data': '/api/getUserDeafults', + 'get-list-data-api': '/api/getList', + 'copy-stock-design': '/api/copyStckDsg', + 'get-voucher-product-list': '/api/getVoucherDetails', + 'get-rate-look-up-options-api': '/api/getPLlist', + 'create-customer-api': '/api/duplicate', + 'update-customer-api': '/api/updateFields', + 'get-pos-entry-api': '/api/getYPOS', + 'post-pos-closing-api': '/api/insertOrUpdateYPOS', + 'post-invoice-data-api': '/api/insertYPosInvoice', + 'get-invoice-list-api': '/api/getYPosInvoice', + 'refresh-voucher-rate-api': '/api/refreshRates', + 'order-list-api': '/api/getListViewData', + 'get-buttons-api': '/api/getYPosCTA', + 'get-vouchers-list-to-create-direct-invoice-api': '/api/getVouchersToCreateDirectInvoice', + 'get-report-api': '/api/getJasperReport', + 'get-meta-tags-api': '/api/seo-api', + 'delete-current-session-api': '/api/clearUserData', + 'forgot-password-api': '/api/forgotPwd', + 'sign-up-api': '/api/SignUp', + 'update-user-preferences': '/api/storeUserPreferences', + 'bom-details-api': '/api/bomChange', + 'get-metal-rate-api': '/api/getMetalRT', + 'post-metal-rate-api': '/api/updateMetalRT', + 'get-sizes-api': '/api/getSizes', + 'stock-block-api': '/api/stockBlock', + 'get-voucher-headers-details-api': '/api/getVchHeaderDetails', + 'send-reset-password-email-api': '/api/sendEmail', + 'verify-reset-password-token-api': '/api/verifyLink', + 'get-filtered-sales-customer-api' : '/api/getFilteredSalesCustomer', + 'check-design-stock-for-ct-api': '/api/checkDsgStckforCT', + 'get-param-list-api': '/api/getParamList', + 'post-user-default-data': '/api/postUserDeafults', + 'get-y-param-list-api': '/api/getyParamList', + 'update-item-instruction-api': '/api/updateFields', +} as const; + +export type EMRApiKey = keyof typeof emrAPISDKRegistry; +export type EMRApiPath = (typeof emrAPISDKRegistry)[EMRApiKey]; export default emrAPISDKRegistry; diff --git a/utils/engine-runner.ts b/utils/engine-runner.ts index f8977cd3..dcf19621 100644 --- a/utils/engine-runner.ts +++ b/utils/engine-runner.ts @@ -1,7 +1,7 @@ import executeEMRAPIHandler from '../services/api-handlers/emr-api-handler'; import executeSummitAPIHandler from '../services/api-handlers/summit-api-handler'; -const engineRunner = (apiMethod: string, apiName: string, apiData: any, token?: string, path?: string) => { +const engineRunner = (apiMethod: string, apiName: string, apiData: any, token?: string, path?: string, isBlob?: boolean) => { const engineName = process.env.NEXT_PUBLIC_ENGINE_NAME; const handlers: Record = { Summit: executeSummitAPIHandler, @@ -13,7 +13,7 @@ const engineRunner = (apiMethod: string, apiName: string, apiData: any, token?: throw new Error(`Unsupported engine name: ${engineName}`); } - return handler(apiMethod, apiName, apiData, token, path); + return handler(apiMethod, apiName, apiData, token, path, isBlob); }; export default engineRunner; diff --git a/utils/http-methods.ts b/utils/http-methods.ts index 79b23f31..4d34adbe 100644 --- a/utils/http-methods.ts +++ b/utils/http-methods.ts @@ -1,7 +1,9 @@ -import axios from 'axios'; -import fetchAPISDK from '../utils/get-api-sdk'; -import { CONSTANTS } from '../services/config/app-config'; -import APP_CONFIG from '../interfaces/app-config-interface'; +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { CONSTANTS } from "../services/config/app-config"; +import fetchAPISDK from "../utils/get-api-sdk"; +import axios from "axios"; +import { EMRApiKey } from "./api-sdk-registry/emr_api_sdk_registry"; /** * @function getVME - VME stands for Version, Method and Entity for that API function. @@ -17,7 +19,13 @@ const getVME = (frappeAppConfig: APP_CONFIG, apiName: string) => { }; }; -export const executeEMRGetAPI = async (apiName: string, apiData: any, token?: string, path?: string) => { +export const executeEMRGetAPI = async ( + apiName: EMRApiKey, + apiData: any, + token?: string, + _path?: string, + isBlob?: boolean, +) => { const sdkInfo = fetchAPISDK(apiName); let apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value if (apiData && Object.keys(apiData).length !== 0) { @@ -28,30 +36,46 @@ export const executeEMRGetAPI = async (apiName: string, apiData: any, token?: st apiURL = `${CONSTANTS.API_BASE_URL}${sdkInfo}?${storeParams}`; } // Make the API call - const response = await callGetAPI(`${apiURL}`, `token ${token}`); + const response = await callGetAPI(`${apiURL}`, `token ${token}`, isBlob); return response; }; -export const executeEMRPostAPI = async (apiName: string, apiData: any, token?: string, path?: string) => { +export const executeEMRPostAPI = async ( + apiName: EMRApiKey, + apiData: any, + token?: string, + _path?: string +) => { const sdkInfo = fetchAPISDK(apiName); - let apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value + const apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value const response = await callPostAPI(apiURL, apiData, `token ${token}`); return response; }; -export const executeEMRPutAPI = async (apiName: string, apiData: any, token?: string, path?: string) => { +export const executeEMRPutAPI = async ( + apiName: EMRApiKey, + apiData: any, + token?: string, + _path?: string +) => { const sdkInfo = fetchAPISDK(apiName); - let apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value + const apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value const response = await callPutAPI(apiURL, apiData, `token ${token}`); return response; }; -export const executeEMRDeleteAPI = async (apiName: string, apiData: any, token?: string, path?: string) => { +export const executeEMRDeleteAPI = async ( + apiName: EMRApiKey, + apiData: any, + token?: string, + _path?: string +) => { const sdkInfo = fetchAPISDK(apiName); - let apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value + const apiURL: string = `${CONSTANTS.API_BASE_URL}${sdkInfo}`; // Initialize with a default value const response = await callDeleteAPI(apiURL, apiData, `token ${token}`); return response; }; + /** * Fetches data from an API by handling repetitive steps like fetching SDK names, * getting the Frappe app version, constructing the API URL, and making the call. @@ -132,13 +156,14 @@ export const executeDELETEAPI = async (frappeAppConfig: APP_CONFIG, apiName: str return response; }; -export const callGetAPI = async (url: string, token?: any) => { +export const callGetAPI = async (url: string, token?: any, isBlob?: boolean) => { let response: any; - const API_CONFIG = { + const API_CONFIG: any = { headers: { - Accept: 'application/json', + Accept: isBlob ? "*/*" : "application/json", ...(token ? { Authorization: token } : {}), }, + ...(isBlob ? { responseType: "blob" } : {}), // ✅ HERE }; await axios .get(`${url}`, { @@ -149,15 +174,17 @@ export const callGetAPI = async (url: string, token?: any) => { response = res; }) .catch((err: any) => { - if (err.code === 'ECONNABORTED') { - response = 'Request timed out. API took too long to return response.'; - } else if (err.code === 'ERR_BAD_REQUEST') { + if (err.code === "ECONNABORTED") { + response = "Request timed out. API took too long to return response."; + } else if (err.code === "ERR_BAD_REQUEST") { // response = err?.response?.data?.exception ?? `Status Code: ${err.status} Bad Request`; response = err?.response?.data?.exception ?? err?.response; - } else if (err.code === 'ERR_INVALID_URL') { - response = 'Invalid URL'; + } else if (err.code === "ERR_INVALID_URL") { + response = "Invalid URL"; } else { - response = err?.response?.data?.error || `Status Code: ${err.status}. ${err?.message}`; + response = + err?.response?.data?.error || + `Status Code: ${err.status}. ${err?.message}`; } }); return response; @@ -178,13 +205,13 @@ export const callPutAPI = async (url: string, body: any, token?: any) => { response = res; }) .catch((err: any) => { - if (err.code === 'ECONNABORTED') { - response = 'Request timed out. API took too long to return response.'; - } else if (err.code === 'ERR_BAD_REQUEST') { + if (err.code === "ECONNABORTED") { + response = "Request timed out. API took too long to return response."; + } else if (err.code === "ERR_BAD_REQUEST") { // response = err?.response?.data?.exception ?? `Status Code: ${err.status} Bad Request`; response = err?.response?.data?.exception ?? err?.response; - } else if (err.code === 'ERR_INVALID_URL') { - response = 'Invalid URL'; + } else if (err.code === "ERR_INVALID_URL") { + response = "Invalid URL"; } else { response = err; } @@ -208,13 +235,13 @@ export const callPostAPI = async (url: string, body: any, token?: any) => { response = res; }) .catch((err: any) => { - if (err.code === 'ECONNABORTED') { - response = 'Request timed out. API took too long to return response.'; - } else if (err.code === 'ERR_BAD_REQUEST') { + if (err.code === "ECONNABORTED") { + response = "Request timed out. API took too long to return response."; + } else if (err.code === "ERR_BAD_REQUEST") { // response = err?.response?.data?.exception ?? `Status Code: ${err.status} Bad Request`; response = err?.response?.data?.exception ?? err?.response; - } else if (err.code === 'ERR_INVALID_URL') { - response = 'Invalid URL'; + } else if (err.code === "ERR_INVALID_URL") { + response = "Invalid URL"; } else { response = err; } @@ -230,17 +257,17 @@ const callDeleteAPI = async (url: string, body?: any, token?: any) => { }; await axios .delete(`${url}`, { headers: { ...API_CONFIG.headers }, data: { ...body } }) - .then((res) => { + .then((res: any) => { response = res; }) .catch((err: any) => { - if (err.code === 'ECONNABORTED') { - response = 'Request timed out. API took too long to return response.'; - } else if (err.code === 'ERR_BAD_REQUEST') { + if (err.code === "ECONNABORTED") { + response = "Request timed out. API took too long to return response."; + } else if (err.code === "ERR_BAD_REQUEST") { // response = err?.response?.data?.exception ?? `Status Code: ${err.status} Bad Request`; response = err?.response?.data?.exception ?? err?.response; - } else if (err.code === 'ERR_INVALID_URL') { - response = 'Invalid URL'; + } else if (err.code === "ERR_INVALID_URL") { + response = "Invalid URL"; } else { response = err; } From 8488e5aa932f979211546fa9fc8cc4aaada60080 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 9 Feb 2026 12:32:02 +0530 Subject: [PATCH 27/37] feat: enhance API SDK integration by adding type safety for EMR API keys --- store/slices/general_slices/kc-slice.ts | 2 -- utils/get-api-sdk.ts | 4 ++-- utils/http-methods.ts | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 90a26d4f..2fb8e4fc 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -86,11 +86,9 @@ export const KCSlice = createSlice({ state.currentScope = action.payload; }, setCustomer: (state, action) => { - console.log("gey", action.payload) state.customer = action.payload; }, setScope: (state, action) => { - console.log("tewyu", action.payload); state.scope = action.payload; }, setFilters: (state, action) => { diff --git a/utils/get-api-sdk.ts b/utils/get-api-sdk.ts index a948fbec..1636bb87 100644 --- a/utils/get-api-sdk.ts +++ b/utils/get-api-sdk.ts @@ -1,9 +1,9 @@ import apiSdkRegistry from './api_sdk_registry'; -import emrSdkRegistry from './api-sdk-registry/emr_api_sdk_registry'; +import emrSdkRegistry, { EMRApiKey } from './api-sdk-registry/emr_api_sdk_registry'; const fetchAPISDK = (apiName: string) => { const engineName = process.env.NEXT_PUBLIC_ENGINE_NAME; - if (engineName === 'EMR') return emrSdkRegistry[apiName]; + if (engineName === 'EMR') return emrSdkRegistry[apiName as EMRApiKey]; else if (engineName === 'Summit') return apiSdkRegistry[apiName]; }; diff --git a/utils/http-methods.ts b/utils/http-methods.ts index 4d34adbe..e2a5c0bf 100644 --- a/utils/http-methods.ts +++ b/utils/http-methods.ts @@ -4,6 +4,7 @@ import { CONSTANTS } from "../services/config/app-config"; import fetchAPISDK from "../utils/get-api-sdk"; import axios from "axios"; import { EMRApiKey } from "./api-sdk-registry/emr_api_sdk_registry"; +import APP_CONFIG from "../interfaces/app-config-interface"; /** * @function getVME - VME stands for Version, Method and Entity for that API function. From 500296b439dbd2911d3b388680372f2ead41e177 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 12 Feb 2026 15:15:37 +0530 Subject: [PATCH 28/37] feat: add translations for stock synchronization and client selection in multiple languages --- public/locales/de/common.json | 8 +++++++- public/locales/en/common.json | 8 +++++++- public/locales/es/common.json | 8 +++++++- public/locales/fr/common.json | 8 +++++++- public/locales/it/common.json | 8 +++++++- utils/api-sdk-registry/emr_api_sdk_registry.ts | 1 + 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index e83e5410..5de7e8d1 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -351,5 +351,11 @@ "print": "Drucken", "detailed": "Detailliert", - "overview": "Übersicht" + "overview": "Übersicht", + + "sync_stock": "Bestand synchronisieren", + "select_all_client": "Alle Kunden auswählen", + "client_code": "Kundencode", + "only_for_filtering": "nur zum Filtern", + "sync": "Synchronisieren" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 7b8bcb40..bddbc6a4 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -366,5 +366,11 @@ "print": "Print", "detailed": "Detailed", - "overview": "Overview" + "overview": "Overview", + + "sync_stock": "Sync Stock", + "select_all_client": "Select All Clients", + "client_code": "Client Code", + "only_for_filtering": "only for filtering", + "sync": "Sync" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index e805ca96..eb62548c 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -351,5 +351,11 @@ "print": "Imprimir", "detailed": "Detallado", - "overview": "Resumen" + "overview": "Resumen", + + "sync_stock": "Sincronizar stock", + "select_all_client": "Seleccionar todos los clientes", + "client_code": "Código de cliente", + "only_for_filtering": "solo para filtrar", + "sync": "Sincronizar" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 1e92020f..3836b3c7 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -351,5 +351,11 @@ "print": "Imprimer", "detailed": "Détaillé", - "overview": "Aperçu" + "overview": "Aperçu", + + "sync_stock": "Synchroniser le stock", + "select_all_client": "Sélectionner tous les clients", + "client_code": "Code client", + "only_for_filtering": "uniquement pour le filtrage", + "sync": "Synchroniser" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index 235305ac..eb373b3d 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -351,5 +351,11 @@ "print": "Stampa", "detailed": "Dettagliato", - "overview": "Riepilogo" + "overview": "Riepilogo", + + "sync_stock": "Sincronizza stock", + "select_all_client": "Seleziona tutti i clienti", + "client_code": "Codice cliente", + "only_for_filtering": "solo per il filtraggio", + "sync": "Sincronizza" } \ No newline at end of file diff --git a/utils/api-sdk-registry/emr_api_sdk_registry.ts b/utils/api-sdk-registry/emr_api_sdk_registry.ts index 1dd98aa5..b807c0fb 100644 --- a/utils/api-sdk-registry/emr_api_sdk_registry.ts +++ b/utils/api-sdk-registry/emr_api_sdk_registry.ts @@ -53,6 +53,7 @@ const emrAPISDKRegistry = { 'post-user-default-data': '/api/postUserDeafults', 'get-y-param-list-api': '/api/getyParamList', 'update-item-instruction-api': '/api/updateFields', + "sync-stock-list-api": "/api/manualStockSync", } as const; export type EMRApiKey = keyof typeof emrAPISDKRegistry; From c37171d7e14b43d3ad27ebc53925be7e2365e88a Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 12 Feb 2026 17:41:49 +0530 Subject: [PATCH 29/37] fix: update default currentScope to 'Database' --- store/slices/general_slices/kc-slice.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 2fb8e4fc..85d3efc4 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -38,7 +38,7 @@ const initialState: FiltersState = { silverRate: 0, filters: {}, filtersSetOfAPI: {}, - currentScope: '', + currentScope: 'Database', customer: null, scope: { label: 'New Session (PDCM Design Bank)', value: 'Database' }, userDefaultData: null, From a1ca628e7025ab3e148c935f35c0a5463b73b56d Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 13 Feb 2026 11:54:27 +0530 Subject: [PATCH 30/37] fix: update login hook to use dispatch for setting customer and scope --- hooks/AuthHooks/useLoginHook.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 6d817fc6..2c7844b0 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -59,8 +59,8 @@ const useLoginHook = () => { } fetchUserDefaultData(tokenData?.data?.access_token); - setCustomer(null); - setScope({ label: 'New Session (PDCM Design Bank)', value: 'Database' }); + dispatch(setCustomer(null)); + dispatch(setScope({ label: 'New Session (PDCM Design Bank)', value: 'Database' })); // Redirect to the home page or any other page after successful login if (tokenData?.data?.isPwdChg === 0) { From d89a5052a2c3590cc15910300a8b47fac8c8d0eb Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 16 Feb 2026 12:19:36 +0530 Subject: [PATCH 31/37] feat: integrate @tanstack/react-query for improved data fetching and caching, add query client setup --- lib/query-client.ts | 21 +++++++++ package-lock.json | 103 ++++++++++++++++++++++++++++++++++++++++++-- package.json | 1 + 3 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 lib/query-client.ts diff --git a/lib/query-client.ts b/lib/query-client.ts new file mode 100644 index 00000000..139c0e30 --- /dev/null +++ b/lib/query-client.ts @@ -0,0 +1,21 @@ +import { QueryClient } from '@tanstack/react-query'; + +const KC_LISTING_STALE_MS = 5 * 60 * 1000; // 5 minutes – same scope+cmcd won't refetch when navigating back +const KC_SESSION_FILTERS_STALE_MS = 5 * 60 * 1000; + +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: KC_LISTING_STALE_MS, + gcTime: 10 * 60 * 1000, // 10 min (formerly cacheTime) + }, + }, +}); + +export const KC_QUERY_KEYS = { + products: (cmcd: string, scope: string, filtersSignature: string) => + ['kc-products', cmcd, scope, filtersSignature] as const, + cart: (cmcd: string, odChr: string) => ['kc-cart', cmcd, odChr] as const, + voucher: (cmcd: string, voucherNoKey: string) => ['kc-voucher', cmcd, voucherNoKey] as const, + sessionFilters: (cmcd: string) => ['kc-session-filters', cmcd] as const, +}; diff --git a/package-lock.json b/package-lock.json index 2b3a5438..28c7c6e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@popperjs/core": "^2.11.8", "@react-oauth/google": "^0.12.1", "@reduxjs/toolkit": "^1.9.5", + "@tanstack/react-query": "^5.59.0", "@types/aos": "^3.0.4", "aos": "^2.3.4", "axios": "^1.4.0", @@ -25,6 +26,7 @@ "next": "13.4.1", "react": "18.2.0", "react-bootstrap": "^2.7.4", + "react-datepicker": "^8.10.0", "react-dom": "18.2.0", "react-ga4": "^2.1.0", "react-i18next": "^15.6.0", @@ -2678,14 +2680,43 @@ } }, "node_modules/@floating-ui/dom": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.3.tgz", - "integrity": "sha512-uZA413QEpNuhtb3/iIKoYMSK07keHPYeXF02Zhd6e213j+d1NamLix/mCLxBUDW/Gx52sPH2m+chlUsyaBs/Ag==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.4.tgz", + "integrity": "sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==", + "license": "MIT", "dependencies": { "@floating-ui/core": "^1.7.3", "@floating-ui/utils": "^0.2.10" } }, + "node_modules/@floating-ui/react": { + "version": "0.27.16", + "resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.27.16.tgz", + "integrity": "sha512-9O8N4SeG2z++TSM8QA/KTeKFBVCNEz/AGS7gWPJf6KFRzmRWixFRnCnkPHRDwSVZW6QPDO6uT0P2SpWNKCc9/g==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.1.6", + "@floating-ui/utils": "^0.2.10", + "tabbable": "^6.0.0" + }, + "peerDependencies": { + "react": ">=17.0.0", + "react-dom": ">=17.0.0" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.6.tgz", + "integrity": "sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.7.4" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, "node_modules/@floating-ui/utils": { "version": "0.2.10", "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.10.tgz", @@ -4304,6 +4335,32 @@ "tslib": "^2.4.0" } }, + "node_modules/@tanstack/query-core": { + "version": "5.90.20", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.20.tgz", + "integrity": "sha512-OMD2HLpNouXEfZJWcKeVKUgQ5n+n3A2JFmBaScpNDUqSrQSjiveC7dKMe53uJUg1nDG16ttFPz2xfilz6i2uVg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.90.21", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.21.tgz", + "integrity": "sha512-0Lu6y5t+tvlTJMTO7oh5NSpJfpg/5D41LlThfepTixPYkJ0sE2Jj0m0f6yYqujBwIXlId87e234+MxG3D3g7kg==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.90.20" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18 || ^19" + } + }, "node_modules/@testing-library/jest-dom": { "version": "5.17.0", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz", @@ -6823,6 +6880,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/debounce": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/debounce/-/debounce-2.2.0.tgz", @@ -16342,6 +16409,30 @@ "react": "~0.14.9 || ^15.0.0 || ^16.0.0" } }, + "node_modules/react-datepicker": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-8.10.0.tgz", + "integrity": "sha512-JIXuA+g+qP3c4MVJpx24o7n1gnv3WV/8A/D6964HucY1FlSEc30+ITPNUfbKZXYHl5rruCtxYCwi2lzn7gaz7g==", + "license": "MIT", + "dependencies": { + "@floating-ui/react": "^0.27.15", + "clsx": "^2.1.1", + "date-fns": "^4.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc", + "react-dom": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc" + } + }, + "node_modules/react-datepicker/node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/react-dom": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", @@ -17587,6 +17678,12 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, + "node_modules/tabbable": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.3.0.tgz", + "integrity": "sha512-EIHvdY5bPLuWForiR/AN2Bxngzpuwn1is4asboytXtpTgsArc+WmSJKVLlhdh71u7jFcryDqB2A8lQvj78MkyQ==", + "license": "MIT" + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", diff --git a/package.json b/package.json index e5cbf390..2a748d66 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@popperjs/core": "^2.11.8", "@react-oauth/google": "^0.12.1", "@reduxjs/toolkit": "^1.9.5", + "@tanstack/react-query": "^5.59.0", "@types/aos": "^3.0.4", "aos": "^2.3.4", "axios": "^1.4.0", From dd3743bc7f605cfc362c779d6fd49b712025f02c Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 19 Feb 2026 14:01:30 +0530 Subject: [PATCH 32/37] fix: add resetStore dispatch after successful login to clear authentication state --- hooks/AuthHooks/useLoginHook.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 2c7844b0..4f70c569 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -16,6 +16,7 @@ import useCurrencyLanguageHandler from '../GeneralHooks/LanguageHandler'; import { currencyOptions } from '../../utils/addon-utils/currency-map'; import useUserDefaultData from '../addon-hooks/kc-hooks/useUserData'; import { setCustomer, setDesignBankCount, setScope } from '../../store/slices/general_slices/kc-slice'; +import { resetStore } from '../../store/slices/auth/logout-slice'; const useLoginHook = () => { const { AFTER_LOGIN_REDIRECT_URL } = CONSTANTS; @@ -47,8 +48,11 @@ const useLoginHook = () => { // const tokenData = await getTokenFromLoginAPI(SUMMIT_APP_CONFIG, userParams); // Need to check below login api logic. Need to make generic. const tokenData = await emrLogin(userParams); - + if (tokenData?.success === true && tokenData?.msg === 'success' && tokenData?.data?.hasOwnProperty('access_token')) { + localStorage.clear(); + dispatch(resetStore()); + localStorage.setItem('isLoggedIn', 'true'); localStorage.setItem('user', values.usr); localStorage.setItem('party_name', tokenData?.data?.full_name); From f3b88ec4a0dd2b3ef57a1a2c19c6d87a4fad8368 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 20 Feb 2026 18:35:00 +0530 Subject: [PATCH 33/37] feat: update localization strings for stock filtering in multiple languages --- public/locales/de/common.json | 2 +- public/locales/en/common.json | 2 +- public/locales/es/common.json | 2 +- public/locales/fr/common.json | 2 +- public/locales/it/common.json | 2 +- store/slices/general_slices/kc-slice.ts | 8 ++++++-- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 5de7e8d1..fa1621ad 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -356,6 +356,6 @@ "sync_stock": "Bestand synchronisieren", "select_all_client": "Alle Kunden auswählen", "client_code": "Kundencode", - "only_for_filtering": "nur zum Filtern", + "only_for_stock_filtering": "Nur zur Bestandsfilterung", "sync": "Synchronisieren" } \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index bddbc6a4..c2104b8f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -371,6 +371,6 @@ "sync_stock": "Sync Stock", "select_all_client": "Select All Clients", "client_code": "Client Code", - "only_for_filtering": "only for filtering", + "only_for_stock_filtering": "only for Stock filtering", "sync": "Sync" } \ No newline at end of file diff --git a/public/locales/es/common.json b/public/locales/es/common.json index eb62548c..b75fe6e9 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -356,6 +356,6 @@ "sync_stock": "Sincronizar stock", "select_all_client": "Seleccionar todos los clientes", "client_code": "Código de cliente", - "only_for_filtering": "solo para filtrar", + "only_for_stock_filtering": "Solo para el filtrado de stock", "sync": "Sincronizar" } \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 3836b3c7..0181909d 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -356,6 +356,6 @@ "sync_stock": "Synchroniser le stock", "select_all_client": "Sélectionner tous les clients", "client_code": "Code client", - "only_for_filtering": "uniquement pour le filtrage", + "only_for_stock_filtering": "Uniquement pour le filtrage du stock", "sync": "Synchroniser" } \ No newline at end of file diff --git a/public/locales/it/common.json b/public/locales/it/common.json index eb373b3d..9603d884 100644 --- a/public/locales/it/common.json +++ b/public/locales/it/common.json @@ -356,6 +356,6 @@ "sync_stock": "Sincronizza stock", "select_all_client": "Seleziona tutti i clienti", "client_code": "Codice cliente", - "only_for_filtering": "solo per il filtraggio", + "only_for_stock_filtering": "Solo per il filtraggio dello stock", "sync": "Sincronizza" } \ No newline at end of file diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 85d3efc4..a3481a73 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -6,7 +6,7 @@ interface FiltersState { customer: any; filters: { [customer: string]: { [scope: string]: any } }; filtersSetOfAPI: { [customer: string]: { [scope: string]: any } }; - + toggleProductView: 'grid' | 'list'; hideFiltersOnFirstLoad: boolean; metalRateSidebar: boolean; userDefaultSidebar: boolean; @@ -47,6 +47,7 @@ const initialState: FiltersState = { gradeChangeList: [], diamondChangeList: [], colorStoneChangeList: [], + toggleProductView: 'grid', showProductCardDetails: false, selectAllProducts: false, }; @@ -127,6 +128,9 @@ export const KCSlice = createSlice({ setColorStoneChangeList: (state, action) => { state.colorStoneChangeList = action.payload; }, + setToggleProductView: (state, action) => { + state.toggleProductView = action.payload; + }, setShowProductCardDetails: (state, action) => { state.showProductCardDetails = action.payload; }, @@ -136,6 +140,6 @@ export const KCSlice = createSlice({ }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setCustomer, setScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setCustomer, setScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts, setToggleProductView } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From d9ef5ec2ca9aec18393b5f5445e51ec66e56912f Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Wed, 25 Feb 2026 18:22:17 +0530 Subject: [PATCH 34/37] feat: add stock cart slice for managing stock cart state and actions --- store/root-reducer.ts | 2 + .../cart-slices/stock-cart-local-slice.ts | 71 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 store/slices/cart-slices/stock-cart-local-slice.ts diff --git a/store/root-reducer.ts b/store/root-reducer.ts index 701841f6..6723fdf2 100644 --- a/store/root-reducer.ts +++ b/store/root-reducer.ts @@ -2,6 +2,7 @@ import { combineReducers } from '@reduxjs/toolkit'; import { resetStore } from './slices/auth/logout-slice'; import GetAccessTokenReducer from './slices/auth/token-login-slice'; import cartLocalSlice from './slices/cart-slices/cart-local-slice'; +import stockCartLocalSlice from './slices/cart-slices/stock-cart-local-slice'; import catalogLocalSlice from './slices/catalog-slice/catalog-local-slice'; import CurrencyReducer from './slices/general_slices/multi-currency-slice'; import MultiLanguageReducer from './slices/general_slices/multilang-slice'; @@ -23,6 +24,7 @@ const appReducer = combineReducers({ SelectedLangDataReducer: SelectedLangDataScreen, wishlistSlice: wishlistSlice, cart: cartLocalSlice, + stockCart: stockCartLocalSlice, catalogSlice: catalogLocalSlice, quickOrder: quickOrderSlice, KCSlice: kcSlice, diff --git a/store/slices/cart-slices/stock-cart-local-slice.ts b/store/slices/cart-slices/stock-cart-local-slice.ts new file mode 100644 index 00000000..72fb2554 --- /dev/null +++ b/store/slices/cart-slices/stock-cart-local-slice.ts @@ -0,0 +1,71 @@ +import { createSlice, PayloadAction } from '@reduxjs/toolkit'; +import { RootState } from '../../root-reducer'; + +interface CartState { + items: any[]; + stockCartCount: any; + grandTotal: number; + error: string | null; + isLoading: 'idle' | 'pending' | 'succeeded' | 'failed'; + quotation_Id: string; +} + +const initialState: CartState = { + items: [], + stockCartCount: 0, + grandTotal: 0, + error: null, + isLoading: 'idle', + quotation_Id: '', +}; + +const cartSlice = createSlice({ + name: 'stockCart', + initialState, + reducers: { + addStockCartList: (state, action) => { + state.items = action.payload?.cartData; + state.stockCartCount = action.payload.stockCartCount; + state.grandTotal = action.payload.grandTotal; + state.quotation_Id = action?.payload?.quotationId; + }, + addItemToStockCart: (state, action) => { + if (!state.items) { + state.items = []; + } + const mergedArray = [...state?.items, ...action?.payload.filter((item: any) => !state?.items.includes(item))]; + state.items = mergedArray; + state.stockCartCount = state?.items?.length || 1; + + state.error = null; + }, + removeItemFromStockCart: (state, action: PayloadAction) => { + state.items = state.items.filter((item) => item !== action.payload); + state.stockCartCount = state.stockCartCount - 1; + state.error = null; + }, + updateItemQuantity: (state, action: PayloadAction<{ id: number; quantity: number }>) => { + const item = state.items.find((item) => item.id === action.payload.id); + if (item) { + item.quantity = action.payload.quantity; + } + state.error = null; + }, + setLoading: (state, action: PayloadAction<'idle' | 'pending' | 'succeeded' | 'failed'>) => { + state.isLoading = action.payload; + }, + setError: (state, action: PayloadAction) => { + state.error = action.payload; + }, + clearCart: (state) => { + state.items = []; + state.error = null; + state.stockCartCount = 0; + }, + }, +}); +export const { addItemToStockCart, removeItemFromStockCart, updateItemQuantity, setLoading, setError, clearCart, addStockCartList } = cartSlice.actions; + +export const selectStockCart = (state: RootState) => state.stockCart; + +export default cartSlice.reducer; From dcbd28a11a97243a976de5630c0f9027510c2d8e Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Thu, 26 Feb 2026 13:55:52 +0530 Subject: [PATCH 35/37] feat: add redirects in next.config.js and update dependencies for @tanstack/query packages --- hooks/AuthHooks/useLoginHook.ts | 73 ++++++++++++++++++--------------- next.config.js | 11 ++++- package-lock.json | 47 +++++++++++++++++++++ package.json | 2 + 4 files changed, 99 insertions(+), 34 deletions(-) diff --git a/hooks/AuthHooks/useLoginHook.ts b/hooks/AuthHooks/useLoginHook.ts index 4f70c569..84fa6f4d 100644 --- a/hooks/AuthHooks/useLoginHook.ts +++ b/hooks/AuthHooks/useLoginHook.ts @@ -37,6 +37,7 @@ const useLoginHook = () => { const fetchToken = async (values: TypeLoginForm) => { setLoginBtnLoader(true); + try { const userParams: TypeLoginAPIParams = { values: { ...values }, @@ -44,44 +45,50 @@ const useLoginHook = () => { loginViaOTP: false, LoginViaGoogle: false, }; - - // const tokenData = await getTokenFromLoginAPI(SUMMIT_APP_CONFIG, userParams); - // Need to check below login api logic. Need to make generic. + const tokenData = await emrLogin(userParams); - - if (tokenData?.success === true && tokenData?.msg === 'success' && tokenData?.data?.hasOwnProperty('access_token')) { - localStorage.clear(); - dispatch(resetStore()); - - localStorage.setItem('isLoggedIn', 'true'); - localStorage.setItem('user', values.usr); - localStorage.setItem('party_name', tokenData?.data?.full_name); - dispatch(setDesignBankCount(tokenData?.data?.count)); - - if (tokenData?.data?.isPwdChg !== 0) { - dispatch(storeToken(tokenData?.data)); - } - - fetchUserDefaultData(tokenData?.data?.access_token); - dispatch(setCustomer(null)); - dispatch(setScope({ label: 'New Session (PDCM Design Bank)', value: 'Database' })); - - // Redirect to the home page or any other page after successful login - if (tokenData?.data?.isPwdChg === 0) { - router.push('/forgot_password'); - } else { - if (AFTER_LOGIN_REDIRECT_URL) { - router.push(AFTER_LOGIN_REDIRECT_URL); - } else { - router.push('/') - } + + if ( + tokenData?.success === true && + tokenData?.msg === 'success' && + tokenData?.data?.access_token + ) { + const { access_token, isPwdChg, count, full_name } = tokenData.data; + + if (isPwdChg !== 0) { + dispatch(storeToken(tokenData.data)); } - // toast.success('Login Successfully'); + + const redirectUrl = + isPwdChg === 0 + ? '/forgot_password' + : AFTER_LOGIN_REDIRECT_URL || '/'; + + router.replace(redirectUrl); + + setTimeout(() => { + dispatch(setDesignBankCount(count)); + dispatch(setCustomer(null)); + dispatch( + setScope({ + label: 'New Session (PDCM Design Bank)', + value: 'Database', + }) + ); + + fetchUserDefaultData(access_token); + + localStorage.setItem('isLoggedIn', 'true'); + localStorage.setItem('user', values.usr); + localStorage.setItem('party_name', full_name); + }, 0); } } catch (error: any) { - if (error?.status === 400 && error?.response?.data?.error === "Invalid username or password") { + if ( + error?.status === 400 && + error?.response?.data?.error === 'Invalid username or password' + ) { toast.error(t('invalid_credentials')); - return; } else { toast.error(t('error_while_login')); } diff --git a/next.config.js b/next.config.js index 77c839d6..1885d6d8 100644 --- a/next.config.js +++ b/next.config.js @@ -8,8 +8,17 @@ const nextConfig = { images: { domains: ['summit.8848digitalerp.com', 'staging-twinkle.8848digitalerp.com', 'emr-euro-shine.8848digitalerp.com', 'backend.atelier-reya.com', 'kc-backend.8848digitalcloud.com'], }, - reactStrictMode: false, + reactStrictMode: false, swcMinify: true, + async redirects() { + return [ + { + source: '/', + destination: '/product-category', + permanent: false, + }, + ] + }, }; module.exports = withBundleAnalyzer(nextConfig); diff --git a/package-lock.json b/package-lock.json index 28c7c6e0..d5adc901 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,9 @@ "@popperjs/core": "^2.11.8", "@react-oauth/google": "^0.12.1", "@reduxjs/toolkit": "^1.9.5", + "@tanstack/query-async-storage-persister": "^5.90.22", "@tanstack/react-query": "^5.59.0", + "@tanstack/react-query-persist-client": "^5.90.22", "@types/aos": "^3.0.4", "aos": "^2.3.4", "axios": "^1.4.0", @@ -4335,6 +4337,20 @@ "tslib": "^2.4.0" } }, + "node_modules/@tanstack/query-async-storage-persister": { + "version": "5.90.22", + "resolved": "https://registry.npmjs.org/@tanstack/query-async-storage-persister/-/query-async-storage-persister-5.90.22.tgz", + "integrity": "sha512-I8Dbi79aoM2S2VqfuxTG13TkqmiDSiZ95Bi1YRXvwGVMsOnaJ99Ou1dIw53kHY3y10Vgwv3YYThw4TN/FM/N3A==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.90.20", + "@tanstack/query-persist-client-core": "5.91.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, "node_modules/@tanstack/query-core": { "version": "5.90.20", "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.90.20.tgz", @@ -4345,6 +4361,19 @@ "url": "https://github.com/sponsors/tannerlinsley" } }, + "node_modules/@tanstack/query-persist-client-core": { + "version": "5.91.19", + "resolved": "https://registry.npmjs.org/@tanstack/query-persist-client-core/-/query-persist-client-core-5.91.19.tgz", + "integrity": "sha512-whrASqbVq8261Ue+/ZzpHsrLDYVfRaENs4HTdLuYKxawkGWzdMfV7BmOdWl8ZF0mEBEbrQR8V6oE3R635JF2Fw==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.90.20" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, "node_modules/@tanstack/react-query": { "version": "5.90.21", "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.90.21.tgz", @@ -4361,6 +4390,23 @@ "react": "^18 || ^19" } }, + "node_modules/@tanstack/react-query-persist-client": { + "version": "5.90.22", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-persist-client/-/react-query-persist-client-5.90.22.tgz", + "integrity": "sha512-BrD3Y/SsrSIDl+t/gpYvjvGHXd7m7oF+GIqktKE8LmTgt7bS1lYHd/CLkVxMPixTU53gHHVFfPNGmY7Hv4L/7g==", + "license": "MIT", + "dependencies": { + "@tanstack/query-persist-client-core": "5.91.19" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@tanstack/react-query": "^5.90.20", + "react": "^18 || ^19" + } + }, "node_modules/@testing-library/jest-dom": { "version": "5.17.0", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz", @@ -6445,6 +6491,7 @@ "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", "dev": true, + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.1" }, diff --git a/package.json b/package.json index 2a748d66..43386888 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ "@popperjs/core": "^2.11.8", "@react-oauth/google": "^0.12.1", "@reduxjs/toolkit": "^1.9.5", + "@tanstack/query-async-storage-persister": "^5.90.22", "@tanstack/react-query": "^5.59.0", + "@tanstack/react-query-persist-client": "^5.90.22", "@types/aos": "^3.0.4", "aos": "^2.3.4", "axios": "^1.4.0", From ef214cfad3fb0ae6824a5a35e4b91b017c13593d Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Mon, 2 Mar 2026 18:34:56 +0530 Subject: [PATCH 36/37] feat: add designSizes and attributesData to FiltersState in KCSlice --- store/slices/general_slices/kc-slice.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index a3481a73..0eddf7ac 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -24,6 +24,8 @@ interface FiltersState { colorStoneChangeList: {label: string, value: string}[]; showProductCardDetails: boolean; selectAllProducts: boolean; + designSizes: any[] | null, + attributesData: any[] | null, } const initialState: FiltersState = { @@ -50,6 +52,8 @@ const initialState: FiltersState = { toggleProductView: 'grid', showProductCardDetails: false, selectAllProducts: false, + designSizes: [], + attributesData: [], }; export const KCSlice = createSlice({ @@ -137,9 +141,15 @@ export const KCSlice = createSlice({ setSelectAllProducts: (state, action) => { state.selectAllProducts = action.payload; }, + setDesignSizes: (state, action) => { + state.designSizes = action.payload; + }, + setAttributesData: (state, action) => { + state.attributesData = action.payload; + }, }, }) -export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setCustomer, setScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts, setToggleProductView } = KCSlice.actions; +export const { setHideFiltersOnFirstLoad, setGridCols, setGoldRate, setPalladiumRate, setPlatinumRate, setSilverRate, setMetalRateSidebar, setPrevCSFilters, setFilters, setFiltersSetOfAPI, setCurrentScope, setCustomer, setScope, setUserDefaultData, setUserDefaultLoading, setUserDefaultSidebar, setDesignBankCount, setGradeChangeList, setDiamondChangeList, setColorStoneChangeList, setShowProductCardDetails, setSelectAllProducts, setToggleProductView, setDesignSizes, setAttributesData } = KCSlice.actions; export const KCFromStore = (state: any) => state.KCSlice; export default KCSlice.reducer; \ No newline at end of file From 5f87bed579bb82fbdc17a33addb374781bcb7751 Mon Sep 17 00:00:00 2001 From: nvnt122 Date: Fri, 6 Mar 2026 10:01:28 +0530 Subject: [PATCH 37/37] fix: add optional chaining to prevent errors when accessing filters --- hooks/ProductListPageHooks/useProductListFilterHook.ts | 10 +++++----- store/slices/general_slices/kc-slice.ts | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hooks/ProductListPageHooks/useProductListFilterHook.ts b/hooks/ProductListPageHooks/useProductListFilterHook.ts index 81202db0..ae549887 100644 --- a/hooks/ProductListPageHooks/useProductListFilterHook.ts +++ b/hooks/ProductListPageHooks/useProductListFilterHook.ts @@ -69,17 +69,17 @@ const useProductListingFilterHook = () => { if (existingSectionIndex !== -1) { if (isChecked) { - if (!updatedFilters[existingSectionIndex].value.includes(filterValue)) { - updatedFilters[existingSectionIndex].value.push(filterValue); + if (!updatedFilters?.[existingSectionIndex].value.includes(filterValue)) { + updatedFilters?.[existingSectionIndex].value.push(filterValue); } } else { updatedFilters[existingSectionIndex].value = updatedFilters[existingSectionIndex].value.filter((val: any) => val !== filterValue); - if (updatedFilters[existingSectionIndex].value.length === 0) { - updatedFilters = updatedFilters.filter((filter) => filter.name !== section); + if (updatedFilters?.[existingSectionIndex].value.length === 0) { + updatedFilters = updatedFilters?.filter((filter) => filter?.name !== section); } } } else if (isChecked) { - updatedFilters.push({ name: section, value: [filterValue] }); + updatedFilters?.push({ name: section, value: [filterValue] }); } duplicateFilters = [...updatedFilters]; diff --git a/store/slices/general_slices/kc-slice.ts b/store/slices/general_slices/kc-slice.ts index 0eddf7ac..33654e81 100644 --- a/store/slices/general_slices/kc-slice.ts +++ b/store/slices/general_slices/kc-slice.ts @@ -99,18 +99,18 @@ export const KCSlice = createSlice({ setFilters: (state, action) => { const { customer, scope, data } = action.payload; - if (!state.filters[customer]) state.filters[customer] = {}; + if (!state.filters?.[customer]) state.filters[customer] = {}; state.filters[customer][scope] = { - ...(state.filters[customer][scope] || {}), + ...(state.filters?.[customer]?.[scope] || {}), ...data, }; }, setFiltersSetOfAPI: (state, action) => { const { customer, scope, data } = action.payload; - if (!state.filtersSetOfAPI[customer]) state.filtersSetOfAPI[customer] = {}; + if (!state.filtersSetOfAPI?.[customer]) state.filtersSetOfAPI[customer] = {}; state.filtersSetOfAPI[customer][scope] = { - ...(state.filtersSetOfAPI[customer][scope] || {}), + ...(state.filtersSetOfAPI?.[customer]?.[scope] || {}), ...data, }; },