mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
fix(FE): resolve merge conflict
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
ClosingGeneralInformation,
|
||||
ClosingIncomingSapronak,
|
||||
ClosingOutgoingSapronak,
|
||||
ClosingOverhead,
|
||||
ClosingSapronakCalculation,
|
||||
} from '@/types/api/closing';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
@@ -16,6 +17,7 @@ import {
|
||||
dummyGetAllOutgoingSapronakFetcher,
|
||||
dummyGetGeneralInfo,
|
||||
dummyGetPerhitunganSapronak,
|
||||
dummyGetOverhead,
|
||||
} from '@/dummy/closing.dummy';
|
||||
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
||||
import { ClosingSales } from '@/types/api/closing';
|
||||
@@ -91,12 +93,12 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
endpoint: string
|
||||
): Promise<BaseApiResponse<ClosingOutgoingSapronak[]>> {
|
||||
// TODO: Remove this block when backend is ready
|
||||
// return await dummyGetAllOutgoingSapronakFetcher();
|
||||
return await dummyGetAllOutgoingSapronakFetcher();
|
||||
|
||||
// Uncomment this when backend is ready
|
||||
return await httpClientFetcher<BaseApiResponse<ClosingOutgoingSapronak[]>>(
|
||||
endpoint
|
||||
);
|
||||
// return await httpClientFetcher<BaseApiResponse<ClosingOutgoingSapronak[]>>(
|
||||
// endpoint
|
||||
// );
|
||||
}
|
||||
|
||||
async getGeneralInfo(
|
||||
@@ -165,6 +167,33 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
async getOverhead(
|
||||
id: number
|
||||
): Promise<BaseApiResponse<ClosingOverhead> | undefined> {
|
||||
// TODO: Remove this block when backend is ready
|
||||
// try {
|
||||
// return await dummyGetOverhead(id);
|
||||
// } catch (error) {
|
||||
// if (axios.isAxiosError<BaseApiResponse<ClosingOverhead>>(error)) {
|
||||
// return error.response?.data;
|
||||
// }
|
||||
// return undefined;
|
||||
// }
|
||||
|
||||
// Uncomment this when backend is ready
|
||||
try {
|
||||
const path = `${this.basePath}/${id}/overhead`;
|
||||
return await httpClient<BaseApiResponse<ClosingOverhead>>(path, {
|
||||
method: 'GET',
|
||||
});
|
||||
} catch (error) {
|
||||
if (axios.isAxiosError<BaseApiResponse<ClosingOverhead>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const ClosingApi = new ClosingApiService('/closings');
|
||||
|
||||
@@ -54,120 +54,119 @@ export class ProjectFlockKandangService extends BaseApiService<
|
||||
id: number
|
||||
): Promise<BaseApiResponse<CheckClosingResponse> | undefined> {
|
||||
// Dummy data - replace with actual API call when backend is ready
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
code: 200,
|
||||
status: 'success',
|
||||
message: 'Cek persyaratan closing kandang',
|
||||
data: {
|
||||
unfinished_expenses: 2,
|
||||
stock_remaining: [
|
||||
{
|
||||
id: 1,
|
||||
product_id: 1,
|
||||
warehouse_id: 1,
|
||||
quantity: 0,
|
||||
product: {
|
||||
id: 1,
|
||||
name: 'Pakan Starter',
|
||||
brand: 'Brand A',
|
||||
sku: 'PKN-STR-001',
|
||||
product_price: 15000,
|
||||
selling_price: 17000,
|
||||
tax: 0,
|
||||
expiry_period: 365,
|
||||
flags: ['active'],
|
||||
uom: {
|
||||
id: 1,
|
||||
name: 'Kg',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin User',
|
||||
},
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
},
|
||||
product_category: {
|
||||
id: 1,
|
||||
name: 'Pakan',
|
||||
code: 'PKN',
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin User',
|
||||
},
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
},
|
||||
suppliers: [],
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin User',
|
||||
},
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
},
|
||||
warehouse: {
|
||||
id: 1,
|
||||
name: 'Gudang Utama',
|
||||
type: 'AREA',
|
||||
area: {
|
||||
id: 1,
|
||||
name: 'Area 1',
|
||||
},
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin User',
|
||||
},
|
||||
created_at: '2024-01-01',
|
||||
updated_at: '2024-01-01',
|
||||
},
|
||||
created_user: {
|
||||
id: 1,
|
||||
id_user: 1,
|
||||
email: 'admin@example.com',
|
||||
name: 'Admin User',
|
||||
},
|
||||
created_at: '2025-01-01',
|
||||
updated_at: '2025-01-01',
|
||||
},
|
||||
],
|
||||
expenses: [
|
||||
{
|
||||
id: 1,
|
||||
po_number: 'PO-BOP-LTI-00001',
|
||||
category: 'NON-BOP',
|
||||
total: 110000,
|
||||
status: 'SELESAI',
|
||||
step_name: 'Approval Finance',
|
||||
step: 5,
|
||||
reference_number: 'BOP-LTI-00001',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
po_number: 'PO-BOP-LTI-00003',
|
||||
category: 'BOP',
|
||||
total: 110000,
|
||||
status: 'SELESAI',
|
||||
step_name: 'Approval Finance',
|
||||
step: 5,
|
||||
reference_number: 'BOP-LTI-00003',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}, 500); // Simulate network delay
|
||||
});
|
||||
// return new Promise((resolve) => {
|
||||
// setTimeout(() => {
|
||||
// resolve({
|
||||
// code: 200,
|
||||
// status: 'success',
|
||||
// message: 'Cek persyaratan closing kandang',
|
||||
// data: {
|
||||
// unfinished_expenses: id % 2 === 1 ? 2 : 0,
|
||||
// stock_remaining: [
|
||||
// {
|
||||
// id: 1,
|
||||
// product_id: 1,
|
||||
// warehouse_id: 1,
|
||||
// quantity: id % 2 === 1 ? 100 : 0,
|
||||
// product: {
|
||||
// id: 1,
|
||||
// name: 'Pakan Starter',
|
||||
// brand: 'Brand A',
|
||||
// sku: 'PKN-STR-001',
|
||||
// product_price: 15000,
|
||||
// selling_price: 17000,
|
||||
// tax: 0,
|
||||
// expiry_period: 365,
|
||||
// flags: ['active'],
|
||||
// uom: {
|
||||
// id: 1,
|
||||
// name: 'Kg',
|
||||
// created_user: {
|
||||
// id: 1,
|
||||
// id_user: 1,
|
||||
// email: 'admin@example.com',
|
||||
// name: 'Admin User',
|
||||
// },
|
||||
// created_at: '2024-01-01',
|
||||
// updated_at: '2024-01-01',
|
||||
// },
|
||||
// product_category: {
|
||||
// id: 1,
|
||||
// name: 'Pakan',
|
||||
// code: 'PKN',
|
||||
// created_user: {
|
||||
// id: 1,
|
||||
// id_user: 1,
|
||||
// email: 'admin@example.com',
|
||||
// name: 'Admin User',
|
||||
// },
|
||||
// created_at: '2024-01-01',
|
||||
// updated_at: '2024-01-01',
|
||||
// },
|
||||
// suppliers: [],
|
||||
// created_user: {
|
||||
// id: 1,
|
||||
// id_user: 1,
|
||||
// email: 'admin@example.com',
|
||||
// name: 'Admin User',
|
||||
// },
|
||||
// created_at: '2024-01-01',
|
||||
// updated_at: '2024-01-01',
|
||||
// },
|
||||
// warehouse: {
|
||||
// id: 1,
|
||||
// name: 'Gudang Utama',
|
||||
// type: 'AREA',
|
||||
// area: {
|
||||
// id: 1,
|
||||
// name: 'Area 1',
|
||||
// },
|
||||
// created_user: {
|
||||
// id: 1,
|
||||
// id_user: 1,
|
||||
// email: 'admin@example.com',
|
||||
// name: 'Admin User',
|
||||
// },
|
||||
// created_at: '2024-01-01',
|
||||
// updated_at: '2024-01-01',
|
||||
// },
|
||||
// created_user: {
|
||||
// id: 1,
|
||||
// id_user: 1,
|
||||
// email: 'admin@example.com',
|
||||
// name: 'Admin User',
|
||||
// },
|
||||
// created_at: '2025-01-01',
|
||||
// updated_at: '2025-01-01',
|
||||
// },
|
||||
// ],
|
||||
// expenses: [
|
||||
// {
|
||||
// id: 1,
|
||||
// po_number: 'PO-BOP-LTI-00001',
|
||||
// category: 'NON-BOP',
|
||||
// total: 110000,
|
||||
// status: id % 2 === 1 ? 'PENGAJUAN' : 'SELESAI',
|
||||
// step_name: id % 2 === 1 ? 'Approval Finance' : 'Selesai',
|
||||
// step: id % 2 === 1 ? 1 : 5,
|
||||
// reference_number: 'BOP-LTI-00001',
|
||||
// },
|
||||
// {
|
||||
// id: 3,
|
||||
// po_number: 'PO-BOP-LTI-00003',
|
||||
// category: 'BOP',
|
||||
// total: 110000,
|
||||
// status: id % 2 === 1 ? 'PENGAJUAN' : 'SELESAI',
|
||||
// step_name: id % 2 === 1 ? 'Approval Finance' : 'Selesai',
|
||||
// step: id % 2 === 1 ? 1 : 5,
|
||||
// reference_number: 'BOP-LTI-00003',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// });
|
||||
// }, 500); // Simulate network delay
|
||||
// });
|
||||
|
||||
/*
|
||||
// Original API call - uncomment when backend is ready
|
||||
try {
|
||||
const path = `${this.basePath}/${id}/closing/check`;
|
||||
@@ -181,7 +180,6 @@ export class ProjectFlockKandangService extends BaseApiService<
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user