From 65377952fbd0721ce1550c42384d723ccd7b9b1a Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Fri, 1 Mar 2024 09:20:11 +0700 Subject: generate recomendation --- .../components/products-recomendatison.jsx | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/pages/my/recomendation/components/products-recomendatison.jsx (limited to 'src/pages/my/recomendation/components') 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 ( +
+
+ +
+
+
+

+ Generate Recomendation +

+
+
+

Contoh Excel

+ + + + + + + + + + + + + +
ProductQty
Tekiro Long Nose Pliers Tang Lancip10
+
+
+
+
+ + +
+ +
+
+
+
+ ); +}; + +export default ProductsRecomendation; -- cgit v1.2.3 From d0d38a82bb3d368632243ffb1cd317bb41cb13a3 Mon Sep 17 00:00:00 2001 From: "HATEC\\SPVDEV001" Date: Wed, 6 Mar 2024 11:01:09 +0700 Subject: import excel --- .../components/products-recomendatison.jsx | 36 +++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/pages/my/recomendation/components') diff --git a/src/pages/my/recomendation/components/products-recomendatison.jsx b/src/pages/my/recomendation/components/products-recomendatison.jsx index 9438eb46..c20aaa5b 100644 --- a/src/pages/my/recomendation/components/products-recomendatison.jsx +++ b/src/pages/my/recomendation/components/products-recomendatison.jsx @@ -1,9 +1,32 @@ import Menu from '@/lib/auth/components/Menu'; -import { cons } from 'lodash-contrib'; +import { useState } from 'react'; +import * as XLSX from 'xlsx'; const ProductsRecomendation = ({ id }) => { - const handleSubmit = () => {} - const handleFileChange = () => {} + const [excelData, setExcelData] = useState(null); + + const handleSubmit = (e) => { + e.preventDefault(); + if (excelData) { + // Lakukan operasi pencarian atau operasi lainnya di sini + console.log('ini data excel',excelData); // Contoh: Menampilkan data excel ke konsol + } else { + console.log('No excel data available'); + } + }; + const handleFileChange = (e) => { + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = (event) => { + const data = new Uint8Array(event.target.result); + const workbook = XLSX.read(data, { type: 'array' }); + const sheetName = workbook.SheetNames[0]; + const sheet = workbook.Sheets[sheetName]; + const jsonData = XLSX.utils.sheet_to_json(sheet, { header: 1, range: 1 }); + setExcelData(jsonData); + }; + reader.readAsArrayBuffer(file); + }; return (
@@ -33,12 +56,9 @@ const ProductsRecomendation = ({ id }) => {
-
+
-