Refactor task modal opening.
This commit is contained in:
@@ -33,7 +33,7 @@ export function TimeTickeTaskModalContainer({
|
|||||||
toggleModalVisible
|
toggleModalVisible
|
||||||
}) {
|
}) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { context, visible, actions } = timeTicketTasksModal;
|
const { context, open, actions } = timeTicketTasksModal;
|
||||||
const [completedTasks, setCompletedTasks] = useState([]);
|
const [completedTasks, setCompletedTasks] = useState([]);
|
||||||
const [unassignedHours, setUnassignedHours] = useState(0);
|
const [unassignedHours, setUnassignedHours] = useState(0);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -59,13 +59,13 @@ export function TimeTickeTaskModalContainer({
|
|||||||
[client]
|
[client]
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (open) {
|
||||||
form.setFieldsValue({ ...context, task: null, timetickets: null });
|
form.setFieldsValue({ ...context, task: null, timetickets: null });
|
||||||
if (context.jobid) {
|
if (context.jobid) {
|
||||||
getCompletedTasks(context.jobid);
|
getCompletedTasks(context.jobid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [context.jobid, visible, getCompletedTasks, form, context]);
|
}, [context.jobid, open, getCompletedTasks, form, context]);
|
||||||
|
|
||||||
async function handleValueChange(changedValues, allValues) {
|
async function handleValueChange(changedValues, allValues) {
|
||||||
if (changedValues.jobid) {
|
if (changedValues.jobid) {
|
||||||
@@ -118,7 +118,7 @@ export function TimeTickeTaskModalContainer({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
open={visible}
|
open={open}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
|
|||||||
Reference in New Issue
Block a user