Compare commits

..
172 Commits
Author SHA1 Message Date
efrilm 2641175e04 query key purchase order 2026-04-13 15:17:46 +07:00
efrilm c78b32d7b8 fix purchase request 2026-04-13 15:03:29 +07:00
Efril e8609a0ab9 fix report 2026-02-26 20:50:12 +07:00
Efril b22f400534 fix report 2026-02-26 20:36:02 +07:00
Efril b506d97c06 update report add service charger 2026-02-26 14:37:53 +07:00
Efril a3dd214a99 update report add standard hpp, realisasi hpp, dan status 2026-02-26 14:02:04 +07:00
efrilm 3c13aa897c add filter order 2026-01-30 17:22:18 +07:00
efrilm f4783236d2 fix order 2026-01-30 12:53:19 +07:00
efrilm 67ebb2ebd7 add excel pdf 2025-12-23 14:46:16 +07:00
efrilm de32d86e94 update daily report 2025-12-23 13:44:50 +07:00
efrilm 3cf7799a91 discount 2025-12-23 13:26:32 +07:00
efrilm 37de68879c update version 2025-12-10 11:22:47 +07:00
efrilm 80bab20f89 update docker 2025-11-26 01:15:10 +07:00
efrilm 6b46f9070a update docker 2025-11-26 01:14:32 +07:00
efrilm c5cda37efb updateclear 2025-11-25 21:45:53 +07:00
efrilm 2897436c5f update report 2025-11-25 21:39:40 +07:00
efrilm fe4176621c remove 2025-11-25 18:43:12 +07:00
efrilm 16deaf1890 add grafik at report 2025-11-25 18:15:18 +07:00
efrilm f434373eaf update report 2025-11-25 15:45:53 +07:00
efrilm 8e4ab5dd69 update report 2025-11-25 15:29:28 +07:00
efrilm 5f65211432 base url 2025-10-09 20:02:49 +07:00
efrilm ead773982a update report 2025-10-09 20:02:32 +07:00
efrilm aae1d49721 update report 2025-10-09 19:10:45 +07:00
efrilm 347d00271b base url 2025-10-07 14:35:11 +07:00
efrilm ac2fc4e920 category order 2025-10-07 00:01:53 +07:00
efrilm e551ae7feb update report 2025-10-06 17:05:11 +07:00
efrilm d059f31eaa update report 2025-10-04 17:17:50 +07:00
efrilm f1cf351ca4 Format Currency 2025-09-27 18:36:47 +07:00
Aditya Siregar 801fcdda2f Update baseUrl 2025-09-25 20:37:47 +07:00
Aditya Siregar 4ba5b9def3 Update Report 2025-09-25 20:31:33 +07:00
aefril 116f6b8009 Merge pull request 'efril' (#18) from efril into main
Reviewed-on: #18
2025-09-24 14:55:52 +00:00
efrilm 1b9908e882 update report 2025-09-23 22:27:58 +07:00
efrilm d245074904 no translate for payment method 2025-09-23 20:54:43 +07:00
aefril 8672f01261 Merge pull request 'fix: report page' (#17) from efril into main
Reviewed-on: #17
2025-09-23 08:32:13 +00:00
efrilm 256f035997 fix: report page 2025-09-23 15:30:42 +07:00
aefril bd14adde23 Merge pull request 'base url' (#16) from efril into main
Reviewed-on: #16
2025-09-21 13:38:26 +00:00
efrilm 726d1f4984 base url 2025-09-21 20:36:36 +07:00
aefril 35b1426384 Merge pull request 'efril' (#15) from efril into main
Reviewed-on: #15
2025-09-20 11:04:26 +00:00
efrilm 9b92f4742f add printer type 2025-09-20 18:03:11 +07:00
efrilm 1bf2bad52c campaign detail 2025-09-19 17:38:48 +07:00
efrilm e55357e305 add campaign 2025-09-19 16:10:52 +07:00
aefril 9806400308 Merge pull request 'api' (#14) from efril into main
Reviewed-on: #14
2025-09-18 09:32:44 +00:00
efrilm 3bfd0b9e19 api 2025-09-18 16:31:58 +07:00
aefril f98b61e527 Merge pull request 'efril' (#13) from efril into main
Reviewed-on: #13
2025-09-18 04:01:32 +00:00
efrilm 97ed613cc6 api 2025-09-18 11:00:00 +07:00
efrilm fdcb0e12f4 api 2025-09-18 10:59:10 +07:00
efrilm 7570e973b8 update vertical menu 2025-09-18 10:55:37 +07:00
efrilm e82173c6e2 Campaign 2025-09-18 03:36:05 +07:00
efrilm 4640d14cb7 Reward 2025-09-18 03:04:06 +07:00
efrilm 3a56e56c69 Update Tier Drawer 2025-09-18 01:21:51 +07:00
efrilm 6d2e436b09 Game Prize 2025-09-18 01:07:39 +07:00
efrilm 7252c05569 Game Prize 2025-09-18 01:07:13 +07:00
efrilm 757d9f524a Game 2025-09-18 00:10:19 +07:00
efrilm a6f80bbd02 Games Page 2025-09-17 21:20:49 +07:00
efrilm 8ed2786bc2 tier 2025-09-17 20:54:54 +07:00
efrilm 4655411b24 tier page 2025-09-17 20:21:28 +07:00
efrilm 185edb94cb fix remove local 2025-09-17 18:43:14 +07:00
efrilm 2643963b49 Voucher 2025-09-17 02:21:02 +07:00
efrilm 18ee652731 Customer Royalti 2025-09-17 01:51:59 +07:00
efrilm 3d1b6eee39 Campaign 2025-09-17 01:45:05 +07:00
efrilm 966081214f Wheel Spin 2025-09-17 01:35:01 +07:00
efrilm 1c5740a85b reward 2025-09-17 00:56:56 +07:00
efrilm f527b6f004 Loyalty Page 2025-09-17 00:10:14 +07:00
Aditya Siregar 84454e66dc fix base url 2025-09-13 17:09:04 +07:00
aefril 54d8ff3444 Merge pull request 'base url' (#11) from efril into main
Reviewed-on: #11
2025-09-13 09:59:07 +00:00
efrilm ddbd5ba607 base url 2025-09-13 16:57:51 +07:00
Aditya Siregar 50a8f4a295 Fix 2025-09-13 16:53:25 +07:00
Aditya Siregar fb6e2571a5 WInners Voucher 2025-09-13 16:06:49 +07:00
aefril 5de78cb78f Merge pull request 'Update draw' (#10) from efril into main
Reviewed-on: #10
2025-09-13 08:21:07 +00:00
efrilm d85f081d3a Update draw 2025-09-13 15:06:46 +07:00
aefril f3358705b0 Merge pull request 'Order draw' (#9) from efril into main
Reviewed-on: #9
2025-09-13 07:26:28 +00:00
efrilm 9959775c77 Order draw 2025-09-13 14:25:25 +07:00
aefril 14efada9bb Merge pull request 'Send Payment' (#8) from efril into main
Reviewed-on: #8
2025-09-13 05:32:15 +00:00
efrilm 7384b38df5 Send Payment 2025-09-13 12:30:24 +07:00
aefril 7f646b82a9 Merge pull request 'efril' (#7) from efril into main
Reviewed-on: #7
2025-09-12 21:12:52 +00:00
efrilm fab31f1540 Add Waste at Product Recipe 2025-09-13 04:08:49 +07:00
efrilm aa2946e627 menu 2025-09-13 03:52:11 +07:00
efrilm 2d3274d3bf Purchase Detail 2025-09-13 03:50:57 +07:00
efrilm e1084277e0 status color 2025-09-13 03:05:45 +07:00
efrilm 222beb5043 Purchase create 2025-09-13 03:03:08 +07:00
efrilm 98d6446b0c Purchase Order table 2025-09-13 02:42:39 +07:00
efrilm d54d623d4c Create Purchase 2025-09-13 01:34:43 +07:00
efrilm 140822763e Ingredient in purchase 2025-09-12 22:15:16 +07:00
efrilm 0b51b29474 Vendor at Purchase Form 2025-09-12 21:54:27 +07:00
efrilm 20203942d2 Cash Bank List 2025-09-12 21:03:38 +07:00
efrilm b2840ca27c Create And Update Account 2025-09-12 20:35:49 +07:00
efrilm ce344e4a98 Get Account 2025-09-12 19:52:46 +07:00
efrilm 2d69a024c1 Get Account 2025-09-12 19:51:35 +07:00
efrilm 27fe48e99e integrate chart of account to sub akun dari 2025-09-12 19:30:14 +07:00
efrilm 5a0d96ee43 feat: update 2025-09-12 19:19:43 +07:00
efrilm 9cbb41c2ad Get Chart of Account Types 2025-09-12 19:18:43 +07:00
efrilm 76ee71e7fe Get Unit Converter 2025-09-12 18:57:23 +07:00
efrilm 54c7598e7a Create Unit Conventer 2025-09-12 18:49:01 +07:00
efrilm 40c417ec72 Delete and Edit Vendor 2025-09-12 15:23:19 +07:00
efrilm c91be1812b Vendor Slice 2025-09-12 14:02:57 +07:00
efrilm 3a74e32e64 Create Vendor 2025-09-12 13:52:11 +07:00
efrilm 8026004630 Update Vendor drawer 2025-09-12 03:27:11 +07:00
efrilm 0e8216b0c9 Vendor Api 2025-09-12 03:11:01 +07:00
aefril e8c1d02843 Merge pull request 'efril' (#6) from efril into main
Reviewed-on: #6
2025-09-11 18:58:34 +00:00
efrilm a019a4bdbc Update Expanse Detail Send Payment 2025-09-11 23:06:20 +07:00
efrilm 5def10dc64 Account 2025-09-11 23:01:01 +07:00
efrilm 5723d49090 Reconciliation and Cash Bank Detail Transaction 2025-09-11 21:47:52 +07:00
efrilm 1a9015563f Report 2025-09-11 20:43:15 +07:00
efrilm 34442740e2 Report Cash FLow 2025-09-11 18:38:27 +07:00
efrilm e13fbab564 Report Neraca 2025-09-11 18:29:17 +07:00
efrilm f2eb142dec Report Profit Loss 2025-09-11 18:20:40 +07:00
efrilm a1d23cad9e Report Cash Flow 2025-09-11 17:57:00 +07:00
efrilm b3a41fe0e0 Ingredient Detail Stock Adjustment Drawer 2025-09-11 16:55:18 +07:00
efrilm 5a77d3c2ea Ingredient Detail 2025-09-11 16:22:05 +07:00
efrilm 29defb68c8 Ingredient Detail Unit 2025-09-11 16:02:31 +07:00
efrilm c9e260860c Report Page 2025-09-11 15:32:26 +07:00
efrilm 9c1b1fc1db Fixed Asset Add 2025-09-11 14:47:57 +07:00
efrilm 42b95bb212 Fixed Asset Table 2025-09-11 13:37:52 +07:00
efrilm 63eea38d48 update 2025-09-11 00:44:07 +07:00
efrilm 630d9c0e65 Account Page 2025-09-11 00:16:00 +07:00
efrilm e267a50946 Cash Bank Detail Table 2025-09-10 19:42:26 +07:00
efrilm 2c754d96fd refator menu 2025-09-10 17:51:24 +07:00
efrilm 66589abdd4 Cash Bank List 2025-09-10 17:41:07 +07:00
efrilm 00620026e4 Detail expense 2025-09-10 16:55:19 +07:00
efrilm afa4cfad0d Expense Add 2025-09-10 15:45:34 +07:00
efrilm 420df71452 Sales Bill List table Update 2025-09-10 14:31:16 +07:00
efrilm 7077bf8d87 Expense List Table 2025-09-10 14:24:18 +07:00
efrilm c32d08666e Purchase Detail 2025-09-10 03:23:54 +07:00
efrilm 8461e1f4b7 Sales Quote List Table 2025-09-10 00:47:15 +07:00
efrilm 8ec6ba62f3 Sales Order List table 2025-09-10 00:40:54 +07:00
efrilm ce9f845fe4 Sales Delivery Page 2025-09-10 00:28:23 +07:00
efrilm cc3a0c07a9 Sales Invoice Page 2025-09-10 00:19:11 +07:00
efrilm f585f23c54 purchase quote list and add 2025-09-09 23:55:38 +07:00
efrilm 9b787e65d4 purchase delivery table page 2025-09-09 23:41:04 +07:00
efrilm d0d5d066a1 purchase bill add page 2025-09-09 23:28:17 +07:00
efrilm b20e672ea1 purchase bills table page 2025-09-09 23:23:59 +07:00
efrilm 49ed3386be feat: purchase form 2025-09-09 23:05:23 +07:00
efrilm 4c4579f009 feat: Purchase Order Add 2025-09-09 22:47:05 +07:00
efrilm dfa8218017 feat: purchase order page 2025-09-09 17:42:49 +07:00
efrilm 849013a08a Purchase Overview Page 2025-09-09 16:17:25 +07:00
efrilm 5dc62b8390 Sales Overview Page 2025-09-09 15:42:05 +07:00
efrilm dfa6b4be75 Vendor Detail 2025-09-09 14:28:35 +07:00
efrilm 59f2d45854 update add vendor 2025-09-09 01:25:50 +07:00
efrilm 105d75c820 feat: vendor create and vendor list 2025-09-09 01:17:01 +07:00
efrilm 789dd823b6 add indonesian lang 2025-09-08 23:19:41 +07:00
efrilm d58bf1983c Merge remote-tracking branch 'origin/main' into efril 2025-09-08 23:13:10 +07:00
efrilm 9f934ce5c7 fix local storage 2025-09-08 23:12:11 +07:00
aefril 0528cfa053 Merge pull request 'fix: reset product' (#5) from efril into main
Reviewed-on: #5
2025-09-03 06:05:58 +00:00
efrilm d3417fae9a fix: reset product 2025-09-03 13:01:48 +07:00
aefril 17f059f09d Merge pull request 'efril' (#4) from efril into main
Reviewed-on: #4
2025-09-03 05:38:04 +00:00
efrilm 1fc2b41d36 feat: routing add product 2025-09-03 12:36:44 +07:00
efrilm ad48cdebe7 fix: to date change 2025-09-03 12:34:18 +07:00
efrilm eb38bd7f5c Merge remote-tracking branch 'origin/main' into efril 2025-09-03 12:26:38 +07:00
Aditya Siregar b8de65bdcf fix api url 2025-09-02 16:25:13 +07:00
Aditya Siregar 4f65b9bbb6 fixed 2025-09-01 21:03:56 +07:00
Aditya Siregar bfdcb123d0 Fixed 2025-09-01 21:03:31 +07:00
Aditya Siregar 4ff01920e7 fix 2025-09-01 19:46:48 +07:00
Aditya Siregar 38e1bb5027 fix 2025-09-01 19:07:22 +07:00
Aditya Siregar c71529b11d fix 2025-09-01 18:33:38 +07:00
Aditya Siregar c6f2d67baf Fix deployment 2025-09-01 18:20:25 +07:00
Aditya Siregar 22374dbee1 add deployment 2025-09-01 18:09:54 +07:00
efrilm 7803eaa13e Merge remote-tracking branch 'origin/main' into efril 2025-08-14 03:25:38 +07:00
ferdiansyah783 6d2fe8d6f7 fix: typography 2025-08-14 03:21:58 +07:00
aefril 3700ce6228 Merge pull request 'efril' (#3) from efril into main
Reviewed-on: #3
2025-08-13 20:19:50 +00:00
efrilm 2c370b4c15 Merge remote-tracking branch 'origin/main' into efril 2025-08-14 03:19:02 +07:00
efrilm 16ad569297 feat: report inventory 2025-08-14 03:17:17 +07:00
ferdiansyah783 6549773c13 fix: typography 2025-08-14 03:15:47 +07:00
ferdiansyah783 274cecd1cb fix: re stock 2025-08-14 03:09:00 +07:00
efrilm e2f18ac9bb Merge remote-tracking branch 'origin/main' into efril 2025-08-14 02:08:24 +07:00
efrilm 7a8bd59bb4 feat: add categories at daily report 2025-08-14 02:07:55 +07:00
ferdiansyah783 1d5ff78fc2 fix: filter date 2025-08-14 01:29:40 +07:00
aefril 165c211c5b Merge pull request 'efril' (#2) from efril into main
Reviewed-on: #2
2025-08-13 18:26:55 +00:00
efrilm a13597725b Merge remote-tracking branch 'origin/main' into efril 2025-08-14 01:26:12 +07:00
efrilm 3aba6c3df5 refactor: change name 2025-08-14 01:24:34 +07:00
ferdiansyah783 1cd8adc1e2 fix: guest route 2025-08-14 00:29:19 +07:00
efrilm 054ca015fd Merge remote-tracking branch 'origin/main' into efril 2025-08-14 00:11:27 +07:00
efrilm 3514e7dc46 Merge remote-tracking branch 'origin/main' into efril 2025-08-13 15:05:14 +07:00
346 changed files with 46563 additions and 1426 deletions
+2
View File
@@ -39,3 +39,5 @@ next-env.d.ts
# icon generated file
src/assets/iconify-icons/generated-icons.js
src/assets/iconify-icons/generated-icons.css
*.backup
+5
View File
@@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
+7
View File
@@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pos-dashboard-v2.iml" filepath="$PROJECT_DIR$/.idea/pos-dashboard-v2.iml" />
</modules>
</component>
</project>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+52
View File
@@ -0,0 +1,52 @@
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
# Build arguments for environment variables
ARG NEXT_PUBLIC_APP_URL
ARG NEXT_PUBLIC_DOCS_URL
ARG NEXT_PUBLIC_API_URL
ARG API_URL
ARG BASEPATH
ARG MAPBOX_ACCESS_TOKEN
# Set environment variables for build
ENV API_URL=$API_URL
ENV BASEPATH=$BASEPATH
ENV MAPBOX_ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN
ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL
ENV NEXT_PUBLIC_DOCS_URL=$NEXT_PUBLIC_DOCS_URL
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
# Copy all files first
COPY . .
# Install dependencies
RUN npm ci
# Build icons
RUN npm run build:icons
# Build the application without linting
RUN npm run build:no-lint
# Production stage
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 8080
ENV PORT=8080
CMD ["node", "server.js"]
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
APP_NAME="apskel-frontend"
PORT="8080"
echo "🔄 Pulling latest code..."
git pull
echo "🐳 Building Docker image..."
docker build -t apskel-frontend .
docker stop $APP_NAME 2>/dev/null
docker rm $APP_NAME 2>/dev/null
docker run -d --name $APP_NAME \
-p 8080:$PORT \
$APP_NAME:latest
echo "✅ Deployment complete."
+27 -22
View File
@@ -1,29 +1,34 @@
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
output: 'standalone',
basePath: process.env.BASEPATH,
redirects: async () => {
return [
{
source: '/',
destination: '/en/dashboards/overview',
permanent: true,
locale: false
},
{
source: '/:lang(en|fr|ar)',
destination: '/:lang/dashboards/overview',
permanent: true,
locale: false
},
{
source: '/((?!(?:en|fr|ar|front-pages|favicon.ico)\\b)):path',
destination: '/en/:path',
permanent: true,
locale: false
}
]
}
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
redirects: async () => [
{
source: '/',
destination: '/en/dashboards/overview',
permanent: true,
locale: false,
},
{
source: '/:lang(en|fr|ar)',
destination: '/:lang/dashboards/overview',
permanent: true,
locale: false,
},
{
source: '/((?!(?:en|fr|ar|front-pages|favicon.ico)\\b)):path',
destination: '/en/:path',
permanent: true,
locale: false,
}
],
}
export default nextConfig
+1238 -59
View File
File diff suppressed because it is too large Load Diff
+12 -3
View File
@@ -11,7 +11,8 @@
"lint:fix": "next lint --fix",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
"build:icons": "tsx src/assets/iconify-icons/bundle-icons-css.ts",
"removeI18n": "tsx src/remove-translation-scripts/index.ts"
"removeI18n": "tsx src/remove-translation-scripts/index.ts",
"build:no-lint": "NEXT_DISABLE_ESLINT=true NEXT_DISABLE_TYPECHECK=true next build"
},
"dependencies": {
"@emoji-mart/data": "1.2.1",
@@ -29,7 +30,9 @@
"@fullcalendar/list": "6.1.15",
"@fullcalendar/react": "6.1.15",
"@fullcalendar/timegrid": "6.1.15",
"@hello-pangea/dnd": "^18.0.1",
"@hookform/resolvers": "3.9.1",
"@iconify/react": "^6.0.1",
"@mui/lab": "6.0.0-beta.19",
"@mui/material": "6.2.1",
"@mui/material-nextjs": "6.2.1",
@@ -50,18 +53,23 @@
"apexcharts": "3.49.0",
"axios": "^1.11.0",
"bootstrap-icons": "1.11.3",
"chart.js": "^4.5.1",
"chartjs-plugin-datalabels": "^2.2.0",
"classnames": "2.5.1",
"cmdk": "1.0.4",
"date-fns": "4.1.0",
"emoji-mart": "5.6.0",
"exceljs": "^4.4.0",
"fs-extra": "11.2.0",
"html2canvas": "^1.4.1",
"input-otp": "1.4.1",
"jspdf": "^3.0.1",
"jspdf-autotable": "^5.0.2",
"keen-slider": "6.8.6",
"lucide-react": "^0.544.0",
"mapbox-gl": "3.9.0",
"negotiator": "1.0.0",
"next": "15.1.2",
"next": "^15.1.9",
"react": "18.3.1",
"react-apexcharts": "1.4.1",
"react-colorful": "5.6.1",
@@ -77,7 +85,8 @@
"react-use": "17.6.0",
"recharts": "2.15.0",
"use-debounce": "^10.0.5",
"valibot": "0.42.1"
"valibot": "0.42.1",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@iconify/json": "2.2.286",
@@ -1,16 +1,13 @@
// Type Imports
import type { ChildrenType } from '@core/types'
import type { Locale } from '@configs/i18n'
// HOC Imports
import GuestOnlyRoute from '@/hocs/GuestOnlyRoute'
const Layout = async (props: ChildrenType & { params: Promise<{ lang: Locale }> }) => {
const params = await props.params
const Layout = async (props: ChildrenType) => {
const { children } = props
return <GuestOnlyRoute lang={params.lang}>{children}</GuestOnlyRoute>
return <GuestOnlyRoute>{children}</GuestOnlyRoute>
}
export default Layout
@@ -0,0 +1,976 @@
'use client';
import React, { useState, useEffect, useRef } from 'react';
import { RotateCw, Trophy, Trash2, RefreshCw, Shuffle, Sparkles, Gift } from 'lucide-react';
import { useVoucherRows } from '@/services/queries/vouchers';
import { Voucher, VoucherRow } from '@/types/services/voucher';
import { toast } from 'react-toastify';
interface SpinRow {
id: string;
rowNumber: number;
vouchers: Voucher[];
displayVouchers: Voucher[];
isSpinning: boolean;
isShuffling: boolean;
winner: Voucher | null;
wheelRef: React.RefObject<HTMLDivElement>;
selectedWinner: Voucher | null;
}
interface WinnerHistory {
rowNumber: number;
winner: Voucher;
timestamp: Date;
}
const RandomDrawApp: React.FC = () => {
const [spinRows, setSpinRows] = useState<SpinRow[]>([]);
const [numberOfRows, setNumberOfRows] = useState<number>(5);
const [winnersHistory, setWinnersHistory] = useState<WinnerHistory[]>([]);
const [isRevealingWinners, setIsRevealingWinners] = useState<boolean>(false);
const [revealedWinners, setRevealedWinners] = useState<Set<number>>(new Set());
const [isSequentialSpinning, setIsSequentialSpinning] = useState<boolean>(false);
const [currentSpinningRow, setCurrentSpinningRow] = useState<number | null>(null);
const [selectedPrize, setSelectedPrize] = useState<number>(1); // 1 for Emas 0.25 Gram, 2 for Emas 3 Gram
const audioContextRef = useRef<AudioContext | null>(null);
const tickIntervalRefs = useRef<Map<string, NodeJS.Timeout>>(new Map());
const shuffleIntervalRefs = useRef<Map<string, NodeJS.Timeout>>(new Map());
// Use React Query hook for fetching voucher data - disabled by default
const { data: voucherData, isLoading: isLoadingData, refetch: refetchVouchers, error: fetchError } = useVoucherRows({
rows: numberOfRows,
winner_number: selectedPrize
}, {
enabled: false // Disable automatic fetching - only fetch when Load Data is clicked
});
// Initialize Audio Context
useEffect(() => {
const initAudio = () => {
if (!audioContextRef.current) {
audioContextRef.current = new (window.AudioContext || (window as any).webkitAudioContext)();
}
};
document.addEventListener('click', initAudio, { once: true });
return () => {
document.removeEventListener('click', initAudio);
tickIntervalRefs.current.forEach(timeout => clearTimeout(timeout));
shuffleIntervalRefs.current.forEach(timeout => clearTimeout(timeout));
};
}, []);
// Create tick sound effect
const playTickSound = () => {
if (!audioContextRef.current) return;
const ctx = audioContextRef.current;
const oscillator = ctx.createOscillator();
const gainNode = ctx.createGain();
oscillator.connect(gainNode);
gainNode.connect(ctx.destination);
oscillator.frequency.setValueAtTime(800, ctx.currentTime);
oscillator.frequency.exponentialRampToValueAtTime(200, ctx.currentTime + 0.05);
gainNode.gain.setValueAtTime(0, ctx.currentTime);
gainNode.gain.linearRampToValueAtTime(0.1, ctx.currentTime + 0.01);
gainNode.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + 0.05);
oscillator.start(ctx.currentTime);
oscillator.stop(ctx.currentTime + 0.05);
};
// Create drum roll sound
const playDrumRoll = () => {
if (!audioContextRef.current) return;
const ctx = audioContextRef.current;
const oscillator = ctx.createOscillator();
const gainNode = ctx.createGain();
const noiseNode = ctx.createBufferSource();
// Create noise buffer for snare-like sound
const bufferSize = ctx.sampleRate * 0.05;
const buffer = ctx.createBuffer(1, bufferSize, ctx.sampleRate);
const data = buffer.getChannelData(0);
for (let i = 0; i < bufferSize; i++) {
data[i] = Math.random() * 2 - 1;
}
noiseNode.buffer = buffer;
oscillator.connect(gainNode);
noiseNode.connect(gainNode);
gainNode.connect(ctx.destination);
oscillator.frequency.setValueAtTime(200, ctx.currentTime);
gainNode.gain.setValueAtTime(0.05, ctx.currentTime);
gainNode.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + 0.1);
oscillator.start(ctx.currentTime);
oscillator.stop(ctx.currentTime + 0.1);
noiseNode.start(ctx.currentTime);
};
// Create winner sound
const playWinnerSound = () => {
if (!audioContextRef.current) return;
const ctx = audioContextRef.current;
const notes = [523.25, 659.25, 783.99, 1046.5]; // C, E, G, C (higher octave)
notes.forEach((freq, index) => {
const oscillator = ctx.createOscillator();
const gainNode = ctx.createGain();
oscillator.connect(gainNode);
gainNode.connect(ctx.destination);
oscillator.frequency.setValueAtTime(freq, ctx.currentTime + index * 0.1);
gainNode.gain.setValueAtTime(0, ctx.currentTime + index * 0.1);
gainNode.gain.linearRampToValueAtTime(0.2, ctx.currentTime + index * 0.1 + 0.05);
gainNode.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + index * 0.1 + 0.5);
oscillator.start(ctx.currentTime + index * 0.1);
oscillator.stop(ctx.currentTime + index * 0.1 + 0.5);
});
};
// Start tick sound during spinning
const startTickSound = (rowId: string, duration: number) => {
const existingInterval = tickIntervalRefs.current.get(rowId);
if (existingInterval) {
clearTimeout(existingInterval);
}
let tickInterval = 50;
const maxInterval = 200;
const intervalIncrement = (maxInterval - tickInterval) / (duration / 100);
const tick = () => {
playTickSound();
tickInterval += intervalIncrement;
if (tickInterval < maxInterval) {
const timeoutId = setTimeout(tick, Math.min(tickInterval, maxInterval));
tickIntervalRefs.current.set(rowId, timeoutId);
}
};
tick();
setTimeout(() => {
const interval = tickIntervalRefs.current.get(rowId);
if (interval) {
clearTimeout(interval);
tickIntervalRefs.current.delete(rowId);
}
}, duration + 100);
};
// Shuffle array
const shuffleArray = <T,>(array: T[]): T[] => {
const shuffled = [...array];
for (let i = shuffled.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
}
return shuffled;
};
// Process voucher data when it changes
useEffect(() => {
if (voucherData && voucherData.rows) {
const newSpinRows: SpinRow[] = voucherData.rows.map(row => ({
id: `row-${row.row_number}-${Date.now()}`,
rowNumber: row.row_number,
vouchers: row.vouchers,
displayVouchers: [...row.vouchers],
isSpinning: false,
isShuffling: false,
winner: null,
wheelRef: React.createRef<HTMLDivElement>(),
selectedWinner: null,
}));
setSpinRows(newSpinRows);
setRevealedWinners(new Set());
}
}, [voucherData]);
// Show error if fetch failed
useEffect(() => {
if (fetchError) {
toast.error('Failed to load voucher data. Please check your connection and try again.');
}
}, [fetchError]);
// Remove auto-refetch - data will only load when Load Data button is clicked
// Shuffle all rows (Acak functionality)
const shuffleAllRows = () => {
setSpinRows(prev => prev.map(row => ({
...row,
isShuffling: true
})));
// Animate shuffling for each row
spinRows.forEach((row, index) => {
let shuffleCount = 0;
const maxShuffles = 20;
const shuffleInterval = setInterval(() => {
shuffleCount++;
setSpinRows(prev => prev.map(r => {
if (r.id === row.id) {
return {
...r,
displayVouchers: shuffleArray(r.vouchers)
};
}
return r;
}));
playTickSound();
if (shuffleCount >= maxShuffles) {
clearInterval(shuffleInterval);
setTimeout(() => {
setSpinRows(prev => prev.map(r => {
if (r.id === row.id) {
return {
...r,
isShuffling: false
};
}
return r;
}));
}, index * 100);
}
}, 100);
shuffleIntervalRefs.current.set(row.id, shuffleInterval as any);
});
};
// Reveal winners dramatically
const revealWinnersDramatically = async () => {
setIsRevealingWinners(true);
setRevealedWinners(new Set());
// First, arrange winners to be in the winner zone for each row
const arrangedRows = spinRows.map(row => {
const winner = row.vouchers.find(v => v.is_winner);
if (!winner) return row;
// Create a new display order with winner at position 3 or 4 (will be in winner zone)
const otherVouchers = row.vouchers.filter(v => v.voucher_code !== winner.voucher_code);
const shuffledOthers = shuffleArray(otherVouchers);
// Place winner at index 3 (4th position) which will be in the winner zone
const newDisplayVouchers = [
...shuffledOthers.slice(0, 3),
winner,
...shuffledOthers.slice(3)
];
return {
...row,
displayVouchers: newDisplayVouchers
};
});
// Update display to show arranged vouchers
setSpinRows(arrangedRows);
// Start drum roll effect
const drumRollInterval = setInterval(() => {
playDrumRoll();
}, 100);
// Create a scrolling/spinning effect for all wheels simultaneously
let scrollSpeed = 50;
let currentScroll = 0;
const maxScroll = 2000;
const deceleration = 0.95;
const spinInterval = setInterval(() => {
currentScroll += scrollSpeed;
scrollSpeed *= deceleration;
// Apply scrolling to all wheels
arrangedRows.forEach(row => {
const wheelElement = row.wheelRef.current;
if (wheelElement) {
wheelElement.style.transition = 'none';
wheelElement.style.transform = `translateY(${-currentScroll}px)`;
}
});
// Stop when speed is very slow
if (scrollSpeed < 0.5 || currentScroll >= maxScroll) {
clearInterval(spinInterval);
clearInterval(drumRollInterval);
// Final positioning - snap to winner position
arrangedRows.forEach(row => {
const wheelElement = row.wheelRef.current;
if (wheelElement) {
const CARD_HEIGHT = 80;
const WINNER_ZONE_TOP = 260; // Top position of winner zone
// Position 4th card (index 3) exactly at the winner zone
const finalPosition = -(3 * CARD_HEIGHT - WINNER_ZONE_TOP);
wheelElement.style.transition = 'transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94)';
wheelElement.style.transform = `translateY(${finalPosition}px)`;
}
});
}
}, 20);
// Wait for scrolling to complete
await new Promise(resolve => setTimeout(resolve, 3000));
// Play winner sound
playWinnerSound();
// Collect all winners
const winnersToReveal: { row: SpinRow, winner: Voucher }[] = [];
arrangedRows.forEach(row => {
const winner = row.vouchers.find(v => v.is_winner);
if (winner) {
winnersToReveal.push({ row, winner });
}
});
// Update all winners at once with highlighting
const allWinnerNumbers = new Set<number>();
const historyEntries: WinnerHistory[] = [];
winnersToReveal.forEach(({ row, winner }) => {
allWinnerNumbers.add(row.rowNumber);
historyEntries.push({
rowNumber: row.rowNumber,
winner: winner,
timestamp: new Date()
});
});
// Update state to highlight winners
setRevealedWinners(allWinnerNumbers);
setSpinRows(prev => prev.map(r => {
const winnerInfo = winnersToReveal.find(w => w.row.id === r.id);
if (winnerInfo) {
return {
...r,
winner: winnerInfo.winner,
selectedWinner: winnerInfo.winner
};
}
return r;
}));
setWinnersHistory(prev => [...prev, ...historyEntries]);
setIsRevealingWinners(false);
};
const performDramaticSpin = (row: SpinRow, isSequential: boolean = false) => {
const wheelElement = row.wheelRef.current;
if (!wheelElement) return;
const winner = row.vouchers.find(v => v.is_winner);
if (!winner) {
console.error('No winner found in vouchers');
return;
}
const CARD_HEIGHT = 80;
const WINNER_ZONE_TOP = 260; // Top position of winner zone
// Shuffle the display vouchers to create more dramatic effect
const shuffledVouchers = shuffleArray([...row.vouchers]);
const winnerIndex = shuffledVouchers.findIndex(v => v.voucher_code === winner.voucher_code);
// Update display vouchers with shuffled order
setSpinRows(prev => prev.map(r =>
r.id === row.id ? { ...r, displayVouchers: shuffledVouchers } : r
));
wheelElement.style.transition = 'none';
wheelElement.style.transform = 'translateY(0px)';
wheelElement.offsetHeight;
setTimeout(() => {
// More dramatic spinning with multiple phases
const minSpins = 15;
const maxSpins = 25;
const spins = minSpins + Math.random() * (maxSpins - minSpins);
const totalItems = shuffledVouchers.length;
const totalRotations = Math.floor(spins);
const baseScrollDistance = totalRotations * totalItems * CARD_HEIGHT;
const winnerScrollPosition = winnerIndex * CARD_HEIGHT;
const finalPosition = -(baseScrollDistance + winnerScrollPosition) + WINNER_ZONE_TOP;
const distance = Math.abs(finalPosition);
const baseDuration = 4000; // Longer base duration
const maxDuration = 7000; // Longer max duration
const duration = Math.min(baseDuration + (distance / 8000) * 2000, maxDuration);
// Phase 1: Fast initial spin
const phase1Duration = duration * 0.3;
const phase1Distance = finalPosition * 0.7;
wheelElement.style.transform = `translateY(${phase1Distance}px)`;
wheelElement.style.transition = `transform ${phase1Duration}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`;
// Phase 2: Slower approach to final position
setTimeout(() => {
wheelElement.style.transform = `translateY(${finalPosition}px)`;
wheelElement.style.transition = `transform ${duration - phase1Duration}ms cubic-bezier(0.17, 0.67, 0.12, 0.99)`;
}, phase1Duration);
startTickSound(row.id, duration);
setTimeout(() => {
const interval = tickIntervalRefs.current.get(row.id);
if (interval) {
clearTimeout(interval);
tickIntervalRefs.current.delete(row.id);
}
playWinnerSound();
setSpinRows(prev => prev.map(r =>
r.id === row.id
? { ...r, isSpinning: false, winner: winner, selectedWinner: winner }
: r
));
setWinnersHistory(prev => [...prev, {
rowNumber: row.rowNumber,
winner: winner,
timestamp: new Date()
}]);
// If this is sequential spinning, trigger next row
if (isSequential) {
const nextRowIndex = spinRows.findIndex(r => r.id === row.id) + 1;
if (nextRowIndex < spinRows.length) {
setTimeout(() => {
spinSequentialRow(nextRowIndex);
}, 2000); // Wait 2 seconds before next spin
} else {
// All rows completed
setIsSequentialSpinning(false);
setCurrentSpinningRow(null);
}
}
// Keep the winner in the winner zone - don't reset position
// The winning card will stay exactly where it landed in the winner zone
}, duration);
}, 100);
};
const performSpin = (row: SpinRow) => {
const wheelElement = row.wheelRef.current;
if (!wheelElement) return;
const winner = row.vouchers.find(v => v.is_winner);
if (!winner) {
console.error('No winner found in vouchers');
return;
}
const CARD_HEIGHT = 80;
const WINNER_ZONE_TOP = 260; // Top position of winner zone
// Shuffle the display vouchers to create more dramatic effect
const shuffledVouchers = shuffleArray([...row.vouchers]);
const winnerIndex = shuffledVouchers.findIndex(v => v.voucher_code === winner.voucher_code);
// Update display vouchers with shuffled order
setSpinRows(prev => prev.map(r =>
r.id === row.id ? { ...r, displayVouchers: shuffledVouchers } : r
));
wheelElement.style.transition = 'none';
wheelElement.style.transform = 'translateY(0px)';
wheelElement.offsetHeight;
setTimeout(() => {
// More dramatic spinning with multiple phases
const minSpins = 15;
const maxSpins = 25;
const spins = minSpins + Math.random() * (maxSpins - minSpins);
const totalItems = shuffledVouchers.length;
const totalRotations = Math.floor(spins);
const baseScrollDistance = totalRotations * totalItems * CARD_HEIGHT;
const winnerScrollPosition = winnerIndex * CARD_HEIGHT;
const finalPosition = -(baseScrollDistance + winnerScrollPosition) + WINNER_ZONE_TOP;
const distance = Math.abs(finalPosition);
const baseDuration = 4000; // Longer base duration
const maxDuration = 7000; // Longer max duration
const duration = Math.min(baseDuration + (distance / 8000) * 2000, maxDuration);
// Phase 1: Fast initial spin
const phase1Duration = duration * 0.3;
const phase1Distance = finalPosition * 0.7;
wheelElement.style.transform = `translateY(${phase1Distance}px)`;
wheelElement.style.transition = `transform ${phase1Duration}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`;
// Phase 2: Slower approach to final position
setTimeout(() => {
wheelElement.style.transform = `translateY(${finalPosition}px)`;
wheelElement.style.transition = `transform ${duration - phase1Duration}ms cubic-bezier(0.17, 0.67, 0.12, 0.99)`;
}, phase1Duration);
startTickSound(row.id, duration);
setTimeout(() => {
const interval = tickIntervalRefs.current.get(row.id);
if (interval) {
clearTimeout(interval);
tickIntervalRefs.current.delete(row.id);
}
playWinnerSound();
setSpinRows(prev => prev.map(r =>
r.id === row.id
? { ...r, isSpinning: false, winner: winner, selectedWinner: winner }
: r
));
setWinnersHistory(prev => [...prev, {
rowNumber: row.rowNumber,
winner: winner,
timestamp: new Date()
}]);
// Keep the winner in the winner zone - don't reset position
// The winning card will stay exactly where it landed in the winner zone
}, duration);
}, 100);
};
const spinSequentialRow = (rowIndex: number) => {
if (rowIndex >= spinRows.length) {
setIsSequentialSpinning(false);
setCurrentSpinningRow(null);
return;
}
const row = spinRows[rowIndex];
if (!row || row.isSpinning || row.winner) {
// Skip this row and go to next
spinSequentialRow(rowIndex + 1);
return;
}
setCurrentSpinningRow(row.rowNumber);
setSpinRows(prev => prev.map(r =>
r.id === row.id ? { ...r, isSpinning: true, selectedWinner: null } : r
));
const wheelElement = row.wheelRef.current;
if (wheelElement) {
wheelElement.style.transition = 'none';
wheelElement.style.transform = 'translateY(0px)';
wheelElement.offsetHeight;
}
performDramaticSpin(row, true);
};
const startSequentialSpinning = () => {
if (spinRows.length === 0) return;
// Clear any existing results
setWinnersHistory([]);
setRevealedWinners(new Set());
setSpinRows(prev => prev.map(row => ({
...row,
isSpinning: false,
isShuffling: false,
winner: null,
selectedWinner: null,
displayVouchers: [...row.vouchers]
})));
// Reset all wheel positions
spinRows.forEach(row => {
const wheelElement = row.wheelRef.current;
if (wheelElement) {
wheelElement.style.transition = 'none';
wheelElement.style.transform = 'translateY(0px)';
}
});
setIsSequentialSpinning(true);
setCurrentSpinningRow(null);
// Start with first row after a short delay
setTimeout(() => {
spinSequentialRow(0);
}, 500);
};
const spinWheel = (rowId: string) => {
const row = spinRows.find(r => r.id === rowId);
if (!row || row.isSpinning || row.winner) return;
setSpinRows(prev => prev.map(r =>
r.id === rowId ? { ...r, isSpinning: true, selectedWinner: null } : r
));
const wheelElement = row.wheelRef.current;
if (wheelElement) {
wheelElement.style.transition = 'none';
wheelElement.style.transform = 'translateY(0px)';
wheelElement.offsetHeight;
}
performSpin(row);
};
const clearResults = () => {
tickIntervalRefs.current.forEach(timeout => clearTimeout(timeout));
shuffleIntervalRefs.current.forEach(timeout => clearTimeout(timeout));
tickIntervalRefs.current.clear();
shuffleIntervalRefs.current.clear();
setWinnersHistory([]);
setRevealedWinners(new Set());
setIsSequentialSpinning(false);
setCurrentSpinningRow(null);
setSpinRows(prev => prev.map(row => ({
...row,
isSpinning: false,
isShuffling: false,
winner: null,
selectedWinner: null,
displayVouchers: [...row.vouchers]
})));
spinRows.forEach(row => {
const wheelElement = row.wheelRef.current;
if (wheelElement) {
wheelElement.style.transition = 'none';
wheelElement.style.transform = 'translateY(0px)';
}
});
};
const refreshData = async () => {
tickIntervalRefs.current.forEach(timeout => clearTimeout(timeout));
shuffleIntervalRefs.current.forEach(timeout => clearTimeout(timeout));
tickIntervalRefs.current.clear();
shuffleIntervalRefs.current.clear();
try {
await refetchVouchers();
toast.success('Data refreshed successfully');
} catch (error) {
toast.error('Failed to refresh data');
}
};
const formatPhoneNumber = (phone: string) => {
return phone.substring(0, 5) + '****' + phone.substring(phone.length - 2);
};
return (
<div className="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 text-gray-900 p-6">
<style jsx>{`
@keyframes bounce-in {
0% {
transform: scale(0.3);
opacity: 0;
}
50% {
transform: scale(1.05);
}
70% {
transform: scale(0.9);
}
100% {
transform: scale(1);
opacity: 1;
}
}
.animate-bounce-in {
animation: bounce-in 0.6s ease-out;
}
`}</style>
<div className="max-w-full px-4 mx-auto">
{/* Header */}
<div className="text-center mb-8">
<h1 className="text-5xl font-bold bg-gradient-to-r from-primary to-purple-600 bg-clip-text text-transparent mb-2">
Voucher Lucky Draw
</h1>
</div>
<div className="space-y-4">
{/* Controls Section - Compact Layout */}
<div className="grid grid-cols-1 lg:grid-cols-3 gap-3">
{/* Configuration Card */}
<div className="bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<h2 className="text-lg font-semibold mb-3 text-gray-900">
Configuration
</h2>
<div className="space-y-3">
<div className="grid grid-cols-2 gap-2">
<div>
<label className="block text-xs font-medium text-gray-700 mb-1">
Number of Rows
</label>
<input
type="number"
min="1"
max="10"
value={numberOfRows}
onChange={(e) => setNumberOfRows(parseInt(e.target.value) || 1)}
className="w-full bg-white border border-gray-300 rounded p-1.5 text-sm text-gray-900 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20"
disabled={isLoadingData}
/>
</div>
<div>
<label className="block text-xs font-medium text-gray-700 mb-1">
Prize Selection
</label>
<select
value={selectedPrize}
onChange={(e) => setSelectedPrize(parseInt(e.target.value))}
className="w-full bg-white border border-gray-300 rounded p-1.5 text-sm text-gray-900 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/20"
disabled={isLoadingData}
>
<option value={1}>🥇 Emas 0.25 Gram</option>
<option value={2}>🥇 Emas 3 Gram</option>
</select>
</div>
</div>
<button
onClick={refreshData}
disabled={isLoadingData}
className="w-full px-3 py-1.5 bg-primary hover:bg-primary/90 disabled:bg-gray-400 text-white text-sm font-semibold rounded flex items-center justify-center gap-1 transition-colors"
>
<RefreshCw size={14} className={isLoadingData ? 'animate-spin' : ''} />
{isLoadingData ? 'Loading...' : 'Load Data'}
</button>
</div>
{spinRows.length > 0 && (
<div className="mt-3 p-2 bg-gray-50 rounded text-xs text-gray-600">
<div>Rows: {spinRows.length} | Vouchers: {spinRows.reduce((acc, row) => acc + row.vouchers.length, 0)}</div>
</div>
)}
</div>
{/* Actions Card */}
<div className="bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<h2 className="text-lg font-semibold mb-3 text-gray-900">
Actions
</h2>
<div className="space-y-2">
<button
onClick={shuffleAllRows}
disabled={isLoadingData || spinRows.some(r => r.isShuffling) || spinRows.length === 0}
className="w-full px-3 py-1.5 bg-purple-600 hover:bg-purple-700 disabled:bg-gray-400 text-white text-sm font-semibold rounded flex items-center justify-center gap-1 transition-colors"
>
<Shuffle size={14} className={spinRows.some(r => r.isShuffling) ? 'animate-pulse' : ''} />
Shuffle All
</button>
<button
onClick={startSequentialSpinning}
disabled={isSequentialSpinning || spinRows.length === 0}
className="w-full px-3 py-1.5 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 disabled:from-gray-400 disabled:to-gray-500 text-white text-sm font-bold rounded flex items-center justify-center gap-1 transition-all"
>
<Trophy size={14} className={isSequentialSpinning ? 'animate-spin' : ''} />
{isSequentialSpinning ? 'Spinning...' : 'Spin for Winner'}
</button>
{winnersHistory.length > 0 && (
<button
onClick={clearResults}
className="w-full px-3 py-1.5 bg-red-600 hover:bg-red-700 text-white text-sm font-semibold rounded flex items-center justify-center gap-1 transition-colors"
>
<Trash2 size={14} />
Clear Results
</button>
)}
</div>
</div>
{/* Winners Summary Card */}
<div className="bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<h2 className="text-lg font-semibold mb-3 text-gray-900 flex items-center gap-2">
<Trophy className="text-yellow-500" size={18} />
Winners
</h2>
{winnersHistory.length > 0 ? (
<div className="space-y-1 max-h-32 overflow-y-auto">
{winnersHistory.map((history) => (
<div
key={`${history.rowNumber}-${history.timestamp.getTime()}`}
className="p-1.5 bg-yellow-50 border border-yellow-200 rounded text-xs"
>
<div className="font-semibold text-yellow-700">
Row {history.rowNumber}: {history.winner.name}
</div>
<div className="text-xs text-yellow-600">
{history.winner.voucher_code}
</div>
</div>
))}
</div>
) : (
<div className="text-center py-2">
<Trophy className="mx-auto text-gray-300 mb-1" size={20} />
<p className="text-gray-500 text-xs">No winners yet</p>
</div>
)}
</div>
</div>
{/* Spin Rows - Display in grid */}
<div className={`grid gap-4 ${
spinRows.length === 1 ? 'grid-cols-1' :
spinRows.length === 2 ? 'grid-cols-1 lg:grid-cols-2' :
spinRows.length === 3 ? 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3' :
spinRows.length === 4 ? 'grid-cols-1 md:grid-cols-2 xl:grid-cols-4' :
spinRows.length === 5 ? 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5' :
'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4'
}`}>
{spinRows.map((row) => (
<div key={row.id} className={`bg-white rounded-lg border-2 shadow-sm transition-all ${
row.isShuffling ? 'border-purple-400 animate-pulse' : 'border-gray-200'
}`}>
<div className="p-4 border-b border-gray-200">
{row.winner && (
<div className="mt-2 p-2 bg-yellow-50 border border-yellow-200 rounded-lg animate-bounce-in">
<div className="flex items-center gap-1 text-sm">
<Trophy className="text-yellow-500" size={16} />
<span className="font-semibold text-yellow-700 truncate">
{row.winner.name}
</span>
</div>
<div className="text-xs text-yellow-600 mt-1">
{row.winner.voucher_code}
</div>
</div>
)}
</div>
{/* Wheel Container */}
<div
className="relative bg-gray-50 overflow-hidden"
style={{ height: '600px' }}
>
{/* Subtle Winner Zone Indicator */}
<div
className="absolute left-0 right-0 z-10 pointer-events-none"
style={{
top: '260px',
height: '80px',
background: 'linear-gradient(90deg, transparent 0%, rgba(34, 197, 94, 0.1) 20%, rgba(34, 197, 94, 0.2) 50%, rgba(34, 197, 94, 0.1) 80%, transparent 100%)',
borderTop: '2px dashed rgba(34, 197, 94, 0.3)',
borderBottom: '2px dashed rgba(34, 197, 94, 0.3)'
}}
>
<div className="absolute right-2 top-1/2 transform -translate-y-1/2">
<div className="bg-green-500 text-white px-2 py-1 rounded text-xs font-bold shadow-lg">
🏆 WINNER
</div>
</div>
</div>
{/* Scrolling Cards */}
<div
ref={row.wheelRef}
className="absolute inset-0"
style={{ transform: 'translateY(0px)' }}
>
{Array.from({ length: 50 }, (_, repeatIndex) =>
row.displayVouchers.map((voucher, voucherIndex) => {
const isSelectedWinner = row.selectedWinner?.voucher_code === voucher.voucher_code;
return (
<div
key={`${repeatIndex}-${voucherIndex}`}
className={`flex items-center px-4 border-b border-gray-300 transition-all duration-300 ${
isSelectedWinner
? 'bg-gradient-to-r from-yellow-100 to-yellow-200 border-yellow-300 shadow-lg'
: voucherIndex % 2 === 0
? 'bg-white hover:bg-gray-50'
: 'bg-gray-50 hover:bg-gray-100'
}`}
style={{
height: '80px',
minHeight: '80px',
maxHeight: '80px',
boxSizing: 'border-box'
}}
>
<div className="flex-1">
<div className={`font-bold text-lg mb-1 ${
isSelectedWinner ? 'text-yellow-600' : 'text-gray-900'
}`}>
{voucher.voucher_code}
</div>
<div className={`text-sm ${
isSelectedWinner ? 'text-yellow-700' : 'text-gray-600'
}`}>
{voucher.name}
</div>
</div>
<div className="text-right">
<div className="text-gray-500 text-xs">
{formatPhoneNumber(voucher.phone_number)}
</div>
{isSelectedWinner && (
<Trophy className="inline ml-2 text-yellow-500" size={16} />
)}
</div>
</div>
);
})
)}
</div>
{/* Gradient Overlays */}
<div className="absolute top-0 left-0 right-0 h-32 bg-gradient-to-b from-gray-50 via-gray-50/70 to-transparent pointer-events-none z-40"></div>
<div className="absolute bottom-0 left-0 right-0 h-32 bg-gradient-to-t from-gray-50 via-gray-50/70 to-transparent pointer-events-none z-40"></div>
</div>
</div>
))}
</div>
</div>
</div>
</div>
);
};
export default RandomDrawApp;
@@ -0,0 +1,7 @@
import AccountList from '@/views/apps/account'
const AccountPage = () => {
return <AccountList />
}
export default AccountPage
@@ -0,0 +1,7 @@
import CashBankDetail from '@/views/apps/cash-bank/detail'
const CashBankDetailPage = () => {
return <CashBankDetail />
}
export default CashBankDetailPage
@@ -0,0 +1,18 @@
import CashBankDetailTransactionContent from '@/views/apps/cash-bank/detail/transaction/CashBankDetailTransactionContent'
import CashBankDetailTransactionHeader from '@/views/apps/cash-bank/detail/transaction/CashBankDetailTransactionHeader'
import Grid from '@mui/material/Grid2'
const TransactionPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<CashBankDetailTransactionHeader title='Giro 1-10003' transaction='Terima Pembayaran Tagihan' />
</Grid>
<Grid size={{ xs: 12 }}>
<CashBankDetailTransactionContent />
</Grid>
</Grid>
)
}
export default TransactionPage
@@ -0,0 +1,7 @@
import CashBankList from '@/views/apps/cash-bank/CashBankList'
const CashBankPage = () => {
return <CashBankList />
}
export default CashBankPage
@@ -0,0 +1,18 @@
import ExpenseDetailContent from '@/views/apps/expense/detail/ExpenseDetailContent'
import ExpenseDetailHeader from '@/views/apps/expense/detail/ExpenseDetailHeader'
import Grid from '@mui/material/Grid2'
const ExpenseDetailPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<ExpenseDetailHeader />
</Grid>
<Grid size={{ xs: 12 }}>
<ExpenseDetailContent />
</Grid>
</Grid>
)
}
export default ExpenseDetailPage
@@ -0,0 +1,18 @@
import ExpenseAddForm from '@/views/apps/expense/add/ExpenseAddForm'
import ExpenseAddHeader from '@/views/apps/expense/add/ExpenseAddHeader'
import Grid from '@mui/material/Grid2'
const ExpenseAddPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<ExpenseAddHeader />
</Grid>
<Grid size={{ xs: 12 }}>
<ExpenseAddForm />
</Grid>
</Grid>
)
}
export default ExpenseAddPage
@@ -0,0 +1,7 @@
import ExpenseList from '@/views/apps/expense/list'
const ExpensePage = () => {
return <ExpenseList />
}
export default ExpensePage
@@ -0,0 +1,18 @@
import FixedAssetAddForm from '@/views/apps/fixed-assets/add/FixedAssetAddForm'
import FixedAssetAddHeader from '@/views/apps/fixed-assets/add/FixedAssetAddHeader'
import Grid from '@mui/material/Grid2'
const FixedAssetPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<FixedAssetAddHeader />
</Grid>
<Grid size={{ xs: 12 }}>
<FixedAssetAddForm />
</Grid>
</Grid>
)
}
export default FixedAssetPage
@@ -0,0 +1,7 @@
import FixedAssetList from '@/views/apps/fixed-assets'
const FixedAssetPage = () => {
return <FixedAssetList />
}
export default FixedAssetPage
@@ -0,0 +1,7 @@
import IngredientDetail from '@/views/apps/ecommerce/products/ingredient/detail'
const IngredientDetailPage = () => {
return <IngredientDetail />
}
export default IngredientDetailPage
@@ -0,0 +1,317 @@
'use client'
import { useInventoryAnalytics } from '@/services/queries/analytics'
import { useOutletById } from '@/services/queries/outlets'
import { formatDateDDMMYYYY } from '@/utils/transform'
import ReportGeneratorComponent from '@/views/dashboards/daily-report/report-generator'
import ReportHeader from '@/views/dashboards/daily-report/report-header'
import { useRef, useState } from 'react'
const ExportInventoryPage = () => {
const reportRef = useRef<HTMLDivElement | null>(null)
const [now, setNow] = useState(new Date())
const [selectedDate, setSelectedDate] = useState(new Date())
const [dateRange, setDateRange] = useState({
startDate: new Date(),
endDate: new Date()
})
const [filterType, setFilterType] = useState<'single' | 'range'>('single') // 'single' or 'range'
const getDateParams = () => {
if (filterType === 'single') {
return {
date_from: formatDateDDMMYYYY(selectedDate),
date_to: formatDateDDMMYYYY(selectedDate)
}
} else {
return {
date_from: formatDateDDMMYYYY(dateRange.startDate),
date_to: formatDateDDMMYYYY(dateRange.endDate)
}
}
}
const dateParams = getDateParams()
const { data: outlet } = useOutletById()
const { data: inventory } = useInventoryAnalytics(dateParams)
const handleGeneratePDF = async () => {
const reportElement = reportRef.current
try {
// Import jsPDF dan html2canvas
const jsPDF = (await import('jspdf')).default
const html2canvas = (await import('html2canvas')).default
// Optimized canvas capture dengan scale lebih rendah
const canvas = await html2canvas(reportElement!, {
scale: 1.5, // Reduced from 2 to 1.5
useCORS: true,
allowTaint: true,
backgroundColor: '#ffffff',
logging: false, // Disable logging for performance
removeContainer: true, // Clean up after capture
imageTimeout: 0, // No timeout for image loading
height: reportElement!.scrollHeight,
width: reportElement!.scrollWidth
})
// Compress canvas using JPEG with quality setting
const imgData = canvas.toDataURL('image/jpeg', 0.85) // JPEG with 85% quality instead of PNG
// Create PDF with compression
const pdf = new jsPDF({
orientation: 'portrait',
unit: 'mm',
format: 'a4',
compress: true // Enable built-in compression
})
const imgWidth = 210
const pageHeight = 295
const imgHeight = (canvas.height * imgWidth) / canvas.width
let heightLeft = imgHeight
let position = 0
// Add first page with compressed image
pdf.addImage(imgData, 'JPEG', 0, position, imgWidth, imgHeight, '', 'FAST') // Use FAST compression
heightLeft -= pageHeight
// Handle multiple pages if needed
while (heightLeft >= 0) {
position = heightLeft - imgHeight
pdf.addPage()
pdf.addImage(imgData, 'JPEG', 0, position, imgWidth, imgHeight, '', 'FAST')
heightLeft -= pageHeight
}
// Additional compression options
pdf.setProperties({
title: `Laporan Inventori`,
subject: 'Laporan Inventori',
author: 'Apskel POS System',
creator: 'Apskel'
})
// Save with optimized settings
const fileName =
filterType === 'single'
? `laporan-inventory-${formatDateForInput(selectedDate)}.pdf`
: `laporan-inventory-${formatDateForInput(dateRange.startDate)}-to-${formatDateForInput(dateRange.endDate)}.pdf`
pdf.save(fileName, {
returnPromise: true
})
// Clean up canvas to free memory
canvas.width = canvas.height = 0
} catch (error) {
console.error('Error generating PDF:', error)
alert('Terjadi kesalahan saat membuat PDF. Pastikan jsPDF dan html2canvas sudah terinstall.')
}
}
const formatDateForInput = (date: Date) => {
return date.toISOString().split('T')[0]
}
const getReportPeriodText = () => {
if (filterType === 'single') {
return `${formatDateDDMMYYYY(selectedDate)} - ${formatDateDDMMYYYY(selectedDate)}`
} else {
return `${formatDateDDMMYYYY(dateRange.startDate)} - ${formatDateDDMMYYYY(dateRange.endDate)}`
}
}
const productSummary = {
totalQuantity: inventory?.products?.reduce((sum, item) => sum + (item?.quantity || 0), 0) || 0,
totalIn: inventory?.products?.reduce((sum, item) => sum + (item?.total_in || 0), 0) || 0,
totalOut: inventory?.products?.reduce((sum, item) => sum + (item?.total_out || 0), 0) || 0
}
const ingredientSummary = {
totalQuantity: inventory?.ingredients?.reduce((sum, item) => sum + (item?.quantity || 0), 0) || 0,
totalIn: inventory?.ingredients?.reduce((sum, item) => sum + (item?.total_in || 0), 0) || 0,
totalOut: inventory?.ingredients?.reduce((sum, item) => sum + (item?.total_out || 0), 0) || 0
}
return (
<div className='min-h-screen'>
{/* Control Panel */}
<ReportGeneratorComponent
// Props wajib
reportTitle='Laporan Inventori'
filterType={filterType}
selectedDate={selectedDate}
dateRange={dateRange}
onFilterTypeChange={setFilterType}
onSingleDateChange={setSelectedDate}
onDateRangeChange={setDateRange}
onGeneratePDF={handleGeneratePDF}
// Props opsional
// isGenerating={isGenerating}
// customQuickActions={customQuickActions}
// labels={customLabels}
/>
<div ref={reportRef} className='max-w-4xl mx-auto bg-white min-h-[297mm]' style={{ width: '210mm' }}>
{/* Header */}
<ReportHeader
outlet={outlet}
reportTitle='Laporan Inventori'
reportSubtitle='Laporan'
brandName='Apskel'
brandColor='#36175e'
periode={getReportPeriodText()}
/>
{/* Ringkasan */}
<div className='p-8'>
<h3 className='text-xl font-bold mb-6' style={{ color: '#36175e' }}>
1. Ringkasan
</h3>
<div className='grid grid-cols-2 gap-6'>
<div className='space-y-4'>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Item</span>
<span className='font-semibold text-gray-800'>{inventory?.summary.total_products}</span>
</div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Item Masuk</span>
<span className='font-semibold text-gray-800'>{inventory?.summary.low_stock_products}</span>
</div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Item Keluar</span>
<span className='font-semibold text-gray-800'>{inventory?.summary.zero_stock_products}</span>
</div>
</div>
<div className='space-y-4'>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Ingredient</span>
<span className='font-semibold text-gray-800'>{inventory?.summary.total_ingredients}</span>
</div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Ingredient Masuk</span>
<span className='font-semibold text-gray-800'>{inventory?.summary.low_stock_ingredients}</span>
</div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Ingredient Keluar</span>
<span className='font-semibold text-gray-800'>{inventory?.summary.zero_stock_ingredients}</span>
</div>
</div>
</div>
</div>
{/* Item */}
<div className='px-8 pb-8'>
<h3 className='text-xl font-bold mb-6' style={{ color: '#36175e' }}>
2. Item
</h3>
<div className='bg-gray-50 rounded-lg border border-gray-200 overflow-hidden'>
<table className='w-full'>
<thead>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<th className='text-left p-3 font-semibold'>Nama</th>
<th className='text-center p-3 font-semibold'>Kategori</th>
<th className='text-center p-3 font-semibold'>Stock</th>
<th className='text-center p-3 font-semibold'>Masuk</th>
<th className='text-center p-3 font-semibold'>Keluar</th>
</tr>
</thead>
<tbody>
{inventory?.products?.map((product, index) => {
let rowClass = index % 2 === 0 ? 'bg-white' : 'bg-gray-50'
if (product.is_zero_stock) {
rowClass = 'bg-red-300' // Merah untuk stok habis
} else if (product.is_low_stock) {
rowClass = 'bg-yellow-300' // Kuning untuk stok sedikit
}
return (
<tr key={index} className={rowClass}>
<td className='p-3 font-medium text-gray-800'>{product.product_name}</td>
<td className='p-3 font-medium text-gray-800'>{product.category_name}</td>
<td className='p-3 text-center text-gray-700'>{product.quantity}</td>
<td className='p-3 text-center text-gray-700'>{product.total_in}</td>
<td className='p-3 text-center text-gray-700'>{product.total_out}</td>
</tr>
)
}) || []}
</tbody>
<tfoot>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<td className='p-3 font-bold'>TOTAL</td>
<td className='p-3'></td>
<td className='p-3 text-center font-bold'>{productSummary.totalQuantity ?? 0}</td>
<td className='p-3 text-center font-bold'>{productSummary.totalIn ?? 0}</td>
<td className='p-3 text-center font-bold'>{productSummary.totalOut ?? 0}</td>
</tr>
</tfoot>
</table>
</div>
</div>
{/* Ingredient */}
<div className='px-8 pb-8'>
<h3 className='text-xl font-bold mb-6' style={{ color: '#36175e' }}>
3. Ingredient
</h3>
<div className='bg-gray-50 rounded-lg border border-gray-200 overflow-hidden'>
<table className='w-full'>
<thead>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<th className='text-left p-3 font-semibold'>Nama</th>
<th className='text-center p-3 font-semibold'>Stock</th>
<th className='text-center p-3 font-semibold'>Masuk</th>
<th className='text-center p-3 font-semibold'>Keluar</th>
</tr>
</thead>
<tbody>
{inventory?.ingredients?.map((ingredient, index) => {
let rowClass = index % 2 === 0 ? 'bg-white' : 'bg-gray-50'
if (ingredient.is_zero_stock) {
rowClass = 'bg-red-300' // Merah untuk stok habis
} else if (ingredient.is_low_stock) {
rowClass = 'bg-yellow-300' // Kuning untuk stok sedikit
}
return (
<tr key={index} className={rowClass}>
<td className='p-3 font-medium text-gray-800'>{ingredient.ingredient_name}</td>
<td className='p-3 text-center text-gray-700'>{ingredient.quantity}</td>
<td className='p-3 text-center text-gray-700'>{ingredient.total_in}</td>
<td className='p-3 text-center text-gray-700'>{ingredient.total_out}</td>
</tr>
)
}) || []}
</tbody>
<tfoot>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<td className='p-3 font-bold'>TOTAL</td>
<td className='p-3 text-center font-bold'>{ingredientSummary.totalQuantity ?? 0}</td>
<td className='p-3 text-center font-bold'>{ingredientSummary.totalIn ?? 0}</td>
<td className='p-3 text-center font-bold'>{ingredientSummary.totalOut ?? 0}</td>
</tr>
</tfoot>
</table>
</div>
</div>
{/* Footer */}
<div className='px-8 py-6 border-t-2 border-gray-200 mt-8'>
<div className='flex justify-between items-center text-sm text-gray-600'>
<p>© 2025 Apskel - Sistem POS Terpadu</p>
<p></p>
<p>Dicetak pada: {now.toLocaleDateString('id-ID')}</p>
</div>
</div>
</div>
</div>
)
}
export default ExportInventoryPage
@@ -0,0 +1,7 @@
import CampaignDetailContent from '@/views/apps/marketing/campaign/detail'
const CampaignDetailPage = () => {
return <CampaignDetailContent />
}
export default CampaignDetailPage
@@ -0,0 +1,7 @@
import CampaignListTable from '@/views/apps/marketing/campaign/CampaignListTable'
const CampaignPage = () => {
return <CampaignListTable />
}
export default CampaignPage
@@ -0,0 +1,7 @@
import CustomerAnalyticList from '@/views/apps/marketing/customer-analytics'
const CustomerAnalyticsPage = () => {
return <CustomerAnalyticList />
}
export default CustomerAnalyticsPage
@@ -0,0 +1,38 @@
import DiscountAddHeader from '@/views/apps/marketing/discount/add/DiscountAddHeader'
import DiscountInformation from '@/views/apps/marketing/discount/add/DiscountAddInformation'
import DiscountOutlets from '@/views/apps/marketing/discount/add/DiscountAddOutlets'
import DiscountRules from '@/views/apps/marketing/discount/add/DiscountAddRule'
import DiscountSettings from '@/views/apps/marketing/discount/add/DiscountAddSetting'
import Grid from '@mui/material/Grid2'
const DiscountsAddPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<DiscountAddHeader />
</Grid>
<Grid size={{ xs: 12, md: 8 }}>
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<DiscountInformation />
</Grid>
<Grid size={{ xs: 12 }}>
<DiscountRules />
</Grid>
</Grid>
</Grid>
<Grid size={{ xs: 12, md: 4 }}>
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<DiscountSettings />
</Grid>
<Grid size={{ xs: 12 }}>
<DiscountOutlets />
</Grid>
</Grid>
</Grid>
</Grid>
)
}
export default DiscountsAddPage
@@ -0,0 +1,7 @@
import DiscountList from '@/views/apps/marketing/discount'
const DiscountPage = () => {
return <DiscountList />
}
export default DiscountPage
@@ -0,0 +1,7 @@
import GamePrizeList from '@/views/apps/marketing/games/game-prizes'
const GamePrizePage = () => {
return <GamePrizeList />
}
export default GamePrizePage
@@ -0,0 +1,7 @@
import GamesList from '@/views/apps/marketing/games/list'
const GamePage = () => {
return <GamesList />
}
export default GamePage
@@ -0,0 +1,7 @@
import WheelSpinList from '@/views/apps/marketing/gamification/wheel-spin'
const WheelSpinPage = () => {
return <WheelSpinList />
}
export default WheelSpinPage
@@ -0,0 +1,7 @@
import LoyaltyList from '@/views/apps/marketing/loyalty'
const LoyaltiPage = () => {
return <LoyaltyList />
}
export default LoyaltiPage
@@ -0,0 +1,7 @@
import RewardList from '@/views/apps/marketing/reward'
const RewardPage = () => {
return <RewardList />
}
export default RewardPage
@@ -0,0 +1,7 @@
import TierList from '@/views/apps/marketing/tier'
const TierPage = () => {
return <TierList />
}
export default TierPage
@@ -0,0 +1,7 @@
import VoucherList from '@/views/apps/marketing/voucher'
const VoucherPage = () => {
return <VoucherList />
}
export default VoucherPage
@@ -0,0 +1,86 @@
'use client'
import Grid from '@mui/material/Grid2'
import { TextField, Typography, useTheme } from '@mui/material'
import { useState } from 'react'
import { formatDateDDMMYYYY, formatForInputDate } from '@/utils/transform'
import PurchaseOverviewLeft from '@/views/apps/purchase/overview/overview-left'
import PurchaseOverviewRight from '@/views/apps/purchase/overview/overview-right'
const PurchaseOverviewPage = () => {
const theme = useTheme()
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
return (
<>
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<div className='flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Overview Pembelian
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(today || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<Typography>-</Typography>
<TextField
type='date'
value={today}
onChange={e => {}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
</div>
</Grid>
</Grid>
<Grid container spacing={6} className='mt-5'>
<Grid size={{ xs: 12, lg: 8, md: 7 }}>
<PurchaseOverviewRight />
</Grid>
<Grid size={{ xs: 12, lg: 4, md: 5 }}>
<PurchaseOverviewLeft />
</Grid>
</Grid>
</>
)
}
export default PurchaseOverviewPage
@@ -0,0 +1,18 @@
import PurchaseDetailContent from '@/views/apps/purchase/purchase-detail/PurchaseDetailContent'
import PurchaseDetailHeader from '@/views/apps/purchase/purchase-detail/PurchaseDetailHeader'
import Grid from '@mui/material/Grid2'
const PurchaseBillDetailPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<PurchaseDetailHeader title='Detail Pesanan Pembelian' />
</Grid>
<Grid size={{ xs: 12 }}>
<PurchaseDetailContent />
</Grid>
</Grid>
)
}
export default PurchaseBillDetailPage
@@ -0,0 +1,19 @@
import Grid from '@mui/material/Grid2'
import PurchaseAddForm from '@/views/apps/purchase/purchase-form/PurchaseAddForm'
import PurchaseBillAddHeader from '@/views/apps/purchase/purchase-bills/add/PurchaseBillAddHeader'
const PurchaseBillAddPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<PurchaseBillAddHeader />
</Grid>
<Grid size={{ xs: 12 }}>
<PurchaseAddForm />
</Grid>
</Grid>
)
}
export default PurchaseBillAddPage
@@ -0,0 +1,7 @@
import PurchaseBillList from '@/views/apps/purchase/purchase-bills/list'
const PurchaseBillsPage = () => {
return <PurchaseBillList />
}
export default PurchaseBillsPage
@@ -0,0 +1,7 @@
import PurchaseDeliveryListTable from '@/views/apps/purchase/purchase-deliveries/list/PurchaseDeliveryListTable'
const PurchaseDeliveryPage = () => {
return <PurchaseDeliveryListTable />
}
export default PurchaseDeliveryPage
@@ -0,0 +1,18 @@
import PurchaseDetailContent from '@/views/apps/purchase/purchase-detail/PurchaseDetailContent'
import PurchaseDetailHeader from '@/views/apps/purchase/purchase-detail/PurchaseDetailHeader'
import Grid from '@mui/material/Grid2'
const PurchaseOrderDetailPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<PurchaseDetailHeader title='Detail Pesanan Pembelian' />
</Grid>
<Grid size={{ xs: 12 }}>
<PurchaseDetailContent />
</Grid>
</Grid>
)
}
export default PurchaseOrderDetailPage
@@ -0,0 +1,19 @@
import Grid from '@mui/material/Grid2'
import PurchaseOrderAddHeader from '@/views/apps/purchase/purchase-orders/add/PurchaseOrderAddHeader'
import PurchaseAddForm from '@/views/apps/purchase/purchase-form/PurchaseAddForm'
const PurchaseOrderAddPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<PurchaseOrderAddHeader />
</Grid>
<Grid size={{ xs: 12 }}>
<PurchaseAddForm />
</Grid>
</Grid>
)
}
export default PurchaseOrderAddPage
@@ -0,0 +1,7 @@
import PurchaseOrderList from '@/views/apps/purchase/purchase-orders/list'
const PurchaseOrdersPage = () => {
return <PurchaseOrderList />
}
export default PurchaseOrdersPage
@@ -0,0 +1,19 @@
import Grid from '@mui/material/Grid2'
import PurchaseAddForm from '@/views/apps/purchase/purchase-form/PurchaseAddForm'
import PurchaseQuoteAddHeader from '@/views/apps/purchase/purchase-quote/add/PurchaseQuoteAddHeader'
const PurchaseQuoteAddPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<PurchaseQuoteAddHeader />
</Grid>
<Grid size={{ xs: 12 }}>
<PurchaseAddForm />
</Grid>
</Grid>
)
}
export default PurchaseQuoteAddPage
@@ -0,0 +1,7 @@
import PurchaseQuoteList from '@/views/apps/purchase/purchase-quote/list'
const PurchaseQuotePage = () => {
return <PurchaseQuoteList />
}
export default PurchaseQuotePage
@@ -0,0 +1,22 @@
import ReportTitle from '@/components/report/ReportTitle'
import ReportCashFlowCard from '@/views/apps/report/cash-flow/ReportCashFlowCard'
import ReportCashFlowContent from '@/views/apps/report/cash-flow/ReportCashFlowContent'
import Grid from '@mui/material/Grid2'
const CashFlowPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<ReportTitle title='Arus Kas' />
</Grid>
<Grid size={{ xs: 12 }}>
<ReportCashFlowCard />
</Grid>
<Grid size={{ xs: 12 }}>
<ReportCashFlowContent />
</Grid>
</Grid>
)
}
export default CashFlowPage
@@ -0,0 +1,22 @@
import ReportTitle from '@/components/report/ReportTitle'
import ReportNeracaCard from '@/views/apps/report/neraca/ReportNeracaCard'
import ReportNeracaContent from '@/views/apps/report/neraca/ReportNeracaContent'
import Grid from '@mui/material/Grid2'
const NeracaPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<ReportTitle title='Neraca' />
</Grid>
<Grid size={{ xs: 12 }}>
<ReportNeracaCard />
</Grid>
<Grid size={{ xs: 12 }}>
<ReportNeracaContent />
</Grid>
</Grid>
)
}
export default NeracaPage
@@ -0,0 +1,7 @@
import ReportList from '@/views/apps/report'
const ReportPage = () => {
return <ReportList />
}
export default ReportPage
@@ -0,0 +1,22 @@
import ReportTitle from '@/components/report/ReportTitle'
import ReportProfitLossCard from '@/views/apps/report/profit-loss/ReportProfitLossCard'
import ReportProfitLossContent from '@/views/apps/report/profit-loss/ReportProfitLossContent'
import Grid from '@mui/material/Grid2'
const ProfiltLossPage = () => {
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<ReportTitle title='Laba Rugi' />
</Grid>
<Grid size={{ xs: 12 }}>
<ReportProfitLossCard />
</Grid>
<Grid size={{ xs: 12 }}>
<ReportProfitLossContent />
</Grid>
</Grid>
)
}
export default ProfiltLossPage
@@ -0,0 +1,86 @@
'use client'
import Grid from '@mui/material/Grid2'
import { TextField, Typography, useTheme } from '@mui/material'
import { useState } from 'react'
import { formatDateDDMMYYYY, formatForInputDate } from '@/utils/transform'
import SalesOverviewRight from '@/views/apps/sales/overview/overview-right'
import SalesOverviewLeft from '@/views/apps/sales/overview/overview-left'
const SalesOverviewPage = () => {
const theme = useTheme()
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
return (
<>
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<div className='flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Overview Penjualan
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(today || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<Typography>-</Typography>
<TextField
type='date'
value={today}
onChange={e => {}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
</div>
</Grid>
</Grid>
<Grid container spacing={6} className='mt-5'>
<Grid size={{ xs: 12, lg: 8, md: 7 }}>
<SalesOverviewRight />
</Grid>
<Grid size={{ xs: 12, lg: 4, md: 5 }}>
<SalesOverviewLeft />
</Grid>
</Grid>
</>
)
}
export default SalesOverviewPage
@@ -0,0 +1,7 @@
import SalesBillList from '@/views/apps/sales/sales-bill/list'
const SalesBillPage = () => {
return <SalesBillList />
}
export default SalesBillPage
@@ -0,0 +1,7 @@
import SalesDeliveryListTable from '@/views/apps/sales/sales-deliveries/list/SalesDeliveryListTable'
const SalesDeliveryPage = () => {
return <SalesDeliveryListTable />
}
export default SalesDeliveryPage
@@ -0,0 +1,7 @@
import SalesOrderList from '@/views/apps/sales/sales-orders/list'
const SalesOrdersPage = () => {
return <SalesOrderList />
}
export default SalesOrdersPage
@@ -0,0 +1,7 @@
import SalesQuoteList from '@/views/apps/sales/sales-quote/list'
const SalesQuotePage = () => {
return <SalesQuoteList />
}
export default SalesQuotePage
@@ -0,0 +1,7 @@
import VendorView from '@/views/apps/vendor/detail'
const VendorViewPage = async () => {
return <VendorView />
}
export default VendorViewPage
@@ -0,0 +1,8 @@
import { vendorDummyData } from '@/data/dummy/vendor'
import VendorList from '@/views/apps/vendor/list'
const VendorListTablePage = async () => {
return <VendorList vendorData={vendorDummyData} />
}
export default VendorListTablePage
@@ -4,16 +4,38 @@ import {
useProductSalesAnalytics,
useProfitLossAnalytics,
useSalesAnalytics,
usePaymentAnalytics
usePaymentAnalytics,
useCategoryAnalytics
} from '@/services/queries/analytics'
import { useOutletById } from '@/services/queries/outlets'
import { generateExcel } from '@/utils/excelGenerator'
import { generatePDF } from '@/utils/pdfGenerator'
import { formatCurrency, formatDate, formatDateDDMMYYYY, formatDatetime } from '@/utils/transform'
import ReportGeneratorComponent from '@/views/dashboards/daily-report/report-generator'
import ReportHeader from '@/views/dashboards/daily-report/report-header'
import React, { useEffect, useRef, useState } from 'react'
// Dummy HPP values — ganti dengan data real nantinya
const DUMMY_STD_HPP = 30 // % — ganti dengan data real nantinya
const DUMMY_REAL_HPP = 0 // % — ganti dengan kalkulasi real nantinya
const getHppStatus = (stdHpp: number, realHpp: number): 'Sehat' | 'Tidak Sehat' =>
realHpp <= stdHpp ? 'Sehat' : 'Tidak Sehat'
const StatusBadge = ({ status }: { status: 'Sehat' | 'Tidak Sehat' }) => (
<span
className={`inline-block px-3 py-1 rounded-full text-base font-bold ${
status === 'Sehat' ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
}`}
>
{status}
</span>
)
const DailyPOSReport = () => {
const reportRef = useRef<HTMLElement | null>(null)
const reportRef = useRef<HTMLDivElement | null>(null)
const [isGeneratingExcel, setIsGeneratingExcel] = useState(false)
const [now, setNow] = useState(new Date())
const [selectedDate, setSelectedDate] = useState(new Date())
@@ -21,9 +43,28 @@ const DailyPOSReport = () => {
startDate: new Date(),
endDate: new Date()
})
const [filterType, setFilterType] = useState('single') // 'single' or 'range'
const [filterType, setFilterType] = useState<'single' | 'range'>('single')
const [isGeneratingPDF, setIsGeneratingPDF] = useState(false)
// PDF Font Size Configuration
const PDF_FONT_SIZES = {
heading: 18,
subheading: 16,
tableContent: 12,
tableHeader: 12,
tableFooter: 12,
grandTotal: 14,
footer: 11
}
// PDF Spacing Configuration
const PDF_SPACING = {
cellPadding: 5,
cellPaddingLarge: 6,
sectionGap: 20,
headerGap: 15
}
// Use selectedDate for single date filter, or dateRange for range filter
const getDateParams = () => {
if (filterType === 'single') {
return {
@@ -40,11 +81,19 @@ const DailyPOSReport = () => {
const dateParams = getDateParams()
const today = new Date()
const sevenDaysAgo = new Date()
sevenDaysAgo.setDate(today.getDate() - 7)
const { data: outlet } = useOutletById()
const { data: sales } = useSalesAnalytics(dateParams)
const { data: profitLoss7Days } = useProfitLossAnalytics({
date_from: formatDateDDMMYYYY(sevenDaysAgo),
date_to: formatDateDDMMYYYY(today)
})
const { data: profitLoss } = useProfitLossAnalytics(dateParams)
const { data: products } = useProductSalesAnalytics(dateParams)
const { data: paymentAnalytics } = usePaymentAnalytics(dateParams)
const { data: category } = useCategoryAnalytics(dateParams)
const productSummary = {
totalQuantitySold: products?.data?.reduce((sum, item) => sum + (item?.quantity_sold || 0), 0) || 0,
@@ -52,24 +101,21 @@ const DailyPOSReport = () => {
totalOrders: products?.data?.reduce((sum, item) => sum + (item?.order_count || 0), 0) || 0
}
// Calculate profit loss product summary
const profitLossProductSummary = {
totalRevenue: profitLoss?.product_data?.reduce((sum, item) => sum + (item?.revenue || 0), 0) || 0,
totalCost: profitLoss?.product_data?.reduce((sum, item) => sum + (item?.cost || 0), 0) || 0,
totalGrossProfit: profitLoss?.product_data?.reduce((sum, item) => sum + (item?.gross_profit || 0), 0) || 0,
totalQuantity: profitLoss?.product_data?.reduce((sum, item) => sum + (item?.quantity_sold || 0), 0) || 0
const categorySummary = {
totalRevenue: category?.data?.reduce((sum, item) => sum + (item?.total_revenue || 0), 0) || 0,
orderCount: category?.data?.reduce((sum, item) => sum + (item?.order_count || 0), 0) || 0,
productCount: category?.data?.reduce((sum, item) => sum + (item?.product_count || 0), 0) || 0,
totalQuantity: category?.data?.reduce((sum, item) => sum + (item?.total_quantity || 0), 0) || 0
}
useEffect(() => {
setNow(new Date())
}, [])
// Format date for input field (YYYY-MM-DD)
const formatDateForInput = (date: Date) => {
return date.toISOString().split('T')[0]
}
// Get display text for the report period
const getReportPeriodText = () => {
if (filterType === 'single') {
return `${formatDateDDMMYYYY(selectedDate)} - ${formatDateDDMMYYYY(selectedDate)}`
@@ -78,98 +124,107 @@ const DailyPOSReport = () => {
}
}
// Get report title based on filter type
const getReportTitle = () => {
if (filterType === 'single') {
return 'Laporan Transaksi'
} else {
const daysDiff = Math.ceil((dateRange.endDate.getTime() - dateRange.startDate.getTime()) / (1000 * 3600 * 24)) + 1
// return `Laporan Transaksi ${daysDiff} Hari`
return `Laporan Transaksi`
}
return 'Laporan Transaksi'
}
const handleGeneratePDF = async () => {
const reportElement = reportRef.current
setIsGeneratingPDF(true)
try {
// Import jsPDF dan html2canvas
const jsPDF = (await import('jspdf')).default
const html2canvas = (await import('html2canvas')).default
// Optimized canvas capture dengan scale lebih rendah
const canvas = await html2canvas(reportElement!, {
scale: 1.5, // Reduced from 2 to 1.5
useCORS: true,
allowTaint: true,
backgroundColor: '#ffffff',
logging: false, // Disable logging for performance
removeContainer: true, // Clean up after capture
imageTimeout: 0, // No timeout for image loading
height: reportElement!.scrollHeight,
width: reportElement!.scrollWidth
await generatePDF({
reportRef,
outlet,
profitLoss,
products,
paymentAnalytics,
category,
productSummary,
categorySummary,
filterType,
selectedDate,
dateRange,
now
})
// Compress canvas using JPEG with quality setting
const imgData = canvas.toDataURL('image/jpeg', 0.85) // JPEG with 85% quality instead of PNG
// Create PDF with compression
const pdf = new jsPDF({
orientation: 'portrait',
unit: 'mm',
format: 'a4',
compress: true // Enable built-in compression
})
const imgWidth = 210
const pageHeight = 295
const imgHeight = (canvas.height * imgWidth) / canvas.width
let heightLeft = imgHeight
let position = 0
// Add first page with compressed image
pdf.addImage(imgData, 'JPEG', 0, position, imgWidth, imgHeight, '', 'FAST') // Use FAST compression
heightLeft -= pageHeight
// Handle multiple pages if needed
while (heightLeft >= 0) {
position = heightLeft - imgHeight
pdf.addPage()
pdf.addImage(imgData, 'JPEG', 0, position, imgWidth, imgHeight, '', 'FAST')
heightLeft -= pageHeight
}
// Additional compression options
pdf.setProperties({
title: `${getReportTitle()}`,
subject: 'Daily Transaction Report',
author: 'Apskel POS System',
creator: 'Apskel'
})
// Save with optimized settings
const fileName =
filterType === 'single'
? `laporan-transaksi-${formatDateForInput(selectedDate)}.pdf`
: `laporan-transaksi-${formatDateForInput(dateRange.startDate)}-to-${formatDateForInput(dateRange.endDate)}.pdf`
pdf.save(fileName, {
returnPromise: true
})
// Clean up canvas to free memory
canvas.width = canvas.height = 0
} catch (error) {
console.error('Error generating PDF:', error)
alert('Terjadi kesalahan saat membuat PDF. Pastikan jsPDF dan html2canvas sudah terinstall.')
alert(`Terjadi kesalahan saat membuat PDF: ${error}`)
} finally {
setIsGeneratingPDF(false)
}
}
const handleGenerateExcel = async () => {
setIsGeneratingExcel(true)
try {
await generateExcel({
outlet,
profitLoss,
products,
paymentAnalytics,
category,
productSummary,
categorySummary,
filterType,
selectedDate,
dateRange
})
} catch (error) {
console.error('Error generating Excel:', error)
alert(`Terjadi kesalahan saat membuat Excel: ${error}`)
} finally {
setIsGeneratingExcel(false)
}
}
const LoadingOverlay = ({ isVisible, message = 'Generating PDF...' }: { isVisible: boolean; message?: string }) => {
if (!isVisible) return null
return (
<div className='fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50 backdrop-blur-sm'>
<div className='bg-white rounded-lg shadow-xl p-8 max-w-sm w-full mx-4'>
<div className='text-center'>
<div className='inline-block animate-spin rounded-full h-12 w-12 border-4 border-gray-200 border-t-purple-600 mb-4'></div>
<h3 className='text-lg font-semibold text-gray-800 mb-2'>{message}</h3>
<p className='text-sm text-gray-600'>Mohon tunggu, proses ini mungkin membutuhkan beberapa detik...</p>
<div className='mt-6 space-y-2'>
<div className='flex items-center text-xs text-gray-500'>
<div className='w-2 h-2 bg-green-500 rounded-full mr-2 flex-shrink-0'></div>
<span>Capturing report content</span>
</div>
<div className='flex items-center text-xs text-gray-500'>
<div className='w-2 h-2 bg-blue-500 rounded-full mr-2 flex-shrink-0 animate-pulse'></div>
<span>Processing pages</span>
</div>
<div className='flex items-center text-xs text-gray-500'>
<div className='w-2 h-2 bg-gray-300 rounded-full mr-2 flex-shrink-0'></div>
<span>Finalizing PDF</span>
</div>
</div>
</div>
</div>
</div>
)
}
// Group products by category
const groupedProducts =
products?.data?.reduce(
(acc, item) => {
const categoryName = item.category_name || 'Tidak Berkategori'
if (!acc[categoryName]) {
acc[categoryName] = []
}
acc[categoryName].push(item)
return acc
},
{} as Record<string, any[]>
) || {}
return (
<div className='min-h-screen'>
{/* Control Panel */}
<LoadingOverlay isVisible={isGeneratingPDF} message='Membuat PDF Laporan...' />
<ReportGeneratorComponent
// Props wajib
reportTitle='Laporan Penjualan'
filterType={filterType}
selectedDate={selectedDate}
@@ -178,161 +233,99 @@ const DailyPOSReport = () => {
onSingleDateChange={setSelectedDate}
onDateRangeChange={setDateRange}
onGeneratePDF={handleGeneratePDF}
// Props opsional
// isGenerating={isGenerating}
// customQuickActions={customQuickActions}
// labels={customLabels}
onGenerateExcel={handleGenerateExcel}
isGeneratingExcel={isGeneratingExcel}
/>
{/* Report Template */}
<div ref={reportRef} className='max-w-4xl mx-auto bg-white min-h-[297mm]' style={{ width: '210mm' }}>
{/* Header */}
<ReportHeader
outlet={outlet}
reportTitle={getReportTitle()}
reportSubtitle='Laporan Bulanan'
brandName='Apskel'
brandColor='#36175e'
periode={getReportPeriodText()}
/>
{/* Wrap header in a section for easy capture */}
<div className='report-header-section'>
<ReportHeader
outlet={outlet}
reportTitle={getReportTitle()}
reportSubtitle='Laporan Bulanan'
brandName='Apskel'
brandColor='#36175e'
periode={getReportPeriodText()}
/>
</div>
{/* Performance Summary */}
<div className='p-8'>
<h3 className='text-xl font-bold mb-6' style={{ color: '#36175e' }}>
1. Ringkasan Kinerja
<h3 className='text-3xl font-bold mb-8' style={{ color: '#36175e' }}>
Ringkasan
</h3>
<div className='grid grid-cols-2 gap-6'>
<div className='space-y-4'>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>TOTAL PENJUALAN (termasuk rasik)</span>
<span className='font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_revenue ?? 0)}
</span>
</div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Total Terjual</span>
<span className='font-semibold text-gray-800'>{productSummary.totalQuantitySold}</span>
</div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>HPP</span>
<span className='font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_cost ?? 0)} |{' '}
{(((profitLoss?.summary.total_cost ?? 0) / (profitLoss?.summary.total_revenue || 1)) * 100).toFixed(
0
)}
%
</span>
</div>
<div className='flex justify-between items-center py-2 border-b-2 border-gray-300'>
<span className='text-lg font-semibold text-green-800'>Laba Kotor</span>
<span className='text-lg font-bold text-green-800'>
{formatCurrency(profitLoss?.summary.gross_profit ?? 0)} |{' '}
{(profitLoss?.summary.gross_profit_margin ?? 0).toFixed(0)}%
</span>
</div>
<div className='space-y-5'>
<div className='flex justify-between items-center py-3 border-b border-gray-200'>
<span className='text-xl text-gray-700'>Total Penjualan</span>
<span className='text-xl font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_revenue ?? 0)}
</span>
</div>
<div className='space-y-4'>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Biaya lain²</span>
<span className='font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_tax ?? 0)} |{' '}
{(((profitLoss?.summary.total_tax ?? 0) / (profitLoss?.summary.total_revenue || 1)) * 100).toFixed(0)}
%
</span>
</div>
<div className='flex justify-between items-center py-2 border-b-2 border-gray-300'>
<span className='text-lg font-bold text-blue-800'>Laba/Rugi</span>
<span className='text-lg font-bold text-blue-800'>
{formatCurrency(profitLoss?.summary.net_profit ?? 0)} |{' '}
{(profitLoss?.summary.net_profit_margin ?? 0).toFixed(0)}%
</span>
</div>
<div className='flex justify-between items-center py-3 border-b border-gray-200'>
<span className='text-xl text-gray-700'>Total Diskon</span>
<span className='text-xl font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_discount ?? 0)}
</span>
</div>
<div className='flex justify-between items-center py-3 border-b border-gray-200'>
<span className='text-xl text-gray-700'>Total Pajak</span>
<span className='text-xl font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_tax ?? 0)}
</span>
</div>
<div className='flex justify-between items-center py-3 border-b border-gray-200'>
<span className='text-xl text-gray-700'>Service Charge</span>
<span className='text-xl font-semibold text-gray-800'>{formatCurrency(0)}</span>
</div>
<div className='flex justify-between items-center py-3 border-b-2 border-gray-300'>
<span className='text-xl text-gray-700 font-bold'>Total</span>
<span className='text-xl font-bold text-gray-800'>
{formatCurrency(profitLoss?.summary.total_revenue ?? 0)}
</span>
</div>
</div>
</div>
{/* Profit Loss Product Table */}
{/* Invoice */}
<div className='px-8 pb-8'>
<h3 className='text-lg font-medium mb-6' style={{ color: '#36175e' }}>
Laba Rugi Per Produk
<h3 className='text-3xl font-bold mb-8' style={{ color: '#36175e' }}>
Invoice
</h3>
<div className='bg-gray-50 rounded-lg border border-gray-200 overflow-hidden'>
<table className='w-full'>
<thead>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<th className='text-left p-3 font-semibold'>Produk</th>
<th className='text-center p-3 font-semibold'>Qty</th>
<th className='text-right p-3 font-semibold'>Pendapatan</th>
<th className='text-right p-3 font-semibold'>HPP</th>
<th className='text-right p-3 font-semibold'>Laba Kotor</th>
<th className='text-center p-3 font-semibold'>Margin (%)</th>
</tr>
</thead>
<tbody>
{profitLoss?.product_data?.map((item, index) => (
<tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
<td className='p-3 font-medium text-gray-800'>{item.product_name}</td>
<td className='p-3 text-center text-gray-700'>{item.quantity_sold}</td>
<td className='p-3 text-right font-semibold text-gray-800'>{formatCurrency(item.revenue)}</td>
<td className='p-3 text-right font-semibold text-red-600'>{formatCurrency(item.cost)}</td>
<td className='p-3 text-right font-semibold text-green-600'>{formatCurrency(item.gross_profit)}</td>
<td className='p-3 text-center font-semibold' style={{ color: '#36175e' }}>
{(item.gross_profit_margin ?? 0).toFixed(1)}%
</td>
</tr>
)) || []}
</tbody>
<tfoot>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<td className='p-3 font-bold'>TOTAL</td>
<td className='p-3 text-center font-bold'>{profitLossProductSummary.totalQuantity}</td>
<td className='p-3 text-right font-bold'>{formatCurrency(profitLossProductSummary.totalRevenue)}</td>
<td className='p-3 text-right font-bold'>{formatCurrency(profitLossProductSummary.totalCost)}</td>
<td className='p-3 text-right font-bold'>
{formatCurrency(profitLossProductSummary.totalGrossProfit)}
</td>
<td className='p-3 text-center font-bold'>
{profitLossProductSummary.totalRevenue > 0
? (
(profitLossProductSummary.totalGrossProfit / profitLossProductSummary.totalRevenue) *
100
).toFixed(1)
: 0}
%
</td>
</tr>
</tfoot>
</table>
<div className='space-y-5'>
<div className='flex justify-between items-center py-3 border-b border-gray-200'>
<span className='text-xl text-gray-700'>Total Invoice</span>
<span className='text-xl font-semibold text-gray-800'>{profitLoss?.summary.total_orders ?? 0}</span>
</div>
</div>
</div>
{/* Payment Method Summary */}
<div className='px-8 pb-8'>
<h3 className='text-xl font-bold mb-6' style={{ color: '#36175e' }}>
2. Ringkasan Metode Pembayaran
<h3 className='text-3xl font-bold mb-8' style={{ color: '#36175e' }}>
Ringkasan Metode Pembayaran
</h3>
<div className='bg-gray-50 rounded-lg border border-gray-200 overflow-hidden'>
<table className='w-full'>
<thead>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<th className='text-left p-3 font-semibold'>Metode Pembayaran</th>
<th className='text-center p-3 font-semibold'>Tipe</th>
<th className='text-center p-3 font-semibold'>Jumlah Order</th>
<th className='text-right p-3 font-semibold'>Total Amount</th>
<th className='text-center p-3 font-semibold'>Persentase</th>
<tr className='text-gray-800 border-b-2 border-gray-300'>
<th className='text-left text-xl p-4 font-semibold'>Metode Pembayaran</th>
<th className='text-center text-xl p-4 font-semibold'>Tipe</th>
<th className='text-center text-xl p-4 font-semibold'>Jumlah Order</th>
<th className='text-right text-xl p-4 font-semibold'>Total Amount</th>
<th className='text-center text-xl p-4 font-semibold'>Persentase</th>
</tr>
</thead>
<tbody>
{paymentAnalytics?.data?.map((payment, index) => (
<tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
<td className='p-3 font-medium text-gray-800'>{payment.payment_method_name}</td>
<td className='p-3 text-center'>
<td className='p-4 text-xl font-medium text-gray-800'>{payment.payment_method_name}</td>
<td className='p-4 text-center'>
<span
className={`px-2 py-1 rounded-full text-xs font-medium ${
className={`px-3 py-1 rounded-full text-lg font-medium ${
payment.payment_method_type === 'cash'
? 'bg-green-100 text-green-800'
: 'bg-blue-100 text-blue-800'
@@ -341,80 +334,240 @@ const DailyPOSReport = () => {
{payment.payment_method_type.toUpperCase()}
</span>
</td>
<td className='p-3 text-center text-gray-700'>{payment.order_count}</td>
<td className='p-3 text-right font-semibold text-gray-800'>
<td className='p-4 text-xl text-center text-gray-700'>{payment.order_count}</td>
<td className='p-4 text-xl text-right font-semibold text-gray-800'>
{formatCurrency(payment.total_amount)}
</td>
<td className='p-3 text-center font-medium' style={{ color: '#36175e' }}>
<td className='p-4 text-xl text-center font-medium' style={{ color: '#36175e' }}>
{(payment.percentage ?? 0).toFixed(1)}%
</td>
</tr>
)) || []}
</tbody>
<tfoot>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<td className='p-3 font-bold'>TOTAL</td>
<td className='p-3'></td>
<td className='p-3 text-center font-bold'>{paymentAnalytics?.summary.total_orders ?? 0}</td>
<td className='p-3 text-right font-bold'>
<tr className='text-gray-800 border-t-2 border-gray-300'>
<td className='p-4 text-xl font-bold'>TOTAL</td>
<td className='p-4'></td>
<td className='p-4 text-xl text-center font-bold'>{paymentAnalytics?.summary.total_orders ?? 0}</td>
<td className='p-4 text-xl text-right font-bold'>
{formatCurrency(paymentAnalytics?.summary.total_amount ?? 0)}
</td>
<td className='p-3 text-center font-bold'>100.0%</td>
<td className='p-4 text-center font-bold'></td>
</tr>
</tfoot>
</table>
</div>
</div>
{/* Transaction Summary */}
{/* Category Summary — +3 kolom baru */}
<div className='px-8 pb-8'>
<h3 className='text-xl font-bold mb-6' style={{ color: '#36175e' }}>
3. Ringkasan Transaksi
<h3 className='text-3xl font-bold mb-8' style={{ color: '#36175e' }}>
Ringkasan Kategori
</h3>
<div className='bg-gray-50 rounded-lg border border-gray-200 overflow-hidden'>
<table className='w-full'>
<thead>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<th className='text-left p-3 font-semibold'>Produk</th>
<th className='text-left p-3 font-semibold'>Kategori</th>
<th className='text-center p-3 font-semibold'>Qty</th>
<th className='text-right p-3 font-semibold'>Order</th>
<th className='text-right p-3 font-semibold'>Pendapatan</th>
<th className='text-right p-3 font-semibold'>Rata Rata</th>
<tr className='text-gray-800 border-b-2 border-gray-300'>
<th className='text-left text-xl p-4 font-semibold'>Nama</th>
<th className='text-center text-xl p-4 font-semibold'>Qty</th>
<th className='text-right text-xl p-4 font-semibold'>Pendapatan</th>
<th className='text-center text-xl p-4 font-semibold'>% Std HPP</th>
<th className='text-center text-xl p-4 font-semibold'>% Real HPP</th>
<th className='text-center text-xl p-4 font-semibold'>Status</th>
</tr>
</thead>
<tbody>
{products?.data?.map((item, index) => (
<tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
<td className='p-3 font-medium text-gray-800'>{item.product_name}</td>
<td className='p-3 font-medium text-gray-800'>{item.category_name}</td>
<td className='p-3 text-center text-gray-700'>{item.quantity_sold}</td>
<td className='p-3 text-center text-gray-700'>{item.order_count ?? 0}</td>
<td className='p-3 text-right font-semibold text-gray-800'>{formatCurrency(item.revenue)}</td>
<td className='p-3 text-right font-medium text-gray-800'>{formatCurrency(item.average_price)}</td>
</tr>
)) || []}
{category?.data?.map((c, index) => {
const stdHpp = DUMMY_STD_HPP
const realHpp = DUMMY_REAL_HPP
const status = getHppStatus(stdHpp, realHpp)
return (
<tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
<td className='p-4 text-xl font-medium text-gray-800'>{c.category_name}</td>
<td className='p-4 text-xl text-center text-gray-700'>{c.total_quantity}</td>
<td className='p-4 text-xl text-right font-semibold' style={{ color: '#36175e' }}>
{formatCurrency(c.total_revenue)}
</td>
<td className='p-4 text-xl text-center text-gray-700'>{stdHpp}%</td>
<td className='p-4 text-xl text-center text-gray-700'>{realHpp}%</td>
<td className='p-4 text-center'>
<StatusBadge status={status} />
</td>
</tr>
)
}) || []}
</tbody>
<tfoot>
<tr style={{ backgroundColor: '#36175e' }} className='text-white'>
<td className='p-3 font-bold'>TOTAL</td>
<td className='p-3 text-center'></td>
<td className='p-3 text-center font-bold'>{productSummary.totalQuantitySold ?? 0}</td>
<td className='p-3 text-right font-bold'>{productSummary.totalOrders ?? 0}</td>
<td className='p-3 text-right font-bold'>{formatCurrency(productSummary.totalRevenue ?? 0)}</td>
<td className='p-3 text-right font-bold'></td>
<tr className='text-gray-800 border-t-2 border-gray-300'>
<td className='p-4 text-xl font-bold'>TOTAL</td>
<td className='p-4 text-xl text-center font-bold'>{categorySummary?.totalQuantity ?? 0}</td>
<td className='p-4 text-xl text-right font-bold'>
{formatCurrency(categorySummary?.totalRevenue ?? 0)}
</td>
<td className='p-4'></td>
<td className='p-4'></td>
<td className='p-4'></td>
</tr>
</tfoot>
</table>
</div>
</div>
{/* Profit Loss Product Table */}
{/* Product Summary — +3 kolom baru */}
<div className='px-8 pb-8'>
<h3 className='text-3xl font-bold mb-8' style={{ color: '#36175e' }}>
Ringkasan Item Per Kategori
</h3>
<div className='space-y-12'>
{Object.keys(groupedProducts)
.sort((a, b) => {
const productsA = groupedProducts[a]
const productsB = groupedProducts[b]
const orderA = productsA[0]?.category_order ?? 999
const orderB = productsB[0]?.category_order ?? 999
return orderA - orderB
})
.map((categoryName, catIndex) => {
const categoryProducts = groupedProducts[categoryName].sort((a, b) => {
const skuA = a.product_sku || ''
const skuB = b.product_sku || ''
return skuA.localeCompare(skuB)
})
const categoryTotalQty = categoryProducts.reduce((sum, item) => sum + (item.quantity_sold || 0), 0)
const categoryTotalRevenue = categoryProducts.reduce((sum, item) => sum + (item.revenue || 0), 0)
return (
<div key={categoryName} style={{ display: 'block', marginBottom: '70px' }}>
<h4
className='text-2xl font-bold mb-0 px-4 py-4 bg-gray-100 rounded-t-lg'
style={{ color: '#36175e' }}
>
{categoryName.toUpperCase()}
</h4>
<div className='bg-gray-50 rounded-b-lg border-l-2 border-r-2 border-b-2 border-gray-300'>
<table
className='w-full'
style={{ borderCollapse: 'collapse', tableLayout: 'fixed', width: '100%' }}
>
<colgroup>
<col style={{ width: '28%' }} />
<col style={{ width: '10%' }} />
<col style={{ width: '22%' }} />
<col style={{ width: '13%' }} />
<col style={{ width: '13%' }} />
<col style={{ width: '14%' }} />
</colgroup>
<thead>
<tr className='text-gray-800 border-b-2 border-gray-300 bg-gray-100'>
<th className='text-left text-xl p-5 font-semibold border-r border-gray-300'>Produk</th>
<th className='text-center text-xl p-5 font-semibold border-r border-gray-300'>Qty</th>
<th className='text-right text-xl p-5 font-semibold border-r border-gray-300'>
Pendapatan
</th>
<th className='text-center text-xl p-5 font-semibold border-r border-gray-300'>
% Std HPP
</th>
<th className='text-center text-xl p-5 font-semibold border-r border-gray-300'>
% Real HPP
</th>
<th className='text-center text-xl p-5 font-semibold'>Status</th>
</tr>
</thead>
<tbody>
{categoryProducts.map((item, index) => {
const stdHpp = DUMMY_STD_HPP
const realHpp = DUMMY_REAL_HPP
const status = getHppStatus(stdHpp, realHpp)
return (
<tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
<td className='p-5 text-xl font-medium text-gray-800 border-r border-gray-200'>
{item.product_name}
</td>
<td className='p-5 text-xl text-center text-gray-700 border-r border-gray-200'>
{item.quantity_sold}
</td>
<td className='p-5 text-xl text-right font-semibold text-gray-800 border-r border-gray-200'>
{formatCurrency(item.revenue)}
</td>
<td className='p-5 text-xl text-center text-gray-700 border-r border-gray-200'>
{stdHpp}%
</td>
<td className='p-5 text-xl text-center text-gray-700 border-r border-gray-200'>
{realHpp}%
</td>
<td className='p-5 text-center'>
<StatusBadge status={status} />
</td>
</tr>
)
})}
</tbody>
<tfoot>
<tr className='bg-gray-200 border-t-2 border-gray-400'>
<td className='p-5 text-xl font-bold text-gray-800 border-r border-gray-400'>
Subtotal {categoryName}
</td>
<td className='p-5 text-xl text-center font-bold text-gray-800 border-r border-gray-400'>
{categoryTotalQty}
</td>
<td className='p-5 text-xl text-right font-bold text-gray-800 border-r border-gray-400'>
{formatCurrency(categoryTotalRevenue)}
</td>
<td className='p-5 border-r border-gray-400'></td>
<td className='p-5 border-r border-gray-400'></td>
<td className='p-5'></td>
</tr>
</tfoot>
</table>
</div>
</div>
)
})}
{/* Grand Total */}
<div className='bg-purple-50 rounded-lg border-2 border-purple-300 mt-6'>
<table className='w-full' style={{ borderCollapse: 'collapse', tableLayout: 'fixed' }}>
<colgroup>
<col style={{ width: '28%' }} />
<col style={{ width: '10%' }} />
<col style={{ width: '22%' }} />
<col style={{ width: '13%' }} />
<col style={{ width: '13%' }} />
<col style={{ width: '14%' }} />
</colgroup>
<tfoot>
<tr className='text-gray-800'>
<td className='p-5 text-2xl font-bold border-r-2 border-purple-300' style={{ color: '#36175e' }}>
TOTAL KESELURUHAN
</td>
<td
className='p-5 text-2xl text-center font-bold border-r-2 border-purple-300'
style={{ color: '#36175e' }}
>
{productSummary.totalQuantitySold ?? 0}
</td>
<td
className='p-5 text-2xl text-right font-bold border-r-2 border-purple-300'
style={{ color: '#36175e' }}
>
{formatCurrency(productSummary.totalRevenue ?? 0)}
</td>
<td className='p-5 border-r-2 border-purple-300'></td>
<td className='p-5 border-r-2 border-purple-300'></td>
<td className='p-5'></td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
{/* Footer */}
<div className='px-8 py-6 border-t-2 border-gray-200 mt-8'>
<div className='flex justify-between items-center text-sm text-gray-600'>
<div className='flex justify-between items-center text-base text-gray-600'>
<p>© 2025 Apskel - Sistem POS Terpadu</p>
<p></p>
<p>Dicetak pada: {now.toLocaleDateString('id-ID')}</p>
@@ -7,18 +7,87 @@ import Grid from '@mui/material/Grid2'
import DistributedBarChartOrder from '@views/dashboards/crm/DistributedBarChartOrder'
// Server Action Imports
import { TextField, Typography, useTheme } from '@mui/material'
import { useState } from 'react'
import Loading from '../../../../../../components/layout/shared/Loading'
import { useSalesAnalytics } from '../../../../../../services/queries/analytics'
import { RecentSale } from '../../../../../../types/services/analytic'
import { formatDateDDMMYYYY, formatForInputDate } from '../../../../../../utils/transform'
import OrdersReport from '../../../../../../views/dashboards/orders/OrdersReport'
const DashboardOrder = () => {
const { data, isLoading } = useSalesAnalytics()
const theme = useTheme()
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
const { data, isLoading } = useSalesAnalytics({
date_from: filter.date_from,
date_to: filter.date_to
})
if (isLoading) return <Loading />
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<div className='flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Orders Analysis Dashboard
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(data?.date_from || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<Typography>-</Typography>
<TextField
type='date'
value={
data?.date_to
? new Date(data?.date_to).toISOString().split('T')[0]
: new Date().toISOString().split('T')[0]
}
onChange={e => {}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
</div>
</Grid>
<Grid size={{ xs: 12, sm: 6, md: 4, lg: 3 }}>
<DistributedBarChartOrder
isLoading={isLoading}
@@ -1,18 +1,36 @@
'use client'
import React from 'react'
import { useDashboardAnalytics } from '../../../../../../services/queries/analytics'
import { TextField, Typography, useTheme } from '@mui/material'
import { useState } from 'react'
import Loading from '../../../../../../components/layout/shared/Loading'
import { formatCurrency, formatDate, formatShortCurrency } from '../../../../../../utils/transform'
import ProductSales from '../../../../../../views/dashboards/products/ProductSales'
import PaymentMethodReport from '../../../../../../views/dashboards/payment-methods/PaymentMethodReport'
import { useDashboardAnalytics } from '../../../../../../services/queries/analytics'
import {
formatCurrency,
formatDateDDMMYYYY,
formatForInputDate,
formatShortCurrency
} from '../../../../../../utils/transform'
import OrdersReport from '../../../../../../views/dashboards/orders/OrdersReport'
import PaymentMethodReport from '../../../../../../views/dashboards/payment-methods/PaymentMethodReport'
import ProductSales from '../../../../../../views/dashboards/products/ProductSales'
const DashboardOverview = () => {
// Sample data - replace with your actual data
const { data: salesData, isLoading } = useDashboardAnalytics()
const theme = useTheme()
if (isLoading) return <Loading />
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
// Sample data - replace with your actual data
const { data: salesData, isLoading } = useDashboardAnalytics({
date_from: filter.date_from,
date_to: filter.date_to
})
const MetricCard = ({ iconClass, title, value, subtitle, bgColor = 'bg-blue-500', isCurrency = false }: any) => (
<div className='bg-white rounded-lg shadow-md hover:shadow-xl transition-shadow duration-300 p-6'>
@@ -29,70 +47,113 @@ const DashboardOverview = () => {
</div>
)
const ProgressBar = ({ percentage, color = 'bg-blue-500' }: any) => (
<div className='w-full bg-gray-200 rounded-full h-2'>
<div
className={`${color} h-2 rounded-full transition-all duration-300`}
style={{ width: `${percentage}%` }}
></div>
</div>
)
return (
<>
{salesData && (
<div>
{/* Header */}
{/* <div className="mb-8">
<h1 className="text-3xl font-bold text-gray-900 mb-2">Sales Dashboard</h1>
<p className="text-gray-600">
{formatDate(salesData.date_from)} - {formatDate(salesData.date_to)}
</p>
</div> */}
{/* Overview Metrics */}
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8'>
<MetricCard
iconClass='tabler-shopping-cart'
title='Total Orders'
value={salesData.overview.total_orders.toLocaleString()}
subtitle={`${salesData.overview.voided_orders} voided, ${salesData.overview.refunded_orders} refunded`}
bgColor='bg-blue-500'
<div>
{/* Header */}
<div className='mb-8 flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Analysis Dashboard
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(salesData?.date_from || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<MetricCard
iconClass='tabler-cash'
title='Total Sales'
value={formatShortCurrency(salesData.overview.total_sales)}
bgColor='bg-green-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-trending-up'
title='Average Order Value'
value={formatShortCurrency(salesData.overview.average_order_value)}
bgColor='bg-purple-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-users'
title='Total Customers'
value={salesData.overview.total_customers || 'N/A'}
bgColor='bg-orange-500'
<Typography>-</Typography>
<TextField
type='date'
value={
salesData?.date_to
? new Date(salesData?.date_to).toISOString().split('T')[0]
: new Date().toISOString().split('T')[0]
}
onChange={e => {
setFilter({
...filter,
date_to: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
<div className='grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8'>
{/* Top Products */}
<ProductSales title='Top Products' productData={salesData.top_products} />
{/* Payment Methods */}
<PaymentMethodReport payments={salesData.payment_methods} />
</div>
{/* Recent Sales */}
<OrdersReport title='Recent Sales' orderData={salesData.recent_sales} />
</div>
)}
{salesData ? (
<>
{/* Overview Metrics */}
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8'>
<MetricCard
iconClass='tabler-shopping-cart'
title='Total Orders'
value={salesData.overview.total_orders.toLocaleString()}
subtitle={`${salesData.overview.voided_orders} voided, ${salesData.overview.refunded_orders} refunded`}
bgColor='bg-blue-500'
/>
<MetricCard
iconClass='tabler-cash'
title='Total Sales'
value={formatCurrency(salesData.overview.total_sales)}
bgColor='bg-green-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-trending-up'
title='Average Order Value'
value={formatCurrency(salesData.overview.average_order_value)}
bgColor='bg-purple-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-users'
title='Total Customers'
value={salesData.overview.total_customers || 'N/A'}
bgColor='bg-orange-500'
/>
</div>
<div className='grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8'>
{/* Top Products */}
<ProductSales title='Top Products' productData={salesData.top_products} />
{/* Payment Methods */}
<PaymentMethodReport payments={salesData.payment_methods} />
</div>
{/* Recent Sales */}
<OrdersReport title='Recent Sales' orderData={salesData.recent_sales} />
</>
) : (
<Loading />
)}
</div>
</>
)
}
@@ -11,14 +11,82 @@ import Loading from '../../../../../../components/layout/shared/Loading'
import { usePaymentAnalytics } from '../../../../../../services/queries/analytics'
import { PaymentDataItem } from '../../../../../../types/services/analytic'
import PaymentMethodReport from '../../../../../../views/dashboards/payment-methods/PaymentMethodReport'
import { Typography, TextField, useTheme } from '@mui/material'
import { useState } from 'react'
import { formatDateDDMMYYYY, formatForInputDate } from '../../../../../../utils/transform'
const DashboardPayment = () => {
const { data, isLoading } = usePaymentAnalytics()
const theme = useTheme()
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
const { data, isLoading } = usePaymentAnalytics({
date_from: filter.date_from,
date_to: filter.date_to
})
if (isLoading) return <Loading />
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12 }}>
<div className='flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Payments Analysis Dashboard
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(data?.date_from || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<Typography>-</Typography>
<TextField
type='date'
value={
data?.date_to
? new Date(data?.date_to).toISOString().split('T')[0]
: new Date().toISOString().split('T')[0]
}
onChange={e => {}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
</div>
</Grid>
<Grid size={{ xs: 12, sm: 6, md: 4, lg: 3 }}>
<DistributedBarChartOrder
isLoading={isLoading}
@@ -4,51 +4,90 @@
import Grid from '@mui/material/Grid2'
// Component Imports
import DistributedBarChartOrder from '@views/dashboards/crm/DistributedBarChartOrder'
import EarningReportsWithTabs from '@views/dashboards/crm/EarningReportsWithTabs'
// Server Action Imports
import { TextField, Typography, useTheme } from '@mui/material'
import { useState } from 'react'
import Loading from '../../../../../../components/layout/shared/Loading'
import { useProductSalesAnalytics } from '../../../../../../services/queries/analytics'
import { formatDateDDMMYYYY, formatForInputDate } from '../../../../../../utils/transform'
import ProductSales from '../../../../../../views/dashboards/products/ProductSales'
const DashboardProduct = () => {
const { data, isLoading } = useProductSalesAnalytics()
const theme = useTheme()
const summary = {
totalProducts: data?.data.length,
totalQuantitySold: data?.data.reduce((sum, item) => sum + item.quantity_sold, 0),
totalRevenue: data?.data.reduce((sum, item) => sum + item.revenue, 0),
totalOrders: data?.data.reduce((sum, item) => sum + item.order_count, 0),
averageOrderValue: data?.data
? data!.data.reduce((sum, item) => sum + item.revenue, 0) /
data!.data.reduce((sum, item) => sum + item.order_count, 0)
: 0
}
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const formatDate = (dateString: any) => {
return new Date(dateString).toLocaleDateString('id-ID', {
month: 'short',
day: 'numeric'
})
}
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
const transformSalesData = (data: any) => {
return [
{
type: 'products',
avatarIcon: 'tabler-package',
date: data.map((d: any) => d.product_name),
series: [{ data: data.map((d: any) => d.revenue) }]
}
]
}
const { data, isLoading } = useProductSalesAnalytics({
date_from: filter.date_from,
date_to: filter.date_to
})
if (isLoading) return <Loading />
return (
<Grid container spacing={6}>
<Grid size={{ xs: 12, lg: 12 }}>{data?.data && <ProductSales title='Product Sales' productData={data.data} />}</Grid>
<Grid size={{ xs: 12, lg: 12 }}>
<div className='flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Products Analysis Dashboard
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(data?.date_from || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<Typography>-</Typography>
<TextField
type='date'
value={
data?.date_to
? new Date(data?.date_to).toISOString().split('T')[0]
: new Date().toISOString().split('T')[0]
}
onChange={e => {}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
</div>
</Grid>
<Grid size={{ xs: 12, lg: 12 }}>
{data?.data ? <ProductSales title='Product Sales' productData={data.data} /> : <Loading />}
</Grid>
</Grid>
)
}
@@ -1,14 +1,30 @@
'use client'
import React from 'react'
import React, { useState } from 'react'
import { useProfitLossAnalytics } from '../../../../../../services/queries/analytics'
import { formatShortCurrency } from '../../../../../../utils/transform'
import { formatDateDDMMYYYY, formatForInputDate, formatShortCurrency } from '../../../../../../utils/transform'
import MultipleSeries from '../../../../../../views/dashboards/profit-loss/EarningReportWithTabs'
import { DailyData, ProfitLossReport } from '../../../../../../types/services/analytic'
import { TextField, Typography, useTheme } from '@mui/material'
import Loading from '../../../../../../components/layout/shared/Loading'
const DashboardProfitloss = () => {
const theme = useTheme()
const today = new Date()
const monthAgo = new Date()
monthAgo.setDate(today.getDate() - 30)
const [filter, setFilter] = useState({
date_from: formatDateDDMMYYYY(monthAgo),
date_to: formatDateDDMMYYYY(today)
})
// Sample data - replace with your actual data
const { data: profitData, isLoading } = useProfitLossAnalytics()
const { data: profitData, isLoading } = useProfitLossAnalytics({
date_from: filter.date_from,
date_to: filter.date_to
})
const formatCurrency = (amount: any) => {
return new Intl.NumberFormat('id-ID', {
@@ -88,269 +104,319 @@ const DashboardProfitloss = () => {
return (
<>
{profitData && (
<div>
{/* Header */}
<div className='mb-8'>
<h1 className='text-3xl font-bold text-gray-900 mb-2'>Profit Analysis Dashboard</h1>
<p className='text-gray-600'>
{formatDate(profitData.date_from)} - {formatDate(profitData.date_to)}
</p>
</div>
{/* Summary Metrics */}
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8'>
<MetricCard
iconClass='tabler-currency-dollar'
title='Total Revenue'
value={formatShortCurrency(profitData.summary.total_revenue)}
bgColor='bg-green-500'
isCurrency={true}
<div>
{/* Header */}
<div className='mb-8 flex gap-4 items-center justify-between'>
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
Profit Analysis Dashboard
</Typography>
<div className='flex items-center gap-4'>
<TextField
type='date'
value={formatForInputDate(profitData?.date_from || new Date())}
onChange={e => {
setFilter({
...filter,
date_from: formatDateDDMMYYYY(new Date(e.target.value))
})
}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
<MetricCard
iconClass='tabler-receipt'
title='Total Cost'
value={formatShortCurrency(profitData.summary.total_cost)}
bgColor='bg-red-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-trending-up'
title='Gross Profit'
value={formatShortCurrency(profitData.summary.gross_profit)}
subtitle={`Margin: ${formatPercentage(profitData.summary.gross_profit_margin)}`}
bgColor='bg-blue-500'
isNegative={profitData.summary.gross_profit < 0}
isCurrency={true}
/>
<MetricCard
iconClass='tabler-percentage'
title='Profitability Ratio'
value={formatPercentage(profitData.summary.profitability_ratio)}
subtitle={`Avg Profit: ${formatShortCurrency(profitData.summary.average_profit)}`}
bgColor='bg-purple-500'
<Typography>-</Typography>
<TextField
type='date'
value={
profitData?.date_to
? new Date(profitData?.date_to).toISOString().split('T')[0]
: new Date().toISOString().split('T')[0]
}
onChange={e => {}}
size='small'
sx={{
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}}
/>
</div>
</div>
{/* Additional Summary Metrics */}
<div className='grid grid-cols-1 md:grid-cols-3 gap-6 mb-8'>
<div className='bg-white rounded-lg shadow-md p-6'>
<div className='flex items-center mb-4'>
<i className='tabler-wallet text-[24px] text-green-600 mr-2'></i>
<h3 className='text-lg font-semibold text-gray-900'>Net Profit</h3>
</div>
<p className='text-3xl font-bold text-green-600 mb-2'>
Rp {formatShortCurrency(profitData.summary.net_profit)}
</p>
<p className='text-sm text-gray-600'>Margin: {formatPercentage(profitData.summary.net_profit_margin)}</p>
{profitData ? (
<>
<div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8'>
<MetricCard
iconClass='tabler-currency-dollar'
title='Total Revenue'
value={formatCurrency(profitData.summary.total_revenue)}
bgColor='bg-green-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-receipt'
title='Total Cost'
value={formatCurrency(profitData.summary.total_cost)}
bgColor='bg-red-500'
isCurrency={true}
/>
<MetricCard
iconClass='tabler-trending-up'
title='Gross Profit'
value={formatCurrency(profitData.summary.gross_profit)}
subtitle={`Margin: ${formatPercentage(profitData.summary.gross_profit_margin)}`}
bgColor='bg-blue-500'
isNegative={profitData.summary.gross_profit < 0}
isCurrency={true}
/>
<MetricCard
iconClass='tabler-percentage'
title='Profitability Ratio'
value={formatPercentage(profitData.summary.profitability_ratio)}
subtitle={`Avg Profit: ${formatCurrency(profitData.summary.average_profit)}`}
bgColor='bg-purple-500'
/>
</div>
<div className='bg-white rounded-lg shadow-md p-6'>
<div className='flex items-center mb-4'>
<i className='tabler-shopping-cart text-[24px] text-blue-600 mr-2'></i>
<h3 className='text-lg font-semibold text-gray-900'>Total Orders</h3>
</div>
<p className='text-3xl font-bold text-blue-600'>{profitData.summary.total_orders}</p>
</div>
<div className='bg-white rounded-lg shadow-md p-6'>
<div className='flex items-center mb-4'>
<i className='tabler-discount text-[24px] text-orange-600 mr-2'></i>
<h3 className='text-lg font-semibold text-gray-900'>Tax & Discount</h3>
</div>
<p className='text-xl font-bold text-orange-600 mb-1'>
Rp {formatShortCurrency(profitData.summary.total_tax + profitData.summary.total_discount)}
</p>
<p className='text-sm text-gray-600'>
Tax: {formatShortCurrency(profitData.summary.total_tax)} | Discount:{' '}
{formatShortCurrency(profitData.summary.total_discount)}
</p>
</div>
</div>
{/* Profit Chart */}
<div className='mb-8'>
<MultipleSeries data={transformMultipleData(profitData)} />
</div>
{/* Additional Summary Metrics */}
<div className='grid grid-cols-1 md:grid-cols-3 gap-6 mb-8'>
<div className='bg-white rounded-lg shadow-md p-6'>
<div className='flex items-center mb-4'>
<i className='tabler-wallet text-[24px] text-green-600 mr-2'></i>
<h3 className='text-lg font-semibold text-gray-900'>Net Profit</h3>
</div>
<p className='text-3xl font-bold text-green-600 mb-2'>
{formatCurrency(profitData.summary.net_profit)}
</p>
<p className='text-sm text-gray-600'>
Margin: {formatPercentage(profitData.summary.net_profit_margin)}
</p>
</div>
<div className='bg-white rounded-lg shadow-md p-6'>
<div className='flex items-center mb-4'>
<i className='tabler-shopping-cart text-[24px] text-blue-600 mr-2'></i>
<h3 className='text-lg font-semibold text-gray-900'>Total Orders</h3>
</div>
<p className='text-3xl font-bold text-blue-600'>{profitData.summary.total_orders}</p>
</div>
<div className='bg-white rounded-lg shadow-md p-6'>
<div className='flex items-center mb-4'>
<i className='tabler-discount text-[24px] text-orange-600 mr-2'></i>
<h3 className='text-lg font-semibold text-gray-900'>Tax & Discount</h3>
</div>
<p className='text-xl font-bold text-orange-600 mb-1'>
Rp {formatShortCurrency(profitData.summary.total_tax + profitData.summary.total_discount)}
</p>
<p className='text-sm text-gray-600'>
Tax: {formatShortCurrency(profitData.summary.total_tax)} | Discount:{' '}
{formatShortCurrency(profitData.summary.total_discount)}
</p>
</div>
</div>
<div className='grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8'>
{/* Daily Breakdown */}
{/* Profit Chart */}
<div className='mb-8'>
<MultipleSeries data={transformMultipleData(profitData)} />
</div>
<div className='grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8'>
{/* Daily Breakdown */}
<div className='bg-white rounded-lg shadow-md'>
<div className='p-6'>
<div className='flex items-center mb-6'>
<i className='tabler-calendar text-[24px] text-purple-500 mr-2'></i>
<h2 className='text-xl font-semibold text-gray-900'>Daily Breakdown</h2>
</div>
<div className='overflow-x-auto'>
<table className='min-w-full'>
<thead>
<tr className='bg-gray-50'>
<th className='px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase'>Date</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Revenue</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Cost</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Profit</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Margin</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Orders</th>
</tr>
</thead>
<tbody className='bg-white divide-y divide-gray-200'>
{profitData.data.map((day, index) => (
<tr key={index} className='hover:bg-gray-50'>
<td className='px-4 py-4 whitespace-nowrap text-sm font-medium text-gray-900'>
{formatDate(day.date)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{formatCurrency(day.revenue)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-red-600'>
{formatCurrency(day.cost)}
</td>
<td
className={`px-4 py-4 whitespace-nowrap text-right text-sm font-medium ${
day.gross_profit >= 0 ? 'text-green-600' : 'text-red-600'
}`}
>
{formatCurrency(day.gross_profit)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right'>
<span
className={`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${getProfitabilityColor(
day.gross_profit_margin
)}`}
>
{formatPercentage(day.gross_profit_margin)}
</span>
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{day.orders}
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
{/* Top Performing Products */}
<div className='bg-white rounded-lg shadow-md'>
<div className='p-6'>
<div className='flex items-center mb-6'>
<i className='tabler-trophy text-[24px] text-gold-500 mr-2'></i>
<h2 className='text-xl font-semibold text-gray-900'>Top Performers</h2>
</div>
<div className='space-y-4'>
{profitData.product_data
.sort((a, b) => b.gross_profit - a.gross_profit)
.slice(0, 5)
.map((product, index) => (
<div
key={product.product_id}
className='flex items-center justify-between p-4 bg-gray-50 rounded-lg'
>
<div className='flex items-center'>
<span
className={`w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold mr-3 ${
index === 0
? 'bg-yellow-500'
: index === 1
? 'bg-gray-400'
: index === 2
? 'bg-orange-500'
: 'bg-blue-500'
}`}
>
{index + 1}
</span>
<div>
<h3 className='font-medium text-gray-900'>{product.product_name}</h3>
<p className='text-sm text-gray-600'>{product.category_name}</p>
</div>
</div>
<div className='text-right'>
<p className={`font-bold ${product.gross_profit >= 0 ? 'text-green-600' : 'text-red-600'}`}>
{formatCurrency(product.gross_profit)}
</p>
<p className='text-xs text-gray-500'>{formatPercentage(product.gross_profit_margin)}</p>
</div>
</div>
))}
</div>
</div>
</div>
</div>
{/* Product Analysis Table */}
<div className='bg-white rounded-lg shadow-md'>
<div className='p-6'>
<div className='flex items-center mb-6'>
<i className='tabler-calendar text-[24px] text-purple-500 mr-2'></i>
<h2 className='text-xl font-semibold text-gray-900'>Daily Breakdown</h2>
<i className='tabler-package text-[24px] text-green-500 mr-2'></i>
<h2 className='text-xl font-semibold text-gray-900'>Product Analysis</h2>
</div>
<div className='overflow-x-auto'>
<table className='min-w-full'>
<thead>
<tr className='bg-gray-50'>
<th className='px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase'>Date</th>
<th className='px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase'>Product</th>
<th className='px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase'>Category</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Qty</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Revenue</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Cost</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Profit</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Margin</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Orders</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Per Unit</th>
</tr>
</thead>
<tbody className='bg-white divide-y divide-gray-200'>
{profitData.data.map((day, index) => (
<tr key={index} className='hover:bg-gray-50'>
<td className='px-4 py-4 whitespace-nowrap text-sm font-medium text-gray-900'>
{formatDate(day.date)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{formatCurrency(day.revenue)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-red-600'>
{formatCurrency(day.cost)}
</td>
<td
className={`px-4 py-4 whitespace-nowrap text-right text-sm font-medium ${
day.gross_profit >= 0 ? 'text-green-600' : 'text-red-600'
}`}
>
{formatCurrency(day.gross_profit)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right'>
<span
className={`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${getProfitabilityColor(
day.gross_profit_margin
)}`}
{profitData.product_data
.sort((a, b) => b.gross_profit - a.gross_profit)
.map(product => (
<tr key={product.product_id} className='hover:bg-gray-50'>
<td className='px-4 py-4 whitespace-nowrap'>
<div className='text-sm font-medium text-gray-900'>{product.product_name}</div>
</td>
<td className='px-4 py-4 whitespace-nowrap'>
<span className='inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800'>
{product.category_name}
</span>
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{product.quantity_sold}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{formatCurrency(product.revenue)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-red-600'>
{formatCurrency(product.cost)}
</td>
<td
className={`px-4 py-4 whitespace-nowrap text-right text-sm font-medium ${
product.gross_profit >= 0 ? 'text-green-600' : 'text-red-600'
}`}
>
{formatPercentage(day.gross_profit_margin)}
</span>
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>{day.orders}</td>
</tr>
))}
{formatCurrency(product.gross_profit)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right'>
<span
className={`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${getProfitabilityColor(
product.gross_profit_margin
)}`}
>
{formatPercentage(product.gross_profit_margin)}
</span>
</td>
<td
className={`px-4 py-4 whitespace-nowrap text-right text-sm ${
product.profit_per_unit >= 0 ? 'text-green-600' : 'text-red-600'
}`}
>
{formatCurrency(product.profit_per_unit)}
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
{/* Top Performing Products */}
<div className='bg-white rounded-lg shadow-md'>
<div className='p-6'>
<div className='flex items-center mb-6'>
<i className='tabler-trophy text-[24px] text-gold-500 mr-2'></i>
<h2 className='text-xl font-semibold text-gray-900'>Top Performers</h2>
</div>
<div className='space-y-4'>
{profitData.product_data
.sort((a, b) => b.gross_profit - a.gross_profit)
.slice(0, 5)
.map((product, index) => (
<div
key={product.product_id}
className='flex items-center justify-between p-4 bg-gray-50 rounded-lg'
>
<div className='flex items-center'>
<span
className={`w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-bold mr-3 ${
index === 0
? 'bg-yellow-500'
: index === 1
? 'bg-gray-400'
: index === 2
? 'bg-orange-500'
: 'bg-blue-500'
}`}
>
{index + 1}
</span>
<div>
<h3 className='font-medium text-gray-900'>{product.product_name}</h3>
<p className='text-sm text-gray-600'>{product.category_name}</p>
</div>
</div>
<div className='text-right'>
<p className={`font-bold ${product.gross_profit >= 0 ? 'text-green-600' : 'text-red-600'}`}>
{formatCurrency(product.gross_profit)}
</p>
<p className='text-xs text-gray-500'>{formatPercentage(product.gross_profit_margin)}</p>
</div>
</div>
))}
</div>
</div>
</div>
</div>
{/* Product Analysis Table */}
<div className='bg-white rounded-lg shadow-md'>
<div className='p-6'>
<div className='flex items-center mb-6'>
<i className='tabler-package text-[24px] text-green-500 mr-2'></i>
<h2 className='text-xl font-semibold text-gray-900'>Product Analysis</h2>
</div>
<div className='overflow-x-auto'>
<table className='min-w-full'>
<thead>
<tr className='bg-gray-50'>
<th className='px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase'>Product</th>
<th className='px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase'>Category</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Qty</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Revenue</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Cost</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Profit</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Margin</th>
<th className='px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase'>Per Unit</th>
</tr>
</thead>
<tbody className='bg-white divide-y divide-gray-200'>
{profitData.product_data
.sort((a, b) => b.gross_profit - a.gross_profit)
.map(product => (
<tr key={product.product_id} className='hover:bg-gray-50'>
<td className='px-4 py-4 whitespace-nowrap'>
<div className='text-sm font-medium text-gray-900'>{product.product_name}</div>
</td>
<td className='px-4 py-4 whitespace-nowrap'>
<span className='inline-flex px-2 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800'>
{product.category_name}
</span>
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{product.quantity_sold}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-gray-900'>
{formatCurrency(product.revenue)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right text-sm text-red-600'>
{formatCurrency(product.cost)}
</td>
<td
className={`px-4 py-4 whitespace-nowrap text-right text-sm font-medium ${
product.gross_profit >= 0 ? 'text-green-600' : 'text-red-600'
}`}
>
{formatCurrency(product.gross_profit)}
</td>
<td className='px-4 py-4 whitespace-nowrap text-right'>
<span
className={`inline-flex px-2 py-1 text-xs font-semibold rounded-full ${getProfitabilityColor(
product.gross_profit_margin
)}`}
>
{formatPercentage(product.gross_profit_margin)}
</span>
</td>
<td
className={`px-4 py-4 whitespace-nowrap text-right text-sm ${
product.profit_per_unit >= 0 ? 'text-green-600' : 'text-red-600'
}`}
>
{formatCurrency(product.profit_per_unit)}
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
)}
</>
) : (
<Loading />
)}
</div>
</>
)
}
+291
View File
@@ -0,0 +1,291 @@
'use client'
// React Imports
import { useEffect, useState } from 'react'
// MUI Imports
import type { BoxProps } from '@mui/material/Box'
import Button from '@mui/material/Button'
import IconButton from '@mui/material/IconButton'
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
import Typography from '@mui/material/Typography'
import { styled } from '@mui/material/styles'
// Third-party Imports
import { useDropzone } from 'react-dropzone'
// Component Imports
import Link from '@components/Link'
import CustomAvatar from '@core/components/mui/Avatar'
// Styled Component Imports
import AppReactDropzone from '@/libs/styles/AppReactDropzone'
type FileProp = {
name: string
type: string
size: number
}
interface ImageUploadProps {
// Required props
onUpload: (file: File) => Promise<string> | string // Returns image URL
// Optional customization props
title?: string | null // Made nullable
currentImageUrl?: string
onImageRemove?: () => void
onImageChange?: (url: string) => void
// Upload state
isUploading?: boolean
// UI customization
maxFileSize?: number // in bytes
acceptedFileTypes?: string[]
showUrlOption?: boolean
uploadButtonText?: string
browseButtonText?: string
dragDropText?: string
replaceText?: string
// Style customization
className?: string
disabled?: boolean
}
// Styled Dropzone Component
const Dropzone = styled(AppReactDropzone)<BoxProps>(({ theme }) => ({
'& .dropzone': {
minHeight: 'unset',
padding: theme.spacing(12),
[theme.breakpoints.down('sm')]: {
paddingInline: theme.spacing(5)
},
'&+.MuiList-root .MuiListItem-root .file-name': {
fontWeight: theme.typography.body1.fontWeight
}
}
}))
const ImageUpload: React.FC<ImageUploadProps> = ({
onUpload,
title = null, // Default to null
currentImageUrl = '',
onImageRemove,
onImageChange,
isUploading = false,
maxFileSize = 5 * 1024 * 1024, // 5MB default
acceptedFileTypes = ['image/*'],
showUrlOption = true,
uploadButtonText = 'Upload',
browseButtonText = 'Browse Image',
dragDropText = 'Drag and Drop Your Image Here.',
replaceText = 'Drop New Image to Replace',
className = '',
disabled = false
}) => {
// States
const [files, setFiles] = useState<File[]>([])
const [error, setError] = useState<string>('')
const handleUpload = async () => {
if (!files.length) return
try {
setError('')
const imageUrl = await onUpload(files[0])
if (typeof imageUrl === 'string') {
onImageChange?.(imageUrl)
setFiles([]) // Clear files after successful upload
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Upload failed')
}
}
// Hooks
const { getRootProps, getInputProps } = useDropzone({
onDrop: (acceptedFiles: File[]) => {
setError('')
if (acceptedFiles.length === 0) return
const file = acceptedFiles[0]
// Validate file size
if (file.size > maxFileSize) {
setError(`File size should be less than ${formatFileSize(maxFileSize)}`)
return
}
// Replace files instead of adding to them
setFiles([file])
},
accept: acceptedFileTypes.reduce((acc, type) => ({ ...acc, [type]: [] }), {}),
disabled: disabled || isUploading
})
const formatFileSize = (bytes: number): string => {
if (bytes === 0) return '0 Bytes'
const k = 1024
const sizes = ['Bytes', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
}
const renderFilePreview = (file: FileProp) => {
if (file.type.startsWith('image')) {
return <img width={38} height={38} alt={file.name} src={URL.createObjectURL(file as any)} />
} else {
return <i className='tabler-file-description' />
}
}
const handleRemoveFile = (file: FileProp) => {
const filtered = files.filter((i: FileProp) => i.name !== file.name)
setFiles(filtered)
setError('')
}
const handleRemoveCurrentImage = () => {
onImageRemove?.()
}
const handleRemoveAllFiles = () => {
setFiles([])
setError('')
}
const fileList = files.map((file: FileProp) => (
<ListItem key={file.name} className='pis-4 plb-3'>
<div className='file-details'>
<div className='file-preview'>{renderFilePreview(file)}</div>
<div>
<Typography className='file-name font-medium' color='text.primary'>
{file.name}
</Typography>
<Typography className='file-size' variant='body2'>
{formatFileSize(file.size)}
</Typography>
</div>
</div>
<IconButton onClick={() => handleRemoveFile(file)} disabled={isUploading}>
<i className='tabler-x text-xl' />
</IconButton>
</ListItem>
))
return (
<Dropzone className={className}>
{/* Conditional title and URL option header */}
{title && (
<div className='flex justify-between items-center mb-4'>
<Typography variant='h6' component='h2'>
{title}
</Typography>
{showUrlOption && (
<Typography component={Link} color='primary.main' className='font-medium'>
Add media from URL
</Typography>
)}
</div>
)}
<div {...getRootProps({ className: 'dropzone' })}>
<input {...getInputProps()} />
<div className='flex items-center flex-col gap-2 text-center'>
<CustomAvatar variant='rounded' skin='light' color='secondary'>
<i className='tabler-upload' />
</CustomAvatar>
<Typography variant='h4'>{currentImageUrl && !files.length ? replaceText : dragDropText}</Typography>
<Typography color='text.disabled'>or</Typography>
<Button variant='tonal' size='small' disabled={disabled || isUploading}>
{browseButtonText}
</Button>
</div>
</div>
{/* Error Message */}
{error && (
<Typography color='error' variant='body2' className='mt-2 text-center'>
{error}
</Typography>
)}
{/* Show current image if it exists */}
{currentImageUrl && !files.length && (
<div className='current-image mb-4'>
<Typography variant='subtitle2' className='mb-2'>
Current Image:
</Typography>
<div className='flex items-center justify-between p-3 border border-gray-200 rounded'>
<div className='flex items-center gap-3'>
<img width={60} height={60} alt='Current image' src={currentImageUrl} className='rounded object-cover' />
<div>
<Typography className='font-medium' color='text.primary'>
Current image
</Typography>
<Typography variant='body2' color='text.secondary'>
Uploaded image
</Typography>
</div>
</div>
{onImageRemove && (
<IconButton onClick={handleRemoveCurrentImage} color='error' disabled={isUploading}>
<i className='tabler-x text-xl' />
</IconButton>
)}
</div>
</div>
)}
{/* File list and upload buttons */}
{files.length > 0 && (
<>
<List>{fileList}</List>
<div className='buttons'>
<Button color='error' variant='tonal' onClick={handleRemoveAllFiles} disabled={isUploading}>
Remove All
</Button>
<Button variant='contained' onClick={handleUpload} disabled={isUploading}>
{isUploading ? 'Uploading...' : uploadButtonText}
</Button>
</div>
</>
)}
</Dropzone>
)
}
export default ImageUpload
// ===== USAGE EXAMPLES =====
// 1. Without title
// <ImageUpload
// onUpload={handleUpload}
// currentImageUrl={imageUrl}
// onImageChange={setImageUrl}
// onImageRemove={() => setImageUrl('')}
// />
// 2. With title
// <ImageUpload
// title="Product Image"
// onUpload={handleUpload}
// currentImageUrl={imageUrl}
// onImageChange={setImageUrl}
// onImageRemove={() => setImageUrl('')}
// />
// 3. Explicitly set title to null
// <ImageUpload
// title={null}
// onUpload={handleUpload}
// currentImageUrl={imageUrl}
// onImageChange={setImageUrl}
// onImageRemove={() => setImageUrl('')}
// />
+465
View File
@@ -0,0 +1,465 @@
'use client'
// React Imports
import { useEffect, useState } from 'react'
// MUI Imports
import type { BoxProps } from '@mui/material/Box'
import Button from '@mui/material/Button'
import IconButton from '@mui/material/IconButton'
import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
import Typography from '@mui/material/Typography'
import Chip from '@mui/material/Chip'
import LinearProgress from '@mui/material/LinearProgress'
import { styled } from '@mui/material/styles'
// Third-party Imports
import { useDropzone } from 'react-dropzone'
// Component Imports
import Link from '@components/Link'
import CustomAvatar from '@core/components/mui/Avatar'
// Styled Component Imports
import AppReactDropzone from '@/libs/styles/AppReactDropzone'
type FileProp = {
name: string
type: string
size: number
}
type UploadedImage = {
id: string
url: string
name: string
size: number
}
type UploadProgress = {
[fileId: string]: number
}
interface MultipleImageUploadProps {
// Required props
onUpload: (files: File[]) => Promise<string[]> | string[] // Returns array of image URLs
onSingleUpload?: (file: File) => Promise<string> | string // For individual file upload
// Optional customization props
title?: string | null
currentImages?: UploadedImage[]
onImagesChange?: (images: UploadedImage[]) => void
onImageRemove?: (imageId: string) => void
// Upload state
isUploading?: boolean
uploadProgress?: UploadProgress
// Limits
maxFiles?: number
maxFileSize?: number // in bytes
acceptedFileTypes?: string[]
// UI customization
showUrlOption?: boolean
uploadButtonText?: string
browseButtonText?: string
dragDropText?: string
replaceText?: string
maxFilesText?: string
// Style customization
className?: string
disabled?: boolean
// Upload modes
uploadMode?: 'batch' | 'individual' // batch: upload all at once, individual: upload one by one
}
// Styled Dropzone Component
const Dropzone = styled(AppReactDropzone)<BoxProps>(({ theme }) => ({
'& .dropzone': {
minHeight: 'unset',
padding: theme.spacing(12),
[theme.breakpoints.down('sm')]: {
paddingInline: theme.spacing(5)
},
'&+.MuiList-root .MuiListItem-root .file-name': {
fontWeight: theme.typography.body1.fontWeight
}
}
}))
const MultipleImageUpload: React.FC<MultipleImageUploadProps> = ({
onUpload,
onSingleUpload,
title = null,
currentImages = [],
onImagesChange,
onImageRemove,
isUploading = false,
uploadProgress = {},
maxFiles = 10,
maxFileSize = 5 * 1024 * 1024, // 5MB default
acceptedFileTypes = ['image/*'],
showUrlOption = true,
uploadButtonText = 'Upload All',
browseButtonText = 'Browse Images',
dragDropText = 'Drag and Drop Your Images Here.',
replaceText = 'Drop Images to Add More',
maxFilesText = 'Maximum {max} files allowed',
className = '',
disabled = false,
uploadMode = 'batch'
}) => {
// States
const [files, setFiles] = useState<File[]>([])
const [error, setError] = useState<string>('')
const [individualUploading, setIndividualUploading] = useState<Set<string>>(new Set())
const handleBatchUpload = async () => {
if (!files.length) return
try {
setError('')
const imageUrls = await onUpload(files)
if (Array.isArray(imageUrls)) {
const newImages: UploadedImage[] = files.map((file, index) => ({
id: `${Date.now()}-${index}`,
url: imageUrls[index],
name: file.name,
size: file.size
}))
const updatedImages = [...currentImages, ...newImages]
onImagesChange?.(updatedImages)
setFiles([]) // Clear files after successful upload
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Upload failed')
}
}
const handleIndividualUpload = async (file: File, fileIndex: number) => {
if (!onSingleUpload) return
const fileId = `${file.name}-${fileIndex}`
setIndividualUploading(prev => new Set(prev).add(fileId))
try {
setError('')
const imageUrl = await onSingleUpload(file)
if (typeof imageUrl === 'string') {
const newImage: UploadedImage = {
id: `${Date.now()}-${fileIndex}`,
url: imageUrl,
name: file.name,
size: file.size
}
const updatedImages = [...currentImages, newImage]
onImagesChange?.(updatedImages)
// Remove uploaded file from pending files
setFiles(prev => prev.filter((_, index) => index !== fileIndex))
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Upload failed')
} finally {
setIndividualUploading(prev => {
const newSet = new Set(prev)
newSet.delete(fileId)
return newSet
})
}
}
// Hooks
const { getRootProps, getInputProps } = useDropzone({
onDrop: (acceptedFiles: File[]) => {
setError('')
if (acceptedFiles.length === 0) return
const totalFiles = currentImages.length + files.length + acceptedFiles.length
if (totalFiles > maxFiles) {
setError(`Cannot upload more than ${maxFiles} files. Current: ${currentImages.length + files.length}`)
return
}
// Validate file sizes
const invalidFiles = acceptedFiles.filter(file => file.size > maxFileSize)
if (invalidFiles.length > 0) {
setError(`Some files exceed ${formatFileSize(maxFileSize)} limit`)
return
}
// Add to existing files
setFiles(prev => [...prev, ...acceptedFiles])
},
accept: acceptedFileTypes.reduce((acc, type) => ({ ...acc, [type]: [] }), {}),
disabled: disabled || isUploading,
multiple: true
})
const formatFileSize = (bytes: number): string => {
if (bytes === 0) return '0 Bytes'
const k = 1024
const sizes = ['Bytes', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
}
const renderFilePreview = (file: FileProp) => {
if (file.type.startsWith('image')) {
return (
<img
width={38}
height={38}
alt={file.name}
src={URL.createObjectURL(file as any)}
className='rounded object-cover'
/>
)
} else {
return <i className='tabler-file-description' />
}
}
const handleRemoveFile = (fileIndex: number) => {
setFiles(prev => prev.filter((_, index) => index !== fileIndex))
setError('')
}
const handleRemoveCurrentImage = (imageId: string) => {
onImageRemove?.(imageId)
}
const handleRemoveAllFiles = () => {
setFiles([])
setError('')
}
const isIndividualUploading = (file: File, index: number) => {
const fileId = `${file.name}-${index}`
return individualUploading.has(fileId)
}
const fileList = files.map((file: File, index: number) => {
const isFileUploading = isIndividualUploading(file, index)
const progress = uploadProgress[`${file.name}-${index}`] || 0
return (
<ListItem key={`${file.name}-${index}`} className='pis-4 plb-3'>
<div className='file-details flex-1'>
<div className='file-preview'>{renderFilePreview(file)}</div>
<div className='flex-1'>
<Typography className='file-name font-medium' color='text.primary'>
{file.name}
</Typography>
<Typography className='file-size' variant='body2'>
{formatFileSize(file.size)}
</Typography>
{isFileUploading && progress > 0 && (
<LinearProgress variant='determinate' value={progress} className='mt-1' />
)}
</div>
</div>
<div className='flex items-center gap-2'>
{uploadMode === 'individual' && onSingleUpload && (
<Button
variant='outlined'
size='small'
onClick={() => handleIndividualUpload(file, index)}
disabled={isUploading || isFileUploading}
>
{isFileUploading ? 'Uploading...' : 'Upload'}
</Button>
)}
<IconButton onClick={() => handleRemoveFile(index)} disabled={isUploading || isFileUploading}>
<i className='tabler-x text-xl' />
</IconButton>
</div>
</ListItem>
)
})
const currentImagesList = currentImages.map(image => (
<ListItem key={image.id} className='pis-4 plb-3'>
<div className='file-details flex-1'>
<div className='file-preview'>
<img width={38} height={38} alt={image.name} src={image.url} className='rounded object-cover' />
</div>
<div className='flex-1'>
<Typography className='file-name font-medium' color='text.primary'>
{image.name}
</Typography>
<Typography className='file-size' variant='body2'>
{formatFileSize(image.size)}
</Typography>
</div>
</div>
<div className='flex items-center gap-2'>
<Chip label='Uploaded' color='success' size='small' />
{onImageRemove && (
<IconButton onClick={() => handleRemoveCurrentImage(image.id)} color='error' disabled={isUploading}>
<i className='tabler-x text-xl' />
</IconButton>
)}
</div>
</ListItem>
))
return (
<Dropzone className={className}>
{/* Conditional title and URL option header */}
{title && (
<div className='flex justify-between items-center mb-4'>
<Typography variant='h6' component='h2'>
{title}
</Typography>
{showUrlOption && (
<Typography component={Link} color='primary.main' className='font-medium'>
Add media from URL
</Typography>
)}
</div>
)}
{/* File limits info */}
<div className='flex justify-between items-center mb-4'>
<Typography variant='body2' color='text.secondary'>
{maxFilesText.replace('{max}', maxFiles.toString())}
</Typography>
<Typography variant='body2' color='text.secondary'>
{currentImages.length + files.length} / {maxFiles} files
</Typography>
</div>
<div {...getRootProps({ className: 'dropzone' })}>
<input {...getInputProps()} />
<div className='flex items-center flex-col gap-2 text-center'>
<CustomAvatar variant='rounded' skin='light' color='secondary'>
<i className='tabler-upload' />
</CustomAvatar>
<Typography variant='h4'>
{currentImages.length > 0 || files.length > 0 ? replaceText : dragDropText}
</Typography>
<Typography color='text.disabled'>or</Typography>
<Button variant='tonal' size='small' disabled={disabled || isUploading}>
{browseButtonText}
</Button>
</div>
</div>
{/* Error Message */}
{error && (
<Typography color='error' variant='body2' className='mt-2 text-center'>
{error}
</Typography>
)}
{/* Current uploaded images */}
{currentImages.length > 0 && (
<div className='mt-4'>
<Typography variant='subtitle2' className='mb-2'>
Uploaded Images ({currentImages.length}):
</Typography>
<List>{currentImagesList}</List>
</div>
)}
{/* Pending files list and upload buttons */}
{files.length > 0 && (
<div className='mt-4'>
<Typography variant='subtitle2' className='mb-2'>
Pending Files ({files.length}):
</Typography>
<List>{fileList}</List>
<div className='buttons flex gap-2 mt-3'>
<Button color='error' variant='tonal' onClick={handleRemoveAllFiles} disabled={isUploading}>
Remove All
</Button>
{uploadMode === 'batch' && (
<Button variant='contained' onClick={handleBatchUpload} disabled={isUploading || files.length === 0}>
{isUploading ? 'Uploading...' : `${uploadButtonText} (${files.length})`}
</Button>
)}
</div>
</div>
)}
</Dropzone>
)
}
export default MultipleImageUpload
// ===== USAGE EXAMPLES =====
// 1. Batch upload mode (upload all files at once)
// const [images, setImages] = useState<UploadedImage[]>([])
//
// <MultipleImageUpload
// title="Product Images"
// onUpload={handleBatchUpload}
// currentImages={images}
// onImagesChange={setImages}
// onImageRemove={(id) => setImages(prev => prev.filter(img => img.id !== id))}
// maxFiles={5}
// uploadMode="batch"
// />
// 2. Individual upload mode (upload files one by one)
// <MultipleImageUpload
// title="Gallery Images"
// onUpload={handleBatchUpload}
// onSingleUpload={handleSingleUpload}
// currentImages={images}
// onImagesChange={setImages}
// onImageRemove={(id) => setImages(prev => prev.filter(img => img.id !== id))}
// maxFiles={10}
// uploadMode="individual"
// uploadProgress={uploadProgress}
// />
// 3. Without title, custom limits
// <MultipleImageUpload
// title={null}
// onUpload={handleBatchUpload}
// currentImages={images}
// onImagesChange={setImages}
// maxFiles={3}
// maxFileSize={2 * 1024 * 1024} // 2MB
// acceptedFileTypes={['image/jpeg', 'image/png']}
// />
// 4. Example upload handlers
// const handleBatchUpload = async (files: File[]): Promise<string[]> => {
// const formData = new FormData()
// files.forEach(file => formData.append('images', file))
//
// const response = await fetch('/api/upload-multiple', {
// method: 'POST',
// body: formData
// })
//
// const result = await response.json()
// return result.urls // Array of uploaded image URLs
// }
//
// const handleSingleUpload = async (file: File): Promise<string> => {
// const formData = new FormData()
// formData.append('image', file)
//
// const response = await fetch('/api/upload-single', {
// method: 'POST',
// body: formData
// })
//
// const result = await response.json()
// return result.url // Single uploaded image URL
// }
+276
View File
@@ -0,0 +1,276 @@
// React Imports
import React from 'react'
// MUI Imports
import TextField from '@mui/material/TextField'
import Typography from '@mui/material/Typography'
import { useTheme } from '@mui/material/styles'
import type { TextFieldProps } from '@mui/material/TextField'
interface DateRangePickerProps {
/**
* Start date value (Date object or date string)
*/
startDate: Date | string | null
/**
* End date value (Date object or date string)
*/
endDate: Date | string | null
/**
* Callback when start date changes
*/
onStartDateChange: (date: Date | null) => void
/**
* Callback when end date changes
*/
onEndDateChange: (date: Date | null) => void
/**
* Label for start date field
*/
startLabel?: string
/**
* Label for end date field
*/
endLabel?: string
/**
* Placeholder for start date field
*/
startPlaceholder?: string
/**
* Placeholder for end date field
*/
endPlaceholder?: string
/**
* Size of the text fields
*/
size?: 'small' | 'medium'
/**
* Whether the fields are disabled
*/
disabled?: boolean
/**
* Whether the fields are required
*/
required?: boolean
/**
* Custom className for the container
*/
className?: string
/**
* Custom styles for the container
*/
containerStyle?: React.CSSProperties
/**
* Separator between date fields
*/
separator?: string
/**
* Custom props for start date TextField
*/
startTextFieldProps?: Omit<TextFieldProps, 'type' | 'value' | 'onChange'>
/**
* Custom props for end date TextField
*/
endTextFieldProps?: Omit<TextFieldProps, 'type' | 'value' | 'onChange'>
/**
* Error state for start date
*/
startError?: boolean
/**
* Error state for end date
*/
endError?: boolean
/**
* Helper text for start date
*/
startHelperText?: string
/**
* Helper text for end date
*/
endHelperText?: string
}
// Utility functions
const formatDateForInput = (date: Date | string | null): string => {
if (!date) return ''
const dateObj = typeof date === 'string' ? new Date(date) : date
if (isNaN(dateObj.getTime())) return ''
return dateObj.toISOString().split('T')[0]
}
const parseDateFromInput = (dateString: string): Date | null => {
if (!dateString) return null
const date = new Date(dateString)
return isNaN(date.getTime()) ? null : date
}
const DateRangePicker: React.FC<DateRangePickerProps> = ({
startDate,
endDate,
onStartDateChange,
onEndDateChange,
startLabel,
endLabel,
startPlaceholder,
endPlaceholder,
size = 'small',
disabled = false,
required = false,
className = '',
containerStyle = {},
separator = '-',
startTextFieldProps = {},
endTextFieldProps = {},
startError = false,
endError = false,
startHelperText,
endHelperText
}) => {
const theme = useTheme()
const defaultTextFieldSx = {
'& .MuiOutlinedInput-root': {
'&.Mui-focused fieldset': {
borderColor: 'primary.main'
},
'& fieldset': {
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
}
}
}
const handleStartDateChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const date = parseDateFromInput(event.target.value)
onStartDateChange(date)
}
const handleEndDateChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const date = parseDateFromInput(event.target.value)
onEndDateChange(date)
}
return (
<div className={`flex items-center gap-4 ${className}`} style={containerStyle}>
<TextField
type='date'
label={startLabel}
placeholder={startPlaceholder}
value={formatDateForInput(startDate)}
onChange={handleStartDateChange}
size={size}
disabled={disabled}
required={required}
error={startError}
helperText={startHelperText}
sx={{
...defaultTextFieldSx,
...startTextFieldProps.sx
}}
{...startTextFieldProps}
/>
<Typography
color='text.secondary'
sx={{
userSelect: 'none',
fontSize: size === 'small' ? '14px' : '16px'
}}
>
{separator}
</Typography>
<TextField
type='date'
label={endLabel}
placeholder={endPlaceholder}
value={formatDateForInput(endDate)}
onChange={handleEndDateChange}
size={size}
disabled={disabled}
required={required}
error={endError}
helperText={endHelperText}
sx={{
...defaultTextFieldSx,
...endTextFieldProps.sx
}}
{...endTextFieldProps}
/>
</div>
)
}
export default DateRangePicker
// Export utility functions for external use
export { formatDateForInput, parseDateFromInput }
// Example usage:
/*
import DateRangePicker from '@/components/DateRangePicker'
// In your component:
const [startDate, setStartDate] = useState<Date | null>(new Date())
const [endDate, setEndDate] = useState<Date | null>(new Date())
// Basic usage
<DateRangePicker
startDate={startDate}
endDate={endDate}
onStartDateChange={setStartDate}
onEndDateChange={setEndDate}
/>
// With labels and validation
<DateRangePicker
startDate={startDate}
endDate={endDate}
onStartDateChange={setStartDate}
onEndDateChange={setEndDate}
startLabel="Tanggal Mulai"
endLabel="Tanggal Selesai"
required
startError={startDate && endDate && startDate > endDate}
endError={startDate && endDate && startDate > endDate}
startHelperText={startDate && endDate && startDate > endDate ? "Tanggal mulai tidak boleh lebih besar dari tanggal selesai" : ""}
/>
// Custom styling
<DateRangePicker
startDate={startDate}
endDate={endDate}
onStartDateChange={setStartDate}
onEndDateChange={setEndDate}
separator="sampai"
size="medium"
className="my-custom-class"
startTextFieldProps={{
variant: "filled",
sx: { minWidth: '150px' }
}}
endTextFieldProps={{
variant: "filled",
sx: { minWidth: '150px' }
}}
/>
// Integration with your existing filter logic
const handleDateRangeChange = (start: Date | null, end: Date | null) => {
setFilter({
...filter,
date_from: start ? formatDateDDMMYYYY(start) : null,
date_to: end ? formatDateDDMMYYYY(end) : null
})
}
<DateRangePicker
startDate={filter.date_from ? new Date(filter.date_from) : null}
endDate={filter.date_to ? new Date(filter.date_to) : null}
onStartDateChange={(date) => handleDateRangeChange(date, filter.date_to ? new Date(filter.date_to) : null)}
onEndDateChange={(date) => handleDateRangeChange(filter.date_from ? new Date(filter.date_from) : null, date)}
/>
*/
+257
View File
@@ -0,0 +1,257 @@
// React Imports
import React, { useState } from 'react'
// MUI Imports
import Button from '@mui/material/Button'
import Menu from '@mui/material/Menu'
import MenuItem from '@mui/material/MenuItem'
import { styled } from '@mui/material/styles'
function toTitleCase(str: string): string {
return str
.toLowerCase()
.split(/\s+/) // split by spaces
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ')
}
const DropdownButton = styled(Button)(({ theme }) => ({
textTransform: 'none',
fontWeight: 400,
borderRadius: '8px',
borderColor: '#e0e0e0',
color: '#666',
'&:hover': {
borderColor: '#ccc',
backgroundColor: 'rgba(0, 0, 0, 0.04)'
}
}))
interface StatusFilterTabsProps {
/**
* Array of status options to display as filter tabs
*/
statusOptions: string[]
/**
* Currently selected status filter
*/
selectedStatus: string
/**
* Callback function when a status is selected
*/
onStatusChange: (status: string) => void
/**
* Custom className for the container
*/
className?: string
/**
* Custom styles for the container
*/
containerStyle?: React.CSSProperties
/**
* Size of the buttons
*/
buttonSize?: 'small' | 'medium' | 'large'
/**
* Maximum number of status options to show as buttons before switching to dropdown
*/
maxButtonsBeforeDropdown?: number
/**
* Label for the dropdown when there are many options
*/
dropdownLabel?: string
}
const StatusFilterTabs: React.FC<StatusFilterTabsProps> = ({
statusOptions,
selectedStatus,
onStatusChange,
className = '',
containerStyle = {},
buttonSize = 'small',
maxButtonsBeforeDropdown = 5,
dropdownLabel = 'Lainnya'
}) => {
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)
const open = Boolean(anchorEl)
const handleDropdownClick = (event: React.MouseEvent<HTMLElement>) => {
setAnchorEl(event.currentTarget)
}
const handleDropdownClose = () => {
setAnchorEl(null)
}
const handleDropdownItemClick = (status: string) => {
onStatusChange(status)
handleDropdownClose()
}
// If status options are <= maxButtonsBeforeDropdown, show all as buttons
if (statusOptions.length <= maxButtonsBeforeDropdown) {
return (
<div className='flex flex-wrap gap-2'>
{statusOptions.map(status => (
<Button
key={status}
variant={selectedStatus === status ? 'contained' : 'outlined'}
color={selectedStatus === status ? 'primary' : 'inherit'}
onClick={() => onStatusChange(status)}
size={buttonSize}
className='rounded-lg'
sx={{
textTransform: 'none',
fontWeight: selectedStatus === status ? 600 : 400,
borderRadius: '8px',
...(selectedStatus !== status && {
borderColor: '#e0e0e0',
color: '#666'
})
}}
>
{toTitleCase(status)}
</Button>
))}
</div>
)
}
// If more than maxButtonsBeforeDropdown, show first few as buttons and rest in dropdown
const buttonStatuses = statusOptions.slice(0, maxButtonsBeforeDropdown - 1)
const dropdownStatuses = statusOptions.slice(maxButtonsBeforeDropdown - 1)
const isDropdownItemSelected = dropdownStatuses.includes(selectedStatus)
return (
<div className='flex flex-wrap gap-2'>
{/* Regular buttons for first few statuses */}
{buttonStatuses.map(status => (
<Button
key={status}
variant={selectedStatus === status ? 'contained' : 'outlined'}
color={selectedStatus === status ? 'primary' : 'inherit'}
onClick={() => onStatusChange(status)}
size={buttonSize}
className='rounded-lg'
sx={{
textTransform: 'none',
fontWeight: selectedStatus === status ? 600 : 400,
borderRadius: '8px',
...(selectedStatus !== status && {
borderColor: '#e0e0e0',
color: '#666'
})
}}
>
{toTitleCase(status)}
</Button>
))}
{/* Dropdown button for remaining statuses */}
<DropdownButton
variant='outlined'
onClick={handleDropdownClick}
size={buttonSize}
endIcon={<i className='tabler-chevron-down' />}
sx={{
...(isDropdownItemSelected && {
backgroundColor: 'primary.main',
color: 'primary.contrastText',
borderColor: 'primary.main',
fontWeight: 600,
'&:hover': {
backgroundColor: 'primary.dark',
borderColor: 'primary.dark'
}
})
}}
>
{isDropdownItemSelected ? toTitleCase(selectedStatus) : dropdownLabel}
</DropdownButton>
<Menu
anchorEl={anchorEl}
open={open}
onClose={handleDropdownClose}
PaperProps={{
elevation: 3,
sx: {
mt: 1,
borderRadius: '8px',
minWidth: '160px'
}
}}
transformOrigin={{ horizontal: 'left', vertical: 'top' }}
anchorOrigin={{ horizontal: 'left', vertical: 'bottom' }}
>
{dropdownStatuses.map(status => (
<MenuItem
key={status}
onClick={() => handleDropdownItemClick(status)}
selected={selectedStatus === status}
sx={{
fontSize: '14px',
fontWeight: selectedStatus === status ? 600 : 400,
color: selectedStatus === status ? 'primary.main' : 'text.primary'
}}
>
{toTitleCase(status)}
</MenuItem>
))}
</Menu>
</div>
)
}
export default StatusFilterTabs
// Example usage:
/*
import StatusFilterTabs from '@/components/StatusFilterTabs'
// In your component:
const [statusFilter, setStatusFilter] = useState('Semua')
// For few statuses (will show all as buttons)
const expenseStatusOptions = ['Semua', 'Belum Dibayar', 'Dibayar Sebagian', 'Lunas']
// For many statuses (will show some buttons + dropdown)
const manyStatusOptions = [
'Semua',
'Belum Dibayar',
'Dibayar Sebagian',
'Lunas',
'Void',
'Retur',
'Jatuh Tempo',
'Transaksi Berulang',
'Ditangguhkan',
'Dibatalkan'
]
<StatusFilterTabs
statusOptions={expenseStatusOptions}
selectedStatus={statusFilter}
onStatusChange={setStatusFilter}
/>
// With many options (will automatically use dropdown)
<StatusFilterTabs
statusOptions={manyStatusOptions}
selectedStatus={statusFilter}
onStatusChange={setStatusFilter}
maxButtonsBeforeDropdown={4} // Show 3 buttons + dropdown
dropdownLabel="Status Lain"
/>
// Custom configuration
<StatusFilterTabs
statusOptions={manyStatusOptions}
selectedStatus={statusFilter}
onStatusChange={setStatusFilter}
maxButtonsBeforeDropdown={3}
dropdownLabel="Lainnya"
buttonSize="medium"
showBorder={false}
/>
*/
@@ -32,7 +32,7 @@ const HorizontalWithSubtitle = (props: UserDataType) => {
<div className='flex flex-col gap-1 flex-grow'>
<Typography color='text.primary'>{title}</Typography>
<div className='flex items-center gap-2 flex-wrap'>
<Typography variant='h4'>{stats}</Typography>
<Typography variant='h5'>{stats}</Typography>
<Typography color={trend === 'negative' ? 'error.main' : 'success.main'}>
{`(${trend === 'negative' ? '-' : '+'}${trendNumber})`}
</Typography>
@@ -97,8 +97,8 @@ const HorizontalMenu = ({ dictionary }: { dictionary: Awaited<ReturnType<typeof
<MenuItem href={`/${locale}/dashboards/analytics`} icon={<i className='tabler-trending-up' />}>
{dictionary['navigation'].analytics}
</MenuItem>
<MenuItem href={`/${locale}/dashboards/ecommerce`} icon={<i className='tabler-shopping-cart' />}>
{dictionary['navigation'].eCommerce}
<MenuItem href={`/${locale}/dashboards/inventory`} icon={<i className='tabler-shopping-cart' />}>
{dictionary['navigation'].inventory}
</MenuItem>
<MenuItem href={`/${locale}/dashboards/academy`} icon={<i className='tabler-school' />}>
{dictionary['navigation'].academy}
@@ -43,12 +43,8 @@ const languageData: LanguageDataType[] = [
langName: 'English'
},
{
langCode: 'fr',
langName: 'French'
},
{
langCode: 'ar',
langName: 'Arabic'
langCode: 'id',
langName: 'Indonesian'
}
]
+1 -1
View File
@@ -2,7 +2,7 @@ import { CircularProgress } from '@mui/material'
export default function Loading({ size = 60 }: { size?: number }) {
return (
<div className='fixed inset-0 z-50 flex items-center justify-center bg-white/70'>
<div className='absolute inset-0 z-50 flex items-center justify-center bg-white/70'>
<CircularProgress size={size} />
</div>
)
+117 -21
View File
@@ -91,41 +91,122 @@ const VerticalMenu = ({ dictionary, scrollMenu }: Props) => {
<MenuItem href={`/${locale}/dashboards/daily-report`}>{dictionary['navigation'].dailyReport}</MenuItem>
</SubMenu>
<MenuSection label={dictionary['navigation'].appsPages}>
<SubMenu label={dictionary['navigation'].eCommerce} icon={<i className='tabler-salad' />}>
{/* <MenuItem href={`/${locale}/apps/ecommerce/dashboard`}>{dictionary['navigation'].dashboard}</MenuItem> */}
{/* <SubMenu label={dictionary['navigation'].sales} icon={<i className='tabler-receipt-2' />}>
<MenuItem href={`/${locale}/apps/sales/overview`}>{dictionary['navigation'].overview}</MenuItem>
<MenuItem href={`/${locale}/apps/sales/sales-bills`}>{dictionary['navigation'].invoices}</MenuItem>
<MenuItem href={`/${locale}/apps/sales/sales-deliveries`}>{dictionary['navigation'].deliveries}</MenuItem>
<MenuItem href={`/${locale}/apps/sales/sales-orders`}>{dictionary['navigation'].sales_orders}</MenuItem>
<MenuItem href={`/${locale}/apps/sales/sales-quotes`}>{dictionary['navigation'].quotes}</MenuItem>
</SubMenu> */}
<SubMenu label={dictionary['navigation'].purchase_text} icon={<i className='tabler-shopping-cart' />}>
<MenuItem href={`/${locale}/apps/purchase/overview`}>{dictionary['navigation'].overview}</MenuItem>
{/* <MenuItem href={`/${locale}/apps/purchase/purchase-bills`}>
{dictionary['navigation'].purchase_bills}
</MenuItem>
<MenuItem href={`/${locale}/apps/purchase/purchase-deliveries`}>
{dictionary['navigation'].purchase_delivery}
</MenuItem> */}
<MenuItem href={`/${locale}/apps/purchase/purchase-orders`}>
{dictionary['navigation'].purchase_orders}
</MenuItem>
{/* <MenuItem href={`/${locale}/apps/purchase/purchase-quotes`}>
{dictionary['navigation'].purchase_quotes}
</MenuItem> */}
</SubMenu>
<MenuItem
href={`/${locale}/apps/expense`}
icon={<i className='tabler-cash' />}
exactMatch={false}
activeUrl='/apps/expense'
>
{dictionary['navigation'].expenses}
</MenuItem>
<MenuItem
href={`/${locale}/apps/cash-bank`}
icon={<i className='tabler-building-bank' />}
exactMatch={false}
activeUrl='/apps/cash-bank'
>
{dictionary['navigation'].cash_and_bank}
</MenuItem>
<MenuItem
href={`/${locale}/apps/account`}
icon={<i className='tabler-align-box-left-stretch' />}
exactMatch={false}
activeUrl='/apps/account'
>
{dictionary['navigation'].account}
</MenuItem>
<MenuItem
href={`/${locale}/apps/fixed-assets`}
icon={<i className='tabler-apps' />}
exactMatch={false}
activeUrl='/apps/fixed-assets'
>
{dictionary['navigation'].fixed_assets}
</MenuItem>
<MenuItem
href={`/${locale}/apps/report`}
icon={<i className='tabler-file-analytics' />}
exactMatch={false}
activeUrl='/apps/report'
>
{dictionary['navigation'].reports}
</MenuItem>
<SubMenu label={dictionary['navigation'].marketing} icon={<i className='tabler-shopping-cart' />}>
{/* <MenuItem href={`/${locale}/apps/marketing/loyalty`}>{dictionary['navigation'].loyalty}</MenuItem> */}
<MenuItem href={`/${locale}/apps/marketing/reward`}>{dictionary['navigation'].reward}</MenuItem>
{/* <SubMenu label={dictionary['navigation'].gamification}>
<MenuItem href={`/${locale}/apps/marketing/gamification/wheel-spin`}>
{dictionary['navigation'].wheel_spin}
</MenuItem>
</SubMenu> */}
<SubMenu label={dictionary['navigation'].games}>
<MenuItem href={`/${locale}/apps/marketing/games/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem href={`/${locale}/apps/marketing/games/game-prizes`}>
{dictionary['navigation'].game_prizes}
</MenuItem>
</SubMenu>
<MenuItem href={`/${locale}/apps/marketing/campaign`}>{dictionary['navigation'].campaign}</MenuItem>
{/* <MenuItem href={`/${locale}/apps/marketing/customer-analytics`}>
{dictionary['navigation'].customer_analytics}
</MenuItem> */}
{/* <MenuItem href={`/${locale}/apps/marketing/voucher`}>{dictionary['navigation'].voucher}</MenuItem> */}
<MenuItem href={`/${locale}/apps/marketing/tier`}>{dictionary['navigation'].tiers_text}</MenuItem>
{/* <MenuItem href={`/${locale}/apps/marketing/discount`}>{dictionary['navigation'].discount}</MenuItem> */}
</SubMenu>
<SubMenu label={dictionary['navigation'].inventory} icon={<i className='tabler-salad' />}>
<SubMenu label={dictionary['navigation'].products}>
<MenuItem href={`/${locale}/apps/ecommerce/products/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem className='hidden' href={`/${locale}/apps/ecommerce/products/${params.id}/detail`}>
<MenuItem href={`/${locale}/apps/inventory/products/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem className='hidden' href={`/${locale}/apps/inventory/products/${params.id}/detail`}>
{dictionary['navigation'].details}
</MenuItem>
<MenuItem className='hidden' href={`/${locale}/apps/ecommerce/products/${params.id}/edit`}>
<MenuItem className='hidden' href={`/${locale}/apps/inventory/products/${params.id}/edit`}>
{dictionary['navigation'].edit}
</MenuItem>
<MenuItem href={`/${locale}/apps/ecommerce/products/add`}>{dictionary['navigation'].add}</MenuItem>
<MenuItem href={`/${locale}/apps/ecommerce/products/category`}>
<MenuItem href={`/${locale}/apps/inventory/products/add`}>{dictionary['navigation'].add}</MenuItem>
<MenuItem href={`/${locale}/apps/inventory/products/category`}>
{dictionary['navigation'].category}
</MenuItem>
<MenuItem href={`/${locale}/apps/ecommerce/products/units`}>{dictionary['navigation'].units}</MenuItem>
<MenuItem href={`/${locale}/apps/ecommerce/products/ingredients`}>
<MenuItem href={`/${locale}/apps/inventory/products/units`}>{dictionary['navigation'].units}</MenuItem>
<MenuItem href={`/${locale}/apps/inventory/products/ingredients`}>
{dictionary['navigation'].ingredients}
</MenuItem>
</SubMenu>
<SubMenu label={dictionary['navigation'].orders}>
<MenuItem href={`/${locale}/apps/ecommerce/orders/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem className='hidden' href={`/${locale}/apps/ecommerce/orders/${params.id}/details`}>
<MenuItem href={`/${locale}/apps/inventory/orders/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem className='hidden' href={`/${locale}/apps/inventory/orders/${params.id}/details`}>
{dictionary['navigation'].details}
</MenuItem>
</SubMenu>
<SubMenu label={dictionary['navigation'].customers}>
<MenuItem href={`/${locale}/apps/ecommerce/customers/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem href={`/${locale}/apps/inventory/customers/list`}>{dictionary['navigation'].list}</MenuItem>
</SubMenu>
<SubMenu label={dictionary['navigation'].stock}>
<MenuItem href={`/${locale}/apps/ecommerce/inventory/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem href={`/${locale}/apps/ecommerce/inventory/adjustment`}>
{dictionary['navigation'].adjustment}
</MenuItem>
<MenuItem href={`/${locale}/apps/inventory/stock/list`}>{dictionary['navigation'].list}</MenuItem>
<MenuItem href={`/${locale}/apps/inventory/stock/restock`}>{dictionary['navigation'].restock}</MenuItem>
</SubMenu>
{/* <MenuItem href={`/${locale}/apps/ecommerce/settings`}>{dictionary['navigation'].settings}</MenuItem> */}
{/* <MenuItem href={`/${locale}/apps/inventory/settings`}>{dictionary['navigation'].settings}</MenuItem> */}
</SubMenu>
<SubMenu label={dictionary['navigation'].organization} icon={<i className='tabler-sitemap' />}>
<SubMenu label={dictionary['navigation'].outlet}>
@@ -137,10 +218,25 @@ const VerticalMenu = ({ dictionary, scrollMenu }: Props) => {
<MenuItem href={`/${locale}/apps/finance/payment-methods/list`}>{dictionary['navigation'].list}</MenuItem>
</SubMenu>
</SubMenu>
<SubMenu label={dictionary['navigation'].user} icon={<i className='tabler-user' />}>
<MenuItem href={`/${locale}/apps/user/list`}>{dictionary['navigation'].list}</MenuItem>
{/* <MenuItem href={`/${locale}/apps/user/view`}>{dictionary['navigation'].view}</MenuItem> */}
</SubMenu>
<MenuItem
href={`/${locale}/apps/user/list`}
icon={<i className='tabler-user' />}
exactMatch={false}
activeUrl='/apps/user/list'
>
{dictionary['navigation'].user}
</MenuItem>
<MenuItem
href={`/${locale}/apps/vendor/list`}
icon={<i className='tabler-building' />}
exactMatch={false}
activeUrl='/apps/vendor/list'
>
{dictionary['navigation'].vendor}
</MenuItem>
<MenuItem href={`/${locale}/draw`} icon={<i className='tabler-building' />} target='_blank'>
Random Draw
</MenuItem>
</MenuSection>
</Menu>
</ScrollWrapper>
+102
View File
@@ -0,0 +1,102 @@
import React from 'react'
import { Box, Typography, Paper } from '@mui/material'
// Types
type ReportItemHeaderProps = {
title: string
date?: string
amount?: number
}
type ReportItemSubheaderProps = {
title: string
}
type ReportItemProps = {
accountCode: string
accountName: string
amount: number
onClick?: () => void
isSubtitle?: boolean
}
type ReportItemFooterProps = {
title: string
amount: number
children?: React.ReactNode
}
// Helper function to format currency
const formatCurrency = (amount: number) => {
return new Intl.NumberFormat('id-ID', {
minimumFractionDigits: 0,
maximumFractionDigits: 0
}).format(amount)
}
// ReportItemHeader Component
export const ReportItemHeader: React.FC<ReportItemHeaderProps> = ({ title, date, amount }) => {
return (
<Box className='bg-slate-200 px-6 py-4 flex justify-between items-center'>
<Typography variant='h6' className='text-primary font-semibold'>
{title}
</Typography>
<Typography variant='body1' className='text-primary font-medium'>
{amount ? formatCurrency(amount) : date}
</Typography>
</Box>
)
}
// ReportItemSubheader Component
export const ReportItemSubheader: React.FC<ReportItemSubheaderProps> = ({ title }) => {
return (
<Box className='px-6 py-3 bg-white border-b border-gray-300 hover:bg-gray-50 transition-colors'>
<Typography variant='subtitle1' className='font-semibold text-gray-900'>
{title}
</Typography>
</Box>
)
}
// ReportItem Component
export const ReportItem: React.FC<ReportItemProps> = ({
accountCode,
accountName,
amount,
onClick,
isSubtitle = true
}) => {
return (
<Box
onClick={onClick}
className={`px-6 py-3 flex justify-between items-center bg-white border-b border-gray-300 transition-all duration-200 ease-in-out ${
onClick ? 'cursor-pointer hover:bg-gray-50' : 'cursor-default'
}`}
>
<Typography variant='body1' className={`text-gray-900 font-normal ${isSubtitle ? 'ml-4' : ''}`}>
{accountCode} {accountName}
</Typography>
<Typography variant='body1' className='text-primary font-medium text-right'>
{formatCurrency(amount)}
</Typography>
</Box>
)
}
// ReportItemFooter Component
export const ReportItemFooter: React.FC<ReportItemFooterProps> = ({ title, amount, children }) => {
return (
<Box className='px-6 py-4 border-b border-gray-300 hover:bg-gray-50 transition-colors'>
<Box className='flex justify-between items-center'>
<Typography variant='subtitle1' className='font-bold text-gray-900'>
{title}
</Typography>
<Typography variant='subtitle1' className='text-primary font-bold text-right'>
{formatCurrency(amount)}
</Typography>
</Box>
{children && <Box className='mt-2'>{children}</Box>}
</Box>
)
}
+27
View File
@@ -0,0 +1,27 @@
'use client'
// MUI Imports
import Button from '@mui/material/Button'
import Typography from '@mui/material/Typography'
interface Props {
title: string
}
const ReportTitle = ({ title }: Props) => {
return (
<div className='flex flex-wrap sm:items-center justify-between max-sm:flex-col gap-6'>
<div>
<Typography variant='h4' className='mbe-1'>
{title}
</Typography>
</div>
</div>
)
}
interface Props {
title: string
}
export default ReportTitle
+2 -1
View File
@@ -1,9 +1,10 @@
export const i18n = {
defaultLocale: 'en',
locales: ['en', 'fr', 'ar'],
locales: ['en', 'id'],
langDirection: {
en: 'ltr',
fr: 'ltr',
id: 'ltr',
ar: 'rtl'
}
} as const
+9 -1
View File
@@ -25,7 +25,15 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
const savedToken = localStorage.getItem('authToken')
const savedUser = localStorage.getItem('user')
if (savedToken) setToken(savedToken)
if (savedUser) setCurrentUser(JSON.parse(savedUser))
if (savedUser) {
try {
setCurrentUser(JSON.parse(savedUser))
} catch (error) {
console.error('Failed to parse saved user data:', error)
// Clear invalid data
localStorage.removeItem('user')
}
}
setIsInitialized(true)
}, [])
-116
View File
@@ -1,116 +0,0 @@
{
"navigation": {
"dashboards": "لوحات القيادة",
"analytics": "تحليلات",
"eCommerce": "تجزئة الكترونية",
"stock": "المخزون",
"academy": "أكاديمية",
"logistics": "اللوجستية",
"frontPages": "الصفحات الأولى",
"landing": "الهبوط",
"pricing": "التسعير",
"payment": "قسط",
"checkout": "الدفع",
"helpCenter": "مركز المساعدة",
"appsPages": "التطبيقات والصفحات",
"apps": "تطبيقات",
"dashboard": "لوحة القيادة",
"products": "منتجات",
"list": "قائمة",
"add": "يضيف",
"adjustment": "تعديل",
"category": "فئة",
"overview": "نظرة عامة",
"profitloss": "الربح والخسارة",
"finance": "مالية",
"paymentMethods": "طرق الدفع",
"organization": "المنظمة",
"outlet": "مخزن",
"units": "وحدات",
"reports": "تقارير",
"ingredients": "مكونات",
"orders": "أوامر",
"details": "تفاصيل",
"customers": "العملاء",
"manageReviews": "إدارة المراجعات",
"referrals": "الإحالات",
"settings": "إعدادات",
"myCourses": "دوراتي",
"courseDetails": "تفاصيل الدورة",
"fleet": "أسطول",
"email": "البريد الإلكتروني",
"chat": "محادثة",
"calendar": "تقويم",
"kanban": "كانبان",
"invoice": "فاتورة",
"preview": "معاينة",
"edit": "يحرر",
"user": "المستعمل",
"view": "رأي",
"rolesPermissions": "الأدوار والأذونات",
"roles": "الأدوار",
"permissions": "أذونات",
"pages": "الصفحات",
"userProfile": "ملف تعريفي للمستخدم",
"accountSettings": "إعدادت الحساب",
"faq": "التعليمات",
"miscellaneous": "متفرقات",
"comingSoon": "قريبا",
"underMaintenance": "تحت الصيانة",
"pageNotFound404": "الصفحة غير موجودة - 404",
"notAuthorized401": "غير مصرح به - 401",
"authPages": "صفحات المصادقة",
"login": "تسجيل الدخول",
"loginV1": "تسجيل الدخول v1",
"loginV2": "تسجيل الدخول الإصدار 2",
"register": "يسجل",
"registerV1": "تسجيل الإصدار 1",
"registerV2": "تسجيل الإصدار 2",
"registerMultiSteps": "تسجيل متعدد الخطوات",
"verifyEmail": "التحقق من البريد الإلكتروني",
"verifyEmailV1": "التحقق من البريد الإلكتروني الإصدار 1",
"verifyEmailV2": "التحقق من البريد الإلكتروني الإصدار 2",
"forgotPassword": "هل نسيت كلمة السر",
"forgotPasswordV1": "نسيت كلمة المرور v1",
"forgotPasswordV2": "نسيت كلمة المرور v2",
"resetPassword": "إعادة تعيين كلمة المرور",
"resetPasswordV1": "إعادة تعيين كلمة المرور v1",
"resetPasswordV2": "إعادة تعيين كلمة المرور الإصدار 2",
"twoSteps": "خطوتين",
"twoStepsV1": "خطوتين v1",
"twoStepsV2": "خطوتان - الإصدار 2",
"wizardExamples": "أمثلة على المعالج",
"propertyListing": "قائمة الممتلكات",
"createDeal": "إنشاء صفقة",
"dialogExamples": "أمثلة الحوار",
"widgetExamples": "أمثلة القطعة",
"basic": "أساسي",
"advanced": "متقدم",
"statistics": "إحصائيات",
"actions": "أجراءات",
"formsAndTables": "النماذج والجداول",
"formLayouts": "تخطيطات النموذج",
"formValidation": "التحقق من صحة النموذج",
"formWizard": "معالج النماذج",
"reactTable": "جدول رد الفعل",
"formELements": "عناصر النماذج",
"muiTables": "جداول MUI",
"chartsMisc": "الرسوم البيانية ومتفرقات",
"charts": "الرسوم البيانية",
"recharts": "يعيد رسم الخرائط",
"apex": "ذروة",
"foundation": "مؤسسة",
"components": "عناصر",
"menuExamples": "أمثلة القائمة",
"raiseSupport": "رفع الدعم",
"documentation": "توثيق",
"others": "آحرون",
"itemWithBadge": "العنصر مع شارة",
"externalLink": "رابط خارجي",
"menuLevels": "مستويات القائمة",
"menuLevel2": "مستوى القائمة 2",
"menuLevel3": "مستوى القائمة 3",
"disabledMenu": "قائمة المعوقين",
"dailyReport": "تقرير يومي"
}
}
+30 -3
View File
@@ -2,7 +2,7 @@
"navigation": {
"dashboards": "Dashboards",
"analytics": "Analytics",
"eCommerce": "Inventory",
"inventory": "Inventory",
"stock": "Stock",
"academy": "Academy",
"logistics": "Logistics",
@@ -18,7 +18,7 @@
"products": "Products",
"list": "List",
"add": "Add",
"adjustment": "Adjustment",
"restock": "Re stock",
"category": "Category",
"overview": "Overview",
"profitloss": "Profit Loss",
@@ -111,6 +111,33 @@
"menuLevel2": "Menu Level 2",
"menuLevel3": "Menu Level 3",
"disabledMenu": "Disabled Menu",
"dailyReport": "Daily Report"
"dailyReport": "Daily Report",
"vendor": "Vendor",
"sales": "Sales",
"purchase_text": "Purchase",
"purchase_orders": "Purchase Orders",
"purchase_bills": "Purchase Bills",
"purchase_delivery": "Purchase Delivery",
"purchase_quotes": "Purchase Quotes",
"invoices": "Invoices",
"deliveries": "Deliveries",
"sales_orders": "Orders",
"quotes": "Quotes",
"expenses": "Expenses",
"cash_and_bank": "Cash & Bank",
"account": "Account",
"fixed_assets": "Fixed Assets",
"marketing": "Marketing",
"loyalty": "Loyalty",
"reward": "Reward",
"gamification": "Gamification",
"wheel_spin": "Wheel Spin",
"campaign": "Campaign",
"customer_analytics": "Customer Analytics",
"voucher": "Voucher",
"tiers_text": "Tiers",
"games": "Games",
"game_prizes": "Game Prizes",
"discount": "Discount"
}
}
-116
View File
@@ -1,116 +0,0 @@
{
"navigation": {
"dashboards": "Tableaux de bord",
"analytics": "Analytique",
"eCommerce": "Inventaire",
"stock": "Stock",
"academy": "Académie",
"logistics": "Logistique",
"frontPages": "Premières pages",
"landing": "Atterrissage",
"pricing": "Tarifs",
"payment": "Paiement",
"checkout": "Vérifier",
"helpCenter": "Centre d'aide",
"appsPages": "Applications et pages",
"apps": "Apps",
"dashboard": "Tableau de bord",
"products": "Produits",
"list": "Liste",
"add": "Ajouter",
"adjustment": "Ajustement",
"category": "Catégorie",
"overview": "Aperçu",
"profitloss": "Profit et perte",
"finance": "Finance",
"paymentMethods": "Méthodes de paiement",
"organization": "Organisation",
"outlet": "Point de vente",
"units": "Unites",
"reports": "Rapports",
"ingredients": "Ingrédients",
"orders": "Ordres",
"details": "Détails",
"customers": "Clientes",
"manageReviews": "Gérer les avis",
"referrals": "Références",
"settings": "Paramètres",
"myCourses": "Mes cours",
"courseDetails": "Détails du cours",
"fleet": "Flotte",
"email": "E-mail",
"chat": "chatte",
"calendar": "Calendrier",
"kanban": "Kanban",
"invoice": "Facture d'achat",
"preview": "Aperçu",
"edit": "Éditer",
"user": "Utilisateur",
"view": "Voir",
"rolesPermissions": "Rôles et autorisations",
"roles": "Les rôles",
"permissions": "Autorisations",
"pages": "Pages",
"userProfile": "Profil de l'utilisateur",
"accountSettings": "Paramètres du compte",
"faq": "FAQ",
"miscellaneous": "Divers",
"comingSoon": "À venir",
"underMaintenance": "En maintenance",
"pageNotFound404": "Page non trouvée - 404",
"notAuthorized401": "Non autorisé - 401",
"authPages": "Pages d'authentification",
"login": "Connexion",
"loginV1": "Connexion v1",
"loginV2": "Connexion v2",
"register": "S'inscrire",
"registerV1": "Enregistrer v1",
"registerV2": "Enregistrer v2",
"registerMultiSteps": "Enregistrer plusieurs étapes",
"verifyEmail": "Vérifier les courriels",
"verifyEmailV1": "Vérifier l'e-mail v1",
"verifyEmailV2": "Vérifier l'e-mail v2",
"forgotPassword": "Mot de passe oublié",
"forgotPasswordV1": "Mot de passe oublié v1",
"forgotPasswordV2": "Mot de passe oublié v2",
"resetPassword": "Réinitialiser le mot de passe",
"resetPasswordV1": "Réinitialiser le mot de passe v1",
"resetPasswordV2": "Réinitialiser le mot de passe v2",
"twoSteps": "Deux étapes",
"twoStepsV1": "Deux étapes v1",
"twoStepsV2": "Deux étapes v2",
"wizardExamples": "Exemples d'assistants",
"propertyListing": "Liste des biens",
"createDeal": "Créer un accord",
"dialogExamples": "Exemples de dialogue",
"widgetExamples": "Exemples de widgets",
"basic": "Basique",
"advanced": "Avancée",
"statistics": "Statistiques",
"actions": "Actions",
"formsAndTables": "Formulaires et tableaux",
"formLayouts": "Dispositions de formulaire",
"formValidation": "Validation du formulaire",
"formWizard": "Assistant de formulaire",
"reactTable": "Tableau de réaction",
"formELements": "Éléments de formulaire",
"muiTables": "Tableaux MUI",
"chartsMisc": "Graphiques & Divers",
"charts": "Graphiques",
"recharts": "Regraphiques",
"apex": "Sommet",
"foundation": "fondation",
"components": "Composants",
"menuExamples": "Exemples de menus",
"raiseSupport": "Augmenter le soutien",
"documentation": "Documentation",
"others": "Les autres",
"itemWithBadge": "Article avec badge",
"externalLink": "Lien Externe",
"menuLevels": "Niveaux de menus",
"menuLevel2": "Niveau menu 2",
"menuLevel3": "Niveau menu 3",
"disabledMenu": "Menu désactivé",
"dailyReport": "Rapport quotidien"
}
}
+143
View File
@@ -0,0 +1,143 @@
{
"navigation": {
"dashboards": "Dasbor",
"analytics": "Analitik",
"inventory": "Inventaris",
"stock": "Stok",
"academy": "Akademi",
"logistics": "Logistik",
"frontPages": "Halaman Depan",
"landing": "Beranda",
"pricing": "Harga",
"payment": "Pembayaran",
"checkout": "Checkout",
"helpCenter": "Pusat Bantuan",
"appsPages": "Aplikasi & Halaman",
"apps": "Aplikasi",
"dashboard": "Dasbor",
"products": "Produk",
"list": "Daftar",
"add": "Tambah",
"restock": "Isi Ulang Stok",
"category": "Kategori",
"overview": "Ringkasan",
"profitloss": "Laba Rugi",
"units": "Unit",
"reports": "Laporan",
"finance": "Keuangan",
"paymentMethods": "Metode Pembayaran",
"organization": "Organisasi",
"outlet": "Outlet",
"ingredients": "Bahan",
"orders": "Pesanan",
"details": "Detail",
"customers": "Pelanggan",
"manageReviews": "Kelola Ulasan",
"referrals": "Rujukan",
"settings": "Pengaturan",
"myCourses": "Kursus Saya",
"courseDetails": "Detail Kursus",
"fleet": "Armada",
"email": "Email",
"chat": "Chat",
"calendar": "Kalender",
"kanban": "Kanban",
"invoice": "Faktur",
"preview": "Pratinjau",
"edit": "Edit",
"user": "Pengguna",
"view": "Lihat",
"rolesPermissions": "Peran & Izin",
"roles": "Peran",
"permissions": "Izin",
"pages": "Halaman",
"userProfile": "Profil Pengguna",
"accountSettings": "Pengaturan Akun",
"faq": "FAQ",
"miscellaneous": "Lain-lain",
"comingSoon": "Segera Hadir",
"underMaintenance": "Dalam Pemeliharaan",
"pageNotFound404": "Halaman Tidak Ditemukan - 404",
"notAuthorized401": "Tidak Diizinkan - 401",
"authPages": "Halaman Autentikasi",
"login": "Masuk",
"loginV1": "Masuk v1",
"loginV2": "Masuk v2",
"register": "Daftar",
"registerV1": "Daftar v1",
"registerV2": "Daftar v2",
"registerMultiSteps": "Daftar Multi-Langkah",
"verifyEmail": "Verifikasi Email",
"verifyEmailV1": "Verifikasi Email v1",
"verifyEmailV2": "Verifikasi Email v2",
"forgotPassword": "Lupa Kata Sandi",
"forgotPasswordV1": "Lupa Kata Sandi v1",
"forgotPasswordV2": "Lupa Kata Sandi v2",
"resetPassword": "Reset Kata Sandi",
"resetPasswordV1": "Reset Kata Sandi v1",
"resetPasswordV2": "Reset Kata Sandi v2",
"twoSteps": "Dua Langkah",
"twoStepsV1": "Dua Langkah v1",
"twoStepsV2": "Dua Langkah v2",
"wizardExamples": "Contoh Wizard",
"propertyListing": "Daftar Properti",
"createDeal": "Buat Penawaran",
"dialogExamples": "Contoh Dialog",
"widgetExamples": "Contoh Widget",
"basic": "Dasar",
"advanced": "Lanjutan",
"statistics": "Statistik",
"actions": "Aksi",
"formsAndTables": "Form & Tabel",
"formLayouts": "Layout Form",
"formValidation": "Validasi Form",
"formWizard": "Wizard Form",
"reactTable": "Tabel React",
"formELements": "Elemen Form",
"muiTables": "Tabel MUI",
"chartsMisc": "Grafik & Lain-lain",
"charts": "Grafik",
"recharts": "Recharts",
"apex": "Apex",
"foundation": "Fondasi",
"components": "Komponen",
"menuExamples": "Contoh Menu",
"raiseSupport": "Buat Tiket Dukungan",
"documentation": "Dokumentasi",
"others": "Lainnya",
"itemWithBadge": "Item dengan Badge",
"externalLink": "Link Eksternal",
"menuLevels": "Level Menu",
"menuLevel2": "Level Menu 2",
"menuLevel3": "Level Menu 3",
"disabledMenu": "Menu Nonaktif",
"dailyReport": "Laporan Harian",
"vendor": "Vendor",
"sales": "Penjualan",
"purchase_text": "Pembelian",
"purchase_orders": "Pesanan Pembelian",
"purchase_bills": "Tagihan Pembelian",
"purchase_delivery": "Pengiriman Pembelian",
"purchase_quotes": "Penawaran Pembelian",
"invoices": "Tagihan",
"deliveries": "Pengiriman",
"sales_orders": "Pemesanan",
"quotes": "Penawaran",
"expenses": "Biaya",
"cash_and_bank": "Kas & Bank",
"account": "Akun",
"fixed_assets": "Aset Tetap",
"marketing": "Pemasaran",
"loyalty": "Loyalti",
"reward": "Reward",
"gamification": "Gamifikasi",
"wheel_spin": "Wheel Spin",
"campaign": "Kampanye",
"customer_analytics": "Analisis Pelanggan",
"voucher": "Vocher",
"tiers_text": "Tiers",
"games": "Permainan",
"game_prizes": "Hadiah Permainan",
"Discount": "Diskon"
}
}
+224
View File
@@ -0,0 +1,224 @@
import { ExpenseType } from '@/types/apps/expenseTypes'
export const expenseData: ExpenseType[] = [
{
id: 1,
date: '2025-01-05',
number: 'EXP/2025/001',
reference: 'REF-EXP-001',
benefeciaryName: 'Budi Santoso',
benefeciaryCompany: 'PT Maju Jaya',
status: 'Belum Dibayar',
balanceDue: 5000000,
total: 5000000
},
{
id: 2,
date: '2025-01-06',
number: 'EXP/2025/002',
reference: 'REF-EXP-002',
benefeciaryName: 'Siti Aminah',
benefeciaryCompany: 'CV Sentosa Abadi',
status: 'Dibayar Sebagian',
balanceDue: 2500000,
total: 6000000
},
{
id: 3,
date: '2025-01-07',
number: 'EXP/2025/003',
reference: 'REF-EXP-003',
benefeciaryName: 'Agus Prasetyo',
benefeciaryCompany: 'UD Makmur',
status: 'Lunas',
balanceDue: 0,
total: 4200000
},
{
id: 4,
date: '2025-01-08',
number: 'EXP/2025/004',
reference: 'REF-EXP-004',
benefeciaryName: 'Rina Wulandari',
benefeciaryCompany: 'PT Sejahtera Bersama',
status: 'Belum Dibayar',
balanceDue: 3200000,
total: 3200000
},
{
id: 5,
date: '2025-01-09',
number: 'EXP/2025/005',
reference: 'REF-EXP-005',
benefeciaryName: 'Dedi Kurniawan',
benefeciaryCompany: 'CV Bintang Terang',
status: 'Dibayar Sebagian',
balanceDue: 1500000,
total: 7000000
},
{
id: 6,
date: '2025-01-10',
number: 'EXP/2025/006',
reference: 'REF-EXP-006',
benefeciaryName: 'Sri Lestari',
benefeciaryCompany: 'PT Barokah Jaya',
status: 'Lunas',
balanceDue: 0,
total: 2800000
},
{
id: 7,
date: '2025-01-11',
number: 'EXP/2025/007',
reference: 'REF-EXP-007',
benefeciaryName: 'Joko Widodo',
benefeciaryCompany: 'UD Sumber Rejeki',
status: 'Belum Dibayar',
balanceDue: 8000000,
total: 8000000
},
{
id: 8,
date: '2025-01-12',
number: 'EXP/2025/008',
reference: 'REF-EXP-008',
benefeciaryName: 'Maya Kartika',
benefeciaryCompany: 'PT Bumi Lestari',
status: 'Dibayar Sebagian',
balanceDue: 2000000,
total: 9000000
},
{
id: 9,
date: '2025-01-13',
number: 'EXP/2025/009',
reference: 'REF-EXP-009',
benefeciaryName: 'Eko Yulianto',
benefeciaryCompany: 'CV Cahaya Baru',
status: 'Lunas',
balanceDue: 0,
total: 3500000
},
{
id: 10,
date: '2025-01-14',
number: 'EXP/2025/010',
reference: 'REF-EXP-010',
benefeciaryName: 'Nina Rahmawati',
benefeciaryCompany: 'PT Gemilang',
status: 'Belum Dibayar',
balanceDue: 4700000,
total: 4700000
},
{
id: 11,
date: '2025-01-15',
number: 'EXP/2025/011',
reference: 'REF-EXP-011',
benefeciaryName: 'Andi Saputra',
benefeciaryCompany: 'CV Harmoni',
status: 'Dibayar Sebagian',
balanceDue: 1200000,
total: 6000000
},
{
id: 12,
date: '2025-01-16',
number: 'EXP/2025/012',
reference: 'REF-EXP-012',
benefeciaryName: 'Yuni Astuti',
benefeciaryCompany: 'PT Surya Abadi',
status: 'Lunas',
balanceDue: 0,
total: 5200000
},
{
id: 13,
date: '2025-01-17',
number: 'EXP/2025/013',
reference: 'REF-EXP-013',
benefeciaryName: 'Ridwan Hidayat',
benefeciaryCompany: 'UD Berkah',
status: 'Belum Dibayar',
balanceDue: 2900000,
total: 2900000
},
{
id: 14,
date: '2025-01-18',
number: 'EXP/2025/014',
reference: 'REF-EXP-014',
benefeciaryName: 'Ratna Sari',
benefeciaryCompany: 'PT Amanah Sentosa',
status: 'Dibayar Sebagian',
balanceDue: 1000000,
total: 4000000
},
{
id: 15,
date: '2025-01-19',
number: 'EXP/2025/015',
reference: 'REF-EXP-015',
benefeciaryName: 'Hendra Gunawan',
benefeciaryCompany: 'CV Murni',
status: 'Lunas',
balanceDue: 0,
total: 2500000
},
{
id: 16,
date: '2025-01-20',
number: 'EXP/2025/016',
reference: 'REF-EXP-016',
benefeciaryName: 'Mega Putri',
benefeciaryCompany: 'PT Citra Mandiri',
status: 'Belum Dibayar',
balanceDue: 6100000,
total: 6100000
},
{
id: 17,
date: '2025-01-21',
number: 'EXP/2025/017',
reference: 'REF-EXP-017',
benefeciaryName: 'Bayu Saputra',
benefeciaryCompany: 'UD Lancar Jaya',
status: 'Dibayar Sebagian',
balanceDue: 1700000,
total: 5000000
},
{
id: 18,
date: '2025-01-22',
number: 'EXP/2025/018',
reference: 'REF-EXP-018',
benefeciaryName: 'Dian Anggraini',
benefeciaryCompany: 'CV Sumber Cahaya',
status: 'Lunas',
balanceDue: 0,
total: 3300000
},
{
id: 19,
date: '2025-01-23',
number: 'EXP/2025/019',
reference: 'REF-EXP-019',
benefeciaryName: 'Rizky Aditya',
benefeciaryCompany: 'PT Mandiri Abadi',
status: 'Belum Dibayar',
balanceDue: 7000000,
total: 7000000
},
{
id: 20,
date: '2025-01-24',
number: 'EXP/2025/020',
reference: 'REF-EXP-020',
benefeciaryName: 'Lina Marlina',
benefeciaryCompany: 'CV Anugerah',
status: 'Dibayar Sebagian',
balanceDue: 2000000,
total: 6500000
}
]
+244
View File
@@ -0,0 +1,244 @@
import { PurchaseBillType } from '@/types/apps/purchaseBillType'
export const purchaseBillsData: PurchaseBillType[] = [
{
id: 1,
number: 'PB-001',
vendorName: 'Andi Wijaya',
vendorCompany: 'PT Sumber Makmur',
reference: 'REF-001',
date: '2025-09-01',
dueDate: '2025-09-15',
status: 'Belum Dibayar',
remainingBill: 5000000,
total: 5000000
},
{
id: 2,
number: 'PB-002',
vendorName: 'Siti Rahma',
vendorCompany: 'CV Cahaya Abadi',
reference: 'REF-002',
date: '2025-08-28',
dueDate: '2025-09-12',
status: 'Dibayar Sebagian',
remainingBill: 2000000,
total: 8000000
},
{
id: 3,
number: 'PB-003',
vendorName: 'Budi Santoso',
vendorCompany: 'UD Sejahtera',
reference: 'REF-003',
date: '2025-09-05',
dueDate: '2025-09-20',
status: 'Lunas',
remainingBill: 0,
total: 3500000
},
{
id: 4,
number: 'PB-004',
vendorName: 'Rina Kartika',
vendorCompany: 'PT Mitra Jaya',
reference: 'REF-004',
date: '2025-08-30',
dueDate: '2025-09-14',
status: 'Belum Dibayar',
remainingBill: 12000000,
total: 12000000
},
{
id: 5,
number: 'PB-005',
vendorName: 'Agus Salim',
vendorCompany: 'CV Bumi Persada',
reference: 'REF-005',
date: '2025-09-03',
dueDate: '2025-09-18',
status: 'Dibayar Sebagian',
remainingBill: 1500000,
total: 6000000
},
{
id: 6,
number: 'PB-006',
vendorName: 'Maya Lestari',
vendorCompany: 'PT Tunas Baru',
reference: 'REF-006',
date: '2025-09-06',
dueDate: '2025-09-21',
status: 'Lunas',
remainingBill: 0,
total: 9000000
},
{
id: 7,
number: 'PB-007',
vendorName: 'Hendra Gunawan',
vendorCompany: 'UD Prima Sentosa',
reference: 'REF-007',
date: '2025-09-02',
dueDate: '2025-09-17',
status: 'Belum Dibayar',
remainingBill: 7200000,
total: 7200000
},
{
id: 8,
number: 'PB-008',
vendorName: 'Dewi Anggraini',
vendorCompany: 'CV Inti Mandiri',
reference: 'REF-008',
date: '2025-08-27',
dueDate: '2025-09-11',
status: 'Dibayar Sebagian',
remainingBill: 3000000,
total: 10000000
},
{
id: 9,
number: 'PB-009',
vendorName: 'Yusuf Arifin',
vendorCompany: 'PT Surya Kencana',
reference: 'REF-009',
date: '2025-09-04',
dueDate: '2025-09-19',
status: 'Lunas',
remainingBill: 0,
total: 4500000
},
{
id: 10,
number: 'PB-010',
vendorName: 'Nurhayati',
vendorCompany: 'UD Cahaya Mulia',
reference: 'REF-010',
date: '2025-09-07',
dueDate: '2025-09-22',
status: 'Belum Dibayar',
remainingBill: 2500000,
total: 2500000
},
{
id: 11,
number: 'PB-011',
vendorName: 'Fajar Hidayat',
vendorCompany: 'PT Bina Karya',
reference: 'REF-011',
date: '2025-09-01',
dueDate: '2025-09-16',
status: 'Dibayar Sebagian',
remainingBill: 1000000,
total: 7000000
},
{
id: 12,
number: 'PB-012',
vendorName: 'Ratna Sari',
vendorCompany: 'CV Mega Utama',
reference: 'REF-012',
date: '2025-09-08',
dueDate: '2025-09-23',
status: 'Lunas',
remainingBill: 0,
total: 5600000
},
{
id: 13,
number: 'PB-013',
vendorName: 'Tono Prasetyo',
vendorCompany: 'UD Karya Indah',
reference: 'REF-013',
date: '2025-08-29',
dueDate: '2025-09-13',
status: 'Belum Dibayar',
remainingBill: 8000000,
total: 8000000
},
{
id: 14,
number: 'PB-014',
vendorName: 'Lina Marlina',
vendorCompany: 'PT Harmoni Sejati',
reference: 'REF-014',
date: '2025-09-05',
dueDate: '2025-09-20',
status: 'Dibayar Sebagian',
remainingBill: 4000000,
total: 10000000
},
{
id: 15,
number: 'PB-015',
vendorName: 'Arman Saputra',
vendorCompany: 'CV Sentra Niaga',
reference: 'REF-015',
date: '2025-09-03',
dueDate: '2025-09-18',
status: 'Lunas',
remainingBill: 0,
total: 3000000
},
{
id: 16,
number: 'PB-016',
vendorName: 'Indah Permata',
vendorCompany: 'PT Citra Abadi',
reference: 'REF-016',
date: '2025-08-31',
dueDate: '2025-09-15',
status: 'Belum Dibayar',
remainingBill: 6700000,
total: 6700000
},
{
id: 17,
number: 'PB-017',
vendorName: 'Adi Putra',
vendorCompany: 'UD Makmur Bersama',
reference: 'REF-017',
date: '2025-09-02',
dueDate: '2025-09-17',
status: 'Dibayar Sebagian',
remainingBill: 2000000,
total: 9000000
},
{
id: 18,
number: 'PB-018',
vendorName: 'Sri Wahyuni',
vendorCompany: 'CV Bintang Terang',
reference: 'REF-018',
date: '2025-09-06',
dueDate: '2025-09-21',
status: 'Lunas',
remainingBill: 0,
total: 7200000
},
{
id: 19,
number: 'PB-019',
vendorName: 'Eko Prabowo',
vendorCompany: 'PT Mandiri Jaya',
reference: 'REF-019',
date: '2025-09-04',
dueDate: '2025-09-19',
status: 'Belum Dibayar',
remainingBill: 11000000,
total: 11000000
},
{
id: 20,
number: 'PB-020',
vendorName: 'Novi Astuti',
vendorCompany: 'UD Sinar Harapan',
reference: 'REF-020',
date: '2025-09-07',
dueDate: '2025-09-22',
status: 'Dibayar Sebagian',
remainingBill: 500000,
total: 4500000
}
]
+184
View File
@@ -0,0 +1,184 @@
import { PurchaseDeliveryType } from '@/types/apps/purchaseDeliveryTypes'
export const purchaseDeliveryData: PurchaseDeliveryType[] = [
{
id: 1,
number: 'PD-001',
vendorName: 'Andi Wijaya',
vendorCompany: 'PT Sumber Makmur',
reference: 'REF-PD-001',
date: '2025-09-01',
status: 'Open'
},
{
id: 2,
number: 'PD-002',
vendorName: 'Siti Rahma',
vendorCompany: 'CV Cahaya Abadi',
reference: 'REF-PD-002',
date: '2025-09-02',
status: 'Selesai'
},
{
id: 3,
number: 'PD-003',
vendorName: 'Budi Santoso',
vendorCompany: 'UD Sejahtera',
reference: 'REF-PD-003',
date: '2025-09-03',
status: 'Open'
},
{
id: 4,
number: 'PD-004',
vendorName: 'Rina Kartika',
vendorCompany: 'PT Mitra Jaya',
reference: 'REF-PD-004',
date: '2025-09-04',
status: 'Selesai'
},
{
id: 5,
number: 'PD-005',
vendorName: 'Agus Salim',
vendorCompany: 'CV Bumi Persada',
reference: 'REF-PD-005',
date: '2025-09-05',
status: 'Open'
},
{
id: 6,
number: 'PD-006',
vendorName: 'Maya Lestari',
vendorCompany: 'PT Tunas Baru',
reference: 'REF-PD-006',
date: '2025-09-06',
status: 'Selesai'
},
{
id: 7,
number: 'PD-007',
vendorName: 'Hendra Gunawan',
vendorCompany: 'UD Prima Sentosa',
reference: 'REF-PD-007',
date: '2025-09-07',
status: 'Open'
},
{
id: 8,
number: 'PD-008',
vendorName: 'Dewi Anggraini',
vendorCompany: 'CV Inti Mandiri',
reference: 'REF-PD-008',
date: '2025-09-08',
status: 'Selesai'
},
{
id: 9,
number: 'PD-009',
vendorName: 'Yusuf Arifin',
vendorCompany: 'PT Surya Kencana',
reference: 'REF-PD-009',
date: '2025-09-09',
status: 'Open'
},
{
id: 10,
number: 'PD-010',
vendorName: 'Nurhayati',
vendorCompany: 'UD Cahaya Mulia',
reference: 'REF-PD-010',
date: '2025-09-10',
status: 'Selesai'
},
{
id: 11,
number: 'PD-011',
vendorName: 'Fajar Hidayat',
vendorCompany: 'PT Bina Karya',
reference: 'REF-PD-011',
date: '2025-09-11',
status: 'Open'
},
{
id: 12,
number: 'PD-012',
vendorName: 'Ratna Sari',
vendorCompany: 'CV Mega Utama',
reference: 'REF-PD-012',
date: '2025-09-12',
status: 'Selesai'
},
{
id: 13,
number: 'PD-013',
vendorName: 'Tono Prasetyo',
vendorCompany: 'UD Karya Indah',
reference: 'REF-PD-013',
date: '2025-09-13',
status: 'Open'
},
{
id: 14,
number: 'PD-014',
vendorName: 'Lina Marlina',
vendorCompany: 'PT Harmoni Sejati',
reference: 'REF-PD-014',
date: '2025-09-14',
status: 'Selesai'
},
{
id: 15,
number: 'PD-015',
vendorName: 'Arman Saputra',
vendorCompany: 'CV Sentra Niaga',
reference: 'REF-PD-015',
date: '2025-09-15',
status: 'Open'
},
{
id: 16,
number: 'PD-016',
vendorName: 'Indah Permata',
vendorCompany: 'PT Citra Abadi',
reference: 'REF-PD-016',
date: '2025-09-16',
status: 'Selesai'
},
{
id: 17,
number: 'PD-017',
vendorName: 'Adi Putra',
vendorCompany: 'UD Makmur Bersama',
reference: 'REF-PD-017',
date: '2025-09-17',
status: 'Open'
},
{
id: 18,
number: 'PD-018',
vendorName: 'Sri Wahyuni',
vendorCompany: 'CV Bintang Terang',
reference: 'REF-PD-018',
date: '2025-09-18',
status: 'Selesai'
},
{
id: 19,
number: 'PD-019',
vendorName: 'Eko Prabowo',
vendorCompany: 'PT Mandiri Jaya',
reference: 'REF-PD-019',
date: '2025-09-19',
status: 'Open'
},
{
id: 20,
number: 'PD-020',
vendorName: 'Novi Astuti',
vendorCompany: 'UD Sinar Harapan',
reference: 'REF-PD-020',
date: '2025-09-20',
status: 'Selesai'
}
]
+224
View File
@@ -0,0 +1,224 @@
import { PurchaseOrderType } from '@/types/apps/purchaseOrderTypes'
export const purchaseOrdersData: PurchaseOrderType[] = [
{
id: 1,
number: 'PO/00040',
vendorName: 'Kairav Wijaya Nababan',
vendorCompany: 'Yayasan Haryanto Tbk',
reference: '',
date: '05/09/2025',
dueDate: '19/09/2025',
status: 'Disetujui',
total: 2037170
},
{
id: 2,
number: 'PO/00041',
vendorName: 'Sari Melani Hutapea',
vendorCompany: 'PT Santoso Jaya',
reference: 'REF-2025-001',
date: '03/09/2025',
dueDate: '17/09/2025',
status: 'Draft',
total: 1875500
},
{
id: 3,
number: 'PO/00042',
vendorName: 'Budi Prasetyo Manullang',
vendorCompany: 'CV Wijaya Makmur',
reference: 'REF-2025-002',
date: '07/09/2025',
dueDate: '21/09/2025',
status: 'Dikirim Sebagian',
total: 3250750
},
{
id: 4,
number: 'PO/00043',
vendorName: 'Maya Sari Lumban Gaol',
vendorCompany: 'PT Indah Permata',
reference: '',
date: '02/09/2025',
dueDate: '16/09/2025',
status: 'Selesai',
total: 980250
},
{
id: 5,
number: 'PO/00044',
vendorName: 'Rahman Hakim Siahaan',
vendorCompany: 'Toko Bahagia Sejahtera',
reference: 'REF-2025-003',
date: '08/09/2025',
dueDate: '22/09/2025',
status: 'Draft',
total: 4125890
},
{
id: 6,
number: 'PO/00045',
vendorName: 'Dewi Anggraini Panjaitan',
vendorCompany: 'PT Maju Bersama',
reference: 'REF-2025-004',
date: '01/09/2025',
dueDate: '15/09/2025',
status: 'Selesai',
total: 2678300
},
{
id: 7,
number: 'PO/00046',
vendorName: 'Agung Wijaya Simbolon',
vendorCompany: 'CV Karya Mandiri',
reference: '',
date: '06/09/2025',
dueDate: '20/09/2025',
status: 'Disetujui',
total: 1456780
},
{
id: 8,
number: 'PO/00047',
vendorName: 'Fitri Handayani Sitorus',
vendorCompany: 'PT Global Nusantara',
reference: 'REF-2025-005',
date: '04/09/2025',
dueDate: '18/09/2025',
status: 'Dikirim Sebagian',
total: 5892450
},
{
id: 9,
number: 'PO/00048',
vendorName: 'Andi Setiawan Tampubolon',
vendorCompany: 'Yayasan Pembangunan Tbk',
reference: 'REF-2025-006',
date: '09/09/2025',
dueDate: '23/09/2025',
status: 'Draft',
total: 3567120
},
{
id: 10,
number: 'PO/00049',
vendorName: 'Rina Maharani Hutasoit',
vendorCompany: 'PT Sejahtera Abadi',
reference: '',
date: '05/09/2025',
dueDate: '19/09/2025',
status: 'Disetujui',
total: 2234680
},
{
id: 11,
number: 'PO/00050',
vendorName: 'Joko Santoso Nainggolan',
vendorCompany: 'CV Berkah Jaya',
reference: 'REF-2025-007',
date: '03/09/2025',
dueDate: '17/09/2025',
status: 'Selesai',
total: 1789560
},
{
id: 12,
number: 'PO/00051',
vendorName: 'Linda Safitri Simanjuntak',
vendorCompany: 'PT Harapan Bangsa',
reference: 'REF-2025-008',
date: '07/09/2025',
dueDate: '21/09/2025',
status: 'Dikirim Sebagian',
total: 4321870
},
{
id: 13,
number: 'PO/00052',
vendorName: 'Irfan Maulana Pasaribu',
vendorCompany: 'CV Sumber Rejeki',
reference: 'REF-2025-009',
date: '10/09/2025',
dueDate: '24/09/2025',
status: 'Draft',
total: 2567890
},
{
id: 14,
number: 'PO/00053',
vendorName: 'Siska Permata Sinaga',
vendorCompany: 'PT Mitra Sukses',
reference: '',
date: '11/09/2025',
dueDate: '25/09/2025',
status: 'Disetujui',
total: 3456780
},
{
id: 15,
number: 'PO/00054',
vendorName: 'Rizky Aditya Siregar',
vendorCompany: 'Toko Aman Sentosa',
reference: 'REF-2025-010',
date: '08/09/2025',
dueDate: '22/09/2025',
status: 'Selesai',
total: 1234567
},
{
id: 16,
number: 'PO/00055',
vendorName: 'Nina Sari Hutabarat',
vendorCompany: 'PT Cahaya Terang',
reference: 'REF-2025-011',
date: '12/09/2025',
dueDate: '26/09/2025',
status: 'Dikirim Sebagian',
total: 5678900
},
{
id: 17,
number: 'PO/00056',
vendorName: 'Doni Prasetya Situmorang',
vendorCompany: 'CV Barokah Makmur',
reference: '',
date: '09/09/2025',
dueDate: '23/09/2025',
status: 'Draft',
total: 987654
},
{
id: 18,
number: 'PO/00057',
vendorName: 'Anita Dewi Marpaung',
vendorCompany: 'Yayasan Karya Bhakti',
reference: 'REF-2025-012',
date: '06/09/2025',
dueDate: '20/09/2025',
status: 'Disetujui',
total: 4567123
},
{
id: 19,
number: 'PO/00058',
vendorName: 'Tommy Wijaya Samosir',
vendorCompany: 'PT Bintang Timur',
reference: 'REF-2025-013',
date: '13/09/2025',
dueDate: '27/09/2025',
status: 'Selesai',
total: 2345678
},
{
id: 20,
number: 'PO/00059',
vendorName: 'Lestari Indah Pakpahan',
vendorCompany: 'CV Harmoni Jaya',
reference: '',
date: '05/09/2025',
dueDate: '19/09/2025',
status: 'Dikirim Sebagian',
total: 3789012
}
]
+224
View File
@@ -0,0 +1,224 @@
import { PurchaseQuoteType } from '@/types/apps/purchaseQuoteTypes'
export const purchaseQuoteData: PurchaseQuoteType[] = [
{
id: 1,
number: 'PQ-001',
vendorName: 'Andi Wijaya',
vendorCompany: 'PT Sumber Makmur',
reference: 'REF-PQ-001',
date: '2025-09-01',
dueDate: '2025-09-10',
status: 'Open',
total: 4500000
},
{
id: 2,
number: 'PQ-002',
vendorName: 'Siti Rahma',
vendorCompany: 'CV Cahaya Abadi',
reference: 'REF-PQ-002',
date: '2025-09-02',
dueDate: '2025-09-12',
status: 'Selesai',
total: 7200000
},
{
id: 3,
number: 'PQ-003',
vendorName: 'Budi Santoso',
vendorCompany: 'UD Sejahtera',
reference: 'REF-PQ-003',
date: '2025-09-03',
dueDate: '2025-09-13',
status: 'Dipesan Sebagai',
total: 3100000
},
{
id: 4,
number: 'PQ-004',
vendorName: 'Rina Kartika',
vendorCompany: 'PT Mitra Jaya',
reference: 'REF-PQ-004',
date: '2025-09-04',
dueDate: '2025-09-15',
status: 'Open',
total: 5800000
},
{
id: 5,
number: 'PQ-005',
vendorName: 'Agus Salim',
vendorCompany: 'CV Bumi Persada',
reference: 'REF-PQ-005',
date: '2025-09-05',
dueDate: '2025-09-16',
status: 'Selesai',
total: 8000000
},
{
id: 6,
number: 'PQ-006',
vendorName: 'Maya Lestari',
vendorCompany: 'PT Tunas Baru',
reference: 'REF-PQ-006',
date: '2025-09-06',
dueDate: '2025-09-17',
status: 'Dipesan Sebagai',
total: 2600000
},
{
id: 7,
number: 'PQ-007',
vendorName: 'Hendra Gunawan',
vendorCompany: 'UD Prima Sentosa',
reference: 'REF-PQ-007',
date: '2025-09-07',
dueDate: '2025-09-18',
status: 'Open',
total: 9300000
},
{
id: 8,
number: 'PQ-008',
vendorName: 'Dewi Anggraini',
vendorCompany: 'CV Inti Mandiri',
reference: 'REF-PQ-008',
date: '2025-09-08',
dueDate: '2025-09-19',
status: 'Selesai',
total: 4100000
},
{
id: 9,
number: 'PQ-009',
vendorName: 'Yusuf Arifin',
vendorCompany: 'PT Surya Kencana',
reference: 'REF-PQ-009',
date: '2025-09-09',
dueDate: '2025-09-20',
status: 'Dipesan Sebagai',
total: 6900000
},
{
id: 10,
number: 'PQ-010',
vendorName: 'Nurhayati',
vendorCompany: 'UD Cahaya Mulia',
reference: 'REF-PQ-010',
date: '2025-09-10',
dueDate: '2025-09-21',
status: 'Open',
total: 5500000
},
{
id: 11,
number: 'PQ-011',
vendorName: 'Fajar Hidayat',
vendorCompany: 'PT Bina Karya',
reference: 'REF-PQ-011',
date: '2025-09-11',
dueDate: '2025-09-22',
status: 'Selesai',
total: 12000000
},
{
id: 12,
number: 'PQ-012',
vendorName: 'Ratna Sari',
vendorCompany: 'CV Mega Utama',
reference: 'REF-PQ-012',
date: '2025-09-12',
dueDate: '2025-09-23',
status: 'Dipesan Sebagai',
total: 3300000
},
{
id: 13,
number: 'PQ-013',
vendorName: 'Tono Prasetyo',
vendorCompany: 'UD Karya Indah',
reference: 'REF-PQ-013',
date: '2025-09-13',
dueDate: '2025-09-24',
status: 'Open',
total: 7500000
},
{
id: 14,
number: 'PQ-014',
vendorName: 'Lina Marlina',
vendorCompany: 'PT Harmoni Sejati',
reference: 'REF-PQ-014',
date: '2025-09-14',
dueDate: '2025-09-25',
status: 'Selesai',
total: 8600000
},
{
id: 15,
number: 'PQ-015',
vendorName: 'Arman Saputra',
vendorCompany: 'CV Sentra Niaga',
reference: 'REF-PQ-015',
date: '2025-09-15',
dueDate: '2025-09-26',
status: 'Dipesan Sebagai',
total: 2950000
},
{
id: 16,
number: 'PQ-016',
vendorName: 'Indah Permata',
vendorCompany: 'PT Citra Abadi',
reference: 'REF-PQ-016',
date: '2025-09-16',
dueDate: '2025-09-27',
status: 'Open',
total: 6800000
},
{
id: 17,
number: 'PQ-017',
vendorName: 'Adi Putra',
vendorCompany: 'UD Makmur Bersama',
reference: 'REF-PQ-017',
date: '2025-09-17',
dueDate: '2025-09-28',
status: 'Selesai',
total: 4700000
},
{
id: 18,
number: 'PQ-018',
vendorName: 'Sri Wahyuni',
vendorCompany: 'CV Bintang Terang',
reference: 'REF-PQ-018',
date: '2025-09-18',
dueDate: '2025-09-29',
status: 'Dipesan Sebagai',
total: 5300000
},
{
id: 19,
number: 'PQ-019',
vendorName: 'Eko Prabowo',
vendorCompany: 'PT Mandiri Jaya',
reference: 'REF-PQ-019',
date: '2025-09-19',
dueDate: '2025-09-30',
status: 'Open',
total: 9500000
},
{
id: 20,
number: 'PQ-020',
vendorName: 'Novi Astuti',
vendorCompany: 'UD Sinar Harapan',
reference: 'REF-PQ-020',
date: '2025-09-20',
dueDate: '2025-10-01',
status: 'Selesai',
total: 4200000
}
]
+873
View File
@@ -0,0 +1,873 @@
import { SalesBillType, SalesDeliveryType, SalesOrderType, SalesQuoteType } from '@/types/apps/salesTypes'
export const salesBillData: SalesBillType[] = [
{
id: 1,
number: 'INV/001',
customerName: 'Andi Wijaya',
customerCompany: 'PT Nusantara Abadi',
reference: 'REF-SB-001',
date: '2025-09-01',
dueDate: '2025-09-15',
status: 'Belum Dibayar',
remainingBill: 5000000,
total: 5000000
},
{
id: 2,
number: 'INV/002',
customerName: 'Siti Rahma',
customerCompany: 'CV Cahaya Abadi',
reference: 'REF-SB-002',
date: '2025-09-02',
dueDate: '2025-09-16',
status: 'Dibayar Sebagian',
remainingBill: 2000000,
total: 8000000
},
{
id: 3,
number: 'INV/003',
customerName: 'Budi Santoso',
customerCompany: 'UD Sejahtera',
reference: 'REF-SB-003',
date: '2025-09-03',
dueDate: '2025-09-17',
status: 'Lunas',
remainingBill: 0,
total: 3500000
},
{
id: 4,
number: 'INV/004',
customerName: 'Rina Kartika',
customerCompany: 'PT Mitra Jaya',
reference: 'REF-SB-004',
date: '2025-09-04',
dueDate: '2025-09-18',
status: 'Void',
remainingBill: 0,
total: 4200000
},
{
id: 5,
number: 'INV/005',
customerName: 'Agus Salim',
customerCompany: 'CV Bumi Persada',
reference: 'REF-SB-005',
date: '2025-09-05',
dueDate: '2025-09-19',
status: 'Retur',
remainingBill: 0,
total: 6100000
},
{
id: 6,
number: 'INV/006',
customerName: 'Maya Lestari',
customerCompany: 'PT Tunas Baru',
reference: 'REF-SB-006',
date: '2025-09-06',
dueDate: '2025-09-20',
status: 'Belum Dibayar',
remainingBill: 9000000,
total: 9000000
},
{
id: 7,
number: 'INV/007',
customerName: 'Hendra Gunawan',
customerCompany: 'UD Prima Sentosa',
reference: 'REF-SB-007',
date: '2025-09-07',
dueDate: '2025-09-21',
status: 'Dibayar Sebagian',
remainingBill: 1500000,
total: 7500000
},
{
id: 8,
number: 'INV/008',
customerName: 'Dewi Anggraini',
customerCompany: 'CV Inti Mandiri',
reference: 'REF-SB-008',
date: '2025-09-08',
dueDate: '2025-09-22',
status: 'Lunas',
remainingBill: 0,
total: 4500000
},
{
id: 9,
number: 'INV/009',
customerName: 'Yusuf Arifin',
customerCompany: 'PT Surya Kencana',
reference: 'REF-SB-009',
date: '2025-09-09',
dueDate: '2025-09-23',
status: 'Void',
remainingBill: 0,
total: 5000000
},
{
id: 10,
number: 'INV/010',
customerName: 'Nurhayati',
customerCompany: 'UD Cahaya Mulia',
reference: 'REF-SB-010',
date: '2025-09-10',
dueDate: '2025-09-24',
status: 'Retur',
remainingBill: 0,
total: 3000000
},
{
id: 11,
number: 'INV/011',
customerName: 'Fajar Hidayat',
customerCompany: 'PT Bina Karya',
reference: 'REF-SB-011',
date: '2025-09-11',
dueDate: '2025-09-25',
status: 'Belum Dibayar',
remainingBill: 6000000,
total: 6000000
},
{
id: 12,
number: 'INV/012',
customerName: 'Ratna Sari',
customerCompany: 'CV Mega Utama',
reference: 'REF-SB-012',
date: '2025-09-12',
dueDate: '2025-09-26',
status: 'Dibayar Sebagian',
remainingBill: 2500000,
total: 10000000
},
{
id: 13,
number: 'INV/013',
customerName: 'Tono Prasetyo',
customerCompany: 'UD Karya Indah',
reference: 'REF-SB-013',
date: '2025-09-13',
dueDate: '2025-09-27',
status: 'Lunas',
remainingBill: 0,
total: 7000000
},
{
id: 14,
number: 'INV/014',
customerName: 'Lina Marlina',
customerCompany: 'PT Harmoni Sejati',
reference: 'REF-SB-014',
date: '2025-09-14',
dueDate: '2025-09-28',
status: 'Void',
remainingBill: 0,
total: 3200000
},
{
id: 15,
number: 'INV/015',
customerName: 'Arman Saputra',
customerCompany: 'CV Sentra Niaga',
reference: 'REF-SB-015',
date: '2025-09-15',
dueDate: '2025-09-29',
status: 'Retur',
remainingBill: 0,
total: 5400000
},
{
id: 16,
number: 'INV/016',
customerName: 'Indah Permata',
customerCompany: 'PT Citra Abadi',
reference: 'REF-SB-016',
date: '2025-09-16',
dueDate: '2025-09-30',
status: 'Belum Dibayar',
remainingBill: 8000000,
total: 8000000
},
{
id: 17,
number: 'INV/017',
customerName: 'Adi Putra',
customerCompany: 'UD Makmur Bersama',
reference: 'REF-SB-017',
date: '2025-09-17',
dueDate: '2025-10-01',
status: 'Dibayar Sebagian',
remainingBill: 1200000,
total: 6200000
},
{
id: 18,
number: 'INV/018',
customerName: 'Sri Wahyuni',
customerCompany: 'CV Bintang Terang',
reference: 'REF-SB-018',
date: '2025-09-18',
dueDate: '2025-10-02',
status: 'Lunas',
remainingBill: 0,
total: 9200000
},
{
id: 19,
number: 'INV/019',
customerName: 'Eko Prabowo',
customerCompany: 'PT Mandiri Jaya',
reference: 'REF-SB-019',
date: '2025-09-19',
dueDate: '2025-10-03',
status: 'Void',
remainingBill: 0,
total: 2500000
},
{
id: 20,
number: 'INV/020',
customerName: 'Novi Astuti',
customerCompany: 'UD Sinar Harapan',
reference: 'REF-SB-020',
date: '2025-09-20',
dueDate: '2025-10-04',
status: 'Retur',
remainingBill: 0,
total: 4800000
}
]
export const salesDeliveryData: SalesDeliveryType[] = [
{
id: 1,
number: 'INV-001',
vendorName: 'Andi Wijaya',
vendorCompany: 'PT Sumber Makmur',
reference: 'REF-INV-001',
date: '2025-09-01',
status: 'Open'
},
{
id: 2,
number: 'INV-002',
vendorName: 'Siti Rahma',
vendorCompany: 'CV Cahaya Abadi',
reference: 'REF-INV-002',
date: '2025-09-02',
status: 'Selesai'
},
{
id: 3,
number: 'INV-003',
vendorName: 'Budi Santoso',
vendorCompany: 'UD Sejahtera',
reference: 'REF-INV-003',
date: '2025-09-03',
status: 'Open'
},
{
id: 4,
number: 'INV-004',
vendorName: 'Rina Kartika',
vendorCompany: 'PT Mitra Jaya',
reference: 'REF-INV-004',
date: '2025-09-04',
status: 'Selesai'
},
{
id: 5,
number: 'INV-005',
vendorName: 'Agus Salim',
vendorCompany: 'CV Bumi Persada',
reference: 'REF-INV-005',
date: '2025-09-05',
status: 'Open'
},
{
id: 6,
number: 'INV-006',
vendorName: 'Maya Lestari',
vendorCompany: 'PT Tunas Baru',
reference: 'REF-INV-006',
date: '2025-09-06',
status: 'Selesai'
},
{
id: 7,
number: 'INV-007',
vendorName: 'Hendra Gunawan',
vendorCompany: 'UD Prima Sentosa',
reference: 'REF-INV-007',
date: '2025-09-07',
status: 'Open'
},
{
id: 8,
number: 'INV-008',
vendorName: 'Dewi Anggraini',
vendorCompany: 'CV Inti Mandiri',
reference: 'REF-INV-008',
date: '2025-09-08',
status: 'Selesai'
},
{
id: 9,
number: 'INV-009',
vendorName: 'Yusuf Arifin',
vendorCompany: 'PT Surya Kencana',
reference: 'REF-INV-009',
date: '2025-09-09',
status: 'Open'
},
{
id: 10,
number: 'INV-010',
vendorName: 'Nurhayati',
vendorCompany: 'UD Cahaya Mulia',
reference: 'REF-INV-010',
date: '2025-09-10',
status: 'Selesai'
},
{
id: 11,
number: 'INV-011',
vendorName: 'Fajar Hidayat',
vendorCompany: 'PT Bina Karya',
reference: 'REF-INV-011',
date: '2025-09-11',
status: 'Open'
},
{
id: 12,
number: 'INV-012',
vendorName: 'Ratna Sari',
vendorCompany: 'CV Mega Utama',
reference: 'REF-INV-012',
date: '2025-09-12',
status: 'Selesai'
},
{
id: 13,
number: 'INV-013',
vendorName: 'Tono Prasetyo',
vendorCompany: 'UD Karya Indah',
reference: 'REF-INV-013',
date: '2025-09-13',
status: 'Open'
},
{
id: 14,
number: 'INV-014',
vendorName: 'Lina Marlina',
vendorCompany: 'PT Harmoni Sejati',
reference: 'REF-INV-014',
date: '2025-09-14',
status: 'Selesai'
},
{
id: 15,
number: 'INV-015',
vendorName: 'Arman Saputra',
vendorCompany: 'CV Sentra Niaga',
reference: 'REF-INV-015',
date: '2025-09-15',
status: 'Open'
},
{
id: 16,
number: 'INV-016',
vendorName: 'Indah Permata',
vendorCompany: 'PT Citra Abadi',
reference: 'REF-INV-016',
date: '2025-09-16',
status: 'Selesai'
},
{
id: 17,
number: 'INV-017',
vendorName: 'Adi Putra',
vendorCompany: 'UD Makmur Bersama',
reference: 'REF-INV-017',
date: '2025-09-17',
status: 'Open'
},
{
id: 18,
number: 'INV-018',
vendorName: 'Sri Wahyuni',
vendorCompany: 'CV Bintang Terang',
reference: 'REF-INV-018',
date: '2025-09-18',
status: 'Selesai'
},
{
id: 19,
number: 'INV-019',
vendorName: 'Eko Prabowo',
vendorCompany: 'PT Mandiri Jaya',
reference: 'REF-INV-019',
date: '2025-09-19',
status: 'Open'
},
{
id: 20,
number: 'INV-020',
vendorName: 'Novi Astuti',
vendorCompany: 'UD Sinar Harapan',
reference: 'REF-INV-020',
date: '2025-09-20',
status: 'Selesai'
}
]
export const salesOrdersData: SalesOrderType[] = [
{
id: 1,
number: 'PO/00040',
vendorName: 'Kairav Wijaya Nababan',
vendorCompany: 'Yayasan Haryanto Tbk',
reference: '',
date: '05/09/2025',
dueDate: '19/09/2025',
status: 'Disetujui',
total: 2037170
},
{
id: 2,
number: 'PO/00041',
vendorName: 'Sari Melani Hutapea',
vendorCompany: 'PT Santoso Jaya',
reference: 'REF-2025-001',
date: '03/09/2025',
dueDate: '17/09/2025',
status: 'Draft',
total: 1875500
},
{
id: 3,
number: 'PO/00042',
vendorName: 'Budi Prasetyo Manullang',
vendorCompany: 'CV Wijaya Makmur',
reference: 'REF-2025-002',
date: '07/09/2025',
dueDate: '21/09/2025',
status: 'Dikirim Sebagian',
total: 3250750
},
{
id: 4,
number: 'PO/00043',
vendorName: 'Maya Sari Lumban Gaol',
vendorCompany: 'PT Indah Permata',
reference: '',
date: '02/09/2025',
dueDate: '16/09/2025',
status: 'Selesai',
total: 980250
},
{
id: 5,
number: 'PO/00044',
vendorName: 'Rahman Hakim Siahaan',
vendorCompany: 'Toko Bahagia Sejahtera',
reference: 'REF-2025-003',
date: '08/09/2025',
dueDate: '22/09/2025',
status: 'Draft',
total: 4125890
},
{
id: 6,
number: 'PO/00045',
vendorName: 'Dewi Anggraini Panjaitan',
vendorCompany: 'PT Maju Bersama',
reference: 'REF-2025-004',
date: '01/09/2025',
dueDate: '15/09/2025',
status: 'Selesai',
total: 2678300
},
{
id: 7,
number: 'PO/00046',
vendorName: 'Agung Wijaya Simbolon',
vendorCompany: 'CV Karya Mandiri',
reference: '',
date: '06/09/2025',
dueDate: '20/09/2025',
status: 'Disetujui',
total: 1456780
},
{
id: 8,
number: 'PO/00047',
vendorName: 'Fitri Handayani Sitorus',
vendorCompany: 'PT Global Nusantara',
reference: 'REF-2025-005',
date: '04/09/2025',
dueDate: '18/09/2025',
status: 'Dikirim Sebagian',
total: 5892450
},
{
id: 9,
number: 'PO/00048',
vendorName: 'Andi Setiawan Tampubolon',
vendorCompany: 'Yayasan Pembangunan Tbk',
reference: 'REF-2025-006',
date: '09/09/2025',
dueDate: '23/09/2025',
status: 'Draft',
total: 3567120
},
{
id: 10,
number: 'PO/00049',
vendorName: 'Rina Maharani Hutasoit',
vendorCompany: 'PT Sejahtera Abadi',
reference: '',
date: '05/09/2025',
dueDate: '19/09/2025',
status: 'Disetujui',
total: 2234680
},
{
id: 11,
number: 'PO/00050',
vendorName: 'Joko Santoso Nainggolan',
vendorCompany: 'CV Berkah Jaya',
reference: 'REF-2025-007',
date: '03/09/2025',
dueDate: '17/09/2025',
status: 'Selesai',
total: 1789560
},
{
id: 12,
number: 'PO/00051',
vendorName: 'Linda Safitri Simanjuntak',
vendorCompany: 'PT Harapan Bangsa',
reference: 'REF-2025-008',
date: '07/09/2025',
dueDate: '21/09/2025',
status: 'Dikirim Sebagian',
total: 4321870
},
{
id: 13,
number: 'PO/00052',
vendorName: 'Irfan Maulana Pasaribu',
vendorCompany: 'CV Sumber Rejeki',
reference: 'REF-2025-009',
date: '10/09/2025',
dueDate: '24/09/2025',
status: 'Draft',
total: 2567890
},
{
id: 14,
number: 'PO/00053',
vendorName: 'Siska Permata Sinaga',
vendorCompany: 'PT Mitra Sukses',
reference: '',
date: '11/09/2025',
dueDate: '25/09/2025',
status: 'Disetujui',
total: 3456780
},
{
id: 15,
number: 'PO/00054',
vendorName: 'Rizky Aditya Siregar',
vendorCompany: 'Toko Aman Sentosa',
reference: 'REF-2025-010',
date: '08/09/2025',
dueDate: '22/09/2025',
status: 'Selesai',
total: 1234567
},
{
id: 16,
number: 'PO/00055',
vendorName: 'Nina Sari Hutabarat',
vendorCompany: 'PT Cahaya Terang',
reference: 'REF-2025-011',
date: '12/09/2025',
dueDate: '26/09/2025',
status: 'Dikirim Sebagian',
total: 5678900
},
{
id: 17,
number: 'PO/00056',
vendorName: 'Doni Prasetya Situmorang',
vendorCompany: 'CV Barokah Makmur',
reference: '',
date: '09/09/2025',
dueDate: '23/09/2025',
status: 'Draft',
total: 987654
},
{
id: 18,
number: 'PO/00057',
vendorName: 'Anita Dewi Marpaung',
vendorCompany: 'Yayasan Karya Bhakti',
reference: 'REF-2025-012',
date: '06/09/2025',
dueDate: '20/09/2025',
status: 'Disetujui',
total: 4567123
},
{
id: 19,
number: 'PO/00058',
vendorName: 'Tommy Wijaya Samosir',
vendorCompany: 'PT Bintang Timur',
reference: 'REF-2025-013',
date: '13/09/2025',
dueDate: '27/09/2025',
status: 'Selesai',
total: 2345678
},
{
id: 20,
number: 'PO/00059',
vendorName: 'Lestari Indah Pakpahan',
vendorCompany: 'CV Harmoni Jaya',
reference: '',
date: '05/09/2025',
dueDate: '19/09/2025',
status: 'Dikirim Sebagian',
total: 3789012
}
]
export const salesQuoteData: SalesQuoteType[] = [
{
id: 1,
number: 'PQ-001',
vendorName: 'Andi Wijaya',
vendorCompany: 'PT Sumber Makmur',
reference: 'REF-PQ-001',
date: '2025-09-01',
dueDate: '2025-09-10',
status: 'Open',
total: 4500000
},
{
id: 2,
number: 'PQ-002',
vendorName: 'Siti Rahma',
vendorCompany: 'CV Cahaya Abadi',
reference: 'REF-PQ-002',
date: '2025-09-02',
dueDate: '2025-09-12',
status: 'Selesai',
total: 7200000
},
{
id: 3,
number: 'PQ-003',
vendorName: 'Budi Santoso',
vendorCompany: 'UD Sejahtera',
reference: 'REF-PQ-003',
date: '2025-09-03',
dueDate: '2025-09-13',
status: 'Dipesan Sebagai',
total: 3100000
},
{
id: 4,
number: 'PQ-004',
vendorName: 'Rina Kartika',
vendorCompany: 'PT Mitra Jaya',
reference: 'REF-PQ-004',
date: '2025-09-04',
dueDate: '2025-09-15',
status: 'Open',
total: 5800000
},
{
id: 5,
number: 'PQ-005',
vendorName: 'Agus Salim',
vendorCompany: 'CV Bumi Persada',
reference: 'REF-PQ-005',
date: '2025-09-05',
dueDate: '2025-09-16',
status: 'Selesai',
total: 8000000
},
{
id: 6,
number: 'PQ-006',
vendorName: 'Maya Lestari',
vendorCompany: 'PT Tunas Baru',
reference: 'REF-PQ-006',
date: '2025-09-06',
dueDate: '2025-09-17',
status: 'Dipesan Sebagai',
total: 2600000
},
{
id: 7,
number: 'PQ-007',
vendorName: 'Hendra Gunawan',
vendorCompany: 'UD Prima Sentosa',
reference: 'REF-PQ-007',
date: '2025-09-07',
dueDate: '2025-09-18',
status: 'Open',
total: 9300000
},
{
id: 8,
number: 'PQ-008',
vendorName: 'Dewi Anggraini',
vendorCompany: 'CV Inti Mandiri',
reference: 'REF-PQ-008',
date: '2025-09-08',
dueDate: '2025-09-19',
status: 'Selesai',
total: 4100000
},
{
id: 9,
number: 'PQ-009',
vendorName: 'Yusuf Arifin',
vendorCompany: 'PT Surya Kencana',
reference: 'REF-PQ-009',
date: '2025-09-09',
dueDate: '2025-09-20',
status: 'Dipesan Sebagai',
total: 6900000
},
{
id: 10,
number: 'PQ-010',
vendorName: 'Nurhayati',
vendorCompany: 'UD Cahaya Mulia',
reference: 'REF-PQ-010',
date: '2025-09-10',
dueDate: '2025-09-21',
status: 'Open',
total: 5500000
},
{
id: 11,
number: 'PQ-011',
vendorName: 'Fajar Hidayat',
vendorCompany: 'PT Bina Karya',
reference: 'REF-PQ-011',
date: '2025-09-11',
dueDate: '2025-09-22',
status: 'Selesai',
total: 12000000
},
{
id: 12,
number: 'PQ-012',
vendorName: 'Ratna Sari',
vendorCompany: 'CV Mega Utama',
reference: 'REF-PQ-012',
date: '2025-09-12',
dueDate: '2025-09-23',
status: 'Dipesan Sebagai',
total: 3300000
},
{
id: 13,
number: 'PQ-013',
vendorName: 'Tono Prasetyo',
vendorCompany: 'UD Karya Indah',
reference: 'REF-PQ-013',
date: '2025-09-13',
dueDate: '2025-09-24',
status: 'Open',
total: 7500000
},
{
id: 14,
number: 'PQ-014',
vendorName: 'Lina Marlina',
vendorCompany: 'PT Harmoni Sejati',
reference: 'REF-PQ-014',
date: '2025-09-14',
dueDate: '2025-09-25',
status: 'Selesai',
total: 8600000
},
{
id: 15,
number: 'PQ-015',
vendorName: 'Arman Saputra',
vendorCompany: 'CV Sentra Niaga',
reference: 'REF-PQ-015',
date: '2025-09-15',
dueDate: '2025-09-26',
status: 'Dipesan Sebagai',
total: 2950000
},
{
id: 16,
number: 'PQ-016',
vendorName: 'Indah Permata',
vendorCompany: 'PT Citra Abadi',
reference: 'REF-PQ-016',
date: '2025-09-16',
dueDate: '2025-09-27',
status: 'Open',
total: 6800000
},
{
id: 17,
number: 'PQ-017',
vendorName: 'Adi Putra',
vendorCompany: 'UD Makmur Bersama',
reference: 'REF-PQ-017',
date: '2025-09-17',
dueDate: '2025-09-28',
status: 'Selesai',
total: 4700000
},
{
id: 18,
number: 'PQ-018',
vendorName: 'Sri Wahyuni',
vendorCompany: 'CV Bintang Terang',
reference: 'REF-PQ-018',
date: '2025-09-18',
dueDate: '2025-09-29',
status: 'Dipesan Sebagai',
total: 5300000
},
{
id: 19,
number: 'PQ-019',
vendorName: 'Eko Prabowo',
vendorCompany: 'PT Mandiri Jaya',
reference: 'REF-PQ-019',
date: '2025-09-19',
dueDate: '2025-09-30',
status: 'Open',
total: 9500000
},
{
id: 20,
number: 'PQ-020',
vendorName: 'Novi Astuti',
vendorCompany: 'UD Sinar Harapan',
reference: 'REF-PQ-020',
date: '2025-09-20',
dueDate: '2025-10-01',
status: 'Selesai',
total: 4200000
}
]

Some files were not shown because too many files have changed in this diff Show More