@@ -1,4 +1,4 @@
|
|||||||
<babeledit_project be_version="2.7.1" version="1.2">
|
<babeledit_project version="1.2" be_version="2.7.1">
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
BabelEdit project file
|
BabelEdit project file
|
||||||
@@ -32670,11 +32670,53 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>updatinglabel</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>
|
||||||
<name>labels</name>
|
<name>labels</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>addlabel</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>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>archive</name>
|
<name>archive</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { setSelectedConversation } from "../../redux/messaging/messaging.actions
|
|||||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||||
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
import { TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||||
import "./chat-conversation-list.styles.scss";
|
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
|
import "./chat-conversation-list.styles.scss";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
selectedConversation: selectSelectedConversation,
|
selectedConversation: selectSelectedConversation,
|
||||||
@@ -38,17 +38,20 @@ export function ChatConversationListComponent({
|
|||||||
: null
|
: null
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{item.job_conversations.length > 0 ? (
|
<div sryle={{ display: "inline-block" }}>
|
||||||
<div className="chat-name">
|
{item.label && <div className="chat-name">{item.label}</div>}
|
||||||
{item.job_conversations.map((j, idx) => (
|
{item.job_conversations.length > 0 ? (
|
||||||
<div key={idx}>
|
<div className="chat-name">
|
||||||
<OwnerNameDisplay ownerObject={j.job} />
|
{item.job_conversations.map((j, idx) => (
|
||||||
</div>
|
<div key={idx}>
|
||||||
))}
|
<OwnerNameDisplay ownerObject={j.job} />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
))}
|
||||||
<PhoneFormatter>{item.phone_num}</PhoneFormatter>
|
</div>
|
||||||
)}
|
) : (
|
||||||
|
<PhoneFormatter>{item.phone_num}</PhoneFormatter>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<div sryle={{ display: "inline-block" }}>
|
<div sryle={{ display: "inline-block" }}>
|
||||||
<div>
|
<div>
|
||||||
{item.job_conversations.length > 0
|
{item.job_conversations.length > 0
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import React from "react";
|
|||||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||||
import ChatArchiveButton from "../chat-archive-button/chat-archive-button.component";
|
import ChatArchiveButton from "../chat-archive-button/chat-archive-button.component";
|
||||||
import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component";
|
import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component";
|
||||||
|
import ChatLabelComponent from "../chat-label/chat-label.component";
|
||||||
import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container";
|
import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container";
|
||||||
|
|
||||||
export default function ChatConversationTitle({ conversation }) {
|
export default function ChatConversationTitle({ conversation }) {
|
||||||
@@ -11,6 +12,7 @@ export default function ChatConversationTitle({ conversation }) {
|
|||||||
<PhoneNumberFormatter>
|
<PhoneNumberFormatter>
|
||||||
{conversation && conversation.phone_num}
|
{conversation && conversation.phone_num}
|
||||||
</PhoneNumberFormatter>
|
</PhoneNumberFormatter>
|
||||||
|
<ChatLabelComponent conversation={conversation} />
|
||||||
<ChatConversationTitleTags
|
<ChatConversationTitleTags
|
||||||
jobConversations={
|
jobConversations={
|
||||||
(conversation && conversation.job_conversations) || []
|
(conversation && conversation.job_conversations) || []
|
||||||
|
|||||||
67
client/src/components/chat-label/chat-label.component.jsx
Normal file
67
client/src/components/chat-label/chat-label.component.jsx
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import { PlusOutlined } from "@ant-design/icons";
|
||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Input, notification, Spin, Tag, Tooltip } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { UPDATE_CONVERSATION_LABEL } from "../../graphql/conversations.queries";
|
||||||
|
export default function ChatLabel({ conversation }) {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [editing, setEditing] = useState(false);
|
||||||
|
const [value, setValue] = useState(conversation.label);
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [updateLabel] = useMutation(UPDATE_CONVERSATION_LABEL);
|
||||||
|
|
||||||
|
const handleSave = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
const response = await updateLabel({
|
||||||
|
variables: { id: conversation.id, label: value },
|
||||||
|
});
|
||||||
|
if (response.errors) {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("messages.errors.updatinglabel", {
|
||||||
|
error: JSON.stringify(response.errors),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setEditing(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("messages.errors.updatinglabel", {
|
||||||
|
error: JSON.stringify(error),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (editing) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Input
|
||||||
|
autoFocus
|
||||||
|
value={value}
|
||||||
|
onChange={(e) => setValue(e.target.value)}
|
||||||
|
onBlur={handleSave}
|
||||||
|
allowClear
|
||||||
|
/>
|
||||||
|
{loading && <Spin size="small" />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return conversation.label && conversation.label.trim() !== "" ? (
|
||||||
|
<Tag style={{ cursor: "pointer" }} onClick={() => setEditing(true)}>
|
||||||
|
{conversation.label}
|
||||||
|
</Tag>
|
||||||
|
) : (
|
||||||
|
<Tooltip title={t("messaging.labels.addlabel")}>
|
||||||
|
<PlusOutlined
|
||||||
|
style={{ cursor: "pointer" }}
|
||||||
|
onClick={() => setEditing(true)}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,11 +43,9 @@ const JobSearchSelect = (
|
|||||||
search: value,
|
search: value,
|
||||||
...(convertedOnly || notExported
|
...(convertedOnly || notExported
|
||||||
? {
|
? {
|
||||||
variables: {
|
...(convertedOnly ? { isConverted: true } : {}),
|
||||||
...(convertedOnly ? { isConverted: true } : {}),
|
...(notExported ? { notExported: true } : {}),
|
||||||
...(notExported ? { notExported: true } : {}),
|
...(notInvoiced ? { notInvoiced: true } : {}),
|
||||||
...(notInvoiced ? { notInvoiced: true } : {}),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
},
|
},
|
||||||
@@ -79,6 +77,7 @@ const JobSearchSelect = (
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
showSearch
|
showSearch
|
||||||
autoFocus
|
autoFocus
|
||||||
|
allowClear
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ export function PayableExportAll({
|
|||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("bills.errors.exporting", {
|
message: t("bills.errors.exporting", {
|
||||||
error: JSON.stringify(billUpdateResponse.error),
|
error: JSON.stringify(billUpdateResponse.errors),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export const CONVERSATION_LIST_QUERY = gql`
|
|||||||
updated_at
|
updated_at
|
||||||
unreadcnt
|
unreadcnt
|
||||||
archived
|
archived
|
||||||
|
label
|
||||||
messages_aggregate(
|
messages_aggregate(
|
||||||
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||||
) {
|
) {
|
||||||
@@ -88,6 +89,7 @@ export const GET_CONVERSATION_DETAILS = gql`
|
|||||||
id
|
id
|
||||||
phone_num
|
phone_num
|
||||||
archived
|
archived
|
||||||
|
label
|
||||||
job_conversations {
|
job_conversations {
|
||||||
jobid
|
jobid
|
||||||
conversationid
|
conversationid
|
||||||
@@ -136,3 +138,15 @@ export const TOGGLE_CONVERSATION_ARCHIVE = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const UPDATE_CONVERSATION_LABEL = gql`
|
||||||
|
mutation UPDATE_CONVERSATION_LABEL($id: uuid!, $label: String) {
|
||||||
|
update_conversations_by_pk(
|
||||||
|
pk_columns: { id: $id }
|
||||||
|
_set: { label: $label }
|
||||||
|
) {
|
||||||
|
label
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1915,9 +1915,11 @@
|
|||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"invalidphone": "The phone number is invalid. Unable to open conversation. ",
|
"invalidphone": "The phone number is invalid. Unable to open conversation. ",
|
||||||
"noattachedjobs": "No jobs have been associated to this conversation. "
|
"noattachedjobs": "No jobs have been associated to this conversation. ",
|
||||||
|
"updatinglabel": "Error updating label. {{error}}"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"addlabel": "Add a label to this conversation.",
|
||||||
"archive": "Archive",
|
"archive": "Archive",
|
||||||
"maxtenimages": "You can only select up to a maximum of 10 images at a time.",
|
"maxtenimages": "You can only select up to a maximum of 10 images at a time.",
|
||||||
"messaging": "Messaging",
|
"messaging": "Messaging",
|
||||||
|
|||||||
@@ -1915,9 +1915,11 @@
|
|||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"invalidphone": "",
|
"invalidphone": "",
|
||||||
"noattachedjobs": ""
|
"noattachedjobs": "",
|
||||||
|
"updatinglabel": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"addlabel": "",
|
||||||
"archive": "",
|
"archive": "",
|
||||||
"maxtenimages": "",
|
"maxtenimages": "",
|
||||||
"messaging": "Mensajería",
|
"messaging": "Mensajería",
|
||||||
|
|||||||
@@ -1915,9 +1915,11 @@
|
|||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"invalidphone": "",
|
"invalidphone": "",
|
||||||
"noattachedjobs": ""
|
"noattachedjobs": "",
|
||||||
|
"updatinglabel": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
|
"addlabel": "",
|
||||||
"archive": "",
|
"archive": "",
|
||||||
"maxtenimages": "",
|
"maxtenimages": "",
|
||||||
"messaging": "Messagerie",
|
"messaging": "Messagerie",
|
||||||
|
|||||||
@@ -1241,6 +1241,7 @@
|
|||||||
- bodyshopid
|
- bodyshopid
|
||||||
- created_at
|
- created_at
|
||||||
- id
|
- id
|
||||||
|
- label
|
||||||
- phone_num
|
- phone_num
|
||||||
- unreadcnt
|
- unreadcnt
|
||||||
- updated_at
|
- updated_at
|
||||||
@@ -1252,6 +1253,7 @@
|
|||||||
- bodyshopid
|
- bodyshopid
|
||||||
- created_at
|
- created_at
|
||||||
- id
|
- id
|
||||||
|
- label
|
||||||
- phone_num
|
- phone_num
|
||||||
- unreadcnt
|
- unreadcnt
|
||||||
- updated_at
|
- updated_at
|
||||||
@@ -1273,6 +1275,7 @@
|
|||||||
- bodyshopid
|
- bodyshopid
|
||||||
- created_at
|
- created_at
|
||||||
- id
|
- id
|
||||||
|
- label
|
||||||
- phone_num
|
- phone_num
|
||||||
- unreadcnt
|
- unreadcnt
|
||||||
- updated_at
|
- updated_at
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."conversations" add column "label" text
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."conversations" add column "label" text
|
||||||
|
null;
|
||||||
Reference in New Issue
Block a user