hotfix/AdditionalProductFruitsIds - Add additional IDs for product fruits
This commit is contained in:
@@ -519,6 +519,7 @@ export function JobLinesComponent({
|
|||||||
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
id="job-lines-order-parts-button"
|
||||||
disabled={(job && !job.converted) || (selectedLines.length > 0 ? false : true) || jobRO || technician}
|
disabled={(job && !job.converted) || (selectedLines.length > 0 ? false : true) || jobRO || technician}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPartsOrderContext({
|
setPartsOrderContext({
|
||||||
@@ -541,6 +542,7 @@ export function JobLinesComponent({
|
|||||||
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
|
id="job-lines-filter-parts-only-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setState((state) => ({
|
setState((state) => ({
|
||||||
...state,
|
...state,
|
||||||
@@ -554,7 +556,7 @@ export function JobLinesComponent({
|
|||||||
<FilterFilled /> {t("jobs.actions.filterpartsonly")}
|
<FilterFilled /> {t("jobs.actions.filterpartsonly")}
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown menu={markMenu} trigger={["click"]}>
|
<Dropdown menu={markMenu} trigger={["click"]}>
|
||||||
<Button>{t("jobs.actions.mark")}</Button>
|
<Button id="repair-data-mark-button">{t("jobs.actions.mark")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Button
|
<Button
|
||||||
disabled={jobRO || technician}
|
disabled={jobRO || technician}
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ export default function OwnerFindModalContainer({
|
|||||||
}, [callSearchowners, modalProps.open, owner]);
|
}, [callSearchowners, modalProps.open, owner]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal title={t("owners.labels.existing_owners")} width={"80%"} {...modalProps}>
|
<Modal
|
||||||
|
title={<span id="owner-find-modal-title">{t("owners.labels.existing_owners")}</span>}
|
||||||
|
width={"80%"}
|
||||||
|
{...modalProps}
|
||||||
|
>
|
||||||
{loading ? <LoadingSpinner /> : null}
|
{loading ? <LoadingSpinner /> : null}
|
||||||
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
||||||
{owner ? (
|
{owner ? (
|
||||||
|
|||||||
@@ -39,50 +39,50 @@ END;
|
|||||||
$$;
|
$$;
|
||||||
CREATE FUNCTION public.assign_ro_number() RETURNS trigger
|
CREATE FUNCTION public.assign_ro_number() RETURNS trigger
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
AS $$
|
AS $$
|
||||||
begin
|
begin
|
||||||
IF NEW.converted = true and (new.ro_number is null or new.ro_number = '') THEN
|
IF NEW.converted = true and (new.ro_number is null or new.ro_number = '') THEN
|
||||||
UPDATE counters
|
UPDATE counters
|
||||||
SET count = count + 1 where shopid=new.shopid AND countertype = 'ronum'
|
SET count = count + 1 where shopid=new.shopid AND countertype = 'ronum'
|
||||||
RETURNING concat(prefix,count) into new.ro_number;
|
RETURNING concat(prefix,count) into new.ro_number;
|
||||||
END IF;
|
END IF;
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
CREATE FUNCTION public.audit_trigger() RETURNS trigger
|
CREATE FUNCTION public.audit_trigger() RETURNS trigger
|
||||||
LANGUAGE plpgsql SECURITY DEFINER
|
LANGUAGE plpgsql SECURITY DEFINER
|
||||||
AS $$
|
AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
shopid uuid ;
|
shopid uuid ;
|
||||||
email text;
|
email text;
|
||||||
BEGIN
|
BEGIN
|
||||||
select b.id, u.email INTO shopid, email from users u join associations a on u.email = a.useremail join bodyshops b on b.id = a.shopid where u.authid = current_setting('hasura.user', 't')::jsonb->>'x-hasura-user-id' and a.active = true;
|
select b.id, u.email INTO shopid, email from users u join associations a on u.email = a.useremail join bodyshops b on b.id = a.shopid where u.authid = current_setting('hasura.user', 't')::jsonb->>'x-hasura-user-id' and a.active = true;
|
||||||
IF TG_OP = 'INSERT'
|
IF TG_OP = 'INSERT'
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO public.audit_trail (tabname, schemaname, operation, new_val, recordid, bodyshopid, useremail)
|
INSERT INTO public.audit_trail (tabname, schemaname, operation, new_val, recordid, bodyshopid, useremail)
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(NEW), NEW.id, shopid, email);
|
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(NEW), NEW.id, shopid, email);
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
ELSIF TG_OP = 'UPDATE'
|
ELSIF TG_OP = 'UPDATE'
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, new_val, recordid, bodyshopid, useremail)
|
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, new_val, recordid, bodyshopid, useremail)
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP,
|
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP,
|
||||||
json_diff(to_jsonb(OLD), to_jsonb(NEW)) , json_diff(to_jsonb(NEW), to_jsonb(OLD)), OLD.id, shopid, email);
|
json_diff(to_jsonb(OLD), to_jsonb(NEW)) , json_diff(to_jsonb(NEW), to_jsonb(OLD)), OLD.id, shopid, email);
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
ELSIF TG_OP = 'DELETE'
|
ELSIF TG_OP = 'DELETE'
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, recordid, bodyshopid, useremail)
|
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, recordid, bodyshopid, useremail)
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(OLD), OLD.ID, shopid, email);
|
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(OLD), OLD.ID, shopid, email);
|
||||||
RETURN OLD;
|
RETURN OLD;
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
CREATE FUNCTION public.json_diff(l jsonb, r jsonb) RETURNS jsonb
|
CREATE FUNCTION public.json_diff(l jsonb, r jsonb) RETURNS jsonb
|
||||||
LANGUAGE sql
|
LANGUAGE sql
|
||||||
AS $$
|
AS $$
|
||||||
SELECT jsonb_object_agg(a.key, a.value) FROM
|
SELECT jsonb_object_agg(a.key, a.value) FROM
|
||||||
( SELECT key, value FROM jsonb_each(l) ) a LEFT OUTER JOIN
|
( SELECT key, value FROM jsonb_each(l) ) a LEFT OUTER JOIN
|
||||||
( SELECT key, value FROM jsonb_each(r) ) b ON a.key = b.key
|
( SELECT key, value FROM jsonb_each(r) ) b ON a.key = b.key
|
||||||
WHERE a.value != b.value OR b.key IS NULL;
|
WHERE a.value != b.value OR b.key IS NULL;
|
||||||
$$;
|
$$;
|
||||||
CREATE TABLE public.bills (
|
CREATE TABLE public.bills (
|
||||||
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
||||||
@@ -211,33 +211,33 @@ CREATE TABLE public.exportlog (
|
|||||||
);
|
);
|
||||||
CREATE FUNCTION public.search_exportlog(search text) RETURNS SETOF public.exportlog
|
CREATE FUNCTION public.search_exportlog(search text) RETURNS SETOF public.exportlog
|
||||||
LANGUAGE plpgsql STABLE
|
LANGUAGE plpgsql STABLE
|
||||||
AS $$ BEGIN IF search = '' THEN RETURN query
|
AS $$ BEGIN IF search = '' THEN RETURN query
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
exportlog e;
|
exportlog e;
|
||||||
ELSE RETURN query
|
ELSE RETURN query
|
||||||
SELECT
|
SELECT
|
||||||
e.*
|
e.*
|
||||||
FROM
|
FROM
|
||||||
exportlog e
|
exportlog e
|
||||||
LEFT JOIN jobs j on j.id = e.jobid
|
LEFT JOIN jobs j on j.id = e.jobid
|
||||||
LEFT JOIN payments p
|
LEFT JOIN payments p
|
||||||
ON p.id = e.paymentid
|
ON p.id = e.paymentid
|
||||||
LEFT JOIN bills b
|
LEFT JOIN bills b
|
||||||
ON e.billid = b.id
|
ON e.billid = b.id
|
||||||
WHERE
|
WHERE
|
||||||
(
|
(
|
||||||
j.ro_number ILIKE '%' || search || '%'
|
j.ro_number ILIKE '%' || search || '%'
|
||||||
OR b.invoice_number ILIKE '%' || search || '%'
|
OR b.invoice_number ILIKE '%' || search || '%'
|
||||||
OR p.paymentnum ILIKE '%' || search || '%'
|
OR p.paymentnum ILIKE '%' || search || '%'
|
||||||
OR e.useremail ILIKE '%' || search || '%'
|
OR e.useremail ILIKE '%' || search || '%'
|
||||||
)
|
)
|
||||||
AND (e.jobid = j.id
|
AND (e.jobid = j.id
|
||||||
or e.paymentid = p.id
|
or e.paymentid = p.id
|
||||||
or e.billid = b.id)
|
or e.billid = b.id)
|
||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
END $$;
|
END $$;
|
||||||
CREATE TABLE public.jobs (
|
CREATE TABLE public.jobs (
|
||||||
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
||||||
|
|||||||
@@ -39,50 +39,50 @@ END;
|
|||||||
$$;
|
$$;
|
||||||
CREATE FUNCTION public.assign_ro_number() RETURNS trigger
|
CREATE FUNCTION public.assign_ro_number() RETURNS trigger
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
AS $$
|
AS $$
|
||||||
begin
|
begin
|
||||||
IF NEW.converted = true and (new.ro_number is null or new.ro_number = '') THEN
|
IF NEW.converted = true and (new.ro_number is null or new.ro_number = '') THEN
|
||||||
UPDATE counters
|
UPDATE counters
|
||||||
SET count = count + 1 where shopid=new.shopid AND countertype = 'ronum'
|
SET count = count + 1 where shopid=new.shopid AND countertype = 'ronum'
|
||||||
RETURNING concat(prefix,count) into new.ro_number;
|
RETURNING concat(prefix,count) into new.ro_number;
|
||||||
END IF;
|
END IF;
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
CREATE FUNCTION public.audit_trigger() RETURNS trigger
|
CREATE FUNCTION public.audit_trigger() RETURNS trigger
|
||||||
LANGUAGE plpgsql SECURITY DEFINER
|
LANGUAGE plpgsql SECURITY DEFINER
|
||||||
AS $$
|
AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
shopid uuid ;
|
shopid uuid ;
|
||||||
email text;
|
email text;
|
||||||
BEGIN
|
BEGIN
|
||||||
select b.id, u.email INTO shopid, email from users u join associations a on u.email = a.useremail join bodyshops b on b.id = a.shopid where u.authid = current_setting('hasura.user', 't')::jsonb->>'x-hasura-user-id' and a.active = true;
|
select b.id, u.email INTO shopid, email from users u join associations a on u.email = a.useremail join bodyshops b on b.id = a.shopid where u.authid = current_setting('hasura.user', 't')::jsonb->>'x-hasura-user-id' and a.active = true;
|
||||||
IF TG_OP = 'INSERT'
|
IF TG_OP = 'INSERT'
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO public.audit_trail (tabname, schemaname, operation, new_val, recordid, bodyshopid, useremail)
|
INSERT INTO public.audit_trail (tabname, schemaname, operation, new_val, recordid, bodyshopid, useremail)
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(NEW), NEW.id, shopid, email);
|
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(NEW), NEW.id, shopid, email);
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
ELSIF TG_OP = 'UPDATE'
|
ELSIF TG_OP = 'UPDATE'
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, new_val, recordid, bodyshopid, useremail)
|
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, new_val, recordid, bodyshopid, useremail)
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP,
|
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP,
|
||||||
json_diff(to_jsonb(OLD), to_jsonb(NEW)) , json_diff(to_jsonb(NEW), to_jsonb(OLD)), OLD.id, shopid, email);
|
json_diff(to_jsonb(OLD), to_jsonb(NEW)) , json_diff(to_jsonb(NEW), to_jsonb(OLD)), OLD.id, shopid, email);
|
||||||
RETURN NEW;
|
RETURN NEW;
|
||||||
ELSIF TG_OP = 'DELETE'
|
ELSIF TG_OP = 'DELETE'
|
||||||
THEN
|
THEN
|
||||||
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, recordid, bodyshopid, useremail)
|
INSERT INTO public.audit_trail (tabname, schemaname, operation, old_val, recordid, bodyshopid, useremail)
|
||||||
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(OLD), OLD.ID, shopid, email);
|
VALUES (TG_RELNAME, TG_TABLE_SCHEMA, TG_OP, row_to_json(OLD), OLD.ID, shopid, email);
|
||||||
RETURN OLD;
|
RETURN OLD;
|
||||||
END IF;
|
END IF;
|
||||||
END;
|
END;
|
||||||
$$;
|
$$;
|
||||||
CREATE FUNCTION public.json_diff(l jsonb, r jsonb) RETURNS jsonb
|
CREATE FUNCTION public.json_diff(l jsonb, r jsonb) RETURNS jsonb
|
||||||
LANGUAGE sql
|
LANGUAGE sql
|
||||||
AS $$
|
AS $$
|
||||||
SELECT jsonb_object_agg(a.key, a.value) FROM
|
SELECT jsonb_object_agg(a.key, a.value) FROM
|
||||||
( SELECT key, value FROM jsonb_each(l) ) a LEFT OUTER JOIN
|
( SELECT key, value FROM jsonb_each(l) ) a LEFT OUTER JOIN
|
||||||
( SELECT key, value FROM jsonb_each(r) ) b ON a.key = b.key
|
( SELECT key, value FROM jsonb_each(r) ) b ON a.key = b.key
|
||||||
WHERE a.value != b.value OR b.key IS NULL;
|
WHERE a.value != b.value OR b.key IS NULL;
|
||||||
$$;
|
$$;
|
||||||
CREATE TABLE public.bills (
|
CREATE TABLE public.bills (
|
||||||
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
||||||
@@ -211,33 +211,33 @@ CREATE TABLE public.exportlog (
|
|||||||
);
|
);
|
||||||
CREATE FUNCTION public.search_exportlog(search text) RETURNS SETOF public.exportlog
|
CREATE FUNCTION public.search_exportlog(search text) RETURNS SETOF public.exportlog
|
||||||
LANGUAGE plpgsql STABLE
|
LANGUAGE plpgsql STABLE
|
||||||
AS $$ BEGIN IF search = '' THEN RETURN query
|
AS $$ BEGIN IF search = '' THEN RETURN query
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
exportlog e;
|
exportlog e;
|
||||||
ELSE RETURN query
|
ELSE RETURN query
|
||||||
SELECT
|
SELECT
|
||||||
e.*
|
e.*
|
||||||
FROM
|
FROM
|
||||||
exportlog e
|
exportlog e
|
||||||
LEFT JOIN jobs j on j.id = e.jobid
|
LEFT JOIN jobs j on j.id = e.jobid
|
||||||
LEFT JOIN payments p
|
LEFT JOIN payments p
|
||||||
ON p.id = e.paymentid
|
ON p.id = e.paymentid
|
||||||
LEFT JOIN bills b
|
LEFT JOIN bills b
|
||||||
ON e.billid = b.id
|
ON e.billid = b.id
|
||||||
WHERE
|
WHERE
|
||||||
(
|
(
|
||||||
j.ro_number ILIKE '%' || search || '%'
|
j.ro_number ILIKE '%' || search || '%'
|
||||||
OR b.invoice_number ILIKE '%' || search || '%'
|
OR b.invoice_number ILIKE '%' || search || '%'
|
||||||
OR p.paymentnum ILIKE '%' || search || '%'
|
OR p.paymentnum ILIKE '%' || search || '%'
|
||||||
OR e.useremail ILIKE '%' || search || '%'
|
OR e.useremail ILIKE '%' || search || '%'
|
||||||
)
|
)
|
||||||
AND (e.jobid = j.id
|
AND (e.jobid = j.id
|
||||||
or e.paymentid = p.id
|
or e.paymentid = p.id
|
||||||
or e.billid = b.id)
|
or e.billid = b.id)
|
||||||
;
|
;
|
||||||
END IF;
|
END IF;
|
||||||
END $$;
|
END $$;
|
||||||
CREATE TABLE public.jobs (
|
CREATE TABLE public.jobs (
|
||||||
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user