- fix regression in settings

- add defaults

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-08-01 11:51:13 -04:00
parent ff184926fc
commit defadf70e3
4 changed files with 28 additions and 10 deletions

View File

@@ -14,8 +14,8 @@ const LayoutSettings = ({ t }) => (
name: "orientation",
label: t("production.labels.orientation"),
options: [
{ value: "vertical", label: t("production.labels.vertical") },
{ value: "horizontal", label: t("production.labels.horizontal") }
{ value: true, label: t("production.labels.vertical") },
{ value: false, label: t("production.labels.horizontal") }
]
},
{
@@ -31,24 +31,24 @@ const LayoutSettings = ({ t }) => (
name: "compact",
label: t("production.labels.compact"),
options: [
{ value: "tall", label: t("production.labels.tall") },
{ value: "wide", label: t("production.labels.wide") }
{ value: true, label: t("production.labels.tall") },
{ value: false, label: t("production.labels.wide") }
]
},
{
name: "cardcolor",
label: t("production.labels.cardcolor"),
options: [
{ value: "on", label: t("production.labels.on") },
{ value: "off", label: t("production.labels.off") }
{ value: true, label: t("production.labels.on") },
{ value: false, label: t("production.labels.off") }
]
},
{
name: "kiosk",
label: t("production.labels.kiosk_mode"),
options: [
{ value: "on", label: t("production.labels.on") },
{ value: "off", label: t("production.labels.off") }
{ value: true, label: t("production.labels.on") },
{ value: false, label: t("production.labels.off") }
]
}
].map(({ name, label, options }) => (
@@ -56,7 +56,7 @@ const LayoutSettings = ({ t }) => (
<Form.Item name={name} label={label}>
<Radio.Group>
{options.map((option) => (
<Radio.Button key={option.value} value={option.value}>
<Radio.Button key={option.value.toString()} value={option.value}>
{option.label}
</Radio.Button>
))}
@@ -67,6 +67,7 @@ const LayoutSettings = ({ t }) => (
</Row>
</Card>
);
const InformationSettings = ({ t }) => (
<Card title={t("production.settings.information")} style={{ minWidth: "50vw", marginTop: 10 }}>
<Row gutter={[16, 16]}>
@@ -162,7 +163,7 @@ export default function ProductionBoardKanbanSettings({ associationSettings, par
const result = await updateKbSettings({
variables: {
id: associationSettings?.id,
ks: { ...values, statisticsOrder }
ks: { ...associationSettings.kanban_settings, ...values, statisticsOrder }
}
});
@@ -183,6 +184,15 @@ export default function ProductionBoardKanbanSettings({ associationSettings, par
const handleValuesChange = () => setHasChanges(true);
const handleRestoreDefaults = () => {
form.setFieldsValue({
...defaultKanbanSettings,
statisticsOrder: defaultKanbanSettings.statisticsOrder
});
setStatisticsOrder(defaultKanbanSettings.statisticsOrder);
setHasChanges(true);
};
const overlay = (
<Card>
<Form form={form} onFinish={handleFinish} layout="vertical" onValuesChange={handleValuesChange}>
@@ -219,6 +229,11 @@ export default function ProductionBoardKanbanSettings({ associationSettings, par
{t("general.actions.cancel")}
</Button>
</Col>
<Col span={8}>
<Button block onClick={handleRestoreDefaults}>
{t("general.actions.defaults")}
</Button>
</Col>
<Col span={8}>
<Button block onClick={form.submit} loading={loading} type="primary" disabled={!hasChanges}>
{t("general.actions.save")}

View File

@@ -1129,6 +1129,7 @@
},
"general": {
"actions": {
"defaults": "Defaults",
"add": "Add",
"calculate": "Calculate",
"cancel": "Cancel",

View File

@@ -1129,6 +1129,7 @@
},
"general": {
"actions": {
"defaults": "defaults",
"add": "",
"calculate": "",
"cancel": "",

View File

@@ -1129,6 +1129,7 @@
},
"general": {
"actions": {
"defaults": "",
"add": "",
"calculate": "",
"cancel": "",