- Checkpoint

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-08-21 15:32:22 -04:00
parent c89e4f1b41
commit 90532427b6
4 changed files with 52 additions and 9 deletions

View File

@@ -362,7 +362,25 @@ export function ProductionListConfigManager({
<div> <div>
<Form layout="vertical" form={form} onFinish={handleSaveConfig}> <Form layout="vertical" form={form} onFinish={handleSaveConfig}>
{isAddingNewProfile && ( {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 /> <Input />
</Form.Item> </Form.Item>
)} )}
@@ -376,13 +394,22 @@ export function ProductionListConfigManager({
> >
{t("general.actions.save")} {t("general.actions.save")}
</Button> </Button>
<Button
type="default"
onClick={() => {
setIsAddingNewProfile(true);
setOpen(true);
}}
>
{t("general.actions.saveas")}
</Button>
<Button <Button
onClick={() => { onClick={() => {
setIsAddingNewProfile(false); setIsAddingNewProfile(false);
setOpen(false); setOpen(false);
}} }}
> >
{t("general.actions.close")} {t("general.actions.cancel")}
</Button> </Button>
</Space> </Space>
</Form> </Form>
@@ -417,7 +444,14 @@ export function ProductionListConfigManager({
.map((config) => ( .map((config) => (
<Select.Option key={config.name} label={config.name}> <Select.Option key={config.name} label={config.name}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}> <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} {config.name}
</span> </span>
{config.name !== t("production.constants.main_profile") && ( {config.name !== t("production.constants.main_profile") && (

View File

@@ -1165,7 +1165,8 @@
"tryagain": "Try Again", "tryagain": "Try Again",
"view": "View", "view": "View",
"viewreleasenotes": "See What's Changed", "viewreleasenotes": "See What's Changed",
"remove_alert": "Are you sure you want to dismiss the alert?" "remove_alert": "Are you sure you want to dismiss the alert?",
"saveas": "Save As"
}, },
"errors": { "errors": {
"fcm": "You must allow notification permissions to have real time messaging. Click to try again.", "fcm": "You must allow notification permissions to have real time messaging. Click to try again.",
@@ -2788,7 +2789,9 @@
"errors": { "errors": {
"boardupdate": "Error encountered updating Job. {{message}}", "boardupdate": "Error encountered updating Job. {{message}}",
"removing": "Error removing from production board. {{error}}", "removing": "Error removing from production board. {{error}}",
"settings": "Error saving board settings: {{error}}" "settings": "Error saving board settings: {{error}}",
"name_exists": "A Profile with this name already exists. Please choose a different name.",
"name_required": "Profile name is required."
}, },
"labels": { "labels": {
"kiosk_mode": "Kiosk Mode", "kiosk_mode": "Kiosk Mode",

View File

@@ -1165,7 +1165,8 @@
"tryagain": "", "tryagain": "",
"view": "", "view": "",
"viewreleasenotes": "", "viewreleasenotes": "",
"remove_alert": "" "remove_alert": "",
"saveas": ""
}, },
"errors": { "errors": {
"fcm": "", "fcm": "",
@@ -2788,7 +2789,9 @@
"errors": { "errors": {
"boardupdate": "", "boardupdate": "",
"removing": "", "removing": "",
"settings": "" "settings": "",
"name_exists": "",
"name_required": ""
}, },
"labels": { "labels": {
"kiosk_mode": "", "kiosk_mode": "",

View File

@@ -1165,7 +1165,8 @@
"tryagain": "", "tryagain": "",
"view": "", "view": "",
"viewreleasenotes": "", "viewreleasenotes": "",
"remove_alert": "" "remove_alert": "",
"saveas": ""
}, },
"errors": { "errors": {
"fcm": "", "fcm": "",
@@ -2788,7 +2789,9 @@
"errors": { "errors": {
"boardupdate": "", "boardupdate": "",
"removing": "", "removing": "",
"settings": "" "settings": "",
"name_exists": "",
"name_required": ""
}, },
"labels": { "labels": {
"kiosk_mode": "", "kiosk_mode": "",