feature/IO-3624-Shop-Config-UX-Refresh - Add missing es/fr keys to translations
This commit is contained in:
@@ -43,6 +43,9 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [form] = useForm();
|
const [form] = useForm();
|
||||||
const employeeRates = Form.useWatch(["rates"], form) || [];
|
const employeeRates = Form.useWatch(["rates"], form) || [];
|
||||||
|
const employeeNumber = Form.useWatch("employee_number", form);
|
||||||
|
const firstName = Form.useWatch("first_name", form);
|
||||||
|
const lastName = Form.useWatch("last_name", form);
|
||||||
const employeeOptionsColProps = {
|
const employeeOptionsColProps = {
|
||||||
xs: 24,
|
xs: 24,
|
||||||
sm: 12,
|
sm: 12,
|
||||||
@@ -61,6 +64,10 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
nextFetchPolicy: "network-only"
|
nextFetchPolicy: "network-only"
|
||||||
});
|
});
|
||||||
const notification = useNotification();
|
const notification = useNotification();
|
||||||
|
const employeeTitleName = [firstName, lastName].filter(Boolean).join(" ").trim();
|
||||||
|
const employeeCardTitle =
|
||||||
|
[employeeNumber, employeeTitleName].filter(Boolean).join(" - ") ||
|
||||||
|
(search.employeeId === "new" ? t("employees.actions.new") : t("bodyshop.labels.employees"));
|
||||||
|
|
||||||
const {
|
const {
|
||||||
treatments: { Enhanced_Payroll }
|
treatments: { Enhanced_Payroll }
|
||||||
@@ -179,6 +186,7 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
|
title={employeeCardTitle}
|
||||||
extra={
|
extra={
|
||||||
<Button type="primary" onClick={() => form.submit()}>
|
<Button type="primary" onClick={() => form.submit()}>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
@@ -379,9 +387,7 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("employees.fields.cost_center")}
|
label={t("employees.fields.cost_center")}
|
||||||
key={`${index}`}
|
|
||||||
name={[field.name, "cost_center"]}
|
name={[field.name, "cost_center"]}
|
||||||
valuePropName="value"
|
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
required: true
|
required: true
|
||||||
@@ -406,7 +412,6 @@ export function ShopEmployeesFormComponent({ bodyshop }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("employees.fields.rate")}
|
label={t("employees.fields.rate")}
|
||||||
key={`${index}`}
|
|
||||||
name={[field.name, "rate"]}
|
name={[field.name, "rate"]}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,14 +113,23 @@ export function ShopEmployeeTeamsFormComponent({ bodyshop }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!search.employeeTeamId || isNewTeam || loading) return;
|
if (!search.employeeTeamId || isNewTeam || loading) return;
|
||||||
|
let hydrationFrameId;
|
||||||
|
|
||||||
if (data?.employee_teams_by_pk?.id === search.employeeTeamId) {
|
if (data?.employee_teams_by_pk?.id === search.employeeTeamId) {
|
||||||
form.setFieldsValue(normalizeEmployeeTeam(data.employee_teams_by_pk));
|
form.setFieldsValue(normalizeEmployeeTeam(data.employee_teams_by_pk));
|
||||||
setHydratedTeamId(search.employeeTeamId);
|
hydrationFrameId = window.requestAnimationFrame(() => {
|
||||||
|
setHydratedTeamId(search.employeeTeamId);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
setHydratedTeamId(search.employeeTeamId);
|
hydrationFrameId = window.requestAnimationFrame(() => {
|
||||||
|
setHydratedTeamId(search.employeeTeamId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (hydrationFrameId) window.cancelAnimationFrame(hydrationFrameId);
|
||||||
|
};
|
||||||
}, [data, form, isNewTeam, loading, search.employeeTeamId]);
|
}, [data, form, isNewTeam, loading, search.employeeTeamId]);
|
||||||
|
|
||||||
const [updateEmployeeTeam] = useMutation(UPDATE_EMPLOYEE_TEAM);
|
const [updateEmployeeTeam] = useMutation(UPDATE_EMPLOYEE_TEAM);
|
||||||
@@ -243,7 +252,7 @@ export function ShopEmployeeTeamsFormComponent({ bodyshop }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={teamCardTitle}
|
title={isTeamHydrating ? undefined : teamCardTitle}
|
||||||
extra={
|
extra={
|
||||||
<Button type="primary" onClick={() => form.submit()} disabled={isTeamHydrating}>
|
<Button type="primary" onClick={() => form.submit()} disabled={isTeamHydrating}>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
@@ -291,7 +300,7 @@ export function ShopEmployeeTeamsFormComponent({ bodyshop }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Form.Item key={field.key} style={{ padding: 0, margin: 2 }}>
|
<Form.Item key={field.key} style={{ padding: 0, margin: 2 }}>
|
||||||
<Form.Item label={t("employees.fields.id")} key={`${index}`} name={[field.name, "id"]} hidden>
|
<Form.Item name={[field.name, "id"]} hidden>
|
||||||
<Input type="hidden" />
|
<Input type="hidden" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<LayoutFormRow
|
<LayoutFormRow
|
||||||
@@ -320,7 +329,6 @@ export function ShopEmployeeTeamsFormComponent({ bodyshop }) {
|
|||||||
<Col {...TEAM_MEMBER_PRIMARY_FIELD_COLS.employee}>
|
<Col {...TEAM_MEMBER_PRIMARY_FIELD_COLS.employee}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("employee_teams.fields.employeeid")}
|
label={t("employee_teams.fields.employeeid")}
|
||||||
key={`${index}`}
|
|
||||||
name={[field.name, "employeeid"]}
|
name={[field.name, "employeeid"]}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
@@ -334,7 +342,6 @@ export function ShopEmployeeTeamsFormComponent({ bodyshop }) {
|
|||||||
<Col {...TEAM_MEMBER_PRIMARY_FIELD_COLS.allocation}>
|
<Col {...TEAM_MEMBER_PRIMARY_FIELD_COLS.allocation}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("employee_teams.fields.allocation_percentage")}
|
label={t("employee_teams.fields.allocation_percentage")}
|
||||||
key={`${index}`}
|
|
||||||
name={[field.name, "percentage"]}
|
name={[field.name, "percentage"]}
|
||||||
rules={[
|
rules={[
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user