IO-1858 Email Groupings

This commit is contained in:
Patrick Fic
2022-05-06 09:30:29 -07:00
parent e348110bdd
commit e56424c9b3
10 changed files with 123 additions and 1 deletions

View File

@@ -8927,6 +8927,48 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>md_to_emails</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>
<name>md_to_emails_emails</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>
<name>messagingpresets</name>
<definition_loaded>false</definition_loaded>

View File

@@ -42,7 +42,12 @@ export function EmailOverlayComponent({
const { t } = useTranslation();
const handleClick = ({ item, key, keyPath }) => {
const email = item.props.value;
form.setFieldsValue({ to: _.uniq([...form.getFieldValue("to"), email]) });
form.setFieldsValue({
to: _.uniq([
...form.getFieldValue("to"),
...(typeof email === "string" ? [email] : email),
]),
});
};
const menu = (
@@ -55,6 +60,11 @@ export function EmailOverlayComponent({
{`${e.first_name} ${e.last_name}`}
</Menu.Item>
))}
{bodyshop.md_to_emails.map((e, idx) => (
<Menu.Item value={e.emails} key={idx + "group"}>
{e.label}
</Menu.Item>
))}
</Menu>
</div>
);

View File

@@ -1393,6 +1393,60 @@ export default function ShopInfoGeneral({ form }) {
}}
</Form.List>
</LayoutFormRow>
<LayoutFormRow grow header={t("bodyshop.labels.md_to_emails")}>
<Form.List name={["md_to_emails"]}>
{(fields, { add, remove, move }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key}>
<LayoutFormRow noDivider>
<Form.Item
label={t("general.labels.label")}
key={`${index}label`}
name={[field.name, "label"]}
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.labels.md_to_emails_emails")}
key={`${index}emails`}
name={[field.name, "emails"]}
>
<Select mode="tags" tokenSeparators={[",", ";"]} />
</Form.Item>
<Space>
<DeleteFilled
onClick={() => {
remove(field.name);
}}
/>
<FormListMoveArrows
move={move}
index={index}
total={fields.length}
/>
</Space>
</LayoutFormRow>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("general.actions.add")}
</Button>
</Form.Item>
</div>
);
}}
</Form.List>
</LayoutFormRow>
</div>
);
}

View File

@@ -106,6 +106,7 @@ export const QUERY_BODYSHOP = gql`
last_name_first
md_parts_order_comment
bill_allow_post_to_closed
md_to_emails
employees {
user_email
id
@@ -209,6 +210,7 @@ export const UPDATE_SHOP = gql`
last_name_first
md_parts_order_comment
bill_allow_post_to_closed
md_to_emails
employees {
id
first_name

View File

@@ -544,6 +544,8 @@
"jobstatuses": "Job Statuses",
"laborrates": "Labor Rates",
"licensing": "Licensing",
"md_to_emails": "Preset To Emails",
"md_to_emails_emails": "Emails",
"messagingpresets": "Messaging Presets",
"notemplatesavailable": "No templates available to add.",
"notespresets": "Notes Presets",

View File

@@ -544,6 +544,8 @@
"jobstatuses": "",
"laborrates": "",
"licensing": "",
"md_to_emails": "",
"md_to_emails_emails": "",
"messagingpresets": "",
"notemplatesavailable": "",
"notespresets": "",

View File

@@ -544,6 +544,8 @@
"jobstatuses": "",
"laborrates": "",
"licensing": "",
"md_to_emails": "",
"md_to_emails_emails": "",
"messagingpresets": "",
"notemplatesavailable": "",
"notespresets": "",

View File

@@ -858,6 +858,7 @@
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- md_to_emails
- messagingservicesid
- pbs_configuration
- pbs_serialnumber
@@ -944,6 +945,7 @@
- md_referral_sources
- md_responsibility_centers
- md_ro_statuses
- md_to_emails
- pbs_configuration
- phone
- prodtargethrs

View File

@@ -0,0 +1,4 @@
-- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."bodyshops" add column "md_to_emails" jsonb
-- null default jsonb_build_array();

View File

@@ -0,0 +1,2 @@
alter table "public"."bodyshops" add column "md_to_emails" jsonb
null default jsonb_build_array();