diff --git a/electron/decoder/decoder.js b/electron/decoder/decoder.js
index 0199932..5fc5b74 100644
--- a/electron/decoder/decoder.js
+++ b/electron/decoder/decoder.js
@@ -326,28 +326,27 @@ async function DecodeLinFile(extensionlessFilePath) {
}
);
})
- .filter(
- (jobline) =>
- jobline.part_type &&
- !jobline.db_ref.startsWith("900") &&
- !jobline.line_desc.toLowerCase().startsWith("urethane") &&
- !jobline.line_desc.toLowerCase().startsWith("wheel") &&
- !jobline.line_desc.toLowerCase().startsWith("hazardous") &&
- !jobline.line_desc.toLowerCase().startsWith("detail") &&
- !jobline.line_desc.toLowerCase().startsWith("clean") &&
- jobline.part_type.toUpperCase() !== "PAG" &&
- jobline.part_type.toUpperCase() !== "PAS" &&
- jobline.part_type.toUpperCase() !== "PASL" &&
- jobline.part_type.toUpperCase() !== "PAE" &&
- jobline.glass_flag === false
- )
+ // .filter(
+ // (jobline) =>
+ // jobline.part_type &&
+ // !jobline.db_ref.startsWith("900") &&
+ // !jobline.line_desc.toLowerCase().startsWith("urethane") &&
+ // !jobline.line_desc.toLowerCase().startsWith("wheel") &&
+ // !jobline.line_desc.toLowerCase().startsWith("hazardous") &&
+ // !jobline.line_desc.toLowerCase().startsWith("detail") &&
+ // !jobline.line_desc.toLowerCase().startsWith("clean") &&
+ // jobline.part_type.toUpperCase() !== "PAG" &&
+ // jobline.part_type.toUpperCase() !== "PAS" &&
+ // jobline.part_type.toUpperCase() !== "PASL" &&
+ // jobline.part_type.toUpperCase() !== "PAE" &&
+ // jobline.glass_flag === false
+ // )
.map((jobline) => {
if (
(jobline.db_price === null || jobline.db_price === 0) &&
!!jobline.act_price &&
jobline.act_price > 0
) {
- console.log(1, jobline.line_desc, jobline.db_price, jobline.act_price);
log.info(
"DB Price null/lower than act price",
jobline.line_desc,
@@ -368,10 +367,25 @@ async function DecodeLinFile(extensionlessFilePath) {
jobline.db_price,
jobline.act_price
);
- console.log(2, jobline.line_desc, jobline.db_price, jobline.act_price);
jobline.db_price = jobline.act_price;
}
+ if (
+ !jobline.part_type ||
+ jobline.db_ref.startsWith("900") ||
+ jobline.line_desc.toLowerCase().startsWith("urethane") ||
+ jobline.line_desc.toLowerCase().startsWith("wheel") ||
+ jobline.line_desc.toLowerCase().startsWith("hazardous") ||
+ jobline.line_desc.toLowerCase().startsWith("detail") ||
+ jobline.line_desc.toLowerCase().startsWith("clean") ||
+ jobline.part_type.toUpperCase() === "PAG" ||
+ jobline.part_type.toUpperCase() === "PAS" ||
+ jobline.part_type.toUpperCase() === "PASL" ||
+ jobline.part_type.toUpperCase() === "PAE" ||
+ jobline.glass_flag === true
+ )
+ jobline.ignore = true;
+
delete jobline.glass_flag;
return jobline;
});
diff --git a/hasura/migrations/1603216465074_alter_table_public_joblines_add_column_ignore/down.yaml b/hasura/migrations/1603216465074_alter_table_public_joblines_add_column_ignore/down.yaml
new file mode 100644
index 0000000..155b5e1
--- /dev/null
+++ b/hasura/migrations/1603216465074_alter_table_public_joblines_add_column_ignore/down.yaml
@@ -0,0 +1,5 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: ALTER TABLE "public"."joblines" DROP COLUMN "ignore";
+ type: run_sql
diff --git a/hasura/migrations/1603216465074_alter_table_public_joblines_add_column_ignore/up.yaml b/hasura/migrations/1603216465074_alter_table_public_joblines_add_column_ignore/up.yaml
new file mode 100644
index 0000000..253741d
--- /dev/null
+++ b/hasura/migrations/1603216465074_alter_table_public_joblines_add_column_ignore/up.yaml
@@ -0,0 +1,6 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: ALTER TABLE "public"."joblines" ADD COLUMN "ignore" boolean NOT NULL DEFAULT
+ false;
+ type: run_sql
diff --git a/hasura/migrations/1603216471209_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1603216471209_update_permission_user_public_table_joblines/down.yaml
new file mode 100644
index 0000000..1b9527e
--- /dev/null
+++ b/hasura/migrations/1603216471209_update_permission_user_public_table_joblines/down.yaml
@@ -0,0 +1,39 @@
+- args:
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: drop_insert_permission
+- args:
+ permission:
+ backend_only: false
+ check:
+ job:
+ bodyshop:
+ associations:
+ user:
+ authid:
+ _eq: X-Hasura-User-Id
+ columns:
+ - act_price
+ - created_at
+ - db_price
+ - db_ref
+ - id
+ - jobid
+ - line_desc
+ - line_ind
+ - line_no
+ - oem_partno
+ - part_qty
+ - part_type
+ - price_diff
+ - price_diff_pc
+ - unq_seq
+ - updated_at
+ set: {}
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: create_insert_permission
diff --git a/hasura/migrations/1603216471209_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1603216471209_update_permission_user_public_table_joblines/up.yaml
new file mode 100644
index 0000000..86afc84
--- /dev/null
+++ b/hasura/migrations/1603216471209_update_permission_user_public_table_joblines/up.yaml
@@ -0,0 +1,40 @@
+- args:
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: drop_insert_permission
+- args:
+ permission:
+ backend_only: false
+ check:
+ job:
+ bodyshop:
+ associations:
+ user:
+ authid:
+ _eq: X-Hasura-User-Id
+ columns:
+ - act_price
+ - created_at
+ - db_price
+ - db_ref
+ - id
+ - ignore
+ - jobid
+ - line_desc
+ - line_ind
+ - line_no
+ - oem_partno
+ - part_qty
+ - part_type
+ - price_diff
+ - price_diff_pc
+ - unq_seq
+ - updated_at
+ set: {}
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: create_insert_permission
diff --git a/hasura/migrations/1603216476135_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1603216476135_update_permission_user_public_table_joblines/down.yaml
new file mode 100644
index 0000000..518eff7
--- /dev/null
+++ b/hasura/migrations/1603216476135_update_permission_user_public_table_joblines/down.yaml
@@ -0,0 +1,39 @@
+- args:
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: drop_select_permission
+- args:
+ permission:
+ allow_aggregations: false
+ columns:
+ - act_price
+ - created_at
+ - db_price
+ - db_ref
+ - id
+ - jobid
+ - line_desc
+ - line_ind
+ - line_no
+ - oem_partno
+ - part_qty
+ - part_type
+ - price_diff
+ - price_diff_pc
+ - unq_seq
+ - updated_at
+ computed_fields: []
+ filter:
+ job:
+ bodyshop:
+ associations:
+ user:
+ authid:
+ _eq: X-Hasura-User-Id
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: create_select_permission
diff --git a/hasura/migrations/1603216476135_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1603216476135_update_permission_user_public_table_joblines/up.yaml
new file mode 100644
index 0000000..873ee04
--- /dev/null
+++ b/hasura/migrations/1603216476135_update_permission_user_public_table_joblines/up.yaml
@@ -0,0 +1,40 @@
+- args:
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: drop_select_permission
+- args:
+ permission:
+ allow_aggregations: false
+ columns:
+ - act_price
+ - created_at
+ - db_price
+ - db_ref
+ - id
+ - ignore
+ - jobid
+ - line_desc
+ - line_ind
+ - line_no
+ - oem_partno
+ - part_qty
+ - part_type
+ - price_diff
+ - price_diff_pc
+ - unq_seq
+ - updated_at
+ computed_fields: []
+ filter:
+ job:
+ bodyshop:
+ associations:
+ user:
+ authid:
+ _eq: X-Hasura-User-Id
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: create_select_permission
diff --git a/hasura/migrations/1603216480562_update_permission_user_public_table_joblines/down.yaml b/hasura/migrations/1603216480562_update_permission_user_public_table_joblines/down.yaml
new file mode 100644
index 0000000..f753d5a
--- /dev/null
+++ b/hasura/migrations/1603216480562_update_permission_user_public_table_joblines/down.yaml
@@ -0,0 +1,38 @@
+- args:
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: drop_update_permission
+- args:
+ permission:
+ columns:
+ - act_price
+ - created_at
+ - db_price
+ - db_ref
+ - id
+ - jobid
+ - line_desc
+ - line_ind
+ - line_no
+ - oem_partno
+ - part_qty
+ - part_type
+ - price_diff
+ - price_diff_pc
+ - unq_seq
+ - updated_at
+ filter:
+ job:
+ bodyshop:
+ associations:
+ user:
+ authid:
+ _eq: X-Hasura-User-Id
+ set: {}
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: create_update_permission
diff --git a/hasura/migrations/1603216480562_update_permission_user_public_table_joblines/up.yaml b/hasura/migrations/1603216480562_update_permission_user_public_table_joblines/up.yaml
new file mode 100644
index 0000000..5f6a028
--- /dev/null
+++ b/hasura/migrations/1603216480562_update_permission_user_public_table_joblines/up.yaml
@@ -0,0 +1,39 @@
+- args:
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: drop_update_permission
+- args:
+ permission:
+ columns:
+ - act_price
+ - created_at
+ - db_price
+ - db_ref
+ - id
+ - ignore
+ - jobid
+ - line_desc
+ - line_ind
+ - line_no
+ - oem_partno
+ - part_qty
+ - part_type
+ - price_diff
+ - price_diff_pc
+ - unq_seq
+ - updated_at
+ filter:
+ job:
+ bodyshop:
+ associations:
+ user:
+ authid:
+ _eq: X-Hasura-User-Id
+ set: {}
+ role: user
+ table:
+ name: joblines
+ schema: public
+ type: create_update_permission
diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml
index 2942282..c3aca2f 100644
--- a/hasura/migrations/metadata.yaml
+++ b/hasura/migrations/metadata.yaml
@@ -89,6 +89,7 @@ tables:
- db_price
- db_ref
- id
+ - ignore
- jobid
- line_desc
- line_ind
@@ -110,6 +111,7 @@ tables:
- db_price
- db_ref
- id
+ - ignore
- jobid
- line_desc
- line_ind
@@ -137,6 +139,7 @@ tables:
- db_price
- db_ref
- id
+ - ignore
- jobid
- line_desc
- line_ind
diff --git a/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx b/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx
new file mode 100644
index 0000000..b9e2cdc
--- /dev/null
+++ b/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx
@@ -0,0 +1,24 @@
+import { useMutation } from "@apollo/client";
+import { message, Switch } from "antd";
+import React, { useState } from "react";
+import { UPDATE_JOB_LINE } from "../../../graphql/joblines.queries";
+const { log } = window;
+
+export default function IgnoreJobLineAtom({ ignore, lineId }) {
+ const [updateJobLine] = useMutation(UPDATE_JOB_LINE);
+ const [loading, setLoading] = useState(false);
+ const handleChange = async (checked) => {
+ setLoading(true);
+ const result = await updateJobLine({
+ variables: { lineId: lineId, line: { ignore: checked } },
+ });
+ if (result.errors) {
+ message.error("Error updating line.");
+ log.error("Error updating job.", result.errors);
+ } else {
+ }
+ setLoading(false);
+ };
+
+ return