@@ -362,7 +362,25 @@ export function ProductionListConfigManager({
|
||||
<div>
|
||||
<Form layout="vertical" form={form} onFinish={handleSaveConfig}>
|
||||
{isAddingNewProfile && (
|
||||
<Form.Item label={t("production.labels.viewname")} name="name" rules={[{ required: true }]}>
|
||||
<Form.Item
|
||||
label={t("production.labels.viewname")}
|
||||
name="name"
|
||||
rules={[
|
||||
{ required: true, message: t("production.errors.name_required") },
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (!value) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
const nameExists = bodyshop.production_config.some((pc) => pc.name === value);
|
||||
if (nameExists) {
|
||||
return Promise.reject(new Error(t("production.errors.name_exists")));
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
@@ -376,13 +394,22 @@ export function ProductionListConfigManager({
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
<Button
|
||||
type="default"
|
||||
onClick={() => {
|
||||
setIsAddingNewProfile(true);
|
||||
setOpen(true);
|
||||
}}
|
||||
>
|
||||
{t("general.actions.saveas")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setIsAddingNewProfile(false);
|
||||
setOpen(false);
|
||||
}}
|
||||
>
|
||||
{t("general.actions.close")}
|
||||
{t("general.actions.cancel")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form>
|
||||
@@ -417,7 +444,14 @@ export function ProductionListConfigManager({
|
||||
.map((config) => (
|
||||
<Select.Option key={config.name} label={config.name}>
|
||||
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
||||
<span style={{ flex: 1, maxWidth: "80%", marginRight: "1rem", textOverflow: "ellipsis" }}>
|
||||
<span
|
||||
style={{
|
||||
flex: 1,
|
||||
maxWidth: "80%",
|
||||
marginRight: "1rem",
|
||||
textOverflow: "ellipsis"
|
||||
}}
|
||||
>
|
||||
{config.name}
|
||||
</span>
|
||||
{config.name !== t("production.constants.main_profile") && (
|
||||
|
||||
Reference in New Issue
Block a user