From 50425ea134852897bf125aae0f68a1642eb3b3b8 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 3 Apr 2024 10:31:14 +0700 Subject: Add voucher shipping feature --- src/lib/checkout/api/checkoutApi.js | 34 ++--- src/lib/checkout/api/getVoucher.js | 37 ++--- src/lib/checkout/components/Checkout.jsx | 224 ++++++++++++++++++++++++++----- 3 files changed, 224 insertions(+), 71 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/api/checkoutApi.js b/src/lib/checkout/api/checkoutApi.js index 24f1868a..fd982fff 100644 --- a/src/lib/checkout/api/checkoutApi.js +++ b/src/lib/checkout/api/checkoutApi.js @@ -1,28 +1,20 @@ -import odooApi from '@/core/api/odooApi' -import { getAuth } from '@/core/utils/auth' +import odooApi from '@/core/api/odooApi'; +import { getAuth } from '@/core/utils/auth'; export const checkoutApi = async ({ data }) => { - const auth = getAuth() + const auth = getAuth(); const dataCheckout = await odooApi( 'POST', `/api/v1/partner/${auth.partnerId}/sale_order/checkout`, data - ) - return dataCheckout -} + ); + return dataCheckout; +}; -export const getProductsCheckout = async (voucher, query) => { - const id = getAuth()?.id - let products - if(voucher && query){ - products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?voucher=${voucher}&source=buy`) - }else if (voucher){ - products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?voucher=${voucher}`) - }else if (query) { - products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?source=buy`) - }else{ - products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout`) - } - - return products -} +export const getProductsCheckout = async (query) => { + const queryParam = new URLSearchParams(query); + const userId = getAuth()?.id; + const url = `/api/v1/user/${userId}/sale_order/checkout?${queryParam.toString()}`; + const result = await odooApi('GET', url); + return result; +}; diff --git a/src/lib/checkout/api/getVoucher.js b/src/lib/checkout/api/getVoucher.js index 07cf376e..54c8cce5 100644 --- a/src/lib/checkout/api/getVoucher.js +++ b/src/lib/checkout/api/getVoucher.js @@ -1,21 +1,24 @@ -import odooApi from '@/core/api/odooApi' +import odooApi from '@/core/api/odooApi'; -export const getVoucher = async (id, source) => { - let dataVoucher = null - if(source){ - dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?source=${source}`) - }else { - dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher`) - } - return dataVoucher -} +export const getVoucher = async (id, query) => { + const queryParam = new URLSearchParams(query); + const url = `/api/v1/user/${id}/voucher?${queryParam.toString()}`; + const dataVoucher = await odooApi('GET', url); + return dataVoucher; +}; export const findVoucher = async (code, id, source) => { - let dataVoucher = null - if(source){ - dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}&source=${source}`) - }else{ - dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}`) + let dataVoucher = null; + if (source) { + dataVoucher = await odooApi( + 'GET', + `/api/v1/user/${id}/voucher?code=${code}&source=${source}` + ); + } else { + dataVoucher = await odooApi( + 'GET', + `/api/v1/user/${id}/voucher?code=${code}` + ); } - return dataVoucher -} + return dataVoucher; +}; diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 52edbd05..042fc258 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -43,9 +43,16 @@ const Checkout = () => { const auth = useAuth(); const [activeVoucher, SetActiveVoucher] = useState(null); - - const { data: cartCheckout } = useQuery('cartCheckout-' + activeVoucher, () => - getProductsCheckout(activeVoucher, query) + const [activeVoucherShipping, setActiveVoucherShipping] = useState(null); + + const { data: cartCheckout } = useQuery( + ['cartCheckout', activeVoucher, activeVoucherShipping], + () => + getProductsCheckout({ + source: query, + voucher: activeVoucher, + voucher_shipping: activeVoucherShipping, + }) ); const [selectedAddress, setSelectedAddress] = useState({ @@ -103,6 +110,7 @@ const Checkout = () => { const [bottomPopupTnC, SetBottomPopupTnC] = useState(null); const [itemTnC, setItemTnC] = useState(null); const [listVouchers, SetListVoucher] = useState(null); + const [listVoucherShippings, SetListVoucherShipping] = useState(null); const [discountVoucher, SetDiscountVoucher] = useState(0); const [codeVoucher, SetCodeVoucher] = useState(null); const [findCodeVoucher, SetFindVoucher] = useState(null); @@ -117,13 +125,23 @@ const Checkout = () => { const voucher = async () => { if (!listVouchers) { try { - let dataVoucher = await getVoucher(auth?.id, query); + setLoadingVoucher(true); + let dataVoucher = await getVoucher(auth?.id, { + source: query, + }); SetListVoucher(dataVoucher); + + let dataVoucherShipping = await getVoucher(auth?.id, { + source: query, + type: 'shipping', + }); + SetListVoucherShipping(dataVoucherShipping); } finally { setLoadingVoucher(false); } } }; + const VoucherCode = async (code) => { let dataVoucher = await findVoucher(code, auth.id, query); if (dataVoucher.length <= 0) { @@ -333,6 +351,7 @@ const Checkout = () => { estimated_arrival_days: splitDuration(etd), delivery_service_type: selectedExpedisiService, voucher: activeVoucher, + voucher_shipping: activeVoucherShipping, type: 'sale_order', }; @@ -419,6 +438,11 @@ const Checkout = () => { return false; }, [products]); + const voucherShippingAmt = cartCheckout?.discountVoucherShipping || 0; + const discShippingAmt = Math.min(biayaKirim, voucherShippingAmt); + + const finalShippingAmt = biayaKirim - discShippingAmt; + return ( <> { )} -
-
+
+ + {listVoucherShippings && listVoucherShippings?.length > 0 && ( +
+

Promo Gratis Ongkir

+ {listVoucherShippings?.map((item) => ( +
+
+ {item.canApply && ( + + )} + {!item.canApply && ( + + )} + +
+ {item.canApply === false && ( +
+ )} +
+ {item.name} +
+
+
+
+

{item.name}

+
+ + {item.description}{' '} + +
+
+
+ +
+
+
+
+

+ Kode Voucher :{' '} + + {item.code} + +

+

+ {activeVoucher === item.code && ( + + Voucher digunakan{' '} + + )} +

+
+
+ +
+
+ Berakhir dalam{' '} + + {item.remainingTime} + {' '} + lagi,{' '} +
+
handlingTnC(item)} + > + Baca S&K +
+
+
+
+
+
+

+
+
+
+ ))} +
+ )} + +
+ +
{!loadingVoucher && listVouchers?.length === 0 ? (
@@ -714,14 +875,7 @@ const Checkout = () => {
-

- {/* {item.canApply === false - ? 'Tambah ' + - currencyFormat(item.differenceToApply) + - ' untuk pakai promo ini' - : 'Potensi potongan sebesar ' + - currencyFormat(hitungDiscountVoucher(item.code))} */} -

+

@@ -887,14 +1041,18 @@ const Checkout = () => {
- Biaya Kirim

{etdFix}

-
-
- {currencyFormat( - Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 - )} + Biaya Kirim

{etdFix}

+
{currencyFormat(biayaKirim)}
+ {activeVoucherShipping && voucherShippingAmt && ( +
+
Diskon Kirim
+
+ - {currencyFormat(discShippingAmt)} +
+
+ )} )} @@ -913,10 +1071,7 @@ const Checkout = () => {
Grand Total
- {currencyFormat( - cartCheckout?.grandTotal + - Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 - )} + {currencyFormat(cartCheckout?.grandTotal + finalShippingAmt)}
)} @@ -926,7 +1081,7 @@ const Checkout = () => {
)} @@ -1209,8 +1368,7 @@ const Checkout = () => {
Grand Total
{currencyFormat( - cartCheckout?.grandTotal + - Math.round(parseInt(biayaKirim * 1.1) / 1000) * 1000 + cartCheckout?.grandTotal + finalShippingAmt )}
-- cgit v1.2.3 From 463a051646fe1dc70bebd05359381c393b951fff Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Thu, 2 May 2024 09:30:54 +0700 Subject: hotfix - validate stepapproval on mobile version --- src/lib/transaction/components/Transaction.jsx | 124 +++++++++++++++---------- 1 file changed, 77 insertions(+), 47 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 8f4b2038..b68bb4cd 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -37,8 +37,8 @@ import rejectApi from '../api/rejectApi'; const Transaction = ({ id }) => { const auth = useAuth(); const { transaction } = useTransaction({ id }); - - const statusApprovalWeb = transaction.data?.approvalStep + + const statusApprovalWeb = transaction.data?.approvalStep; const { queryAirwayBill } = useAirwayBill({ orderId: id }); const [airwayBillPopup, setAirwayBillPopup] = useState(null); @@ -78,7 +78,7 @@ const Transaction = ({ id }) => { const closeCancelTransaction = () => setCancelTransaction(false); const [rejectTransaction, setRejectTransaction] = useState(false); - + const openRejectTransaction = () => setRejectTransaction(true); const closeRejectTransaction = () => setRejectTransaction(false); const submitCancelTransaction = async () => { @@ -106,13 +106,13 @@ const Transaction = ({ id }) => { await aprpoveApi({ id }); toast.success('Berhasil melanjutkan approval'); transaction.refetch(); - } + }; const handleReject = async () => { - await rejectApi({ id }); - closeRejectTransaction() - transaction.refetch(); - } + await rejectApi({ id }); + closeRejectTransaction(); + transaction.refetch(); + }; const memoizeVariantGroupCard = useMemo( () => ( @@ -238,7 +238,13 @@ const Transaction = ({ id }) => {
- + {auth?.feature?.soApproval && ( + + )}
@@ -359,33 +365,43 @@ const Transaction = ({ id }) => {
- {transaction.data?.status == 'draft' && auth?.feature.soApproval && ( -
- - + +
+ )} + {transaction.data?.status == 'draft' && + !auth?.feature?.soApproval && ( + -
- )} - {transaction.data?.status == 'draft' && !auth?.feature?.soApproval && ( - - )} + )} {transaction.data?.status == 'draft' && - auth?.feature?.soApproval && auth?.webRole && ( + auth?.feature?.soApproval && + auth?.webRole && (
)} - {transaction.data?.status != 'draft' && !auth?.feature.soApproval && ( - - )} + {transaction.data?.status != 'draft' && + !auth?.feature.soApproval && ( + + )}
-- cgit v1.2.3 From 1bb3f91f27db4db6a16a1ed3fe59016268ba3d44 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 8 May 2024 13:23:10 +0700 Subject: change wa number --- src/lib/checkout/components/Checkout.jsx | 2 +- src/lib/checkout/components/CheckoutOld.jsx | 2 +- src/lib/checkout/components/CheckoutSection.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 7a456d70..0090acee 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -1454,7 +1454,7 @@ const SectionExpedisi = ({ dengan menghubungi admin melalui{' '} tautan ini diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx index d57fbd66..e2c45ce6 100644 --- a/src/lib/checkout/components/CheckoutOld.jsx +++ b/src/lib/checkout/components/CheckoutOld.jsx @@ -696,7 +696,7 @@ const SectionExpedisi = ({ address, listExpedisi, setSelectedExpedisi, checkWeig diatur beratnya. Mohon atur berat barang dengan menghubungi admin melalui{' '} tautan ini diff --git a/src/lib/checkout/components/CheckoutSection.jsx b/src/lib/checkout/components/CheckoutSection.jsx index 7f9ea08a..affe6138 100644 --- a/src/lib/checkout/components/CheckoutSection.jsx +++ b/src/lib/checkout/components/CheckoutSection.jsx @@ -120,7 +120,7 @@ export const SectionExpedisi = ({ dengan menghubungi admin melalui{' '} tautan ini -- cgit v1.2.3 From 6650a080208b09a50f286cd197c166ebdeca6d8a Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 21 May 2024 14:10:36 +0700 Subject: filter site dan export --- src/lib/transaction/components/Transactions.jsx | 299 +++++++++++++++++------- 1 file changed, 219 insertions(+), 80 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx index be63effd..9485449d 100644 --- a/src/lib/transaction/components/Transactions.jsx +++ b/src/lib/transaction/components/Transactions.jsx @@ -1,63 +1,139 @@ -import { useRouter } from 'next/router' -import { useState } from 'react' -import { toast } from 'react-hot-toast' -import { EllipsisVerticalIcon, MagnifyingGlassIcon } from '@heroicons/react/24/outline' +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import { toast } from 'react-hot-toast'; +import { + EllipsisVerticalIcon, + MagnifyingGlassIcon, +} from '@heroicons/react/24/outline'; +import useAuth from '@/core/hooks/useAuth'; -import { downloadPurchaseOrder, downloadQuotation } from '../utils/transactions' -import useTransactions from '../hooks/useTransactions' -import currencyFormat from '@/core/utils/currencyFormat' -import cancelTransactionApi from '../api/cancelTransactionApi' -import TransactionStatusBadge from './TransactionStatusBadge' -import Spinner from '@/core/components/elements/Spinner/Spinner' -import Link from '@/core/components/elements/Link/Link' -import BottomPopup from '@/core/components/elements/Popup/BottomPopup' -import Pagination from '@/core/components/elements/Pagination/Pagination' -import { toQuery } from 'lodash-contrib' -import _ from 'lodash' -import Alert from '@/core/components/elements/Alert/Alert' -import MobileView from '@/core/components/views/MobileView' -import DesktopView from '@/core/components/views/DesktopView' -import Menu from '@/lib/auth/components/Menu' +import { + downloadPurchaseOrder, + downloadQuotation, +} from '../utils/transactions'; +import useTransactions from '../hooks/useTransactions'; +import currencyFormat from '@/core/utils/currencyFormat'; +import cancelTransactionApi from '../api/cancelTransactionApi'; +import TransactionStatusBadge from './TransactionStatusBadge'; +import Spinner from '@/core/components/elements/Spinner/Spinner'; +import Link from '@/core/components/elements/Link/Link'; +import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; +import Pagination from '@/core/components/elements/Pagination/Pagination'; +import { toQuery } from 'lodash-contrib'; +import _ from 'lodash'; +import Alert from '@/core/components/elements/Alert/Alert'; +import MobileView from '@/core/components/views/MobileView'; +import DesktopView from '@/core/components/views/DesktopView'; +import Menu from '@/lib/auth/components/Menu'; +import * as XLSX from 'xlsx'; const Transactions = ({ context = '' }) => { - const router = useRouter() - const { q = '', page = 1 } = router.query + const auth = useAuth(); + const router = useRouter(); + const { q = '', page = 1, site = null } = router.query; - const limit = 15 + const limit = 15; + + const [inputQuery, setInputQuery] = useState(q); + const [toOthers, setToOthers] = useState(null); + const [toCancel, setToCancel] = useState(null); + + const [siteFilter, setSiteFilter] = useState(site); const query = { name: q, offset: (page - 1) * limit, context, - limit - } - const { transactions } = useTransactions({ query }) + limit, + site: + siteFilter || (auth?.webRole === null && auth?.site ? auth.site : null), + }; - const [inputQuery, setInputQuery] = useState(q) - const [toOthers, setToOthers] = useState(null) - const [toCancel, setToCancel] = useState(null) + const { transactions } = useTransactions({ query }); const submitCancelTransaction = async () => { const isCancelled = await cancelTransactionApi({ - transaction: toCancel - }) + transaction: toCancel, + }); if (isCancelled) { - toast.success('Berhasil batalkan transaksi') - transactions.refetch() + toast.success('Berhasil batalkan transaksi'); + transactions.refetch(); } - setToCancel(null) - } + setToCancel(null); + }; - const pageCount = Math.ceil(transactions?.data?.saleOrderTotal / limit) - let pageQuery = _.omit(query, ['limit', 'offset', 'context']) - pageQuery = _.pickBy(pageQuery, _.identity) - pageQuery = toQuery(pageQuery) + const pageCount = Math.ceil(transactions?.data?.saleOrderTotal / limit); + let pageQuery = _.omit(query, ['limit', 'offset', 'context']); + pageQuery = _.pickBy( + pageQuery, + (value, key) => value !== '' && !(key === 'page' && value === '1') + ); + pageQuery = toQuery(pageQuery); const handleSubmit = (e) => { - e.preventDefault() - router.push(`${router.pathname}?q=${inputQuery}`) - } + e.preventDefault(); + const queryParams = {}; + if (inputQuery) queryParams.q = inputQuery; + if (siteFilter) queryParams.site = siteFilter; + router.push({ + pathname: router.pathname, + query: queryParams, + }); + }; + + const handleSiteFilterChange = (e) => { + setSiteFilter(e.target.value); + const queryParams = {}; + if (inputQuery) queryParams.q = inputQuery; + if (e.target.value) queryParams.site = e.target.value; + router.push({ + pathname: router.pathname, + query: queryParams, + }); + }; + + const exportToExcel = (data, siteFilter) => { + const fieldsToExport = [ + 'No. Transaksi', + 'No. PO', + 'Tanggal', + 'Created By', + 'Salesperson', + 'Total', + 'Status', + ]; + const rowsToExport = []; + + data.forEach((saleOrder) => { + const row = { + 'No. Transaksi': saleOrder.name, + 'No. PO': saleOrder.purchaseOrderName || '-', + 'Tanggal': saleOrder.dateOrder || '-', + 'Created By': saleOrder.address.customer?.name || '-', + 'Salesperson': saleOrder.sales, + 'Total': currencyFormat(saleOrder.amountTotal), + 'Status': saleOrder.status, + }; + if(siteFilter){ + row['Site'] = siteFilter; + } + rowsToExport.push(row); + }); + const worksheet = XLSX.utils.json_to_sheet(rowsToExport, { + header: fieldsToExport, + }); + + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); + XLSX.writeFile(workbook, 'transactions.xlsx'); + }; + + const handleExportExcel = () => { + const dataToExport = transactions.data.saleOrders; + + exportToExcel(dataToExport, siteFilter); + }; return ( <> @@ -81,17 +157,23 @@ const Transactions = ({ context = '' }) => {
)} - {!transactions.isLoading && transactions.data?.saleOrders?.length === 0 && ( - - Tidak ada transaksi - - )} + {!transactions.isLoading && + transactions.data?.saleOrders?.length === 0 && ( + + Tidak ada transaksi + + )} {transactions.data?.saleOrders?.map((saleOrder, index) => ( -
+
- No. Transaksi + + No. Transaksi +

{saleOrder.name}

@@ -105,13 +187,17 @@ const Transactions = ({ context = '' }) => {
- No. Purchase Order + + No. Purchase Order +

{saleOrder.purchaseOrderName || '-'}

- Total Invoice + + Total Invoice +

{saleOrder.invoiceCount} Invoice

@@ -120,10 +206,14 @@ const Transactions = ({ context = '' }) => {
Sales -

{saleOrder.sales}

+

+ {saleOrder.sales} +

- Total Harga + + Total Harga +

{currencyFormat(saleOrder.amountTotal)}

@@ -140,14 +230,18 @@ const Transactions = ({ context = '' }) => { className='mt-2 mb-2' /> - setToOthers(null)}> + setToOthers(null)} + >
- setToCancel(null)} title='Batalkan Transaksi'> + setToCancel(null)} + title='Batalkan Transaksi' + >
Apakah anda yakin membatalkan transaksi{' '} {toCancel?.name}? @@ -188,7 +286,11 @@ const Transactions = ({ context = '' }) => { > Ya, Batalkan -
@@ -202,24 +304,54 @@ const Transactions = ({ context = '' }) => {
-
+

Daftar Transaksi{' '} - {transactions?.data?.saleOrders ? `(${transactions?.data?.saleOrders.length})` : ''} + {transactions?.data?.saleOrders + ? `(${transactions?.data?.saleOrders.length})` + : ''}

-
- + + + setInputQuery(e.target.value)} + /> + +
+
+ @@ -252,13 +384,20 @@ const Transactions = ({ context = '' }) => { {transactions.data?.saleOrders?.map((saleOrder) => ( - + - + {/* */} @@ -605,18 +605,18 @@ const Transaction = ({ id }) => { - + */} -- cgit v1.2.3 From ebf4faee910b591254b27b99be68e2e0cb6d31ae Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 22 May 2024 10:34:58 +0700 Subject: list site & button download --- src/lib/transaction/components/Transactions.jsx | 60 ++++++++++++++----------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx index 9485449d..1a57a976 100644 --- a/src/lib/transaction/components/Transactions.jsx +++ b/src/lib/transaction/components/Transactions.jsx @@ -26,6 +26,7 @@ import MobileView from '@/core/components/views/MobileView'; import DesktopView from '@/core/components/views/DesktopView'; import Menu from '@/lib/auth/components/Menu'; import * as XLSX from 'xlsx'; +import getSite from '../api/listSiteApi'; const Transactions = ({ context = '' }) => { const auth = useAuth(); @@ -37,6 +38,7 @@ const Transactions = ({ context = '' }) => { const [inputQuery, setInputQuery] = useState(q); const [toOthers, setToOthers] = useState(null); const [toCancel, setToCancel] = useState(null); + const [listSites, setListSites] = useState([]); const [siteFilter, setSiteFilter] = useState(site); @@ -51,6 +53,11 @@ const Transactions = ({ context = '' }) => { const { transactions } = useTransactions({ query }); + const fetchSite = async () => { + const site = await getSite(); + setListSites(site.sites); + }; + const submitCancelTransaction = async () => { const isCancelled = await cancelTransactionApi({ transaction: toCancel, @@ -108,13 +115,13 @@ const Transactions = ({ context = '' }) => { const row = { 'No. Transaksi': saleOrder.name, 'No. PO': saleOrder.purchaseOrderName || '-', - 'Tanggal': saleOrder.dateOrder || '-', + Tanggal: saleOrder.dateOrder || '-', 'Created By': saleOrder.address.customer?.name || '-', - 'Salesperson': saleOrder.sales, - 'Total': currencyFormat(saleOrder.amountTotal), - 'Status': saleOrder.status, + Salesperson: saleOrder.sales, + Total: currencyFormat(saleOrder.amountTotal), + Status: saleOrder.status, }; - if(siteFilter){ + if (siteFilter) { row['Site'] = siteFilter; } rowsToExport.push(row); @@ -134,6 +141,10 @@ const Transactions = ({ context = '' }) => { exportToExcel(dataToExport, siteFilter); }; + + useEffect(() => { + fetchSite(); + }, []); return ( <> @@ -304,7 +315,7 @@ const Transactions = ({ context = '' }) => {
-
+

Daftar Transaksi{' '} {transactions?.data?.saleOrders @@ -312,16 +323,21 @@ const Transactions = ({ context = '' }) => { : ''}

- + {listSites.length > 0 && ( + + )} +
{
- {saleOrder.name} + + {saleOrder.name} + {saleOrder.purchaseOrderName || '-'} {saleOrder.dateOrder || '-'} {saleOrder.address.customer?.name || '-'} {saleOrder.sales}{currencyFormat(saleOrder.amountTotal)} + {currencyFormat(saleOrder.amountTotal)} +
@@ -272,14 +411,14 @@ const Transactions = ({ context = '' }) => {
- ) -} + ); +}; -export default Transactions +export default Transactions; -- cgit v1.2.3 From 21d3c9cdc25477f5d07ff395a65f89430b7c9924 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 21 May 2024 14:54:08 +0700 Subject: delete discount field --- src/lib/transaction/components/Transaction.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 8f4b2038..9b11f5bb 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -562,7 +562,7 @@ const Transaction = ({ id }) => {
Nama ProdukDiskonDiskonJumlah Harga Subtotal + {/* {product.price.discountPercentage > 0 ? `${product.price.discountPercentage}%` : ''} - {product.quantity} - {product.price.discountPercentage > 0 && ( + {/* {product.price.discountPercentage > 0 && (
{currencyFormat(product.price.price)}
- )} + )} */}
{currencyFormat(product.price.priceDiscount)}
{currencyFormat(product.price.subtotal)}
-- cgit v1.2.3 From 6d57f1f7449ace08f56a80f5f03b43f5da05a995 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 22 May 2024 10:39:19 +0700 Subject: modul list site --- src/lib/transaction/api/listSiteApi.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/lib/transaction/api/listSiteApi.js (limited to 'src/lib') diff --git a/src/lib/transaction/api/listSiteApi.js b/src/lib/transaction/api/listSiteApi.js new file mode 100644 index 00000000..8b7740c5 --- /dev/null +++ b/src/lib/transaction/api/listSiteApi.js @@ -0,0 +1,10 @@ +import odooApi from '@/core/api/odooApi' +import { getAuth } from '@/core/utils/auth' + +const getSite = async () => { + const auth = getAuth() + const dataSite = await odooApi('GET', `/api/v1/partner/${auth?.partnerId}/list/site`) + return dataSite +} + +export default getSite \ No newline at end of file -- cgit v1.2.3 From d1f70e37fdea0d677cedccec9effdbeeb91656aa Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 22 May 2024 15:18:49 +0700 Subject: feedback testing renca --- src/lib/transaction/components/Transactions.jsx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx index 1a57a976..5a6dfb01 100644 --- a/src/lib/transaction/components/Transactions.jsx +++ b/src/lib/transaction/components/Transactions.jsx @@ -27,6 +27,7 @@ import DesktopView from '@/core/components/views/DesktopView'; import Menu from '@/lib/auth/components/Menu'; import * as XLSX from 'xlsx'; import getSite from '../api/listSiteApi'; +import transactionsApi from '../api/transactionsApi'; const Transactions = ({ context = '' }) => { const auth = useAuth(); @@ -136,10 +137,22 @@ const Transactions = ({ context = '' }) => { XLSX.writeFile(workbook, 'transactions.xlsx'); }; - const handleExportExcel = () => { - const dataToExport = transactions.data.saleOrders; + const getAllData = async () => { + const query = { + name: q, + context, + site: + siteFilter || (auth?.webRole === null && auth?.site ? auth.site : null), + }; + const queryString = toQuery(query) + const data = await transactionsApi({ query : queryString }); + return data; + }; + + const handleExportExcel = async () => { + const dataToExport = await getAllData(); - exportToExcel(dataToExport, siteFilter); + exportToExcel(dataToExport?.saleOrders, siteFilter); }; useEffect(() => { @@ -323,7 +336,7 @@ const Transactions = ({ context = '' }) => { : ''}
- {listSites.length > 0 && ( + {listSites?.length > 0 ? ( - )} + ):(
) } Date: Wed, 5 Jun 2024 13:02:27 +0700 Subject: add Informasi SNI & TKDN --- src/lib/product/components/ProductCard.jsx | 109 +++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 38ed35f8..8dde4dbe 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import ImageNext from 'next/image'; import { useRouter } from 'next/router'; -import { useMemo } from 'react'; +import { useMemo, useEffect, useState } from 'react'; import Image from '@/core/components/elements/Image/Image'; import Link from '@/core/components/elements/Link/Link'; @@ -15,6 +15,47 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const router = useRouter(); const utmSource = useUtmSource(); + const [isSni, setIsSni] = useState(false); + const [isTkdn, setTkdn] = useState(false); + + useEffect(() => { + // Lakukan pemanggilan API untuk memeriksa isSni + const fetchSniData = async () => { + try { + const response = await fetch('URL_API_SNI'); + const data = await response.json(); + if (data && data.sni) { + setIsSni(true); + } else { + setIsSni(false); + } + } catch (error) { + console.error('Error fetching SNI data:', error); + setIsSni(false); + } + }; + + // Lakukan pemanggilan API untuk memeriksa isTkdn + const fetchTkdnData = async () => { + try { + const response = await fetch('URL_API_TKDN'); + const data = await response.json(); + if (data && data.tkdn) { + setTkdn(true); + } else { + setTkdn(false); + } + } catch (error) { + console.error('Error fetching TKDN data:', error); + setTkdn(false); + } + }; + fetchSniData(); + fetchTkdnData(); + return () => { + }; + }, []); + const callForPriceWhatsapp = whatsappUrl('product', { name: product.name, manufacture: product.manufacture?.name, @@ -41,11 +82,39 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { return (
+
+
+
+ {!isSni && ( + + )} +
+
+ {!isTkdn && ( + + )} +
+
+
+ + {router.pathname != '/' && product?.flashSale?.id > 0 && (
@@ -171,11 +240,37 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => {
- +
+ +
+
+ {!isSni && ( + + )} +
+
+ {!isTkdn && ( + + )} +
+
+
{product.variantTotal > 1 && (
{product.variantTotal} Varian -- cgit v1.2.3 From 87432c8627896711167813654dce2969ce45e643 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 5 Jun 2024 13:11:26 +0700 Subject: add Informasi SNI & TKDN --- 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 8dde4dbe..00edc29d 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -90,7 +90,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { />
- {!isSni && ( + {isSni && ( { )}
- {!isTkdn && ( + {isTkdn && ( Date: Wed, 5 Jun 2024 15:01:12 +0700 Subject: fixing shipping address and invoice address --- src/lib/checkout/components/Checkout.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 0090acee..5ca3611f 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -333,8 +333,10 @@ const Checkout = () => { quantity: product.quantity, })); let data = { - partner_shipping_id: auth.partnerId, - partner_invoice_id: auth.partnerId, + // partner_shipping_id: auth.partnerId, + // partner_invoice_id: auth.partnerId, + partner_shipping_id: selectedAddress?.shipping?.id || auth.partnerId, + partner_invoice_id: selectedAddress?.invoicing?.id || auth.partnerId, user_id: auth.id, order_line: JSON.stringify(productOrder), delivery_amount: biayaKirim, -- cgit v1.2.3 From f9f1fdf83c2b6ed5c1d85d7418d45aeed9b05c77 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 5 Jun 2024 15:24:42 +0700 Subject: add feature SNI-TKDR --- src/lib/product/components/ProductCard.jsx | 4 +- src/lib/transaction/components/Transaction.jsx | 71 ++++++++++++++++++++++++- src/lib/variant/components/VariantCard.jsx | 72 +++++++++++++++++++++++++- 3 files changed, 142 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 00edc29d..8dde4dbe 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -90,7 +90,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { />
- {isSni && ( + {!isSni && ( { )}
- {isTkdn && ( + {!isTkdn && ( { const [idAWB, setIdAWB] = useState(null); const openUploadPo = () => setUploadPo(true); const closeUploadPo = () => setUploadPo(false); + const [isSni, setIsSni] = useState(false); + const [isTkdn, setTkdn] = useState(false); + + useEffect(() => { + const fetchSniData = async () => { + try { + const response = await fetch('URL_API_SNI'); + const data = await response.json(); + if (data && data.sni) { + setIsSni(true); + } else { + setIsSni(false); + } + } catch (error) { + console.error('Error fetching SNI data:', error); + setIsSni(false); + } + }; + const fetchTkdnData = async () => { + try { + const response = await fetch('URL_API_TKDN'); + const data = await response.json(); + if (data && data.tkdn) { + setTkdn(true); + } else { + setTkdn(false); + } + } catch (error) { + console.error('Error fetching TKDN data:', error); + setTkdn(false); + } + }; + fetchSniData(); + fetchTkdnData(); + return () => { + }; + }, []); + const submitUploadPo = async () => { const file = poFile.current.files[0]; const name = poNumber.current.value; @@ -610,11 +649,39 @@ const Transaction = ({ id }) => { )} className='w-[20%] flex-shrink-0' > - + +
+
+ {!isSni && ( + + )} +
+
+ {!isTkdn && ( + + )} +
+
+
+
{ const router = useRouter() + const [isSni, setIsSni] = useState(false); + const [isTkdn, setTkdn] = useState(false); + + useEffect(() => { + // Lakukan pemanggilan API untuk memeriksa isSni + const fetchSniData = async () => { + try { + const response = await fetch('URL_API_SNI'); + const data = await response.json(); + if (data && data.sni) { + setIsSni(true); + } else { + setIsSni(false); + } + } catch (error) { + console.error('Error fetching SNI data:', error); + setIsSni(false); + } + }; + + // Lakukan pemanggilan API untuk memeriksa isTkdn + const fetchTkdnData = async () => { + try { + const response = await fetch('URL_API_TKDN'); + const data = await response.json(); + if (data && data.tkdn) { + setTkdn(true); + } else { + setTkdn(false); + } + } catch (error) { + console.error('Error fetching TKDN data:', error); + setTkdn(false); + } + }; + fetchSniData(); + fetchTkdnData(); + return () => { + }; + }, []); const addItemToCart = () => { toast.success('Berhasil menambahkan ke keranjang', { duration: 1500 }) @@ -27,11 +69,39 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { const Card = () => (
- + +
+
+ {!isSni && ( + + )} +
+
+ {!isTkdn && ( + + )} +
+
+
+

{product.parent.name}

-- cgit v1.2.3 From 755b61a8a7a082cc13f7ecb4a79807f90e60b3d6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 5 Jun 2024 16:50:38 +0700 Subject: add feature SNI-TKDN --- src/lib/product/components/ProductCard.jsx | 103 ++++++++----------------- src/lib/transaction/components/Transaction.jsx | 4 +- src/lib/variant/components/VariantCard.jsx | 4 +- 3 files changed, 36 insertions(+), 75 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 8dde4dbe..48a30b51 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import ImageNext from 'next/image'; import { useRouter } from 'next/router'; -import { useMemo, useEffect, useState } from 'react'; +import { useMemo} from 'react'; import Image from '@/core/components/elements/Image/Image'; import Link from '@/core/components/elements/Link/Link'; @@ -15,46 +15,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const router = useRouter(); const utmSource = useUtmSource(); - const [isSni, setIsSni] = useState(false); - const [isTkdn, setTkdn] = useState(false); - - useEffect(() => { - // Lakukan pemanggilan API untuk memeriksa isSni - const fetchSniData = async () => { - try { - const response = await fetch('URL_API_SNI'); - const data = await response.json(); - if (data && data.sni) { - setIsSni(true); - } else { - setIsSni(false); - } - } catch (error) { - console.error('Error fetching SNI data:', error); - setIsSni(false); - } - }; - - // Lakukan pemanggilan API untuk memeriksa isTkdn - const fetchTkdnData = async () => { - try { - const response = await fetch('URL_API_TKDN'); - const data = await response.json(); - if (data && data.tkdn) { - setTkdn(true); - } else { - setTkdn(false); - } - } catch (error) { - console.error('Error fetching TKDN data:', error); - setTkdn(false); - } - }; - fetchSniData(); - fetchTkdnData(); - return () => { - }; - }, []); + const callForPriceWhatsapp = whatsappUrl('product', { name: product.name, @@ -90,7 +51,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { />
- {!isSni && ( + {product.isSni && ( { )}
- {!isTkdn && ( + {product.isTkdn && ( {
- -
-
- {!isSni && ( - - )} -
-
- {!isTkdn && ( - - )} + +
+
+ {product.isSni && ( + + )} +
+
+ {product.isTkdn && ( + + )} +
-
{product.variantTotal > 1 && (
diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index fb5fd0dd..f3e2afb9 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -658,7 +658,7 @@ const Transaction = ({ id }) => { />
- {!isSni && ( + {product.isSni && ( { )}
- {!isTkdn && ( + {product.isTkdn && ( { />
- {!isSni && ( + {product.isSni && ( { )}
- {!isTkdn && ( + {product.isTkdn && ( Date: Wed, 5 Jun 2024 17:01:12 +0700 Subject: add feature SNI-TKDN --- src/lib/product/components/ProductCard.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 48a30b51..357f3fd9 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import ImageNext from 'next/image'; import { useRouter } from 'next/router'; -import { useMemo} from 'react'; +import { useMemo, useEffect, useState } from 'react'; import Image from '@/core/components/elements/Image/Image'; import Link from '@/core/components/elements/Link/Link'; @@ -15,7 +15,6 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const router = useRouter(); const utmSource = useUtmSource(); - const callForPriceWhatsapp = whatsappUrl('product', { name: product.name, -- cgit v1.2.3 From 68a3c897edef3f42a339d92ed8d663039f3ddfc7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 6 Jun 2024 09:39:01 +0700 Subject: add feature SNI-TKDN --- src/lib/transaction/components/Transaction.jsx | 40 ++----------------------- src/lib/variant/components/VariantCard.jsx | 41 ++------------------------ 2 files changed, 5 insertions(+), 76 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index f3e2afb9..9962b46e 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -50,43 +50,9 @@ const Transaction = ({ id }) => { const [idAWB, setIdAWB] = useState(null); const openUploadPo = () => setUploadPo(true); const closeUploadPo = () => setUploadPo(false); - const [isSni, setIsSni] = useState(false); - const [isTkdn, setTkdn] = useState(false); - - useEffect(() => { - const fetchSniData = async () => { - try { - const response = await fetch('URL_API_SNI'); - const data = await response.json(); - if (data && data.sni) { - setIsSni(true); - } else { - setIsSni(false); - } - } catch (error) { - console.error('Error fetching SNI data:', error); - setIsSni(false); - } - }; - const fetchTkdnData = async () => { - try { - const response = await fetch('URL_API_TKDN'); - const data = await response.json(); - if (data && data.tkdn) { - setTkdn(true); - } else { - setTkdn(false); - } - } catch (error) { - console.error('Error fetching TKDN data:', error); - setTkdn(false); - } - }; - fetchSniData(); - fetchTkdnData(); - return () => { - }; - }, []); + + + const submitUploadPo = async () => { const file = poFile.current.files[0]; diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx index f5ae4478..9f65fc3c 100644 --- a/src/lib/variant/components/VariantCard.jsx +++ b/src/lib/variant/components/VariantCard.jsx @@ -12,46 +12,9 @@ import { useMemo, useEffect, useState } from 'react'; const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { const router = useRouter() - const [isSni, setIsSni] = useState(false); - const [isTkdn, setTkdn] = useState(false); + - useEffect(() => { - // Lakukan pemanggilan API untuk memeriksa isSni - const fetchSniData = async () => { - try { - const response = await fetch('URL_API_SNI'); - const data = await response.json(); - if (data && data.sni) { - setIsSni(true); - } else { - setIsSni(false); - } - } catch (error) { - console.error('Error fetching SNI data:', error); - setIsSni(false); - } - }; - - // Lakukan pemanggilan API untuk memeriksa isTkdn - const fetchTkdnData = async () => { - try { - const response = await fetch('URL_API_TKDN'); - const data = await response.json(); - if (data && data.tkdn) { - setTkdn(true); - } else { - setTkdn(false); - } - } catch (error) { - console.error('Error fetching TKDN data:', error); - setTkdn(false); - } - }; - fetchSniData(); - fetchTkdnData(); - return () => { - }; - }, []); + const addItemToCart = () => { toast.success('Berhasil menambahkan ke keranjang', { duration: 1500 }) -- cgit v1.2.3 From e7ff25b6c0763149981df738ff50871b851bf4a6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 6 Jun 2024 10:07:51 +0700 Subject: add feature SNI-TKDN --- src/lib/product/components/ProductCard.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index 357f3fd9..98732407 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -50,7 +50,7 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { />
- {product.isSni && ( + {product?.isSni && ( { )}
- {product.isTkdn && ( + {product?.isTkdn && ( { />
- {product.isSni && ( + {product?.isSni && ( { )}
- {product.isTkdn && ( + {product?.isTkdn && ( Date: Fri, 7 Jun 2024 17:08:09 +0700 Subject: add promotion program --- src/lib/home/components/PromotionProgram.jsx | 31 +++++++++++++++++++++ src/lib/promo/components/Promocrumb.jsx | 40 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/lib/home/components/PromotionProgram.jsx create mode 100644 src/lib/promo/components/Promocrumb.jsx (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx new file mode 100644 index 00000000..461383a1 --- /dev/null +++ b/src/lib/home/components/PromotionProgram.jsx @@ -0,0 +1,31 @@ +import Link from '@/core/components/elements/Link/Link' +import Image from 'next/image' +import { bannerApi } from '@/api/bannerApi'; + +const { useQuery } = require('react-query') + +const BannerSection = () => { + const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); + + return ( + promotionProgram.data && + promotionProgram.data?.length > 0 && ( +
+ {promotionProgram.data?.map((banner) => ( + + + + ))} +
+ ) + ) +} + +export default BannerSection diff --git a/src/lib/promo/components/Promocrumb.jsx b/src/lib/promo/components/Promocrumb.jsx new file mode 100644 index 00000000..a96ec6b4 --- /dev/null +++ b/src/lib/promo/components/Promocrumb.jsx @@ -0,0 +1,40 @@ +import { Breadcrumb as ChakraBreadcrumb, BreadcrumbItem, BreadcrumbLink } from '@chakra-ui/react' +import Link from 'next/link' +import React from 'react' + +/** + * Renders a breadcrumb component with links to navigate through different pages. + * + * @param {Object} props - The props object containing the brand name. + * @param {string} props.brandName - The name of the brand to display in the breadcrumb. + * @return {JSX.Element} The rendered breadcrumb component. + */ +const Breadcrumb = ({ brandName }) => { + return ( +
+ + + + Shop + + + + + + Promo + + + + + {brandName} + + +
+ ) +} + +export default Breadcrumb -- cgit v1.2.3 From 5e5b67e5b98d3183044dc5149fe67a29feeb3c41 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 10 Jun 2024 16:53:28 +0700 Subject: update promotion-program --- src/lib/home/components/PromotionProgram.jsx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index 461383a1..a3c09a9b 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -1,16 +1,25 @@ import Link from '@/core/components/elements/Link/Link' import Image from 'next/image' import { bannerApi } from '@/api/bannerApi'; - +import useDevice from '@/core/hooks/useDevice' const { useQuery } = require('react-query') - const BannerSection = () => { const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); + const { isMobile, isDesktop } = useDevice() return ( - promotionProgram.data && +
+
+
Promo Tersedia
+ {isDesktop && ( + + Lihat Semua + + )} +
+ {promotionProgram.data && promotionProgram.data?.length > 0 && ( -
+
{promotionProgram.data?.map((banner) => ( { ))}
- ) + + )} +
+ ) } -- cgit v1.2.3 From 9565ddf794165e297acf511a108f9a9643ee615d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 11 Jun 2024 13:40:23 +0700 Subject: update promotion program --- src/lib/home/components/PromotionProgram.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index a3c09a9b..98bc7c7f 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -9,17 +9,19 @@ const BannerSection = () => { return (
-
+
Promo Tersedia
{isDesktop && ( - - Lihat Semua - + + Lihat Semua + )}
{promotionProgram.data && promotionProgram.data?.length > 0 && ( -
+
{promotionProgram.data?.map((banner) => ( { quality={100} src={banner.image} alt={banner.name} - className='h-auto w-full rounded' + className='h-auto w-full rounded hover:scale-105 transition duration-500 ease-in-out' /> ))} -- cgit v1.2.3 From 0a87455727114468c216fbcd74266ea928eaec37 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 13 Jun 2024 09:34:24 +0700 Subject: update promotion-program --- src/lib/product/components/ProductFilterDesktop.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductFilterDesktop.jsx b/src/lib/product/components/ProductFilterDesktop.jsx index e4a62abb..b4afebc2 100644 --- a/src/lib/product/components/ProductFilterDesktop.jsx +++ b/src/lib/product/components/ProductFilterDesktop.jsx @@ -21,6 +21,7 @@ import Image from '@/core/components/elements/Image/Image' import { formatCurrency } from '@/core/utils/formatValue' const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = null }) => { + console.log("prefixUrl",prefixUrl) const router = useRouter() const { query } = router const [order, setOrder] = useState(query?.orderBy) @@ -102,7 +103,14 @@ const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = nu } params = _.pickBy(params, _.identity) params = toQuery(params) - router.push(`${prefixUrl}?${params}`) + + const slug = Array.isArray(router.query.slug) ? router.query.slug[0] : router.query.slug; + + if (slug) { + router.push(`${prefixUrl}/${slug}?${params}`) + } else { + router.push(`${prefixUrl}?${params}`) + } } -- cgit v1.2.3 From 9bf19afa1776f72d1cc930558ccce41ec855a30d Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 14 Jun 2024 09:15:00 +0700 Subject: google sign up --- src/lib/auth/components/LoginDesktop.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/LoginDesktop.jsx b/src/lib/auth/components/LoginDesktop.jsx index 1333db14..9a68dc53 100644 --- a/src/lib/auth/components/LoginDesktop.jsx +++ b/src/lib/auth/components/LoginDesktop.jsx @@ -8,6 +8,7 @@ import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import BottomPopup from '@/core/components/elements/Popup/BottomPopup'; import LogoSpinner from '@/core/components/elements/Spinner/LogoSpinner'; +import Image from 'next/image'; const LoginDesktop = () => { const { @@ -108,7 +109,7 @@ const LoginDesktop = () => { {!isLoading ? 'Masuk' : 'Loading...'} - {/*
+

ATAU


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

Masuk dengan Google

- */} +
Belum punya akun Indoteknik?{' '} -- cgit v1.2.3 From b7c98bf3586d31fa65eea048ed2c98db321ce28c Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 14 Jun 2024 10:39:54 +0700 Subject: login mobile --- src/lib/auth/components/LoginMobile.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/auth/components/LoginMobile.jsx b/src/lib/auth/components/LoginMobile.jsx index 40924fbe..d2bf704f 100644 --- a/src/lib/auth/components/LoginMobile.jsx +++ b/src/lib/auth/components/LoginMobile.jsx @@ -117,7 +117,7 @@ const LoginMobile = () => { {!isLoading ? 'Masuk' : 'Loading...'} - {/*
+

ATAU


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

Masuk dengan Google

- */} +
Belum punya akun Indoteknik?{' '} -- cgit v1.2.3 From e3e3fe8d87130fcd1872046de0160272b6ea9763 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 14 Jun 2024 15:15:30 +0700 Subject: update promotion-program --- src/lib/product/components/ProductSearch.jsx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 08b64c13..ec0077c2 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -130,6 +130,7 @@ const ProductSearch = ({ brands.push({ brand, qty }); } } + console.log("daftar brand",brands) const categories = []; for ( @@ -144,6 +145,7 @@ const ProductSearch = ({ categories.push({ name, qty }); } } + console.log("daftar kategori",categories) const orderOptions = [ { value: 'price-asc', label: 'Harga Terendah' }, -- cgit v1.2.3 From 98109d3da0a88dfa1a513be68a0debe2e626d331 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 18 Jun 2024 11:50:51 +0700 Subject: fixing error refirect login --- src/lib/auth/hooks/useLogin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/auth/hooks/useLogin.js b/src/lib/auth/hooks/useLogin.js index dc9580ea..dd5a4b03 100644 --- a/src/lib/auth/hooks/useLogin.js +++ b/src/lib/auth/hooks/useLogin.js @@ -74,7 +74,7 @@ const useLogin = () => { if (data.isAuth) { session.odooUser = data.user; setCookie('auth', JSON.stringify(session?.odooUser)); - router.push(decodeURIComponent(router?.query?.next) ?? '/'); + router.push(router?.query?.next || '/'); return; } }; -- cgit v1.2.3 From ced37d32aa345fc288483716771422e7b7c0913a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 19 Jun 2024 17:10:24 +0700 Subject: update tampilan promotion program --- .../components/ProductFilterDesktopPromotion.jsx | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/lib/product/components/ProductFilterDesktopPromotion.jsx (limited to 'src/lib') diff --git a/src/lib/product/components/ProductFilterDesktopPromotion.jsx b/src/lib/product/components/ProductFilterDesktopPromotion.jsx new file mode 100644 index 00000000..332d2374 --- /dev/null +++ b/src/lib/product/components/ProductFilterDesktopPromotion.jsx @@ -0,0 +1,98 @@ +import { useRouter } from 'next/router' +import { useEffect, useState } from 'react' +import _ from 'lodash' +import { toQuery } from 'lodash-contrib' +import { Button } from '@chakra-ui/react' +import { MultiSelect } from 'primereact/multiselect'; + +const ProductFilterDesktop = ({ brands, categories, prefixUrl }) => { + const router = useRouter() + const { query } = router + + const [selectedBrand, setSelectedBrand] = useState(null); + const [selectedCategory, setSelectedCategory] = useState(null); + + const handleSubmit = () => { + let params = { + q: router.query.q, + orderBy: query?.orderBy, + brand: selectedBrand ? selectedBrand.map(b => b.code).join(',') : '', + category: query?.category, + priceFrom: query?.priceFrom, + priceTo: query?.priceTo, + stock: query?.stock + } + params = _.pickBy(params, _.identity) + params = toQuery(params) + + const slug = Array.isArray(router.query.slug) ? router.query.slug[0] : router.query.slug; + + if (slug) { + router.push(`${prefixUrl}/${slug}?${params}`) + } else { + router.push(`${prefixUrl}?${params}`) + } + } + + const countryTemplate = (option) => { + return ( +
+
{option.name}
+
+ ); + }; + + const brandOptions = brands.map(brand => ({ + name: `${brand.brand} (${brand.qty})`, + code: brand.brand + })); + + const categoryOptions = categories.map(category => ({ + name: `${category.name} (${category.qty})`, + code: category.name + })); + + const panelFooterTemplate = () => { + return ( + + ); + }; + + return ( +
+
+ + setSelectedBrand(e.value)} + optionLabel="name" + placeholder="Pilih Brand" + itemTemplate={countryTemplate} + panelFooterTemplate={panelFooterTemplate} + className="w-full" + display="chip" + /> +
+ +
+ + setSelectedCategory(e.value)} + optionLabel="name" + placeholder="Pilih Kategori" + itemTemplate={countryTemplate} + panelFooterTemplate={panelFooterTemplate} + className="w-full" + display="chip" + /> +
+
+ ) +} + +export default ProductFilterDesktop -- cgit v1.2.3 From fd96f81bdf1ad6bfe8c7a60571eb9ea70f432ff8 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 20 Jun 2024 11:54:11 +0700 Subject: update filter promotion-program --- .../components/ProductFilterDesktopPromotion.jsx | 186 ++++++++++++--------- 1 file changed, 110 insertions(+), 76 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductFilterDesktopPromotion.jsx b/src/lib/product/components/ProductFilterDesktopPromotion.jsx index 332d2374..0815b881 100644 --- a/src/lib/product/components/ProductFilterDesktopPromotion.jsx +++ b/src/lib/product/components/ProductFilterDesktopPromotion.jsx @@ -1,98 +1,132 @@ -import { useRouter } from 'next/router' -import { useEffect, useState } from 'react' -import _ from 'lodash' -import { toQuery } from 'lodash-contrib' -import { Button } from '@chakra-ui/react' -import { MultiSelect } from 'primereact/multiselect'; +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import _ from 'lodash'; +import { toQuery } from 'lodash-contrib'; +import { Button } from '@chakra-ui/react'; +import { MultiSelect } from 'react-multi-select-component'; const ProductFilterDesktop = ({ brands, categories, prefixUrl }) => { - const router = useRouter() - const { query } = router + const router = useRouter(); + const { query } = router; + const [order, setOrder] = useState(query?.orderBy); + const [brandValues, setBrand] = useState([]); + const [categoryValues, setCategory] = useState([]); + const [priceFrom, setPriceFrom] = useState(query?.priceFrom); + const [priceTo, setPriceTo] = useState(query?.priceTo); + const [stock, setStock] = useState(query?.stock); + const [activeRange, setActiveRange] = useState(null); + const [isBrandDropdownClicked, setIsBrandDropdownClicked] = useState(false); + const [isCategoryDropdownClicked, setIsCategoryDropdownClicked] = useState(false); - const [selectedBrand, setSelectedBrand] = useState(null); - const [selectedCategory, setSelectedCategory] = useState(null); + // Effect to set brandValues from query parameter 'brand' + useEffect(() => { + const brandParam = query?.brand; + if (brandParam) { + const brandsArray = brandParam.split(',').map((b) => ({ + label: b, + value: b, + })); + setBrand(brandsArray); + } + + }, [query.brand]); // Trigger effect whenever query.brand changes + + useEffect(() => { + const categoryParam = query?.category; + if (categoryParam) { + const categoriesArray = categoryParam.split(',').map((c) => ({ + label: c, + value: c, + })); + setCategory(categoriesArray); + } + }, [query.category]); // Trigger effect whenever query.category changes const handleSubmit = () => { let params = { q: router.query.q, - orderBy: query?.orderBy, - brand: selectedBrand ? selectedBrand.map(b => b.code).join(',') : '', - category: query?.category, - priceFrom: query?.priceFrom, - priceTo: query?.priceTo, - stock: query?.stock - } - params = _.pickBy(params, _.identity) - params = toQuery(params) + orderBy: order, + brand: brandValues.map((b) => b.value).join(','), + category: categoryValues.map((c) => c.value).join(','), + priceFrom, + priceTo, + stock: stock, + }; + params = _.pickBy(params, _.identity); + params = toQuery(params); - const slug = Array.isArray(router.query.slug) ? router.query.slug[0] : router.query.slug; + const slug = Array.isArray(router.query.slug) + ? router.query.slug[0] + : router.query.slug; if (slug) { - router.push(`${prefixUrl}/${slug}?${params}`) + router.push(`${prefixUrl}/${slug}?${params}`); } else { - router.push(`${prefixUrl}?${params}`) + router.push(`${prefixUrl}?${params}`); } - } - - const countryTemplate = (option) => { - return ( -
-
{option.name}
-
- ); }; - const brandOptions = brands.map(brand => ({ - name: `${brand.brand} (${brand.qty})`, - code: brand.brand - })); - const categoryOptions = categories.map(category => ({ - name: `${category.name} (${category.qty})`, - code: category.name + const brandOptions = brands.map((brand) => ({ + label: `${brand.brand} (${brand.qty})`, + value: brand.brand, })); - const panelFooterTemplate = () => { - return ( - - ); - }; + const categoryOptions = categories.map((category) => ({ + label: `${category.name} (${category.qty})`, + value: category.name, + })); return ( -
-
- - setSelectedBrand(e.value)} - optionLabel="name" - placeholder="Pilih Brand" - itemTemplate={countryTemplate} - panelFooterTemplate={panelFooterTemplate} - className="w-full" - display="chip" - /> -
+ <> +
+ {/* Brand MultiSelect */} +
+
+ +
+ setIsBrandDropdownClicked(isOpen)} + hasSelectAll={false} + /> +
+
+
+ + {/* Category MultiSelect */} +
+
+ +
+ + setIsCategoryDropdownClicked(!isCategoryDropdownClicked) + } + hasSelectAll={false} + /> +
+
+
-
- - setSelectedCategory(e.value)} - optionLabel="name" - placeholder="Pilih Kategori" - itemTemplate={countryTemplate} - panelFooterTemplate={panelFooterTemplate} - className="w-full" - display="chip" - /> + {/* Apply Button */} +
+
+ +
+
-
- ) -} + + ); +}; -export default ProductFilterDesktop +export default ProductFilterDesktop; -- cgit v1.2.3 From 7afd73bde637528e9427124b6e9842a026f823f6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 21 Jun 2024 16:46:24 +0700 Subject: remove console log --- src/lib/product/components/ProductFilterDesktop.jsx | 1 - src/lib/product/components/ProductSearch.jsx | 2 -- 2 files changed, 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductFilterDesktop.jsx b/src/lib/product/components/ProductFilterDesktop.jsx index b4afebc2..b9be7c15 100644 --- a/src/lib/product/components/ProductFilterDesktop.jsx +++ b/src/lib/product/components/ProductFilterDesktop.jsx @@ -21,7 +21,6 @@ import Image from '@/core/components/elements/Image/Image' import { formatCurrency } from '@/core/utils/formatValue' const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = null }) => { - console.log("prefixUrl",prefixUrl) const router = useRouter() const { query } = router const [order, setOrder] = useState(query?.orderBy) diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index ec0077c2..08b64c13 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -130,7 +130,6 @@ const ProductSearch = ({ brands.push({ brand, qty }); } } - console.log("daftar brand",brands) const categories = []; for ( @@ -145,7 +144,6 @@ const ProductSearch = ({ categories.push({ name, qty }); } } - console.log("daftar kategori",categories) const orderOptions = [ { value: 'price-asc', label: 'Harga Terendah' }, -- cgit v1.2.3 From 01bea5fe1b68fee2d673274b44295db6fc665e29 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 24 Jun 2024 14:36:56 +0700 Subject: ubah button lihat semua --- src/lib/home/components/PromotionProgram.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index 98bc7c7f..66216d19 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -12,9 +12,7 @@ const BannerSection = () => {
Promo Tersedia
{isDesktop && ( - + Lihat Semua )} -- cgit v1.2.3 From cac51e393df3adfbb2ea971be9a26daf78e6ef90 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 28 Jun 2024 10:13:16 +0700 Subject: update button lihat semua --- src/lib/home/components/PromotionProgram.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index 98bc7c7f..66216d19 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -12,9 +12,7 @@ const BannerSection = () => {
Promo Tersedia
{isDesktop && ( - + Lihat Semua )} -- cgit v1.2.3 From 936f7f9fb1c6951e02dd8a5f7e85fb8d39cc7e6a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 28 Jun 2024 10:23:57 +0700 Subject: delete console.log --- src/lib/product/components/ProductFilterDesktop.jsx | 2 +- src/lib/product/components/ProductSearch.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/product/components/ProductFilterDesktop.jsx b/src/lib/product/components/ProductFilterDesktop.jsx index b4afebc2..a8073036 100644 --- a/src/lib/product/components/ProductFilterDesktop.jsx +++ b/src/lib/product/components/ProductFilterDesktop.jsx @@ -21,7 +21,7 @@ import Image from '@/core/components/elements/Image/Image' import { formatCurrency } from '@/core/utils/formatValue' const ProductFilterDesktop = ({ brands, categories, prefixUrl, defaultBrand = null }) => { - console.log("prefixUrl",prefixUrl) + const router = useRouter() const { query } = router const [order, setOrder] = useState(query?.orderBy) diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index ec0077c2..b1a5d409 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -130,7 +130,7 @@ const ProductSearch = ({ brands.push({ brand, qty }); } } - console.log("daftar brand",brands) + const categories = []; for ( @@ -145,7 +145,7 @@ const ProductSearch = ({ categories.push({ name, qty }); } } - console.log("daftar kategori",categories) + const orderOptions = [ { value: 'price-asc', label: 'Harga Terendah' }, -- cgit v1.2.3 From b5effbf8b6b4927614ab15fcf1f9b8ba1afcdadf Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 28 Jun 2024 11:10:30 +0700 Subject: update button lihat semua dan promocrumb --- src/lib/home/components/PromotionProgram.jsx | 10 ++++++---- src/lib/promo/components/Promocrumb.jsx | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index 66216d19..66ed6749 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -2,19 +2,21 @@ import Link from '@/core/components/elements/Link/Link' import Image from 'next/image' import { bannerApi } from '@/api/bannerApi'; import useDevice from '@/core/hooks/useDevice' +import { div } from 'lodash-contrib'; const { useQuery } = require('react-query') const BannerSection = () => { const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); const { isMobile, isDesktop } = useDevice() - + console.log("promotionProgram",promotionProgram) return (
Promo Tersedia
{isDesktop && ( - - Lihat Semua - +
+ // + // Lihat Semua + // )}
{promotionProgram.data && diff --git a/src/lib/promo/components/Promocrumb.jsx b/src/lib/promo/components/Promocrumb.jsx index a96ec6b4..4f5cf346 100644 --- a/src/lib/promo/components/Promocrumb.jsx +++ b/src/lib/promo/components/Promocrumb.jsx @@ -19,7 +19,7 @@ const Breadcrumb = ({ brandName }) => { - + {/* { > Promo - + */} {brandName} -- cgit v1.2.3 From 1455ce5887a3d03597192118ba84d3c27f165b12 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 28 Jun 2024 11:17:08 +0700 Subject: delete console log --- src/lib/home/components/PromotionProgram.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index 66ed6749..c2779fd2 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -7,7 +7,7 @@ const { useQuery } = require('react-query') const BannerSection = () => { const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); const { isMobile, isDesktop } = useDevice() - console.log("promotionProgram",promotionProgram) + return (
-- cgit v1.2.3 From ca0faeb73b521a40a2e96b2e7b724b839db6aa57 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 28 Jun 2024 16:47:06 +0700 Subject: update mobile view --- src/lib/home/components/PromotionProgram.jsx | 29 ++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PromotionProgram.jsx b/src/lib/home/components/PromotionProgram.jsx index c2779fd2..b204df8e 100644 --- a/src/lib/home/components/PromotionProgram.jsx +++ b/src/lib/home/components/PromotionProgram.jsx @@ -2,12 +2,12 @@ import Link from '@/core/components/elements/Link/Link' import Image from 'next/image' import { bannerApi } from '@/api/bannerApi'; import useDevice from '@/core/hooks/useDevice' -import { div } from 'lodash-contrib'; +import { Swiper, SwiperSlide } from 'swiper/react'; const { useQuery } = require('react-query') const BannerSection = () => { const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' })); const { isMobile, isDesktop } = useDevice() - + return (
@@ -19,7 +19,7 @@ const BannerSection = () => { // )}
- {promotionProgram.data && + {isDesktop && (promotionProgram.data && promotionProgram.data?.length > 0 && (
{promotionProgram.data?.map((banner) => ( @@ -36,7 +36,28 @@ const BannerSection = () => { ))}
- )} + ))} + +{isMobile && ( + + + {promotionProgram.data?.map((banner) => ( + + + + + + ))} + + + )}
) -- cgit v1.2.3 From b992edcc7f1b7395dea0c8562ddf272df9fc6b7f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 29 Jun 2024 10:08:16 +0700 Subject: add parameter flag flash sale --- src/lib/checkout/components/Checkout.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 5ca3611f..df1768fb 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -112,6 +112,7 @@ const Checkout = () => { const [loadingVoucher, setLoadingVoucher] = useState(true); const [loadingRajaOngkir, setLoadingRajaOngkir] = useState(false); const [grandTotal, setGrandTotal] = useState(0); + const [hasFlashSale, setHasFlashSale] = useState(false); const expedisiValidation = useRef(null); @@ -224,6 +225,7 @@ const Checkout = () => { setProducts(cartCheckout?.products); setCheckWeight(cartCheckout?.hasProductWithoutWeight); setTotalWeight(cartCheckout?.totalWeight.g); + setHasFlashSale(cartCheckout?.products[0]?.hasFlashsale ? cartCheckout.products[0].hasFlashsale : false); }, [cartCheckout]); useEffect(() => { @@ -343,6 +345,7 @@ const Checkout = () => { carrier_id: selectedCarrierId, estimated_arrival_days: splitDuration(etd), delivery_service_type: selectedExpedisiService, + flash_sale : !hasFlashSale, // dibuat negasi untuk ngetest kebalikan nilai false voucher: activeVoucher, type: 'sale_order', }; @@ -358,7 +361,7 @@ const Checkout = () => { toast.error('Gagal melakukan transaksi, terjadi kesalahan internal'); return; } - + console.log("isCheckouted",isCheckouted) gtagPurchase(products, biayaKirim, isCheckouted.name); const midtrans = async () => { -- cgit v1.2.3 From 703136862dc3d41d0a276c17fa7f4ecebd471527 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 1 Jul 2024 09:07:59 +0700 Subject: add flash sales to sales order --- src/lib/checkout/components/Checkout.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index df1768fb..4aafdece 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -227,6 +227,7 @@ const Checkout = () => { setTotalWeight(cartCheckout?.totalWeight.g); setHasFlashSale(cartCheckout?.products[0]?.hasFlashsale ? cartCheckout.products[0].hasFlashsale : false); }, [cartCheckout]); + useEffect(() => { setCheckoutValidation(false); @@ -345,7 +346,7 @@ const Checkout = () => { carrier_id: selectedCarrierId, estimated_arrival_days: splitDuration(etd), delivery_service_type: selectedExpedisiService, - flash_sale : !hasFlashSale, // dibuat negasi untuk ngetest kebalikan nilai false + flash_sale : hasFlashSale, // dibuat negasi untuk ngetest kebalikan nilai false voucher: activeVoucher, type: 'sale_order', }; @@ -361,7 +362,7 @@ const Checkout = () => { toast.error('Gagal melakukan transaksi, terjadi kesalahan internal'); return; } - console.log("isCheckouted",isCheckouted) + gtagPurchase(products, biayaKirim, isCheckouted.name); const midtrans = async () => { -- cgit v1.2.3 From 556cbc1e5ea1c1ef0170c9a1b8f470a3d92d888e Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Tue, 2 Jul 2024 10:40:06 +0700 Subject: IS SO APPROVAL --- src/lib/quotation/components/Quotation.jsx | 62 ++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'src/lib') diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index 09d55e92..8855c6c4 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -68,6 +68,8 @@ const Quotation = () => { const [etd, setEtd] = useState(null); const [etdFix, setEtdFix] = useState(null); + const [isApproval, setIsApproval] = useState(false); + const expedisiValidation = useRef(null); const [selectedAddress, setSelectedAddress] = useState({ @@ -86,6 +88,7 @@ const Quotation = () => { }; getAddresses(); + setIsApproval(auth?.feature?.soApproval); }, [auth]); useEffect(() => { @@ -185,6 +188,13 @@ const Quotation = () => { if (etd) setEtdFix(calculateEstimatedArrival(etd)); }, [etd]); + useEffect(() => { + if (isApproval) { + setselectedCarrierId(1); + setselectedExpedisiService('indoteknik'); + } + }, [isApproval]); + // end set up address and carrier useEffect(() => { @@ -235,7 +245,7 @@ const Quotation = () => { const checkout = async () => { // validation checkout - if (selectedExpedisi === 0) { + if (selectedExpedisi === 0 && !isApproval) { setCheckoutValidation(true); if (expedisiValidation.current) { const position = expedisiValidation.current.getBoundingClientRect(); @@ -246,7 +256,7 @@ const Quotation = () => { } return; } - if (selectedCarrier != 1 && biayaKirim == 0) { + if (selectedCarrier != 1 && biayaKirim == 0 && !isApproval) { toast.error('Maaf, layanan tidak tersedia. Mohon pilih expedisi lain.'); return; } @@ -267,7 +277,9 @@ const Quotation = () => { estimated_arrival_days: splitDuration(etd), delivery_service_type: selectedExpedisiService, }; + console.log('data checkout', data); const isSuccess = await checkoutApi({ data }); + console.log('isSuccess', isSuccess); setIsLoading(false); if (isSuccess?.id) { for (const product of products) deleteItemCart({ productId: product.id }); @@ -343,16 +355,21 @@ const Quotation = () => { )} - - + {!isApproval && ( + <> + + + + )} + { )} - + {!isApproval && ( + + )} + Date: Tue, 2 Jul 2024 14:55:14 +0700 Subject: add site on transactions list and transaction detial --- src/lib/transaction/components/Transaction.jsx | 25 +++++++++++++++---------- src/lib/transaction/components/Transactions.jsx | 10 ++++++++-- 2 files changed, 23 insertions(+), 12 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 9b11f5bb..30f1d902 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -37,7 +37,7 @@ import rejectApi from '../api/rejectApi'; const Transaction = ({ id }) => { const auth = useAuth(); const { transaction } = useTransaction({ id }); - + const statusApprovalWeb = transaction.data?.approvalStep const { queryAirwayBill } = useAirwayBill({ orderId: id }); @@ -78,7 +78,7 @@ const Transaction = ({ id }) => { const closeCancelTransaction = () => setCancelTransaction(false); const [rejectTransaction, setRejectTransaction] = useState(false); - + const openRejectTransaction = () => setRejectTransaction(true); const closeRejectTransaction = () => setRejectTransaction(false); const submitCancelTransaction = async () => { @@ -109,9 +109,9 @@ const Transaction = ({ id }) => { } const handleReject = async () => { - await rejectApi({ id }); - closeRejectTransaction() - transaction.refetch(); + await rejectApi({ id }); + closeRejectTransaction() + transaction.refetch(); } const memoizeVariantGroupCard = useMemo( @@ -365,7 +365,7 @@ const Transaction = ({ id }) => { className='btn-yellow w-full' onClick={checkout} disabled={ - transaction.data?.status === 'cancel' ? true : false || auth?.webRole === statusApprovalWeb ? true : false + transaction.data?.status === 'cancel' ? true : false || auth?.webRole === statusApprovalWeb ? true : false } > Approve @@ -374,7 +374,7 @@ const Transaction = ({ id }) => { className='btn-solid-red px-7 w-full' onClick={checkout} disabled={ - transaction.data?.status === 'cancel' ? true : false || auth?.webRole === statusApprovalWeb ? true : false + transaction.data?.status === 'cancel' ? true : false || auth?.webRole === statusApprovalWeb ? true : false } > Reject @@ -454,7 +454,7 @@ const Transaction = ({ id }) => { className='btn-solid-red px-7' onClick={openRejectTransaction} disabled={ - transaction.data?.status === 'cancel' ? true : false || auth?.webRole === statusApprovalWeb ? true : false || statusApprovalWeb < 1 ? true : false + transaction.data?.status === 'cancel' ? true : false || auth?.webRole === statusApprovalWeb ? true : false || statusApprovalWeb < 1 ? true : false } > Reject @@ -467,7 +467,7 @@ const Transaction = ({ id }) => { Lanjutkan Transaksi )} - {transaction.data?.status != 'draft' && !auth?.feature.soApproval && ( + {transaction.data?.status != 'draft' && !auth?.feature.soApproval && (
+ ) : ( + <> +
Site
+
: {transaction?.data?.sitePartner}
+ )}
diff --git a/src/lib/transaction/components/Transactions.jsx b/src/lib/transaction/components/Transactions.jsx index 5a6dfb01..92bdd276 100644 --- a/src/lib/transaction/components/Transactions.jsx +++ b/src/lib/transaction/components/Transactions.jsx @@ -145,7 +145,7 @@ const Transactions = ({ context = '' }) => { siteFilter || (auth?.webRole === null && auth?.site ? auth.site : null), }; const queryString = toQuery(query) - const data = await transactionsApi({ query : queryString }); + const data = await transactionsApi({ query: queryString }); return data; }; @@ -349,7 +349,7 @@ const Transactions = ({ context = '' }) => { ))} - ):(
) } + ) : (
)}
{
+ {auth?.feature?.soApproval && ( + + )} @@ -417,6 +420,9 @@ const Transactions = ({ context = '' }) => { + {auth?.feature?.soApproval && ( + + )} + @@ -620,10 +657,61 @@ const Transaction = ({ id }) => {
{currencyFormat(product.price.priceDiscount)}
+ {/* {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (transaction.data.isReaject == false) && ( */} + {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (router.asPath.includes("/my/quotations/")) && ( + + )} + {/* {transaction.data.isReaject && ( + + )} */} ))}
No. PO Tanggal Created BySiteSalesperson Total Status{saleOrder.purchaseOrderName || '-'} {saleOrder.dateOrder || '-'} {saleOrder.address.customer?.name || '-'}{saleOrder.sitePartner || '-'}{saleOrder.sales} {currencyFormat(saleOrder.amountTotal)} -- cgit v1.2.3 From 51fb7cb3adeb99c428e716a17cc524b5dbbe3da7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 5 Jul 2024 17:00:48 +0700 Subject: fix bug sequence brands homepage --- src/lib/home/components/PreferredBrand.jsx | 38 ++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'src/lib') diff --git a/src/lib/home/components/PreferredBrand.jsx b/src/lib/home/components/PreferredBrand.jsx index 571c4745..ec09aa4e 100644 --- a/src/lib/home/components/PreferredBrand.jsx +++ b/src/lib/home/components/PreferredBrand.jsx @@ -1,13 +1,41 @@ import { Swiper, SwiperSlide } from 'swiper/react' +import { useCallback, useEffect, useState } from 'react' import usePreferredBrand from '../hooks/usePreferredBrand' import PreferredBrandSkeleton from './Skeleton/PreferredBrandSkeleton' import BrandCard from '@/lib/brand/components/BrandCard' import useDevice from '@/core/hooks/useDevice' import Link from '@/core/components/elements/Link/Link' +import axios from 'axios' const PreferredBrand = () => { let query = 'level_s' let params = 'prioritas' + const [isLoading, setIsLoading] = useState(true) + const [startWith, setStartWith] = useState(null) + const [manufactures, setManufactures] = useState([]) + + const loadBrand = useCallback(async () => { + setIsLoading(true) + const name = startWith ? `${startWith}*` : '' + const result = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=${name}`) + + setIsLoading(false) + setManufactures((manufactures) => [...result.data]) + }, [startWith]) + + const toggleStartWith = (alphabet) => { + setManufactures([]) + if (alphabet == startWith) { + setStartWith(null) + return + } + setStartWith(alphabet) + } + + useEffect(() => { + loadBrand() + }, [loadBrand]) + const { preferredBrands } = usePreferredBrand(query) const { isMobile, isDesktop } = useDevice() @@ -21,12 +49,12 @@ const PreferredBrand = () => { )} - {preferredBrands.isLoading && } - {!preferredBrands.isLoading && ( + {manufactures.isLoading && } + {!manufactures.isLoading && ( - {preferredBrands.data?.data.map((brand) => ( - - + {manufactures.map((manufacture) => ( + + ))} -- cgit v1.2.3 From dc204e9cdbcf7faf81dba825db608be2c918589d Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 9 Jul 2024 16:31:30 +0700 Subject: { + const dataCheckout = await odooApi('POST', `/api/v1/sale_order/${idSo}/reject/${idProduct}`, { + reason_reject: reason + }); + return dataCheckout +} +export default rejectProductApi \ No newline at end of file diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 9b11f5bb..03c94ded 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -33,13 +33,17 @@ import useAuth from '@/core/hooks/useAuth'; import StepApproval from './stepper'; import aprpoveApi from '../api/approveApi'; import rejectApi from '../api/rejectApi'; +import rejectProductApi from '../api/rejectProductApi'; +import { useRouter } from 'next/router'; const Transaction = ({ id }) => { + const router = useRouter() + const [isModalOpen, setIsModalOpen] = useState(false); + const [selectedProduct, setSelectedProduct] = useState(null); + const [reason, setReason] = useState(''); const auth = useAuth(); const { transaction } = useTransaction({ id }); - const statusApprovalWeb = transaction.data?.approvalStep - const { queryAirwayBill } = useAirwayBill({ orderId: id }); const [airwayBillPopup, setAirwayBillPopup] = useState(null); @@ -151,6 +155,38 @@ const Transaction = ({ id }) => { setIdAWB(null); }; + const openModal = (product) => { + setSelectedProduct(product); + setIsModalOpen(true); + }; + + const closeModal = () => { + setIsModalOpen(false); + setSelectedProduct(null); + setReason(''); + }; + + const handleRejectProduct = async () => { + try{ + if (!reason.trim()) { + toast.error('Masukkan alasan terlebih dahulu'); + return; + }else{ + let idSo = transaction?.data.id + let idProduct = selectedProduct?.id + await rejectProductApi({ idSo, idProduct, reason}); + closeModal(); + toast.success("Produk berhasil di reaject") + setTimeout(() => { + window.location.reload(); + }, 1500); + } + }catch(error){ + toast.error('Gagal reject produk. Silakan coba lagi.'); + } + }; + + return ( transaction.data?.name && ( <> @@ -566,6 +602,7 @@ const Transaction = ({ id }) => { Jumlah Harga Subtotal
{currencyFormat(product.price.subtotal)} + + + +
+ {isModalOpen && ( +
+
+

Berikan Alasan

+ +
+ + +
+
+
+ )}
diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx index 9f1b5733..c629c987 100644 --- a/src/lib/variant/components/VariantCard.jsx +++ b/src/lib/variant/components/VariantCard.jsx @@ -1,16 +1,25 @@ import { useRouter } from 'next/router' import { toast } from 'react-hot-toast' - +import useAuth from '@/core/hooks/useAuth'; import Image from '@/core/components/elements/Image/Image' import Link from '@/core/components/elements/Link/Link' import { createSlug } from '@/core/utils/slug' import currencyFormat from '@/core/utils/currencyFormat' import { updateItemCart } from '@/core/utils/cart' import whatsappUrl from '@/core/utils/whatsappUrl' +import {useState } from 'react'; +import rejectProductApi from '../../../lib/transaction/api/rejectProductApi' +// import {useTransaction} from 'C:\Users\Indoteknik\next-indoteknik\src\lib\transaction\hooks\useTransaction.js' +import useTransaction from '../../../lib/transaction/hooks/useTransaction'; const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { const router = useRouter() - + const id = router.query.id + const auth = useAuth(); + const { transaction } = useTransaction({id}); + const [isModalOpen, setIsModalOpen] = useState(false); + const [selectedProduct, setSelectedProduct] = useState(null); + const [reason, setReason] = useState(''); const addItemToCart = () => { toast.success('Berhasil menambahkan ke keranjang', { duration: 1500 }) updateItemCart({ @@ -19,11 +28,42 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { }) return } - + const checkoutItem = () => { router.push(`/shop/checkout?product_id=${product.id}&qty=${product.quantity}`) } - + + const openModal = (product) => { + setSelectedProduct(product); + setIsModalOpen(true); + }; + + const closeModal = () => { + setIsModalOpen(false); + setSelectedProduct(null); + setReason(''); + }; + + const handleRejectProduct = async () => { + try { + if (!reason.trim()) { + toast.error('Masukkan alasan terlebih dahulu'); + return; + }else{ + let idSo = transaction?.data.id + let idProduct = selectedProduct.id + await rejectProductApi({ idSo, idProduct, reason}); + closeModal(); + toast.success("Produk berhasil di reject") + setTimeout(() => { + window.location.reload(); + }, 1500); + } + } catch (error) { + toast.error('Gagal reject produk. Silakan coba lagi.'); + } + }; + const Card = () => (
@@ -91,14 +131,59 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { > Tambah Keranjang - + {/* {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (transaction.data.isReaject == false) && ( */} + {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (router.asPath.includes("/my/quotations/")) && ( + + + + )} + {/* {transaction.data.isReaject && ( + + + + )} */} + {isModalOpen && ( +
+
+

Berikan Alasan

+ +
+ + +
+
+
+ )}
+ )} ) -- cgit v1.2.3 From e3d0de0ba20eee9d53e95c5525907b099d2b5b04 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 10 Jul 2024 14:20:29 +0700 Subject: update reaject button & component position --- src/lib/transaction/components/Transaction.jsx | 316 ++++++++++++++++--------- src/lib/variant/components/VariantCard.jsx | 31 +-- 2 files changed, 217 insertions(+), 130 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 03c94ded..8e7cede0 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -143,6 +143,15 @@ const Transaction = ({ id }) => { [transaction.data] ); + const memoizeVariantGroupCardReject = useMemo( + () => ( +
+ +
+ ), + [transaction.data] + ); + if (transaction.isLoading) { return (
@@ -176,7 +185,7 @@ const Transaction = ({ id }) => { let idProduct = selectedProduct?.id await rejectProductApi({ idSo, idProduct, reason}); closeModal(); - toast.success("Produk berhasil di reaject") + toast.success("Produk berhasil di reject") setTimeout(() => { window.location.reload(); }, 1500); @@ -329,6 +338,37 @@ const Transaction = ({ id }) => { +
+

Invoice

+
+ {transaction.data?.invoices?.map((invoice, index) => ( + +
+
+

{invoice?.name}

+
+ {invoice.amountResidual > 0 ? ( +
Belum Lunas
+ ) : ( +
Lunas
+ )} +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ +
+ + ))} + {transaction.data?.invoices?.length === 0 && ( +
Belum ada invoice
+ )} +
+
+ + + {!auth?.feature.soApproval && (
@@ -354,8 +394,20 @@ const Transaction = ({ id }) => {
Detail Produk
+ {transaction?.data?.products.length > 0? ( +
+ {memoizeVariantGroupCard} +
+ ) : ( +
Semua produk telah di reject
+ )} - {memoizeVariantGroupCard} + {transaction?.data?.productsRejectLine.length > 0 && ( +
+
Detail Produk Reject
+ {memoizeVariantGroupCardReject} +
+ )} @@ -363,37 +415,6 @@ const Transaction = ({ id }) => { -
-

Invoice

-
- {transaction.data?.invoices?.map((invoice, index) => ( - -
-
-

{invoice?.name}

-
- {invoice.amountResidual > 0 ? ( -
Belum Lunas
- ) : ( -
Lunas
- )} -

- {currencyFormat(invoice.amountTotal)} -

-
-
- -
- - ))} - {transaction.data?.invoices?.length === 0 && ( -
Belum ada invoice
- )} -
-
- - -
{transaction.data?.status == 'draft' && auth?.feature.soApproval && (
@@ -561,51 +582,83 @@ const Transaction = ({ id }) => { />
- -
- Pengiriman -
-
- {transaction?.data?.pickings?.map((airway) => ( - + ))} +
+
+
+
Invoice
+ {transaction.data?.invoices?.length === 0 && ( +
Belum ada invoice
+ )} +
+ {transaction.data?.invoices?.map((invoice, index) => ( + +
+
+

{invoice?.name}

+
+ {invoice.amountResidual > 0 ? ( +
Belum Lunas
+ ) : ( +
Lunas
+ )} +

+ {currencyFormat(invoice.amountTotal)} +

+
+
+ +
+ + ))}
- - ))} +
- {transaction?.data?.pickings.length == 0 && ( -
Belum ada pengiriman
- )} -
+
Rincian Pembelian
- - - - - {/* */} - - - - - - - + {transaction?.data?.products?.length > 0? ( +
Nama ProdukDiskonJumlahHargaSubtotal
+ + + + {/* */} + + + + + + + {transaction?.data?.products?.map((product) => ( )} - {/* {transaction.data.isReaject && ( - - )} */} ))}
Nama ProdukDiskonJumlahHargaSubtotal
@@ -668,21 +721,14 @@ const Transaction = ({ id }) => { - -
+ ) : ( +
Semua produk telah di reject
+ )} + {isModalOpen && (
Subtotal
@@ -738,33 +785,84 @@ const Transaction = ({ id }) => {
+ ))} -
Invoice
-
- {transaction.data?.invoices?.map((invoice, index) => ( - -
-
-

{invoice?.name}

-
- {invoice.amountResidual > 0 ? ( -
Belum Lunas
- ) : ( -
Lunas
- )} -

- {currencyFormat(invoice.amountTotal)} -

-
-
- -
- - ))} -
- {transaction.data?.invoices?.length === 0 && ( -
Belum ada invoice
+ + + {transaction?.data?.productsRejectLine.length > 0 && ( +
+ Rincian Produk Reject +
+ )} + {transaction?.data?.productsRejectLine.length > 0 && ( + + + + + {/* */} + + + + + + + {transaction?.data?.productsRejectLine?.map((product) => ( + + + {/* */} + + + + + ))} + +
Nama ProdukDiskonJumlahHargaSubtotal
+ + {product?.name} + +
+ + {product?.parent?.name} + +
+ {product?.code}{' '} + {product?.attributes.length > 0 + ? `| ${product?.attributes.join(', ')}` + : ''} +
+
+
+ {product.price.discountPercentage > 0 + ? `${product.price.discountPercentage}%` + : ''} + {product.quantity} + {/* {product.price.discountPercentage > 0 && ( +
+ {currencyFormat(product.price.price)} +
+ )} */} +
{currencyFormat(product.price.priceDiscount)}
+
{currencyFormat(product.quantity * product.price.priceDiscount)}
)} +
diff --git a/src/lib/variant/components/VariantCard.jsx b/src/lib/variant/components/VariantCard.jsx index c629c987..5d95ee70 100644 --- a/src/lib/variant/components/VariantCard.jsx +++ b/src/lib/variant/components/VariantCard.jsx @@ -122,7 +122,7 @@ const VariantCard = ({ product, openOnClick = true, buyMore = false }) => { - {buyMore && ( + {buyMore && (!transaction?.data?.productsRejectLine.some(pr => pr.id === product.id)) && (
{/* {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (transaction.data.isReaject == false) && ( */} {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (router.asPath.includes("/my/quotations/")) && ( - - - - )} - {/* {transaction.data.isReaject && ( - - - - )} */} + !transaction?.data?.productsRejectLine.some(pr => pr.id === product.id) && ( + + ) + )} {isModalOpen && (
{ const router = useRouter() -- cgit v1.2.3 From 91fae67a9fdece78f0d0fbf4230472577b6260c6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 11 Jul 2024 14:58:55 +0700 Subject: add key && update reject button by status quotation && add image reject --- src/lib/transaction/components/Transaction.jsx | 149 +++++++++++++------------ 1 file changed, 79 insertions(+), 70 deletions(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index 8e7cede0..b099ffa7 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -1,4 +1,6 @@ import Spinner from '@/core/components/elements/Spinner/Spinner'; +import NextImage from 'next/image'; +import rejectImage from "../../../../public/images/reject.png" import useTransaction from '../hooks/useTransaction'; import TransactionStatusBadge from './TransactionStatusBadge'; import Divider from '@/core/components/elements/Divider/Divider'; @@ -646,85 +648,85 @@ const Transaction = ({ id }) => {
Rincian Pembelian
- {transaction?.data?.products?.length > 0? ( - - - - - {/* */} - - - - - - - - {transaction?.data?.products?.map((product) => ( - - + {/* {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (transaction.data.isReaject == false) && ( */} + {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (router.asPath.includes("/my/quotations/")) && transaction.data?.status == 'draft' && ( + + )} + + ))} + +
Nama ProdukDiskonJumlahHargaSubtotal
- - {product?.name} - -
+ {transaction?.data?.products?.length > 0? ( + + + + + {/* */} + + + + + + + + {transaction?.data?.products?.map((product) => ( + + - {/* */} - - - - {/* {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (transaction.data.isReaject == false) && ( */} - {auth?.feature.soApproval && (auth.webRole == 2 || auth.webRole == 3) && (router.asPath.includes("/my/quotations/")) && ( + + {/* */} + - )} - - ))} - -
Nama ProdukDiskonJumlahHargaSubtotal
- {product?.parent?.name} + {product?.name} -
- {product?.code}{' '} - {product?.attributes.length > 0 - ? `| ${product?.attributes.join(', ')}` - : ''} -
- -
- {product.price.discountPercentage > 0 - ? `${product.price.discountPercentage}%` - : ''} - {product.quantity} - {/* {product.price.discountPercentage > 0 && ( -
- {currencyFormat(product.price.price)} +
+ + {product?.parent?.name} + +
+ {product?.code}{' '} + {product?.attributes.length > 0 + ? `| ${product?.attributes.join(', ')}` + : ''} +
- )} */} -
{currencyFormat(product.price.priceDiscount)}
-
{currencyFormat(product.price.subtotal)} + {product.price.discountPercentage > 0 + ? `${product.price.discountPercentage}%` + : ''} + {product.quantity} - + {/* {product.price.discountPercentage > 0 && ( +
+ {currencyFormat(product.price.price)} +
+ )} */} +
{currencyFormat(product.price.priceDiscount)}
+
{currencyFormat(product.price.subtotal)} + +
) : (
Semua produk telah di reject
)} @@ -856,13 +858,20 @@ const Transaction = ({ id }) => { )} */}
{currencyFormat(product.price.priceDiscount)}
- {currencyFormat(product.quantity * product.price.priceDiscount)} + + + ))} )} - +
-- cgit v1.2.3 From 44895db5a27a87e6f6f91d4d3fda33ff444f82f0 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 11 Jul 2024 15:21:10 +0700 Subject: marge conflik --- src/lib/checkout/components/Checkout.jsx | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 4355c7bd..3c2b8a09 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -1391,13 +1391,10 @@ const Checkout = () => {
Grand Total
-<<<<<<< HEAD {currencyFormat(grandTotal)} -======= {currencyFormat( cartCheckout?.grandTotal + finalShippingAmt )} ->>>>>>> dev/voucher-shipment
)} -- cgit v1.2.3 From 1b9aeada3b663128f7c221342143cdb687b6e71f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 11 Jul 2024 15:26:16 +0700 Subject: add key on map --- src/lib/transaction/components/Transaction.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index b099ffa7..97b8a507 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -762,7 +762,7 @@ const Transaction = ({ id }) => { )} {transaction?.data?.products?.map((product) => ( -
+
Subtotal
-- cgit v1.2.3 From 721067120c2756554829070b3fa10de7f04ae705 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 12 Jul 2024 11:34:23 +0700 Subject: update input note --- src/lib/quotation/components/Quotation.jsx | 35 ++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'src/lib') diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index 8855c6c4..19419f61 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -67,17 +67,19 @@ const Quotation = () => { const [selectedExpedisiService, setselectedExpedisiService] = useState(null); const [etd, setEtd] = useState(null); const [etdFix, setEtdFix] = useState(null); - + const [isApproval, setIsApproval] = useState(false); - + const expedisiValidation = useRef(null); - + const [selectedAddress, setSelectedAddress] = useState({ shipping: null, invoicing: null, }); - + const [addresses, setAddresses] = useState(null); + + const [note_websiteText, setselectedNote_websiteText] = useState(null); useEffect(() => { if (!auth) return; @@ -262,6 +264,12 @@ const Quotation = () => { } if (!products || products.length == 0) return; + + if (auth?.feature?.soApproval && !note_websiteText.trim()) { + toast.error('Note harus diisi karena fitur soApproval aktif.'); + return; + } + setIsLoading(true); const productOrder = products.map((product) => ({ product_id: product.id, @@ -276,6 +284,7 @@ const Quotation = () => { carrier_id: selectedCarrierId, estimated_arrival_days: splitDuration(etd), delivery_service_type: selectedExpedisiService, + note_website : note_websiteText, }; console.log('data checkout', data); const isSuccess = await checkoutApi({ data }); @@ -291,6 +300,8 @@ const Quotation = () => { const taxTotal = (totalAmount - totalDiscountAmount) * 0.11; + console.log("note_websiteText",note_websiteText) + return ( <> @@ -576,6 +587,22 @@ const Quotation = () => { yang berlaku

+
+
+ +
+
Note
+
+