- fix regression in settings
- add defaults Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -14,8 +14,8 @@ const LayoutSettings = ({ t }) => (
|
|||||||
name: "orientation",
|
name: "orientation",
|
||||||
label: t("production.labels.orientation"),
|
label: t("production.labels.orientation"),
|
||||||
options: [
|
options: [
|
||||||
{ value: "vertical", label: t("production.labels.vertical") },
|
{ value: true, label: t("production.labels.vertical") },
|
||||||
{ value: "horizontal", label: t("production.labels.horizontal") }
|
{ value: false, label: t("production.labels.horizontal") }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -31,24 +31,24 @@ const LayoutSettings = ({ t }) => (
|
|||||||
name: "compact",
|
name: "compact",
|
||||||
label: t("production.labels.compact"),
|
label: t("production.labels.compact"),
|
||||||
options: [
|
options: [
|
||||||
{ value: "tall", label: t("production.labels.tall") },
|
{ value: true, label: t("production.labels.tall") },
|
||||||
{ value: "wide", label: t("production.labels.wide") }
|
{ value: false, label: t("production.labels.wide") }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cardcolor",
|
name: "cardcolor",
|
||||||
label: t("production.labels.cardcolor"),
|
label: t("production.labels.cardcolor"),
|
||||||
options: [
|
options: [
|
||||||
{ value: "on", label: t("production.labels.on") },
|
{ value: true, label: t("production.labels.on") },
|
||||||
{ value: "off", label: t("production.labels.off") }
|
{ value: false, label: t("production.labels.off") }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "kiosk",
|
name: "kiosk",
|
||||||
label: t("production.labels.kiosk_mode"),
|
label: t("production.labels.kiosk_mode"),
|
||||||
options: [
|
options: [
|
||||||
{ value: "on", label: t("production.labels.on") },
|
{ value: true, label: t("production.labels.on") },
|
||||||
{ value: "off", label: t("production.labels.off") }
|
{ value: false, label: t("production.labels.off") }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
].map(({ name, label, options }) => (
|
].map(({ name, label, options }) => (
|
||||||
@@ -56,7 +56,7 @@ const LayoutSettings = ({ t }) => (
|
|||||||
<Form.Item name={name} label={label}>
|
<Form.Item name={name} label={label}>
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
{options.map((option) => (
|
{options.map((option) => (
|
||||||
<Radio.Button key={option.value} value={option.value}>
|
<Radio.Button key={option.value.toString()} value={option.value}>
|
||||||
{option.label}
|
{option.label}
|
||||||
</Radio.Button>
|
</Radio.Button>
|
||||||
))}
|
))}
|
||||||
@@ -67,6 +67,7 @@ const LayoutSettings = ({ t }) => (
|
|||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|
||||||
const InformationSettings = ({ t }) => (
|
const InformationSettings = ({ t }) => (
|
||||||
<Card title={t("production.settings.information")} style={{ minWidth: "50vw", marginTop: 10 }}>
|
<Card title={t("production.settings.information")} style={{ minWidth: "50vw", marginTop: 10 }}>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
@@ -162,7 +163,7 @@ export default function ProductionBoardKanbanSettings({ associationSettings, par
|
|||||||
const result = await updateKbSettings({
|
const result = await updateKbSettings({
|
||||||
variables: {
|
variables: {
|
||||||
id: associationSettings?.id,
|
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 handleValuesChange = () => setHasChanges(true);
|
||||||
|
|
||||||
|
const handleRestoreDefaults = () => {
|
||||||
|
form.setFieldsValue({
|
||||||
|
...defaultKanbanSettings,
|
||||||
|
statisticsOrder: defaultKanbanSettings.statisticsOrder
|
||||||
|
});
|
||||||
|
setStatisticsOrder(defaultKanbanSettings.statisticsOrder);
|
||||||
|
setHasChanges(true);
|
||||||
|
};
|
||||||
|
|
||||||
const overlay = (
|
const overlay = (
|
||||||
<Card>
|
<Card>
|
||||||
<Form form={form} onFinish={handleFinish} layout="vertical" onValuesChange={handleValuesChange}>
|
<Form form={form} onFinish={handleFinish} layout="vertical" onValuesChange={handleValuesChange}>
|
||||||
@@ -219,6 +229,11 @@ export default function ProductionBoardKanbanSettings({ associationSettings, par
|
|||||||
{t("general.actions.cancel")}
|
{t("general.actions.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col span={8}>
|
||||||
|
<Button block onClick={handleRestoreDefaults}>
|
||||||
|
{t("general.actions.defaults")}
|
||||||
|
</Button>
|
||||||
|
</Col>
|
||||||
<Col span={8}>
|
<Col span={8}>
|
||||||
<Button block onClick={form.submit} loading={loading} type="primary" disabled={!hasChanges}>
|
<Button block onClick={form.submit} loading={loading} type="primary" disabled={!hasChanges}>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
|
|||||||
@@ -1129,6 +1129,7 @@
|
|||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
"actions": {
|
"actions": {
|
||||||
|
"defaults": "Defaults",
|
||||||
"add": "Add",
|
"add": "Add",
|
||||||
"calculate": "Calculate",
|
"calculate": "Calculate",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
|
|||||||
@@ -1129,6 +1129,7 @@
|
|||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
"actions": {
|
"actions": {
|
||||||
|
"defaults": "defaults",
|
||||||
"add": "",
|
"add": "",
|
||||||
"calculate": "",
|
"calculate": "",
|
||||||
"cancel": "",
|
"cancel": "",
|
||||||
|
|||||||
@@ -1129,6 +1129,7 @@
|
|||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
"actions": {
|
"actions": {
|
||||||
|
"defaults": "",
|
||||||
"add": "",
|
"add": "",
|
||||||
"calculate": "",
|
"calculate": "",
|
||||||
"cancel": "",
|
"cancel": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user