Ver a proveniência

fetch salaryEffective Info

tags/Baseline_30082024_FRONTEND_UAT
MSI\2Fi há 1 ano
ascendente
cometimento
62e536a420
2 ficheiros alterados com 11 adições e 2 eliminações
  1. +6
    -0
      src/app/api/staff/index.ts
  2. +5
    -2
      src/components/EditStaff/EditStaffWrapper.tsx

+ 6
- 0
src/app/api/staff/index.ts Ver ficheiro

@@ -116,6 +116,12 @@ export const fetchStaffWithoutTeam = cache(async () => {
});
});

export const fetchStaffSalaryEffectiveInfo = cache(async (id: number) => {
return serverFetchJson<SalaryEffectiveInfo[]>(`${BASE_API_URL}/salaryEffective?staffId=${id}`, {
next: { tags: ["staffs"] },
});
});

// export const fetchStaffCombo = cache(async () => {
// return serverFetchJson<Staff4TransferList>(`${BASE_API_URL}/staffs/combo`, {
// next: { tags: ["staffs"] },


+ 5
- 2
src/components/EditStaff/EditStaffWrapper.tsx Ver ficheiro

@@ -1,7 +1,7 @@
import React from "react";
import EditStaff, { comboItem } from "./EditStaff";
import EditStaffLoading from "./EditStaffLoading";
import { StaffResult, fetchIndivStaff, fetchStaff, fetchTeamLeads, preloadStaff } from "@/app/api/staff";
import { StaffResult, fetchIndivStaff, fetchStaff, fetchStaffSalaryEffectiveInfo, fetchTeamLeads, preloadStaff } from "@/app/api/staff";
import { useSearchParams } from "next/navigation";
import { fetchTeamCombo } from "@/app/api/team/actions";
import { fetchDepartmentCombo } from "@/app/api/departments/actions";
@@ -32,6 +32,7 @@ const EditStaffWrapper: React.FC<Props> & SubComponents = async ({
GradeCombo,
SkillCombo,
SalaryCombo,
SalaryEffectiveInfo,
] = await Promise.all([
fetchIndivStaff(id),
fetchCompanyCombo(),
@@ -41,6 +42,7 @@ const EditStaffWrapper: React.FC<Props> & SubComponents = async ({
fetchGradeCombo(),
fetchSkillCombo(),
fetchSalaryCombo(),
fetchStaffSalaryEffectiveInfo(id),
]);

console.log(SalaryCombo.records)
@@ -54,9 +56,10 @@ const EditStaffWrapper: React.FC<Props> & SubComponents = async ({
salary: SalaryCombo.records,
}

// [{id:0, salaryPoint: 1, date:"2021-05-05"}, {id:1, salaryPoint: 43, date:"2024-05-05"}]
console.log(Staff.data)

return <EditStaff Staff={Staff.data} combos={combos} SalaryEffectiveInfo={[{id:0, salaryPoint: 1, date:"2021-05-05"}, {id:1, salaryPoint: 43, date:"2024-05-05"}]}/>;
return <EditStaff Staff={Staff.data} combos={combos} SalaryEffectiveInfo={SalaryEffectiveInfo}/>;
};

EditStaffWrapper.Loading = EditStaffLoading;


Carregando…
Cancelar
Guardar