IO-951 IO-924 Phonebook fixes
This commit is contained in:
@@ -23609,6 +23609,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>phonebook</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>vehicles</name>
|
<name>vehicles</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -27004,6 +27025,27 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>fields</name>
|
<name>fields</name>
|
||||||
<children>
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>category</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>city</name>
|
<name>city</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -137,6 +137,28 @@ export default function GlobalSearch() {
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: renderTitle(t("menus.header.search.phonebook")),
|
||||||
|
options: data.search_phonebook.map((pb) => {
|
||||||
|
return {
|
||||||
|
key: pb.id,
|
||||||
|
value: `${pb.firstname || ""} ${pb.lastname || ""} ${
|
||||||
|
pb.company || ""
|
||||||
|
}`,
|
||||||
|
label: (
|
||||||
|
<Link to={`/manage/phonebook?phonebookentry=${pb.id}`}>
|
||||||
|
<Space wrap split={<Divider type="vertical" />}>
|
||||||
|
<span>{`${pb.firstname || ""} ${pb.lastname || ""} ${
|
||||||
|
pb.company || ""
|
||||||
|
}`}</span>
|
||||||
|
<PhoneNumberFormatter>{pb.phone1}</PhoneNumberFormatter>
|
||||||
|
<span>{pb.email}</span>
|
||||||
|
</Space>
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
},
|
||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ export default function PhonebookFormComponent({
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow grow>
|
<LayoutFormRow grow>
|
||||||
|
<Form.Item label={t("phonebook.fields.category")} name="category">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item label={t("phonebook.fields.street1")} name="street1">
|
<Form.Item label={t("phonebook.fields.street1")} name="street1">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -52,5 +52,12 @@ export const GLOBAL_SEARCH_QUERY = gql`
|
|||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
search_phonebook(args: { search: $search }) {
|
||||||
|
id
|
||||||
|
firstname
|
||||||
|
lastname
|
||||||
|
company
|
||||||
|
phone1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ export function PhonebookPageComponent({ bodyshop }) {
|
|||||||
dataIndex: "company",
|
dataIndex: "company",
|
||||||
key: "company",
|
key: "company",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("phonebook.fields.category"),
|
||||||
|
dataIndex: "category",
|
||||||
|
key: "category",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("phonebook.fields.email"),
|
title: t("phonebook.fields.email"),
|
||||||
dataIndex: "email",
|
dataIndex: "email",
|
||||||
|
|||||||
@@ -1392,6 +1392,7 @@
|
|||||||
"jobs": "Jobs",
|
"jobs": "Jobs",
|
||||||
"owners": "Owners",
|
"owners": "Owners",
|
||||||
"payments": "Payments",
|
"payments": "Payments",
|
||||||
|
"phonebook": "Phonebook",
|
||||||
"vehicles": "Vehicles"
|
"vehicles": "Vehicles"
|
||||||
},
|
},
|
||||||
"shiftclock": "Shift Clock",
|
"shiftclock": "Shift Clock",
|
||||||
@@ -1618,6 +1619,7 @@
|
|||||||
"new": "New Phonebook Entry"
|
"new": "New Phonebook Entry"
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
|
"category": "Category",
|
||||||
"city": "City",
|
"city": "City",
|
||||||
"company": "Company",
|
"company": "Company",
|
||||||
"country": "Country",
|
"country": "Country",
|
||||||
|
|||||||
@@ -1392,6 +1392,7 @@
|
|||||||
"jobs": "",
|
"jobs": "",
|
||||||
"owners": "",
|
"owners": "",
|
||||||
"payments": "",
|
"payments": "",
|
||||||
|
"phonebook": "",
|
||||||
"vehicles": ""
|
"vehicles": ""
|
||||||
},
|
},
|
||||||
"shiftclock": "",
|
"shiftclock": "",
|
||||||
@@ -1618,6 +1619,7 @@
|
|||||||
"new": ""
|
"new": ""
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
|
"category": "",
|
||||||
"city": "",
|
"city": "",
|
||||||
"company": "",
|
"company": "",
|
||||||
"country": "",
|
"country": "",
|
||||||
|
|||||||
@@ -1392,6 +1392,7 @@
|
|||||||
"jobs": "",
|
"jobs": "",
|
||||||
"owners": "",
|
"owners": "",
|
||||||
"payments": "",
|
"payments": "",
|
||||||
|
"phonebook": "",
|
||||||
"vehicles": ""
|
"vehicles": ""
|
||||||
},
|
},
|
||||||
"shiftclock": "",
|
"shiftclock": "",
|
||||||
@@ -1618,6 +1619,7 @@
|
|||||||
"new": ""
|
"new": ""
|
||||||
},
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
|
"category": "",
|
||||||
"city": "",
|
"city": "",
|
||||||
"company": "",
|
"company": "",
|
||||||
"country": "",
|
"country": "",
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
26
hasura/migrations/1619540860369_run_sql_migration/up.yaml
Normal file
26
hasura/migrations/1619540860369_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: "drop function search_phonebook;\nCREATE OR REPLACE FUNCTION public.search_phonebook(search
|
||||||
|
text)\n RETURNS SETOF phonebook\n LANGUAGE plpgsql\n STABLE\nAS $function$\nBEGIN\n\tIF
|
||||||
|
search = '' THEN\n\t\tRETURN query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tphonebook;\n\tELSE\n\t\tRETURN
|
||||||
|
query\n\t\tSELECT\n\t\t\tphonebook.*\n\t\tFROM\n\t\t\tphonebook\n\t\tWHERE firstname
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR lastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||||
|
company ILIKE '%' || search || '%'\n\t\t\tOR address1 ILIKE '%' || search ||
|
||||||
|
'%'\n\t\t\tOR phone1 ILIKE '%' || search || '%'\n\t\t\tOR phone2 ILIKE '%' ||
|
||||||
|
search || '%'\n\t\t\tOR email ILIKE '%' || search || '%'\n\t\t\tOR category
|
||||||
|
ILIKE '%' || search || '%'\n\t\tORDER BY\n\t\t\n\t\t\tfirstname ILIKE '%' ||
|
||||||
|
search || '%'\n\t\t\tOR NULL,\n\t\t\tlastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||||
|
NULL,\n\t\t\tcompany ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\taddress1
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tphone1 ILIKE '%' || search
|
||||||
|
|| '%'\n\t\t\tOR NULL,\n\t\t\tphone2 ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\temail
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tcategory ILIKE '%' || search
|
||||||
|
|| '%'\n\t\t\tOR NULL,\n\t\t\townr_addr1 ILIKE '%' || search || '%'\n\t\t\tOR
|
||||||
|
NULL,\n\t\t\townr_addr1 ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_addr1
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\townr_addr1 ILIKE '%' || search
|
||||||
|
|| '%'\n\t\t\tOR NULL;\n\tEND IF;\nEND\n$function$;"
|
||||||
|
type: run_sql
|
||||||
|
- args:
|
||||||
|
name: search_phonebook
|
||||||
|
schema: public
|
||||||
|
type: track_function
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
23
hasura/migrations/1619540900896_run_sql_migration/up.yaml
Normal file
23
hasura/migrations/1619540900896_run_sql_migration/up.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: "drop function search_phonebook;\nCREATE OR REPLACE FUNCTION public.search_phonebook(search
|
||||||
|
text)\n RETURNS SETOF phonebook\n LANGUAGE plpgsql\n STABLE\nAS $function$\nBEGIN\n\tIF
|
||||||
|
search = '' THEN\n\t\tRETURN query\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tphonebook;\n\tELSE\n\t\tRETURN
|
||||||
|
query\n\t\tSELECT\n\t\t\tphonebook.*\n\t\tFROM\n\t\t\tphonebook\n\t\tWHERE firstname
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR lastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||||
|
company ILIKE '%' || search || '%'\n\t\t\tOR address1 ILIKE '%' || search ||
|
||||||
|
'%'\n\t\t\tOR phone1 ILIKE '%' || search || '%'\n\t\t\tOR phone2 ILIKE '%' ||
|
||||||
|
search || '%'\n\t\t\tOR email ILIKE '%' || search || '%'\n\t\t\tOR category
|
||||||
|
ILIKE '%' || search || '%'\n\t\tORDER BY\n\t\t\n\t\t\tfirstname ILIKE '%' ||
|
||||||
|
search || '%'\n\t\t\tOR NULL,\n\t\t\tlastname ILIKE '%' || search || '%'\n\t\t\tOR
|
||||||
|
NULL,\n\t\t\tcompany ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\taddress1
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tphone1 ILIKE '%' || search
|
||||||
|
|| '%'\n\t\t\tOR NULL,\n\t\t\tphone2 ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\temail
|
||||||
|
ILIKE '%' || search || '%'\n\t\t\tOR NULL,\n\t\t\tcategory ILIKE '%' || search
|
||||||
|
|| '%'\n\t\t\tOR NULL;\n\tEND IF;\nEND\n$function$;"
|
||||||
|
type: run_sql
|
||||||
|
- args:
|
||||||
|
name: search_phonebook
|
||||||
|
schema: public
|
||||||
|
type: track_function
|
||||||
Reference in New Issue
Block a user