mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ad6c25d8b6 |
@@ -42,9 +42,3 @@ next-env.d.ts
|
|||||||
|
|
||||||
# idea
|
# idea
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
# claude
|
|
||||||
.claude
|
|
||||||
|
|
||||||
# rtk
|
|
||||||
rtk.exe
|
|
||||||
|
|||||||
+30
-97
@@ -2,20 +2,9 @@ stages:
|
|||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
# ==========================================================
|
|
||||||
# ✅ Global defaults
|
|
||||||
# ==========================================================
|
|
||||||
default:
|
|
||||||
tags:
|
|
||||||
- server-development-biznet
|
|
||||||
interruptible: true
|
|
||||||
|
|
||||||
# ==========================================================
|
|
||||||
# 🏗️ Build Template
|
|
||||||
# ==========================================================
|
|
||||||
.build_template: &build_template
|
.build_template: &build_template
|
||||||
stage: build
|
stage: build
|
||||||
image: public.ecr.aws/docker/library/node:20-alpine
|
image: node:20-alpine
|
||||||
cache:
|
cache:
|
||||||
key: npm-cache
|
key: npm-cache
|
||||||
paths:
|
paths:
|
||||||
@@ -26,37 +15,18 @@ default:
|
|||||||
script:
|
script:
|
||||||
- echo "Installing dependencies..."
|
- echo "Installing dependencies..."
|
||||||
- npm ci --no-audit --no-fund
|
- npm ci --no-audit --no-fund
|
||||||
- echo "Build env used:"
|
|
||||||
- echo "NEXT_PUBLIC_LTI_URL=$NEXT_PUBLIC_LTI_URL"
|
|
||||||
- echo "NEXT_PUBLIC_SSO_LOGIN_URL=$NEXT_PUBLIC_SSO_LOGIN_URL"
|
|
||||||
- echo "NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL"
|
|
||||||
- echo "Building Next.js static export..."
|
- echo "Building Next.js static export..."
|
||||||
- npx next build
|
- npx next build
|
||||||
- |
|
|
||||||
mkdir -p out
|
|
||||||
cat <<EOF > out/build-info.json
|
|
||||||
{
|
|
||||||
"commit": "$CI_COMMIT_SHORT_SHA",
|
|
||||||
"pipeline": "$CI_PIPELINE_ID",
|
|
||||||
"built_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
|
||||||
"NEXT_PUBLIC_LTI_URL": "$NEXT_PUBLIC_LTI_URL",
|
|
||||||
"NEXT_PUBLIC_SSO_LOGIN_URL": "$NEXT_PUBLIC_SSO_LOGIN_URL",
|
|
||||||
"NEXT_PUBLIC_API_BASE_URL": "$NEXT_PUBLIC_API_BASE_URL"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
artifacts:
|
artifacts:
|
||||||
name: 'out-$CI_COMMIT_SHORT_SHA'
|
name: 'out-$CI_COMMIT_SHORT_SHA'
|
||||||
paths:
|
paths:
|
||||||
- out/
|
- out/
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
||||||
# ==========================================================
|
|
||||||
# 🚀 Deploy Template
|
|
||||||
# ==========================================================
|
|
||||||
.deploy_template: &deploy_template
|
.deploy_template: &deploy_template
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image:
|
image:
|
||||||
name: public.ecr.aws/aws-cli/aws-cli:latest
|
name: amazon/aws-cli:latest
|
||||||
entrypoint: ['/bin/sh', '-c']
|
entrypoint: ['/bin/sh', '-c']
|
||||||
script:
|
script:
|
||||||
- set -e
|
- set -e
|
||||||
@@ -87,8 +57,8 @@ default:
|
|||||||
|
|
||||||
if [ "$CI_COMMIT_BRANCH" = "development" ]; then
|
if [ "$CI_COMMIT_BRANCH" = "development" ]; then
|
||||||
ENVIRONMENT_NAME="WEB-LTI-DEV"
|
ENVIRONMENT_NAME="WEB-LTI-DEV"
|
||||||
elif [ "$CI_COMMIT_BRANCH" = "staging" ]; then
|
elif [ "$CI_COMMIT_BRANCH" = "master" ]; then
|
||||||
ENVIRONMENT_NAME="WEB-LTI-STAGING"
|
ENVIRONMENT_NAME="WEB-LTI-PROD"
|
||||||
else
|
else
|
||||||
ENVIRONMENT_NAME="UNKNOWN"
|
ENVIRONMENT_NAME="UNKNOWN"
|
||||||
fi
|
fi
|
||||||
@@ -96,11 +66,11 @@ default:
|
|||||||
if [ "$STATUS" = "success" ]; then
|
if [ "$STATUS" = "success" ]; then
|
||||||
COLOR=3066993
|
COLOR=3066993
|
||||||
TITLE="✅ Deployment ${ENVIRONMENT_NAME} Succeeded"
|
TITLE="✅ Deployment ${ENVIRONMENT_NAME} Succeeded"
|
||||||
DESC="Deployment job on branch \${CI_COMMIT_REF_NAME}\ completed successfully."
|
DESC="Deployment job on branch \`${CI_COMMIT_REF_NAME}\` completed successfully."
|
||||||
else
|
else
|
||||||
COLOR=15158332
|
COLOR=15158332
|
||||||
TITLE="❌ Deployment ${ENVIRONMENT_NAME} Failed"
|
TITLE="❌ Deployment ${ENVIRONMENT_NAME} Failed"
|
||||||
DESC="Deployment job on branch \${CI_COMMIT_REF_NAME}\ encountered issues."
|
DESC="Deployment job on branch \`${CI_COMMIT_REF_NAME}\` encountered issues."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
jq -n \
|
jq -n \
|
||||||
@@ -128,9 +98,7 @@ default:
|
|||||||
|
|
||||||
curl -sS -H "Content-Type: application/json" -d @payload.json "$DISCORD_WEBHOOK_URL"
|
curl -sS -H "Content-Type: application/json" -d @payload.json "$DISCORD_WEBHOOK_URL"
|
||||||
|
|
||||||
# ==========================================================
|
# ====== DEVELOPMENT (Branch development) ======
|
||||||
# ==== DEVELOPMENT (Branch development) ======
|
|
||||||
# ==========================================================
|
|
||||||
build:dev:
|
build:dev:
|
||||||
<<: *build_template
|
<<: *build_template
|
||||||
rules:
|
rules:
|
||||||
@@ -138,10 +106,8 @@ build:dev:
|
|||||||
environment:
|
environment:
|
||||||
name: development
|
name: development
|
||||||
variables:
|
variables:
|
||||||
NEXT_PUBLIC_LTI_URL: 'https://dev-lti-erp.mbugroup.id'
|
NEXT_PUBLIC_API_BASE_URL: 'https://dev-api-lti.mbugroup.id'
|
||||||
NEXT_PUBLIC_SSO_LOGIN_URL: 'https://dev-auth-erp.mbugroup.id'
|
NEXT_PUBLIC_SSO_LOGIN_URL: 'https://dev-api-sso.mbugroup.id'
|
||||||
NEXT_PUBLIC_API_BASE_URL: 'https://dev-api-lti.mbugroup.id/api'
|
|
||||||
NEXT_PUBLIC_CLIENT_ID: 'Lumbung-Telur-Indonesia'
|
|
||||||
|
|
||||||
deploy:dev:
|
deploy:dev:
|
||||||
<<: *deploy_template
|
<<: *deploy_template
|
||||||
@@ -155,59 +121,26 @@ deploy:dev:
|
|||||||
environment:
|
environment:
|
||||||
name: development
|
name: development
|
||||||
url: https://dev-lti-erp.mbugroup.id
|
url: https://dev-lti-erp.mbugroup.id
|
||||||
|
# ====== PRODUCTION ======
|
||||||
|
# build:production:
|
||||||
|
# <<: *build_template
|
||||||
|
# rules:
|
||||||
|
# # pilih salah satu: pakai branch master ATAU pakai tags rilis
|
||||||
|
# - if: '$CI_COMMIT_BRANCH == "master"'
|
||||||
|
# # - if: '$CI_COMMIT_TAG' # kalau mau rilis via tag, uncomment ini dan hapus baris di atas
|
||||||
|
# environment:
|
||||||
|
# name: production
|
||||||
|
|
||||||
# ==========================================================
|
# deploy:production:
|
||||||
# ====== STAGING (Branch staging) ======
|
# <<: *deploy_template
|
||||||
# ==========================================================
|
# needs: ["build:production"]
|
||||||
build:staging:
|
# rules:
|
||||||
<<: *build_template
|
# - if: '$CI_COMMIT_BRANCH == "master"'
|
||||||
rules:
|
# # - if: '$CI_COMMIT_TAG' # selaras dengan rule di build:production
|
||||||
- if: '$CI_COMMIT_BRANCH == "staging"'
|
# variables:
|
||||||
environment:
|
# S3_BUCKET: "lti-erp.mbugroup.id"
|
||||||
name: staging
|
# CLOUDFRONT_DISTRIBUTION_ID: "ddfd"
|
||||||
variables:
|
# environment:
|
||||||
NEXT_PUBLIC_LTI_URL: 'https://stg-lti-erp.mbugroup.id'
|
# name: production
|
||||||
NEXT_PUBLIC_SSO_LOGIN_URL: 'https://stg-auth-erp.mbugroup.id'
|
# url: https://royalgoldcapital.com
|
||||||
NEXT_PUBLIC_API_BASE_URL: 'https://stg-api-lti.mbugroup.id/api'
|
|
||||||
NEXT_PUBLIC_CLIENT_ID: 'Lumbung-Telur-Indonesia'
|
|
||||||
|
|
||||||
deploy:staging:
|
|
||||||
<<: *deploy_template
|
|
||||||
needs: ['build:staging']
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "staging"'
|
|
||||||
variables:
|
|
||||||
S3_BUCKET: 'stg-lti-erp.mbugroup.id'
|
|
||||||
AWS_REGION: 'ap-southeast-3'
|
|
||||||
CLOUDFRONT_DISTRIBUTION_ID: 'E2V6PPO1AUIU7H'
|
|
||||||
environment:
|
|
||||||
name: staging
|
|
||||||
url: https://stg-lti-erp.mbugroup.id
|
|
||||||
|
|
||||||
# ==========================================================
|
|
||||||
# ====== STAGING (Branch production) ======
|
|
||||||
# ==========================================================
|
|
||||||
build:production:
|
|
||||||
<<: *build_template
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "production"'
|
|
||||||
environment:
|
|
||||||
name: staging
|
|
||||||
variables:
|
|
||||||
NEXT_PUBLIC_LTI_URL: 'https://lti-erp.mbugroup.id'
|
|
||||||
NEXT_PUBLIC_SSO_LOGIN_URL: 'https://auth-erp.mbugroup.id'
|
|
||||||
NEXT_PUBLIC_API_BASE_URL: 'https://api-lti.mbugroup.id/api'
|
|
||||||
NEXT_PUBLIC_CLIENT_ID: 'Lumbung-Telur-Indonesia'
|
|
||||||
|
|
||||||
deploy:production:
|
|
||||||
<<: *deploy_template
|
|
||||||
needs: ['build:production']
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "production"'
|
|
||||||
variables:
|
|
||||||
S3_BUCKET: 'production-lti-erp.mbugroup.id'
|
|
||||||
AWS_REGION: 'ap-southeast-3'
|
|
||||||
CLOUDFRONT_DISTRIBUTION_ID: 'E1SSLXKYYITASJ'
|
|
||||||
environment:
|
|
||||||
name: staging
|
|
||||||
url: https://lti-erp.mbugroup.id
|
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
npm run format
|
npm run format
|
||||||
npm run lint
|
npm run lint
|
||||||
npm run typecheck
|
npm run build
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM public.ecr.aws/docker/library/node:20-alpine
|
FROM node:20-alpine
|
||||||
|
|
||||||
RUN apk add --no-cache git bash build-base curl
|
RUN apk add --no-cache git bash build-base curl
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import type { NextConfig } from 'next';
|
|||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: 'export',
|
output: 'export',
|
||||||
images: { unoptimized: true },
|
images: { unoptimized: true },
|
||||||
trailingSlash: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
Generated
+72
-4408
File diff suppressed because it is too large
Load Diff
+6
-25
@@ -7,47 +7,28 @@
|
|||||||
"build": "next build --turbopack",
|
"build": "next build --turbopack",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "eslint",
|
"lint": "eslint",
|
||||||
"typecheck": "next typegen && tsc --noEmit",
|
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write ."
|
||||||
"pre-commit": "npm run format && npm run lint && npm run typecheck && npm run build"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-pdf/renderer": "^4.3.1",
|
"@react-pdf/renderer": "^4.3.1",
|
||||||
"@tanstack/match-sorter-utils": "^8.19.4",
|
"@tanstack/match-sorter-utils": "^8.19.4",
|
||||||
"@tanstack/react-table": "^8.21.3",
|
"@tanstack/react-table": "^8.21.3",
|
||||||
"axios": "^1.12.2",
|
"axios": "^1.12.2",
|
||||||
"class-variance-authority": "^0.7.1",
|
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cmdk": "^1.1.1",
|
|
||||||
"embla-carousel-react": "^8.6.0",
|
|
||||||
"exceljs": "^4.4.0",
|
|
||||||
"formik": "^2.4.6",
|
"formik": "^2.4.6",
|
||||||
"html-to-image": "^1.11.13",
|
|
||||||
"input-otp": "^1.4.2",
|
|
||||||
"jspdf": "^3.0.4",
|
|
||||||
"jspdf-autotable": "^5.0.2",
|
|
||||||
"lucide-react": "^0.562.0",
|
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"next": "15.5.9",
|
"next": "15.5.3",
|
||||||
"next-themes": "^0.4.6",
|
"react": "19.1.0",
|
||||||
"radix-ui": "^1.4.3",
|
|
||||||
"react": "^19.1.2",
|
|
||||||
"react-day-picker": "^9.11.1",
|
"react-day-picker": "^9.11.1",
|
||||||
"react-dom": "^19.1.2",
|
"react-dom": "19.1.0",
|
||||||
"react-dropzone": "^14.3.8",
|
"react-dropzone": "^14.3.8",
|
||||||
"react-hook-form": "^7.70.0",
|
|
||||||
"react-hot-toast": "^2.6.0",
|
"react-hot-toast": "^2.6.0",
|
||||||
"react-number-format": "^5.4.4",
|
"react-number-format": "^5.4.4",
|
||||||
"react-resizable-panels": "2.1.7",
|
|
||||||
"react-select": "^5.10.2",
|
"react-select": "^5.10.2",
|
||||||
"recharts": "^3.6.0",
|
|
||||||
"sonner": "^2.0.7",
|
|
||||||
"swr": "^2.3.6",
|
"swr": "^2.3.6",
|
||||||
"tailwind-merge": "^3.3.1",
|
"tailwind-merge": "^3.3.1",
|
||||||
"use-debounce": "^10.0.6",
|
"use-debounce": "^10.0.6",
|
||||||
"vaul": "^1.1.2",
|
|
||||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
||||||
"yup": "^1.7.0",
|
"yup": "^1.7.0",
|
||||||
"zustand": "^5.0.8"
|
"zustand": "^5.0.8"
|
||||||
},
|
},
|
||||||
@@ -58,9 +39,9 @@
|
|||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
"daisyui": "^5.5.14",
|
"daisyui": "^5.1.12",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "^15.5.7",
|
"eslint-config-next": "15.5.3",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
@@ -1,73 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
import ClosingDetail from '@/components/pages/closing/ClosingDetailTabs';
|
|
||||||
|
|
||||||
import { ClosingApi } from '@/services/api/closing';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import { ProjectFlockApi } from '@/services/api/production/project-flock';
|
|
||||||
import { ProjectFlockKandangApi } from '@/services/api/production';
|
|
||||||
|
|
||||||
const ClosingDetailPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const closingId = searchParams.get('closingId');
|
|
||||||
const kandangId = searchParams.get('kandangId'); // project flock kandang ID
|
|
||||||
|
|
||||||
const { data: closing, isLoading: isLoadingClosing } = useSWR(
|
|
||||||
closingId,
|
|
||||||
(id: number) => ClosingApi.getGeneralInfo(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
// WORKAROUND - get flock data from closing ID
|
|
||||||
const { data: projectData, isLoading: isLoadingProject } = useSWR(
|
|
||||||
`flock-${closingId}`,
|
|
||||||
() => ProjectFlockApi.getSingle(Number(closingId))
|
|
||||||
);
|
|
||||||
// WORKAROUND - get kandang data from closing ID
|
|
||||||
const { data: kandangData, isLoading: isLoadingKandang } = useSWR(
|
|
||||||
kandangId ? `kandang-${closingId}-${kandangId}` : null,
|
|
||||||
() => ProjectFlockKandangApi.getSingle(Number(kandangId))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!closingId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingClosing && (!closing || isResponseError(closing))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isLoading = isLoadingClosing || isLoadingProject || isLoadingKandang;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
|
||||||
|
|
||||||
{!isLoading && isResponseSuccess(closing) && (
|
|
||||||
<ClosingDetail
|
|
||||||
id={Number(closingId)}
|
|
||||||
initialValue={closing.data}
|
|
||||||
projectData={
|
|
||||||
isResponseSuccess(projectData) ? projectData.data : undefined
|
|
||||||
}
|
|
||||||
kandangData={
|
|
||||||
isResponseSuccess(kandangData) ? kandangData.data : undefined
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ClosingDetailPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import ClosingsTable from '@/components/pages/closing/ClosingsTable';
|
|
||||||
|
|
||||||
const Closing = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full p-3'>
|
|
||||||
<ClosingsTable />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Closing;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { DailyChecklistContent } from '@/figma-make/components/pages/daily-checklist/DailyChecklistContent';
|
|
||||||
|
|
||||||
const DailyChecklistPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<DailyChecklistContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DailyChecklistPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { Dashboard as DashboardDailyChecklist } from '@/figma-make/components/pages/dashboard/Dashboard';
|
|
||||||
|
|
||||||
const DailyChecklistDashboardPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<DashboardDailyChecklist />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DailyChecklistDashboardPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { DetailDailyChecklistContent } from '@/figma-make/components/pages/list-daily-checklist/detail/DetailDailyChecklistContent';
|
|
||||||
|
|
||||||
const ListDailyChecklistDetailPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<DetailDailyChecklistContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ListDailyChecklistDetailPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { ListDailyChecklistContent } from '@/figma-make/components/pages/list-daily-checklist/ListDailyChecklistContent';
|
|
||||||
|
|
||||||
const ListDailyChecklistPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<ListDailyChecklistContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ListDailyChecklistPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { MasterAktivitasContent } from '@/figma-make/components/pages/master-data/activity/MasterAktivitasContent';
|
|
||||||
|
|
||||||
const MasterAktivitasPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<MasterAktivitasContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MasterAktivitasPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { MasterConfigurationContent } from '@/figma-make/components/pages/master-data/configuration/MasterConfigurationContent';
|
|
||||||
|
|
||||||
const MasterConfigurationPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<MasterConfigurationContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MasterConfigurationPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { MasterEmployeeContent } from '@/figma-make/components/pages/master-data/employee/MasterEmployeeContent';
|
|
||||||
|
|
||||||
const MasterEmployeePage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<MasterEmployeeContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MasterEmployeePage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { MasterKandangContent } from '@/figma-make/components/pages/master-data/kandang/MasterKandangContent';
|
|
||||||
|
|
||||||
const MasterKandangPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<MasterKandangContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MasterKandangPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { DailyChecklistReportsContent } from '@/figma-make/components/pages/reports/DailyChecklistReportsContent';
|
|
||||||
|
|
||||||
const DailyChecklistReportsPage = () => {
|
|
||||||
return (
|
|
||||||
<section className='w-full'>
|
|
||||||
<DailyChecklistReportsContent />
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DailyChecklistReportsPage;
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import DashboardProduction from '@/components/pages/dashboard/DashboardProduction';
|
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
return <DashboardProduction />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<h1 className='text-3xl font-bold text-primary'>Dashboard</h1>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Dashboard;
|
export default Dashboard;
|
||||||
|
|||||||
@@ -34,17 +34,13 @@ const ExpenseEditPage = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isExpenseCanBeEdited =
|
const isExpenseRejectedOrApproved =
|
||||||
!isLoadingExpense &&
|
!isLoadingExpense &&
|
||||||
isResponseSuccess(expense) &&
|
isResponseSuccess(expense) &&
|
||||||
expense.data.latest_approval.step_number !== 5 &&
|
(expense.data.approval.action === 'REJECTED' ||
|
||||||
expense.data.latest_approval.step_number !== 6 &&
|
expense.data.approval.step_number === 5);
|
||||||
(expense.data.latest_approval.step_number === 1 ||
|
|
||||||
expense.data.latest_approval.step_number === 2 ||
|
|
||||||
expense.data.latest_approval.step_number === 3 ||
|
|
||||||
expense.data.latest_approval.step_number === 4);
|
|
||||||
|
|
||||||
if (!isLoadingExpense && !isExpenseCanBeEdited) {
|
if (isExpenseRejectedOrApproved) {
|
||||||
router.back();
|
router.back();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import ExpensesTable from '@/components/pages/expense/ExpensesTable';
|
|||||||
|
|
||||||
const Expense = () => {
|
const Expense = () => {
|
||||||
return (
|
return (
|
||||||
<section className='w-full p-4 sm:p-0'>
|
<section className='w-full p-4'>
|
||||||
<ExpensesTable />
|
<ExpensesTable />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
import ExpenseRealizationForm from '@/components/pages/expense/form/ExpenseRealizationForm';
|
|
||||||
|
|
||||||
import { ExpenseApi } from '@/services/api/expense';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
|
|
||||||
const ExpenseRealizationEditPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const expenseId = searchParams.get('expenseId');
|
|
||||||
|
|
||||||
const { data: expense, isLoading: isLoadingExpense } = useSWR(
|
|
||||||
expenseId,
|
|
||||||
(id: number) => ExpenseApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!expenseId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingExpense && (!expense || isResponseError(expense))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isExpenseRealizationCanBeEdited =
|
|
||||||
!isLoadingExpense &&
|
|
||||||
isResponseSuccess(expense) &&
|
|
||||||
expense.data.latest_approval.action !== 'REJECTED' &&
|
|
||||||
(expense.data.latest_approval.step_number === 5 ||
|
|
||||||
expense.data.latest_approval.step_number === 6);
|
|
||||||
|
|
||||||
if (!isLoadingExpense && !isExpenseRealizationCanBeEdited) {
|
|
||||||
router.back();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
{isLoadingExpense && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isLoadingExpense && isResponseSuccess(expense) && (
|
|
||||||
<ExpenseRealizationForm type='edit' initialValues={expense.data} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ExpenseRealizationEditPage;
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
import ExpenseRealizationForm from '@/components/pages/expense/form/ExpenseRealizationForm';
|
|
||||||
|
|
||||||
import { ExpenseApi } from '@/services/api/expense';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
|
|
||||||
const ExpenseRealization = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const expenseId = searchParams.get('expenseId');
|
|
||||||
|
|
||||||
const { data: expense, isLoading: isLoadingExpense } = useSWR(
|
|
||||||
expenseId,
|
|
||||||
(id: number) => ExpenseApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!expenseId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingExpense && (!expense || isResponseError(expense))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isExpenseCanBeRealized =
|
|
||||||
isResponseSuccess(expense) &&
|
|
||||||
expense.data.latest_approval.action !== 'REJECTED' &&
|
|
||||||
expense.data.latest_approval.step_number === 4;
|
|
||||||
|
|
||||||
if (isResponseSuccess(expense) && !isExpenseCanBeRealized) {
|
|
||||||
if (typeof window !== 'undefined') {
|
|
||||||
router.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
{isLoadingExpense && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isLoadingExpense && isResponseSuccess(expense) && (
|
|
||||||
<ExpenseRealizationForm initialValues={expense.data} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ExpenseRealization;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
const FinanceAdjust = () => {
|
|
||||||
return <div>Finance Adjust</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default FinanceAdjust;
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import FormFinanceAddInitialBalance from '@/components/pages/finance/add/initial-balance/FormFinanceAddInitialBalance';
|
|
||||||
|
|
||||||
const FinanceAddInitialBalancePage = () => {
|
|
||||||
return <FormFinanceAddInitialBalance type='add' />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default FinanceAddInitialBalancePage;
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import FormFinanceInjection from '@/components/pages/finance/add/injection/FormFinanceInjection';
|
|
||||||
|
|
||||||
const FinanceAddInjectionPage = () => {
|
|
||||||
return <FormFinanceInjection type='add' />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default FinanceAddInjectionPage;
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import FormFinanceAdd from '@/components/pages/finance/add/FormFinanceAdd';
|
|
||||||
|
|
||||||
const FinanceAddPage = () => {
|
|
||||||
return <FormFinanceAdd />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default FinanceAddPage;
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
import { FinanceApi } from '@/services/api/finance';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import FormFinanceAddInitialBalance from '@/components/pages/finance/add/initial-balance/FormFinanceAddInitialBalance';
|
|
||||||
|
|
||||||
const EditFinanceInitialBalancePage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const financeId = searchParams.get('financeId');
|
|
||||||
|
|
||||||
const { data: finance, isLoading: isLoadingFinance } = useSWR(
|
|
||||||
financeId,
|
|
||||||
(id: number) => FinanceApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!financeId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingFinance && (!finance || isResponseError(finance))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
{isLoadingFinance && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isLoadingFinance && (
|
|
||||||
<FormFinanceAddInitialBalance
|
|
||||||
type='edit'
|
|
||||||
initialValues={isResponseSuccess(finance) ? finance.data : undefined}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditFinanceInitialBalancePage;
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
import { FinanceApi } from '@/services/api/finance';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import FormFinanceInjection from '@/components/pages/finance/add/injection/FormFinanceInjection';
|
|
||||||
|
|
||||||
const EditFinanceInjectionPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const financeId = searchParams.get('financeId');
|
|
||||||
|
|
||||||
const { data: finance, isLoading: isLoadingFinance } = useSWR(
|
|
||||||
financeId,
|
|
||||||
(id: number) => FinanceApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!financeId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingFinance && (!finance || isResponseError(finance))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
{isLoadingFinance && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isLoadingFinance && (
|
|
||||||
<FormFinanceInjection
|
|
||||||
type='edit'
|
|
||||||
initialValues={isResponseSuccess(finance) ? finance.data : undefined}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditFinanceInjectionPage;
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
import { FinanceApi } from '@/services/api/finance';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import FormFinanceAdd from '@/components/pages/finance/add/FormFinanceAdd';
|
|
||||||
|
|
||||||
const EditFinanceTransactionPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const financeId = searchParams.get('financeId');
|
|
||||||
|
|
||||||
const { data: finance, isLoading: isLoadingFinance } = useSWR(
|
|
||||||
financeId,
|
|
||||||
(id: number) => FinanceApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!financeId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingFinance && (!finance || isResponseError(finance))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
{isLoadingFinance && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!isLoadingFinance && (
|
|
||||||
<FormFinanceAdd
|
|
||||||
type='edit'
|
|
||||||
initialValues={isResponseSuccess(finance) ? finance.data : undefined}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditFinanceTransactionPage;
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import FinanceDetail from '@/components/pages/finance/FinanceDetail';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import { FinanceApi } from '@/services/api/finance';
|
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
|
|
||||||
const FinanceDetailPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const financeId = useSearchParams().get('financeId');
|
|
||||||
|
|
||||||
const { data: finance } = useSWR(financeId, () =>
|
|
||||||
FinanceApi.getSingle(Number(financeId))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!financeId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (!finance || isResponseError(finance)) {
|
|
||||||
// router.replace('/404');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{isResponseSuccess(finance) && <FinanceDetail finance={finance.data} />}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default FinanceDetailPage;
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import FinanceTable from '@/components/pages/finance/FinanceTable';
|
|
||||||
|
|
||||||
const Finance = () => {
|
|
||||||
return <FinanceTable />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Finance;
|
|
||||||
+21
-48
@@ -1,47 +1,32 @@
|
|||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
@plugin "daisyui";
|
@plugin "daisyui";
|
||||||
@import '../styles/tailwind.css';
|
|
||||||
@import '../styles/daisyui.css';
|
@import '../styles/daisyui.css';
|
||||||
@import '../figma-make/styles/theme.css';
|
|
||||||
|
|
||||||
@plugin "daisyui/theme" {
|
@plugin "daisyui/theme" {
|
||||||
name: 'lti';
|
name: 'lti';
|
||||||
default: false;
|
default: false;
|
||||||
prefersdark: false;
|
prefersdark: false;
|
||||||
color-scheme: 'light';
|
color-scheme: 'light';
|
||||||
|
--color-base-100: oklch(98% 0.001 106.423);
|
||||||
/* Primary Colors */
|
--color-base-200: oklch(97% 0.001 106.424);
|
||||||
--color-primary: oklch(39.4% 0.177 301.9);
|
--color-base-300: oklch(92% 0.003 48.717);
|
||||||
--color-primary-content: oklch(87.5% 0.038 274.5);
|
--color-base-content: oklch(22.389% 0.031 278.072);
|
||||||
|
--color-primary: oklch(60% 0.126 221.723);
|
||||||
/* Secondary Colors */
|
--color-primary-content: oklch(100% 0 0);
|
||||||
--color-secondary: oklch(60.1% 0.258 335.7);
|
--color-secondary: oklch(52% 0.105 223.128);
|
||||||
--color-secondary-content: oklch(99.4% 0.007 337.8);
|
--color-secondary-content: oklch(100% 0 0);
|
||||||
|
--color-accent: oklch(45% 0.085 224.283);
|
||||||
/* Accent Colors */
|
--color-accent-content: oklch(100% 0 0);
|
||||||
--color-accent: oklch(76.2% 0.155 170.8);
|
--color-neutral: oklch(39% 0.07 227.392);
|
||||||
--color-accent-content: oklch(7.2% 0.007 167.6);
|
--color-neutral-content: oklch(100% 0 0);
|
||||||
|
--color-info: oklch(58% 0.158 241.966);
|
||||||
/* Neutral Colors */
|
--color-info-content: oklch(100% 0 0);
|
||||||
--color-neutral: oklch(22.4% 0.032 258.8);
|
--color-success: oklch(62% 0.194 149.214);
|
||||||
--color-neutral-content: oklch(87.7% 0.016 257);
|
--color-success-content: oklch(100% 0 0);
|
||||||
|
--color-warning: oklch(85% 0.199 91.936);
|
||||||
/* Base Colors */
|
--color-warning-content: oklch(0% 0 0);
|
||||||
--color-base-100: oklch(100% 0 0); /* #ffffff */
|
--color-error: oklch(57% 0.245 27.325);
|
||||||
--color-base-200: oklch(97.2% 0 0); /* #f2f2f2 */
|
--color-error-content: oklch(100% 0 0);
|
||||||
--color-base-300: oklch(93.1% 0.002 249.7); /* #e5e6e6 */
|
|
||||||
--color-base-content: #18181b;
|
|
||||||
|
|
||||||
/* Status/Utility Colors */
|
|
||||||
--color-info: oklch(67.4% 0.176 238.9);
|
|
||||||
--color-info-content: oklch(0% 0 0); /* #000000 */
|
|
||||||
--color-success: #00d390;
|
|
||||||
--color-success-content: oklch(100% 0 0); /* #ffffff */
|
|
||||||
--color-warning: #fcb700;
|
|
||||||
--color-warning-content: oklch(0% 0 0); /* #000000 */
|
|
||||||
--color-error: #ff3a3a;
|
|
||||||
--color-error-content: oklch(100% 0 0); /* #fffffff */
|
|
||||||
|
|
||||||
--radius-selector: 0rem;
|
--radius-selector: 0rem;
|
||||||
--radius-field: 0.25rem;
|
--radius-field: 0.25rem;
|
||||||
--radius-box: 0.25rem;
|
--radius-box: 0.25rem;
|
||||||
@@ -53,23 +38,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--color-primary: #0069e0;
|
--color-primary: #1f74bf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@theme {
|
@theme {
|
||||||
--font-inter: var(--font-inter);
|
--font-inter: var(--font-inter);
|
||||||
--font-roboto: var(--font-roboto);
|
|
||||||
|
|
||||||
--container-sm: 40rem;
|
|
||||||
--container-md: 48rem;
|
|
||||||
--container-lg: 64rem;
|
|
||||||
--container-xl: 80rem;
|
|
||||||
--container-2xl: 96rem;
|
|
||||||
|
|
||||||
--shadow-button-soft:
|
|
||||||
0 3px 2px -2px var(--color-base-200), 0 4px 3px -2px var(--color-base-200);
|
|
||||||
|
|
||||||
--shadow-bg: 0px -2px 4px 0px #00000014;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ const DetailInventoryAdjustment = () => {
|
|||||||
|
|
||||||
// Ambil data dari router state
|
// Ambil data dari router state
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('Router State');
|
||||||
|
console.log(window.history.state);
|
||||||
const state = window.history.state?.usr as
|
const state = window.history.state?.usr as
|
||||||
| { inventoryAdjustment?: InventoryAdjustment }
|
| { inventoryAdjustment?: InventoryAdjustment }
|
||||||
| undefined;
|
| undefined;
|
||||||
@@ -24,6 +26,9 @@ const DetailInventoryAdjustment = () => {
|
|||||||
|
|
||||||
const finalData = inventoryAdjustment;
|
const finalData = inventoryAdjustment;
|
||||||
|
|
||||||
|
console.log('Final Data');
|
||||||
|
console.log(finalData);
|
||||||
|
|
||||||
if (!finalData) {
|
if (!finalData) {
|
||||||
return (
|
return (
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import InventoryAdjustmentTable from '@/components/pages/inventory/adjustment/In
|
|||||||
|
|
||||||
const InventoryAdjustment = () => {
|
const InventoryAdjustment = () => {
|
||||||
return (
|
return (
|
||||||
<section className='w-full'>
|
<section className='w-full p-4'>
|
||||||
<InventoryAdjustmentTable />
|
<InventoryAdjustmentTable />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import MovementTable from '@/components/pages/inventory/movement/MovementTable';
|
|||||||
|
|
||||||
const Movement = () => {
|
const Movement = () => {
|
||||||
return (
|
return (
|
||||||
<section className='w-full p-4 sm:p-0'>
|
<section className='w-full p-4'>
|
||||||
<MovementTable />
|
<MovementTable />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import InventoryProductDetail from '@/components/pages/inventory/product/detail/InventoryProductDetail';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import { InventoryProductApi } from '@/services/api/inventory';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
const InventoryProductDetailPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const inventoryProductId = searchParams.get('inventoryProductId');
|
|
||||||
|
|
||||||
const { data: inventoryProduct, isLoading: isLoadingInventoryProduct } =
|
|
||||||
useSWR(inventoryProductId, (id: number) =>
|
|
||||||
InventoryProductApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!inventoryProductId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!isLoadingInventoryProduct &&
|
|
||||||
(!inventoryProduct || isResponseError(inventoryProduct))
|
|
||||||
) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='size-full'>
|
|
||||||
{isLoadingInventoryProduct && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
{!isLoadingInventoryProduct && isResponseSuccess(inventoryProduct) && (
|
|
||||||
<InventoryProductDetail inventoryProduct={inventoryProduct.data} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default InventoryProductDetailPage;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import InventoryProductTable from '@/components/pages/inventory/product/InventoryProductTable';
|
|
||||||
|
|
||||||
const InventoryProductPage = () => {
|
|
||||||
return (
|
|
||||||
<div className='size-full'>
|
|
||||||
<InventoryProductTable />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default InventoryProductPage;
|
|
||||||
+2
-12
@@ -1,9 +1,8 @@
|
|||||||
import type { Metadata, Viewport } from 'next';
|
import type { Metadata, Viewport } from 'next';
|
||||||
import { Inter, Roboto } from 'next/font/google';
|
import { Inter } from 'next/font/google';
|
||||||
import '@/app/globals.css';
|
import '@/app/globals.css';
|
||||||
|
|
||||||
import { Toaster } from 'react-hot-toast';
|
import { Toaster } from 'react-hot-toast';
|
||||||
import { Toaster as SonnerToaster } from '@/figma-make/components/base/sonner';
|
|
||||||
import MainDrawer from '@/components/MainDrawer';
|
import MainDrawer from '@/components/MainDrawer';
|
||||||
import RequireAuth from '@/components/helper/RequireAuth';
|
import RequireAuth from '@/components/helper/RequireAuth';
|
||||||
|
|
||||||
@@ -12,12 +11,6 @@ const inter = Inter({
|
|||||||
subsets: ['latin'],
|
subsets: ['latin'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const roboto = Roboto({
|
|
||||||
variable: '--font-roboto',
|
|
||||||
subsets: ['latin'],
|
|
||||||
weight: ['200', '300', '400', '500', '600', '700', '900'],
|
|
||||||
});
|
|
||||||
|
|
||||||
export const viewport: Viewport = {
|
export const viewport: Viewport = {
|
||||||
themeColor: '#1f74bf',
|
themeColor: '#1f74bf',
|
||||||
colorScheme: 'light',
|
colorScheme: 'light',
|
||||||
@@ -36,15 +29,12 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang='en' data-theme='lti'>
|
<html lang='en' data-theme='lti'>
|
||||||
<body
|
<body className={`${inter.variable} antialiased font-inter`}>
|
||||||
className={`${inter.variable} ${roboto.variable} antialiased font-inter`}
|
|
||||||
>
|
|
||||||
<RequireAuth>
|
<RequireAuth>
|
||||||
<MainDrawer>{children}</MainDrawer>
|
<MainDrawer>{children}</MainDrawer>
|
||||||
</RequireAuth>
|
</RequireAuth>
|
||||||
|
|
||||||
<Toaster />
|
<Toaster />
|
||||||
<SonnerToaster position='top-right' />
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import MarketingForm from '@/components/pages/marketing/form/MarketingForm';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
import { MarketingApi } from '@/services/api/marketing/marketing';
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
const EditMarketingDelivery = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const soId = searchParams.get('marketingId');
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: marketing,
|
||||||
|
isLoading: isLoading,
|
||||||
|
mutate: refreshMarketing,
|
||||||
|
} = useSWR(`get-so-${soId}`, () =>
|
||||||
|
MarketingApi.getSingle(soId ? parseInt(soId) : 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!soId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoading && (!marketing || isResponseError(marketing))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4'>
|
||||||
|
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
||||||
|
{!isLoading && isResponseSuccess(marketing) && (
|
||||||
|
<MarketingForm
|
||||||
|
formType='add_deliver'
|
||||||
|
initialValues={marketing.data}
|
||||||
|
afterSubmit={() => {
|
||||||
|
refreshMarketing();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default EditMarketingDelivery;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import MarketingForm from '@/components/pages/marketing/form/MarketingForm';
|
||||||
|
|
||||||
|
const AddSalesOrder = () => {
|
||||||
|
return (
|
||||||
|
<div className='size-full p-4'>
|
||||||
|
<MarketingForm formType='add' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddSalesOrder;
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import MarketingForm from '@/components/pages/marketing/form/MarketingForm';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
import { MarketingApi } from '@/services/api/marketing/marketing';
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
const EditMarketingDelivery = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const soId = searchParams.get('marketingId');
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: marketing,
|
||||||
|
isLoading: isLoading,
|
||||||
|
mutate: refreshMarketing,
|
||||||
|
} = useSWR(`get-so-${soId}`, () =>
|
||||||
|
MarketingApi.getSingle(soId ? parseInt(soId) : 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!soId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoading && (!marketing || isResponseError(marketing))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
isResponseSuccess(marketing) &&
|
||||||
|
marketing.data.latest_approval.step_number != 3
|
||||||
|
) {
|
||||||
|
toast.error('Data Marketing perlu dilakukan approval terlebih dahulu!');
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4'>
|
||||||
|
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
||||||
|
{!isLoading && isResponseSuccess(marketing) && (
|
||||||
|
<MarketingForm
|
||||||
|
formType='edit_deliver'
|
||||||
|
initialValues={marketing.data}
|
||||||
|
afterSubmit={() => {
|
||||||
|
refreshMarketing();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default EditMarketingDelivery;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import MarketingDetail from '@/components/pages/marketing/detail/MarketingDetail';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
import { MarketingApi } from '@/services/api/marketing/marketing';
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
const DetailMarketing = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const soId = searchParams.get('marketingId');
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: marketing,
|
||||||
|
isLoading: isLoading,
|
||||||
|
mutate: refreshMarketing,
|
||||||
|
} = useSWR(soId, (id: number) => MarketingApi.getSingle(id));
|
||||||
|
|
||||||
|
if (!soId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoading && (!marketing || isResponseError(marketing))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4'>
|
||||||
|
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
||||||
|
{!isLoading && isResponseSuccess(marketing) && (
|
||||||
|
<MarketingDetail
|
||||||
|
initialValues={marketing.data}
|
||||||
|
refresh={refreshMarketing}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DetailMarketing;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import MarketingForm from '@/components/pages/marketing/form/MarketingForm';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
import { MarketingApi } from '@/services/api/marketing/marketing';
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
const EditSalesOrder = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const soId = searchParams.get('marketingId');
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: marketing,
|
||||||
|
isLoading: isLoading,
|
||||||
|
mutate: refreshMarketing,
|
||||||
|
} = useSWR(`get-so-${soId}`, () =>
|
||||||
|
MarketingApi.getSingle(soId ? parseInt(soId) : 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!soId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoading && (!marketing || isResponseError(marketing))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4'>
|
||||||
|
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
||||||
|
{!isLoading && isResponseSuccess(marketing) && (
|
||||||
|
<MarketingForm
|
||||||
|
formType='edit'
|
||||||
|
initialValues={marketing.data}
|
||||||
|
afterSubmit={() => {
|
||||||
|
refreshMarketing();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default EditSalesOrder;
|
||||||
@@ -1,16 +1,10 @@
|
|||||||
import DeliveryOrderFormModal from '@/components/pages/marketing/DeliveryOrderFormModal';
|
|
||||||
import MarketingTable from '@/components/pages/marketing/MarketingTable';
|
import MarketingTable from '@/components/pages/marketing/MarketingTable';
|
||||||
import SalesOrderFormModal from '@/components/pages/marketing/SalesOrderFormModal';
|
|
||||||
|
|
||||||
const Marketing = () => {
|
const Marketing = () => {
|
||||||
return (
|
return (
|
||||||
<div className='w-full'>
|
<div className='w-full p-4'>
|
||||||
<MarketingTable />
|
<MarketingTable />
|
||||||
|
|
||||||
<SalesOrderFormModal />
|
|
||||||
<DeliveryOrderFormModal />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Marketing;
|
export default Marketing;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import AreasTable from '@/components/pages/master-data/area/AreasTable';
|
import AreasTable from '@/components/pages/master-data/area/AreasTable';
|
||||||
|
|
||||||
const Nonstock = () => {
|
const Nonstock = () => {
|
||||||
return <AreasTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<AreasTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Nonstock;
|
export default Nonstock;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import BanksTable from '@/components/pages/master-data/bank/BanksTable';
|
import BanksTable from '@/components/pages/master-data/bank/BanksTable';
|
||||||
|
|
||||||
const Bank = () => {
|
const Bank = () => {
|
||||||
return <BanksTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<BanksTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Bank;
|
export default Bank;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import CustomersTable from '@/components/pages/master-data/customer/CustomersTable';
|
import CustomersTable from '@/components/pages/master-data/customer/CustomersTable';
|
||||||
|
|
||||||
const Customer = () => {
|
const Customer = () => {
|
||||||
return <CustomersTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<CustomersTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Customer;
|
export default Customer;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import FcrForm from '@/components/pages/master-data/fcr/form/FcrForm';
|
||||||
|
|
||||||
|
const AddFcr = () => {
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
<FcrForm />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddFcr;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
import FcrForm from '@/components/pages/master-data/fcr/form/FcrForm';
|
||||||
|
|
||||||
|
import { FcrApi } from '@/services/api/master-data';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
import { BaseApiResponse } from '@/types/api/api-general';
|
||||||
|
import { FcrWithStandards } from '@/types/api/master-data/fcr';
|
||||||
|
|
||||||
|
const FcrEdit = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const fcrId = searchParams.get('fcrId');
|
||||||
|
|
||||||
|
const { data: fcr, isLoading: isLoadingFcr } = useSWR(
|
||||||
|
fcrId,
|
||||||
|
(id: number) =>
|
||||||
|
FcrApi.getSingle(id) as Promise<
|
||||||
|
BaseApiResponse<FcrWithStandards> | undefined
|
||||||
|
>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fcrId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoadingFcr && (!fcr || isResponseError(fcr))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{isLoadingFcr && <span className='loading loading-spinner loading-xl' />}
|
||||||
|
{!isLoadingFcr && isResponseSuccess(fcr) && (
|
||||||
|
<FcrForm type='edit' initialValues={fcr.data} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FcrEdit;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
import FcrForm from '@/components/pages/master-data/fcr/form/FcrForm';
|
||||||
|
|
||||||
|
import { FcrApi } from '@/services/api/master-data';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
import { FcrWithStandards } from '@/types/api/master-data/fcr';
|
||||||
|
import { BaseApiResponse } from '@/types/api/api-general';
|
||||||
|
|
||||||
|
const FcrDetail = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const fcrId = searchParams.get('fcrId');
|
||||||
|
|
||||||
|
const { data: fcr, isLoading: isLoadingFcr } = useSWR(
|
||||||
|
fcrId,
|
||||||
|
(id: number) =>
|
||||||
|
FcrApi.getSingle(id) as Promise<
|
||||||
|
BaseApiResponse<FcrWithStandards> | undefined
|
||||||
|
>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!fcrId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoadingFcr && (!fcr || isResponseError(fcr))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{isLoadingFcr && <span className='loading loading-spinner loading-xl' />}
|
||||||
|
{!isLoadingFcr && isResponseSuccess(fcr) && (
|
||||||
|
<FcrForm type='detail' initialValues={fcr.data} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FcrDetail;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import FcrsTable from '@/components/pages/master-data/fcr/FcrsTable';
|
||||||
|
|
||||||
|
const Fcr = () => {
|
||||||
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<FcrsTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Fcr;
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
import FlockTable from '@/components/pages/master-data/flock/FlocksTable';
|
import FlockTable from '@/components/pages/master-data/flock/FlocksTable';
|
||||||
|
|
||||||
const Flock = () => {
|
const Flock = () => {
|
||||||
return <FlockTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<FlockTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Flock;
|
export default Flock;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import KandangsTable from '@/components/pages/master-data/kandang/KandangsTable';
|
import KandangsTable from '@/components/pages/master-data/kandang/KandangsTable';
|
||||||
|
|
||||||
const Nonstock = () => {
|
const Nonstock = () => {
|
||||||
return <KandangsTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<KandangsTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Nonstock;
|
export default Nonstock;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import LocationsTable from '@/components/pages/master-data/location/LocationsTable';
|
import LocationsTable from '@/components/pages/master-data/location/LocationsTable';
|
||||||
|
|
||||||
const Nonstock = () => {
|
const Nonstock = () => {
|
||||||
return <LocationsTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<LocationsTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Nonstock;
|
export default Nonstock;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import NonstocksTable from '@/components/pages/master-data/nonstock/NonstocksTable';
|
import NonstocksTable from '@/components/pages/master-data/nonstock/NonstocksTable';
|
||||||
|
|
||||||
const Nonstock = () => {
|
const Nonstock = () => {
|
||||||
return <NonstocksTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<NonstocksTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Nonstock;
|
export default Nonstock;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import ProductCategoryTable from '@/components/pages/master-data/product-category/ProductCategoryTable';
|
import ProductCategoryTable from '@/components/pages/master-data/product-category/ProductCategoryTable';
|
||||||
|
|
||||||
const ProductCategory = () => {
|
const ProductCategory = () => {
|
||||||
return <ProductCategoryTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<ProductCategoryTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProductCategory;
|
export default ProductCategory;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import ProductsTable from '@/components/pages/master-data/product/ProductTable';
|
import ProductsTable from '@/components/pages/master-data/product/ProductTable';
|
||||||
|
|
||||||
const Product = () => {
|
const Product = () => {
|
||||||
return <ProductsTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<ProductsTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Product;
|
export default Product;
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import ProductionStandardForm from '@/components/pages/master-data/production-standard/form/ProductionStandardForm';
|
|
||||||
|
|
||||||
const AddProductionStandardPage = () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<ProductionStandardForm formType='add' />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddProductionStandardPage;
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import ProductionStandardForm from '@/components/pages/master-data/production-standard/form/ProductionStandardForm';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import { ProductionStandardApi } from '@/services/api/master-data';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
const EditProductionStandardPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
// Get Query Params
|
|
||||||
const productionStandardId = searchParams.get('productionStandardId');
|
|
||||||
|
|
||||||
// Fetch Data
|
|
||||||
const { data: productionStandard, isLoading: isLoadingProductionStandard } =
|
|
||||||
useSWR(productionStandardId, (id: number) =>
|
|
||||||
ProductionStandardApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!productionStandardId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!isLoadingProductionStandard &&
|
|
||||||
(!productionStandard || isResponseError(productionStandard))
|
|
||||||
) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{isLoadingProductionStandard && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
{!isLoadingProductionStandard &&
|
|
||||||
isResponseSuccess(productionStandard) && (
|
|
||||||
<ProductionStandardForm
|
|
||||||
formType='edit'
|
|
||||||
initialValue={productionStandard.data}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default EditProductionStandardPage;
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import ProductionStandardForm from '@/components/pages/master-data/production-standard/form/ProductionStandardForm';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import { ProductionStandardApi } from '@/services/api/master-data';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
const DetailProductionStandardPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
// Get Query Params
|
|
||||||
const productionStandardId = searchParams.get('productionStandardId');
|
|
||||||
|
|
||||||
// Fetch Data
|
|
||||||
const { data: productionStandard, isLoading: isLoadingProductionStandard } =
|
|
||||||
useSWR(productionStandardId, (id: number) =>
|
|
||||||
ProductionStandardApi.getSingle(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!productionStandardId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!isLoadingProductionStandard &&
|
|
||||||
(!productionStandard || isResponseError(productionStandard))
|
|
||||||
) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{isLoadingProductionStandard && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
)}
|
|
||||||
{!isLoadingProductionStandard &&
|
|
||||||
isResponseSuccess(productionStandard) && (
|
|
||||||
<ProductionStandardForm
|
|
||||||
formType='detail'
|
|
||||||
initialValue={productionStandard.data}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default DetailProductionStandardPage;
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import ProductionStandardTable from '@/components/pages/master-data/production-standard/ProductionStandardTable';
|
|
||||||
|
|
||||||
const ProductionStandardPage = () => {
|
|
||||||
return <ProductionStandardTable />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ProductionStandardPage;
|
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
import SuppliersTable from '@/components/pages/master-data/supplier/SupplierTable';
|
import SuppliersTable from '@/components/pages/master-data/supplier/SupplierTable';
|
||||||
|
|
||||||
const Supplier = () => {
|
const Supplier = () => {
|
||||||
return <SuppliersTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<SuppliersTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Supplier;
|
export default Supplier;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import UomsTable from '@/components/pages/master-data/uom/UomsTable';
|
import UomsTable from '@/components/pages/master-data/uom/UomsTable';
|
||||||
|
|
||||||
const Nonstock = () => {
|
const Nonstock = () => {
|
||||||
return <UomsTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<UomsTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Nonstock;
|
export default Nonstock;
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import WarehousesTable from '@/components/pages/master-data/warehouse/WarehousesTable';
|
import WarehousesTable from '@/components/pages/master-data/warehouse/WarehousesTable';
|
||||||
|
|
||||||
const Warehouse = () => {
|
const Warehouse = () => {
|
||||||
return <WarehousesTable />;
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<WarehousesTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Warehouse;
|
export default Warehouse;
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import PageNotFound from '@/components/helper/NotFoundPage';
|
|
||||||
|
|
||||||
export default function NotFound() {
|
|
||||||
return <PageNotFound />;
|
|
||||||
}
|
|
||||||
+3
-24
@@ -1,32 +1,11 @@
|
|||||||
'use client';
|
import { redirect } from 'next/navigation';
|
||||||
|
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
|
||||||
import { useAuth } from '@/services/hooks/useAuth';
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const { isLoadingUser } = useAuth();
|
redirect('/dashboard');
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const pathname = usePathname();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (pathname === '/') {
|
|
||||||
router.replace('/dashboard');
|
|
||||||
}
|
|
||||||
}, [pathname]);
|
|
||||||
|
|
||||||
if (isLoadingUser) {
|
|
||||||
return (
|
|
||||||
<main className='w-full h-full min-h-screen flex flex-row justify-center items-center'>
|
|
||||||
<span className='loading loading-spinner loading-lg'></span>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className='w-full h-full min-h-screen flex flex-row justify-center items-center'>
|
<main className='w-full h-full min-h-screen flex flex-row justify-center items-center'>
|
||||||
<span className='loading loading-spinner loading-lg'></span>
|
<h1>LTI ERP</h1>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import ProjectFlockForm from '@/components/pages/production/project-flock/form/ProjectFlockForm';
|
import ProjectFlockForm from '@/components/pages/production/project-flock/form/ProjectFlockForm';
|
||||||
import React from 'react';
|
|
||||||
// import React, { useImperativeHandle } from 'react';
|
|
||||||
|
|
||||||
const AddProjectFlock = () => {
|
const AddProjectFlock = () => {
|
||||||
// useImperativeHandle(ref, () => ({
|
|
||||||
// validate() {
|
|
||||||
// toast.success('Validating');
|
|
||||||
// return false;
|
|
||||||
// },
|
|
||||||
// }));
|
|
||||||
return (
|
return (
|
||||||
<section className='w-full flex flex-row justify-center'>
|
<section className='w-full p-4 flex flex-row justify-center'>
|
||||||
<ProjectFlockForm formType='add' />
|
<ProjectFlockForm formType='add' />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default function AddChickinKandang() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<section className='size-full'>
|
<section className='w-full p-4'>
|
||||||
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
{isLoading && <span className='loading loading-spinner loading-xl' />}
|
||||||
{!isLoading &&
|
{!isLoading &&
|
||||||
isResponseSuccess(projectFlockKandang) &&
|
isResponseSuccess(projectFlockKandang) &&
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { FormHeader } from '@/components/helper/form/FormHeader';
|
||||||
|
import ProjectFlockChickinDetail from '@/components/pages/production/project-flock/chickin/ProjectFlockChickinDetail';
|
||||||
|
import { useSearchParams } from 'next/navigation';
|
||||||
|
|
||||||
|
const AddChickin = () => {
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const projectFlockId = searchParams.get('projectFlockId');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<ProjectFlockChickinDetail projectFlockId={Number(projectFlockId)} />
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddChickin;
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import ChickinTable from '@/components/pages/production/chickin/ChickinTable';
|
||||||
|
|
||||||
|
const Chickin = () => {
|
||||||
|
return (
|
||||||
|
<section className='w-full p-4'>
|
||||||
|
<ChickinTable />
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default Chickin;
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
'use client';
|
|
||||||
import ProjectFlockClosingForm from '@/components/pages/production/project-flock/closing/ProjectFlockClosingForm';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import { ProjectFlockKandangApi } from '@/services/api/production';
|
|
||||||
import { ProjectFlockApi } from '@/services/api/production/project-flock';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
const ProjectFlockClosingPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const projectFlockId = searchParams.get('projectFlockId');
|
|
||||||
const projectFlockKandangId = searchParams.get('projectFlockKandangId');
|
|
||||||
|
|
||||||
const { data: projectFlockKandang, isLoading: isLoadingProjectFlockKandang } =
|
|
||||||
useSWR(`get-flock-kandang-id/${projectFlockKandangId}`, () =>
|
|
||||||
ProjectFlockKandangApi.getSingle(parseInt(projectFlockKandangId ?? ''))
|
|
||||||
);
|
|
||||||
|
|
||||||
const { data: projectFlock, isLoading: isLoadingProjectFlock } = useSWR(
|
|
||||||
`get-flock-id/${projectFlockId}`,
|
|
||||||
() => ProjectFlockApi.getSingle(parseInt(projectFlockId ?? ''))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!projectFlockId || !projectFlockKandangId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!isLoadingProjectFlock &&
|
|
||||||
(!projectFlock || isResponseError(projectFlock)) &&
|
|
||||||
!isLoadingProjectFlockKandang &&
|
|
||||||
(!projectFlockKandang || isResponseError(projectFlockKandang))
|
|
||||||
) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full h-full flex flex-col justify-center'>
|
|
||||||
{isLoadingProjectFlock ||
|
|
||||||
(isLoadingProjectFlockKandang && (
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
))}
|
|
||||||
{isResponseSuccess(projectFlock) &&
|
|
||||||
isResponseSuccess(projectFlockKandang) && (
|
|
||||||
<ProjectFlockClosingForm
|
|
||||||
projectFlock={projectFlock.data}
|
|
||||||
projectFlockKandang={projectFlockKandang.data}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default ProjectFlockClosingPage;
|
|
||||||
@@ -12,10 +12,11 @@ const ProjectFlockEdit = () => {
|
|||||||
|
|
||||||
const projectFlockId = searchParams.get('projectFlockId');
|
const projectFlockId = searchParams.get('projectFlockId');
|
||||||
|
|
||||||
const { data: projectFlock, isLoading: isLoadingProjectFlock } = useSWR(
|
const {
|
||||||
projectFlockId,
|
data: projectFlock,
|
||||||
(id: number) => ProjectFlockApi.getSingle(id)
|
isLoading: isLoadingProjectFlock,
|
||||||
);
|
mutate: refreshProjectFlocks,
|
||||||
|
} = useSWR(projectFlockId, (id: number) => ProjectFlockApi.getSingle(id));
|
||||||
|
|
||||||
if (!projectFlockId) {
|
if (!projectFlockId) {
|
||||||
router.back();
|
router.back();
|
||||||
@@ -36,7 +37,7 @@ const ProjectFlockEdit = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='w-full flex flex-col justify-center'>
|
<div className='w-full p-4 flex flex-col justify-center'>
|
||||||
{isLoadingProjectFlock && (
|
{isLoadingProjectFlock && (
|
||||||
<span className='loading loading-spinner loading-xl' />
|
<span className='loading loading-spinner loading-xl' />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import ProjectFlockDetail from '@/components/pages/production/project-flock/detail/ProjectFlockDetail';
|
import ProjectFlockForm from '@/components/pages/production/project-flock/form/ProjectFlockForm';
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
import { ProjectFlockApi } from '@/services/api/production/project-flock';
|
import { ProjectFlockApi } from '@/services/api/production/project-flock';
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
const ProjectFlockDetailPage = () => {
|
const ProjectFlockDetail = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
const projectFlockId = searchParams.get('projectFlockId');
|
const projectFlockId = searchParams.get('projectFlockId');
|
||||||
|
|
||||||
const { data: projectFlock, isLoading: isLoadingProjectFlock } = useSWR(
|
const {
|
||||||
projectFlockId,
|
data: projectFlock,
|
||||||
(id: number) => ProjectFlockApi.getSingle(id)
|
isLoading: isLoadingProjectFlock,
|
||||||
);
|
mutate: refreshProjectFlock,
|
||||||
|
} = useSWR(projectFlockId, (id: number) => ProjectFlockApi.getSingle(id));
|
||||||
|
|
||||||
if (!projectFlockId) {
|
if (!projectFlockId) {
|
||||||
router.back();
|
router.back();
|
||||||
@@ -36,15 +37,19 @@ const ProjectFlockDetailPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='w-full h-full flex flex-col justify-center'>
|
<div className='w-full p-4 flex flex-col justify-center'>
|
||||||
{isLoadingProjectFlock && (
|
{isLoadingProjectFlock && (
|
||||||
<span className='loading loading-spinner loading-xl' />
|
<span className='loading loading-spinner loading-xl' />
|
||||||
)}
|
)}
|
||||||
{isResponseSuccess(projectFlock) && (
|
{isResponseSuccess(projectFlock) && (
|
||||||
<ProjectFlockDetail projectFlock={projectFlock.data} />
|
<ProjectFlockForm
|
||||||
|
formType='detail'
|
||||||
|
initialValues={projectFlock.data}
|
||||||
|
refreshProjectFlocks={refreshProjectFlock}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ProjectFlockDetailPage;
|
export default ProjectFlockDetail;
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { usePathname, useRouter } from 'next/navigation';
|
|
||||||
import React, { ReactNode, useEffect } from 'react';
|
|
||||||
import ProjectFlockTable from '@/components/pages/production/project-flock/ProjectFlockTable';
|
|
||||||
import { useUiStore } from '@/stores/ui/ui.store';
|
|
||||||
import Modal, { useModal } from '@/components/Modal';
|
|
||||||
|
|
||||||
export default function ProjectFlockLayout({
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: ReactNode;
|
|
||||||
}) {
|
|
||||||
const pathname = usePathname();
|
|
||||||
const router = useRouter();
|
|
||||||
const toggleValidate = useUiStore((s) => s.toggleValidate);
|
|
||||||
|
|
||||||
const isAdd = pathname.includes('/add');
|
|
||||||
const isEdit = pathname.includes('/detail/edit');
|
|
||||||
const isDetail = pathname.includes('/detail');
|
|
||||||
const isChickin = pathname.includes('/chickin/add/kandang');
|
|
||||||
const isClosing = pathname.includes('/closing');
|
|
||||||
|
|
||||||
const isOpen = isAdd || isEdit || isDetail || isChickin || isClosing;
|
|
||||||
|
|
||||||
const formModal = useModal();
|
|
||||||
|
|
||||||
const handleBackdropClick = () => {
|
|
||||||
const unsub = useUiStore.getState().subscribeIsValid((isValid) => {
|
|
||||||
if (isValid) {
|
|
||||||
formModal.closeModal();
|
|
||||||
unsub(); // berhenti listen
|
|
||||||
router.push('/production/project-flock');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
toggleValidate();
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (isOpen && !formModal.open) {
|
|
||||||
formModal.openModal();
|
|
||||||
} else {
|
|
||||||
formModal.closeModal();
|
|
||||||
}
|
|
||||||
}, [isOpen]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{/* List page always rendered */}
|
|
||||||
<div className='min-h-sceen w-full relative'>
|
|
||||||
<ProjectFlockTable
|
|
||||||
refresh={() => !isOpen && router.push('/production/project-flock')}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Render Modal only on /add */}
|
|
||||||
<Modal
|
|
||||||
ref={formModal.ref}
|
|
||||||
position='end'
|
|
||||||
onBackdropClick={handleBackdropClick}
|
|
||||||
className={{
|
|
||||||
modalBox: 'w-full sm:w-fit p-3 rounded-xl bg-transparent shadow-none',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className='w-full sm:w-[446px] h-full flex flex-col sm:flex-row items-stretch bg-base-100 rounded-xl overflow-hidden'>
|
|
||||||
{isOpen && children}
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@ import ProjectFlockTable from '@/components/pages/production/project-flock/Proje
|
|||||||
|
|
||||||
const ProjectFlock = () => {
|
const ProjectFlock = () => {
|
||||||
return (
|
return (
|
||||||
<section className='size-full p-4'>
|
<section className='w-full p-4'>
|
||||||
<ProjectFlockTable />
|
<ProjectFlockTable />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,13 +11,10 @@ const RecordingEdit = () => {
|
|||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
const recordingId = searchParams.get('recordingId');
|
const recordingId = searchParams.get('recordingId');
|
||||||
const recordingDetailKey = recordingId
|
|
||||||
? ['recording-detail', recordingId]
|
|
||||||
: null;
|
|
||||||
|
|
||||||
const { data: recording, isLoading: isLoadingRecording } = useSWR(
|
const { data: recording, isLoading: isLoadingRecording } = useSWR(
|
||||||
recordingDetailKey,
|
recordingId,
|
||||||
([, id]: [string, string]) => RecordingApi.getSingle(parseInt(id))
|
(id: number) => RecordingApi.getSingle(id) // Gunakan RecordingApi
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!recordingId) {
|
if (!recordingId) {
|
||||||
|
|||||||
@@ -11,13 +11,10 @@ const RecordingDetail = () => {
|
|||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
const recordingId = searchParams.get('recordingId');
|
const recordingId = searchParams.get('recordingId');
|
||||||
const recordingDetailKey = recordingId
|
|
||||||
? ['recording-detail', recordingId]
|
|
||||||
: null;
|
|
||||||
|
|
||||||
const { data: recording, isLoading: isLoadingRecording } = useSWR(
|
const { data: recording, isLoading: isLoadingRecording } = useSWR(
|
||||||
recordingDetailKey,
|
recordingId,
|
||||||
([, id]: [string, string]) => RecordingApi.getSingle(parseInt(id))
|
(id: number) => RecordingApi.getSingle(id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!recordingId) {
|
if (!recordingId) {
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
import GradingForm from '@/components/pages/production/recording/grading/form/GradingForm';
|
||||||
|
import { RecordingApi } from '@/services/api/production';
|
||||||
|
import { isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
|
const AddGrading = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const recordingId = searchParams.get('recording_id');
|
||||||
|
|
||||||
|
const { data: recording, isLoading: isLoadingRecording } = useSWR(
|
||||||
|
recordingId && recordingId !== 'new' ? [recordingId] : null,
|
||||||
|
([id]) => RecordingApi.getSingle(parseInt(id))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
recordingId &&
|
||||||
|
recordingId !== 'new' &&
|
||||||
|
!isLoadingRecording &&
|
||||||
|
(!recording || !isResponseSuccess(recording))
|
||||||
|
) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{recordingId && recordingId !== 'new' && isLoadingRecording && (
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
)}
|
||||||
|
{(!recordingId ||
|
||||||
|
recordingId === 'new' ||
|
||||||
|
(!isLoadingRecording && recording && isResponseSuccess(recording))) && (
|
||||||
|
<GradingForm
|
||||||
|
type='add'
|
||||||
|
initialValues={
|
||||||
|
isResponseSuccess(recording) ? recording.data?.eggs?.[0] : undefined
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddGrading;
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
import GradingForm from '@/components/pages/production/recording/grading/form/GradingForm';
|
||||||
|
import { RecordingApi } from '@/services/api/production';
|
||||||
|
import { isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
|
const EditGrading = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const recordingId = searchParams.get('recordingId');
|
||||||
|
const gradingId = searchParams.get('gradingId');
|
||||||
|
|
||||||
|
const { data: recording, isLoading: isLoadingRecording } = useSWR(
|
||||||
|
recordingId ? [recordingId] : null,
|
||||||
|
([id]) => RecordingApi.getSingle(parseInt(id))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!recordingId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoadingRecording && (!recording || !isResponseSuccess(recording))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{isLoadingRecording && (
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
)}
|
||||||
|
{!isLoadingRecording && recording && isResponseSuccess(recording) && (
|
||||||
|
<GradingForm
|
||||||
|
type='edit'
|
||||||
|
initialValues={recording.data.eggs?.find(
|
||||||
|
(egg) => egg.id === parseInt(gradingId || '0')
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default EditGrading;
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
import GradingForm from '@/components/pages/production/recording/grading/form/GradingForm';
|
||||||
|
import { RecordingApi } from '@/services/api/production';
|
||||||
|
import { isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
|
const DetailGrading = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const gradingId = searchParams.get('gradingId');
|
||||||
|
|
||||||
|
const { data: grading, isLoading: isLoadingGrading } = useSWR(
|
||||||
|
gradingId ? [gradingId] : null,
|
||||||
|
([id]) => RecordingApi.getSingle(parseInt(id))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!gradingId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoadingGrading && (!grading || !isResponseSuccess(grading))) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{isLoadingGrading && (
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
)}
|
||||||
|
{!isLoadingGrading && grading && isResponseSuccess(grading) && (
|
||||||
|
<GradingForm
|
||||||
|
type='detail'
|
||||||
|
initialValues={grading.data.eggs?.find(
|
||||||
|
(egg) => egg.id === parseInt(gradingId)
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DetailGrading;
|
||||||
@@ -2,7 +2,7 @@ import RecordingTable from '@/components/pages/production/recording/RecordingTab
|
|||||||
|
|
||||||
const Recording = () => {
|
const Recording = () => {
|
||||||
return (
|
return (
|
||||||
<section className='w-full'>
|
<section className='w-full p-4'>
|
||||||
<RecordingTable />
|
<RecordingTable />
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import TransferToLayingForm from '@/components/pages/production/transfer-to-laying/form/TransferToLayingForm';
|
||||||
|
|
||||||
|
const AddTransferToLaying = () => {
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
<TransferToLayingForm />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default AddTransferToLaying;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
import TransferToLayingForm from '@/components/pages/production/transfer-to-laying/form/TransferToLayingForm';
|
||||||
|
|
||||||
|
import { TransferToLayingApi } from '@/services/api/production/transfer-to-laying';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
|
const TransferToLayingEdit = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const transferToLayingId = searchParams.get('transferToLayingId');
|
||||||
|
|
||||||
|
const { data: transferToLaying, isLoading: isLoadingTransferToLaying } =
|
||||||
|
useSWR(transferToLayingId, (id: number) =>
|
||||||
|
TransferToLayingApi.getSingle(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!transferToLayingId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isLoadingTransferToLaying &&
|
||||||
|
(!transferToLaying || isResponseError(transferToLaying))
|
||||||
|
) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
isResponseSuccess(transferToLaying) &&
|
||||||
|
transferToLaying.data.approval.step_number === 2
|
||||||
|
) {
|
||||||
|
router.replace('/production/transfer-to-laying');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{isLoadingTransferToLaying && (
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
)}
|
||||||
|
{!isLoadingTransferToLaying && isResponseSuccess(transferToLaying) && (
|
||||||
|
<TransferToLayingForm
|
||||||
|
type='edit'
|
||||||
|
initialValues={transferToLaying.data}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TransferToLayingEdit;
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
import TransferToLayingForm from '@/components/pages/production/transfer-to-laying/form/TransferToLayingForm';
|
||||||
|
|
||||||
|
import { TransferToLayingApi } from '@/services/api/production/transfer-to-laying';
|
||||||
|
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
||||||
|
|
||||||
|
const TransferToLayingDetail = () => {
|
||||||
|
const router = useRouter();
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
|
||||||
|
const transferToLayingId = searchParams.get('transferToLayingId');
|
||||||
|
|
||||||
|
const { data: transferToLaying, isLoading: isLoadingTransferToLaying } =
|
||||||
|
useSWR(transferToLayingId, (id: number) =>
|
||||||
|
TransferToLayingApi.getSingle(id)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!transferToLayingId) {
|
||||||
|
router.back();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full flex flex-row justify-center items-center p-4'>
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isLoadingTransferToLaying &&
|
||||||
|
(!transferToLaying || isResponseError(transferToLaying))
|
||||||
|
) {
|
||||||
|
router.replace('/404');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='w-full p-4 flex flex-row justify-center'>
|
||||||
|
{isLoadingTransferToLaying && (
|
||||||
|
<span className='loading loading-spinner loading-xl' />
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!isLoadingTransferToLaying && isResponseSuccess(transferToLaying) && (
|
||||||
|
<TransferToLayingForm
|
||||||
|
type='detail'
|
||||||
|
initialValues={transferToLaying.data}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TransferToLayingDetail;
|
||||||
@@ -1,25 +1,9 @@
|
|||||||
import TransferToLayingsTable from '@/components/pages/production/transfer-to-laying/TransferToLayingsTable';
|
import TransferToLayingsTable from '@/components/pages/production/transfer-to-laying/TransferToLayingsTable';
|
||||||
import TransferToLayingFormModal from '@/components/pages/production/transfer-to-laying/TransferToLayingFormModal';
|
|
||||||
import TransferToLayingDetailModal from '@/components/pages/production/transfer-to-laying/TransferToLayingDetailModal';
|
|
||||||
import RequirePermission from '@/components/helper/RequirePermission';
|
|
||||||
|
|
||||||
const TransferToLaying = () => {
|
const TransferToLaying = () => {
|
||||||
return (
|
return (
|
||||||
<section className='w-full'>
|
<section className='w-full p-4'>
|
||||||
<TransferToLayingsTable />
|
<TransferToLayingsTable />
|
||||||
|
|
||||||
<RequirePermission
|
|
||||||
permissions={[
|
|
||||||
'lti.production.transfer_to_laying.create',
|
|
||||||
'lti.production.transfer_to_laying.update',
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<TransferToLayingFormModal />
|
|
||||||
</RequirePermission>
|
|
||||||
|
|
||||||
<RequirePermission permissions='lti.production.transfer_to_laying.detail'>
|
|
||||||
<TransferToLayingDetailModal />
|
|
||||||
</RequirePermission>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
import UniformityForm from '@/components/pages/production/uniformity/form/UniformityForm';
|
|
||||||
|
|
||||||
const AddUniformity = () => {
|
|
||||||
return <UniformityForm formType='add' />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddUniformity;
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import UniformityDetail from '@/components/pages/production/uniformity/detail/UniformityDetail';
|
|
||||||
import { isResponseError, isResponseSuccess } from '@/lib/api-helper';
|
|
||||||
import { UniformityApi } from '@/services/api/uniformity';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import useSWR from 'swr';
|
|
||||||
|
|
||||||
const UniformityDetailPage = () => {
|
|
||||||
const router = useRouter();
|
|
||||||
const searchParams = useSearchParams();
|
|
||||||
|
|
||||||
const uniformityId = searchParams.get('uniformityId');
|
|
||||||
|
|
||||||
const { data: uniformity, isLoading: isLoadingUniformity } = useSWR(
|
|
||||||
uniformityId,
|
|
||||||
(id: string) => UniformityApi.getUniformityDetail(parseInt(id))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!uniformityId) {
|
|
||||||
router.back();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoadingUniformity && (!uniformity || isResponseError(uniformity))) {
|
|
||||||
router.replace('/404');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className='w-full h-full flex flex-col justify-center'>
|
|
||||||
{isLoadingUniformity && (
|
|
||||||
<div className='w-full flex flex-row justify-center items-center p-4 min-h-screen'>
|
|
||||||
<span className='loading loading-spinner loading-xl' />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{isResponseSuccess(uniformity) && (
|
|
||||||
<UniformityDetail initialValues={uniformity.data} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default UniformityDetailPage;
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import { ReactNode } from 'react';
|
|
||||||
import UniformityPageWrapper from '@/components/pages/production/uniformity/UniformityPageWrapper';
|
|
||||||
|
|
||||||
export default function UniformityLayout({
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
children: ReactNode;
|
|
||||||
}) {
|
|
||||||
return <UniformityPageWrapper>{children}</UniformityPageWrapper>;
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import UniformityTable from '@/components/pages/production/uniformity/UniformityTable';
|
|
||||||
|
|
||||||
const Uniformity = () => {
|
|
||||||
return <UniformityTable />;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Uniformity;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import PurchaseRequestForm from '@/components/pages/purchase/form/request/PurchaseRequestForm';
|
|
||||||
|
|
||||||
const AddPurchaseRequest = () => {
|
|
||||||
return (
|
|
||||||
<div className='w-full p-4 flex flex-row justify-center'>
|
|
||||||
<PurchaseRequestForm />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default AddPurchaseRequest;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user