Merged in release/2021-09-24 (pull request #222)
release/2021-09-24 Approved-by: Patrick Fic
This commit is contained in:
@@ -13,6 +13,7 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
|
||||
ref={ref}
|
||||
showSearch
|
||||
optionFilterProp="line_desc"
|
||||
notFoundContent={"Removed."}
|
||||
{...restProps}
|
||||
>
|
||||
<Select.Option key={null} value={"noline"} cost={0} line_desc={""}>
|
||||
@@ -21,14 +22,18 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
|
||||
{options
|
||||
? options.map((item) => (
|
||||
<Option
|
||||
disabled={item.removed}
|
||||
key={item.id}
|
||||
value={item.id}
|
||||
cost={item.act_price ? item.act_price : 0}
|
||||
part_type={item.part_type}
|
||||
line_desc={item.line_desc}
|
||||
part_qty={item.part_qty}
|
||||
style={{
|
||||
...(item.removed ? { textDecoration: "line-through" } : {}),
|
||||
}}
|
||||
>
|
||||
{`${item.line_desc}${
|
||||
{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
|
||||
item.oem_partno ? ` - ${item.oem_partno}` : ""
|
||||
}`}
|
||||
</Option>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { selectSelectedConversation } from "../../redux/messaging/messaging.sele
|
||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||
import "./chat-conversation-list.styles.scss";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
selectedConversation: selectSelectedConversation,
|
||||
@@ -60,13 +61,18 @@ export function ChatConversationListComponent({
|
||||
) : (
|
||||
<PhoneFormatter>{item.phone_num}</PhoneFormatter>
|
||||
)}
|
||||
{item.job_conversations.length > 0
|
||||
? item.job_conversations.map((j, idx) => (
|
||||
<Tag key={idx} className="ro-number-tag">
|
||||
{j.job.ro_number}
|
||||
</Tag>
|
||||
))
|
||||
: null}
|
||||
<div sryle={{ display: "inline-block" }}>
|
||||
<div>
|
||||
{item.job_conversations.length > 0
|
||||
? item.job_conversations.map((j, idx) => (
|
||||
<Tag key={idx} className="ro-number-tag">
|
||||
{j.job.ro_number}
|
||||
</Tag>
|
||||
))
|
||||
: null}
|
||||
</div>
|
||||
<TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>
|
||||
</div>
|
||||
<Badge count={item.messages_aggregate.aggregate.count || 0} />
|
||||
</List.Item>
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Icon from "@ant-design/icons";
|
||||
import { Tooltip } from "antd";
|
||||
import i18n from "i18next";
|
||||
import moment from "moment";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
@@ -9,6 +10,7 @@ import {
|
||||
CellMeasurerCache,
|
||||
List,
|
||||
} from "react-virtualized";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import "./chat-message-list.styles.scss";
|
||||
|
||||
export default function ChatMessageListComponent({ messages }) {
|
||||
@@ -85,17 +87,22 @@ export default function ChatMessageListComponent({ messages }) {
|
||||
|
||||
const MessageRender = (message) => {
|
||||
return (
|
||||
<div>
|
||||
{message.image_path &&
|
||||
message.image_path.map((i, idx) => (
|
||||
<div key={idx} style={{ display: "flex", justifyContent: "center" }}>
|
||||
<a href={i} target="__blank">
|
||||
<img alt="Received" className="message-img" src={i} />
|
||||
</a>
|
||||
</div>
|
||||
))}
|
||||
<div>{message.text}</div>
|
||||
</div>
|
||||
<Tooltip title={DateTimeFormatter({ children: message.created_at })}>
|
||||
<div>
|
||||
{message.image_path &&
|
||||
message.image_path.map((i, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
style={{ display: "flex", justifyContent: "center" }}
|
||||
>
|
||||
<a href={i} target="__blank">
|
||||
<img alt="Received" className="message-img" src={i} />
|
||||
</a>
|
||||
</div>
|
||||
))}
|
||||
<div>{message.text}</div>
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ export function JobLinesComponent({
|
||||
setState({
|
||||
...state,
|
||||
filteredInfo: {
|
||||
part_type: ["PAN,PAC,PAR,PAL,PAA,PAM,PAP,PAO,PAS,PASL,PAG"],
|
||||
part_type: ["PAN,PAC,PAR,PAL,PAA,PAM,PAP,PAS,PASL,PAG"],
|
||||
},
|
||||
});
|
||||
}}
|
||||
|
||||
@@ -9,6 +9,7 @@ export const CONVERSATION_LIST_SUBSCRIPTION = gql`
|
||||
) {
|
||||
phone_num
|
||||
id
|
||||
updated_at
|
||||
job_conversations {
|
||||
job {
|
||||
id
|
||||
|
||||
@@ -160,7 +160,8 @@ export const UPDATE_JOB_LINE = gql`
|
||||
|
||||
export const GET_JOB_LINES_TO_ENTER_BILL = gql`
|
||||
query GET_JOB_LINES_TO_ENTER_BILL($id: uuid!) {
|
||||
joblines(where: { jobid: { _eq: $id }, removed: { _eq: false } }) {
|
||||
joblines(where: { jobid: { _eq: $id } }) {
|
||||
removed
|
||||
id
|
||||
line_desc
|
||||
part_type
|
||||
|
||||
@@ -90,8 +90,6 @@ export function* onSendMessage() {
|
||||
}
|
||||
export function* sendMessage({ payload }) {
|
||||
try {
|
||||
yield logImEXEvent("messaging_send_message");
|
||||
|
||||
const response = yield call(axios.post, "/sms/send", payload);
|
||||
if (response.status === 200) {
|
||||
yield put(sendMessageSuccess(payload));
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
15
hasura/migrations/1632265756746_run_sql_migration/up.yaml
Normal file
15
hasura/migrations/1632265756746_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
- type: run_sql
|
||||
args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: |-
|
||||
CREATE OR REPLACE FUNCTION public.update_conversation_on_message()
|
||||
RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
UPDATE conversations SET updated_at = now() WHERE id = NEW.conversationid;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$function$
|
||||
;
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
15
hasura/migrations/1632265816135_run_sql_migration/up.yaml
Normal file
15
hasura/migrations/1632265816135_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
- type: run_sql
|
||||
args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: |-
|
||||
CREATE OR REPLACE FUNCTION public.update_conversation_on_message()
|
||||
RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
UPDATE conversations SET updated_at = now() WHERE conversations.id = NEW.conversationid;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$function$
|
||||
;
|
||||
@@ -12,14 +12,24 @@ query FIND_BODYSHOP_BY_MESSAGING_SERVICE_SID(
|
||||
}
|
||||
`;
|
||||
|
||||
exports.INSERT_MESSAGE = `
|
||||
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!, $conversationid: uuid) {
|
||||
update_conversations(where: {id: {_eq: $conversationid}}, _set: {archived: false}) {
|
||||
affected_rows
|
||||
exports.UNARCHIVE_CONVERSATION = `
|
||||
mutation UNARCHIVE_CONVERSATION($id: uuid!) {
|
||||
update_conversations_by_pk(pk_columns: {id: $id}, _set: {archived: false}) {
|
||||
id
|
||||
}
|
||||
insert_messages(objects: $msg) {
|
||||
}
|
||||
`;
|
||||
|
||||
exports.INSERT_MESSAGE = `
|
||||
mutation INSERT_MESSAGE($msg: [messages_insert_input!]!, $conversationid: uuid!) {
|
||||
update_conversations_by_pk(pk_columns: {id: $conversationid}, _set: {archived: false}) {
|
||||
id
|
||||
}
|
||||
insert_messages(objects: $msg) {
|
||||
returning {
|
||||
conversation {
|
||||
id
|
||||
archived
|
||||
bodyshop {
|
||||
associations(where: {active: {_eq: true}}) {
|
||||
user {
|
||||
|
||||
@@ -55,7 +55,7 @@ exports.send = (req, res) => {
|
||||
: [],
|
||||
};
|
||||
gqlClient
|
||||
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
||||
.request(queries.INSERT_MESSAGE, { msg: newMessage, conversationid })
|
||||
.then((r2) => {
|
||||
//console.log("Responding GQL Message ID", JSON.stringify(r2));
|
||||
logger.log("sms-outbound-success", "DEBUG", req.user.email, null, {
|
||||
|
||||
Reference in New Issue
Block a user