Added manual conversation creation BOD-379
This commit is contained in:
@@ -18197,6 +18197,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>new</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>
|
||||||
@@ -18244,6 +18265,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>phonenumber</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>presets</name>
|
<name>presets</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { PlusCircleFilled } from "@ant-design/icons";
|
||||||
|
import { Button, Form, Popover } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { openChatByPhone } from "../../redux/messaging/messaging.actions";
|
||||||
|
import PhoneFormItem from "../form-items-formatted/phone-form-item.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
openChatByPhone: (phone) => dispatch(openChatByPhone(phone)),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function ChatNewConversation({ openChatByPhone }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const handleFinish = (values) => {
|
||||||
|
console.log("values :>> ", values);
|
||||||
|
openChatByPhone({ phone_num: values.phoneNumber });
|
||||||
|
form.resetFields();
|
||||||
|
};
|
||||||
|
|
||||||
|
const popContent = (
|
||||||
|
<div>
|
||||||
|
<Form form={form} onFinish={handleFinish}>
|
||||||
|
<Form.Item label={t("messaging.labels.phonenumber")} name="phoneNumber">
|
||||||
|
<PhoneFormItem />
|
||||||
|
</Form.Item>
|
||||||
|
<Button type="primary" htmlType="submit">
|
||||||
|
{t("messaging.actions.new")}
|
||||||
|
</Button>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Popover trigger="click" content={popContent}>
|
||||||
|
<PlusCircleFilled style={{ margin: "1rem" }} />
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ChatNewConversation);
|
||||||
@@ -9,6 +9,7 @@ import ChatConversationListComponent from "../chat-conversation-list/chat-conver
|
|||||||
import ChatConversationContainer from "../chat-conversation/chat-conversation.container";
|
import ChatConversationContainer from "../chat-conversation/chat-conversation.container";
|
||||||
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
import { selectSelectedConversation } from "../../redux/messaging/messaging.selectors";
|
||||||
import "./chat-popup.styles.scss";
|
import "./chat-popup.styles.scss";
|
||||||
|
import ChatNewConversation from "../chat-new-conversation/chat-new-conversation.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
selectedConversation: selectSelectedConversation,
|
selectedConversation: selectSelectedConversation,
|
||||||
@@ -25,9 +26,12 @@ export function ChatPopupComponent({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div className="chat-popup">
|
<div className="chat-popup">
|
||||||
<Typography.Title level={4}>
|
<div style={{ display: "flex", alignItems: "center" }}>
|
||||||
{t("messaging.labels.messaging")}
|
<Typography.Title level={4}>
|
||||||
</Typography.Title>
|
{t("messaging.labels.messaging")}
|
||||||
|
</Typography.Title>
|
||||||
|
<ChatNewConversation />
|
||||||
|
</div>
|
||||||
<ShrinkOutlined
|
<ShrinkOutlined
|
||||||
onClick={() => toggleChatVisible()}
|
onClick={() => toggleChatVisible()}
|
||||||
style={{ position: "absolute", right: ".5rem", top: ".5rem" }}
|
style={{ position: "absolute", right: ".5rem", top: ".5rem" }}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function ChatTagRoContainer({ conversation }) {
|
|||||||
loadRo(v);
|
loadRo(v);
|
||||||
};
|
};
|
||||||
|
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 800);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
const handleSearch = (value) => {
|
||||||
debouncedExecuteSearch({ variables: { search: value } });
|
debouncedExecuteSearch({ variables: { search: value } });
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const JobSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => {
|
|||||||
const executeSearch = (v) => {
|
const executeSearch = (v) => {
|
||||||
callSearch(v);
|
callSearch(v);
|
||||||
};
|
};
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 800);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 500);
|
||||||
|
|
||||||
const handleSearch = (value) => {
|
const handleSearch = (value) => {
|
||||||
debouncedExecuteSearch({ variables: { search: value } });
|
debouncedExecuteSearch({ variables: { search: value } });
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ export function JobsChangeStatus({ job, bodyshop }) {
|
|||||||
)
|
)
|
||||||
setAvailableStatuses(bodyshop.md_ro_statuses.post_production_statuses);
|
setAvailableStatuses(bodyshop.md_ro_statuses.post_production_statuses);
|
||||||
else {
|
else {
|
||||||
|
console.log(
|
||||||
|
"Status didn't match any restrictions. Allowing all status changes."
|
||||||
|
);
|
||||||
setAvailableStatuses(bodyshop.statuses);
|
setAvailableStatuses(bodyshop.statuses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export function* onOpenChatByPhone() {
|
|||||||
export function* openChatByPhone({ payload }) {
|
export function* openChatByPhone({ payload }) {
|
||||||
logImEXEvent("messaging_open_by_phone");
|
logImEXEvent("messaging_open_by_phone");
|
||||||
const { phone_num, jobid } = payload;
|
const { phone_num, jobid } = payload;
|
||||||
|
|
||||||
const bodyshop = yield select(selectBodyshop);
|
const bodyshop = yield select(selectBodyshop);
|
||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
@@ -39,7 +40,9 @@ export function* openChatByPhone({ payload }) {
|
|||||||
} = yield client.query({
|
} = yield client.query({
|
||||||
query: CONVERSATION_ID_BY_PHONE,
|
query: CONVERSATION_ID_BY_PHONE,
|
||||||
variables: { phone: phone(phone_num)[0] },
|
variables: { phone: phone(phone_num)[0] },
|
||||||
|
fetchPolicy: "network-only",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (conversations.length === 0) {
|
if (conversations.length === 0) {
|
||||||
const {
|
const {
|
||||||
data: {
|
data: {
|
||||||
@@ -61,13 +64,14 @@ export function* openChatByPhone({ payload }) {
|
|||||||
} else if (conversations.length === 1) {
|
} else if (conversations.length === 1) {
|
||||||
//got the ID. Open it.
|
//got the ID. Open it.
|
||||||
yield put(setSelectedConversation(conversations[0].id));
|
yield put(setSelectedConversation(conversations[0].id));
|
||||||
yield client.mutate({
|
if (jobid)
|
||||||
mutation: INSERT_CONVERSATION_TAG,
|
yield client.mutate({
|
||||||
variables: {
|
mutation: INSERT_CONVERSATION_TAG,
|
||||||
conversationId: conversations[0].id,
|
variables: {
|
||||||
jobId: jobid,
|
conversationId: conversations[0].id,
|
||||||
},
|
jobId: jobid,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("ERROR: Multiple conversations found. "); //TODO Graceful handling of this situation
|
console.log("ERROR: Multiple conversations found. "); //TODO Graceful handling of this situation
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1106,11 +1106,13 @@
|
|||||||
},
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"link": "Link to Job"
|
"link": "Link to Job",
|
||||||
|
"new": "New Conversation"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"messaging": "Messaging",
|
"messaging": "Messaging",
|
||||||
"nojobs": "Not associated to any job.",
|
"nojobs": "Not associated to any job.",
|
||||||
|
"phonenumber": "Phone #",
|
||||||
"presets": "Presets",
|
"presets": "Presets",
|
||||||
"typeamessage": "Send a message..."
|
"typeamessage": "Send a message..."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1106,11 +1106,13 @@
|
|||||||
},
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"link": ""
|
"link": "",
|
||||||
|
"new": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"messaging": "Mensajería",
|
"messaging": "Mensajería",
|
||||||
"nojobs": "",
|
"nojobs": "",
|
||||||
|
"phonenumber": "",
|
||||||
"presets": "",
|
"presets": "",
|
||||||
"typeamessage": "Enviar un mensaje..."
|
"typeamessage": "Enviar un mensaje..."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1106,11 +1106,13 @@
|
|||||||
},
|
},
|
||||||
"messaging": {
|
"messaging": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"link": ""
|
"link": "",
|
||||||
|
"new": ""
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"messaging": "Messagerie",
|
"messaging": "Messagerie",
|
||||||
"nojobs": "",
|
"nojobs": "",
|
||||||
|
"phonenumber": "",
|
||||||
"presets": "",
|
"presets": "",
|
||||||
"typeamessage": "Envoyer un message..."
|
"typeamessage": "Envoyer un message..."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user