diff --git a/electron/main.js b/electron/main.js index c2a55f0..f8f6d25 100644 --- a/electron/main.js +++ b/electron/main.js @@ -249,15 +249,17 @@ function createTray() { // autoUpdater.on("checking-for-update", () => { // log.log("Checking for update..."); // }); -// autoUpdater.on("update-available", (ev, info) => { -// log.log("Update available."); -// }); -// autoUpdater.on("update-not-available", (ev, info) => { -// log.log("Update not available."); -// }); -// autoUpdater.on("error", (ev, err) => { -// log.log("Error in auto-updater."); -// }); +autoUpdater.on("update-available", (ev) => { + log.log("Update available.", ev); + mainWindow.webContents.send(ipcTypes.app.toRenderer.updateAvailable, ev); +}); +autoUpdater.on("update-not-available", (ev) => { + log.log("Update not available.", ev); +}); + +autoUpdater.on("error", (ev, err) => { + log.log("Error in auto-updater.", ev, err); +}); // // autoUpdater.on("update-downloaded", (ev, info) => { // // console.log("Update downloaded; will install in 5 seconds"); @@ -326,15 +328,16 @@ autoUpdater.on("update-downloaded", (ev, info) => { async function checkForUpdates() { try { log.info("Checking for updates."); - const result = await autoUpdater.checkForUpdates(); - const { updateInfo } = result; + //const result = await + autoUpdater.checkForUpdates(); + // const { updateInfo } = result; - if (updateInfo.version !== app.getVersion()) { - mainWindow.webContents.send( - ipcTypes.app.toRenderer.updateAvailable, - updateInfo - ); - } + // if (updateInfo.version !== app.getVersion()) { + // mainWindow.webContents.send( + // ipcTypes.app.toRenderer.updateAvailable, + // updateInfo + // ); + // } } catch (error) { log.error("Error while checking for update", error); } diff --git a/hasura/config.yaml b/hasura/config.yaml index 80a8d8e..5909335 100644 --- a/hasura/config.yaml +++ b/hasura/config.yaml @@ -1 +1,2 @@ -endpoint: https://rps.bodyshop.app \ No newline at end of file +#endpoint: https://rps.bodyshop.app +endpoint: https://db.rps.imex.online diff --git a/hasura/migrations/1604011931472_alter_table_public_bodyshops_add_column_ppd_diff_alert/down.yaml b/hasura/migrations/1604011931472_alter_table_public_bodyshops_add_column_ppd_diff_alert/down.yaml new file mode 100644 index 0000000..d0245ef --- /dev/null +++ b/hasura/migrations/1604011931472_alter_table_public_bodyshops_add_column_ppd_diff_alert/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "ppd_diff_alert"; + type: run_sql diff --git a/hasura/migrations/1604011931472_alter_table_public_bodyshops_add_column_ppd_diff_alert/up.yaml b/hasura/migrations/1604011931472_alter_table_public_bodyshops_add_column_ppd_diff_alert/up.yaml new file mode 100644 index 0000000..00ae49f --- /dev/null +++ b/hasura/migrations/1604011931472_alter_table_public_bodyshops_add_column_ppd_diff_alert/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "ppd_diff_alert" numeric NULL + DEFAULT .05; + type: run_sql diff --git a/hasura/migrations/1604011938755_update_permission_user_public_table_bodyshops/down.yaml b/hasura/migrations/1604011938755_update_permission_user_public_table_bodyshops/down.yaml new file mode 100644 index 0000000..da91d45 --- /dev/null +++ b/hasura/migrations/1604011938755_update_permission_user_public_table_bodyshops/down.yaml @@ -0,0 +1,28 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - accepted_ins_co + - created_at + - groups + - id + - shopname + - targets + - updated_at + computed_fields: [] + filter: + associations: + user: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: bodyshops + schema: public + type: create_select_permission diff --git a/hasura/migrations/1604011938755_update_permission_user_public_table_bodyshops/up.yaml b/hasura/migrations/1604011938755_update_permission_user_public_table_bodyshops/up.yaml new file mode 100644 index 0000000..1883517 --- /dev/null +++ b/hasura/migrations/1604011938755_update_permission_user_public_table_bodyshops/up.yaml @@ -0,0 +1,29 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - accepted_ins_co + - created_at + - groups + - id + - ppd_diff_alert + - shopname + - targets + - updated_at + computed_fields: [] + filter: + associations: + user: + authid: + _eq: X-Hasura-User-Id + role: user + table: + name: bodyshops + schema: public + type: create_select_permission diff --git a/hasura/migrations/1604011944447_update_permission_user_public_table_bodyshops/down.yaml b/hasura/migrations/1604011944447_update_permission_user_public_table_bodyshops/down.yaml new file mode 100644 index 0000000..1ff07f9 --- /dev/null +++ b/hasura/migrations/1604011944447_update_permission_user_public_table_bodyshops/down.yaml @@ -0,0 +1,24 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_update_permission +- args: + permission: + columns: + - accepted_ins_co + - groups + - shopname + - targets + filter: + associations: + user: + authid: + _eq: X-Hasura-User-Id + set: {} + role: user + table: + name: bodyshops + schema: public + type: create_update_permission diff --git a/hasura/migrations/1604011944447_update_permission_user_public_table_bodyshops/up.yaml b/hasura/migrations/1604011944447_update_permission_user_public_table_bodyshops/up.yaml new file mode 100644 index 0000000..f52f9fc --- /dev/null +++ b/hasura/migrations/1604011944447_update_permission_user_public_table_bodyshops/up.yaml @@ -0,0 +1,25 @@ +- args: + role: user + table: + name: bodyshops + schema: public + type: drop_update_permission +- args: + permission: + columns: + - accepted_ins_co + - groups + - ppd_diff_alert + - shopname + - targets + filter: + associations: + user: + authid: + _eq: X-Hasura-User-Id + set: {} + role: user + table: + name: bodyshops + schema: public + type: create_update_permission diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index f864e4b..171c7b2 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -46,6 +46,7 @@ tables: - created_at - groups - id + - ppd_diff_alert - shopname - targets - updated_at @@ -60,6 +61,7 @@ tables: columns: - accepted_ins_co - groups + - ppd_diff_alert - shopname - targets filter: diff --git a/package.json b/package.json index db0f24f..f2a446f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.0.7", + "version": "1.0.8", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/public/index.html b/public/index.html index 3ef2c51..e861641 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,9 @@ - + {(price_diff_pc * 100).toFixed(1)}% - {price_diff_pc === 1 ? ( + {price_diff_pc === 1 || + (price_diff_pc <= bodyshop.ppd_diff_alert && price_diff_pc > 0) ? ( ) : null} diff --git a/src/components/atoms/update-available/update-available.atom.jsx b/src/components/atoms/update-available/update-available.atom.jsx deleted file mode 100644 index 684b25e..0000000 --- a/src/components/atoms/update-available/update-available.atom.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from "react"; -import { connect } from "react-redux"; -import { createStructuredSelector } from "reselect"; -import { selectUpdateAvailable } from "../../../redux/application/application.selectors"; -const mapStateToProps = createStructuredSelector({ - //scanLoading: selectScanLoading, - updateAvailable: selectUpdateAvailable, -}); -const mapDispatchToProps = (dispatch) => ({}); - -export function UpdateAvailableAtom({ available }) { - return
Update Available!
; -} -export default connect( - mapStateToProps, - mapDispatchToProps -)(UpdateAvailableAtom); diff --git a/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx b/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx index 6af24c8..b4bae83 100644 --- a/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx +++ b/src/components/molecules/jobs-list-item/jobs-list-item.molecule.jsx @@ -1,3 +1,4 @@ +import { WarningOutlined } from "@ant-design/icons"; import { List } from "antd"; import React from "react"; import { connect } from "react-redux"; @@ -6,7 +7,6 @@ import { setSelectedJobId } from "../../../redux/application/application.actions import { selectSelectedJobId } from "../../../redux/application/application.selectors"; import TimeAgoFormatter from "../../atoms/time-ago-formatter/time-ago-formatter.atom"; import "./jobs-list-item.styles.scss"; -import { WarningOutlined } from "@ant-design/icons"; const mapStateToProps = createStructuredSelector({ selectedJobId: selectSelectedJobId, @@ -19,11 +19,24 @@ export function JobsListItemMolecule({ selectedJobId, setSelectedJobId, item, + refetch, }) { const handleSelect = (jobId) => { setSelectedJobId(jobId); }; + if (item.isRefresh) + return ( + { + refetch(); + }} + > +
Refresh All
+
+ ); return ( diff --git a/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx b/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx index 51bae82..ae9e6f2 100644 --- a/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx +++ b/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx @@ -11,6 +11,8 @@ import { selectReportLoading, selectScorecard, } from "../../../redux/reporting/reporting.selectors"; +import { alphaSort } from "../../../util/sorters"; +import moment from "moment"; const { ipcRenderer } = window; @@ -41,21 +43,34 @@ export function ReportingJobsListMolecule({ {text} ), + sorter: (a, b) => alphaSort(a.clm_no, b.clm_no), + }, + { + title: "Close Date", + dataIndex: "close_date", + key: "close_date", + render: (text, record) => moment(record.close_date).format("MM/DD/yyyy"), + defaultSortOrder: "ascend", + sorter: (a, b) => + moment(a.close_date).unix() - moment(b.close_date).unix(), }, { title: "Ins Co.", dataIndex: "ins_co_nm", key: "ins_co_nm", + sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm), }, { title: "First Name", dataIndex: "ownr_fn", key: "ownr_fn", + sorter: (a, b) => alphaSort(a.ownr_fn, b.ownr_fn), }, { title: "Last Name", dataIndex: "ownr_ln", key: "ownr_ln", + sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln), }, { title: "Vehicle", @@ -72,12 +87,14 @@ export function ReportingJobsListMolecule({ title: "Database Price Sum", dataIndex: "dbPriceSum", key: "dbPriceSum", + sorter: (a, b) => a.dbPriceSum.getAmount() - b.dbPriceSum.getAmount(), render: (text, record) => record.dbPriceSum.toFormat(), }, { title: "Actual Price Sum ", dataIndex: "actPriceSum", key: "actPriceSum", + sorter: (a, b) => a.actPriceSum.getAmount() - b.actPriceSum.getAmount(), render: (text, record) => record.actPriceSum.toFormat(), }, { @@ -104,7 +121,7 @@ export function ReportingJobsListMolecule({ color: record.jobRpsPc > record.jobTarget ? "seagreen" : "tomato", }} > - {`${(record.jobRpsPc * 100).toFixed(1)}% / ${( + {`${(record.jobRpsPc * 100 || 0).toFixed(1)}% / ${( record.jobTarget * 100 ).toFixed(1)}%`} @@ -159,14 +176,13 @@ export function ReportingJobsListMolecule({ - + + {scoreCard && scoreCard.allJobsSumDbPrice.toFormat()} - - {" "} + {scoreCard && scoreCard.allJobsSumActPrice.toFormat()} - )} diff --git a/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx b/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx index 38584c6..bb3baad 100644 --- a/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx +++ b/src/components/molecules/shop-settings-form/shop-settings-form.molecule.jsx @@ -60,6 +60,18 @@ export default function ShopSettingsFormMolecule({ form, saveLoading }) { >