Added alert and setting for PP differences less than a set amount. RPS-34

This commit is contained in:
Patrick Fic
2020-10-29 18:53:17 -07:00
parent 0bb53bd1be
commit 8507ba455a
14 changed files with 144 additions and 19 deletions

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "ppd_diff_alert";
type: run_sql

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -3,7 +3,7 @@
"productName": "ImEX RPS",
"author": "ImEX Systems Inc. <support@thinkimex.com>",
"description": "ImEX RPS",
"version": "1.0.8",
"version": "1.0.2",
"main": "electron/main.js",
"homepage": "./",
"dependencies": {

View File

@@ -3,13 +3,16 @@ import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectSelectedJobTargetPc } from "../../../redux/application/application.selectors";
import { selectBodyshop } from "../../../redux/user/user.selectors";
import "./price-diff-pc-formatter.styles.scss";
const mapStateToProps = createStructuredSelector({
selectedJobTargetPc: selectSelectedJobTargetPc,
bodyshop: selectBodyshop,
});
export function PriceDiffPcFormatterAtom({
bodyshop,
price_diff_pc,
selectedJobTargetPc,
}) {
@@ -22,7 +25,8 @@ export function PriceDiffPcFormatterAtom({
}}
>
{(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) ? (
<AlertFilled style={{ color: "tomato" }} className="blink_me" />
) : null}
</div>

View File

@@ -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 <div>Update Available!</div>;
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(UpdateAvailableAtom);

View File

@@ -60,6 +60,18 @@ export default function ShopSettingsFormMolecule({ form, saveLoading }) {
>
<Select mode="tags" onBlur={handleBlur} />
</Form.Item>
<Form.Item
label="Alert whne Parts Price Difference Less Than"
name="ppd_diff_alert"
rules={[
{
required: true,
},
]}
>
<InputNumber />
</Form.Item>
</LayoutFormRow>
<Typography.Title level={4}>Group Definitions</Typography.Title>
<Form.List name={["targets"]}>

View File

@@ -19,6 +19,11 @@ const mapDispatchToProps = (dispatch) => ({
});
export function UpdateManagerOrganism({ updateAvailable, updateProgress }) {
console.log(
"UpdateManagerOrganism -> updateAvailable, updateProgress",
updateAvailable,
updateProgress
);
if (!updateAvailable) return null;
return (
<Layout.Footer>

View File

@@ -7,6 +7,7 @@ export const QUERY_BODYSHOP = gql`
targets
accepted_ins_co
groups
ppd_diff_alert
}
}
`;
@@ -20,6 +21,7 @@ export const UPDATE_SHOP = gql`
targets
accepted_ins_co
groups
ppd_diff_alert
}
}
}