Merge branch 'feat/closing-kandang-hpp-ekspedisi-dan-penjualan' into 'development'

[FEAT/FE] Add Closing (Kandang) HPP Expedition (Ekspedisi) dan Sales (Penjualan)

See merge request mbugroup/lti-web-client!164
This commit is contained in:
Rivaldi A N S
2026-01-13 04:15:46 +00:00
2 changed files with 55 additions and 4 deletions
+21 -4
View File
@@ -35,13 +35,30 @@ const ClosingDetailPage = () => {
);
const { data: salesData, isLoading: isLoadingSales } = useSWR(
closingId ? `sales-${closingId}` : null,
() => ClosingApi.getPenjualan(Number(closingId))
kandangId
? `sales-${closingId}-${kandangId}`
: closingId
? `sales-${closingId}`
: null,
() =>
kandangId
? ClosingApi.getPenjualanByKandang(Number(closingId), Number(kandangId))
: ClosingApi.getPenjualan(Number(closingId))
);
const { data: hppEkspedisiData, isLoading: isLoadingHppEkspedisi } = useSWR(
closingId ? `hpp-ekspedisi-${closingId}` : null,
() => ClosingApi.getHppEkspedisi(Number(closingId))
kandangId
? `hpp-ekspedisi-${closingId}-${kandangId}`
: closingId
? `hpp-ekspedisi-${closingId}`
: null,
() =>
kandangId
? ClosingApi.getHppEkspedisiByKandang(
Number(closingId),
Number(kandangId)
)
: ClosingApi.getHppEkspedisi(Number(closingId))
);
if (!closingId) {
+34
View File
@@ -37,6 +37,23 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
}
}
async getPenjualanByKandang(
closingId: number,
kandangId: number
): Promise<BaseApiResponse<ClosingSales> | undefined> {
try {
const path = `${this.basePath}/${closingId}/${kandangId}/penjualan`;
return await httpClient<BaseApiResponse<ClosingSales>>(path, {
method: 'GET',
});
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<ClosingSales>>(error)) {
return error.response?.data;
}
return undefined;
}
}
async getAllIncomingSapronakFetcher(
endpoint: string
): Promise<BaseApiResponse<ClosingIncomingSapronak[]>> {
@@ -162,6 +179,23 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
return undefined;
}
}
async getHppEkspedisiByKandang(
closingId: number,
kandangId: number
): Promise<BaseApiResponse<ClosingHppExpedition> | undefined> {
try {
const path = `${this.basePath}/${closingId}/${kandangId}/expedition-hpp`;
return await httpClient<BaseApiResponse<ClosingHppExpedition>>(path, {
method: 'GET',
});
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<ClosingHppExpedition>>(error)) {
return error.response?.data;
}
return undefined;
}
}
}
export const ClosingApi = new ClosingApiService('/closings');