diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..7c4836f --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e7b78f5 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pos-dashboard-v2.iml b/.idea/pos-dashboard-v2.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/pos-dashboard-v2.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..84164b3 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/deployment.sh b/deployment.sh new file mode 100644 index 0000000..1355703 --- /dev/null +++ b/deployment.sh @@ -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." diff --git a/next.config.ts b/next.config.ts index e21db92..50436c1 100644 --- a/next.config.ts +++ b/next.config.ts @@ -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 diff --git a/package-lock.json b/package-lock.json index 52d1762..3359af7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,6 +25,7 @@ "@fullcalendar/react": "6.1.15", "@fullcalendar/timegrid": "6.1.15", "@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", @@ -1308,6 +1309,21 @@ "pathe": "^1.1.2" } }, + "node_modules/@iconify/react": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@iconify/react/-/react-6.0.1.tgz", + "integrity": "sha512-fCocnAfiGXjrA0u7KkS3W/OQHNp9LRFICudvOtxmS3Mf7U92aDhP50wyzRbobZli51zYt9ksZ9g0J7H586XvOQ==", + "license": "MIT", + "dependencies": { + "@iconify/types": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/cyberalien" + }, + "peerDependencies": { + "react": ">=16" + } + }, "node_modules/@iconify/tools": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/@iconify/tools/-/tools-4.1.1.tgz", @@ -1332,7 +1348,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", - "dev": true, "license": "MIT" }, "node_modules/@iconify/utils": { diff --git a/package.json b/package.json index 0e92148..70a67a7 100644 --- a/package.json +++ b/package.json @@ -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", @@ -30,6 +31,7 @@ "@fullcalendar/react": "6.1.15", "@fullcalendar/timegrid": "6.1.15", "@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", diff --git a/src/components/layout/horizontal/HorizontalMenu.tsx b/src/components/layout/horizontal/HorizontalMenu.tsx index af9bbac..dd7658e 100644 --- a/src/components/layout/horizontal/HorizontalMenu.tsx +++ b/src/components/layout/horizontal/HorizontalMenu.tsx @@ -97,8 +97,8 @@ const HorizontalMenu = ({ dictionary }: { dictionary: Awaited}> {dictionary['navigation'].analytics} - }> - {dictionary['navigation'].eCommerce} + }> + {dictionary['navigation'].inventory} }> {dictionary['navigation'].academy} diff --git a/src/services/api.ts b/src/services/api.ts index ab43ede..7dc7a13 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -6,7 +6,7 @@ const getToken = () => { } export const api = axios.create({ - baseURL: process.env.NEXT_PUBLIC_API_URL, + baseURL: 'https://api-pos.apskel.id/api/v1', headers: { 'Content-Type': 'application/json' }, diff --git a/src/views/apps/ecommerce/stock/adjustment/AdjustmentStockDrawer.tsx b/src/views/apps/ecommerce/stock/adjustment/AdjustmentStockDrawer.tsx index 6f1b75c..f783329 100644 --- a/src/views/apps/ecommerce/stock/adjustment/AdjustmentStockDrawer.tsx +++ b/src/views/apps/ecommerce/stock/adjustment/AdjustmentStockDrawer.tsx @@ -151,7 +151,7 @@ const AdjustmentStockDrawer = (props: Props) => { onChange={e => setFormData({ ...formData, items: [{ ...formData.items[0], item_type: e.target.value }] })} > Product - Ingredient + {/* Ingredient */} = ({ - + {labels.periodLabel || 'Periode:'}{' '}