diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-05-12 09:56:26 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-05-12 09:56:26 +0700 |
| commit | b20c603a856d8875e0e2b3a16fd925d997fd16d3 (patch) | |
| tree | fa587aefc21a1da1987996076cea6bf97d53482b /src/lib/checkout/components | |
| parent | 93663539deeb5ad487a383c741248c14f999a442 (diff) | |
checkout
Diffstat (limited to 'src/lib/checkout/components')
| -rw-r--r-- | src/lib/checkout/components/Checkout.jsx | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index effe5ec2..b51c9b34 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -142,8 +142,9 @@ const Checkout = () => { setBiayaKirim(0) const dataService = await axios('/api/rajaongkir-service?body=' + JSON.stringify(body)) setListServiceExpedisi(dataService.data[0].costs) + setBiayaKirim(dataService.data[0].costs[0].cost[0].value) } - if (selectedExpedisi != 0 && totalWeight > 0) { + if (selectedExpedisi != 0 && selectedExpedisi != 1 && totalWeight > 0) { loadServiceRajaOngkir() } else { setListServiceExpedisi() @@ -335,7 +336,7 @@ const Checkout = () => { <button className='flex-1 btn-yellow' onClick={checkout} - disabled={isLoading || !products || products?.length == 0 || priceCheck} + disabled={isLoading || !products || products?.length == 0 || priceCheck || selectedExpedisi == 0} > {isLoading ? 'Loading...' : 'Lanjut Pembayaran'} </button> @@ -386,7 +387,6 @@ const Checkout = () => { <div className='font-medium'>Service Type Expedisi : </div> <div> <select className='form-input' onChange={(e) => setBiayaKirim(e.target.value)}> - <option value=''>Service Type</option> {listserviceExpedisi.map((service) => ( <option value={service.cost[0].value} key={service.service}> {' '} @@ -562,7 +562,7 @@ const Checkout = () => { <button className='w-full btn-yellow mt-4' onClick={checkout} - disabled={isLoading || !products || products?.length == 0 || priceCheck} + disabled={isLoading || !products || products?.length == 0 || priceCheck || selectedExpedisi == 0} > {isLoading ? 'Loading...' : 'Lanjut Pembayaran'} </button> @@ -622,38 +622,20 @@ const SectionValidation = ({ address, checkWeigth }) => ( </div> </div> </div> - ), - checkWeigth == true && ( - <div className='p-4'> - <div className='flex justify-between items-center'> - <div> - <p className='mt-2 text-gray_r-11'> - Ada item barang yang belum di setting berat nya, silahkan hub admin di{' '} - <span> - <a - className='text-danger-500' - href='https://api.whatsapp.com/send?phone=628128080622' - > - Link InI ! - </a> - </span> - </p> - </div> - </div> - </div> ) ) const SectionExpedisi = ({ address, listExpedisi, setSelectedExpedisi, checkWeigth }) => - (address?.rajaongkirCityId > 0 && checkWeigth != true) && ( + address?.rajaongkirCityId > 0 && ( <div className='p-4'> <div className='flex justify-between items-center'> <div className='font-medium'>Pilih Expedisi : </div> <div> <select className='form-input' onChange={(e) => setSelectedExpedisi(e.target.value)}> <option value=''>Pengiriman</option> + <option value='1'>SELF PICKUP</option> {listExpedisi.map((expedisi) => ( - <option value={expedisi.label} key={expedisi.value}> + <option disabled={checkWeigth} value={expedisi.label} key={expedisi.value}> {' '} {expedisi.label.toUpperCase()}{' '} </option> @@ -661,6 +643,19 @@ const SectionExpedisi = ({ address, listExpedisi, setSelectedExpedisi, checkWeig </select> </div> </div> + {checkWeigth == true && ( + <p className='mt-2 text-gray_r-11'> + Opsi pengiriman hanya ada self pickup, , silahkan hub admin di{' '} + <span> + <a + className='text-danger-500' + href='https://api.whatsapp.com/send?phone=628128080622' + > + Link InI ! + </a> + </span> + </p> + )} </div> ) const PickupAddress = ({ label }) => ( |
