- allan found bug

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-04-11 19:12:06 -04:00
parent 8cce6ea6e3
commit 4d1480bb61
2 changed files with 20 additions and 10 deletions

View File

@@ -175,7 +175,11 @@ export function TaskUpsertModalComponent({
<Form.Item
label={t("tasks.fields.assigned_to")}
name="assigned_to"
initialValue={currentUser.email}
initialValue={
bodyshop.employees.find((employee) => employee.user_email === currentUser.email && employee.active)
? currentUser.email
: undefined
}
rules={[
{
required: true

View File

@@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { MUTATION_INSERT_NEW_TASK, MUTATION_UPDATE_TASK, QUERY_GET_TASK_BY_ID } from "../../graphql/tasks.queries";
import { QUERY_GET_TASKS_JOB_DETAILS_BY_ID } from "../../graphql/jobs.queries.js";
import { GET_JOB_BY_PK, QUERY_GET_TASKS_JOB_DETAILS_BY_ID } from "../../graphql/jobs.queries.js";
import { toggleModalVisible } from "../../redux/modals/modals.actions";
import { selectTaskUpsert } from "../../redux/modals/modals.selectors";
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
@@ -122,10 +122,13 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
refetchQueries: []
};
// We have relationship IDS, so we need to refetch the job
if (jobid || joblineid || billid || partsorderid) {
taskObject.refetchQueries.push("GET_JOB_BY_PK");
}
// We need to make sure this is updated everywhere
taskObject.refetchQueries.push({
query: GET_JOB_BY_PK,
variables: {
id: existingTask.jobid
}
});
// We have a relationship query, so we need to refetch the query
if (query && Object.keys(query).length) {
@@ -189,10 +192,13 @@ export function TaskUpsertModalContainer({ bodyshop, currentUser, taskUpsert, to
refetchQueries: []
};
// We have relationship IDS, so we need to refetch the job
if (jobid || joblineid || billid || partsorderid) {
newTaskObject.refetchQueries.push("GET_JOB_BY_PK");
}
// We need to make sure this is updated everywhere
newTaskObject.refetchQueries.push({
query: GET_JOB_BY_PK,
variables: {
id: values.jobid
}
});
// We have a relationship query, so we need to refetch the query
if (query && Object.keys(query).length) {