From 35013fd66d8cbc78e07573112fc482fb7dec14e2 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 31 Aug 2023 14:03:04 +0700 Subject: bugs fixing flash sale tag --- src/lib/product/components/ProductCard.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 36cd8d18..66363ff2 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -45,7 +45,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { height={5} /> - {product?.flashSale?.tag} + {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? '' : 'FLASH SALE'} @@ -138,7 +138,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { width={15} height={10} /> - FLASH SALE + {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? '' : 'FLASH SALE'} )} {product?.manufacture?.name ? ( -- cgit v1.2.3 From 4c81d351a5d4ab54f8d08a94c0046b04bbc3a373 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 31 Aug 2023 14:08:15 +0700 Subject: delete logs --- src/lib/product/components/Product/ProductDesktop.jsx | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 187ab3c9..3b9296a8 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -59,8 +59,6 @@ const ProductDesktop = ({ products, wishlist, toggleWishlist }) => { getBackgound() }, []) - console.log('ini set', backgorundFlashSale) - const [informationTab, setInformationTab] = useState(informationTabOptions[0].value) const variantQuantityRefs = useRef([]) -- cgit v1.2.3 From 4cfc5bf25ba20b2a1a8ca140c785557d6c00cef6 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 31 Aug 2023 14:19:58 +0700 Subject: fixing --- src/lib/product/components/ProductCard.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 66363ff2..2c849bd6 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -45,7 +45,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { height={5} /> - {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? '' : 'FLASH SALE'} + {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? product?.flashSale?.tag : 'FLASH SALE'} @@ -138,7 +138,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { width={15} height={10} /> - {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? '' : 'FLASH SALE'} + {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? product?.flashSale?.tag : 'FLASH SALE'} )} {product?.manufacture?.name ? ( -- cgit v1.2.3 From 96e59b7af6895f82ac005d60b65084bd5ec2d01f Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 31 Aug 2023 16:47:34 +0700 Subject: change ui open newtab, g maps, top banner, profil --- src/lib/auth/components/CompanyProfile.jsx | 2 +- src/lib/checkout/components/Checkout.jsx | 752 +++++++++++++++-------------- src/lib/product/components/ProductCard.jsx | 2 +- 3 files changed, 403 insertions(+), 353 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/CompanyProfile.jsx b/src/lib/auth/components/CompanyProfile.jsx index ff673953..2faede9b 100644 --- a/src/lib/auth/components/CompanyProfile.jsx +++ b/src/lib/auth/components/CompanyProfile.jsx @@ -93,7 +93,7 @@ const CompanyProfile = () => { />
-
Nama Usaha
+
Badan Usaha
{
)} -
+
{item.canApply && (
{ >

Tambah produk{' '} - {item.manufactureNames} senilai{' '} + {item.manufactureNames}{' '} + senilai{' '} {currencyFormat(item.minPurchaseAmount)} {' '} @@ -537,7 +540,8 @@ const Checkout = () => { >

Tambah produk{' '} - {item.manufactureNames} senilai{' '} + {item.manufactureNames}{' '} + senilai{' '} {currencyFormat(item.differenceToApply)} {' '} @@ -652,6 +656,29 @@ const Checkout = () => { + {selectedCarrierId == SELF_PICKUP_ID && ( +

+ +
+ )} + {selectedCarrierId == SELF_PICKUP_ID && } {selectedCarrierId != SELF_PICKUP_ID && ( <> @@ -884,393 +911,416 @@ const Checkout = () => { -
-
- {selectedCarrierId == SELF_PICKUP_ID && } - {selectedCarrierId != SELF_PICKUP_ID && ( - <> - - - - - )} - - - - - +
+ {selectedCarrierId == SELF_PICKUP_ID && ( + + )} + +
+ {' '} +
+ {selectedCarrierId == SELF_PICKUP_ID && } + {selectedCarrierId != SELF_PICKUP_ID && ( + <> + + + + + )} + + + + + -
-
Detail Pesanan
- - - - - - - - - - - {!products ? ( +
+
Detail Pesanan
+
Nama ProdukJumlahHargaSubtotal
+ - + + + + - ) : ( - products?.map((product) => ( - <> - - + + {!products ? ( + + + + ) : ( + products?.map((product) => ( + <> + + - - - - - {product.program && - product.program.items && - product.program.items.map((item) => ( - <> - - + + - - + + + {product.program && + product.program.items && + product.program.items.map((item) => ( + <> + + - - - - - ))} - - )) - )} - -
-
-
-
-
-
-
-
Nama ProdukJumlahHargaSubtotal
-
- {product?.name} -
-
-
- {product?.parent?.name} -
-
- {product?.code}{' '} - {product?.attributes.length > 0 - ? `| ${product?.attributes.join(', ')}` - : ''} -
-
- Berat item : {product?.weight} Kg +
+
+
+
+
+
+
+
+
+ {product?.name}
- -
- - - {product?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} +
+
+ {product?.parent?.name}
-
- {product?.price?.discountPercentage}% +
+ {product?.code}{' '} + {product?.attributes.length > 0 + ? `| ${product?.attributes.join(', ')}` + : ''} +
+
+ Berat item : {product?.weight} Kg
- )} -
- {product.price.priceDiscount > 0 - ? currencyFormat(product?.price?.priceDiscount) - : 'Call For Price'} -
-
-
- {product.price.priceDiscount > 0 ? ( - currencyFormat(product?.price?.priceDiscount * product?.quantity) - ) : ( - - Call For Price{' '} - - )} -
-
-
- {item.name} +
+ + + {product?.price?.discountPercentage > 0 && ( +
+
+ {currencyFormat(product?.price?.price)}
-
-
- - {product.program.type.label} - -
-
{item.name}
+
+ {product?.price?.discountPercentage}%
-
- - - {item?.price?.discountPercentage > 0 && ( -
-
- {currencyFormat(product?.price?.price)} +
+ )} +
+ {product.price.priceDiscount > 0 + ? currencyFormat(product?.price?.priceDiscount) + : 'Call For Price'} +
+
+
+ {product.price.priceDiscount > 0 ? ( + currencyFormat(product?.price?.priceDiscount * product?.quantity) + ) : ( + + Call For Price{' '} + + )} +
+
+
+ {item.name} +
+
+
+ + {product.program.type.label} +
+
{item.name}
- )} -
- {item?.price.priceDiscount > 0 ? 'Gratis' : ''} -
-
-
- {item.price.priceDiscount > 0 ? 'Gratis' : ''} -
-
-
-
- -
-
-
-
Ringkasan Pesanan
-
{products?.length} Barang
+ + + + + + {item?.price?.discountPercentage > 0 && ( +
+
+ {currencyFormat(product?.price?.price)} +
+
+ )} +
+ {item?.price.priceDiscount > 0 ? 'Gratis' : ''} +
+ + +
+ {item.price.priceDiscount > 0 ? 'Gratis' : ''} +
+ + + + + ))} + + )) + )} + +
+
+
+
+
+
Ringkasan Pesanan
+
{products?.length} Barang
+
-
- {!cartCheckout ? ( -
-
-
-
+
+ {!cartCheckout ? ( +
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+ ) : ( +
+
+
Total Belanja
+
{currencyFormat(cartCheckout?.totalPurchase)}
+
+
+
Diskon Produk
+
+ - {currencyFormat(cartCheckout?.totalDiscount)} +
+
+ {activeVoucher && ( +
+
Diskon Voucher
+
- {currencyFormat(discountVoucher)}
+
+ )} +
+
Subtotal
+
{currencyFormat(cartCheckout?.subtotal)}
+
+
+
PPN 11%
+
{currencyFormat(cartCheckout?.tax)}
+
+
+
+ Biaya Kirim +

{etdFix}

+
+
+ {currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)} +
-
-
+ )} + +
+ {!cartCheckout ? ( +
+ {' '}
-
-
-
- ) : ( -
-
-
Total Belanja
-
{currencyFormat(cartCheckout?.totalPurchase)}
-
-
-
Diskon Produk
-
- - {currencyFormat(cartCheckout?.totalDiscount)} +
+
- {activeVoucher && ( -
-
Diskon Voucher
-
- {currencyFormat(discountVoucher)}
+ ) : ( +
+
Grand Total
+
+ {currencyFormat( + cartCheckout?.grandTotal + + Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 + )}
- )} -
-
Subtotal
-
{currencyFormat(cartCheckout?.subtotal)}
-
-
-
PPN 11%
-
{currencyFormat(cartCheckout?.tax)}
-
-
- Biaya Kirim -

{etdFix}

-
-
- {currencyFormat(Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000)} + )} + +
+ +
+
+ {'>'} +
- )} -
- {!cartCheckout ? ( -
-
- {' '} -
-
-
-
-
+

+ Dengan melakukan pembelian melalui website Indoteknik, saya menyetujui{' '} + + Syarat & Ketentuan + {' '} + yang berlaku +

+ +
+ +
+ Purchase Order (Opsional)
- ) : ( -
-
Grand Total
-
- {currencyFormat( - cartCheckout?.grandTotal + - Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 - )} + +
+
+ + +
+
+ +
- )} +

Ukuran dokumen PO Maksimal 5MB

-
+
-
+ {priceCheck && ( +
+ + *) Terdapat produk yang belum memiliki harga,{' '} + + Hubungi Kami untuk meminta harga. + - {activeVoucher ? ( -
-
- Hemat {currencyFormat(discountVoucher)} -
-
- Voucher berhasil digunakan -
-
- ) : ( - - Hemat belanja dengan promo - - )}
- {'>'} - -
- -

- Dengan melakukan pembelian melalui website Indoteknik, saya menyetujui{' '} - - Syarat & Ketentuan - {' '} - yang berlaku -

- -
- -
- Purchase Order (Opsional) -
- -
-
- - -
-
- - -
+ )}
-

Ukuran dokumen PO Maksimal 5MB

- -
- - - {priceCheck && ( -
- - *) Terdapat produk yang belum memiliki harga,{' '} - - Hubungi Kami untuk meminta harga. - - -
- )}
diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 2c849bd6..abf462a1 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -44,7 +44,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { width={13} height={5} /> - + {product?.flashSale?.tag != "false" || product?.flashSale?.tag != product?.flashSale?.tag ? product?.flashSale?.tag : 'FLASH SALE'}
-- cgit v1.2.3 From 6155dd4ea416de8cbd3be3c9409e2246ad61d60c Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 1 Sep 2023 13:48:07 +0700 Subject: hide button google sign up & shipmet page --- src/lib/auth/components/LoginDesktop.jsx | 8 ++++---- src/lib/auth/components/LoginMobile.jsx | 8 ++++---- src/lib/shipment/components/Shipments.jsx | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/LoginDesktop.jsx b/src/lib/auth/components/LoginDesktop.jsx index 42fa8896..838054cd 100644 --- a/src/lib/auth/components/LoginDesktop.jsx +++ b/src/lib/auth/components/LoginDesktop.jsx @@ -95,13 +95,13 @@ const LoginDesktop = () => { {!isLoading ? 'Masuk' : 'Loading...'} -
+ {/*

ATAU


-
+
*/} - + */}
Belum punya akun Indoteknik?{' '} diff --git a/src/lib/auth/components/LoginMobile.jsx b/src/lib/auth/components/LoginMobile.jsx index 095f4174..2d6501cd 100644 --- a/src/lib/auth/components/LoginMobile.jsx +++ b/src/lib/auth/components/LoginMobile.jsx @@ -91,13 +91,13 @@ const LoginMobile = () => { {!isLoading ? 'Masuk' : 'Loading...'} -
+ {/*

ATAU


-
+
*/} - + */}
Belum punya akun Indoteknik?{' '} diff --git a/src/lib/shipment/components/Shipments.jsx b/src/lib/shipment/components/Shipments.jsx index c9d3e627..8b369a11 100644 --- a/src/lib/shipment/components/Shipments.jsx +++ b/src/lib/shipment/components/Shipments.jsx @@ -26,7 +26,6 @@ const Shipments = () => { offset: (page - 1) * limit, limit } - console.log('ini query', query) const [inputQuery, setInputQuery] = useState(q) const queryString = _.toQuery(query) @@ -184,8 +183,7 @@ const Shipments = () => {
- Warning alert! Change a few things up and try - submitting again. + Lacak pengiriman untuk setiap transaksi anda semakin mudah di Indoteknik.com
-- cgit v1.2.3 From 6b1083de2c5ad57953c6653d00a42b2da3fea108 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 1 Sep 2023 17:09:16 +0700 Subject: hide google sign up button --- src/lib/auth/components/RegisterDesktop.jsx | 4 ++-- src/lib/auth/components/RegisterMobile.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/RegisterDesktop.jsx b/src/lib/auth/components/RegisterDesktop.jsx index a2bc98c2..6072bfb9 100644 --- a/src/lib/auth/components/RegisterDesktop.jsx +++ b/src/lib/auth/components/RegisterDesktop.jsx @@ -152,7 +152,7 @@ const RegisterDesktop = () => {
-
+ {/*

ATAU


@@ -171,7 +171,7 @@ const RegisterDesktop = () => { height={10} />

Daftar dengan Google

- + */}
Sudah punya akun Indoteknik?{' '} diff --git a/src/lib/auth/components/RegisterMobile.jsx b/src/lib/auth/components/RegisterMobile.jsx index 2e918a14..1b0d2adf 100644 --- a/src/lib/auth/components/RegisterMobile.jsx +++ b/src/lib/auth/components/RegisterMobile.jsx @@ -151,7 +151,7 @@ const RegisterMobile = () => {
-
+ {/*

ATAU


@@ -170,7 +170,7 @@ const RegisterMobile = () => { height={10} />

Daftar dengan Google

- + */}
Sudah punya akun Indoteknik?{' '} -- cgit v1.2.3 From 643c1cc2203d05286b94e591f53560eec83e3f14 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Mon, 4 Sep 2023 11:05:29 +0700 Subject: layanan pelanggan & icon gear di ganti icon user --- src/lib/auth/components/Menu.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/Menu.jsx b/src/lib/auth/components/Menu.jsx index 939a0d5f..f475db1f 100644 --- a/src/lib/auth/components/Menu.jsx +++ b/src/lib/auth/components/Menu.jsx @@ -1,6 +1,7 @@ import Link from '@/core/components/elements/Link/Link' import { useRouter } from 'next/router' import ImageNext from 'next/image' +import whatsappUrl from '@/core/utils/whatsappUrl' const Menu = () => { const router = useRouter() @@ -42,7 +43,7 @@ const Menu = () => {
Pusat Bantuan
- +

Layanan Pelanggan

-- cgit v1.2.3 From 009aab3dfc5a08f19c8e147f380dc6517b9f6fd1 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 5 Sep 2023 10:09:08 +0700 Subject: cr icon & uncomment login google --- src/lib/auth/components/LoginDesktop.jsx | 8 ++++---- src/lib/auth/components/LoginMobile.jsx | 24 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/LoginDesktop.jsx b/src/lib/auth/components/LoginDesktop.jsx index 838054cd..42fa8896 100644 --- a/src/lib/auth/components/LoginDesktop.jsx +++ b/src/lib/auth/components/LoginDesktop.jsx @@ -95,13 +95,13 @@ const LoginDesktop = () => { {!isLoading ? 'Masuk' : 'Loading...'} - {/*
+

ATAU


-
*/} +
- {/* */} +
Belum punya akun Indoteknik?{' '} diff --git a/src/lib/auth/components/LoginMobile.jsx b/src/lib/auth/components/LoginMobile.jsx index 2d6501cd..ed032295 100644 --- a/src/lib/auth/components/LoginMobile.jsx +++ b/src/lib/auth/components/LoginMobile.jsx @@ -13,10 +13,19 @@ import BottomPopup from '@/core/components/elements/Popup/BottomPopup' import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner' import odooApi from '@/core/api/odooApi' import { getAuth } from '@/core/utils/auth' +import PageContent from '@/lib/content/components/PageContent' const LoginMobile = () => { - const { handleSubmit, handleChangeInput, isLoading, isValid, alert, emailRef, passwordRef, handleGoogleSubmit } = - useLogin() + const { + handleSubmit, + handleChangeInput, + isLoading, + isValid, + alert, + emailRef, + passwordRef, + handleGoogleSubmit + } = useLogin() const router = useRouter() const [query, setQuery] = useState(router?.query?.next || '/') @@ -91,13 +100,13 @@ const LoginMobile = () => { {!isLoading ? 'Masuk' : 'Loading...'} - {/*
+

ATAU


-
*/} +
- {/* */} +
Belum punya akun Indoteknik?{' '} @@ -118,6 +127,9 @@ const LoginMobile = () => { Daftar
+ {/*
+ +
*/}
) -- cgit v1.2.3 From e9ddb20da7114af4d9777e466e033db11536921d Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 5 Sep 2023 12:02:21 +0700 Subject: hide google sign up --- src/lib/auth/components/LoginDesktop.jsx | 4 ++-- src/lib/auth/components/LoginMobile.jsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/LoginDesktop.jsx b/src/lib/auth/components/LoginDesktop.jsx index 42fa8896..d22da6f8 100644 --- a/src/lib/auth/components/LoginDesktop.jsx +++ b/src/lib/auth/components/LoginDesktop.jsx @@ -95,7 +95,7 @@ const LoginDesktop = () => { {!isLoading ? 'Masuk' : 'Loading...'} -
+ {/*

ATAU


@@ -114,7 +114,7 @@ const LoginDesktop = () => { height={10} />

Masuk dengan Google

- + */}
Belum punya akun Indoteknik?{' '} diff --git a/src/lib/auth/components/LoginMobile.jsx b/src/lib/auth/components/LoginMobile.jsx index ed032295..6e1831d4 100644 --- a/src/lib/auth/components/LoginMobile.jsx +++ b/src/lib/auth/components/LoginMobile.jsx @@ -100,7 +100,7 @@ const LoginMobile = () => { {!isLoading ? 'Masuk' : 'Loading...'} -
+ {/*

ATAU


@@ -119,7 +119,7 @@ const LoginMobile = () => { height={10} />

Masuk dengan Google

- + */}
Belum punya akun Indoteknik?{' '} -- cgit v1.2.3 From 7809824df6af3ae1eb37f1f2d1354a0efaa1e36e Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 7 Sep 2023 10:32:00 +0700 Subject: Update category homepage API endpoint --- src/lib/home/api/categoryHomeApi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/home/api/categoryHomeApi.js b/src/lib/home/api/categoryHomeApi.js index 81909d7b..44b77daa 100644 --- a/src/lib/home/api/categoryHomeApi.js +++ b/src/lib/home/api/categoryHomeApi.js @@ -1,7 +1,7 @@ import odooApi from '@/core/api/odooApi' const categoryHomeIdApi = async ({ id }) => { - const dataCategoryHomeId = await odooApi('GET', `/api/v1/categories_homepage?id=${id}`) + const dataCategoryHomeId = await odooApi('GET', `/api/v1/product/category-homepage?id=${id}`) return dataCategoryHomeId } -- cgit v1.2.3 From fd0e97e0a4a9b6d625c7c0605d415955b9b25597 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 8 Sep 2023 14:16:44 +0700 Subject: cr - traking web awb --- src/lib/shipment/components/Shipments.jsx | 240 +++++++++++++++++++---------- src/lib/treckingAwb/component/Manifest.jsx | 16 +- 2 files changed, 174 insertions(+), 82 deletions(-) (limited to 'src/lib') diff --git a/src/lib/shipment/components/Shipments.jsx b/src/lib/shipment/components/Shipments.jsx index 8b369a11..129e2496 100644 --- a/src/lib/shipment/components/Shipments.jsx +++ b/src/lib/shipment/components/Shipments.jsx @@ -5,7 +5,7 @@ import { EllipsisVerticalIcon, MagnifyingGlassIcon } from '@heroicons/react/24/o import ImageNext from 'next/image' import { useRouter } from 'next/router' import { useQuery } from 'react-query' -import _ from 'lodash-contrib' +import _, { forEach } from 'lodash-contrib' import Spinner from '@/core/components/elements/Spinner/Spinner' import Manifest from '@/lib/treckingAwb/component/Manifest' import { useState } from 'react' @@ -18,19 +18,24 @@ const { listShipments } = require('../api/listShipment') const Shipments = () => { const router = useRouter() const { q = '', page = 1 } = router.query + const [paramStatus, setParamStatus] = useState(null) const limit = 15 const query = { q: q, + status: paramStatus, offset: (page - 1) * limit, limit } const [inputQuery, setInputQuery] = useState(q) const queryString = _.toQuery(query) - const { data: shipments } = useQuery('shipments', () => listShipments({ query: queryString })) + const { data: shipments } = useQuery('shipments' + queryString, () => + listShipments({ query: queryString }) + ) const [idAWB, setIdAWB] = useState(null) + console.log('ini shipmnets', shipments) const pageCount = Math.ceil(shipments?.pickingTotal / limit) let pageQuery = _.omit(query, ['limit', 'offset', 'context']) @@ -45,41 +50,25 @@ const Shipments = () => { e.preventDefault() router.push(`${router.pathname}?q=${inputQuery}`) } + + const filterStatus = async (status) => { + if (status === paramStatus) { + setParamStatus(null) + } else { + setParamStatus(status) + } + } return ( <>
-
-
- -
-

Pending

-

- {' '} - {shipments?.summary?.pendingCount} {'>'} -

-
-
-
- -
-

Pengiriman

-

- {' '} - {shipments?.summary?.shipmentCount} {'>'} -

-
-
-
- -
-

Selesai

-

- {' '} - {shipments?.summary?.shipmentCount} {'>'} -

-
+
@@ -108,14 +97,19 @@ const Shipments = () => {

No. Resi : {shipment.trackingNumber || '-'}

- {shipment?.delivered && ( + {shipment?.status === 'completed' && (

Pesanan Tiba

)} - {!shipment?.delivered && ( + {shipment?.status === 'shipment' && ( +
+

Sedang Dikirim

+
+ )} + {shipment?.status === 'pending' && (
-

Sedang Dikirim

+

Pending

)}
@@ -187,49 +181,12 @@ const Shipments = () => {
-
-

Pending

-
-
- -
-
-

- {shipments?.summary?.pendingCount} Pesanan -

-
-
-
Pengiriman
-
-
- -
-
-

- {shipments?.summary?.shipmentCount} Pesanan -

-
-
-
Pesanan Tiba
-
-
- -
-
-

- {shipments?.summary?.completedCount} Pesanan -

-
+
@@ -310,4 +267,131 @@ const Shipments = () => { ) } +const CardStatus = ({ device, paramStatus, shipments, filterStatus }) => { + const status = [`pending`, `shipment`, `completed`] + + return ( + <> + {status.map((value) => { + const statusData = getStatusLabel(device, value, shipments) + if (device === 'desktop') { + return ( +
filterStatus(value)} + > +

{statusData.label}

+ {statusData.image} +

+ {statusData.shipCount} Pesanan +

+
+ ) + } else { + return ( +
filterStatus(value)} + > + {statusData.image} +

{statusData.label}

+

+ {' '} + {statusData.shipCount} {'>'} +

+
+ ) + } + })} + + ) +} + +const getStatusLabel = (device, status, shipments) => { + let images = null + switch (status) { + case 'pending': + if (device === 'desktop') { + images = ( +
+
+ +
+
+ ) + } else { + images = ( +
+ +
+ ) + } + return { + label: 'Pending', + shipCount: shipments?.summary?.pendingCount, + image: images + } + case 'shipment': + if (device === 'desktop') { + images = ( +
+
+ +
+
+ ) + } else { + images = ( +
+ +
+ ) + } + return { + label: 'Pengiriman', + shipCount: shipments?.summary?.shipmentCount, + image: images + } + case 'completed': + if (device === 'desktop') { + images = ( +
+
+ +
+
+ ) + } else { + images = ( +
+ +
+ ) + } + return { + label: 'Pesanan Tiba', + shipCount: shipments?.summary?.completedCount, + image: images + } + default: + return 'Status Tidak Dikenal' + } +} + export default Shipments diff --git a/src/lib/treckingAwb/component/Manifest.jsx b/src/lib/treckingAwb/component/Manifest.jsx index 185a9d55..cf2fa4ed 100644 --- a/src/lib/treckingAwb/component/Manifest.jsx +++ b/src/lib/treckingAwb/component/Manifest.jsx @@ -5,6 +5,7 @@ import { getAuth } from '@/core/utils/auth' import { useEffect, useState } from 'react' import { toast } from 'react-hot-toast' import ImageNext from 'next/image' +import { list } from 'postcss' const Manifest = ({ idAWB, closePopup }) => { const [manifests, setManifests] = useState(null) @@ -84,14 +85,19 @@ const Manifest = ({ idAWB, closePopup }) => { >

Status Pesanan

- {manifests?.delivered && ( + {manifests?.status === 'completed' && (

Pesanan Tiba

)} - {!manifests?.delivered && ( + {manifests?.status === 'shipment' && ( +
+

Sedang Dikirim

+
+ )} + {manifests?.status === 'pending' && (
-

Sedang Dikirim

+

Pending

)}
@@ -152,7 +158,9 @@ const Manifest = ({ idAWB, closePopup }) => { )} {manifests.delivered != true && (
)} -- cgit v1.2.3