From c2479ad248ac2c9bc9e2d00b2c31f1ce326f8700 Mon Sep 17 00:00:00 2001 From: rstubryan Date: Thu, 13 Nov 2025 14:08:35 +0700 Subject: [PATCH] chore: prettier format --- .gitlab-ci.yml | 25 +++--- docker-compose.yaml | 12 +-- .../production/recording/grading/add/page.tsx | 7 +- src/components/helper/form/FormActions.tsx | 78 ++++++++++--------- src/components/input/PatternInput.tsx | 16 ++-- .../movement/form/MovementForm.schema.ts | 61 ++++++++------- .../form/ProductCategoryForm.schema.ts | 4 +- .../product/form/ProductForm.schema.ts | 8 +- .../master-data/product/form/ProductForm.tsx | 4 +- .../recording/form/RecordingForm.schema.ts | 23 +++--- 10 files changed, 127 insertions(+), 111 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 345f305f..951e5472 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ stages: - build - deploy - + .build_template: &build_template stage: build image: node:20-alpine @@ -10,15 +10,15 @@ stages: paths: - node_modules/ variables: - NPM_CONFIG_PRODUCTION: "false" - NODE_ENV: "" + NPM_CONFIG_PRODUCTION: 'false' + NODE_ENV: '' script: - echo "Installing dependencies..." - npm ci --no-audit --no-fund - echo "Building Next.js static export..." - npx next build artifacts: - name: "out-$CI_COMMIT_SHORT_SHA" + name: 'out-$CI_COMMIT_SHORT_SHA' paths: - out/ expire_in: 1 week @@ -27,7 +27,7 @@ stages: stage: deploy image: name: amazon/aws-cli:latest - entrypoint: ["/bin/sh", "-c"] + entrypoint: ['/bin/sh', '-c'] script: - set -e - aws --version @@ -106,22 +106,21 @@ build:dev: environment: name: development variables: - NEXT_PUBLIC_API_BASE_URL: "https://dev-api-lti.mbugroup.id" - NEXT_PUBLIC_SSO_LOGIN_URL: "https://dev-api-sso.mbugroup.id" + NEXT_PUBLIC_API_BASE_URL: 'https://dev-api-lti.mbugroup.id' + NEXT_PUBLIC_SSO_LOGIN_URL: 'https://dev-api-sso.mbugroup.id' deploy:dev: <<: *deploy_template - needs: ["build:dev"] + needs: ['build:dev'] rules: - if: '$CI_COMMIT_BRANCH == "development"' variables: - S3_BUCKET: "dev-lti-erp.mbugroup.id" - AWS_REGION: "ap-southeast-3" - CLOUDFRONT_DISTRIBUTION_ID: "E1Z8XTA8XF1GIV" + S3_BUCKET: 'dev-lti-erp.mbugroup.id' + AWS_REGION: 'ap-southeast-3' + CLOUDFRONT_DISTRIBUTION_ID: 'E1Z8XTA8XF1GIV' environment: name: development url: https://dev-lti-erp.mbugroup.id - # ====== PRODUCTION ====== # build:production: # <<: *build_template @@ -143,5 +142,5 @@ deploy:dev: # CLOUDFRONT_DISTRIBUTION_ID: "ddfd" # environment: # name: production - # url: https://royalgoldcapital.com +# url: https://royalgoldcapital.com diff --git a/docker-compose.yaml b/docker-compose.yaml index 8d658170..b89f441b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: "3.9" +version: '3.9' services: dev-web-lti: @@ -7,7 +7,7 @@ services: context: . dockerfile: Dockerfile ports: - - "3002:3000" + - '3002:3000' env_file: - .env environment: @@ -19,13 +19,13 @@ services: deploy: resources: limits: - cpus: "3.0" + cpus: '3.0' memory: 3G reservations: - cpus: "1.0" + cpus: '1.0' memory: 512M extra_hosts: - - "host.docker.internal:host-gateway" + - 'host.docker.internal:host-gateway' # Optional: aktifkan healthcheck jika punya endpoint # healthcheck: # test: ["CMD-SHELL", "curl -fsS http://localhost:3000/api/healthz || exit 1"] @@ -36,4 +36,4 @@ services: networks: dev-lti-network: - external: true \ No newline at end of file + external: true diff --git a/src/app/production/recording/grading/add/page.tsx b/src/app/production/recording/grading/add/page.tsx index 828930b3..9b918d98 100644 --- a/src/app/production/recording/grading/add/page.tsx +++ b/src/app/production/recording/grading/add/page.tsx @@ -35,7 +35,12 @@ const AddGrading = () => { {(!recordingId || recordingId === 'new' || (!isLoadingRecording && recording && isResponseSuccess(recording))) && ( - + )} ); diff --git a/src/components/helper/form/FormActions.tsx b/src/components/helper/form/FormActions.tsx index 111b052f..4968f93e 100644 --- a/src/components/helper/form/FormActions.tsx +++ b/src/components/helper/form/FormActions.tsx @@ -64,44 +64,46 @@ export const FormActions = ({ Edit )} - {type === 'detail' && showApproveReject && (onApprove || onReject) && ( - <> - {onApprove && ( - - )} - {onReject && ( - - )} - - )} + {type === 'detail' && + showApproveReject && + (onApprove || onReject) && ( + <> + {onApprove && ( + + )} + {onReject && ( + + )} + + )} )} {type !== 'detail' && ( diff --git a/src/components/input/PatternInput.tsx b/src/components/input/PatternInput.tsx index 1905d2e3..b5f4f65d 100644 --- a/src/components/input/PatternInput.tsx +++ b/src/components/input/PatternInput.tsx @@ -20,14 +20,14 @@ interface PatternInputProps extends Omit { } const PatternInput = ({ - type = 'text', - format, - mask = '_', - allowEmptyFormatting = false, - patternChar = '#', - onChange, - ...restProps - }: PatternInputProps) => { + type = 'text', + format, + mask = '_', + allowEmptyFormatting = false, + patternChar = '#', + onChange, + ...restProps +}: PatternInputProps) => { const valueChangeHandler: OnValueChange = ( patternFormatValues, sourceInfo diff --git a/src/components/pages/inventory/movement/form/MovementForm.schema.ts b/src/components/pages/inventory/movement/form/MovementForm.schema.ts index 195873b7..39f7c669 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.schema.ts +++ b/src/components/pages/inventory/movement/form/MovementForm.schema.ts @@ -150,36 +150,37 @@ const DeliveryObjectSchema: Yup.ObjectSchema = Yup.object({ .required('Produk wajib diisi!'), }); -export const MovementFormSchema: Yup.ObjectSchema = Yup.object({ - transfer_reason: Yup.string().required('Alasan transfer wajib diisi!'), - transfer_date: Yup.string().required('Tanggal transfer wajib diisi!'), - source_warehouse: Yup.object({ - value: Yup.number().min(1).required(), - label: Yup.string().required(), - area: Yup.string().optional(), - location: Yup.string().optional(), - }).nullable(), - source_warehouse_id: Yup.number() - .required('Gudang asal wajib diisi!') - .typeError('Gudang asal wajib diisi!'), - destination_warehouse: Yup.object({ - value: Yup.number().min(1).required(), - label: Yup.string().required(), - area: Yup.string().optional(), - location: Yup.string().optional(), - }).nullable(), - destination_warehouse_id: Yup.number() - .required('Gudang tujuan wajib diisi!') - .typeError('Gudang tujuan wajib diisi!'), - products: Yup.array() - .of(ProductObjectSchema) - .min(1, 'Minimal harus ada 1 produk!') - .required('Produk wajib diisi!'), - deliveries: Yup.array() - .of(DeliveryObjectSchema) - .min(1, 'Minimal harus ada 1 pengiriman!') - .required('Pengiriman wajib diisi!'), -}); +export const MovementFormSchema: Yup.ObjectSchema = + Yup.object({ + transfer_reason: Yup.string().required('Alasan transfer wajib diisi!'), + transfer_date: Yup.string().required('Tanggal transfer wajib diisi!'), + source_warehouse: Yup.object({ + value: Yup.number().min(1).required(), + label: Yup.string().required(), + area: Yup.string().optional(), + location: Yup.string().optional(), + }).nullable(), + source_warehouse_id: Yup.number() + .required('Gudang asal wajib diisi!') + .typeError('Gudang asal wajib diisi!'), + destination_warehouse: Yup.object({ + value: Yup.number().min(1).required(), + label: Yup.string().required(), + area: Yup.string().optional(), + location: Yup.string().optional(), + }).nullable(), + destination_warehouse_id: Yup.number() + .required('Gudang tujuan wajib diisi!') + .typeError('Gudang tujuan wajib diisi!'), + products: Yup.array() + .of(ProductObjectSchema) + .min(1, 'Minimal harus ada 1 produk!') + .required('Produk wajib diisi!'), + deliveries: Yup.array() + .of(DeliveryObjectSchema) + .min(1, 'Minimal harus ada 1 pengiriman!') + .required('Pengiriman wajib diisi!'), + }); export type MovementFormValues = Yup.InferType; diff --git a/src/components/pages/master-data/product-category/form/ProductCategoryForm.schema.ts b/src/components/pages/master-data/product-category/form/ProductCategoryForm.schema.ts index d97e755a..c9cb2b7b 100644 --- a/src/components/pages/master-data/product-category/form/ProductCategoryForm.schema.ts +++ b/src/components/pages/master-data/product-category/form/ProductCategoryForm.schema.ts @@ -15,4 +15,6 @@ export const ProductCategoryFormSchema: Yup.ObjectSchema; \ No newline at end of file +export type ProductCategoryFormValues = Yup.InferType< + typeof ProductCategoryFormSchema +>; diff --git a/src/components/pages/master-data/product/form/ProductForm.schema.ts b/src/components/pages/master-data/product/form/ProductForm.schema.ts index 5db141a3..37881636 100644 --- a/src/components/pages/master-data/product/form/ProductForm.schema.ts +++ b/src/components/pages/master-data/product/form/ProductForm.schema.ts @@ -31,7 +31,9 @@ export const ProductFormSchema: Yup.ObjectSchema = uom: Yup.object({ value: Yup.number().min(1).required(), label: Yup.string().required(), - }).nullable().required('Satuan wajib diisi!'), + }) + .nullable() + .required('Satuan wajib diisi!'), uom_id: Yup.number() .required('Satuan wajib diisi!') @@ -40,7 +42,9 @@ export const ProductFormSchema: Yup.ObjectSchema = product_category: Yup.object({ value: Yup.number().min(1).required(), label: Yup.string().required(), - }).nullable().required('Kategori produk wajib diisi!'), + }) + .nullable() + .required('Kategori produk wajib diisi!'), product_category_id: Yup.number() .required('Kategori produk wajib diisi!') diff --git a/src/components/pages/master-data/product/form/ProductForm.tsx b/src/components/pages/master-data/product/form/ProductForm.tsx index 20527398..44457c81 100644 --- a/src/components/pages/master-data/product/form/ProductForm.tsx +++ b/src/components/pages/master-data/product/form/ProductForm.tsx @@ -121,9 +121,7 @@ const ProductForm = ({ type = 'add', initialValues }: ProductFormProps) => { supplier_ids: values.supplier_ids.filter( (id): id is number => typeof id === 'number' ), - flags: values.flags.filter( - (f): f is string => typeof f === 'string' - ), + flags: values.flags.filter((f): f is string => typeof f === 'string'), }; switch (type) { case 'add': diff --git a/src/components/pages/production/recording/form/RecordingForm.schema.ts b/src/components/pages/production/recording/form/RecordingForm.schema.ts index 73b41d8e..dd13aa0b 100644 --- a/src/components/pages/production/recording/form/RecordingForm.schema.ts +++ b/src/components/pages/production/recording/form/RecordingForm.schema.ts @@ -236,7 +236,9 @@ export type RecordingGradingFormValues = Yup.InferType< type RecordingFormData = Partial & { body_weights?: CreateGrowingRecordingPayload['body_weights']; stocks?: CreateGrowingRecordingPayload['stocks'] | Recording['stocks']; - depletions?: CreateGrowingRecordingPayload['depletions'] | Recording['depletions']; + depletions?: + | CreateGrowingRecordingPayload['depletions'] + | Recording['depletions']; eggs?: CreateLayingRecordingPayload['eggs'] | Recording['eggs']; project_flock_kandang_id?: number; project_flock_category?: string; @@ -268,14 +270,17 @@ export const getRecordingGrowingFormInitialValues = ( }, ], stocks: initialValues?.stocks?.map((stock) => ({ - product_warehouse_id: stock.product_warehouse_id, - qty: (stock as { qty?: number; usage_amount?: number }).qty || (stock as { qty?: number; usage_amount?: number }).usage_amount || '', - })) ?? [ - { - product_warehouse_id: 0, - qty: '', - }, - ], + product_warehouse_id: stock.product_warehouse_id, + qty: + (stock as { qty?: number; usage_amount?: number }).qty || + (stock as { qty?: number; usage_amount?: number }).usage_amount || + '', + })) ?? [ + { + product_warehouse_id: 0, + qty: '', + }, + ], depletions: initialValues?.depletions?.map( ( depletion: NonNullable[0]