BOD-7 #comment Fixed up employee list + form screen to follow other screens and resolve antd breaking changes.

This commit is contained in:
Patrick Fic
2020-03-10 11:41:46 -07:00
parent 05d7aa7000
commit 024ddc2737
9 changed files with 137 additions and 87 deletions

View File

@@ -1,6 +1,6 @@
import { Button, DatePicker, Form, Input, InputNumber, Switch } from "antd";
import moment from "moment";
import React from "react";
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
export default function ShopEmployeesFormComponent({
@@ -9,8 +9,11 @@ export default function ShopEmployeesFormComponent({
handleFinish
}) {
const { t } = useTranslation();
useEffect(() => {
if (selectedEmployee) form.resetFields();
}, [selectedEmployee, form]);
if (!selectedEmployee) return "//TODO No employee selected.";
if (!selectedEmployee) return null;
return (
<Form
@@ -76,7 +79,7 @@ export default function ShopEmployeesFormComponent({
</Form.Item>
<Form.Item
label={t("employees.fields.flat_rate")}
name="active"
name="flat_rate"
valuePropName="checked"
>
<Switch />