Merged in release/2021-10-08 (pull request #245)
release/2021-10-08 Approved-by: Patrick Fic
This commit is contained in:
@@ -29415,6 +29415,32 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<folder_node>
|
||||||
|
<name>errors</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>inserting</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
|
</children>
|
||||||
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
<name>fields</name>
|
<name>fields</name>
|
||||||
<children>
|
<children>
|
||||||
@@ -29549,6 +29575,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>notetoadd</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export default function GlobalSearch() {
|
|||||||
}`,
|
}`,
|
||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/owners/${owner.id}`}>
|
<Link to={`/manage/owners/${owner.id}`}>
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
<Space size="small" split={<Divider type="vertical" />} wrap>
|
||||||
<span>{`${owner.ownr_fn || ""} ${owner.ownr_ln || ""} ${
|
<span>{`${owner.ownr_fn || ""} ${owner.ownr_ln || ""} ${
|
||||||
owner.ownr_co_nm || ""
|
owner.ownr_co_nm || ""
|
||||||
}`}</span>
|
}`}</span>
|
||||||
|
|||||||
@@ -296,18 +296,17 @@ export function JobLinesComponent({
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await deleteJobLine({
|
await deleteJobLine({
|
||||||
variables: { joblineId: record.id },
|
variables: { joblineId: record.id },
|
||||||
// update(cache) {
|
update(cache) {
|
||||||
// cache.modify({
|
cache.modify({
|
||||||
// id: cache.identify(job),
|
fields: {
|
||||||
// fields: {
|
joblines(existingJobLines, { readField }) {
|
||||||
// joblines(existingJobLines, { readField }) {
|
return existingJobLines.filter(
|
||||||
// return existingJobLines.filter(
|
(jlRef) => record.id !== readField("id", jlRef)
|
||||||
// (jlRef) => record.id !== readField("id", jlRef)
|
);
|
||||||
// );
|
},
|
||||||
// },
|
},
|
||||||
// },
|
});
|
||||||
// });
|
},
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
await axios.post("/job/totalsssu", {
|
await axios.post("/job/totalsssu", {
|
||||||
id: job.id,
|
id: job.id,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import ProductionListColumnPaintPriority from "./production-list-columns.paintpr
|
|||||||
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||||
|
import ProductionListLastContacted from "./production-list-columns.lastcontacted.component";
|
||||||
|
|
||||||
const r = ({ technician, state }) => {
|
const r = ({ technician, state }) => {
|
||||||
return [
|
return [
|
||||||
@@ -106,9 +107,7 @@ const r = ({ technician, state }) => {
|
|||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "date_last_contacted" &&
|
state.sortedInfo.columnKey === "date_last_contacted" &&
|
||||||
state.sortedInfo.order,
|
state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionListLastContacted record={record} />,
|
||||||
<ProductionListDate time record={record} field="date_last_contacted" />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.scheduled_delivery"),
|
title: i18n.t("jobs.fields.scheduled_delivery"),
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Button, Card, Dropdown, Form, Input, notification, Space } from "antd";
|
||||||
|
import moment from "moment";
|
||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { INSERT_NEW_NOTE } from "../../graphql/notes.queries";
|
||||||
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
|
import FormDateTimePickerComponent from "../form-date-time-picker/form-date-time-picker.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
currentUser: selectCurrentUser,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ProductionLastContacted);
|
||||||
|
|
||||||
|
export function ProductionLastContacted({ currentUser, record }) {
|
||||||
|
const [updateAlert] = useMutation(UPDATE_JOB);
|
||||||
|
const [insertNote] = useMutation(INSERT_NEW_NOTE);
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const handleFinish = async ({ date_last_contacted, note }) => {
|
||||||
|
logImEXEvent("production_last_contacted");
|
||||||
|
|
||||||
|
//e.stopPropagation();
|
||||||
|
const res = await updateAlert({
|
||||||
|
variables: {
|
||||||
|
jobId: record.id,
|
||||||
|
job: {
|
||||||
|
date_last_contacted,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res.errors) {
|
||||||
|
notification.open({
|
||||||
|
type: "error",
|
||||||
|
message: t("jobs.errors.saving", {
|
||||||
|
error: JSON.stringify(res.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (note && note.trim() !== "") {
|
||||||
|
//Insert a note.
|
||||||
|
const res2 = await insertNote({
|
||||||
|
variables: {
|
||||||
|
noteInput: {
|
||||||
|
jobid: record.id,
|
||||||
|
text: note,
|
||||||
|
created_by: currentUser.email,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res2.errors) {
|
||||||
|
notification.open({
|
||||||
|
type: "error",
|
||||||
|
message: t("notes.errors.inserting", {
|
||||||
|
error: JSON.stringify(res.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (record.refetch) record.refetch();
|
||||||
|
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (visible) {
|
||||||
|
form.setFieldsValue({
|
||||||
|
note: null,
|
||||||
|
date_last_contacted:
|
||||||
|
record.date_last_contacted && moment(record.date_last_contacted),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [visible, form, record.date_last_contacted]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Dropdown
|
||||||
|
//trigger={["click"]}
|
||||||
|
visible={visible}
|
||||||
|
style={{
|
||||||
|
height: "19px",
|
||||||
|
}}
|
||||||
|
overlay={
|
||||||
|
<Card
|
||||||
|
style={{ padding: "1rem" }}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<Form form={form} onFinish={handleFinish} layout="vertical">
|
||||||
|
<Form.Item name="date_last_contacted">
|
||||||
|
<FormDateTimePickerComponent />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("notes.labels.notetoadd")} name="note">
|
||||||
|
<Input.TextArea rows={4} />
|
||||||
|
</Form.Item>
|
||||||
|
<Space>
|
||||||
|
<Button type="primary" htmlType="submit">
|
||||||
|
{t("general.actions.save")}
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setVisible(false)}>
|
||||||
|
{t("general.actions.close")}
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Form>
|
||||||
|
</Card>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
onClick={() => setVisible(true)}
|
||||||
|
style={{
|
||||||
|
height: "19px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<DateFormatter bordered={false}>
|
||||||
|
{record.date_last_contacted}
|
||||||
|
</DateFormatter>
|
||||||
|
</div>
|
||||||
|
</Dropdown>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1739,6 +1739,9 @@
|
|||||||
"edit": "Edit Note",
|
"edit": "Edit Note",
|
||||||
"new": "New Note"
|
"new": "New Note"
|
||||||
},
|
},
|
||||||
|
"errors": {
|
||||||
|
"inserting": "Error inserting note. {{error}}"
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"createdby": "Created By",
|
"createdby": "Created By",
|
||||||
"critical": "Critical",
|
"critical": "Critical",
|
||||||
@@ -1747,7 +1750,8 @@
|
|||||||
"updatedat": "Updated At"
|
"updatedat": "Updated At"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"newnoteplaceholder": "Add a note..."
|
"newnoteplaceholder": "Add a note...",
|
||||||
|
"notetoadd": "Note to Add"
|
||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"create": "Note created successfully.",
|
"create": "Note created successfully.",
|
||||||
|
|||||||
@@ -1739,6 +1739,9 @@
|
|||||||
"edit": "Editar nota",
|
"edit": "Editar nota",
|
||||||
"new": "Nueva nota"
|
"new": "Nueva nota"
|
||||||
},
|
},
|
||||||
|
"errors": {
|
||||||
|
"inserting": ""
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"createdby": "Creado por",
|
"createdby": "Creado por",
|
||||||
"critical": "Crítico",
|
"critical": "Crítico",
|
||||||
@@ -1747,7 +1750,8 @@
|
|||||||
"updatedat": "Actualizado en"
|
"updatedat": "Actualizado en"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"newnoteplaceholder": "Agrega una nota..."
|
"newnoteplaceholder": "Agrega una nota...",
|
||||||
|
"notetoadd": ""
|
||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"create": "Nota creada con éxito.",
|
"create": "Nota creada con éxito.",
|
||||||
|
|||||||
@@ -1739,6 +1739,9 @@
|
|||||||
"edit": "Note éditée",
|
"edit": "Note éditée",
|
||||||
"new": "Nouvelle note"
|
"new": "Nouvelle note"
|
||||||
},
|
},
|
||||||
|
"errors": {
|
||||||
|
"inserting": ""
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"createdby": "Créé par",
|
"createdby": "Créé par",
|
||||||
"critical": "Critique",
|
"critical": "Critique",
|
||||||
@@ -1747,7 +1750,8 @@
|
|||||||
"updatedat": "Mis à jour à"
|
"updatedat": "Mis à jour à"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"newnoteplaceholder": "Ajouter une note..."
|
"newnoteplaceholder": "Ajouter une note...",
|
||||||
|
"notetoadd": ""
|
||||||
},
|
},
|
||||||
"successes": {
|
"successes": {
|
||||||
"create": "Remarque créée avec succès.",
|
"create": "Remarque créée avec succès.",
|
||||||
|
|||||||
51
hasura/migrations/1633647205750_run_sql_migration/down.sql
Normal file
51
hasura/migrations/1633647205750_run_sql_migration/down.sql
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- CREATE
|
||||||
|
-- OR REPLACE FUNCTION public.search_owners (search text) RETURNS SETOF owners LANGUAGE plpgsql STABLE AS $function$
|
||||||
|
-- BEGIN
|
||||||
|
-- IF search = ''
|
||||||
|
-- THEN
|
||||||
|
-- RETURN query
|
||||||
|
-- SELECT
|
||||||
|
-- *
|
||||||
|
-- FROM
|
||||||
|
-- owners;
|
||||||
|
-- ELSE
|
||||||
|
-- RETURN query
|
||||||
|
-- SELECT
|
||||||
|
-- *
|
||||||
|
-- FROM
|
||||||
|
-- owners
|
||||||
|
-- WHERE
|
||||||
|
-- (
|
||||||
|
-- ownr_fn || ' ' || ownr_ln
|
||||||
|
-- )
|
||||||
|
-- ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_ln ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_fn ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_fn ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_co_nm ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_ph1 ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_ph2 ILIKE '%' || search || '%'
|
||||||
|
-- OR ownr_addr1 ILIKE '%' || search || '%'
|
||||||
|
-- ORDER BY
|
||||||
|
-- (ownr_fn || ' ' || ownr_ln) ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_ln ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_fn ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_co_nm ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_fn ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_ph1 ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_ph2 ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL,
|
||||||
|
-- ownr_addr1 ILIKE '%' || search || '%'
|
||||||
|
-- OR NULL;
|
||||||
|
-- END
|
||||||
|
-- IF;
|
||||||
|
-- END
|
||||||
|
-- $function$;
|
||||||
49
hasura/migrations/1633647205750_run_sql_migration/up.sql
Normal file
49
hasura/migrations/1633647205750_run_sql_migration/up.sql
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
CREATE
|
||||||
|
OR REPLACE FUNCTION public.search_owners (search text) RETURNS SETOF owners LANGUAGE plpgsql STABLE AS $function$
|
||||||
|
BEGIN
|
||||||
|
IF search = ''
|
||||||
|
THEN
|
||||||
|
RETURN query
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
owners;
|
||||||
|
ELSE
|
||||||
|
RETURN query
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
owners
|
||||||
|
WHERE
|
||||||
|
(
|
||||||
|
ownr_fn || ' ' || ownr_ln
|
||||||
|
)
|
||||||
|
ILIKE '%' || search || '%'
|
||||||
|
OR ownr_ln ILIKE '%' || search || '%'
|
||||||
|
OR ownr_fn ILIKE '%' || search || '%'
|
||||||
|
OR ownr_fn ILIKE '%' || search || '%'
|
||||||
|
OR ownr_co_nm ILIKE '%' || search || '%'
|
||||||
|
OR ownr_ph1 ILIKE '%' || search || '%'
|
||||||
|
OR ownr_ph2 ILIKE '%' || search || '%'
|
||||||
|
OR ownr_addr1 ILIKE '%' || search || '%'
|
||||||
|
ORDER BY
|
||||||
|
(ownr_fn || ' ' || ownr_ln) ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_ln ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_fn ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_co_nm ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_fn ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_ph1 ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_ph2 ILIKE '%' || search || '%'
|
||||||
|
OR NULL,
|
||||||
|
ownr_addr1 ILIKE '%' || search || '%'
|
||||||
|
OR NULL;
|
||||||
|
END
|
||||||
|
IF;
|
||||||
|
END
|
||||||
|
$function$;
|
||||||
Reference in New Issue
Block a user