summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2024-03-01 09:20:11 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2024-03-01 09:20:11 +0700
commit65377952fbd0721ce1550c42384d723ccd7b9b1a (patch)
treebd3d0e7546ec89a1c1c8e0c1889240a92d1e01c3
parent756f93807a33bb1398931ae894b071504dfec3b8 (diff)
generate recomendation
-rw-r--r--src/core/components/elements/Navbar/NavbarUserDropdown.jsx5
-rw-r--r--src/pages/my/recomendation/api/recomendation.js8
-rw-r--r--src/pages/my/recomendation/components/products-recomendatison.jsx65
-rw-r--r--src/pages/my/recomendation/index.jsx26
4 files changed, 104 insertions, 0 deletions
diff --git a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx
index 1851ce84..42bdc12a 100644
--- a/src/core/components/elements/Navbar/NavbarUserDropdown.jsx
+++ b/src/core/components/elements/Navbar/NavbarUserDropdown.jsx
@@ -2,9 +2,11 @@ import { deleteAuth } from '@/core/utils/auth'
import Link from '../Link/Link'
import { useRouter } from 'next/router'
import { signOut, useSession } from 'next-auth/react'
+import useAuth from '@/core/hooks/useAuth'
const NavbarUserDropdown = () => {
const router = useRouter()
+ const atuh = useAuth()
const logout = async () => {
deleteAuth().then(() => {
@@ -21,6 +23,9 @@ const NavbarUserDropdown = () => {
<Link href='/my/invoices'>Invoice & Faktur Pajak</Link>
<Link href='/my/wishlist'>Wishlist</Link>
<Link href='/my/address'>Daftar Alamat</Link>
+ {!atuh?.external &&
+ <Link href='/my/recomendation'>Dashboard Recomendation</Link>
+ }
<button type='button' onClick={logout}>
Keluar Akun
</button>
diff --git a/src/pages/my/recomendation/api/recomendation.js b/src/pages/my/recomendation/api/recomendation.js
new file mode 100644
index 00000000..47ed743a
--- /dev/null
+++ b/src/pages/my/recomendation/api/recomendation.js
@@ -0,0 +1,8 @@
+import axios from "axios"
+
+const GenerateRecomendations = async ({query}) => {
+ const GenerateRecomendationProducts = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/recomendation?${query}`)
+
+ return GenerateRecomendationProducts
+}
+export default GenerateRecomendations \ No newline at end of file
diff --git a/src/pages/my/recomendation/components/products-recomendatison.jsx b/src/pages/my/recomendation/components/products-recomendatison.jsx
new file mode 100644
index 00000000..9438eb46
--- /dev/null
+++ b/src/pages/my/recomendation/components/products-recomendatison.jsx
@@ -0,0 +1,65 @@
+import Menu from '@/lib/auth/components/Menu';
+import { cons } from 'lodash-contrib';
+
+const ProductsRecomendation = ({ id }) => {
+ const handleSubmit = () => {}
+ const handleFileChange = () => {}
+ return (
+ <div className='container mx-auto flex py-10'>
+ <div className='w-3/12 pr-4'>
+ <Menu />
+ </div>
+ <div className='w-9/12 p-4 bg-white border border-gray_r-6 rounded'>
+ <div className='flex mb-6 items-center justify-between'>
+ <h1 className='text-title-sm font-semibold'>
+ Generate Recomendation
+ </h1>
+ </div>
+ <div className='group'>
+ <h1 className='text-sm font-semibold'>Contoh Excel</h1>
+ <table className='table-data'>
+ <thead>
+ <tr>
+ <th>Product</th>
+ <th>Qty</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Tekiro Long Nose Pliers Tang Lancip</td>
+ <td>10</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div className='container mx-auto mt-8'>
+ <form onSubmit={handleSubmit} >
+ <div className='mb-4'>
+ <label
+ htmlFor='excelFile'
+ className='text-sm font-semibold'
+ >
+ Upload Excel File (.xlsx)
+ </label>
+ <input
+ type='file'
+ id='excelFile'
+ accept='.xlsx'
+ onChange={handleFileChange}
+ className='mt-1 p-2 block w-full border border-gray-300 rounded-md focus:outline-none focus:border-blue-500'
+ />
+ </div>
+ <button
+ type='submit'
+ className='bg-blue-500 text-white py-2 px-4 rounded-md hover:bg-blue-600'
+ >
+ Generate
+ </button>
+ </form>
+ </div>
+ </div>
+ </div>
+ );
+};
+
+export default ProductsRecomendation;
diff --git a/src/pages/my/recomendation/index.jsx b/src/pages/my/recomendation/index.jsx
new file mode 100644
index 00000000..684b30c2
--- /dev/null
+++ b/src/pages/my/recomendation/index.jsx
@@ -0,0 +1,26 @@
+import DesktopView from '@/core/components/views/DesktopView';
+import MobileView from '@/core/components/views/MobileView';
+import IsAuth from '../../../lib/auth/components/IsAuth';
+import AppLayout from '@/core/components/layouts/AppLayout';
+import BasicLayout from '@/core/components/layouts/BasicLayout';
+import dynamic from 'next/dynamic';
+import Seo from '@/core/components/Seo'
+
+const ProductsRecomendation = dynamic(() => import('./components/products-recomendatison'))
+export default function MyRecomendation() {
+ return (
+ <IsAuth>
+
+ <Seo title='Dashboard Rekomendasi - Indoteknik.com' />
+
+ <MobileView>
+ <AppLayout></AppLayout>
+ </MobileView>
+ <DesktopView>
+ <BasicLayout>
+ <ProductsRecomendation />
+ </BasicLayout>
+ </DesktopView>
+ </IsAuth>
+ );
+}