From f555e7bc9d070e7e0bd4900941592480d4ba6c6a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 17 Oct 2024 14:39:17 +0700 Subject: update pengajuan tempo --- .../register/stores/usePengajuanTempoStore.ts | 93 ++++++++++++++++++++++ src-migrate/types/tempo.ts | 59 ++++++++++++++ src-migrate/validations/tempo.ts | 28 +++++++ 3 files changed, 180 insertions(+) create mode 100644 src-migrate/modules/register/stores/usePengajuanTempoStore.ts create mode 100644 src-migrate/types/tempo.ts create mode 100644 src-migrate/validations/tempo.ts (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts new file mode 100644 index 00000000..6f3bc13d --- /dev/null +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -0,0 +1,93 @@ +import { create } from 'zustand'; +import { TempoProps } from '~/types/tempo'; +import { TempoSchema } from '~/validations/tempo'; +import { boolean, ZodError } from 'zod'; + +type State = { + form: TempoProps; + errors: { + [key in keyof TempoProps]?: string; + }; + isCheckedTNC: boolean; + isOpenTNC: boolean; + isValidCaptcha: boolean; +}; + +type Action = { + updateForm: (name: string, value: string) => void; + updateValidCaptcha: (value: boolean) => void; + toggleCheckTNC: () => void; + openTNC: () => void; + closeTNC: () => void; + validate: () => void; + resetForm: () => void; +}; + +export const usePengajuanTempoStore = create((set, get) => ({ + form: { + name: '', + industry_id: '', + street: '', + state: '', + city: '', + zip: '', + mobile: '', + bankName: '', + accountName: '', + accountNumber: '', + estimasi: '', + tempoDuration: '', + bersedia: '', + categoryProduk: '', + tempoLimit: '', + }, + updateForm: (name, value) => + set((state) => ({ form: { ...state.form, [name]: value } })), + + errors: {}, + validate: () => { + try { + TempoSchema.parse(get().form); + set({ errors: {} }); + } catch (error) { + if (error instanceof ZodError) { + const errors: State['errors'] = {}; + error.errors.forEach( + (e) => (errors[e.path[0] as keyof TempoProps] = e.message) + ); + set({ errors }); + } + } + }, + + isCheckedTNC: false, + toggleCheckTNC: () => set((state) => ({ isCheckedTNC: !state.isCheckedTNC })), + + isOpenTNC: false, + openTNC: () => set(() => ({ isOpenTNC: true })), + closeTNC: () => set(() => ({ isOpenTNC: false })), + + isValidCaptcha: false, + updateValidCaptcha: (value) => set(() => ({ isValidCaptcha: value })), + + resetForm: () => + set({ + form: { + name: '', + industry_id: '', + street: '', + state: '', + city: '', + zip: '', + mobile: '', + bankName: '', + accountName: '', + accountNumber: '', + estimasi: '', + tempoDuration: '', + bersedia: '', + categoryProduk: '', + tempoLimit: '', + }, + }), +})); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts new file mode 100644 index 00000000..f8a3c5b8 --- /dev/null +++ b/src-migrate/types/tempo.ts @@ -0,0 +1,59 @@ +import { TempoSchema } from '~/validations/tempo'; +import { OdooApiRes } from './odoo'; +import { z } from 'zod'; + +export type tempoProps = { + name: string; + industry_id: string; + street: string; + state: string; + city: string; + zip: string; + mobile: string; + bankName: string; + accountName: string; + accountNumber: string; + estimasi: string; + tempoDuration: string; + bersedia: string; +}; + +export type TempoApiProps = OdooApiRes; + +export type TempoProps = z.infer; + +export type TempoResApiProps = { + Tempo: boolean; + reason: 'EMAIL_USED' | 'NOT_ACTIVE' | null; +}; + +type ActivationResProps = { + activation: boolean; + user: TempoProps | null; +}; + +export type ActivationTokenProps = { + token: string; +}; + +export type ActivationTokenResApiProps = ActivationResProps & { + reason: 'INVALID_TOKEN' | null; +}; + +export type ActivationOtpProps = { + email: string; + otp: string; +}; + +export type ActivationOtpResApiProps = ActivationResProps & { + reason: 'INVALID_OTP' | null; +}; + +export type ActivationReqProps = { + email: string; +}; + +export type ActivationReqResApiProps = { + activation_request: boolean; + reason: 'NOT_FOUND' | 'ACTIVE' | null; +}; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts new file mode 100644 index 00000000..6999c1c6 --- /dev/null +++ b/src-migrate/validations/tempo.ts @@ -0,0 +1,28 @@ +import { z } from 'zod'; + +export const TempoSchema = z.object({ + name: z.string().min(1, { message: 'Nama harus diisi' }), + street: z.string().min(1, { message: 'Alamat harus diisi' }), + industry_id: z.string().min(1, { message: 'Jenis usaha harus dipilih' }), + zip: z.string().min(1, { message: 'Kode pos harus diisi' }), + state: z.string().min(1, { message: 'Provinsi harus dipilih' }), + city: z.string().min(1, { message: 'Kota harus dipilih' }), + mobile: z + .string() + .min(1, { message: 'Nomor telepon harus diisi' }) + .refine((val) => /^\d{10,12}$/.test(val), { + message: 'Format nomor telepon tidak valid, contoh: 081234567890', + }), + bankName: z.string().min(1, { message: 'Nama bank harus diisi' }), + accountName: z.string().min(1, { message: 'Nama rekening harus diisi' }), + accountNumber: z.string().min(1, { message: 'Nomor rekening harus diisi' }), + estimasi: z + .string() + .min(1, { message: 'Estimasi pemmbelian pertahun harus diisi' }), + tempoDuration: z.string().min(1, { message: 'Durasi tempo harus dipilih' }), + tempoLimit: z.string().min(1, { message: 'Limit tempo harus dipilih' }), + bersedia: z.string().min(1, { message: 'Harus dipilih' }), + categoryProduk: z + .string() + .min(1, { message: 'Category produk harus dipilih' }), +}); -- cgit v1.2.3 From ead46a6d760850530946926b390a8954ca64e1c2 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 17 Oct 2024 17:06:58 +0700 Subject: update pengajuan tempo --- .../register/stores/usePengajuanTempoStore.ts | 86 +++++++++++++++++++++- src-migrate/types/tempo.ts | 20 ++++- src-migrate/validations/tempo.ts | 30 ++++++++ 3 files changed, 133 insertions(+), 3 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 6f3bc13d..8891e6ea 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -1,6 +1,6 @@ import { create } from 'zustand'; -import { TempoProps } from '~/types/tempo'; -import { TempoSchema } from '~/validations/tempo'; +import { TempoProps, TempoPropsKontakPerson } from '~/types/tempo'; +import { TempoSchema, TempoSchemaKontakPerson } from '~/validations/tempo'; import { boolean, ZodError } from 'zod'; type State = { @@ -91,3 +91,85 @@ export const usePengajuanTempoStore = create((set, get) => ({ }, }), })); + +type StateKontakPerson = { + form: TempoPropsKontakPerson; + errors: { + [key in keyof TempoPropsKontakPerson]?: string; + }; + isCheckedTNC: boolean; + isOpenTNC: boolean; + isValidCaptcha: boolean; +}; +export const usePengajuanTempoStoreKontakPerson = create< + StateKontakPerson & Action +>((set, get) => ({ + form: { + direkturName: '', + direkturMobile: '', + direkturEmail: '', + industry_id: '', + street: '', + state: '', + city: '', + zip: '', + bankName: '', + accountName: '', + accountNumber: '', + estimasi: '', + tempoDuration: '', + bersedia: '', + categoryProduk: '', + tempoLimit: '', + }, + updateForm: (name, value) => + set((state) => ({ form: { ...state.form, [name]: value } })), + + errors: {}, + validate: () => { + try { + TempoSchemaKontakPerson.parse(get().form); + set({ errors: {} }); + } catch (error) { + if (error instanceof ZodError) { + const errors: StateKontakPerson['errors'] = {}; + error.errors.forEach( + (e) => (errors[e.path[0] as keyof TempoPropsKontakPerson] = e.message) + ); + set({ errors }); + } + } + }, + + isCheckedTNC: false, + toggleCheckTNC: () => set((state) => ({ isCheckedTNC: !state.isCheckedTNC })), + + isOpenTNC: false, + openTNC: () => set(() => ({ isOpenTNC: true })), + closeTNC: () => set(() => ({ isOpenTNC: false })), + + isValidCaptcha: false, + updateValidCaptcha: (value) => set(() => ({ isValidCaptcha: value })), + + resetForm: () => + set({ + form: { + direkturName: '', + direkturMobile: '', + direkturEmail: '', + industry_id: '', + street: '', + state: '', + city: '', + zip: '', + bankName: '', + accountName: '', + accountNumber: '', + estimasi: '', + tempoDuration: '', + bersedia: '', + categoryProduk: '', + tempoLimit: '', + }, + }), +})); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index f8a3c5b8..a4bd3d0a 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -1,4 +1,4 @@ -import { TempoSchema } from '~/validations/tempo'; +import { TempoSchema, TempoSchemaKontakPerson } from '~/validations/tempo'; import { OdooApiRes } from './odoo'; import { z } from 'zod'; @@ -18,9 +18,27 @@ export type tempoProps = { bersedia: string; }; +export type tempoPropsKontakPerson = { + direkturName: string; + direkturMobile: string; + direkturEmail: string; + industry_id: string; + street: string; + state: string; + city: string; + zip: string; + bankName: string; + accountName: string; + accountNumber: string; + estimasi: string; + tempoDuration: string; + bersedia: string; +}; + export type TempoApiProps = OdooApiRes; export type TempoProps = z.infer; +export type TempoPropsKontakPerson = z.infer; export type TempoResApiProps = { Tempo: boolean; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 6999c1c6..dca60869 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -26,3 +26,33 @@ export const TempoSchema = z.object({ .string() .min(1, { message: 'Category produk harus dipilih' }), }); +export const TempoSchemaKontakPerson = z.object({ + direkturName: z.string().min(1, { message: 'Nama harus diisi' }), + direkturMobile: z + .string() + .min(1, { message: 'Nomor telepon harus diisi' }) + .refine((val) => /^\d{10,12}$/.test(val), { + message: 'Format nomor telepon tidak valid, contoh: 081234567890', + }), + direkturEmail: z + .string() + .min(1, { message: 'Email harus diisi' }) + .email({ message: 'Email harus menggunakan format example@mail.com' }), + street: z.string().min(1, { message: 'Alamat harus diisi' }), + industry_id: z.string().min(1, { message: 'Jenis usaha harus dipilih' }), + zip: z.string().min(1, { message: 'Kode pos harus diisi' }), + state: z.string().min(1, { message: 'Provinsi harus dipilih' }), + city: z.string().min(1, { message: 'Kota harus dipilih' }), + bankName: z.string().min(1, { message: 'Nama bank harus diisi' }), + accountName: z.string().min(1, { message: 'Nama rekening harus diisi' }), + accountNumber: z.string().min(1, { message: 'Nomor rekening harus diisi' }), + estimasi: z + .string() + .min(1, { message: 'Estimasi pemmbelian pertahun harus diisi' }), + tempoDuration: z.string().min(1, { message: 'Durasi tempo harus dipilih' }), + tempoLimit: z.string().min(1, { message: 'Limit tempo harus dipilih' }), + bersedia: z.string().min(1, { message: 'Harus dipilih' }), + categoryProduk: z + .string() + .min(1, { message: 'Category produk harus dipilih' }), +}); -- cgit v1.2.3 From 661d742193b62aeb3d2a2350433bdd3714667625 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 18 Oct 2024 10:39:40 +0700 Subject: add kontak perusahaan --- .../register/stores/usePengajuanTempoStore.ts | 89 +++++++++------------- src-migrate/types/tempo.ts | 16 ++-- src-migrate/validations/tempo.ts | 29 ++++--- 3 files changed, 54 insertions(+), 80 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 8891e6ea..247f62dd 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -93,83 +93,64 @@ export const usePengajuanTempoStore = create((set, get) => ({ })); type StateKontakPerson = { - form: TempoPropsKontakPerson; - errors: { + formKontakPerson: TempoPropsKontakPerson; + errorsKontakPerson: { [key in keyof TempoPropsKontakPerson]?: string; }; - isCheckedTNC: boolean; - isOpenTNC: boolean; - isValidCaptcha: boolean; +}; +type ActionKontakPerson = { + updateFormKontakPerson: (name: string, value: string) => void; + + validateKontakPerson: () => void; + resetFormKontakPerson: () => void; }; export const usePengajuanTempoStoreKontakPerson = create< - StateKontakPerson & Action + StateKontakPerson & ActionKontakPerson >((set, get) => ({ - form: { + formKontakPerson: { direkturName: '', direkturMobile: '', direkturEmail: '', - industry_id: '', - street: '', - state: '', - city: '', - zip: '', - bankName: '', - accountName: '', - accountNumber: '', - estimasi: '', - tempoDuration: '', - bersedia: '', - categoryProduk: '', - tempoLimit: '', + purchasingName: '', + purchasingEmail: '', + financeMobile: '', + financeName: '', + financeEmail: '', }, - updateForm: (name, value) => - set((state) => ({ form: { ...state.form, [name]: value } })), + updateFormKontakPerson: (name, value) => + set((state) => ({ + formKontakPerson: { ...state.formKontakPerson, [name]: value }, + })), - errors: {}, - validate: () => { + errorsKontakPerson: {}, + validateKontakPerson: () => { try { - TempoSchemaKontakPerson.parse(get().form); - set({ errors: {} }); + TempoSchemaKontakPerson.parse(get().formKontakPerson); + set({ errorsKontakPerson: {} }); } catch (error) { if (error instanceof ZodError) { - const errors: StateKontakPerson['errors'] = {}; + const errorsKontakPerson: StateKontakPerson['errorsKontakPerson'] = {}; error.errors.forEach( - (e) => (errors[e.path[0] as keyof TempoPropsKontakPerson] = e.message) + (e) => + (errorsKontakPerson[e.path[0] as keyof TempoPropsKontakPerson] = + e.message) ); - set({ errors }); + set({ errorsKontakPerson }); } } }, - isCheckedTNC: false, - toggleCheckTNC: () => set((state) => ({ isCheckedTNC: !state.isCheckedTNC })), - - isOpenTNC: false, - openTNC: () => set(() => ({ isOpenTNC: true })), - closeTNC: () => set(() => ({ isOpenTNC: false })), - - isValidCaptcha: false, - updateValidCaptcha: (value) => set(() => ({ isValidCaptcha: value })), - - resetForm: () => + resetFormKontakPerson: () => set({ - form: { + formKontakPerson: { direkturName: '', direkturMobile: '', direkturEmail: '', - industry_id: '', - street: '', - state: '', - city: '', - zip: '', - bankName: '', - accountName: '', - accountNumber: '', - estimasi: '', - tempoDuration: '', - bersedia: '', - categoryProduk: '', - tempoLimit: '', + purchasingName: '', + purchasingEmail: '', + financeName: '', + financeMobile: '', + financeEmail: '', }, }), })); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index a4bd3d0a..fc920c05 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -22,17 +22,11 @@ export type tempoPropsKontakPerson = { direkturName: string; direkturMobile: string; direkturEmail: string; - industry_id: string; - street: string; - state: string; - city: string; - zip: string; - bankName: string; - accountName: string; - accountNumber: string; - estimasi: string; - tempoDuration: string; - bersedia: string; + purchasingName: string; + purchasingEmail: string; + financeMobile: string; + financeEmail: string; + financeName: string; }; export type TempoApiProps = OdooApiRes; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index dca60869..45cc8cd2 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -28,31 +28,30 @@ export const TempoSchema = z.object({ }); export const TempoSchemaKontakPerson = z.object({ direkturName: z.string().min(1, { message: 'Nama harus diisi' }), + financeName: z.string().min(1, { message: 'Nama harus diisi' }), direkturMobile: z .string() .min(1, { message: 'Nomor telepon harus diisi' }) .refine((val) => /^\d{10,12}$/.test(val), { message: 'Format nomor telepon tidak valid, contoh: 081234567890', }), + financeMobile: z + .string() + .min(1, { message: 'Nomor telepon harus diisi' }) + .refine((val) => /^\d{10,12}$/.test(val), { + message: 'Format nomor telepon tidak valid, contoh: 081234567890', + }), direkturEmail: z .string() .min(1, { message: 'Email harus diisi' }) .email({ message: 'Email harus menggunakan format example@mail.com' }), - street: z.string().min(1, { message: 'Alamat harus diisi' }), - industry_id: z.string().min(1, { message: 'Jenis usaha harus dipilih' }), - zip: z.string().min(1, { message: 'Kode pos harus diisi' }), - state: z.string().min(1, { message: 'Provinsi harus dipilih' }), - city: z.string().min(1, { message: 'Kota harus dipilih' }), - bankName: z.string().min(1, { message: 'Nama bank harus diisi' }), - accountName: z.string().min(1, { message: 'Nama rekening harus diisi' }), - accountNumber: z.string().min(1, { message: 'Nomor rekening harus diisi' }), - estimasi: z + purchasingEmail: z .string() - .min(1, { message: 'Estimasi pemmbelian pertahun harus diisi' }), - tempoDuration: z.string().min(1, { message: 'Durasi tempo harus dipilih' }), - tempoLimit: z.string().min(1, { message: 'Limit tempo harus dipilih' }), - bersedia: z.string().min(1, { message: 'Harus dipilih' }), - categoryProduk: z + .min(1, { message: 'Email harus diisi' }) + .email({ message: 'Email harus menggunakan format example@mail.com' }), + financeEmail: z .string() - .min(1, { message: 'Category produk harus dipilih' }), + .min(1, { message: 'Email harus diisi' }) + .email({ message: 'Email harus menggunakan format example@mail.com' }), + purchasingName: z.string().min(1, { message: 'Nama harus diisi' }), }); -- cgit v1.2.3 From 87ffd2fa7edc240693ddd81401ef23c5cd1bbb3e Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 18 Oct 2024 16:11:17 +0700 Subject: update fix kontak person --- src-migrate/modules/register/stores/usePengajuanTempoStore.ts | 2 ++ src-migrate/types/tempo.ts | 1 + src-migrate/validations/tempo.ts | 6 ++++++ 3 files changed, 9 insertions(+) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 247f62dd..7f1bcbb0 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -116,6 +116,7 @@ export const usePengajuanTempoStoreKontakPerson = create< financeMobile: '', financeName: '', financeEmail: '', + purchasingMobile: '', }, updateFormKontakPerson: (name, value) => set((state) => ({ @@ -151,6 +152,7 @@ export const usePengajuanTempoStoreKontakPerson = create< financeName: '', financeMobile: '', financeEmail: '', + purchasingMobile: '', }, }), })); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index fc920c05..85680cba 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -27,6 +27,7 @@ export type tempoPropsKontakPerson = { financeMobile: string; financeEmail: string; financeName: string; + purchasingMobile: string; }; export type TempoApiProps = OdooApiRes; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 45cc8cd2..756bb722 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -41,6 +41,12 @@ export const TempoSchemaKontakPerson = z.object({ .refine((val) => /^\d{10,12}$/.test(val), { message: 'Format nomor telepon tidak valid, contoh: 081234567890', }), + purchasingMobile: z + .string() + .min(1, { message: 'Nomor telepon harus diisi' }) + .refine((val) => /^\d{10,12}$/.test(val), { + message: 'Format nomor telepon tidak valid, contoh: 081234567890', + }), direkturEmail: z .string() .min(1, { message: 'Email harus diisi' }) -- cgit v1.2.3 From 548e2b48b1c2f6521037765f96083a8d79f611d6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 18 Oct 2024 17:08:55 +0700 Subject: add pengiriman section --- .../register/stores/usePengajuanTempoStore.ts | 71 +++++++++++++++++++++- src-migrate/types/tempo.ts | 13 +++- src-migrate/validations/tempo.ts | 9 +++ 3 files changed, 90 insertions(+), 3 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 7f1bcbb0..0d397c78 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -1,6 +1,14 @@ import { create } from 'zustand'; -import { TempoProps, TempoPropsKontakPerson } from '~/types/tempo'; -import { TempoSchema, TempoSchemaKontakPerson } from '~/validations/tempo'; +import { + TempoProps, + TempoPropsKontakPerson, + TempoPropsPengiriman, +} from '~/types/tempo'; +import { + TempoSchema, + TempoSchemaKontakPerson, + TempoSchemaPengiriman, +} from '~/validations/tempo'; import { boolean, ZodError } from 'zod'; type State = { @@ -156,3 +164,62 @@ export const usePengajuanTempoStoreKontakPerson = create< }, }), })); + +type StatePengiriman = { + formPengiriman: TempoPropsPengiriman; + errorsPengiriman: { + [key in keyof TempoPropsPengiriman]?: string; + }; +}; +type ActionPengiriman = { + updateFormPengiriman: (name: string, value: string) => void; + + validatePengiriman: () => void; + resetFormPengiriman: () => void; +}; +export const usePengajuanTempoStorePengiriman = create< + StatePengiriman & ActionPengiriman +>((set, get) => ({ + formPengiriman: { + PICName: '', + streetPengiriman: '', + statePengiriman: '', + cityPengiriman: '', + zip: '', + invoicePic: '', + }, + updateFormPengiriman: (name, value) => + set((state) => ({ + formPengiriman: { ...state.formPengiriman, [name]: value }, + })), + + errorsPengiriman: {}, + validatePengiriman: () => { + try { + TempoSchemaPengiriman.parse(get().formPengiriman); + set({ errorsPengiriman: {} }); + } catch (error) { + if (error instanceof ZodError) { + const errorsPengiriman: StatePengiriman['errorsPengiriman'] = {}; + error.errors.forEach( + (e) => + (errorsPengiriman[e.path[0] as keyof TempoPropsPengiriman] = + e.message) + ); + set({ errorsPengiriman }); + } + } + }, + + resetFormPengiriman: () => + set({ + formPengiriman: { + PICName: '', + streetPengiriman: '', + statePengiriman: '', + cityPengiriman: '', + zip: '', + invoicePic: '', + }, + }), +})); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index 85680cba..6e3f2502 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -1,4 +1,8 @@ -import { TempoSchema, TempoSchemaKontakPerson } from '~/validations/tempo'; +import { + TempoSchema, + TempoSchemaKontakPerson, + TempoSchemaPengiriman, +} from '~/validations/tempo'; import { OdooApiRes } from './odoo'; import { z } from 'zod'; @@ -29,11 +33,18 @@ export type tempoPropsKontakPerson = { financeName: string; purchasingMobile: string; }; +export type tempoPropsPengiriman = { + PICName: string; + streetPengiriman: string; + statePengiriman: string; + cityPengiriman: string; +}; export type TempoApiProps = OdooApiRes; export type TempoProps = z.infer; export type TempoPropsKontakPerson = z.infer; +export type TempoPropsPengiriman = z.infer; export type TempoResApiProps = { Tempo: boolean; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 756bb722..7adfa780 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -26,6 +26,7 @@ export const TempoSchema = z.object({ .string() .min(1, { message: 'Category produk harus dipilih' }), }); + export const TempoSchemaKontakPerson = z.object({ direkturName: z.string().min(1, { message: 'Nama harus diisi' }), financeName: z.string().min(1, { message: 'Nama harus diisi' }), @@ -61,3 +62,11 @@ export const TempoSchemaKontakPerson = z.object({ .email({ message: 'Email harus menggunakan format example@mail.com' }), purchasingName: z.string().min(1, { message: 'Nama harus diisi' }), }); +export const TempoSchemaPengiriman = z.object({ + PICName: z.string().min(1, { message: 'Nama harus diisi' }), + streetPengiriman: z.string().min(1, { message: 'Alamat harus diisi' }), + statePengiriman: z.string().min(1, { message: 'Provinsi harus dipilih' }), + cityPengiriman: z.string().min(1, { message: 'Kota harus dipilih' }), + zip: z.string().min(1, { message: 'Kode pos harus diisi' }), + invoicePic: z.string().min(1, { message: 'Nama pic invoice harus diisi' }), +}); -- cgit v1.2.3 From c61477111b95d83a9b862f242923b911364f3612 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 19 Oct 2024 11:49:38 +0700 Subject: fix section pengiriman --- .../register/stores/usePengajuanTempoStore.ts | 37 ++++++++++++++++++++++ src-migrate/types/tempo.ts | 21 ++++++++++++ src-migrate/validations/tempo.ts | 25 +++++++++++++++ 3 files changed, 83 insertions(+) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 0d397c78..e531c3d0 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -187,6 +187,24 @@ export const usePengajuanTempoStorePengiriman = create< cityPengiriman: '', zip: '', invoicePic: '', + streetInvoice: '', + stateInvoice: '', + cityInvoice: '', + everyWeekday: false, + everyWeekdayInput: '', + everyWeek: false, + everyWeekInput: '', + tukarInvoice: false, + tukarInvoiceInput: '', + everyWeekdayPembayaran: false, + everyWeekdayInputPembayaran: '', + everyWeekPembayaran: false, + everyWeekInputPembayaran: '', + tukarInvoicePembayaran: false, + tukarInvoiceInputPembayaran: '', + dokumenPengiriman: '', + dokumenPengirimanInput: '', + dokumenPengirimanInvoice: '', }, updateFormPengiriman: (name, value) => set((state) => ({ @@ -220,6 +238,25 @@ export const usePengajuanTempoStorePengiriman = create< cityPengiriman: '', zip: '', invoicePic: '', + streetInvoice: '', + stateInvoice: '', + cityInvoice: '', + everyWeekday: false, + everyWeekdayInput: '', + everyWeek: false, + everyWeekInput: '', + tukarInvoice: false, + tukarInvoiceInput: '', + everyWeekdayPembayaran: false, + everyWeekdayInputPembayaran: '', + everyWeekPembayaran: false, + everyWeekInputPembayaran: '', + tukarInvoicePembayaran: false, + tukarInvoiceInputPembayaran: '', + dokumenPengiriman: '', + dokumenPengirimanInput: '', + dokumenPengirimanInvoice: '', + dokumenPengirimanInvoiceInput: '', }, }), })); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index 6e3f2502..b40ef8d7 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -38,6 +38,27 @@ export type tempoPropsPengiriman = { streetPengiriman: string; statePengiriman: string; cityPengiriman: string; + streetInvoice: string; + zip: string; + invoicePic: string; + stateInvoice: string; + cityInvoice: string; + everyWeekday: boolean; + everyWeekdayInput: string; + everyWeek: boolean; + everyWeekInput: string; + tukarInvoice: boolean; + tukarInvoiceInput: string; + everyWeekdayPembayaran: boolean; + everyWeekdayInputPembayaran: string; + everyWeekPembayaran: boolean; + everyWeekInputPembayaran: string; + tukarInvoicePembayaran: boolean; + tukarInvoiceInputPembayaran: string; + dokumenPengiriman: string; + dokumenPengirimanInput: string; + dokumenPengirimanInvoice: string; + dokumenPengirimanInvoiceInput: string; }; export type TempoApiProps = OdooApiRes; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 7adfa780..9a0df8bb 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -69,4 +69,29 @@ export const TempoSchemaPengiriman = z.object({ cityPengiriman: z.string().min(1, { message: 'Kota harus dipilih' }), zip: z.string().min(1, { message: 'Kode pos harus diisi' }), invoicePic: z.string().min(1, { message: 'Nama pic invoice harus diisi' }), + streetInvoice: z.string().min(1, { message: 'Alamat invoice harus diisi' }), + stateInvoice: z + .string() + .min(1, { message: 'Provinsi invoice harus dipilih' }), + cityInvoice: z.string().min(1, { message: 'Kota invoice harus dipilih' }), + everyWeekday: z.boolean().optional(), + everyWeekdayInput: z.string().optional(), + everyWeek: z.boolean().optional(), + everyWeekInput: z.string().optional(), + tukarInvoice: z.boolean().optional(), + tukarInvoiceInput: z.string().optional(), + everyWeekdayPembayaran: z.boolean().optional(), + everyWeekdayInputPembayaran: z.string().optional(), + everyWeekPembayaran: z.boolean().optional(), + everyWeekInputPembayaran: z.string().optional(), + tukarInvoicePembayaran: z.boolean().optional(), + tukarInvoiceInputPembayaran: z.string().optional(), + dokumenPengiriman: z.string().min(1, { + message: 'dokumen lampiran saat pengiriman barang harus dipilih', + }), + dokumenPengirimanInput: z.string().optional(), + dokumenPengirimanInvoice: z.string().min(1, { + message: 'dokumen lampiran saat pengiriman barang harus dipilih', + }), + dokumenPengirimanInvoiceInput: z.string().optional(), }); -- cgit v1.2.3 From 3a0f3c6ed7ef886d3205d51937b1ecbb035b1a87 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 21 Oct 2024 16:16:34 +0700 Subject: update and fix section dokumen --- .../register/stores/usePengajuanTempoStore.ts | 41 ++++++++++++++++++++++ src-migrate/types/tempo.ts | 9 +++++ src-migrate/validations/tempo.ts | 12 +++++++ 3 files changed, 62 insertions(+) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index e531c3d0..08053e42 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -3,11 +3,13 @@ import { TempoProps, TempoPropsKontakPerson, TempoPropsPengiriman, + TempoPropsSupplier, } from '~/types/tempo'; import { TempoSchema, TempoSchemaKontakPerson, TempoSchemaPengiriman, + TempoSchemaSupplier, } from '~/validations/tempo'; import { boolean, ZodError } from 'zod'; @@ -260,3 +262,42 @@ export const usePengajuanTempoStorePengiriman = create< }, }), })); + +type StateSupplier = { + formSupplier: TempoPropsSupplier[]; + errorsSupplier: { + [key in keyof TempoPropsSupplier]?: string; + }; +}; +type ActionSupplier = { + updateFormSupplier: (data: TempoPropsSupplier[]) => void; + + validateSupplier: () => void; +}; +export const usePengajuanTempoStoreSupplier = create< + StateSupplier & ActionSupplier +>((set, get) => ({ + formSupplier: [], + updateFormSupplier: (data) => { + set(() => ({ + formSupplier: data, // Menyimpan data baru ke dalam formSupplier + })); + }, + + errorsSupplier: {}, + validateSupplier: () => { + // try { + // TempoSchemaSupplier.parse(get().formSupplier); + // set({ errorsSupplier: {} }); + // } catch (error) { + // if (error instanceof ZodError) { + // const errorsSupplier: StateSupplier['errorsSupplier'] = {}; + // error.errors.forEach( + // (e) => + // (errorsSupplier[e.path[0] as keyof TempoPropsSupplier] = e.message) + // ); + // set({ errorsSupplier }); + // } + // } + }, +})); diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index b40ef8d7..17c4c906 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -2,6 +2,7 @@ import { TempoSchema, TempoSchemaKontakPerson, TempoSchemaPengiriman, + TempoSchemaSupplier, } from '~/validations/tempo'; import { OdooApiRes } from './odoo'; import { z } from 'zod'; @@ -60,12 +61,20 @@ export type tempoPropsPengiriman = { dokumenPengirimanInvoice: string; dokumenPengirimanInvoiceInput: string; }; +export type tempoPropsSupplier = { + supplier: string; + pic: string; + telepon: string; + durasiTempo: string; + creditLimit: string; +}; export type TempoApiProps = OdooApiRes; export type TempoProps = z.infer; export type TempoPropsKontakPerson = z.infer; export type TempoPropsPengiriman = z.infer; +export type TempoPropsSupplier = z.infer; export type TempoResApiProps = { Tempo: boolean; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 9a0df8bb..86bcf6d1 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -95,3 +95,15 @@ export const TempoSchemaPengiriman = z.object({ }), dokumenPengirimanInvoiceInput: z.string().optional(), }); +export const TempoSchemaSupplier = z.object({ + supplier: z.string().min(1, { message: 'Nama supplier harus diisi' }), + pic: z.string().min(1, { message: 'Nama PIC harus diisi' }), + telepon: z + .string() + .min(1, { message: 'Nomor telepon harus diisi' }) + .refine((val) => /^\d{10,12}$/.test(val), { + message: 'Format nomor telepon tidak valid, contoh: 081234567890', + }), + durasiTempo: z.string().min(1, { message: 'Durasi tempo harus diisi' }), + creditLimit: z.string().min(1, { message: 'Limit Kredit harus diisi' }), +}); -- cgit v1.2.3 From d6ede238658d90315a5dc5b864f20037e8a776f6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 22 Oct 2024 11:24:43 +0700 Subject: update & add section dokumen --- .../register/stores/usePengajuanTempoStore.ts | 89 ++++++++++++++++++++++ src-migrate/types/tempo.ts | 13 ++++ src-migrate/validations/tempo.ts | 47 ++++++++++++ 3 files changed, 149 insertions(+) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 08053e42..9c97b8a0 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -4,12 +4,14 @@ import { TempoPropsKontakPerson, TempoPropsPengiriman, TempoPropsSupplier, + TempoPropsDokumen, } from '~/types/tempo'; import { TempoSchema, TempoSchemaKontakPerson, TempoSchemaPengiriman, TempoSchemaSupplier, + TempoSchemaDokumen, } from '~/validations/tempo'; import { boolean, ZodError } from 'zod'; @@ -262,6 +264,93 @@ export const usePengajuanTempoStorePengiriman = create< }, }), })); +type StateDokumen = { + formDokumen: TempoPropsDokumen; + errorsDokumen: { + [key in keyof TempoPropsDokumen]?: string; + }; +}; +type ActionDokumen = { + updateFormDokumen: ( + name: string, + fileName: string, + fileFormat: string, + value: string + ) => void; + + validateDokumen: () => void; + resetFormDokumen: () => void; + getJumlahDokumenDiisi: () => void; +}; +export const usePengajuanTempoStoreDokumen = create< + StateDokumen & ActionDokumen +>((set, get) => ({ + formDokumen: { + dokumenNib: { name: '', format: '', base64: '' }, + dokumenNpwp: { name: '', format: '', base64: '' }, + dokumenSppkp: { name: '', format: '', base64: '' }, + dokumenAktaPerubahan: { name: '', format: '', base64: '' }, + dokumenKtpDirut: { name: '', format: '', base64: '' }, + dokumenAktaPendirian: { name: '', format: '', base64: '' }, + dokumenLaporanKeuangan: { name: '', format: '', base64: '' }, + dokumenFotoKantor: { name: '', format: '', base64: '' }, + dokumenTempatBekerja: { name: '', format: '', base64: '' }, + }, + + // Memperbarui dokumen dengan name, format, dan base64 + updateFormDokumen: (name, fileName, fileFormat, value) => + set((state) => ({ + formDokumen: { + ...state.formDokumen, + [name]: { + name: fileName, + format: fileFormat, + base64: value, + }, + }, + })), + + errorsDokumen: {}, + validateDokumen: () => { + try { + TempoSchemaDokumen.parse(get().formDokumen); + set({ errorsDokumen: {} }); + } catch (error) { + if (error instanceof ZodError) { + const errorsDokumen: StateDokumen['errorsDokumen'] = {}; + error.errors.forEach( + (e) => + (errorsDokumen[e.path[0] as keyof TempoPropsDokumen] = e.message) + ); + set({ errorsDokumen }); + } + } + }, + + getJumlahDokumenDiisi: () => { + const formDokumen = get().formDokumen; + // Menghitung jumlah field yang base64 tidak kosong + const jumlahTerisi = Object.values(formDokumen).filter( + (dokumen) => dokumen.base64 !== '' + ).length; + return jumlahTerisi; + }, + + resetFormDokumen: () => + set({ + formDokumen: { + dokumenNib: { name: '', format: '', base64: '' }, + dokumenNpwp: { name: '', format: '', base64: '' }, + dokumenSppkp: { name: '', format: '', base64: '' }, + dokumenAktaPerubahan: { name: '', format: '', base64: '' }, + dokumenKtpDirut: { name: '', format: '', base64: '' }, + dokumenAktaPendirian: { name: '', format: '', base64: '' }, + dokumenLaporanKeuangan: { name: '', format: '', base64: '' }, + dokumenFotoKantor: { name: '', format: '', base64: '' }, + dokumenTempatBekerja: { name: '', format: '', base64: '' }, + }, + }), +})); type StateSupplier = { formSupplier: TempoPropsSupplier[]; diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index 17c4c906..d928d9c3 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -3,6 +3,7 @@ import { TempoSchemaKontakPerson, TempoSchemaPengiriman, TempoSchemaSupplier, + TempoSchemaDokumen, } from '~/validations/tempo'; import { OdooApiRes } from './odoo'; import { z } from 'zod'; @@ -68,6 +69,17 @@ export type tempoPropsSupplier = { durasiTempo: string; creditLimit: string; }; +export type tempoPropsDokumen = { + dokumenNib: { name: string; format: string; base64: string }; + dokumenNpwp: { name: string; format: string; base64: string }; + dokumenSppkp: { name: string; format: string; base64: string }; + dokumenAktaPerubahan: { name: string; format: string; base64: string }; + dokumenKtpDirut: { name: string; format: string; base64: string }; + dokumenAktaPendirian: { name: string; format: string; base64: string }; + dokumenLaporanKeuangan: { name: string; format: string; base64: string }; + dokumenFotoKantor: { name: string; format: string; base64: string }; + dokumenTempatBekerja: { name: string; format: string; base64: string }; +}; export type TempoApiProps = OdooApiRes; @@ -75,6 +87,7 @@ export type TempoProps = z.infer; export type TempoPropsKontakPerson = z.infer; export type TempoPropsPengiriman = z.infer; export type TempoPropsSupplier = z.infer; +export type TempoPropsDokumen = z.infer; export type TempoResApiProps = { Tempo: boolean; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 86bcf6d1..ccef8d83 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -107,3 +107,50 @@ export const TempoSchemaSupplier = z.object({ durasiTempo: z.string().min(1, { message: 'Durasi tempo harus diisi' }), creditLimit: z.string().min(1, { message: 'Limit Kredit harus diisi' }), }); +export const TempoSchemaDokumen = z.object({ + dokumenNib: z.object({ + name: z.string().min(1, { message: 'Nama file harus diisi' }), + format: z.string().min(1, { message: 'Format file harus diisi' }), + base64: z.string().min(1, { message: 'Dokumen harus diisi' }), + }), + dokumenNpwp: z.object({ + name: z.string().min(1, { message: 'Nama file harus diisi' }), + format: z.string().min(1, { message: 'Format file harus diisi' }), + base64: z.string().min(1, { message: 'Dokumen harus diisi' }), + }), + dokumenSppkp: z.object({ + name: z.string().optional(), + format: z.string().optional(), + base64: z.string().optional(), + }), + dokumenAktaPerubahan: z.object({ + name: z.string().optional(), + format: z.string().optional(), + base64: z.string().optional(), + }), + dokumenKtpDirut: z.object({ + name: z.string().optional(), + format: z.string().optional(), + base64: z.string().optional(), + }), + dokumenAktaPendirian: z.object({ + name: z.string().optional(), + format: z.string().optional(), + base64: z.string().optional(), + }), + dokumenLaporanKeuangan: z.object({ + name: z.string().optional(), + format: z.string().optional(), + base64: z.string().optional(), + }), + dokumenFotoKantor: z.object({ + name: z.string().min(1, { message: 'Nama file harus diisi' }), + format: z.string().min(1, { message: 'Format file harus diisi' }), + base64: z.string().min(1, { message: 'Dokumen harus diisi' }), + }), + dokumenTempatBekerja: z.object({ + name: z.string().min(1, { message: 'Nama file harus diisi' }), + format: z.string().min(1, { message: 'Format file harus diisi' }), + base64: z.string().min(1, { message: 'Dokumen harus diisi' }), + }), +}); -- cgit v1.2.3 From c19c7eee924b70d25cb47d40fd7c8e00d5efa867 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 23 Oct 2024 17:07:37 +0700 Subject: update pengajuan tempo section konfirmasi --- src-migrate/modules/register/stores/usePengajuanTempoStore.ts | 2 ++ src-migrate/types/tempo.ts | 1 + src-migrate/validations/tempo.ts | 7 ++++--- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 9c97b8a0..e09639db 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -191,6 +191,7 @@ export const usePengajuanTempoStorePengiriman = create< cityPengiriman: '', zip: '', invoicePic: '', + isSameAddrees: '', streetInvoice: '', stateInvoice: '', cityInvoice: '', @@ -245,6 +246,7 @@ export const usePengajuanTempoStorePengiriman = create< streetInvoice: '', stateInvoice: '', cityInvoice: '', + isSameAddrees: '', everyWeekday: false, everyWeekdayInput: '', everyWeek: false, diff --git a/src-migrate/types/tempo.ts b/src-migrate/types/tempo.ts index d928d9c3..815a7557 100644 --- a/src-migrate/types/tempo.ts +++ b/src-migrate/types/tempo.ts @@ -43,6 +43,7 @@ export type tempoPropsPengiriman = { streetInvoice: string; zip: string; invoicePic: string; + isSameAddrees: string; stateInvoice: string; cityInvoice: string; everyWeekday: boolean; diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index ccef8d83..66535fc4 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -73,6 +73,7 @@ export const TempoSchemaPengiriman = z.object({ stateInvoice: z .string() .min(1, { message: 'Provinsi invoice harus dipilih' }), + isSameAddrees: z.string(), cityInvoice: z.string().min(1, { message: 'Kota invoice harus dipilih' }), everyWeekday: z.boolean().optional(), everyWeekdayInput: z.string().optional(), @@ -119,9 +120,9 @@ export const TempoSchemaDokumen = z.object({ base64: z.string().min(1, { message: 'Dokumen harus diisi' }), }), dokumenSppkp: z.object({ - name: z.string().optional(), - format: z.string().optional(), - base64: z.string().optional(), + name: z.string().min(1, { message: 'Nama file harus diisi' }), + format: z.string().min(1, { message: 'Format file harus diisi' }), + base64: z.string().min(1, { message: 'Dokumen harus diisi' }), }), dokumenAktaPerubahan: z.object({ name: z.string().optional(), -- cgit v1.2.3 From daaf32f9dd3af860013b70d04c89f4cca84724b1 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Tue, 29 Oct 2024 16:22:33 +0700 Subject: updarte pengajuan tempo --- src-migrate/modules/register/stores/usePengajuanTempoStore.ts | 4 ++-- src-migrate/validations/tempo.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index e09639db..be5a3e45 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -189,7 +189,7 @@ export const usePengajuanTempoStorePengiriman = create< streetPengiriman: '', statePengiriman: '', cityPengiriman: '', - zip: '', + zipPengiriman: '', invoicePic: '', isSameAddrees: '', streetInvoice: '', @@ -241,7 +241,7 @@ export const usePengajuanTempoStorePengiriman = create< streetPengiriman: '', statePengiriman: '', cityPengiriman: '', - zip: '', + zipPengiriman: '', invoicePic: '', streetInvoice: '', stateInvoice: '', diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 66535fc4..7f02019c 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -67,7 +67,7 @@ export const TempoSchemaPengiriman = z.object({ streetPengiriman: z.string().min(1, { message: 'Alamat harus diisi' }), statePengiriman: z.string().min(1, { message: 'Provinsi harus dipilih' }), cityPengiriman: z.string().min(1, { message: 'Kota harus dipilih' }), - zip: z.string().min(1, { message: 'Kode pos harus diisi' }), + zipPengiriman: z.string().min(1, { message: 'Kode pos harus diisi' }), invoicePic: z.string().min(1, { message: 'Nama pic invoice harus diisi' }), streetInvoice: z.string().min(1, { message: 'Alamat invoice harus diisi' }), stateInvoice: z -- cgit v1.2.3 From b5701645ce23deed5e32afc4a0f98bd523c6c92c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 31 Oct 2024 13:58:23 +0700 Subject: update pengajuan tempo --- .../register/stores/usePengajuanTempoStore.ts | 28 ++++++++-------------- 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index be5a3e45..47168a2a 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -355,6 +355,7 @@ export const usePengajuanTempoStoreDokumen = create< })); type StateSupplier = { + hasSavedata: boolean; formSupplier: TempoPropsSupplier[]; errorsSupplier: { [key in keyof TempoPropsSupplier]?: string; @@ -362,33 +363,24 @@ type StateSupplier = { }; type ActionSupplier = { updateFormSupplier: (data: TempoPropsSupplier[]) => void; - + updateHasSave: (data: boolean) => void; validateSupplier: () => void; }; export const usePengajuanTempoStoreSupplier = create< StateSupplier & ActionSupplier >((set, get) => ({ formSupplier: [], + hasSavedata: false, updateFormSupplier: (data) => { set(() => ({ - formSupplier: data, // Menyimpan data baru ke dalam formSupplier + formSupplier: data, })); }, - - errorsSupplier: {}, - validateSupplier: () => { - // try { - // TempoSchemaSupplier.parse(get().formSupplier); - // set({ errorsSupplier: {} }); - // } catch (error) { - // if (error instanceof ZodError) { - // const errorsSupplier: StateSupplier['errorsSupplier'] = {}; - // error.errors.forEach( - // (e) => - // (errorsSupplier[e.path[0] as keyof TempoPropsSupplier] = e.message) - // ); - // set({ errorsSupplier }); - // } - // } + updateHasSave: (data) => { + set(() => ({ + hasSavedata: data, + })); }, + errorsSupplier: {}, + validateSupplier: () => {}, })); -- cgit v1.2.3 From 6bbf1dbd94355f34f58f4b72f134f3dbeac776aa Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Sat, 23 Nov 2024 11:55:59 +0700 Subject: update tempo --- src-migrate/modules/register/stores/usePengajuanTempoStore.ts | 6 ++++-- src-migrate/validations/tempo.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 47168a2a..39508158 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -38,7 +38,7 @@ type Action = { export const usePengajuanTempoStore = create((set, get) => ({ form: { name: '', - industry_id: '', + industryId: '', street: '', state: '', city: '', @@ -86,7 +86,7 @@ export const usePengajuanTempoStore = create((set, get) => ({ set({ form: { name: '', - industry_id: '', + industryId: '', street: '', state: '', city: '', @@ -192,6 +192,7 @@ export const usePengajuanTempoStorePengiriman = create< zipPengiriman: '', invoicePic: '', isSameAddrees: '', + isSameAddreesStreet: '', streetInvoice: '', stateInvoice: '', cityInvoice: '', @@ -247,6 +248,7 @@ export const usePengajuanTempoStorePengiriman = create< stateInvoice: '', cityInvoice: '', isSameAddrees: '', + isSameAddreesStreet: '', everyWeekday: false, everyWeekdayInput: '', everyWeek: false, diff --git a/src-migrate/validations/tempo.ts b/src-migrate/validations/tempo.ts index 7f02019c..cb2b279d 100644 --- a/src-migrate/validations/tempo.ts +++ b/src-migrate/validations/tempo.ts @@ -3,7 +3,7 @@ import { z } from 'zod'; export const TempoSchema = z.object({ name: z.string().min(1, { message: 'Nama harus diisi' }), street: z.string().min(1, { message: 'Alamat harus diisi' }), - industry_id: z.string().min(1, { message: 'Jenis usaha harus dipilih' }), + industryId: z.string().min(1, { message: 'Jenis usaha harus dipilih' }), zip: z.string().min(1, { message: 'Kode pos harus diisi' }), state: z.string().min(1, { message: 'Provinsi harus dipilih' }), city: z.string().min(1, { message: 'Kota harus dipilih' }), @@ -74,6 +74,7 @@ export const TempoSchemaPengiriman = z.object({ .string() .min(1, { message: 'Provinsi invoice harus dipilih' }), isSameAddrees: z.string(), + isSameAddreesStreet: z.string(), cityInvoice: z.string().min(1, { message: 'Kota invoice harus dipilih' }), everyWeekday: z.boolean().optional(), everyWeekdayInput: z.string().optional(), -- cgit v1.2.3 From 494909f40b918e4273d6258a74f12ac42253a4a7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 25 Nov 2024 17:04:51 +0700 Subject: pengajuan tempo --- src-migrate/modules/register/stores/usePengajuanTempoStore.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 39508158..8e2436a2 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -358,13 +358,13 @@ export const usePengajuanTempoStoreDokumen = create< type StateSupplier = { hasSavedata: boolean; - formSupplier: TempoPropsSupplier[]; + formSupplier: []; errorsSupplier: { [key in keyof TempoPropsSupplier]?: string; }; }; type ActionSupplier = { - updateFormSupplier: (data: TempoPropsSupplier[]) => void; + updateFormSupplier: (data: []) => void; updateHasSave: (data: boolean) => void; validateSupplier: () => void; }; -- cgit v1.2.3 From 77f9843ad5072583cb1797d7ecf5ac80394bad3f Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 2 Dec 2024 09:31:44 +0700 Subject: pengajuan tempo --- src-migrate/types/auth.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src-migrate') diff --git a/src-migrate/types/auth.ts b/src-migrate/types/auth.ts index 8feac2e1..1b400e95 100644 --- a/src-migrate/types/auth.ts +++ b/src-migrate/types/auth.ts @@ -20,7 +20,8 @@ export type AuthProps = { onlyReadyStock: boolean; soApproval: boolean; }; - partner_tempo: boolean; + partner_tempo: string; + tempo_progres: string; }; export type AuthApiProps = OdooApiRes; -- cgit v1.2.3 From 9a49b8d84761781531cb417731cb9ef802f63541 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 4 Dec 2024 10:59:21 +0700 Subject: update pengajuan tempo --- src-migrate/modules/register/index.tsx | 5 +++-- src-migrate/validations/tempo.ts | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'src-migrate') diff --git a/src-migrate/modules/register/index.tsx b/src-migrate/modules/register/index.tsx index da41fd8b..2cc8a28b 100644 --- a/src-migrate/modules/register/index.tsx +++ b/src-migrate/modules/register/index.tsx @@ -161,7 +161,7 @@ const Register = () => { )}
- + {/* */}