Merge branch 'development' into feat/FE/daily-checklist

This commit is contained in:
ValdiANS
2026-01-12 17:37:20 +07:00
77 changed files with 4736 additions and 3913 deletions
+3 -2
View File
@@ -92,10 +92,11 @@ export class ClosingApiService extends BaseApiService<Closing, null, null> {
}
async getPerhitunganSapronak(
id: number
id: number,
projectKandangId?: number
): Promise<BaseApiResponse<ClosingSapronakCalculation> | undefined> {
try {
const path = `${this.basePath}/${id}/perhitungan_sapronak`;
const path = `${this.basePath}/${id}${projectKandangId ? `/${projectKandangId}` : ''}/perhitungan_sapronak`;
return await httpClient<BaseApiResponse<ClosingSapronakCalculation>>(
path,
{
+8 -17
View File
@@ -1,13 +1,9 @@
import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { DashboardProduction } from '@/types/api/dashboard/dashboard-production';
import { getDummySingle } from '@/dummy/dashboard/dashboard.production.dummy';
import { Dashboard } from '@/types/api/dashboard/dashboard';
import { httpClientFetcher } from '@/services/http/client';
class DashboardService extends BaseApiService<
DashboardProduction,
unknown,
unknown
> {
class DashboardService extends BaseApiService<Dashboard, unknown, unknown> {
constructor(basePath: string) {
super(basePath);
}
@@ -16,19 +12,14 @@ class DashboardService extends BaseApiService<
* Fetch dashboard production data
* @param endpoint - The endpoint URL with query parameters
* @returns Promise with BaseApiResponse containing DashboardProduction
*
* Note: Currently using dummy data. When real API is ready,
* uncomment the line below and remove getDummySingle() call:
* return await this.customRequest<BaseApiResponse<DashboardProduction>>(endpoint);
*/
async getDashboardProductionFetcher(
endpoint: string
): Promise<BaseApiResponse<DashboardProduction>> {
// For now, we're using dummy data regardless of the endpoint
// The endpoint parameter is kept for future API integration
console.log('Fetching dashboard data with endpoint:', endpoint);
return await getDummySingle();
): Promise<BaseApiResponse<Dashboard> | undefined> {
return await httpClientFetcher<BaseApiResponse<Dashboard>>(
`${endpoint ? endpoint : this.basePath}`
);
}
}
export const DashboardApi = new DashboardService('/dashboard');
export const DashboardApi = new DashboardService('/dashboards');
+116 -8
View File
@@ -169,13 +169,13 @@ export class ExpenseApiService extends BaseApiService<
}
}
async approveManager(
async approveHeadArea(
id: number,
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const approveRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/manager`,
`${this.basePath}/approvals/head-area`,
{
method: 'POST',
body: {
@@ -196,13 +196,67 @@ export class ExpenseApiService extends BaseApiService<
}
}
async bulkApproveManager(
async bulkApproveHeadArea(
ids: number[],
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const bulkApproveRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/manager`,
`${this.basePath}/approvals/head-area`,
{
method: 'POST',
body: {
action: 'APPROVED',
approvable_ids: ids,
notes: notes,
},
}
);
return bulkApproveRes;
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
return error.response?.data;
}
return undefined;
}
}
async approveUnitVicePresident(
id: number,
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const approveRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/unit-vice-president`,
{
method: 'POST',
body: {
action: 'APPROVED',
approvable_ids: [id],
notes: notes,
},
}
);
return approveRes;
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
return error.response?.data;
}
return undefined;
}
}
async bulkApproveUnitVicePresident(
ids: number[],
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const bulkApproveRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/unit-vice-president`,
{
method: 'POST',
body: {
@@ -277,13 +331,13 @@ export class ExpenseApiService extends BaseApiService<
}
}
async rejectManager(
async rejectHeadArea(
id: number,
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const rejectRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/manager`,
`${this.basePath}/approvals/head-area`,
{
method: 'POST',
body: {
@@ -304,13 +358,67 @@ export class ExpenseApiService extends BaseApiService<
}
}
async bulkRejectManager(
async bulkRejectHeadArea(
ids: number[],
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const bulkRejectRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/manager`,
`${this.basePath}/approvals/head-area`,
{
method: 'POST',
body: {
action: 'REJECTED',
approvable_ids: ids,
notes: notes,
},
}
);
return bulkRejectRes;
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
return error.response?.data;
}
return undefined;
}
}
async rejectUnitVicePresident(
id: number,
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const rejectRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/unit-vice-president`,
{
method: 'POST',
body: {
action: 'REJECTED',
approvable_ids: [id],
notes: notes,
},
}
);
return rejectRes;
} catch (error) {
if (axios.isAxiosError<BaseApiResponse<Expense>>(error)) {
return error.response?.data;
}
return undefined;
}
}
async bulkRejectUnitVicePresident(
ids: number[],
notes?: string
): Promise<BaseApiResponse<Expense> | undefined> {
try {
const bulkRejectRes = await httpClient<BaseApiResponse<Expense>>(
`${this.basePath}/approvals/unit-vice-president`,
{
method: 'POST',
body: {
+66
View File
@@ -0,0 +1,66 @@
import { BaseApiService } from '@/services/api/base';
import { BaseApiResponse } from '@/types/api/api-general';
import { CustomerPaymentReport } from '@/types/api/report/customer-payment';
import { DebtSupplier } from '@/types/api/report/debt-supplier';
export class FinanceApiService extends BaseApiService<
CustomerPaymentReport,
unknown,
unknown
> {
constructor(basePath: string) {
super(basePath);
}
async getCustomerPaymentReport(
customer_id?: string,
sales?: string,
filter_by?: 'do_date',
start_date?: string,
end_date?: string,
page?: number,
limit?: number
): Promise<BaseApiResponse<CustomerPaymentReport> | undefined> {
return await this.customRequest<BaseApiResponse<CustomerPaymentReport>>(
`customer-payment`,
{
method: 'GET',
params: {
customer_id: customer_id,
sales: sales,
filter_by: filter_by,
start_date: start_date,
end_date: end_date,
page: page,
limit: limit,
},
}
);
}
async getDebtSupplierReport(
supplier_ids?: string,
filter_by?: string,
start_date?: string,
end_date?: string,
page?: number,
limit?: number
): Promise<BaseApiResponse<DebtSupplier[]> | undefined> {
return await this.customRequest<BaseApiResponse<DebtSupplier[]>>(
`debt-supplier`,
{
method: 'GET',
params: {
supplier_ids: supplier_ids,
filter_by: filter_by,
start_date: start_date,
end_date: end_date,
page: page,
limit: limit,
},
}
);
}
}
export const FinanceApi = new FinanceApiService('reports');