diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-04 17:00:51 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-04 17:00:51 +0700 |
| commit | bd65a11a9f6ed0589ccdf86745abbf12b17816e9 (patch) | |
| tree | 588dee98beb3cd17a41932d52b9f6c3ccfc4ed1d | |
| parent | de3c0915c6167264982af981399b728134ae7d1a (diff) | |
forgot password
| -rw-r--r-- | src/core/components/elements/Link/Link.jsx | 3 | ||||
| -rw-r--r-- | src/lib/auth/components/Activate.jsx | 2 | ||||
| -rw-r--r-- | src/lib/auth/components/LoginDesktop.jsx | 5 | ||||
| -rw-r--r-- | src/lib/auth/components/LoginMobile.jsx | 5 | ||||
| -rw-r--r-- | src/lib/checkout/components/Checkout.jsx | 34 | ||||
| -rw-r--r-- | src/lib/transaction/components/Transaction.jsx | 14 | ||||
| -rw-r--r-- | src/pages/api/shop/search.js | 8 | ||||
| -rw-r--r-- | src/pages/forgot-password.jsx | 64 |
8 files changed, 91 insertions, 44 deletions
diff --git a/src/core/components/elements/Link/Link.jsx b/src/core/components/elements/Link/Link.jsx index 557abbc4..05859639 100644 --- a/src/core/components/elements/Link/Link.jsx +++ b/src/core/components/elements/Link/Link.jsx @@ -6,13 +6,12 @@ const Link = ({ children, ...props }) => { const router = useRouter() useEffect(() => { - router.events.on('routeChangeStart', () => window.scrollTo({ top: 0, behavior: 'smooth' })) + router.events.on('routeChangeComplete', () => window.scrollTo({ top: 0, behavior: 'smooth' })) }, [router]) return ( <NextLink {...props} - // onClick={() => window.scrollTo({ top: 0, behavior: 'smooth' })} scroll={false} className={`block font-medium text-red_r-11 ${props?.className || ''}`} > diff --git a/src/lib/auth/components/Activate.jsx b/src/lib/auth/components/Activate.jsx index 8fdc1096..5e95de8a 100644 --- a/src/lib/auth/components/Activate.jsx +++ b/src/lib/auth/components/Activate.jsx @@ -127,7 +127,7 @@ const Activate = () => { /> </Link> - <h1 className='text-2xl mt-4 font-semibold'>Aktivasi Akun Indoteknik</h1> + <h1 className='text-2xl mt-4 font-semibold text-center'>Aktivasi Akun Indoteknik</h1> {alert && ( <Alert diff --git a/src/lib/auth/components/LoginDesktop.jsx b/src/lib/auth/components/LoginDesktop.jsx index 7b71b9a6..8ce2e4e3 100644 --- a/src/lib/auth/components/LoginDesktop.jsx +++ b/src/lib/auth/components/LoginDesktop.jsx @@ -38,7 +38,10 @@ const LoginDesktop = () => { /> </div> <div> - <label htmlFor='password'>Kata Sandi</label> + <div className='flex justify-between'> + <label htmlFor='password'>Kata Sandi</label> + <Link href='/forgot-password'>Lupa Kata Sandi</Link> + </div> <input type='password' name='password' diff --git a/src/lib/auth/components/LoginMobile.jsx b/src/lib/auth/components/LoginMobile.jsx index 78584a1c..b365330b 100644 --- a/src/lib/auth/components/LoginMobile.jsx +++ b/src/lib/auth/components/LoginMobile.jsx @@ -38,7 +38,10 @@ const LoginMobile = () => { /> </div> <div> - <label htmlFor='password'>Kata Sandi</label> + <div className='flex justify-between'> + <label htmlFor='password'>Kata Sandi</label> + <Link href='/forgot-password'>Lupa Kata Sandi</Link> + </div> <input type='password' name='password' diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx index 71f47a30..c9e0556b 100644 --- a/src/lib/checkout/components/Checkout.jsx +++ b/src/lib/checkout/components/Checkout.jsx @@ -161,11 +161,7 @@ const Checkout = () => { <Divider /> - <SectionAddress - label='Alamat Pengiriman' - url='/my/address?select=shipping' - address={selectedAddress.shipping} - /> + <PickupAddress label='Alamat Pickup' /> <Divider /> @@ -195,7 +191,7 @@ const Checkout = () => { <div>{currencyFormat(totalAmount - totalDiscountAmount)}</div> </div> <div className='flex gap-x-2 justify-between'> - <div className='text-gray_r-11'>PPN 11% (Incl.)</div> + <div className='text-gray_r-11'>PPN 11%</div> <div>{currencyFormat(taxTotal)}</div> </div> </div> @@ -218,14 +214,6 @@ const Checkout = () => { <Divider /> - <SectionAddress - label='Alamat Penagihan' - url='/my/address?select=invoicing' - address={selectedAddress.invoicing} - /> - - <Divider /> - <div className='p-4'> <div className='font-medium'>Purchase Order</div> @@ -263,14 +251,6 @@ const Checkout = () => { <DesktopView> <div className='container mx-auto py-10 flex'> <div className='w-3/4 border border-gray_r-6 rounded bg-white'> - {/* <SectionAddress - label='Alamat Pengiriman' - url='/my/address?select=shipping' - address={selectedAddress.shipping} - /> */} - - <Divider /> - <PickupAddress label='Alamat Pickup' /> <Divider /> @@ -454,18 +434,16 @@ const SectionAddress = ({ address, label, url }) => ( )} </div> ) -const PickupAddress = ({ address, label, url }) => ( +const PickupAddress = ({ label }) => ( <div className='p-4'> <div className='flex justify-between items-center'> <div className='font-medium'>{label}</div> </div> <div className='mt-4 text-caption-1'> <p className='font-medium'>Indoteknik</p> - <p className='mt-2 text-gray_r-11'> - Jl. Bandengan Utara Raya No.85, RT.3/RW.16, Penjaringan, Kec. Penjaringan, - </p> - <p className='mt-1 text-gray_r-11'> - Kota Jkt Utara, Daerah Khusus Ibukota Jakarta, Indonesia Kodepos : 14440 + <p className='mt-2 mb-2 text-gray_r-11 leading-6'> + Jl. Bandengan Utara Raya No.85, RT.3/RW.16, Penjaringan, Kec. Penjaringan, Kota Jkt Utara, + Daerah Khusus Ibukota Jakarta, Indonesia Kodepos : 14440 </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> diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx index e992580a..c8956d80 100644 --- a/src/lib/transaction/components/Transaction.jsx +++ b/src/lib/transaction/components/Transaction.jsx @@ -108,7 +108,7 @@ const Transaction = ({ id }) => { <p>{currencyFormat(transaction.data?.amountTax)}</p> </div> <div className='flex justify-between mt-1 font-medium'> - <p>Total Belanja</p> + <p>Grand Total</p> <p>{currencyFormat(transaction.data?.amountTotal)}</p> </div> </div> @@ -331,20 +331,20 @@ const Transaction = ({ id }) => { </div> </div> - <div className='text-h-sm font-semibold mt-6 mb-4'>Info Pengiriman</div> - <div className='grid grid-cols-3 gap-x-4'> + <div className='text-h-sm font-semibold mt-6 mb-4'>Informasi Pelanggan</div> + <div className='grid grid-cols-2 gap-x-4'> <div className='border border-gray_r-6 rounded p-3'> <div className='font-medium mb-4'>Detail Pelanggan</div> <SectionContent address={transaction?.data?.address?.customer} /> </div> - <div className='border border-gray_r-6 rounded p-3'> + {/* <div className='border border-gray_r-6 rounded p-3'> <div className='font-medium mb-4'>Detail Pengiriman</div> <SectionContent address={transaction?.data?.address?.shipping} /> </div> <div className='border border-gray_r-6 rounded p-3'> <div className='font-medium mb-4'>Detail Penagihan</div> <SectionContent address={transaction?.data?.address?.invoice} /> - </div> + </div> */} </div> <div className='text-h-sm font-semibold mt-6 mb-4'>Rincian Pembelian</div> @@ -508,7 +508,7 @@ const SectionAddress = ({ address }) => { {section.customer && <SectionContent address={address?.customer} />} - <Divider /> + {/* <Divider /> <SectionButton label='Detail Pengiriman' @@ -525,7 +525,7 @@ const SectionAddress = ({ address }) => { active={section.invoice} toggle={() => toggleSection('invoice')} /> - {section.invoice && <SectionContent address={address?.invoice} />} + {section.invoice && <SectionContent address={address?.invoice} />} */} </> ) } diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index e174b06f..7be8b2c0 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -69,8 +69,8 @@ export default async function handler(req, res) { let limit = 30 let offset = (page - 1) * limit let parameter = [ - 'facet.field=manufacture_name_s', - 'facet.field=category_name_s', + 'facet.field=manufacture_name', + 'facet.field=category_name', 'facet=true', 'indent=true', `facet.query=${q}`, @@ -82,8 +82,8 @@ export default async function handler(req, res) { `fq=price_discount_f:[${priceFrom == '' ? '*' : priceFrom} TO ${priceTo == '' ? '*' : priceTo}]` ] - if (brand) parameter.push(`fq=manufacture_name_s:${brand}`) - if (category) parameter.push(`fq=category_name_s:${category}`) + if (brand) parameter.push(`fq=manufacture_name:${brand}`) + if (category) parameter.push(`fq=category_name:${category}`) // Single fq in url params if (typeof fq === 'string') parameter.push(`fq=${fq}`) diff --git a/src/pages/forgot-password.jsx b/src/pages/forgot-password.jsx new file mode 100644 index 00000000..eb5c5185 --- /dev/null +++ b/src/pages/forgot-password.jsx @@ -0,0 +1,64 @@ +import Alert from '@/core/components/elements/Alert/Alert' +import SimpleFooter from '@/core/components/elements/Footer/SimpleFooter' +import Link from '@/core/components/elements/Link/Link' +import BasicLayout from '@/core/components/layouts/BasicLayout' +import MobileView from '@/core/components/views/MobileView' +import IndoteknikLogo from '@/images/logo.png' +import Image from 'next/image' +import { useRouter } from 'next/router' +import { useState } from 'react' + +export default function ForgotPassword() { + const router = useRouter() + const { token } = router.query + + const [isLoading, setIsLoading] = useState(false) + const [alert, setAlert] = useState() + + const [email, setEmail] = useState(router.query?.email || '') + + const forgotPasswordRequest = () => {} + + return ( + <> + <MobileView> + <div className='p-6 pt-10 flex flex-col items-center min-h-screen'> + <Link href='/'> + <Image src={IndoteknikLogo} alt='Logo Indoteknik' width={150} height={50} /> + </Link> + + <h1 className='text-2xl mt-4 font-semibold text-center'> + Lupa Kata Sandi Akun Indoteknik + </h1> + + {alert && ( + <Alert className='text-center mt-4' type={alert.type}> + {alert.children} + </Alert> + )} + + <form onSubmit={forgotPasswordRequest} className='mt-6 w-full'> + <input + type='email' + id='email' + className='form-input w-full text-center' + value={email} + onChange={(e) => setEmail(e.target.value)} + placeholder='Masukan alamat email' + autoFocus + /> + <button + type='submit' + disabled={email != ''} + className='btn-yellow font-semibold mt-4 w-full' + > + {isLoading ? 'Loading...' : 'Kirim Permintaan'} + </button> + </form> + </div> + + <SimpleFooter /> + </MobileView> + </> + ) +} |
