mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 15:55:48 +00:00
refactor(FE): Increase upload file size limit to 5 MB
This commit is contained in:
@@ -131,9 +131,9 @@ const DeliveryObjectSchema: Yup.ObjectSchema<DeliverySchema> = Yup.object({
|
|||||||
document_index: Yup.number().optional(),
|
document_index: Yup.number().optional(),
|
||||||
document: Yup.mixed<File | MovementDocument>()
|
document: Yup.mixed<File | MovementDocument>()
|
||||||
.nullable()
|
.nullable()
|
||||||
.test('fileSize', 'Ukuran dokumen maksimal 2 MB', (value) => {
|
.test('fileSize', 'Ukuran dokumen maksimal 5 MB', (value) => {
|
||||||
if (!value) return true;
|
if (!value) return true;
|
||||||
if (value instanceof File) return value.size <= 2 * 1024 * 1024;
|
if (value instanceof File) return value.size <= 5 * 1024 * 1024;
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
driver_name: Yup.string().required('Nama sopir wajib diisi!'),
|
driver_name: Yup.string().required('Nama sopir wajib diisi!'),
|
||||||
|
|||||||
@@ -1589,8 +1589,8 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const file = e.target.files?.[0];
|
const file = e.target.files?.[0];
|
||||||
if (file) {
|
if (file) {
|
||||||
if (file.size > 2 * 1024 * 1024) {
|
if (file.size > 5 * 1024 * 1024) {
|
||||||
toast.error('Ukuran dokumen maksimal 2 MB!');
|
toast.error('Ukuran dokumen maksimal 5 MB!');
|
||||||
e.target.value = '';
|
e.target.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -690,11 +690,11 @@ const PurchaseOrderAcceptApprovalForm = ({
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const files = Array.from(e.target.files || []);
|
const files = Array.from(e.target.files || []);
|
||||||
const invalidFiles = files.filter(
|
const invalidFiles = files.filter(
|
||||||
(file) => file.size > 2 * 1024 * 1024
|
(file) => file.size > 5 * 1024 * 1024
|
||||||
);
|
);
|
||||||
|
|
||||||
if (invalidFiles.length > 0) {
|
if (invalidFiles.length > 0) {
|
||||||
toast.error('Ukuran dokumen maksimal 2 MB!');
|
toast.error('Ukuran dokumen maksimal 5 MB!');
|
||||||
e.target.value = '';
|
e.target.value = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,9 +395,9 @@ export const PurchaseRequestAcceptApprovalFormSchema: Yup.ObjectSchema<PurchaseR
|
|||||||
.of(
|
.of(
|
||||||
Yup.mixed<File>()
|
Yup.mixed<File>()
|
||||||
.required('Dokumen surat jalan wajib diupload!')
|
.required('Dokumen surat jalan wajib diupload!')
|
||||||
.test('fileSize', 'Ukuran dokumen maksimal 2 MB', (value) => {
|
.test('fileSize', 'Ukuran dokumen maksimal 5 MB', (value) => {
|
||||||
if (!value) return true;
|
if (!value) return true;
|
||||||
if (value instanceof File) return value.size <= 2 * 1024 * 1024;
|
if (value instanceof File) return value.size <= 5 * 1024 * 1024;
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user