Commit 3fa64b2e authored by Rais Aryaguna's avatar Rais Aryaguna

fix error eslint and type

parent d96c2477
...@@ -121,6 +121,7 @@ ...@@ -121,6 +121,7 @@
"swr": "^2.3.4", "swr": "^2.3.4",
"turndown": "^7.2.0", "turndown": "^7.2.0",
"yet-another-react-lightbox": "^3.25.0", "yet-another-react-lightbox": "^3.25.0",
"yup": "^1.7.1",
"zod": "^4.0.15", "zod": "^4.0.15",
"zustand": "^5.0.8" "zustand": "^5.0.8"
}, },
......
...@@ -14,9 +14,9 @@ interface KodeNegara { ...@@ -14,9 +14,9 @@ interface KodeNegara {
nama: string; nama: string;
} }
interface KodeNegaraResponse { // interface KodeNegaraResponse {
data: KodeNegara[]; // data: KodeNegara[];
} // }
interface UseKodeNegaraReturn { interface UseKodeNegaraReturn {
kodeNegara: KodeNegara[]; kodeNegara: KodeNegara[];
......
import { useBoolean } from 'minimal-shared/hooks'; import { useBoolean } from 'minimal-shared/hooks';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import * as yup from 'yup'; import { object, string } from 'yup';
import * as z from 'zod'; import z from 'zod';
// import { zodResolver } from '@hookform/resolvers/zod'; // import { zodResolver } from '@hookform/resolvers/zod';
import { yupResolver } from '@hookform/resolvers/yup'; import { yupResolver } from '@hookform/resolvers/yup';
...@@ -44,9 +44,9 @@ export const SignInSchema = z.object({ ...@@ -44,9 +44,9 @@ export const SignInSchema = z.object({
/** /**
* Form Validation Schema * Form Validation Schema
*/ */
const schema = yup.object().shape({ const schema = object().shape({
email: yup.string().email('You must enter a valid email').required('You must enter a email'), email: string().email('You must enter a valid email').required('You must enter a email'),
password: yup.string().required('Please enter your password.'), password: string().required('Please enter your password.'),
}); });
export function JwtSignInView() { export function JwtSignInView() {
......
import axios from 'axios';
import { useMutation } from '@tanstack/react-query'; import { useMutation } from '@tanstack/react-query';
// import { submitLogin } from 'app/auth/store/loginSlice'; // import { submitLogin } from 'app/auth/store/loginSlice';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { useNavigate } from 'react-router'; import { useNavigate } from 'react-router';
// import { useLocation, useHistory } from 'react-router-dom'; // import { useLocation, useHistory } from 'react-router-dom';
import { submitLogin } from 'src/auth/store/loginSlice'; import { submitLogin } from 'src/auth/store/loginSlice';
import { endpoints } from 'src/lib/axios'; // import { endpoints } from 'src/lib/axios';
import type { AppDispatch } from 'src/store.tsx'; import type { AppDispatch } from 'src/store.tsx';
const getUserInfo = async (token: any) => { // const getUserInfo = async (token: any) => {
axios.defaults.headers.common.Authorization = `Bearer ${window.atob(token)}`; // axios.defaults.headers.common.Authorization = `Bearer ${window.atob(token)}`;
const res = await axios.post(endpoints.auth.me); // const res = await axios.post(endpoints.auth.me);
const { data } = await res.data; // const { data } = await res.data;
return data.user; // return data.user;
}; // };
interface SignInParams { interface SignInParams {
email: string; email: string;
...@@ -27,7 +26,7 @@ const useLogin = () => { ...@@ -27,7 +26,7 @@ const useLogin = () => {
const mutation = useMutation({ const mutation = useMutation({
mutationKey: ['login'], mutationKey: ['login'],
mutationFn: async (params: SignInParams) => { mutationFn: async (params: SignInParams) => {
const { payload: loginActionPayload } = await dispatch(submitLogin(params)); const { payload: loginActionPayload } = await dispatch(submitLogin(params));
return loginActionPayload; return loginActionPayload;
......
...@@ -3,28 +3,28 @@ import { forwardRef, useEffect, useState } from 'react'; ...@@ -3,28 +3,28 @@ import { forwardRef, useEffect, useState } from 'react';
// import { NumberFormat } from 'react-number-format'; // import { NumberFormat } from 'react-number-format';
import { NumericFormat } from 'react-number-format'; import { NumericFormat } from 'react-number-format';
const formatNegativeValue = (value, negativeMask) => { // const formatNegativeValue = (value, negativeMask) => {
if (!value || value === '0') return value; // if (!value || value === '0') return value;
const numValue = parseFloat(value); // const numValue = parseFloat(value);
if (numValue >= 0) return value; // if (numValue >= 0) return value;
const formattedAbsValue = new Intl.NumberFormat('id-ID', { // const formattedAbsValue = new Intl.NumberFormat('id-ID', {
minimumFractionDigits: 0, // minimumFractionDigits: 0,
maximumFractionDigits: 2, // maximumFractionDigits: 2,
}).format(Math.abs(numValue)); // }).format(Math.abs(numValue));
switch (negativeMask) { // switch (negativeMask) {
case 'prefix': // case 'prefix':
return `-${formattedAbsValue}`; // return `-${formattedAbsValue}`;
case 'suffix': // case 'suffix':
return `${formattedAbsValue}-`; // return `${formattedAbsValue}-`;
case 'both': // case 'both':
return `(${formattedAbsValue})`; // return `(${formattedAbsValue})`;
default: // default:
return `-${formattedAbsValue}`; // return `-${formattedAbsValue}`;
} // }
}; // };
export const getIntegerDigitCount = (value) => { export const getIntegerDigitCount = (value) => {
if (!value) return 0; if (!value) return 0;
......
import * as z from 'zod'; import z from 'zod';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod'; import { zodResolver } from '@hookform/resolvers/zod';
import { isValidPhoneNumber } from 'react-phone-number-input/input'; import { isValidPhoneNumber } from 'react-phone-number-input/input';
...@@ -8,7 +8,6 @@ import Card from '@mui/material/Card'; ...@@ -8,7 +8,6 @@ import Card from '@mui/material/Card';
import Grid from '@mui/material/Grid'; import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import { toast } from 'src/components/snackbar'; import { toast } from 'src/components/snackbar';
import { Form, Field, schemaUtils } from 'src/components/hook-form'; import { Form, Field, schemaUtils } from 'src/components/hook-form';
...@@ -30,9 +29,8 @@ export const UpdateUserSchema = z.object({ ...@@ -30,9 +29,8 @@ export const UpdateUserSchema = z.object({
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
export function AccountGeneral() { export function AccountGeneral() {
const user = useSelector((state: RootState) => state.user); const user = useSelector((state: RootState) => state.user);
console.log(user) console.log(user);
const currentUser: User = { const currentUser: User = {
customer_name: user?.data.customer_name, customer_name: user?.data.customer_name,
...@@ -57,7 +55,7 @@ export function AccountGeneral() { ...@@ -57,7 +55,7 @@ export function AccountGeneral() {
const { const {
handleSubmit, handleSubmit,
formState: { isSubmitting }, // formState: { isSubmitting },
} = methods; } = methods;
const onSubmit = handleSubmit(async (data) => { const onSubmit = handleSubmit(async (data) => {
...@@ -70,47 +68,53 @@ export function AccountGeneral() { ...@@ -70,47 +68,53 @@ export function AccountGeneral() {
} }
}); });
const styleCustom = { "& .MuiInputBase-input.Mui-disabled": { const styleCustom = {
WebkitTextFillColor: "#000 !important", '& .MuiInputBase-input.Mui-disabled': {
color: "#000 !important", WebkitTextFillColor: '#000 !important',
}, color: '#000 !important',
"& .MuiInputLabel-root.Mui-disabled": { },
color: "#000 !important", '& .MuiInputLabel-root.Mui-disabled': {
}, color: '#000 !important',
"& .MuiOutlinedInput-root.Mui-disabled fieldset": { },
borderColor: "#403535ff", '& .MuiOutlinedInput-root.Mui-disabled fieldset': {
} borderColor: '#403535ff',
},
} };
return ( return (
<Form methods={methods} onSubmit={onSubmit}> <Form methods={methods} onSubmit={onSubmit}>
<Box sx={{ <Box
mb:3, sx={{
}}> mb: 3,
<Typography variant='h4'>User Profile</Typography> }}
>
<Typography variant="h4">User Profile</Typography>
</Box> </Box>
<Grid container spacing={3} sx={{flexDirection:"column"}}> <Grid container spacing={3} sx={{ flexDirection: 'column' }}>
<Grid > <Grid>
<Card <Card
sx={{ sx={{
p:2, p: 2,
background: "linear-gradient(to right, #143b88, #1976D2)", background: 'linear-gradient(to right, #143b88, #1976D2)',
borderRadius:"16px", borderRadius: '16px',
mb:2 mb: 2,
}} }}
> >
<Typography sx={{ <Typography
fontSize:"24px", sx={{
color:"#fff", fontSize: '24px',
pb:"4px", color: '#fff',
}}> pb: '4px',
}}
>
{user.data.customer_name} {user.data.customer_name}
</Typography> </Typography>
<Typography sx={{ <Typography
fontSize:"16", sx={{
color:"#BBDEFB" fontSize: '16',
}}> color: '#BBDEFB',
}}
>
{user.data.email} {user.data.email}
</Typography> </Typography>
</Card> </Card>
...@@ -128,9 +132,14 @@ export function AccountGeneral() { ...@@ -128,9 +132,14 @@ export function AccountGeneral() {
> >
<Field.Text sx={styleCustom} name="customer_name" label="Name" disabled /> <Field.Text sx={styleCustom} name="customer_name" label="Name" disabled />
<Field.Text sx={styleCustom} name="email" label="Email address" disabled /> <Field.Text sx={styleCustom} name="email" label="Email address" disabled />
<Field.Text sx={styleCustom} name="phone" type='number' label="Phone Number" disabled/> <Field.Text
<Field.Text sx={styleCustom} name="address" label="Address"disabled /> sx={styleCustom}
name="phone"
type="number"
label="Phone Number"
disabled
/>
<Field.Text sx={styleCustom} name="address" label="Address" disabled />
</Box> </Box>
</Card> </Card>
</Grid> </Grid>
......
...@@ -42,12 +42,12 @@ export default function DialogPenandatangan({ ...@@ -42,12 +42,12 @@ export default function DialogPenandatangan({
// { label: 'Wakil/Kuasa', value: 1 }, // { label: 'Wakil/Kuasa', value: 1 },
// ]; // ];
const handleSubmitLocal = (data: any) => { // const handleSubmitLocal = (data: any) => {
// if (isCountDown) // if (isCountDown)
// setCountdown(30); // start countdown saat submit // setCountdown(30); // start countdown saat submit
// else setCountdown(null); // else setCountdown(null);
// onSubmit(data); // tetap panggil props onSubmit // onSubmit(data); // tetap panggil props onSubmit
}; // };
return ( return (
<Dialog <Dialog
......
...@@ -13,7 +13,7 @@ type IdentitasProps = { ...@@ -13,7 +13,7 @@ type IdentitasProps = {
}; };
const Identitas = ({ isPengganti }: IdentitasProps) => { const Identitas = ({ isPengganti }: IdentitasProps) => {
const { dnId } = useParams(); // const { dnId } = useParams();
const { setValue, watch } = useFormContext(); const { setValue, watch } = useFormContext();
const tanggalPemotongan = watch('tglPemotongan'); const tanggalPemotongan = watch('tglPemotongan');
const fgKaryawanAsing = watch('fgKaryawanAsing'); const fgKaryawanAsing = watch('fgKaryawanAsing');
......
/* eslint-disable @typescript-eslint/no-shadow */
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useFormContext, useWatch } from 'react-hook-form'; import { useFormContext, useWatch } from 'react-hook-form';
import type { TGetListDataKOPDn } from '../types/types'; import type { TGetListDataKOPDn } from '../types/types';
...@@ -66,6 +67,7 @@ const usePphDipotong = (kodeObjekPajakSelected?: TGetListDataKOPDn) => { ...@@ -66,6 +67,7 @@ const usePphDipotong = (kodeObjekPajakSelected?: TGetListDataKOPDn) => {
Number(handlerSetPphDipotong[4]) Number(handlerSetPphDipotong[4])
); );
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [handlerSetPphDipotong]); }, [handlerSetPphDipotong]);
return { return {
......
...@@ -24,7 +24,7 @@ bulananApi.getList = async (config: any) => { ...@@ -24,7 +24,7 @@ bulananApi.getList = async (config: any) => {
throw new Error(response?.message || 'Failed to fetch bulanan data'); throw new Error(response?.message || 'Failed to fetch bulanan data');
} }
const { message, metaPage, data } = response; const { metaPage, data } = response;
return { total: metaPage ? Number(metaPage.totalRow) : 0, data }; return { total: metaPage ? Number(metaPage.totalRow) : 0, data };
}; };
......
...@@ -49,7 +49,7 @@ const bulananSchema = z ...@@ -49,7 +49,7 @@ const bulananSchema = z
label: z.string(), label: z.string(),
value: z.string(), value: z.string(),
}) })
.refine((data) => data.value !== '', { .refine((data: any) => data.value !== '', {
message: 'Kode Objek Pajak wajib diisi', message: 'Kode Objek Pajak wajib diisi',
}), }),
jenisHitung: z.string().optional(), jenisHitung: z.string().optional(),
...@@ -58,7 +58,7 @@ const bulananSchema = z ...@@ -58,7 +58,7 @@ const bulananSchema = z
label: z.string(), label: z.string(),
value: z.string(), value: z.string(),
}) })
.refine((data) => data.value !== '', { .refine((data: any) => data.value !== '', {
message: 'Fasilitas wajib dipilih', message: 'Fasilitas wajib dipilih',
}), }),
fgSkb: z.boolean().optional(), fgSkb: z.boolean().optional(),
...@@ -73,7 +73,7 @@ const bulananSchema = z ...@@ -73,7 +73,7 @@ const bulananSchema = z
label: z.string(), label: z.string(),
value: z.string(), value: z.string(),
}) })
.refine((data) => data.value !== '', { .refine((data: any) => data.value !== '', {
message: 'PTKP wajib dipilih', message: 'PTKP wajib dipilih',
}), }),
email: z.string().optional(), email: z.string().optional(),
...@@ -84,7 +84,7 @@ const bulananSchema = z ...@@ -84,7 +84,7 @@ const bulananSchema = z
label: z.string(), label: z.string(),
value: z.string(), value: z.string(),
}) })
.refine((data) => data.value !== '', { .refine((data: any) => data.value !== '', {
message: 'NITKU Pemotong wajib diisi', message: 'NITKU Pemotong wajib diisi',
}), }),
tglPemotongan: z.string().min(1, 'Tanggal Pemotongan wajib diisi'), tglPemotongan: z.string().min(1, 'Tanggal Pemotongan wajib diisi'),
...@@ -142,11 +142,11 @@ const bulananSchema = z ...@@ -142,11 +142,11 @@ const bulananSchema = z
path: ['skb'], path: ['skb'],
} }
) )
.refine((data) => parseInt(data.phBruto || '0', 10) >= 0, { .refine((data: any) => parseInt(data.phBruto || '0', 10) >= 0, {
message: 'Jumlah Penghasilan Bruto tidak boleh minus', message: 'Jumlah Penghasilan Bruto tidak boleh minus',
path: ['phBruto'], path: ['phBruto'],
}) })
.refine((data) => parseInt(data.tarif || '0', 10) <= 100, { .refine((data: any) => parseInt(data.tarif || '0', 10) <= 100, {
message: 'Tarif tidak boleh lebih dari 100', message: 'Tarif tidak boleh lebih dari 100',
path: ['tarif'], path: ['tarif'],
}) })
...@@ -168,7 +168,7 @@ const bulananSchema = z ...@@ -168,7 +168,7 @@ const bulananSchema = z
); );
export const BulananRekamView = () => { export const BulananRekamView = () => {
const { id } = useParams(); // const { id } = useParams();
const pathname = usePathname(); const pathname = usePathname();
const { mutate: saveBulanan, isPending: isSaving } = useSaveBulanan(); const { mutate: saveBulanan, isPending: isSaving } = useSaveBulanan();
......
import Grid from '@mui/material/Grid'; import Grid from '@mui/material/Grid';
import { useState } from 'react';
import { useFormContext } from 'react-hook-form';
// import { useParams } from 'react-router'; // import { useParams } from 'react-router';
import { Field } from 'src/components/hook-form'; import { Field } from 'src/components/hook-form';
...@@ -10,42 +8,39 @@ type IdentitasProps = { ...@@ -10,42 +8,39 @@ type IdentitasProps = {
// disabledHapus: boolean; // disabledHapus: boolean;
}; };
const Identitas = ({ isPengganti }: IdentitasProps) => { const Identitas = ({ isPengganti }: IdentitasProps) => (
// const { dnId } = useParams(); // const { dnId } = useParams();
const { setValue } = useFormContext(); // const { setValue } = useFormContext();
const [jumlahKeterangan, setJumlahKeterangan] = useState<number>(0); // const [jumlahKeterangan, setJumlahKeterangan] = useState<number>(0);
const maxKeterangan = 5; // const maxKeterangan = 5;
const handleTambah = () => { // const handleTambah = () => {
if (jumlahKeterangan < maxKeterangan) { // if (jumlahKeterangan < maxKeterangan) {
setJumlahKeterangan(jumlahKeterangan + 1); // setJumlahKeterangan(jumlahKeterangan + 1);
} // }
}; // };
const handleHapus = () => { // const handleHapus = () => {
if (jumlahKeterangan > 0) { // if (jumlahKeterangan > 0) {
const newCount = jumlahKeterangan - 1; // const newCount = jumlahKeterangan - 1;
setJumlahKeterangan(newCount); // setJumlahKeterangan(newCount);
// reset value form field yang dihapus // // reset value form field yang dihapus
setValue(`keterangan${newCount + 1}`, null); // setValue(`keterangan${newCount + 1}`, null);
} // }
}; // };
return ( <Grid container rowSpacing={2} alignItems="center" columnSpacing={2}>
<Grid container rowSpacing={2} alignItems="center" columnSpacing={2}> <Grid size={{ md: 6 }}>
<Grid size={{ md: 6 }}> <Field.DatePicker name="tglPemotongan" label="Tanggal Pemotongan" />
<Field.DatePicker name="tglPemotongan" label="Tanggal Pemotongan" />
</Grid>
<Grid size={{ md: 3 }}>
<Field.DatePicker name="thnPajak" label="Tahun Pajak" view="year" format="YYYY" />
</Grid>
<Grid size={{ md: 3 }}>
<Field.DatePicker name="msPajak" label="Masa Pajak" view="month" format="MM" />
</Grid>
</Grid> </Grid>
); <Grid size={{ md: 3 }}>
}; <Field.DatePicker name="thnPajak" label="Tahun Pajak" view="year" format="YYYY" />
</Grid>
<Grid size={{ md: 3 }}>
<Field.DatePicker name="msPajak" label="Masa Pajak" view="month" format="MM" />
</Grid>
</Grid>
);
export default Identitas; export default Identitas;
...@@ -74,7 +74,7 @@ export function DigunggungListView() { ...@@ -74,7 +74,7 @@ export function DigunggungListView() {
.join(' AND '); .join(' AND ');
}; };
const { data, isLoading, isError } = useGetDn({ const { data, isLoading } = useGetDn({
params: { params: {
Page: paginationModel.page + 1, // API biasanya 1-based Page: paginationModel.page + 1, // API biasanya 1-based
Limit: paginationModel.pageSize, Limit: paginationModel.pageSize,
...@@ -82,7 +82,9 @@ export function DigunggungListView() { ...@@ -82,7 +82,9 @@ export function DigunggungListView() {
sortingMode: sortModel[0]?.field, sortingMode: sortModel[0]?.field,
sortingMethod: sortModel[0]?.sort, sortingMethod: sortModel[0]?.sort,
}, },
refetchOnWindowFocus: false, option: {
refetchOnWindowFocus: false,
},
}); });
const totalRows = data?.total || 0; const totalRows = data?.total || 0;
...@@ -139,46 +141,46 @@ export function DigunggungListView() { ...@@ -139,46 +141,46 @@ export function DigunggungListView() {
]; ];
return ( return (
<DashboardContent> <DashboardContent>
<CustomBreadcrumbs <CustomBreadcrumbs
heading="Bupot Disetor Sendiri" heading="Bupot Disetor Sendiri"
links={[ links={[
{ name: 'Dashboard', href: paths.dashboard.root }, { name: 'Dashboard', href: paths.dashboard.root },
{ name: 'e-Bupot Disetor Sendiri' }, { name: 'e-Bupot Disetor Sendiri' },
]} ]}
action={ action={
<Button component={RouterLink} href={paths.unifikasi.sspNew} variant="contained"> <Button component={RouterLink} href={paths.unifikasi.sspNew} variant="contained">
Rekam Data Rekam Data
</Button> </Button>
} }
/> />
<TableHeaderLabel label="Daftar Bukti Setor atas PPh yang disetor Sendiri" /> <TableHeaderLabel label="Daftar Bukti Setor atas PPh yang disetor Sendiri" />
<DataGridPremium <DataGridPremium
checkboxSelection checkboxSelection
rows={rows} rows={rows}
columns={columns} columns={columns}
loading={isLoading} loading={isLoading}
rowCount={totalRows} rowCount={totalRows}
initialState={{ initialState={{
pagination: { paginationModel: { pageSize: 10, page: 0 } }, pagination: { paginationModel: { pageSize: 10, page: 0 } },
}} }}
pagination pagination
pageSizeOptions={[5, 10, 15, 25, 50, 100, 250, 500, 750, 100]} pageSizeOptions={[5, 10, 15, 25, 50, 100, 250, 500, 750, 100]}
paginationMode="server" paginationMode="server"
onPaginationModelChange={setPaginationModel} onPaginationModelChange={setPaginationModel}
filterMode="server" filterMode="server"
onFilterModelChange={setFilterModel} onFilterModelChange={setFilterModel}
sortingMode="server" sortingMode="server"
onSortModelChange={setSortModel} onSortModelChange={setSortModel}
pinnedColumns={{ pinnedColumns={{
left: ['__check__', 'fgStatus', 'noBupot'], left: ['__check__', 'fgStatus', 'noBupot'],
}} }}
cellSelection cellSelection
// slots={{ // slots={{
// toolbar: CustomToolbarDn, // BENAR: pakai object // toolbar: CustomToolbarDn, // BENAR: pakai object
// }} // }}
/> />
</DashboardContent> </DashboardContent>
); );
} }
...@@ -38,9 +38,9 @@ const DigunggungRekamView = () => { ...@@ -38,9 +38,9 @@ const DigunggungRekamView = () => {
const [isOpenPanduan, setIsOpenPanduan] = useState<boolean>(false); const [isOpenPanduan, setIsOpenPanduan] = useState<boolean>(false);
const [isCheckedAgreement, setIsCheckedAgreement] = useState<boolean>(false); const [isCheckedAgreement, setIsCheckedAgreement] = useState<boolean>(false);
const { data, isLoading, isError } = useGetKodeObjekPajak(); const { data } = useGetKodeObjekPajak();
type BpuFormData = z.infer<typeof bpuSchema>; // type BpuFormData = z.infer<typeof bpuSchema>;
const handleOpenPanduan = () => setIsOpenPanduan(!isOpenPanduan); const handleOpenPanduan = () => setIsOpenPanduan(!isOpenPanduan);
...@@ -66,11 +66,11 @@ const DigunggungRekamView = () => { ...@@ -66,11 +66,11 @@ const DigunggungRekamView = () => {
defaultValues, defaultValues,
}); });
const { // const {
reset, // reset,
handleSubmit, // handleSubmit,
formState: { isSubmitting }, // formState: { isSubmitting },
} = methods; // } = methods;
const SubmitRekam = () => { const SubmitRekam = () => {
console.log('Submit API'); console.log('Submit API');
...@@ -78,67 +78,67 @@ const DigunggungRekamView = () => { ...@@ -78,67 +78,67 @@ const DigunggungRekamView = () => {
return ( return (
<DashboardContent> <DashboardContent>
<CustomBreadcrumbs <CustomBreadcrumbs
heading="Add Bupot Unifikasi Disetor Sendiri" heading="Add Bupot Unifikasi Disetor Sendiri"
links={[ links={[
{ name: 'Dashboard', href: paths.dashboard.root }, { name: 'Dashboard', href: paths.dashboard.root },
{ name: 'e-Bupot Unifikasi Disetor Sendiri', href: paths.unifikasi.nr }, { name: 'e-Bupot Unifikasi Disetor Sendiri', href: paths.unifikasi.nr },
{ name: 'Add Bupot Unifikasi Disetor Sendiri' }, { name: 'Add Bupot Unifikasi Disetor Sendiri' },
]} ]}
/> />
<HeadingRekam label="Rekam Data Bukti Potong PPh Non Residen" /> <HeadingRekam label="Rekam Data Bukti Potong PPh Non Residen" />
<Grid container columnSpacing={2} /* container otomatis */> <Grid container columnSpacing={2} /* container otomatis */>
<Grid size={{ xs: isOpenPanduan ? 8 : 11 }}> <Grid size={{ xs: isOpenPanduan ? 8 : 11 }}>
<form onSubmit={methods.handleSubmit(SubmitRekam)}> <form onSubmit={methods.handleSubmit(SubmitRekam)}>
<FormProvider {...methods}> <FormProvider {...methods}>
<Suspense fallback={<FormSkeleton />}>
<Identitas isPengganti />
<Suspense fallback={<FormSkeleton />}> <Suspense fallback={<FormSkeleton />}>
<Identitas isPengganti /> <PphDipotong kodeObjectPajak={data?.data ?? []} />
<Suspense fallback={<FormSkeleton />}> </Suspense>
<PphDipotong kodeObjectPajak={data?.data ?? []} /> <DokumenReferensi />
</Suspense> <Divider />
<DokumenReferensi /> <Grid size={12}>
<Divider /> <Agreement
<Grid size={12}> isCheckedAgreement={isCheckedAgreement}
<Agreement setIsCheckedAgreement={setIsCheckedAgreement}
isCheckedAgreement={isCheckedAgreement} text="Dengan ini saya menyatakan bahwa Bukti Pemotongan/Pemungutan Unifikasi telah
setIsCheckedAgreement={setIsCheckedAgreement}
text="Dengan ini saya menyatakan bahwa Bukti Pemotongan/Pemungutan Unifikasi telah
saya isi dengan benar secara elektronik sesuai saya isi dengan benar secara elektronik sesuai
dengan" dengan"
/> />
</Grid> </Grid>
<Stack direction="row" gap={2} justifyContent="end" marginTop={2}> <Stack direction="row" gap={2} justifyContent="end" marginTop={2}>
<LoadingButton <LoadingButton
type="submit" type="submit"
// loading={saveDn.isLoading} // loading={saveDn.isLoading}
disabled={!isCheckedAgreement} disabled={!isCheckedAgreement}
variant="outlined" variant="outlined"
sx={{ color: '#143B88' }} sx={{ color: '#143B88' }}
> >
Save as Draft Save as Draft
</LoadingButton> </LoadingButton>
<LoadingButton <LoadingButton
type="button" type="button"
disabled={!isCheckedAgreement} disabled={!isCheckedAgreement}
// onClick={handleClickUploadSsp} // onClick={handleClickUploadSsp}
// loading={uploadDn.isLoading} // loading={uploadDn.isLoading}
variant="contained" variant="contained"
sx={{ background: '#143B88' }} sx={{ background: '#143B88' }}
> >
Save and Upload Save and Upload
</LoadingButton> </LoadingButton>
</Stack> </Stack>
</Suspense> </Suspense>
</FormProvider> </FormProvider>
</form> </form>
</Grid> </Grid>
<Grid size={{ xs: isOpenPanduan ? 4 : 1 }}> <Grid size={{ xs: isOpenPanduan ? 4 : 1 }}>
<PanduanSspRekam handleOpen={handleOpenPanduan} isOpen={isOpenPanduan} /> <PanduanSspRekam handleOpen={handleOpenPanduan} isOpen={isOpenPanduan} />
</Grid>
</Grid> </Grid>
</DashboardContent> </Grid>
</DashboardContent>
); );
}; };
......
...@@ -13,16 +13,16 @@ interface ModalCetakPdfDnProps { ...@@ -13,16 +13,16 @@ interface ModalCetakPdfDnProps {
onClose: () => void; onClose: () => void;
} }
const formatTanggalIndo = (isoDate: string | undefined | null): string => { // const formatTanggalIndo = (isoDate: string | undefined | null): string => {
if (!isoDate) return ''; // if (!isoDate) return '';
const date = new Date(isoDate); // const date = new Date(isoDate);
const formatter = new Intl.DateTimeFormat('id-ID', { // const formatter = new Intl.DateTimeFormat('id-ID', {
day: '2-digit', // day: '2-digit',
month: 'long', // month: 'long',
year: 'numeric', // year: 'numeric',
}); // });
return formatter.format(date); // return formatter.format(date);
}; // };
const ModalCetakPdfDn: React.FC<ModalCetakPdfDnProps> = ({ payload, isOpen, onClose }) => { const ModalCetakPdfDn: React.FC<ModalCetakPdfDnProps> = ({ payload, isOpen, onClose }) => {
const [pdfUrl, setPdfUrl] = useState<string | null>(null); const [pdfUrl, setPdfUrl] = useState<string | null>(null);
......
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { useQuery } from '@tanstack/react-query'; import { useQuery, type UseQueryOptions } from '@tanstack/react-query';
import dnApi from '../utils/api'; import dnApi from '../utils/api';
import type { TGetListDataTableDn, TGetListDataTableDnResult } from '../types/types'; import type { TGetListDataTableDn, TGetListDataTableDnResult } from '../types/types';
import { FG_PDF_STATUS, FG_SIGN_STATUS } from '../constant'; import { FG_PDF_STATUS, FG_SIGN_STATUS } from '../constant';
...@@ -93,22 +93,22 @@ const normalisePropsGetDn = (params: TGetListDataTableDn) => ({ ...@@ -93,22 +93,22 @@ const normalisePropsGetDn = (params: TGetListDataTableDn) => ({
}); });
// ---------- normalizer for params request ---------- // ---------- normalizer for params request ----------
const normalisPropsParmasGetDn = (params: any) => { // const normalisPropsParmasGetDn = (params: any) => {
const sorting = !isEmpty(params.sortModel) // const sorting = !isEmpty(params.sortModel)
? transformSortModelToSortApiPayload(params.sortModel) // ? transformSortModelToSortApiPayload(params.sortModel)
: {}; // : {};
return { // return {
...params, // ...params,
page: (typeof params.page === 'number' ? params.page : 0) + 1, // page: (typeof params.page === 'number' ? params.page : 0) + 1,
limit: params.pageSize, // limit: params.pageSize,
masaPajak: params.msPajak || null, // masaPajak: params.msPajak || null,
tahunPajak: params.thnPajak || null, // tahunPajak: params.thnPajak || null,
npwp: params.idDipotong || null, // npwp: params.idDipotong || null,
advanced: isEmpty(params.advanced) ? undefined : params.advanced, // advanced: isEmpty(params.advanced) ? undefined : params.advanced,
...sorting, // ...sorting,
}; // };
}; // };
const normalizeParams = (params: any) => { const normalizeParams = (params: any) => {
const { const {
...@@ -155,7 +155,13 @@ const normalizeParams = (params: any) => { ...@@ -155,7 +155,13 @@ const normalizeParams = (params: any) => {
}; };
}; };
export const useGetDn = ({ params }: { params: any }) => { export const useGetDn = ({
params,
option,
}: {
params: any;
option?: Omit<UseQueryOptions, 'queryKey' | 'queryFn'>;
}) => {
const { page, limit, advanced, sortingMode, sortingMethod } = params; const { page, limit, advanced, sortingMode, sortingMethod } = params;
const normalized = normalizeParams(params); const normalized = normalizeParams(params);
...@@ -227,6 +233,7 @@ export const useGetDn = ({ params }: { params: any }) => { ...@@ -227,6 +233,7 @@ export const useGetDn = ({ params }: { params: any }) => {
staleTime: 0, staleTime: 0,
gcTime: 0, gcTime: 0,
retry: false, retry: false,
// ...option,
}); });
}; };
......
/* eslint-disable @typescript-eslint/no-shadow */
import { useEffect } from 'react'; import { useEffect } from 'react';
import { useFormContext, useWatch } from 'react-hook-form'; import { useFormContext, useWatch } from 'react-hook-form';
import type { TGetListDataKOPDn } from '../types/types'; import type { TGetListDataKOPDn } from '../types/types';
...@@ -35,7 +36,6 @@ const usePphDipotong = (kodeObjekPajakSelected?: TGetListDataKOPDn) => { ...@@ -35,7 +36,6 @@ const usePphDipotong = (kodeObjekPajakSelected?: TGetListDataKOPDn) => {
name: ['thnPajak', 'fgFasilitas', 'fgIdDipotong', 'jmlBruto', 'tarif'], name: ['thnPajak', 'fgFasilitas', 'fgIdDipotong', 'jmlBruto', 'tarif'],
}); });
const calculateAndSetPphDipotong = ( const calculateAndSetPphDipotong = (
thnPajak: number, thnPajak: number,
fgFasilitas: string, fgFasilitas: string,
...@@ -67,6 +67,7 @@ const usePphDipotong = (kodeObjekPajakSelected?: TGetListDataKOPDn) => { ...@@ -67,6 +67,7 @@ const usePphDipotong = (kodeObjekPajakSelected?: TGetListDataKOPDn) => {
Number(handlerSetPphDipotong[4]) Number(handlerSetPphDipotong[4])
); );
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [handlerSetPphDipotong]); }, [handlerSetPphDipotong]);
return { return {
......
...@@ -6,8 +6,8 @@ import type { ...@@ -6,8 +6,8 @@ import type {
TDeleteDnRequest, TDeleteDnRequest,
TGetListDataKOPDnResult, TGetListDataKOPDnResult,
TGetListDataTableDnResult, TGetListDataTableDnResult,
TPostDnRequest} from '../types/types'; TPostDnRequest,
} from '../types/types';
import unifikasiClient from './unifikasiClient'; import unifikasiClient from './unifikasiClient';
...@@ -24,7 +24,7 @@ const axiosCetakPdf = axios.create({ ...@@ -24,7 +24,7 @@ const axiosCetakPdf = axios.create({
// API untuk get list table // API untuk get list table
dnApi.getDn = async (config: any) => { dnApi.getDn = async (config: any) => {
const { const {
data: { status, message, metaPage, data }, data: { message, metaPage, data },
status: statusCode, status: statusCode,
} = await unifikasiClient.get<TBaseResponseAPI<TGetListDataTableDnResult>>('IF_TXR_028/bpu', { } = await unifikasiClient.get<TBaseResponseAPI<TGetListDataTableDnResult>>('IF_TXR_028/bpu', {
...config, ...config,
...@@ -54,8 +54,8 @@ dnApi.getKodeObjekPajakDn = async (params?: Record<string, any>) => { ...@@ -54,8 +54,8 @@ dnApi.getKodeObjekPajakDn = async (params?: Record<string, any>) => {
dnApi.saveDn = async (config: TPostDnRequest) => { dnApi.saveDn = async (config: TPostDnRequest) => {
const { const {
data: { status, message, data, code }, data: { message, data, code },
status: statusCode, // status: statusCode,
} = await unifikasiClient.post<TBaseResponseAPI<TPostDnRequest>>('/IF_TXR_028/bpu', { } = await unifikasiClient.post<TBaseResponseAPI<TPostDnRequest>>('/IF_TXR_028/bpu', {
...config, ...config,
}); });
...@@ -111,7 +111,7 @@ dnApi.deleteDn = async (payload: TDeleteDnRequest, config?: Record<string, any>) ...@@ -111,7 +111,7 @@ dnApi.deleteDn = async (payload: TDeleteDnRequest, config?: Record<string, any>)
dnApi.cancel = async ({ id, tglPembatalan }: TCancelDnRequest): Promise<TCancelDnResponse> => { dnApi.cancel = async ({ id, tglPembatalan }: TCancelDnRequest): Promise<TCancelDnResponse> => {
const { const {
data: { status, message, data, code, time, metaPage, total }, data: { status, message, data, code, time, metaPage, total },
status: statusCode, // status: statusCode,
} = await unifikasiClient.post('/IF_TXR_028/bpu/batal', { } = await unifikasiClient.post('/IF_TXR_028/bpu/batal', {
id, id,
tglPembatalan, tglPembatalan,
......
...@@ -276,35 +276,35 @@ export function DnListView() { ...@@ -276,35 +276,35 @@ export function DnListView() {
); );
// --- selection helpers (kept same) // --- selection helpers (kept same)
const normalizeSelectionToArray = (raw: unknown): GridRowId[] => { // const normalizeSelectionToArray = (raw: unknown): GridRowId[] => {
if (!raw) return []; // if (!raw) return [];
if (typeof raw === 'object' && raw !== null && 'ids' in (raw as any)) { // if (typeof raw === 'object' && raw !== null && 'ids' in (raw as any)) {
const ids = (raw as any).ids; // const ids = (raw as any).ids;
if (ids instanceof Set) return Array.from(ids) as GridRowId[]; // if (ids instanceof Set) return Array.from(ids) as GridRowId[];
if (Array.isArray(ids)) return ids as GridRowId[]; // if (Array.isArray(ids)) return ids as GridRowId[];
if (ids instanceof Map) return Array.from((ids as Map<any, any>).keys()) as GridRowId[]; // if (ids instanceof Map) return Array.from((ids as Map<any, any>).keys()) as GridRowId[];
if (typeof ids === 'object' && ids !== null) return Object.keys(ids) as GridRowId[]; // if (typeof ids === 'object' && ids !== null) return Object.keys(ids) as GridRowId[];
} // }
if (Array.isArray(raw)) return raw as GridRowId[]; // if (Array.isArray(raw)) return raw as GridRowId[];
if (raw instanceof Set) return Array.from(raw) as GridRowId[]; // if (raw instanceof Set) return Array.from(raw) as GridRowId[];
if (raw instanceof Map) return Array.from((raw as Map<any, any>).keys()) as GridRowId[]; // if (raw instanceof Map) return Array.from((raw as Map<any, any>).keys()) as GridRowId[];
if (typeof raw === 'object' && raw !== null) { // if (typeof raw === 'object' && raw !== null) {
const obj = raw as Record<string, any>; // const obj = raw as Record<string, any>;
const keys = Object.keys(obj).filter((k) => !!obj[k]); // const keys = Object.keys(obj).filter((k) => !!obj[k]);
if (keys.length) return keys as GridRowId[]; // if (keys.length) return keys as GridRowId[];
} // }
try { // try {
if ((raw as any)[Symbol.iterator]) { // if ((raw as any)[Symbol.iterator]) {
return Array.from(raw as Iterable<unknown>) as GridRowId[]; // return Array.from(raw as Iterable<unknown>) as GridRowId[];
} // }
} catch { // } catch {
/* ignore */ // /* ignore */
} // }
return []; // return [];
}; // };
const getSelectedRowByKey = (key?: GridRowId | 'all') => { const getSelectedRowByKey = (key?: GridRowId | 'all') => {
const api = apiRef.current; const api = apiRef.current;
...@@ -381,6 +381,7 @@ export function DnListView() { ...@@ -381,6 +381,7 @@ export function DnListView() {
canReplacement: count === 1 && dataSelected[0].fgStatus === FG_STATUS_DN.NORMAL_DONE, canReplacement: count === 1 && dataSelected[0].fgStatus === FG_STATUS_DN.NORMAL_DONE,
canCancel: hasSelection && allNormal, canCancel: hasSelection && allNormal,
}; };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectionVersion]); }, [selectionVersion]);
useEffect(() => { useEffect(() => {
...@@ -467,6 +468,7 @@ export function DnListView() { ...@@ -467,6 +468,7 @@ export function DnListView() {
}, },
], ],
], ],
// eslint-disable-next-line react-hooks/exhaustive-deps
[validatedActions, refetch, handleEditData] [validatedActions, refetch, handleEditData]
); );
...@@ -492,10 +494,12 @@ export function DnListView() { ...@@ -492,10 +494,12 @@ export function DnListView() {
const api = apiRef.current; const api = apiRef.current;
if (!api) return; if (!api) return;
const id = window.setTimeout(() => { const id = window.setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const selected = getSelectedRowByKey('all'); const selected = getSelectedRowByKey('all');
}, 100); }, 100);
// eslint-disable-next-line consistent-return // eslint-disable-next-line consistent-return
return () => clearTimeout(id); return () => clearTimeout(id);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [apiRef, selectionVersion]); }, [apiRef, selectionVersion]);
return ( return (
......
...@@ -48,6 +48,7 @@ function normalisePropsGetDn(params) { ...@@ -48,6 +48,7 @@ function normalisePropsGetDn(params) {
}; };
} }
// eslint-disable-next-line func-names
onmessage = function (e) { onmessage = function (e) {
const { data } = e; const { data } = e;
// data should be array of items // data should be array of items
......
import Grid from '@mui/material/Grid'; import Grid from '@mui/material/Grid';
import MenuItem from '@mui/material/MenuItem'; import MenuItem from '@mui/material/MenuItem';
import { useState } from 'react'; // import { useState } from 'react';
import { useFormContext } from 'react-hook-form'; // import { useFormContext } from 'react-hook-form';
import { useParams } from 'react-router'; // import { useParams } from 'react-router';
import { Field } from 'src/components/hook-form'; import { Field } from 'src/components/hook-form';
type IdentitasProps = { type IdentitasProps = {
...@@ -12,27 +12,27 @@ type IdentitasProps = { ...@@ -12,27 +12,27 @@ type IdentitasProps = {
}; };
const Identitas = ({ isPengganti }: IdentitasProps) => { const Identitas = ({ isPengganti }: IdentitasProps) => {
const { dnId } = useParams(); // const { dnId } = useParams();
const { setValue } = useFormContext(); // const { setValue } = useFormContext();
const [jumlahKeterangan, setJumlahKeterangan] = useState<number>(0); // const [jumlahKeterangan, setJumlahKeterangan] = useState<number>(0);
const maxKeterangan = 5; // const maxKeterangan = 5;
const handleTambah = () => { // const handleTambah = () => {
if (jumlahKeterangan < maxKeterangan) { // if (jumlahKeterangan < maxKeterangan) {
setJumlahKeterangan(jumlahKeterangan + 1); // setJumlahKeterangan(jumlahKeterangan + 1);
} // }
}; // };
const handleHapus = () => { // const handleHapus = () => {
if (jumlahKeterangan > 0) { // if (jumlahKeterangan > 0) {
const newCount = jumlahKeterangan - 1; // const newCount = jumlahKeterangan - 1;
setJumlahKeterangan(newCount); // setJumlahKeterangan(newCount);
// reset value form field yang dihapus // // reset value form field yang dihapus
setValue(`keterangan${newCount + 1}`, null); // setValue(`keterangan${newCount + 1}`, null);
} // }
}; // };
const MockNitku = [ const MockNitku = [
{ {
...@@ -45,51 +45,51 @@ const Identitas = ({ isPengganti }: IdentitasProps) => { ...@@ -45,51 +45,51 @@ const Identitas = ({ isPengganti }: IdentitasProps) => {
return ( return (
<Grid container rowSpacing={2} alignItems="center" columnSpacing={2} sx={{ mb: 4 }}> <Grid container rowSpacing={2} alignItems="center" columnSpacing={2} sx={{ mb: 4 }}>
<Grid size={{ md: 6 }}> <Grid size={{ md: 6 }}>
<Field.DatePicker name="tglPemotongan" label="Tanggal Pemotongan" /> <Field.DatePicker name="tglPemotongan" label="Tanggal Pemotongan" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Select name="status" label="Status" disabled>
<MenuItem>Normal</MenuItem>
</Field.Select>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="noRekAkun" label="Nomor Rekening Akun" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Select name="idTku" label="NITKU Pemotong">
{MockNitku.map((item, index) => (
<MenuItem key={index} value={item.nama}>
{item.nama}
</MenuItem>
))}
</Field.Select>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="npwpPemberiPenghasilan" label="NPWP Pemberi Penghasilan" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text
name="noRekAkunPemberiPenghasilan"
label="Nomor Rekening Akun Pemberi Penghasilan"
/>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="npwpPenerimaPenghasilan" label="NPWP Penerima Penghasilan" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text
name="noRekAkunPenerimaPenghasilan"
label="Nomor Rekening Akun Penerima Penghasilan"
/>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="kodeBilling" label="Kode Billing" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.DatePicker name="tanggalBilling" label="Tanggal Billing" />
</Grid>
</Grid> </Grid>
<Grid size={{ md: 6 }}>
<Field.Select name="status" label="Status" disabled>
<MenuItem>Normal</MenuItem>
</Field.Select>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="noRekAkun" label="Nomor Rekening Akun" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Select name="idTku" label="NITKU Pemotong">
{MockNitku.map((item, index) => (
<MenuItem key={index} value={item.nama}>
{item.nama}
</MenuItem>
))}
</Field.Select>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="npwpPemberiPenghasilan" label="NPWP Pemberi Penghasilan" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text
name="noRekAkunPemberiPenghasilan"
label="Nomor Rekening Akun Pemberi Penghasilan"
/>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="npwpPenerimaPenghasilan" label="NPWP Penerima Penghasilan" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text
name="noRekAkunPenerimaPenghasilan"
label="Nomor Rekening Akun Penerima Penghasilan"
/>
</Grid>
<Grid size={{ md: 6 }}>
<Field.Text name="kodeBilling" label="Kode Billing" />
</Grid>
<Grid size={{ md: 6 }}>
<Field.DatePicker name="tanggalBilling" label="Tanggal Billing" />
</Grid>
</Grid>
); );
}; };
......
...@@ -74,7 +74,7 @@ export function DokumenDipersamakanListView() { ...@@ -74,7 +74,7 @@ export function DokumenDipersamakanListView() {
.join(' AND '); .join(' AND ');
}; };
const { data, isLoading, isError } = useGetDn({ const { data, isLoading } = useGetDn({
params: { params: {
Page: paginationModel.page + 1, // API biasanya 1-based Page: paginationModel.page + 1, // API biasanya 1-based
Limit: paginationModel.pageSize, Limit: paginationModel.pageSize,
...@@ -82,7 +82,9 @@ export function DokumenDipersamakanListView() { ...@@ -82,7 +82,9 @@ export function DokumenDipersamakanListView() {
sortingMode: sortModel[0]?.field, sortingMode: sortModel[0]?.field,
sortingMethod: sortModel[0]?.sort, sortingMethod: sortModel[0]?.sort,
}, },
refetchOnWindowFocus: false, option: {
refetchOnWindowFocus: false,
},
}); });
const totalRows = data?.total || 0; const totalRows = data?.total || 0;
...@@ -139,50 +141,50 @@ export function DokumenDipersamakanListView() { ...@@ -139,50 +141,50 @@ export function DokumenDipersamakanListView() {
]; ];
return ( return (
<DashboardContent> <DashboardContent>
<CustomBreadcrumbs <CustomBreadcrumbs
heading="Bupot Dokumen Dipersamakan" heading="Bupot Dokumen Dipersamakan"
links={[ links={[
{ name: 'Dashboard', href: paths.dashboard.root }, { name: 'Dashboard', href: paths.dashboard.root },
{ name: 'e-Bupot Dokumen Dipersamakan' }, { name: 'e-Bupot Dokumen Dipersamakan' },
]} ]}
action={ action={
<Button <Button
component={RouterLink} component={RouterLink}
href={paths.unifikasi.dokumenDipersamakanNew} href={paths.unifikasi.dokumenDipersamakanNew}
variant="contained" variant="contained"
> >
Rekam Data Rekam Data
</Button> </Button>
} }
/> />
<TableHeaderLabel label="Dokumen Dipersamakan" /> <TableHeaderLabel label="Dokumen Dipersamakan" />
<DataGridPremium <DataGridPremium
checkboxSelection checkboxSelection
rows={rows} rows={rows}
columns={columns} columns={columns}
loading={isLoading} loading={isLoading}
rowCount={totalRows} rowCount={totalRows}
initialState={{ initialState={{
pagination: { paginationModel: { pageSize: 10, page: 0 } }, pagination: { paginationModel: { pageSize: 10, page: 0 } },
}} }}
pagination pagination
pageSizeOptions={[5, 10, 15, 25, 50, 100, 250, 500, 750, 100]} pageSizeOptions={[5, 10, 15, 25, 50, 100, 250, 500, 750, 100]}
paginationMode="server" paginationMode="server"
onPaginationModelChange={setPaginationModel} onPaginationModelChange={setPaginationModel}
filterMode="server" filterMode="server"
onFilterModelChange={setFilterModel} onFilterModelChange={setFilterModel}
sortingMode="server" sortingMode="server"
onSortModelChange={setSortModel} onSortModelChange={setSortModel}
pinnedColumns={{ pinnedColumns={{
left: ['__check__', 'fgStatus', 'noBupot'], left: ['__check__', 'fgStatus', 'noBupot'],
}} }}
cellSelection cellSelection
// slots={{ // slots={{
// toolbar: CustomToolbarDn, // BENAR: pakai object // toolbar: CustomToolbarDn, // BENAR: pakai object
// }} // }}
/> />
</DashboardContent> </DashboardContent>
); );
} }
...@@ -82,7 +82,9 @@ export function NrListView() { ...@@ -82,7 +82,9 @@ export function NrListView() {
sortingMode: sortModel[0]?.field, sortingMode: sortModel[0]?.field,
sortingMethod: sortModel[0]?.sort, sortingMethod: sortModel[0]?.sort,
}, },
refetchOnWindowFocus: false, option: {
refetchOnWindowFocus: false,
},
}); });
const totalRows = data?.total || 0; const totalRows = data?.total || 0;
...@@ -139,46 +141,43 @@ export function NrListView() { ...@@ -139,46 +141,43 @@ export function NrListView() {
]; ];
return ( return (
<DashboardContent> <DashboardContent>
<CustomBreadcrumbs <CustomBreadcrumbs
heading="Bupot Non Residen" heading="Bupot Non Residen"
links={[ links={[{ name: 'Dashboard', href: paths.dashboard.root }, { name: 'e-Bupot Non Residen' }]}
{ name: 'Dashboard', href: paths.dashboard.root }, action={
{ name: 'e-Bupot Non Residen' }, <Button component={RouterLink} href={paths.unifikasi.nrNew} variant="contained">
]} Rekam Data
action={ </Button>
<Button component={RouterLink} href={paths.unifikasi.nrNew} variant="contained"> }
Rekam Data />
</Button>
}
/>
<TableHeaderLabel label="Daftar Bukti Potong PPh Non Residen" /> <TableHeaderLabel label="Daftar Bukti Potong PPh Non Residen" />
<DataGridPremium <DataGridPremium
checkboxSelection checkboxSelection
rows={rows} rows={rows}
columns={columns} columns={columns}
loading={isLoading} loading={isLoading}
rowCount={totalRows} rowCount={totalRows}
initialState={{ initialState={{
pagination: { paginationModel: { pageSize: 10, page: 0 } }, pagination: { paginationModel: { pageSize: 10, page: 0 } },
}} }}
pagination pagination
pageSizeOptions={[5, 10, 15, 25, 50, 100, 250, 500, 750, 100]} pageSizeOptions={[5, 10, 15, 25, 50, 100, 250, 500, 750, 100]}
paginationMode="server" paginationMode="server"
onPaginationModelChange={setPaginationModel} onPaginationModelChange={setPaginationModel}
filterMode="server" filterMode="server"
onFilterModelChange={setFilterModel} onFilterModelChange={setFilterModel}
sortingMode="server" sortingMode="server"
onSortModelChange={setSortModel} onSortModelChange={setSortModel}
pinnedColumns={{ pinnedColumns={{
left: ['__check__', 'fgStatus', 'noBupot'], left: ['__check__', 'fgStatus', 'noBupot'],
}} }}
cellSelection cellSelection
// slots={{ // slots={{
// toolbar: CustomToolbarDn, // BENAR: pakai object // toolbar: CustomToolbarDn, // BENAR: pakai object
// }} // }}
/> />
</DashboardContent> </DashboardContent>
); );
} }
...@@ -37,9 +37,9 @@ const NrRekamView = () => { ...@@ -37,9 +37,9 @@ const NrRekamView = () => {
const [isOpenPanduan, setIsOpenPanduan] = useState<boolean>(false); const [isOpenPanduan, setIsOpenPanduan] = useState<boolean>(false);
const [isCheckedAgreement, setIsCheckedAgreement] = useState<boolean>(false); const [isCheckedAgreement, setIsCheckedAgreement] = useState<boolean>(false);
const { data, isLoading, isError } = useGetKodeObjekPajak(); const { data } = useGetKodeObjekPajak();
type BpuFormData = z.infer<typeof bpuSchema>; // type BpuFormData = z.infer<typeof bpuSchema>;
const handleOpenPanduan = () => setIsOpenPanduan(!isOpenPanduan); const handleOpenPanduan = () => setIsOpenPanduan(!isOpenPanduan);
......
import Grid from '@mui/material/Grid'; import Grid from '@mui/material/Grid';
import { useState } from 'react';
import { useFormContext } from 'react-hook-form';
// import { useParams } from 'react-router'; // import { useParams } from 'react-router';
import { Field } from 'src/components/hook-form'; import { Field } from 'src/components/hook-form';
...@@ -10,42 +8,39 @@ type IdentitasProps = { ...@@ -10,42 +8,39 @@ type IdentitasProps = {
// disabledHapus: boolean; // disabledHapus: boolean;
}; };
const Identitas = ({ isPengganti }: IdentitasProps) => { const Identitas = ({ isPengganti }: IdentitasProps) => (
// const { dnId } = useParams(); // const { dnId } = useParams();
const { setValue } = useFormContext(); // const { setValue } = useFormContext();
const [jumlahKeterangan, setJumlahKeterangan] = useState<number>(0); // const [jumlahKeterangan, setJumlahKeterangan] = useState<number>(0);
const maxKeterangan = 5; // const maxKeterangan = 5;
const handleTambah = () => { // const handleTambah = () => {
if (jumlahKeterangan < maxKeterangan) { // if (jumlahKeterangan < maxKeterangan) {
setJumlahKeterangan(jumlahKeterangan + 1); // setJumlahKeterangan(jumlahKeterangan + 1);
} // }
}; // };
const handleHapus = () => { // const handleHapus = () => {
if (jumlahKeterangan > 0) { // if (jumlahKeterangan > 0) {
const newCount = jumlahKeterangan - 1; // const newCount = jumlahKeterangan - 1;
setJumlahKeterangan(newCount); // setJumlahKeterangan(newCount);
// reset value form field yang dihapus // // reset value form field yang dihapus
setValue(`keterangan${newCount + 1}`, null); // setValue(`keterangan${newCount + 1}`, null);
} // }
}; // };
return ( <Grid container rowSpacing={2} alignItems="center" columnSpacing={2}>
<Grid container rowSpacing={2} alignItems="center" columnSpacing={2}> <Grid size={{ md: 6 }}>
<Grid size={{ md: 6 }}> <Field.DatePicker name="tglPemotongan" label="Tanggal Pemotongan" />
<Field.DatePicker name="tglPemotongan" label="Tanggal Pemotongan" />
</Grid>
<Grid size={{ md: 3 }}>
<Field.DatePicker name="thnPajak" label="Tahun Pajak" view="year" format="YYYY" />
</Grid>
<Grid size={{ md: 3 }}>
<Field.DatePicker name="msPajak" label="Masa Pajak" view="month" format="MM" />
</Grid>
</Grid> </Grid>
); <Grid size={{ md: 3 }}>
}; <Field.DatePicker name="thnPajak" label="Tahun Pajak" view="year" format="YYYY" />
</Grid>
<Grid size={{ md: 3 }}>
<Field.DatePicker name="msPajak" label="Masa Pajak" view="month" format="MM" />
</Grid>
</Grid>
);
export default Identitas; export default Identitas;
...@@ -36,10 +36,14 @@ export function applySettingsToTheme( ...@@ -36,10 +36,14 @@ export function applySettingsToTheme(
// const secondaryColorPalette = createPaletteChannel(secondaryColorPresets[primaryColor]); // const secondaryColorPalette = createPaletteChannel(secondaryColorPresets[primaryColor]);
const updateColorScheme = (schemeName: ThemeColorScheme) => { const updateColorScheme = (schemeName: ThemeColorScheme) => {
const currentScheme = theme.colorSchemes?.[schemeName]; const currentScheme = theme.colorSchemes?.[schemeName] as any;
if (!currentScheme || typeof currentScheme !== 'object') {
return currentScheme;
}
const updatedPalette = { const updatedPalette = {
...currentScheme?.palette, ...currentScheme.palette,
...(!isDefaultPrimaryColor && { ...(!isDefaultPrimaryColor && {
primary: primaryColorPalette, primary: primaryColorPalette,
// secondary: secondaryColorPalette, // secondary: secondaryColorPalette,
...@@ -56,7 +60,7 @@ export function applySettingsToTheme( ...@@ -56,7 +60,7 @@ export function applySettingsToTheme(
}; };
const updatedCustomShadows = { const updatedCustomShadows = {
...currentScheme?.customShadows, ...currentScheme.customShadows,
...(!isDefaultPrimaryColor && { ...(!isDefaultPrimaryColor && {
primary: createShadowColor(primaryColorPalette.mainChannel), primary: createShadowColor(primaryColorPalette.mainChannel),
// secondary: createShadowColor(secondaryColorPalette.mainChannel), // secondary: createShadowColor(secondaryColorPalette.mainChannel),
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
"strictNullChecks": true, "strictNullChecks": true,
/* Tambahan penting: biar TypeScript tahu lokasi file deklarasi custom */ /* Tambahan penting: biar TypeScript tahu lokasi file deklarasi custom */
"typeRoots": ["./node_modules/@types", "./src/@types"] "typeRoots": ["./node_modules/@types", "./src/@types"],
"types": ["node", "vite/client"] // Remove "yup" from here
}, },
"include": ["src"], "include": ["src"],
"exclude": ["node_modules"], "exclude": ["node_modules"],
......
...@@ -9108,7 +9108,7 @@ yoga-layout@^3.2.1: ...@@ -9108,7 +9108,7 @@ yoga-layout@^3.2.1:
resolved "https://registry.yarnpkg.com/yoga-layout/-/yoga-layout-3.2.1.tgz#d2d1ba06f0e81c2eb650c3e5ad8b0b4adde1e843" resolved "https://registry.yarnpkg.com/yoga-layout/-/yoga-layout-3.2.1.tgz#d2d1ba06f0e81c2eb650c3e5ad8b0b4adde1e843"
integrity sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ== integrity sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ==
yup@*: yup@*, yup@^1.7.1:
version "1.7.1" version "1.7.1"
resolved "https://registry.yarnpkg.com/yup/-/yup-1.7.1.tgz#4c47c6bb367df08d4bc597f8c4c4f5fc4277f6ab" resolved "https://registry.yarnpkg.com/yup/-/yup-1.7.1.tgz#4c47c6bb367df08d4bc597f8c4c4f5fc4277f6ab"
integrity sha512-GKHFX2nXul2/4Dtfxhozv701jLQHdf6J34YDh2cEkpqoo8le5Mg6/LrdseVLrFarmFygZTlfIhHx/QKfb/QWXw== integrity sha512-GKHFX2nXul2/4Dtfxhozv701jLQHdf6J34YDh2cEkpqoo8le5Mg6/LrdseVLrFarmFygZTlfIhHx/QKfb/QWXw==
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment