diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-10 14:43:40 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-10 14:43:40 +0700 |
| commit | 98910cc03fe1c4779396a5e376184c5d4f5b86b4 (patch) | |
| tree | 83ee6ec197373c220af131a0a7dc0fee5481ec01 /src/lib | |
| parent | 9c2c365da1edb2e2835d19303cdee81e53f3deb8 (diff) | |
| parent | 20dd2a819be9c7bdb0571222705bec8b90e1e4b1 (diff) | |
Merge branch 'master' of bitbucket.org:altafixco/next-indoteknik
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cart/components/Cart.jsx | 6 | ||||
| -rw-r--r-- | src/lib/checkout/components/Checkout.jsx | 10 | ||||
| -rw-r--r-- | src/lib/product/components/Product/ProductDesktop.jsx | 173 | ||||
| -rw-r--r-- | src/lib/quotation/components/Quotation.jsx | 2 | ||||
| -rw-r--r-- | src/lib/transaction/components/Transaction.jsx | 2 |
5 files changed, 110 insertions, 83 deletions
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx index 49fa46e6..e2173268 100644 --- a/src/lib/cart/components/Cart.jsx +++ b/src/lib/cart/components/Cart.jsx @@ -164,7 +164,7 @@ const Cart = () => { <MobileView> <div className='pt-4'> <div className='flex justify-between mb-4 px-4'> - <h1 className='font-semibold'>Daftar Produk Belanja</h1> + <h1 className='font-semibold'>Keranjang</h1> <Link href='/'>Cari Produk Lain</Link> </div> @@ -301,7 +301,7 @@ const Cart = () => { <DesktopView> <div className='container mx-auto py-10 grid grid-cols-12'> <div className='col-span-9 border border-gray_r-6 rounded bg-white p-4 pt-6'> - <h1 className='text-title-sm font-semibold mb-6'>Daftar Produk Belanja</h1> + <h1 className='text-title-sm font-semibold mb-6'>Keranjang</h1> <table className='table-cart'> <thead> @@ -424,7 +424,7 @@ const Cart = () => { height={60} /> <div className='text-gray_r-12/90'> - Tanya stock untuk pembelian anda sebelum melanjutkan pembayaran! + Tanya stock untuk pembelian anda sebelum melanjutkan pembayaran!<span> <a href='https://wa.me/628128080622' className='text-danger-500'>Hubungi Kami</a></span> </div> </div> </div> diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 37a67d88..96f2f161 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -202,7 +202,7 @@ const Checkout = () => { {currencyFormat(totalAmount - totalDiscountAmount + taxTotal)} </div> </div> - <p className='text-caption-2 text-gray_r-10 mb-2'>*) Belum termasuk biaya pengiriman</p> + {/* <p className='text-caption-2 text-gray_r-10 mb-2'>*) Belum termasuk biaya pengiriman</p> */} <p className='text-caption-2 text-gray_r-10 leading-5'> Dengan melakukan pembelian melalui website Indoteknik, saya menyetujui{' '} <Link href='/' className='inline font-normal'> @@ -325,7 +325,7 @@ const Checkout = () => { </div> <div className='w-1/4 pl-4'> - <div className='border border-gray_r-6 bg-white rounded p-4'> + <div className='sticky top-48 border border-gray_r-6 bg-white rounded p-4'> <div className='flex justify-between items-center'> <div className='font-medium'>Ringkasan Pesanan</div> <div className='text-gray_r-11 text-caption-1'>{products?.length} Barang</div> @@ -360,9 +360,6 @@ const Checkout = () => { {currencyFormat(totalAmount - totalDiscountAmount + taxTotal)} </div> </div> - <p className='text-caption-2 text-gray_r-11 mb-2'> - *) Belum termasuk biaya pengiriman - </p> <p className='text-caption-2 text-gray_r-11 leading-5'> Dengan melakukan pembelian melalui website Indoteknik, saya menyetujui{' '} <Link href='/' className='inline font-normal'> @@ -447,6 +444,9 @@ const PickupAddress = ({ label }) => ( </p> <p className='mt-1 text-gray_r-11'>Telp : 021-2933 8828/29</p> <p className='mt-1 text-gray_r-11'>Mobile : 0813 9000 7430</p> + <p className='mt-5 text-caption-2 text-gray_r-11 mb-2'> + *) Belum termasuk biaya pengiriman + </p> </div> </div> ) diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 37a258a6..751c0014 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -161,14 +161,38 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { </span> )} </h3> - - <button - type='button' - onClick={goToVariantSection} - className='btn-solid-red w-full mt-6' - > - Lihat Varian - </button> + {product.variants.length > 1 ? ( + <button + type='button' + onClick={goToVariantSection} + className='btn-solid-red w-full mt-6' + > + Lihat Varian + </button> + ) : ( + <td className='flex gap-x-3 mt-4'> + <input + type='number' + className='form-input w-16 py-2 text-center bg-gray_r-1' + ref={setVariantQuantityRef(product.variants[0].id)} + defaultValue={1} + /> + <button + type='button' + onClick={() => handleAddToCart(product.variants[0].id)} + className='flex-1 py-2 btn-yellow' + > + Keranjang + </button> + <button + type='button' + onClick={() => handleBuy(product.variants[0].id)} + className='flex-1 py-2 btn-solid-red' + > + Beli + </button> + </td> + )} <div className='flex mt-4'> <button className='flex items-center gap-x-1' onClick={toggleWishlist}> @@ -183,73 +207,76 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { </div> </div> - <div className='mt-12' ref={variantSectionRef}> - <div className='text-h-lg font-semibold mb-6'>Varian Produk</div> - <div className='table-specification'> - <table> - <thead> - <tr> - <th>Part Number</th> - <th>Varian</th> - <th>Harga</th> - <th>Jumlah</th> - <th>Action</th> - </tr> - </thead> - <tbody> - {product.variants.map((variant) => ( - <tr key={variant.id}> - <td>{variant.code}</td> - <td>{variant.attributes.join(', ') || '-'}</td> - <td> - {variant.price.discountPercentage > 0 && variant.price.priceDiscount > 0 && ( - <> - <div className='line-through text-caption-1 text-gray_r-11 mb-1'> - {currencyFormat(variant.price.price)} - </div>{' '} - </> - )} - <div> - {variant.price.priceDiscount > 0 ? ( - currencyFormat(variant.price.priceDiscount) - ) : ( - <a href='https://wa.me/' className='text-danger-500'> - Call for price - </a> - )} - </div> - {/* <VariantPrice id={variant.id} /> */} - </td> - <td> - <input - type='number' - className='form-input w-16 py-2 text-center bg-gray_r-1' - ref={setVariantQuantityRef(variant.id)} - defaultValue={1} - /> - </td> - <td className='flex gap-x-3'> - <button - type='button' - onClick={() => handleAddToCart(variant.id)} - className='flex-1 py-2 btn-yellow' - > - Keranjang - </button> - <button - type='button' - onClick={() => handleBuy(variant.id)} - className='flex-1 py-2 btn-solid-red' - > - Beli - </button> - </td> + {product.variants.length > 1 && ( + <div className='mt-12' ref={variantSectionRef}> + <div className='text-h-lg font-semibold mb-6'>Varian Produk</div> + <div className='table-specification'> + <table> + <thead> + <tr> + <th>Part Number</th> + <th>Varian</th> + <th>Harga</th> + <th>Jumlah</th> + <th>Action</th> </tr> - ))} - </tbody> - </table> + </thead> + <tbody> + {product.variants.map((variant) => ( + <tr key={variant.id}> + <td>{variant.code}</td> + <td>{variant.attributes.join(', ') || '-'}</td> + <td> + {variant.price.discountPercentage > 0 && + variant.price.priceDiscount > 0 && ( + <> + <div className='line-through text-caption-1 text-gray_r-11 mb-1'> + {currencyFormat(variant.price.price)} + </div>{' '} + </> + )} + <div> + {variant.price.priceDiscount > 0 ? ( + currencyFormat(variant.price.priceDiscount) + ) : ( + <a href='https://wa.me/' className='text-red_r-11'> + Call for price + </a> + )} + </div> + {/* <VariantPrice id={variant.id} /> */} + </td> + <td> + <input + type='number' + className='form-input w-16 py-2 text-center bg-gray_r-1' + ref={setVariantQuantityRef(variant.id)} + defaultValue={1} + /> + </td> + <td className='flex gap-x-3'> + <button + type='button' + onClick={() => handleAddToCart(variant.id)} + className='flex-1 py-2 btn-yellow' + > + Keranjang + </button> + <button + type='button' + onClick={() => handleBuy(variant.id)} + className='flex-1 py-2 btn-solid-red' + > + Beli + </button> + </td> + </tr> + ))} + </tbody> + </table> + </div> </div> - </div> + )} <div className='mt-12'> <div className='text-h-lg font-semibold'>Informasi Produk</div> diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx index e233efd1..a68889f5 100644 --- a/src/lib/quotation/components/Quotation.jsx +++ b/src/lib/quotation/components/Quotation.jsx @@ -237,7 +237,7 @@ const Quotation = () => { </div> <div className='w-1/4 pl-4'> - <div className='border border-gray_r-6 bg-white rounded p-4'> + <div className='sticky top-48 border border-gray_r-6 bg-white rounded p-4'> <div className='flex justify-between items-center'> <div className='font-medium'>Ringkasan Pesanan</div> <div className='text-gray_r-11 text-caption-1'>{products?.length} Barang</div> diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index a0455c27..ad59f8dd 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -295,7 +295,7 @@ const Transaction = ({ id }) => { <button type='button' className='btn-solid-red px-3 py-2' - disabled={transaction.data?.status != 'draft'} + // disabled={transaction.data?.status != 'draft'} onClick={() => downloadQuotation(transaction.data)} > Download |
