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>
|
||||
</children>
|
||||
</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>
|
||||
<name>fields</name>
|
||||
<children>
|
||||
@@ -29549,6 +29575,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</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>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
|
||||
@@ -62,7 +62,7 @@ export default function GlobalSearch() {
|
||||
}`,
|
||||
label: (
|
||||
<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 || ""} ${
|
||||
owner.ownr_co_nm || ""
|
||||
}`}</span>
|
||||
|
||||
@@ -296,18 +296,17 @@ export function JobLinesComponent({
|
||||
onClick={async () => {
|
||||
await deleteJobLine({
|
||||
variables: { joblineId: record.id },
|
||||
// update(cache) {
|
||||
// cache.modify({
|
||||
// id: cache.identify(job),
|
||||
// fields: {
|
||||
// joblines(existingJobLines, { readField }) {
|
||||
// return existingJobLines.filter(
|
||||
// (jlRef) => record.id !== readField("id", jlRef)
|
||||
// );
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
// },
|
||||
update(cache) {
|
||||
cache.modify({
|
||||
fields: {
|
||||
joblines(existingJobLines, { readField }) {
|
||||
return existingJobLines.filter(
|
||||
(jlRef) => record.id !== readField("id", jlRef)
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
await axios.post("/job/totalsssu", {
|
||||
id: job.id,
|
||||
|
||||
@@ -15,6 +15,7 @@ import ProductionListColumnPaintPriority from "./production-list-columns.paintpr
|
||||
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||
import ProductionListLastContacted from "./production-list-columns.lastcontacted.component";
|
||||
|
||||
const r = ({ technician, state }) => {
|
||||
return [
|
||||
@@ -106,9 +107,7 @@ const r = ({ technician, state }) => {
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "date_last_contacted" &&
|
||||
state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<ProductionListDate time record={record} field="date_last_contacted" />
|
||||
),
|
||||
render: (text, record) => <ProductionListLastContacted record={record} />,
|
||||
},
|
||||
{
|
||||
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",
|
||||
"new": "New Note"
|
||||
},
|
||||
"errors": {
|
||||
"inserting": "Error inserting note. {{error}}"
|
||||
},
|
||||
"fields": {
|
||||
"createdby": "Created By",
|
||||
"critical": "Critical",
|
||||
@@ -1747,7 +1750,8 @@
|
||||
"updatedat": "Updated At"
|
||||
},
|
||||
"labels": {
|
||||
"newnoteplaceholder": "Add a note..."
|
||||
"newnoteplaceholder": "Add a note...",
|
||||
"notetoadd": "Note to Add"
|
||||
},
|
||||
"successes": {
|
||||
"create": "Note created successfully.",
|
||||
|
||||
@@ -1739,6 +1739,9 @@
|
||||
"edit": "Editar nota",
|
||||
"new": "Nueva nota"
|
||||
},
|
||||
"errors": {
|
||||
"inserting": ""
|
||||
},
|
||||
"fields": {
|
||||
"createdby": "Creado por",
|
||||
"critical": "Crítico",
|
||||
@@ -1747,7 +1750,8 @@
|
||||
"updatedat": "Actualizado en"
|
||||
},
|
||||
"labels": {
|
||||
"newnoteplaceholder": "Agrega una nota..."
|
||||
"newnoteplaceholder": "Agrega una nota...",
|
||||
"notetoadd": ""
|
||||
},
|
||||
"successes": {
|
||||
"create": "Nota creada con éxito.",
|
||||
|
||||
@@ -1739,6 +1739,9 @@
|
||||
"edit": "Note éditée",
|
||||
"new": "Nouvelle note"
|
||||
},
|
||||
"errors": {
|
||||
"inserting": ""
|
||||
},
|
||||
"fields": {
|
||||
"createdby": "Créé par",
|
||||
"critical": "Critique",
|
||||
@@ -1747,7 +1750,8 @@
|
||||
"updatedat": "Mis à jour à"
|
||||
},
|
||||
"labels": {
|
||||
"newnoteplaceholder": "Ajouter une note..."
|
||||
"newnoteplaceholder": "Ajouter une note...",
|
||||
"notetoadd": ""
|
||||
},
|
||||
"successes": {
|
||||
"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