|
- "use client";
-
- import {
- fetchAllShopsAction,
- findTruckLaneByShopIdAction,
- updateTruckLaneAction,
- updateLaneLogisticAction,
- deleteTruckLaneAction,
- createTruckAction,
- findAllUniqueTruckLaneCombinationsAction,
- findAllForRouteBoardAction,
- exportRouteLanesExcelAction,
- exportRouteReportExcelAction,
- exportTruckLaneVersionReportExcelAction,
- importRouteLanesExcelAction,
- parseRouteLanesExcelAction,
- type ParseRouteLanesExcelResponse,
- type RouteLaneImportPreviewRow,
- findAllShopsByTruckLanceCodeAndRemarkAction,
- findAllShopsByTruckLanceCodeAction,
- createTruckWithoutShopAction,
- updateTruckShopDetailsAction,
- findAllUniqueShopNamesAndCodesFromTrucksAction,
- findAllUniqueRemarksFromTrucksAction,
- findAllUniqueShopCodesFromTrucksAction,
- findAllUniqueShopNamesFromTrucksAction,
- createTruckLaneSnapshotAction,
- listTruckLaneVersionsAction,
- getTruckLaneVersionLinesAction,
- diffTruckLaneVersionsAction,
- restoreTruckLaneVersionAction,
- updateTruckLaneVersionNoteAction,
- type CreateTruckLaneSnapshotRequest,
- type UpdateTruckLaneVersionNoteRequest,
- type TruckLaneVersionResponse,
- type TruckLaneVersionLineResponse,
- type TruckLaneVersionDiffResponse,
- findAllByTruckLanceCodeAndDeletedFalseAction,
- findAllByTruckLanceCodeAndRemarkAndDeletedFalseAction,
- type SaveTruckLane,
- type UpdateLaneLogisticRequest,
- type DeleteTruckLane,
- type SaveTruckRequest,
- type UpdateTruckShopDetailsRequest,
- type CreateTruckWithoutShopRequest,
- type MessageResponse
- } from "./actions";
-
- export const fetchAllShopsClient = async (params?: Record<string, string | number | null>) => {
- return await fetchAllShopsAction(params);
- };
-
- export const findTruckLaneByShopIdClient = async (shopId: number | string) => {
- return await findTruckLaneByShopIdAction(shopId);
- };
-
- export const updateTruckLaneClient = async (data: SaveTruckLane): Promise<MessageResponse> => {
- return await updateTruckLaneAction(data);
- };
-
- export const updateLaneLogisticClient = async (
- data: UpdateLaneLogisticRequest,
- ): Promise<MessageResponse> => {
- return await updateLaneLogisticAction(data);
- };
-
- export const deleteTruckLaneClient = async (data: DeleteTruckLane): Promise<MessageResponse> => {
- return await deleteTruckLaneAction(data);
- };
-
- export const createTruckClient = async (data: SaveTruckRequest): Promise<MessageResponse> => {
- return await createTruckAction(data);
- };
-
- export const findAllUniqueTruckLaneCombinationsClient = async () => {
- return await findAllUniqueTruckLaneCombinationsAction();
- };
-
- export const findAllForRouteBoardClient = async () => {
- return await findAllForRouteBoardAction();
- };
-
- export const exportRouteLanesExcelClient = async (laneIds: string[]) => {
- return await exportRouteLanesExcelAction(laneIds);
- };
-
- export const exportRouteReportExcelClient = async (laneIds: string[]) => {
- return await exportRouteReportExcelAction(laneIds);
- };
-
- export const exportTruckLaneVersionReportExcelClient = async (
- fromVersionId: number,
- toVersionId: number,
- ) => {
- return await exportTruckLaneVersionReportExcelAction(fromVersionId, toVersionId);
- };
-
- export const importRouteLanesExcelClient = async (formData: FormData) => {
- return await importRouteLanesExcelAction(formData);
- };
-
- export const parseRouteLanesExcelClient = async (formData: FormData) => {
- return await parseRouteLanesExcelAction(formData);
- };
-
- export type { ParseRouteLanesExcelResponse, RouteLaneImportPreviewRow };
-
- export const findAllShopsByTruckLanceCodeAndRemarkClient = async (truckLanceCode: string, remark: string) => {
- return await findAllShopsByTruckLanceCodeAndRemarkAction(truckLanceCode, remark);
- };
-
- export const findAllShopsByTruckLanceCodeClient = async (truckLanceCode: string) => {
- return await findAllShopsByTruckLanceCodeAction(truckLanceCode);
- };
-
- export const findAllByTruckLanceCodeAndDeletedFalseClient = async (truckLanceCode: string) => {
- return await findAllByTruckLanceCodeAndDeletedFalseAction(truckLanceCode);
- };
-
- export const findAllByTruckLanceCodeAndRemarkAndDeletedFalseClient = async (
- truckLanceCode: string,
- remark: string | null | undefined,
- ) => {
- return await findAllByTruckLanceCodeAndRemarkAndDeletedFalseAction(truckLanceCode, remark);
- };
-
- export const updateTruckShopDetailsClient = async (data: UpdateTruckShopDetailsRequest): Promise<MessageResponse> => {
- return await updateTruckShopDetailsAction(data);
- };
-
- export const createTruckWithoutShopClient = async (data: CreateTruckWithoutShopRequest): Promise<MessageResponse> => {
- return await createTruckWithoutShopAction(data);
- };
-
- export const findAllUniqueShopNamesAndCodesFromTrucksClient = async () => {
- return await findAllUniqueShopNamesAndCodesFromTrucksAction();
- };
-
- export const findAllUniqueRemarksFromTrucksClient = async () => {
- return await findAllUniqueRemarksFromTrucksAction();
- };
-
- export const findAllUniqueShopCodesFromTrucksClient = async () => {
- return await findAllUniqueShopCodesFromTrucksAction();
- };
-
- export const findAllUniqueShopNamesFromTrucksClient = async () => {
- return await findAllUniqueShopNamesFromTrucksAction();
- };
-
- export const createTruckLaneSnapshotClient = async (
- data: CreateTruckLaneSnapshotRequest,
- ): Promise<TruckLaneVersionResponse> => {
- return await createTruckLaneSnapshotAction(data);
- };
-
- export const listTruckLaneVersionsClient = async (
- truckLanceCode?: string | null,
- ): Promise<TruckLaneVersionResponse[]> => {
- return await listTruckLaneVersionsAction(truckLanceCode);
- };
-
- export const getTruckLaneVersionLinesClient = async (
- versionId: number,
- ): Promise<TruckLaneVersionLineResponse[]> => {
- return await getTruckLaneVersionLinesAction(versionId);
- };
-
- export const diffTruckLaneVersionsClient = async (
- fromVersionId: number,
- toVersionId: number,
- ): Promise<TruckLaneVersionDiffResponse> => {
- return await diffTruckLaneVersionsAction(fromVersionId, toVersionId);
- };
-
- export const restoreTruckLaneVersionClient = async (versionId: number): Promise<MessageResponse> => {
- return await restoreTruckLaneVersionAction(versionId);
- };
-
- export const updateTruckLaneVersionNoteClient = async (
- versionId: number,
- data: UpdateTruckLaneVersionNoteRequest,
- ): Promise<TruckLaneVersionResponse> => {
- return await updateTruckLaneVersionNoteAction(versionId, data);
- };
-
- export default fetchAllShopsClient;
|