Compare commits
260 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f28653546b | ||
|
|
e742917876 | ||
|
|
04a193ef37 | ||
|
|
cf258e9a12 | ||
|
|
a230e15a66 | ||
|
|
011cb1b349 | ||
|
|
9b2cdddb88 | ||
|
|
c71db5133d | ||
|
|
ee733434e6 | ||
|
|
c2050e7e26 | ||
|
|
c0096a0dec | ||
|
|
41e40b9165 | ||
|
|
1e566c82cd | ||
|
|
d45be60668 | ||
|
|
62d5511337 | ||
|
|
ac37074666 | ||
|
|
9467c57c8f | ||
|
|
87f591ce1b | ||
|
|
c3a950088e | ||
|
|
704e35e0b0 | ||
|
|
d616d204d0 | ||
|
|
8eae657bb3 | ||
|
|
492cee29e7 | ||
|
|
b4cd016008 | ||
|
|
7595cbf11d | ||
|
|
786f2f212c | ||
|
|
bdfbe52244 | ||
|
|
0ca75298d8 | ||
|
|
1ffad4a8b0 | ||
|
|
cac7df66e1 | ||
|
|
cb50ca7897 | ||
|
|
a4f4f45251 | ||
|
|
acc91abc0c | ||
|
|
d6d6ced7a4 | ||
|
|
17928741e3 | ||
|
|
a6b825ffdf | ||
|
|
f2914868e2 | ||
|
|
561f0313f9 | ||
|
|
02a49efbea | ||
|
|
4fb9c37c0d | ||
|
|
1620b94a7b | ||
|
|
81f94eac6c | ||
|
|
ec7509670d | ||
|
|
0acfd3c4b1 | ||
|
|
bfc4cb1ad9 | ||
|
|
1f42be2e54 | ||
|
|
30d344af6b | ||
|
|
3ca989fd8c | ||
|
|
ce2086a480 | ||
|
|
63f7106d2b | ||
|
|
e75d8d1874 | ||
|
|
07bf84ed69 | ||
|
|
c2cc7b1e9e | ||
|
|
fe55eccbf9 | ||
|
|
88a71dd647 | ||
|
|
c3b395c99e | ||
|
|
33d5d9b462 | ||
|
|
b5a371d0cf | ||
|
|
3b35f38ad5 | ||
|
|
1f5c1b9658 | ||
|
|
37196e65c3 | ||
|
|
b20c605c85 | ||
|
|
d8ac708536 | ||
|
|
8a32fe50f3 | ||
|
|
7897a490bd | ||
|
|
17d73fc6d7 | ||
|
|
7d1910086e | ||
|
|
817c41afb9 | ||
|
|
04315a9045 | ||
|
|
d0871ffe21 | ||
|
|
dca587d6e0 | ||
|
|
19ec4cb021 | ||
|
|
346e82bdbc | ||
|
|
fd9575e5a5 | ||
|
|
af6bc0fb5a | ||
|
|
d0e289757f | ||
|
|
becc54f7b3 | ||
|
|
e3fabdac91 | ||
|
|
40621db556 | ||
|
|
c2e64a124d | ||
|
|
1fa83d124d | ||
|
|
cc734d3981 | ||
|
|
b41d69593d | ||
|
|
b7055aac84 | ||
|
|
09e505399c | ||
|
|
42f9f275c7 | ||
|
|
39b119b2e8 | ||
|
|
5bc224206c | ||
|
|
190da863c2 | ||
|
|
2711b5fce5 | ||
|
|
8e9358cd6f | ||
|
|
0e31bbb789 | ||
|
|
3b635aeed3 | ||
|
|
1f896b1ede | ||
|
|
b1ca09bd4f | ||
|
|
f9ca36ec89 | ||
|
|
9d479d4b4d | ||
|
|
23b5b740cb | ||
|
|
8f9b05b974 | ||
|
|
d1132e7d45 | ||
|
|
960b0b4d09 | ||
|
|
f35ea026b8 | ||
|
|
b1fc2828c8 | ||
|
|
bc25c23982 | ||
|
|
2215c8439e | ||
|
|
f98c9e6f71 | ||
|
|
28f2e8ad30 | ||
|
|
c27e206687 | ||
|
|
01fd253f1d | ||
|
|
e67bc0d953 | ||
|
|
3eab3e2fb6 | ||
|
|
3adf6b649b | ||
|
|
f8243aa2b3 | ||
|
|
3c3f50d138 | ||
|
|
4f7e1b81ac | ||
|
|
806bdc4c70 | ||
|
|
a0572a0cec | ||
|
|
04cdf13e86 | ||
|
|
50349e91dc | ||
|
|
9998a8f154 | ||
|
|
9dcbcb2a43 | ||
|
|
5773f7a0f3 | ||
|
|
8614d88e71 | ||
|
|
fa5e26c52a | ||
|
|
90e1cbd390 | ||
|
|
947a3c6a88 | ||
|
|
a33662e6f0 | ||
|
|
6d1f04369e | ||
|
|
4a27726ef3 | ||
|
|
eedba97237 | ||
|
|
bcf095ed4f | ||
|
|
c3f9e268c7 | ||
|
|
c8442f0750 | ||
|
|
da5b446c30 | ||
|
|
e13b2bb969 | ||
|
|
e8969c4698 | ||
|
|
346d32a2bb | ||
|
|
6ba00a90be | ||
|
|
4293d20313 | ||
|
|
706c70c509 | ||
|
|
e872b1bf0a | ||
|
|
379fa060d8 | ||
|
|
a6258c6456 | ||
|
|
d6bf0a225b | ||
|
|
ec2b914e5e | ||
|
|
309a20148a | ||
|
|
013b56778b | ||
|
|
9dec4a3a61 | ||
|
|
189b4db90f | ||
|
|
c49fa1c527 | ||
|
|
53ef048f6f | ||
|
|
1cc7eed983 | ||
|
|
1c8f377212 | ||
|
|
c050947276 | ||
|
|
9bde1f820d | ||
|
|
393765640c | ||
|
|
69c2836425 | ||
|
|
ec9edf30eb | ||
|
|
6a812f9ea7 | ||
|
|
fa86254bfd | ||
|
|
58ab7afbb3 | ||
|
|
fa7d90d2a9 | ||
|
|
fbf9047974 | ||
|
|
3e9b795052 | ||
|
|
d29ffc21e5 | ||
|
|
959f7780e8 | ||
|
|
e47731702a | ||
|
|
85a3aeb335 | ||
|
|
80b7ae0e54 | ||
|
|
0529ac4478 | ||
|
|
3cafbebbee | ||
|
|
6f248d864e | ||
|
|
a4a84572b7 | ||
|
|
a45d0bb9f4 | ||
|
|
a2e0f9fbe7 | ||
|
|
e37dc0a18f | ||
|
|
0bc00d46cf | ||
|
|
e80e40bb76 | ||
|
|
a88c102b27 | ||
|
|
c691d44c44 | ||
|
|
ebb3a13ff5 | ||
|
|
3846b7c5fc | ||
|
|
93d139f926 | ||
|
|
4d1f40537c | ||
|
|
896f1415f7 | ||
|
|
8a01cd9cb0 | ||
|
|
c2013d47e7 | ||
|
|
0f20807690 | ||
|
|
2a45be6a45 | ||
|
|
b63602143e | ||
|
|
2add712270 | ||
|
|
77c8f74bcb | ||
|
|
1d38102541 | ||
|
|
6117b5ab64 | ||
|
|
578f0a110e | ||
|
|
b5c66274ca | ||
|
|
be46bdc57f | ||
|
|
6263e63a1d | ||
|
|
83d702f12b | ||
|
|
37708a0b59 | ||
|
|
6cfcab8156 | ||
|
|
33ec18986d | ||
|
|
6b7b34ae79 | ||
|
|
06ef2482ba | ||
|
|
83bd485597 | ||
|
|
6921f2fe68 | ||
|
|
a7e199932c | ||
|
|
2427c14b7b | ||
|
|
66655d449e | ||
|
|
845a84c4c8 | ||
|
|
0ff5ea3d59 | ||
|
|
09492e647e | ||
|
|
2d6594cc73 | ||
|
|
3b8e83d88a | ||
|
|
3ec4dbb5b8 | ||
|
|
601fdbba39 | ||
|
|
830adc4ef3 | ||
|
|
3f216195ca | ||
|
|
bcb8de0937 | ||
|
|
9cc0d6175e | ||
|
|
4c07632ee6 | ||
|
|
767c219af8 | ||
|
|
cfc301570e | ||
|
|
fb718f9f37 | ||
|
|
cafc0e5628 | ||
|
|
a635725839 | ||
|
|
eb8e9b10ef | ||
|
|
2584f7129c | ||
|
|
6c996037d6 | ||
|
|
f421b45222 | ||
|
|
30cf46a158 | ||
|
|
8d37c54f89 | ||
|
|
f9b9f39418 | ||
|
|
05a5df789b | ||
|
|
bed87eda97 | ||
|
|
67008c35b8 | ||
|
|
9b95e40a13 | ||
|
|
e3a998b6f8 | ||
|
|
3c7ede0155 | ||
|
|
82c7aa1347 | ||
|
|
4ccd912363 | ||
|
|
c0525842fd | ||
|
|
dd5ca5d233 | ||
|
|
616a4b04a0 | ||
|
|
9a34640c88 | ||
|
|
3110be4703 | ||
|
|
971c8d41ff | ||
|
|
7c303a5154 | ||
|
|
9383b37a41 | ||
|
|
205d507097 | ||
|
|
97a1bd66d1 | ||
|
|
0d1ff6390c | ||
|
|
830d2c87d2 | ||
|
|
da98e7b886 | ||
|
|
a74a9ba5a1 | ||
|
|
b8a3081488 | ||
|
|
c8fc1b0f68 | ||
|
|
da1ddb874f | ||
|
|
771f9ceaa8 | ||
|
|
9b61da5c62 |
@@ -42,7 +42,7 @@ jobs:
|
|||||||
app-build:
|
app-build:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/node:16.15.0
|
- image: cimg/node:16.15.0
|
||||||
|
resource_class: large
|
||||||
working_directory: ~/repo/client
|
working_directory: ~/repo/client
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -83,7 +83,7 @@ jobs:
|
|||||||
test-app-build:
|
test-app-build:
|
||||||
docker:
|
docker:
|
||||||
- image: cimg/node:16.15.0
|
- image: cimg/node:16.15.0
|
||||||
|
resource_class: large
|
||||||
working_directory: ~/repo/client
|
working_directory: ~/repo/client
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -134,10 +134,6 @@ jobs:
|
|||||||
workflows:
|
workflows:
|
||||||
deploy_and_build:
|
deploy_and_build:
|
||||||
jobs:
|
jobs:
|
||||||
- api-deploy:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: master
|
|
||||||
- app-build:
|
- app-build:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
@@ -159,4 +155,4 @@ workflows:
|
|||||||
#- admin-app-build:
|
#- admin-app-build:
|
||||||
#filters:
|
#filters:
|
||||||
#branches:
|
#branches:
|
||||||
#only: master
|
#only: master
|
||||||
|
|||||||
16
.prettierrc.js
Normal file
16
.prettierrc.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
exports.default = {
|
||||||
|
printWidth: 120,
|
||||||
|
useTabs: false,
|
||||||
|
tabWidth: 2,
|
||||||
|
trailingComma: "es5",
|
||||||
|
semi: true,
|
||||||
|
singleQuote: false,
|
||||||
|
bracketSpacing: true,
|
||||||
|
arrowParens: "always",
|
||||||
|
jsxSingleQuote: false,
|
||||||
|
bracketSameLine: false,
|
||||||
|
endOfLine: "lf",
|
||||||
|
importOrder: ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
|
||||||
|
importOrderSeparation: true,
|
||||||
|
importOrderSortSpecifiers: true,
|
||||||
|
};
|
||||||
189
_reference/reportFiltersAndSorters.md
Normal file
189
_reference/reportFiltersAndSorters.md
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
# Filters and Sorters
|
||||||
|
|
||||||
|
This documentation details the schema required for `.filters` files on the report server. It is used to dynamically
|
||||||
|
modify the graphQL query and provide the user more power over their reports.
|
||||||
|
|
||||||
|
For filters and sorters, valid types include (`type` key in the schema):
|
||||||
|
- string (default)
|
||||||
|
- number
|
||||||
|
- bool or boolean
|
||||||
|
- date
|
||||||
|
|
||||||
|
## Special Notes
|
||||||
|
- When passing the data to the template server, the property filters and sorters is added to the data object and will reflect the filters and sorters the user has selected
|
||||||
|
|
||||||
|
## High level Schema Overview
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const schema = {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"name": "jobs.joblines.mod_lb_hrs", // Name and path of the field in the graphQL query
|
||||||
|
"translation": "jobs.joblines.mod_lb_hrs_1", // Translation key for the label used in the GUI
|
||||||
|
"label": "mod_lb_hrs_1", // Label used in the case the GUI does not contain a translation
|
||||||
|
"type": "number" // Type of field, can be number or string currently
|
||||||
|
},
|
||||||
|
// ... more filters
|
||||||
|
],
|
||||||
|
"sorters": [
|
||||||
|
{
|
||||||
|
"name": "jobs.joblines.mod_lb_hrs", // Name and path of the field in the graphQL query
|
||||||
|
"translation": "jobs.joblines.mod_lb_hrs_1", // Translation key for the label used in the GUI
|
||||||
|
"label": "mod_lb_hrs_1", // Label used in the case the GUI does not contain a translation
|
||||||
|
"type": "number" // Type of field, can be number or string currently
|
||||||
|
},
|
||||||
|
// ... more sorters
|
||||||
|
],
|
||||||
|
"dates": {
|
||||||
|
// This is not yet implemented and will be added in a future release
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Filters
|
||||||
|
|
||||||
|
Filters effect the where clause of the graphQL query. They are used to filter the data returned from the server.
|
||||||
|
A note on special notation used in the `name` field.
|
||||||
|
|
||||||
|
## Reflection
|
||||||
|
|
||||||
|
Filters can make use of reflection to pre-fill select boxes, the following is an example of that in the filters file.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "jobs.status",
|
||||||
|
"translation": "jobs.fields.status",
|
||||||
|
"label": "Status",
|
||||||
|
"type": "string",
|
||||||
|
"reflector": {
|
||||||
|
"type": "internal",
|
||||||
|
"name": "special.job_statuses"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
in this example, a reflector with the type 'internal' (all types at the moment require this, and it is used for future functionality), with a name of `special.job_statuses`
|
||||||
|
|
||||||
|
The following cases are available
|
||||||
|
|
||||||
|
- `special.job_statuses` - This will reflect the statuses of the jobs table `bodyshop.md_ro_statuses.statuses'`
|
||||||
|
- `special.cost_centers` - This will reflect the cost centers `bodyshop.md_responsibility_centers.costs`
|
||||||
|
- `special.categories` - This will reflect the categories `bodyshop.md_categories`
|
||||||
|
- `special.insurance_companies` - This will reflect the insurance companies `bodyshop.md_ins_cos`'
|
||||||
|
- `special.employee_teams` - This will reflect the employee teams `bodyshop.employee_teams`
|
||||||
|
- `special.employees` - This will reflect the employees `bodyshop.employees`
|
||||||
|
- `special.first_names` - This will reflect the first names `bodyshop.employees`
|
||||||
|
- `special.last_names` - This will reflect the last names `bodyshop.employees`
|
||||||
|
- `special.referral_sources` - This will reflect the referral sources `bodyshop.md_referral_sources`
|
||||||
|
- `special.class`- This will reflect the class `bodyshop.md_classes`
|
||||||
|
- `special.lost_sale_reasons` - This will reflect the lost sale reasons `bodyshop.md_lost_sale_reasons`
|
||||||
|
- `special.alt_transports` - This will reflect the alternative transports `bodyshop.appt_alt_transport`
|
||||||
|
- `special.payment_types` - This will reflect the payment types `bodyshop.md_payment_types`
|
||||||
|
- `special.payment_payers` - This is a special case with a key value set of [Customer, Insurance]
|
||||||
|
|
||||||
|
### Path without brackets, multi level
|
||||||
|
|
||||||
|
`"name": "jobs.joblines.mod_lb_hrs",`
|
||||||
|
This will produce a where clause at the `joblines` level of the graphQL query,
|
||||||
|
|
||||||
|
```graphql
|
||||||
|
query gendoc_hours_sold_detail_open($starttz: timestamptz!, $endtz: timestamptz!) {
|
||||||
|
jobs(
|
||||||
|
where: {date_invoiced: {_is_null: true}, date_open: {_gte: $starttz, _lte: $endtz}, ro_number: {_is_null: false}, voided: {_eq: false}}
|
||||||
|
) {
|
||||||
|
joblines(
|
||||||
|
order_by: {line_no: asc}
|
||||||
|
where: {removed: {_eq: false}, mod_lb_hrs: {_lt: 3}}
|
||||||
|
) {
|
||||||
|
line_no
|
||||||
|
mod_lbr_ty
|
||||||
|
mod_lb_hrs
|
||||||
|
convertedtolbr
|
||||||
|
convertedtolbr_data
|
||||||
|
}
|
||||||
|
ownr_co_nm
|
||||||
|
ownr_fn
|
||||||
|
ownr_ln
|
||||||
|
plate_no
|
||||||
|
ro_number
|
||||||
|
status
|
||||||
|
v_make_desc
|
||||||
|
v_model_desc
|
||||||
|
v_model_yr
|
||||||
|
v_vin
|
||||||
|
v_color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Path with brackets,top level
|
||||||
|
|
||||||
|
`"name": "[jobs].joblines.mod_lb_hrs",`
|
||||||
|
This will produce a where clause at the `jobs` level of the graphQL query.
|
||||||
|
|
||||||
|
```graphql
|
||||||
|
query gendoc_hours_sold_detail_open($starttz: timestamptz!, $endtz: timestamptz!) {
|
||||||
|
jobs(
|
||||||
|
where: {date_invoiced: {_is_null: true}, date_open: {_gte: $starttz, _lte: $endtz}, ro_number: {_is_null: false}, voided: {_eq: false}, joblines: {mod_lb_hrs: {_gt: 4}}}
|
||||||
|
) {
|
||||||
|
joblines(
|
||||||
|
order_by: {line_no: asc}
|
||||||
|
where: {removed: {_eq: false}}
|
||||||
|
) {
|
||||||
|
line_no
|
||||||
|
mod_lbr_ty
|
||||||
|
mod_lb_hrs
|
||||||
|
convertedtolbr
|
||||||
|
convertedtolbr_data
|
||||||
|
}
|
||||||
|
ownr_co_nm
|
||||||
|
ownr_fn
|
||||||
|
ownr_ln
|
||||||
|
plate_no
|
||||||
|
ro_number
|
||||||
|
status
|
||||||
|
v_make_desc
|
||||||
|
v_model_desc
|
||||||
|
v_model_yr
|
||||||
|
v_vin
|
||||||
|
v_color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Known Caveats
|
||||||
|
|
||||||
|
- Will only support two level of nesting in the graphQL query `jobs.joblines.mod_lb_hrs` vs `[jobs].joblines.mod_lb_hrs`
|
||||||
|
is fine, but `jobs.[joblines.].some_table.mod_lb_hrs` is not.
|
||||||
|
- The type object must be 'string' or 'number' or 'bool' or 'boolean' or 'date' and is case-sensitive.
|
||||||
|
- The `translation` key is used to look up the label in the GUI, if it is not found, the `label` key is used.
|
||||||
|
- Do not add the ability to filter things that are already filtered as part of the original query, this would be
|
||||||
|
redundant and could cause issues.
|
||||||
|
- Do not add the ability to filter on things like FK constraints, must like the above example.
|
||||||
|
- *INHERITANCE CAVEAT* If you have a filters file on a parent report that has a child that you do not want the filters inherited from, you must place a blank filters file (valid json so {}) on the child report level. This will than fetch the child filters, which are empty and move along, versus inheriting the parent filters.
|
||||||
|
|
||||||
|
## Sorters
|
||||||
|
|
||||||
|
- Sorters follow the same schema as filters, however, they do not do square bracket wrapping to indicate level hoisting,
|
||||||
|
a filter added on `job.md_status` would be added at the top level, and a filter added on `jobs.joblines.mod_lb_hrs`
|
||||||
|
would be added at the `joblines` level.
|
||||||
|
- Most of the reports currently do sorting on a template level, this will need to change to actually see the results
|
||||||
|
using the sorters.
|
||||||
|
|
||||||
|
### Default Sorters
|
||||||
|
|
||||||
|
- A sorter can be given a default object containing a `order` and `direction` key value. This will be used to sort the report if the user does not select any of the sorters themselves.
|
||||||
|
- The `order` key is the order in which the sorters are applied, and the `direction` key is the direction of the sort, either `asc` or `desc`.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "jobs.joblines.mod_lb_hrs",
|
||||||
|
"translation": "jobs.joblines.mod_lb_hrs_1",
|
||||||
|
"label": "mod_lb_hrs_1",
|
||||||
|
"type": "number",
|
||||||
|
"default": {
|
||||||
|
"order": 1,
|
||||||
|
"direction": "asc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -16,42 +16,28 @@ import TechPageContainer from "../pages/tech/tech.page.container";
|
|||||||
import { setOnline } from "../redux/application/application.actions";
|
import { setOnline } from "../redux/application/application.actions";
|
||||||
import { selectOnline } from "../redux/application/application.selectors";
|
import { selectOnline } from "../redux/application/application.selectors";
|
||||||
import { checkUserSession } from "../redux/user/user.actions";
|
import { checkUserSession } from "../redux/user/user.actions";
|
||||||
import {
|
import { selectBodyshop, selectCurrentUser } from "../redux/user/user.selectors";
|
||||||
selectBodyshop,
|
|
||||||
selectCurrentUser,
|
|
||||||
} from "../redux/user/user.selectors";
|
|
||||||
import PrivateRoute from "../utils/private-route";
|
import PrivateRoute from "../utils/private-route";
|
||||||
import "./App.styles.scss";
|
import "./App.styles.scss";
|
||||||
import handleBeta from "../utils/handleBeta";
|
|
||||||
|
|
||||||
const ResetPassword = lazy(() =>
|
const ResetPassword = lazy(() => import("../pages/reset-password/reset-password.component"));
|
||||||
import("../pages/reset-password/reset-password.component")
|
|
||||||
);
|
|
||||||
const ManagePage = lazy(() => import("../pages/manage/manage.page.container"));
|
const ManagePage = lazy(() => import("../pages/manage/manage.page.container"));
|
||||||
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
|
const SignInPage = lazy(() => import("../pages/sign-in/sign-in.page"));
|
||||||
|
|
||||||
const CsiPage = lazy(() => import("../pages/csi/csi.container.page"));
|
const CsiPage = lazy(() => import("../pages/csi/csi.container.page"));
|
||||||
const MobilePaymentContainer = lazy(() =>
|
const MobilePaymentContainer = lazy(() => import("../pages/mobile-payment/mobile-payment.container"));
|
||||||
import("../pages/mobile-payment/mobile-payment.container")
|
|
||||||
);
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
online: selectOnline,
|
online: selectOnline,
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
checkUserSession: () => dispatch(checkUserSession()),
|
checkUserSession: () => dispatch(checkUserSession()),
|
||||||
setOnline: (isOnline) => dispatch(setOnline(isOnline)),
|
setOnline: (isOnline) => dispatch(setOnline(isOnline))
|
||||||
});
|
});
|
||||||
|
|
||||||
export function App({
|
export function App({ bodyshop, checkUserSession, currentUser, online, setOnline }) {
|
||||||
bodyshop,
|
|
||||||
checkUserSession,
|
|
||||||
currentUser,
|
|
||||||
online,
|
|
||||||
setOnline,
|
|
||||||
}) {
|
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -108,8 +94,6 @@ export function App({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
handleBeta();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
<Suspense fallback={<LoadingSpinner message="ImEX Online" />}>
|
<Suspense fallback={<LoadingSpinner message="ImEX Online" />}>
|
||||||
@@ -129,32 +113,16 @@ export function App({
|
|||||||
<Route exact path="/disclaimer" component={DisclaimerPage} />
|
<Route exact path="/disclaimer" component={DisclaimerPage} />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<Route
|
<Route exact path="/mp/:paymentIs" component={MobilePaymentContainer} />
|
||||||
exact
|
|
||||||
path="/mp/:paymentIs"
|
|
||||||
component={MobilePaymentContainer}
|
|
||||||
/>
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<PrivateRoute
|
<PrivateRoute isAuthorized={currentUser.authorized} path="/manage" component={ManagePage} />
|
||||||
isAuthorized={currentUser.authorized}
|
|
||||||
path="/manage"
|
|
||||||
component={ManagePage}
|
|
||||||
/>
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<PrivateRoute
|
<PrivateRoute isAuthorized={currentUser.authorized} path="/tech" component={TechPageContainer} />
|
||||||
isAuthorized={currentUser.authorized}
|
|
||||||
path="/tech"
|
|
||||||
component={TechPageContainer}
|
|
||||||
/>
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
<PrivateRoute
|
<PrivateRoute isAuthorized={currentUser.authorized} path="/edit" component={DocumentEditorContainer} />
|
||||||
isAuthorized={currentUser.authorized}
|
|
||||||
path="/edit"
|
|
||||||
component={DocumentEditorContainer}
|
|
||||||
/>
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
import { Input, Table, Checkbox, Card, Space } from "antd";
|
import { Card, Checkbox, Input, Space, Table } from "antd";
|
||||||
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
|
||||||
import PayableExportButton from "../payable-export-button/payable-export-button.component";
|
|
||||||
import PayableExportAll from "../payable-export-all-button/payable-export-all-button.component";
|
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
|
||||||
import queryString from "query-string";
|
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
|
||||||
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { pageLimit } from "../../utils/config";
|
||||||
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
|
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
|
||||||
|
import PayableExportAll from "../payable-export-all-button/payable-export-all-button.component";
|
||||||
|
import PayableExportButton from "../payable-export-button/payable-export-button.component";
|
||||||
import BillMarkSelectedExported from "../payable-mark-selected-exported/payable-mark-selected-exported.component";
|
import BillMarkSelectedExported from "../payable-mark-selected-exported/payable-mark-selected-exported.component";
|
||||||
import {pageLimit} from "../../utils/config";
|
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -138,7 +138,6 @@ export function AccountingPayablesTableComponent({
|
|||||||
title: t("exportlogs.labels.attempts"),
|
title: t("exportlogs.labels.attempts"),
|
||||||
dataIndex: "attempts",
|
dataIndex: "attempts",
|
||||||
key: "attempts",
|
key: "attempts",
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ExportLogsCountDisplay logs={record.exportlogs} />
|
<ExportLogsCountDisplay logs={record.exportlogs} />
|
||||||
),
|
),
|
||||||
@@ -147,8 +146,6 @@ export function AccountingPayablesTableComponent({
|
|||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
key: "actions",
|
key: "actions",
|
||||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<PayableExportButton
|
<PayableExportButton
|
||||||
billId={record.id}
|
billId={record.id}
|
||||||
|
|||||||
@@ -8,14 +8,16 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
|
|||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { pageLimit } from "../../utils/config";
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
|
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../owner-name-display/owner-name-display.component";
|
||||||
import PaymentExportButton from "../payment-export-button/payment-export-button.component";
|
import PaymentExportButton from "../payment-export-button/payment-export-button.component";
|
||||||
import PaymentMarkSelectedExported from "../payment-mark-selected-exported/payment-mark-selected-exported.component";
|
import PaymentMarkSelectedExported from "../payment-mark-selected-exported/payment-mark-selected-exported.component";
|
||||||
import PaymentsExportAllButton from "../payments-export-all-button/payments-export-all-button.component";
|
import PaymentsExportAllButton from "../payments-export-all-button/payments-export-all-button.component";
|
||||||
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
||||||
import {pageLimit} from "../../utils/config";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -75,7 +77,11 @@ export function AccountingPayablesTableComponent({
|
|||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln),
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
OwnerNameDisplayFunction(a.job),
|
||||||
|
OwnerNameDisplayFunction(b.job)
|
||||||
|
),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
@@ -94,6 +100,9 @@ export function AccountingPayablesTableComponent({
|
|||||||
title: t("payments.fields.amount"),
|
title: t("payments.fields.amount"),
|
||||||
dataIndex: "amount",
|
dataIndex: "amount",
|
||||||
key: "amount",
|
key: "amount",
|
||||||
|
sorter: (a, b) => a.amount - b.amount,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "amount" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<CurrencyFormatter>{record.amount}</CurrencyFormatter>
|
<CurrencyFormatter>{record.amount}</CurrencyFormatter>
|
||||||
),
|
),
|
||||||
@@ -112,18 +121,21 @@ export function AccountingPayablesTableComponent({
|
|||||||
title: t("payments.fields.created_at"),
|
title: t("payments.fields.created_at"),
|
||||||
dataIndex: "created_at",
|
dataIndex: "created_at",
|
||||||
key: "created_at",
|
key: "created_at",
|
||||||
|
sorter: (a, b) => dateSort(a.created_at, b.created_at),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "created_at" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<DateTimeFormatter>{record.created_at}</DateTimeFormatter>
|
<DateTimeFormatter>{record.created_at}</DateTimeFormatter>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: t("payments.fields.exportedat"),
|
// title: t("payments.fields.exportedat"),
|
||||||
dataIndex: "exportedat",
|
// dataIndex: "exportedat",
|
||||||
key: "exportedat",
|
// key: "exportedat",
|
||||||
render: (text, record) => (
|
// render: (text, record) => (
|
||||||
<DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
|
// <DateTimeFormatter>{record.exportedat}</DateTimeFormatter>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
title: t("exportlogs.labels.attempts"),
|
title: t("exportlogs.labels.attempts"),
|
||||||
dataIndex: "attempts",
|
dataIndex: "attempts",
|
||||||
@@ -137,8 +149,6 @@ export function AccountingPayablesTableComponent({
|
|||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
dataIndex: "actions",
|
dataIndex: "actions",
|
||||||
key: "actions",
|
key: "actions",
|
||||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<PaymentExportButton
|
<PaymentExportButton
|
||||||
paymentId={record.id}
|
paymentId={record.id}
|
||||||
|
|||||||
@@ -4,17 +4,19 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||||
import JobExportButton from "../jobs-close-export-button/jobs-close-export-button.component";
|
import JobExportButton from "../jobs-close-export-button/jobs-close-export-button.component";
|
||||||
import JobsExportAllButton from "../jobs-export-all-button/jobs-export-all-button.component";
|
import JobsExportAllButton from "../jobs-export-all-button/jobs-export-all-button.component";
|
||||||
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
|
||||||
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
|
import ExportLogsCountDisplay from "../export-logs-count-display/export-logs-count-display.component";
|
||||||
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../owner-name-display/owner-name-display.component";
|
||||||
|
import QboAuthorizeComponent from "../qbo-authorize/qbo-authorize.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -63,7 +65,7 @@ export function AccountingReceivablesTableComponent({
|
|||||||
title: t("jobs.fields.status"),
|
title: t("jobs.fields.status"),
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
sorter: (a, b) => a.status - b.status,
|
sorter: (a, b) => statusSort(a, b, bodyshop.md_ro_statuses.statuses),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
@@ -83,7 +85,8 @@ export function AccountingReceivablesTableComponent({
|
|||||||
title: t("jobs.fields.owner"),
|
title: t("jobs.fields.owner"),
|
||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
@@ -103,6 +106,15 @@ export function AccountingReceivablesTableComponent({
|
|||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
key: "vehicle",
|
key: "vehicle",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.vehicleid ? (
|
return record.vehicleid ? (
|
||||||
<Link to={"/manage/vehicles/" + record.vehicleid}>
|
<Link to={"/manage/vehicles/" + record.vehicleid}>
|
||||||
|
|||||||
@@ -3,10 +3,22 @@ import { useMutation } from "@apollo/client";
|
|||||||
import { Button, notification, Popconfirm } from "antd";
|
import { Button, notification, Popconfirm } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
import { DELETE_BILL } from "../../graphql/bills.queries";
|
import { DELETE_BILL } from "../../graphql/bills.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
|
|
||||||
export default function BillDeleteButton({ bill, callback }) {
|
const mapStateToProps = createStructuredSelector({});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(BillDeleteButton);
|
||||||
|
|
||||||
|
export function BillDeleteButton({ bill, jobid, callback, insertAuditTrail }) {
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [deleteBill] = useMutation(DELETE_BILL);
|
const [deleteBill] = useMutation(DELETE_BILL);
|
||||||
@@ -36,6 +48,11 @@ export default function BillDeleteButton({ bill, callback }) {
|
|||||||
|
|
||||||
if (!!!result.errors) {
|
if (!!!result.errors) {
|
||||||
notification["success"]({ message: t("bills.successes.deleted") });
|
notification["success"]({ message: t("bills.successes.deleted") });
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobid,
|
||||||
|
operation: AuditTrailMapping.billdeleted(bill.invoice_number),
|
||||||
|
type: "billdeleted",
|
||||||
|
});
|
||||||
|
|
||||||
if (callback && typeof callback === "function") callback(bill.id);
|
if (callback && typeof callback === "function") callback(bill.id);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useMutation, useQuery } from "@apollo/client";
|
import { useMutation, useQuery } from "@apollo/client";
|
||||||
import { Button, Form, PageHeader, Popconfirm, Space } from "antd";
|
import { Button, Divider, Form, PageHeader, Popconfirm, Space } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@@ -33,8 +33,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPartsOrderContext: (context) =>
|
setPartsOrderContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
@@ -150,6 +150,7 @@ export function BillDetailEditcontainer({
|
|||||||
jobid: bill.jobid,
|
jobid: bill.jobid,
|
||||||
billid: search.billid,
|
billid: search.billid,
|
||||||
operation: AuditTrailMapping.billupdated(bill.invoice_number),
|
operation: AuditTrailMapping.billupdated(bill.invoice_number),
|
||||||
|
type: "billupdated",
|
||||||
});
|
});
|
||||||
|
|
||||||
await refetch();
|
await refetch();
|
||||||
@@ -163,6 +164,7 @@ export function BillDetailEditcontainer({
|
|||||||
if (!search.billid) return <></>; //<div>{t("bills.labels.noneselected")}</div>;
|
if (!search.billid) return <></>; //<div>{t("bills.labels.noneselected")}</div>;
|
||||||
|
|
||||||
const exported = data && data.bills_by_pk && data.bills_by_pk.exported;
|
const exported = data && data.bills_by_pk && data.bills_by_pk.exported;
|
||||||
|
const isinhouse = data && data.bills_by_pk && data.bills_by_pk.isinhouse;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -206,8 +208,8 @@ export function BillDetailEditcontainer({
|
|||||||
initialValues={transformData(data)}
|
initialValues={transformData(data)}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
>
|
>
|
||||||
<BillFormContainer form={form} billEdit disabled={exported} />
|
<BillFormContainer form={form} billEdit disabled={exported} disableInHouse={isinhouse}/>
|
||||||
|
<Divider orientation="left">{t("general.labels.media")}</Divider>
|
||||||
{bodyshop.uselocalmediaserver ? (
|
{bodyshop.uselocalmediaserver ? (
|
||||||
<JobsDocumentsLocalGallery
|
<JobsDocumentsLocalGallery
|
||||||
job={{ id: data ? data.bills_by_pk.jobid : null }}
|
job={{ id: data ? data.bills_by_pk.jobid : null }}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPartsOrderContext: (context) =>
|
setPartsOrderContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
@@ -45,6 +45,7 @@ export function BillDetailEditReturn({
|
|||||||
actions: {},
|
actions: {},
|
||||||
context: {
|
context: {
|
||||||
jobId: data.bills_by_pk.jobid,
|
jobId: data.bills_by_pk.jobid,
|
||||||
|
job: data.bills_by_pk.job,
|
||||||
vendorId: data.bills_by_pk.vendorid,
|
vendorId: data.bills_by_pk.vendorid,
|
||||||
returnFromBill: data.bills_by_pk.id,
|
returnFromBill: data.bills_by_pk.id,
|
||||||
invoiceNumber: data.bills_by_pk.invoice_number,
|
invoiceNumber: data.bills_by_pk.invoice_number,
|
||||||
@@ -173,7 +174,11 @@ export function BillDetailEditReturn({
|
|||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Button
|
<Button
|
||||||
disabled={data.bills_by_pk.is_credit_memo || disabled}
|
disabled={
|
||||||
|
data.bills_by_pk.is_credit_memo ||
|
||||||
|
data.bills_by_pk.isinhouse ||
|
||||||
|
disabled
|
||||||
|
}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")),
|
||||||
insertAuditTrail: ({ jobid, billid, operation }) =>
|
insertAuditTrail: ({ jobid, billid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, billid, operation })),
|
dispatch(insertAuditTrail({ jobid, billid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
const Templates = TemplateList("job_special");
|
const Templates = TemplateList("job_special");
|
||||||
@@ -94,6 +94,7 @@ function BillEnterModalContainer({
|
|||||||
location,
|
location,
|
||||||
outstanding_returns,
|
outstanding_returns,
|
||||||
inventory,
|
inventory,
|
||||||
|
federal_tax_exempt,
|
||||||
...remainingValues
|
...remainingValues
|
||||||
} = values;
|
} = values;
|
||||||
|
|
||||||
@@ -170,6 +171,7 @@ function BillEnterModalContainer({
|
|||||||
mod_lbr_ty: key,
|
mod_lbr_ty: key,
|
||||||
hours: adjustmentsToInsert[key].toFixed(1),
|
hours: adjustmentsToInsert[key].toFixed(1),
|
||||||
}),
|
}),
|
||||||
|
type: "jobmodifylbradj",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -319,6 +321,7 @@ function BillEnterModalContainer({
|
|||||||
operation: AuditTrailMapping.billposted(
|
operation: AuditTrailMapping.billposted(
|
||||||
r1.data.insert_bills.returning[0].invoice_number
|
r1.data.insert_bills.returning[0].invoice_number
|
||||||
),
|
),
|
||||||
|
type: "billposted",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (enterAgain) {
|
if (enterAgain) {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export function BillFormComponent({
|
|||||||
loadLines,
|
loadLines,
|
||||||
billEdit,
|
billEdit,
|
||||||
disableInvNumber,
|
disableInvNumber,
|
||||||
|
disableInHouse,
|
||||||
job,
|
job,
|
||||||
loadOutstandingReturns,
|
loadOutstandingReturns,
|
||||||
loadInventory,
|
loadInventory,
|
||||||
@@ -198,7 +199,7 @@ export function BillFormComponent({
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<VendorSearchSelect
|
<VendorSearchSelect
|
||||||
disabled={disabled}
|
disabled={disabled || disableInHouse}
|
||||||
options={vendorAutoCompleteOptions}
|
options={vendorAutoCompleteOptions}
|
||||||
preferredMake={preferredMake}
|
preferredMake={preferredMake}
|
||||||
onSelect={handleVendorSelect}
|
onSelect={handleVendorSelect}
|
||||||
@@ -271,7 +272,7 @@ export function BillFormComponent({
|
|||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input disabled={disabled || disableInvNumber} />
|
<Input disabled={disabled || disableInvNumber || disableInHouse} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("bills.fields.date")}
|
label={t("bills.fields.date")}
|
||||||
@@ -504,10 +505,11 @@ export function BillFormComponent({
|
|||||||
billEdit={billEdit}
|
billEdit={billEdit}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
<Divider orientation="left" style={{ display: billEdit ? "none" : null }}>
|
||||||
|
{t("documents.labels.upload")}
|
||||||
|
</Divider>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="upload"
|
name="upload"
|
||||||
label="Upload"
|
|
||||||
style={{ display: billEdit ? "none" : null }}
|
style={{ display: billEdit ? "none" : null }}
|
||||||
valuePropName="fileList"
|
valuePropName="fileList"
|
||||||
getValueFromEvent={(e) => {
|
getValueFromEvent={(e) => {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export function BillFormContainer({
|
|||||||
billEdit,
|
billEdit,
|
||||||
disabled,
|
disabled,
|
||||||
disableInvNumber,
|
disableInvNumber,
|
||||||
|
disableInHouse
|
||||||
}) {
|
}) {
|
||||||
const { Simple_Inventory } = useTreatments(
|
const { Simple_Inventory } = useTreatments(
|
||||||
["Simple_Inventory"],
|
["Simple_Inventory"],
|
||||||
@@ -57,6 +58,7 @@ export function BillFormContainer({
|
|||||||
job={lineData ? lineData.jobs_by_pk : null}
|
job={lineData ? lineData.jobs_by_pk : null}
|
||||||
responsibilityCenters={bodyshop.md_responsibility_centers || null}
|
responsibilityCenters={bodyshop.md_responsibility_centers || null}
|
||||||
disableInvNumber={disableInvNumber}
|
disableInvNumber={disableInvNumber}
|
||||||
|
disableInHouse={disableInHouse}
|
||||||
loadOutstandingReturns={loadOutstandingReturns}
|
loadOutstandingReturns={loadOutstandingReturns}
|
||||||
loadInventory={loadInventory}
|
loadInventory={loadInventory}
|
||||||
preferredMake={lineData ? lineData.jobs_by_pk.v_make_desc : null}
|
preferredMake={lineData ? lineData.jobs_by_pk.v_make_desc : null}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import { setModalContext } from "../../redux/modals/modals.actions";
|
|||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import BillDeleteButton from "../bill-delete-button/bill-delete-button.component";
|
import BillDeleteButton from "../bill-delete-button/bill-delete-button.component";
|
||||||
import BillDetailEditReturnComponent from "../bill-detail-edit/bill-detail-edit-return.component";
|
import BillDetailEditReturnComponent from "../bill-detail-edit/bill-detail-edit-return.component";
|
||||||
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
||||||
@@ -58,9 +58,9 @@ export function BillsListTableComponent({
|
|||||||
<EditFilled />
|
<EditFilled />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<BillDeleteButton bill={record} />
|
<BillDeleteButton bill={record} jobid={job.id} />
|
||||||
<BillDetailEditReturnComponent
|
<BillDetailEditReturnComponent
|
||||||
data={{ bills_by_pk: { ...record, jobid: job.id } }}
|
data={{ bills_by_pk: { ...record, jobid: job.id, job: job } }}
|
||||||
disabled={
|
disabled={
|
||||||
record.is_credit_memo ||
|
record.is_credit_memo ||
|
||||||
record.vendorid === bodyshop.inhousevendorid ||
|
record.vendorid === bodyshop.inhousevendorid ||
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import React, { useState } from "react";
|
|
||||||
import { Button, Form, InputNumber, Popover } from "antd";
|
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { CalculatorFilled } from "@ant-design/icons";
|
import { CalculatorFilled } from "@ant-design/icons";
|
||||||
|
import { Button, Form, InputNumber, Popover, Space } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
export default function CABCpvrtCalculator({ disabled, form }) {
|
export default function CABCpvrtCalculator({ disabled, form }) {
|
||||||
const [visibility, setVisibility] = useState(false);
|
const [visibility, setVisibility] = useState(false);
|
||||||
|
|
||||||
@@ -26,10 +26,14 @@ export default function CABCpvrtCalculator({ disabled, form }) {
|
|||||||
<Form.Item name="days" label={t("jobs.labels.ca_bc_pvrt.days")}>
|
<Form.Item name="days" label={t("jobs.labels.ca_bc_pvrt.days")}>
|
||||||
<InputNumber precision={0} min={0} />
|
<InputNumber precision={0} min={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="primary" htmlType="submit">
|
<div style={{ display: "flex", justifyContent: "flex-end" }}>
|
||||||
{t("general.actions.calculate")}
|
<Space>
|
||||||
</Button>
|
<Button type="primary" htmlType="submit">
|
||||||
<Button onClick={() => setVisibility(false)}>Close</Button>
|
{t("general.actions.calculate")}
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setVisibility(false)}>Close</Button>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
notification,
|
notification,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -22,7 +21,6 @@ import {
|
|||||||
INSERT_PAYMENT_RESPONSE,
|
INSERT_PAYMENT_RESPONSE,
|
||||||
QUERY_RO_AND_OWNER_BY_JOB_PKS,
|
QUERY_RO_AND_OWNER_BY_JOB_PKS,
|
||||||
} from "../../graphql/payment_response.queries";
|
} from "../../graphql/payment_response.queries";
|
||||||
import { INSERT_NEW_PAYMENT } from "../../graphql/payments.queries";
|
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
import { toggleModalVisible } from "../../redux/modals/modals.actions";
|
||||||
import { selectCardPayment } from "../../redux/modals/modals.selectors";
|
import { selectCardPayment } from "../../redux/modals/modals.selectors";
|
||||||
@@ -37,8 +35,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("cardPayment")),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -48,12 +46,12 @@ const CardPaymentModalComponent = ({
|
|||||||
toggleModalVisible,
|
toggleModalVisible,
|
||||||
insertAuditTrail,
|
insertAuditTrail,
|
||||||
}) => {
|
}) => {
|
||||||
const { context } = cardPaymentModal;
|
const { context, actions } = cardPaymentModal;
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [insertPayment] = useMutation(INSERT_NEW_PAYMENT);
|
// const [insertPayment] = useMutation(INSERT_NEW_PAYMENT);
|
||||||
const [insertPaymentResponse] = useMutation(INSERT_PAYMENT_RESPONSE);
|
const [insertPaymentResponse] = useMutation(INSERT_PAYMENT_RESPONSE);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -65,7 +63,6 @@ const CardPaymentModalComponent = ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log("🚀 ~ file: card-payment-modal.component..jsx:61 ~ data:", data);
|
|
||||||
//Initialize the intellipay window.
|
//Initialize the intellipay window.
|
||||||
const SetIntellipayCallbackFunctions = () => {
|
const SetIntellipayCallbackFunctions = () => {
|
||||||
console.log("*** Set IntelliPay callback functions.");
|
console.log("*** Set IntelliPay callback functions.");
|
||||||
@@ -74,16 +71,20 @@ const CardPaymentModalComponent = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.intellipay.runOnApproval(async function (response) {
|
window.intellipay.runOnApproval(async function (response) {
|
||||||
console.warn("*** Running On Approval Script ***");
|
//2024-04-25: Nothing is going to happen here anymore. We'll completely rely on the callback.
|
||||||
form.setFieldValue("paymentResponse", response);
|
//Add a slight delay to allow the refetch to properly get the data.
|
||||||
form.submit();
|
setTimeout(() => {
|
||||||
|
if (actions && actions.refetch && typeof actions.refetch === "function")
|
||||||
|
actions.refetch();
|
||||||
|
setLoading(false);
|
||||||
|
toggleModalVisible();
|
||||||
|
}, 750);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.intellipay.runOnNonApproval(async function (response) {
|
window.intellipay.runOnNonApproval(async function (response) {
|
||||||
// Mutate unsuccessful payment
|
// Mutate unsuccessful payment
|
||||||
|
|
||||||
const { payments } = form.getFieldsValue();
|
const { payments } = form.getFieldsValue();
|
||||||
|
|
||||||
await insertPaymentResponse({
|
await insertPaymentResponse({
|
||||||
variables: {
|
variables: {
|
||||||
paymentResponse: payments.map((payment) => ({
|
paymentResponse: payments.map((payment) => ({
|
||||||
@@ -102,55 +103,15 @@ const CardPaymentModalComponent = ({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: payment.jobid,
|
jobid: payment.jobid,
|
||||||
operation: AuditTrailMapping.failedpayment(),
|
operation: AuditTrailMapping.failedpayment(),
|
||||||
|
type: "failedpayment",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
|
||||||
try {
|
|
||||||
await insertPayment({
|
|
||||||
variables: {
|
|
||||||
paymentInput: values.payments.map((payment) => ({
|
|
||||||
amount: payment.amount,
|
|
||||||
transactionid: (values.paymentResponse.paymentid || "").toString(),
|
|
||||||
payer: t("payments.labels.customer"),
|
|
||||||
type: values.paymentResponse.cardbrand,
|
|
||||||
jobid: payment.jobid,
|
|
||||||
date: moment(Date.now()),
|
|
||||||
payment_responses: {
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
amount: payment.amount,
|
|
||||||
bodyshopid: bodyshop.id,
|
|
||||||
|
|
||||||
jobid: payment.jobid,
|
|
||||||
declinereason: values.paymentResponse.declinereason,
|
|
||||||
ext_paymentid: values.paymentResponse.paymentid.toString(),
|
|
||||||
successful: true,
|
|
||||||
response: values.paymentResponse,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
refetchQueries: ["GET_JOB_BY_PK"],
|
|
||||||
});
|
|
||||||
toggleModalVisible();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
notification.open({
|
|
||||||
type: "error",
|
|
||||||
message: t("payments.errors.inserting", { error: error.message }),
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleIntelliPayCharge = async () => {
|
const handleIntelliPayCharge = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
//Validate
|
//Validate
|
||||||
try {
|
try {
|
||||||
await form.validateFields();
|
await form.validateFields();
|
||||||
@@ -163,6 +124,7 @@ const CardPaymentModalComponent = ({
|
|||||||
const response = await axios.post("/intellipay/lightbox_credentials", {
|
const response = await axios.post("/intellipay/lightbox_credentials", {
|
||||||
bodyshop,
|
bodyshop,
|
||||||
refresh: !!window.intellipay,
|
refresh: !!window.intellipay,
|
||||||
|
paymentSplitMeta: form.getFieldsValue(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.intellipay) {
|
if (window.intellipay) {
|
||||||
@@ -191,7 +153,6 @@ const CardPaymentModalComponent = ({
|
|||||||
<Card title="Card Payment">
|
<Card title="Card Payment">
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
<Form
|
<Form
|
||||||
onFinish={handleFinish}
|
|
||||||
form={form}
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
initialValues={{
|
initialValues={{
|
||||||
@@ -272,23 +233,14 @@ const CardPaymentModalComponent = ({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
console.log("Updating the owner info section.");
|
|
||||||
//If all of the job ids have been fileld in, then query and update the IP field.
|
//If all of the job ids have been fileld in, then query and update the IP field.
|
||||||
const { payments } = form.getFieldsValue();
|
const { payments } = form.getFieldsValue();
|
||||||
if (
|
if (
|
||||||
payments?.length > 0 &&
|
payments?.length > 0 &&
|
||||||
payments?.filter((p) => p?.jobid).length === payments?.length
|
payments?.filter((p) => p?.jobid).length === payments?.length
|
||||||
) {
|
) {
|
||||||
console.log("**Calling refetch.");
|
|
||||||
refetch({ jobids: payments.map((p) => p.jobid) });
|
refetch({ jobids: payments.map((p) => p.jobid) });
|
||||||
}
|
}
|
||||||
console.log(
|
|
||||||
"Acc info",
|
|
||||||
data,
|
|
||||||
payments && data && data.jobs.length > 0
|
|
||||||
? data.jobs.map((j) => j.ro_number).join(", ")
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Input
|
<Input
|
||||||
@@ -343,6 +295,13 @@ const CardPaymentModalComponent = ({
|
|||||||
value={totalAmountToCharge?.toFixed(2)}
|
value={totalAmountToCharge?.toFixed(2)}
|
||||||
hidden
|
hidden
|
||||||
/>
|
/>
|
||||||
|
<Input
|
||||||
|
className="ipayfield"
|
||||||
|
data-ipayname="comment"
|
||||||
|
//type="hidden"
|
||||||
|
value={btoa(JSON.stringify(payments))}
|
||||||
|
hidden
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
// data-ipayname="submit"
|
// data-ipayname="submit"
|
||||||
@@ -357,11 +316,6 @@ const CardPaymentModalComponent = ({
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
{/* Lightbox payment response when it is completed */}
|
|
||||||
<Form.Item name="paymentResponse" hidden>
|
|
||||||
<Input type="hidden" />
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
</Form>
|
||||||
</Spin>
|
</Spin>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -68,6 +68,30 @@ export default function ContractFormComponent({
|
|||||||
<FormDateTimePicker />
|
<FormDateTimePicker />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
{create && (
|
||||||
|
<Form.Item
|
||||||
|
shouldUpdate={(p, c) => p.scheduledreturn !== c.scheduledreturn}
|
||||||
|
>
|
||||||
|
{() => {
|
||||||
|
const insuranceOver =
|
||||||
|
selectedCar &&
|
||||||
|
selectedCar.insuranceexpires &&
|
||||||
|
moment(selectedCar.insuranceexpires)
|
||||||
|
.endOf("day")
|
||||||
|
.isBefore(moment(form.getFieldValue("scheduledreturn")));
|
||||||
|
if (insuranceOver)
|
||||||
|
return (
|
||||||
|
<Space direction="vertical" style={{ color: "tomato" }}>
|
||||||
|
<span>
|
||||||
|
<WarningFilled style={{ marginRight: ".3rem" }} />
|
||||||
|
{t("contracts.labels.insuranceexpired")}
|
||||||
|
</span>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
return <></>;
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow grow>
|
<LayoutFormRow grow>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -90,16 +114,17 @@ export default function ContractFormComponent({
|
|||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
const mileageOver =
|
const mileageOver =
|
||||||
selectedCar &&
|
selectedCar && selectedCar.nextservicekm
|
||||||
selectedCar.nextservicekm <= form.getFieldValue("kmstart");
|
? selectedCar.nextservicekm <= form.getFieldValue("kmstart")
|
||||||
|
: false;
|
||||||
const dueForService =
|
const dueForService =
|
||||||
selectedCar &&
|
selectedCar &&
|
||||||
selectedCar.nextservicedate &&
|
selectedCar.nextservicedate &&
|
||||||
moment(selectedCar.nextservicedate).isBefore(
|
moment(selectedCar.nextservicedate)
|
||||||
moment(form.getFieldValue("scheduledreturn"))
|
.endOf("day")
|
||||||
);
|
.isSameOrBefore(
|
||||||
|
moment(form.getFieldValue("scheduledreturn"))
|
||||||
|
);
|
||||||
if (mileageOver || dueForService)
|
if (mileageOver || dueForService)
|
||||||
return (
|
return (
|
||||||
<Space direction="vertical" style={{ color: "tomato" }}>
|
<Space direction="vertical" style={{ color: "tomato" }}>
|
||||||
@@ -117,7 +142,6 @@ export default function ContractFormComponent({
|
|||||||
</span>
|
</span>
|
||||||
</Space>
|
</Space>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <></>;
|
return <></>;
|
||||||
}}
|
}}
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
@@ -10,11 +10,15 @@ import CourtesyCarFuelSlider from "../courtesy-car-fuel-select/courtesy-car-fuel
|
|||||||
import CourtesyCarReadiness from "../courtesy-car-readiness-select/courtesy-car-readiness-select.component";
|
import CourtesyCarReadiness from "../courtesy-car-readiness-select/courtesy-car-readiness-select.component";
|
||||||
import CourtesyCarStatus from "../courtesy-car-status-select/courtesy-car-status-select.component";
|
import CourtesyCarStatus from "../courtesy-car-status-select/courtesy-car-status-select.component";
|
||||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||||
//import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
import CurrencyInput from "../form-items-formatted/currency-form-item.component";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
|
|
||||||
export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
export default function CourtesyCarCreateFormComponent({
|
||||||
|
form,
|
||||||
|
saveLoading,
|
||||||
|
newCC,
|
||||||
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
|
|
||||||
@@ -33,7 +37,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <FormFieldsChanged form={form} /> */}
|
{newCC ? null : <FormFieldsChanged form={form} />}
|
||||||
<LayoutFormRow header={t("courtesycars.labels.vehicle")}>
|
<LayoutFormRow header={t("courtesycars.labels.vehicle")}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("courtesycars.fields.year")}
|
label={t("courtesycars.fields.year")}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ const CourtesyCarStatusComponent = ({ value, onChange }, ref) => {
|
|||||||
<Option value="courtesycars.status.leasereturn">
|
<Option value="courtesycars.status.leasereturn">
|
||||||
{t("courtesycars.status.leasereturn")}
|
{t("courtesycars.status.leasereturn")}
|
||||||
</Option>
|
</Option>
|
||||||
|
<Option value="courtesycars.status.unavailable">
|
||||||
|
{t("courtesycars.status.unavailable")}
|
||||||
|
</Option>
|
||||||
</Select>
|
</Select>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,13 +17,18 @@ import { DateTimeFormatter } from "../../utils/DateFormatter";
|
|||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||||
|
|
||||||
export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
filteredInfo: { text: "" },
|
|
||||||
});
|
});
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
|
const [filter, setFilter] = useLocalStorage(
|
||||||
|
"filter_courtesy_cars_list",
|
||||||
|
null
|
||||||
|
);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
@@ -50,11 +55,16 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||||
|
filteredValue: filter?.status || null,
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
text: t("courtesycars.status.in"),
|
text: t("courtesycars.status.in"),
|
||||||
value: "courtesycars.status.in",
|
value: "courtesycars.status.in",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: t("courtesycars.status.inservice"),
|
||||||
|
value: "courtesycars.status.inservice",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: t("courtesycars.status.out"),
|
text: t("courtesycars.status.out"),
|
||||||
value: "courtesycars.status.out",
|
value: "courtesycars.status.out",
|
||||||
@@ -67,12 +77,17 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
text: t("courtesycars.status.leasereturn"),
|
text: t("courtesycars.status.leasereturn"),
|
||||||
value: "courtesycars.status.leasereturn",
|
value: "courtesycars.status.leasereturn",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: t("courtesycars.status.unavailable"),
|
||||||
|
value: "courtesycars.status.unavailable",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
onFilter: (value, record) => value.includes(record.status),
|
onFilter: (value, record) => record.status === value,
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
const { nextservicedate, nextservicekm, mileage } = record;
|
const { nextservicedate, nextservicekm, mileage, insuranceexpires } =
|
||||||
|
record;
|
||||||
|
|
||||||
const mileageOver = nextservicekm ? nextservicekm <= mileage : false;
|
const mileageOver = nextservicekm ? nextservicekm <= mileage : false;
|
||||||
|
|
||||||
@@ -80,11 +95,25 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
nextservicedate &&
|
nextservicedate &&
|
||||||
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
|
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
|
||||||
|
|
||||||
|
const insuranceOver =
|
||||||
|
insuranceexpires &&
|
||||||
|
moment(insuranceexpires).endOf("day").isBefore(moment());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space>
|
<Space>
|
||||||
{t(record.status)}
|
{t(record.status)}
|
||||||
{(mileageOver || dueForService) && (
|
{(mileageOver || dueForService || insuranceOver) && (
|
||||||
<Tooltip title={t("contracts.labels.cardueforservice")}>
|
<Tooltip
|
||||||
|
title={
|
||||||
|
(mileageOver || dueForService) && insuranceOver
|
||||||
|
? t("contracts.labels.insuranceexpired") +
|
||||||
|
" / " +
|
||||||
|
t("contracts.labels.cardueforservice")
|
||||||
|
: insuranceOver
|
||||||
|
? t("contracts.labels.insuranceexpired")
|
||||||
|
: t("contracts.labels.cardueforservice")
|
||||||
|
}
|
||||||
|
>
|
||||||
<WarningFilled style={{ color: "tomato" }} />
|
<WarningFilled style={{ color: "tomato" }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
@@ -97,6 +126,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
dataIndex: "readiness",
|
dataIndex: "readiness",
|
||||||
key: "readiness",
|
key: "readiness",
|
||||||
sorter: (a, b) => alphaSort(a.readiness, b.readiness),
|
sorter: (a, b) => alphaSort(a.readiness, b.readiness),
|
||||||
|
filteredValue: filter?.readiness || null,
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
text: t("courtesycars.readiness.ready"),
|
text: t("courtesycars.readiness.ready"),
|
||||||
@@ -156,7 +186,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
title: t("courtesycars.fields.fuel"),
|
title: t("courtesycars.fields.fuel"),
|
||||||
dataIndex: "fuel",
|
dataIndex: "fuel",
|
||||||
key: "fuel",
|
key: "fuel",
|
||||||
sorter: (a, b) => alphaSort(a.fuel, b.fuel),
|
sorter: (a, b) => a.fuel - b.fuel,
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "fuel" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "fuel" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
@@ -165,12 +195,14 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
return t("courtesycars.labels.fuel.full");
|
return t("courtesycars.labels.fuel.full");
|
||||||
case 88:
|
case 88:
|
||||||
return t("courtesycars.labels.fuel.78");
|
return t("courtesycars.labels.fuel.78");
|
||||||
|
case 75:
|
||||||
|
return t("courtesycars.labels.fuel.34");
|
||||||
case 63:
|
case 63:
|
||||||
return t("courtesycars.labels.fuel.58");
|
return t("courtesycars.labels.fuel.58");
|
||||||
case 50:
|
case 50:
|
||||||
return t("courtesycars.labels.fuel.12");
|
return t("courtesycars.labels.fuel.12");
|
||||||
case 38:
|
case 38:
|
||||||
return t("courtesycars.labels.fuel.34");
|
return t("courtesycars.labels.fuel.38");
|
||||||
case 25:
|
case 25:
|
||||||
return t("courtesycars.labels.fuel.14");
|
return t("courtesycars.labels.fuel.14");
|
||||||
case 13:
|
case 13:
|
||||||
@@ -212,7 +244,8 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({ ...state, sortedInfo: sorter });
|
||||||
|
setFilter(filters);
|
||||||
};
|
};
|
||||||
|
|
||||||
const tableData = searchText
|
const tableData = searchText
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import React, { useEffect } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import { QUERY_CSI_RESPONSE_BY_PK } from "../../graphql/csi.queries";
|
import { QUERY_CSI_RESPONSE_BY_PK } from "../../graphql/csi.queries";
|
||||||
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ConfigFormComponents from "../config-form-components/config-form-components.component";
|
import ConfigFormComponents from "../config-form-components/config-form-components.component";
|
||||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
@@ -44,6 +45,13 @@ export default function CsiResponseFormContainer() {
|
|||||||
readOnly
|
readOnly
|
||||||
componentList={data.csi_by_pk.csiquestion.config}
|
componentList={data.csi_by_pk.csiquestion.config}
|
||||||
/>
|
/>
|
||||||
|
{data.csi_by_pk.validuntil ? (
|
||||||
|
<>
|
||||||
|
{t("csi.fields.validuntil")}
|
||||||
|
{": "}
|
||||||
|
<DateFormatter>{data.csi_by_pk.validuntil}</DateFormatter>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,9 +5,11 @@ import React, { useState } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { pageLimit } from "../../utils/config";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import {pageLimit} from "../../utils/config";
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../owner-name-display/owner-name-display.component";
|
||||||
|
|
||||||
export default function CsiResponseListPaginated({
|
export default function CsiResponseListPaginated({
|
||||||
refetch,
|
refetch,
|
||||||
@@ -16,23 +18,23 @@ export default function CsiResponseListPaginated({
|
|||||||
total,
|
total,
|
||||||
}) {
|
}) {
|
||||||
const search = queryString.parse(useLocation().search);
|
const search = queryString.parse(useLocation().search);
|
||||||
const { responseid, page, sortcolumn, sortorder } = search;
|
const { responseid } = search;
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const { t } = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
filteredInfo: { text: "" },
|
filteredInfo: { text: "" },
|
||||||
|
page: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
width: "8%",
|
|
||||||
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
|
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
|
||||||
sortOrder: sortcolumn === "ro_number" && sortorder,
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={"/manage/jobs/" + record.job.id}>
|
<Link to={"/manage/jobs/" + record.job.id}>
|
||||||
{record.job.ro_number || t("general.labels.na")}
|
{record.job.ro_number || t("general.labels.na")}
|
||||||
@@ -41,15 +43,18 @@ export default function CsiResponseListPaginated({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.owner"),
|
title: t("jobs.fields.owner"),
|
||||||
dataIndex: "owner",
|
dataIndex: "owner_name",
|
||||||
key: "owner",
|
key: "owner_name",
|
||||||
ellipsis: true,
|
sorter: (a, b) =>
|
||||||
sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln),
|
alphaSort(
|
||||||
width: "25%",
|
OwnerNameDisplayFunction(a.job),
|
||||||
sortOrder: sortcolumn === "owner" && sortorder,
|
OwnerNameDisplayFunction(b.job)
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "owner_name" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.job.owner ? (
|
return record.job.ownerid ? (
|
||||||
<Link to={"/manage/owners/" + record.job.owner.id}>
|
<Link to={"/manage/owners/" + record.job.ownerid}>
|
||||||
<OwnerNameDisplay ownerObject={record.job} />
|
<OwnerNameDisplay ownerObject={record.job} />
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
@@ -64,9 +69,9 @@ export default function CsiResponseListPaginated({
|
|||||||
dataIndex: "completedon",
|
dataIndex: "completedon",
|
||||||
key: "completedon",
|
key: "completedon",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => a.completedon - b.completedon,
|
sorter: (a, b) => dateSort(a.completedon, b.completedon),
|
||||||
width: "25%",
|
sortOrder:
|
||||||
sortOrder: sortcolumn === "completedon" && sortorder,
|
state.sortedInfo.columnKey === "completedon" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.completedon ? (
|
return record.completedon ? (
|
||||||
<DateFormatter>{record.completedon}</DateFormatter>
|
<DateFormatter>{record.completedon}</DateFormatter>
|
||||||
@@ -76,11 +81,12 @@ export default function CsiResponseListPaginated({
|
|||||||
];
|
];
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({
|
||||||
search.page = pagination.current;
|
...state,
|
||||||
search.sortcolumn = sorter.columnKey;
|
filteredInfo: filters,
|
||||||
search.sortorder = sorter.order;
|
sortedInfo: sorter,
|
||||||
history.push({ search: queryString.stringify(search) });
|
page: pagination.current,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnRowClick = (record) => {
|
const handleOnRowClick = (record) => {
|
||||||
@@ -108,7 +114,7 @@ export default function CsiResponseListPaginated({
|
|||||||
pagination={{
|
pagination={{
|
||||||
position: "top",
|
position: "top",
|
||||||
pageSize: pageLimit,
|
pageSize: pageLimit,
|
||||||
current: parseInt(page || 1),
|
current: parseInt(state.page || 1),
|
||||||
total: total,
|
total: total,
|
||||||
}}
|
}}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -122,13 +128,6 @@ export default function CsiResponseListPaginated({
|
|||||||
selectedRowKeys: [responseid],
|
selectedRowKeys: [responseid],
|
||||||
type: "radio",
|
type: "radio",
|
||||||
}}
|
}}
|
||||||
onRow={(record, rowIndex) => {
|
|
||||||
return {
|
|
||||||
onClick: (event) => {
|
|
||||||
handleOnRowClick(record);
|
|
||||||
}, // click row
|
|
||||||
};
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,169 @@
|
|||||||
|
import {Card, Table, Tag} from "antd";
|
||||||
|
import LoadingSkeleton from "../../loading-skeleton/loading-skeleton.component";
|
||||||
|
import {useTranslation} from "react-i18next";
|
||||||
|
import React, {useEffect, useState} from "react";
|
||||||
|
import moment from "moment";
|
||||||
|
import DashboardRefreshRequired from "../refresh-required.component";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
const fortyFiveDaysAgo = () => moment().subtract(45, 'days').toLocaleString();
|
||||||
|
|
||||||
|
export default function JobLifecycleDashboardComponent({data, bodyshop, ...cardProps}) {
|
||||||
|
const {t} = useTranslation();
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [lifecycleData, setLifecycleData] = useState(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function getLifecycleData() {
|
||||||
|
if (data && data.job_lifecycle) {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await axios.post("/job/lifecycle", {
|
||||||
|
jobids: data.job_lifecycle.map(x => x.id),
|
||||||
|
statuses: bodyshop.md_ro_statuses
|
||||||
|
});
|
||||||
|
setLifecycleData(response.data.durations);
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getLifecycleData().catch(e => {
|
||||||
|
console.error(`Error in getLifecycleData: ${e}`);
|
||||||
|
})
|
||||||
|
}, [data, bodyshop]);
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t('job_lifecycle.columns.status'),
|
||||||
|
dataIndex: 'status',
|
||||||
|
bgColor: 'red',
|
||||||
|
key: 'status',
|
||||||
|
render: (text, record) => {
|
||||||
|
return <Tag color={record.color}>{record.status}</Tag>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('job_lifecycle.columns.human_readable'),
|
||||||
|
dataIndex: 'humanReadable',
|
||||||
|
key: 'humanReadable',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('job_lifecycle.columns.status_count'),
|
||||||
|
key: 'statusCount',
|
||||||
|
render: (text, record) => {
|
||||||
|
return lifecycleData.statusCounts[record.status];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t('job_lifecycle.columns.percentage'),
|
||||||
|
dataIndex: 'percentage',
|
||||||
|
key: 'percentage',
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.percentage.toFixed(2) + '%';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!data) return null;
|
||||||
|
|
||||||
|
if (!data.job_lifecycle || !lifecycleData) return <DashboardRefreshRequired {...cardProps} />;
|
||||||
|
|
||||||
|
const extra = `${t('job_lifecycle.content.calculated_based_on')} ${lifecycleData.jobs} ${t('job_lifecycle.content.jobs_in_since')} ${fortyFiveDaysAgo()}`
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card title={t("job_lifecycle.titles.dashboard")} {...cardProps}>
|
||||||
|
<LoadingSkeleton loading={loading}>
|
||||||
|
<div style={{overflow: 'scroll', height: "100%"}}>
|
||||||
|
<div id="bar-container" style={{
|
||||||
|
display: 'flex',
|
||||||
|
width: '100%',
|
||||||
|
height: '100px',
|
||||||
|
textAlign: 'center',
|
||||||
|
borderRadius: '5px',
|
||||||
|
borderWidth: '5px',
|
||||||
|
borderStyle: 'solid',
|
||||||
|
borderColor: '#f0f2f5',
|
||||||
|
margin: 0,
|
||||||
|
padding: 0
|
||||||
|
}}>
|
||||||
|
{lifecycleData.summations.map((key, index, array) => {
|
||||||
|
const isFirst = index === 0;
|
||||||
|
const isLast = index === array.length - 1;
|
||||||
|
return (
|
||||||
|
<div key={key.status} style={{
|
||||||
|
overflow: 'hidden',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
margin: 0,
|
||||||
|
padding: 0,
|
||||||
|
|
||||||
|
borderTop: '1px solid #f0f2f5',
|
||||||
|
borderBottom: '1px solid #f0f2f5',
|
||||||
|
borderLeft: isFirst ? '1px solid #f0f2f5' : undefined,
|
||||||
|
borderRight: isLast ? '1px solid #f0f2f5' : undefined,
|
||||||
|
|
||||||
|
backgroundColor: key.color,
|
||||||
|
width: `${key.percentage}%`
|
||||||
|
}}
|
||||||
|
aria-label={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||||
|
title={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||||
|
>
|
||||||
|
|
||||||
|
{key.percentage > 15 ?
|
||||||
|
<>
|
||||||
|
<div>{key.roundedPercentage}</div>
|
||||||
|
<div style={{
|
||||||
|
backgroundColor: '#f0f2f5',
|
||||||
|
borderRadius: '5px',
|
||||||
|
paddingRight: '2px',
|
||||||
|
paddingLeft: '2px',
|
||||||
|
fontSize: '0.8rem',
|
||||||
|
}}>
|
||||||
|
{key.status}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<Card extra={extra} type='inner' title={t('job_lifecycle.content.legend_title')}
|
||||||
|
style={{marginTop: '10px'}}>
|
||||||
|
<div>
|
||||||
|
{lifecycleData.summations.map((key) => (
|
||||||
|
<Tag color={key.color} style={{width: '13vh', padding: '4px', margin: '4px'}}>
|
||||||
|
<div
|
||||||
|
aria-label={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||||
|
title={`${key.status} | ${key.roundedPercentage} | ${key.humanReadable}`}
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f0f2f5',
|
||||||
|
color: '#000',
|
||||||
|
padding: '4px',
|
||||||
|
textAlign: 'center'
|
||||||
|
}}>
|
||||||
|
{key.status} [{lifecycleData.statusCounts[key.status]}] ({key.roundedPercentage})
|
||||||
|
</div>
|
||||||
|
</Tag>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
<Card style={{marginTop: "5px"}} type='inner' title={t("job_lifecycle.titles.top_durations")}>
|
||||||
|
<Table size="small" pagination={false} columns={columns}
|
||||||
|
dataSource={lifecycleData.summations.sort((a, b) => b.value - a.value).slice(0, 3)}/>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
</LoadingSkeleton>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const JobLifecycleDashboardGQL = `
|
||||||
|
job_lifecycle: jobs(where: {
|
||||||
|
actual_in: {
|
||||||
|
_gte: "${moment().subtract(45, 'days').toISOString()}"
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
id
|
||||||
|
actual_in
|
||||||
|
} `;
|
||||||
@@ -3,21 +3,32 @@ import {
|
|||||||
ExclamationCircleFilled,
|
ExclamationCircleFilled,
|
||||||
PauseCircleOutlined,
|
PauseCircleOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Card, Space, Table, Tooltip } from "antd";
|
import { Card, Space, Switch, Table, Tooltip, Typography } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { TimeFormatter } from "../../../utils/DateFormatter";
|
||||||
|
import { onlyUnique } from "../../../utils/arrayHelper";
|
||||||
|
import { alphaSort, dateSort } from "../../../utils/sorters";
|
||||||
|
import useLocalStorage from "../../../utils/useLocalStorage";
|
||||||
import ChatOpenButton from "../../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../../owner-name-display/owner-name-display.component";
|
||||||
import DashboardRefreshRequired from "../refresh-required.component";
|
import DashboardRefreshRequired from "../refresh-required.component";
|
||||||
import {pageLimit} from "../../../utils/config";
|
|
||||||
|
|
||||||
export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
|
filteredInfo: {},
|
||||||
});
|
});
|
||||||
|
const [isTvModeScheduledIn, setIsTvModeScheduledIn] = useLocalStorage(
|
||||||
|
"isTvModeScheduledIn",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
if (!data.scheduled_in_today)
|
if (!data.scheduled_in_today)
|
||||||
return <DashboardRefreshRequired {...cardProps} />;
|
return <DashboardRefreshRequired {...cardProps} />;
|
||||||
@@ -31,6 +42,12 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
alt_transport: item.job.alt_transport,
|
alt_transport: item.job.alt_transport,
|
||||||
clm_no: item.job.clm_no,
|
clm_no: item.job.clm_no,
|
||||||
jobid: item.job.jobid,
|
jobid: item.job.jobid,
|
||||||
|
joblines_body: item.job.joblines
|
||||||
|
.filter((l) => l.mod_lbr_ty !== "LAR")
|
||||||
|
.reduce((acc, val) => acc + val.mod_lb_hrs, 0),
|
||||||
|
joblines_ref: item.job.joblines
|
||||||
|
.filter((l) => l.mod_lbr_ty === "LAR")
|
||||||
|
.reduce((acc, val) => acc + val.mod_lb_hrs, 0),
|
||||||
ins_co_nm: item.job.ins_co_nm,
|
ins_co_nm: item.job.ins_co_nm,
|
||||||
iouparent: item.job.iouparent,
|
iouparent: item.job.iouparent,
|
||||||
ownerid: item.job.ownerid,
|
ownerid: item.job.ownerid,
|
||||||
@@ -49,7 +66,7 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
v_vin: item.job.v_vin,
|
v_vin: item.job.v_vin,
|
||||||
vehicleid: item.job.vehicleid,
|
vehicleid: item.job.vehicleid,
|
||||||
note: item.note,
|
note: item.note,
|
||||||
start: moment(item.start).format("hh:mm a"),
|
start: item.start,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
};
|
};
|
||||||
appt.push(i);
|
appt.push(i);
|
||||||
@@ -59,11 +76,192 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
return new moment(a.start) - new moment(b.start);
|
return new moment(a.start) - new moment(b.start);
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = [
|
const tvFontSize = 16;
|
||||||
|
const tvFontWeight = "bold";
|
||||||
|
|
||||||
|
const tvColumns = [
|
||||||
|
{
|
||||||
|
title: t("appointments.fields.time"),
|
||||||
|
dataIndex: "start",
|
||||||
|
key: "start",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => dateSort(a.start, b.start),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "start" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
<TimeFormatter>{record.start}</TimeFormatter>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
|
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<Link
|
||||||
|
to={"/manage/jobs/" + record.jobid}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<Space>
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.ro_number || t("general.labels.na")}
|
||||||
|
{record.production_vars && record.production_vars.alert ? (
|
||||||
|
<ExclamationCircleFilled className="production-alert" />
|
||||||
|
) : null}
|
||||||
|
{record.suspended && (
|
||||||
|
<PauseCircleOutlined style={{ color: "orangered" }} />
|
||||||
|
)}
|
||||||
|
{record.iouparent && (
|
||||||
|
<Tooltip title={t("jobs.labels.iou")}>
|
||||||
|
<BranchesOutlined style={{ color: "orangered" }} />
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</Space>
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.owner"),
|
||||||
|
dataIndex: "owner",
|
||||||
|
key: "owner",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.ownerid ? (
|
||||||
|
<Link
|
||||||
|
to={"/manage/owners/" + record.ownerid}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
<OwnerNameDisplay ownerObject={record} />
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
<OwnerNameDisplay ownerObject={record} />
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.vehicle"),
|
||||||
|
dataIndex: "vehicle",
|
||||||
|
key: "vehicle",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.vehicleid ? (
|
||||||
|
<Link
|
||||||
|
to={"/manage/vehicles/" + record.vehicleid}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||||
|
record.v_model_desc || ""
|
||||||
|
}`}
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>{`${
|
||||||
|
record.v_model_yr || ""
|
||||||
|
} ${record.v_make_desc || ""} ${record.v_model_desc || ""}`}</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("appointments.fields.alt_transport"),
|
||||||
|
dataIndex: "alt_transport",
|
||||||
|
key: "alt_transport",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "alt_transport" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
filters:
|
||||||
|
(appt &&
|
||||||
|
appt
|
||||||
|
.map((j) => j.alt_transport)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Alt. Transport",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.alt_transport),
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.alt_transport}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.lab"),
|
||||||
|
dataIndex: "joblines_body",
|
||||||
|
key: "joblines_body",
|
||||||
|
sorter: (a, b) => a.joblines_body - b.joblines_body,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "joblines_body" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
align: "right",
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.joblines_body.toFixed(1)}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.lar"),
|
||||||
|
dataIndex: "joblines_ref",
|
||||||
|
key: "joblines_ref",
|
||||||
|
sorter: (a, b) => a.joblines_ref - b.joblines_ref,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "joblines_ref" && state.sortedInfo.order,
|
||||||
|
align: "right",
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.joblines_ref.toFixed(1)}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("appointments.fields.time"),
|
||||||
|
dataIndex: "start",
|
||||||
|
key: "start",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => dateSort(a.start, b.start),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "start" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => <TimeFormatter>{record.start}</TimeFormatter>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.ro_number"),
|
||||||
|
dataIndex: "ro_number",
|
||||||
|
key: "ro_number",
|
||||||
|
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link
|
<Link
|
||||||
to={"/manage/jobs/" + record.jobid}
|
to={"/manage/jobs/" + record.jobid}
|
||||||
@@ -91,7 +289,10 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.ownerid ? (
|
return record.ownerid ? (
|
||||||
<Link
|
<Link
|
||||||
@@ -108,23 +309,16 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ownr_ph1"),
|
title: t("dashboard.labels.phone"),
|
||||||
dataIndex: "ownr_ph1",
|
dataIndex: "ownr_ph",
|
||||||
key: "ownr_ph1",
|
key: "ownr_ph",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.jobid} />
|
<Space size="small" wrap>
|
||||||
),
|
<ChatOpenButton phone={record.ownr_ph1} jobid={record.jobid} />
|
||||||
},
|
<ChatOpenButton phone={record.ownr_ph2} jobid={record.jobid} />
|
||||||
{
|
</Space>
|
||||||
title: t("jobs.fields.ownr_ph2"),
|
|
||||||
dataIndex: "ownr_ph2",
|
|
||||||
key: "ownr_ph2",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.jobid} />
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -134,7 +328,7 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ea} jobid={record.jobid} />
|
<a href={`mailto:${record.ownr_ea}`}>{record.ownr_ea}</a>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -142,6 +336,15 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
key: "vehicle",
|
key: "vehicle",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.vehicleid ? (
|
return record.vehicleid ? (
|
||||||
<Link
|
<Link
|
||||||
@@ -165,43 +368,80 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) {
|
|||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
},
|
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
||||||
{
|
sortOrder:
|
||||||
title: t("appointments.fields.time"),
|
state.sortedInfo.columnKey === "ins_co_nm" && state.sortedInfo.order,
|
||||||
dataIndex: "start",
|
filters:
|
||||||
key: "start",
|
(appt &&
|
||||||
ellipsis: true,
|
appt
|
||||||
responsive: ["md"],
|
.map((j) => j.ins_co_nm)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Ins. Co.*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("appointments.fields.alt_transport"),
|
title: t("appointments.fields.alt_transport"),
|
||||||
dataIndex: "alt_transport",
|
dataIndex: "alt_transport",
|
||||||
key: "alt_transport",
|
key: "alt_transport",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "alt_transport" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
filters:
|
||||||
|
(appt &&
|
||||||
|
appt
|
||||||
|
.map((j) => j.alt_transport)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Alt. Transport",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.alt_transport),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleTableChange = (sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, sortedInfo: sorter });
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={t("dashboard.titles.scheduledintoday", {
|
title={t("dashboard.titles.scheduledindate", {
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
date: moment().startOf("day").format("MM/DD/YYYY"),
|
||||||
})}
|
})}
|
||||||
|
extra={
|
||||||
|
<Space>
|
||||||
|
<Typography.Text>{t("general.labels.tvmode")}</Typography.Text>
|
||||||
|
<Switch
|
||||||
|
onClick={() => setIsTvModeScheduledIn(!isTvModeScheduledIn)}
|
||||||
|
defaultChecked={isTvModeScheduledIn}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
{...cardProps}
|
{...cardProps}
|
||||||
>
|
>
|
||||||
<div style={{ height: "100%" }}>
|
<div style={{ height: "100%" }}>
|
||||||
<Table
|
<Table
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
pagination={{ position: "top", defaultPageSize: pageLimit }}
|
pagination={false}
|
||||||
columns={columns}
|
columns={isTvModeScheduledIn ? tvColumns : columns}
|
||||||
scroll={{ x: true, y: "calc(100% - 2em)" }}
|
scroll={{ x: true, y: "calc(100% - 2em)" }}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
style={{ height: "85%" }}
|
style={{ height: "85%" }}
|
||||||
dataSource={appt}
|
dataSource={appt}
|
||||||
|
size={isTvModeScheduledIn ? "small" : "middle"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -220,6 +460,10 @@ export const DashboardScheduledInTodayGql = `
|
|||||||
alt_transport
|
alt_transport
|
||||||
clm_no
|
clm_no
|
||||||
jobid: id
|
jobid: id
|
||||||
|
joblines(where: {removed: {_eq: false}}) {
|
||||||
|
mod_lb_hrs
|
||||||
|
mod_lbr_ty
|
||||||
|
}
|
||||||
ins_co_nm
|
ins_co_nm
|
||||||
iouparent
|
iouparent
|
||||||
ownerid
|
ownerid
|
||||||
|
|||||||
@@ -3,37 +3,272 @@ import {
|
|||||||
ExclamationCircleFilled,
|
ExclamationCircleFilled,
|
||||||
PauseCircleOutlined,
|
PauseCircleOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Card, Space, Table, Tooltip } from "antd";
|
import { Card, Space, Switch, Table, Tooltip, Typography } from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { TimeFormatter } from "../../../utils/DateFormatter";
|
||||||
|
import { onlyUnique } from "../../../utils/arrayHelper";
|
||||||
|
import { alphaSort, dateSort } from "../../../utils/sorters";
|
||||||
|
import useLocalStorage from "../../../utils/useLocalStorage";
|
||||||
import ChatOpenButton from "../../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../../owner-name-display/owner-name-display.component";
|
||||||
import DashboardRefreshRequired from "../refresh-required.component";
|
import DashboardRefreshRequired from "../refresh-required.component";
|
||||||
import {pageLimit} from "../../../utils/config";
|
|
||||||
|
|
||||||
export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
|
filteredInfo: {},
|
||||||
});
|
});
|
||||||
|
const [isTvModeScheduledOut, setIsTvModeScheduledOut] = useLocalStorage(
|
||||||
|
"isTvModeScheduledOut",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
if (!data.scheduled_out_today)
|
if (!data.scheduled_out_today)
|
||||||
return <DashboardRefreshRequired {...cardProps} />;
|
return <DashboardRefreshRequired {...cardProps} />;
|
||||||
|
|
||||||
data.scheduled_out_today.forEach((item) => {
|
data.scheduled_out_today.forEach((item) => {
|
||||||
item.scheduled_completion= moment(item.scheduled_completion).format("hh:mm a")
|
item.joblines_body = item.joblines
|
||||||
|
? item.joblines
|
||||||
|
.filter((l) => l.mod_lbr_ty !== "LAR")
|
||||||
|
.reduce((acc, val) => acc + val.mod_lb_hrs, 0)
|
||||||
|
: 0;
|
||||||
|
item.joblines_ref = item.joblines
|
||||||
|
? item.joblines
|
||||||
|
.filter((l) => l.mod_lbr_ty === "LAR")
|
||||||
|
.reduce((acc, val) => acc + val.mod_lb_hrs, 0)
|
||||||
|
: 0;
|
||||||
});
|
});
|
||||||
data.scheduled_out_today.sort(function (a, b) {
|
data.scheduled_out_today.sort(function (a, b) {
|
||||||
return new Date(a.scheduled_completion) - new Date(b.scheduled_completion);
|
return new Date(a.scheduled_completion) - new Date(b.scheduled_completion);
|
||||||
});
|
});
|
||||||
|
|
||||||
const columns = [
|
const tvFontSize = 18;
|
||||||
|
const tvFontWeight = "bold";
|
||||||
|
|
||||||
|
const tvColumns = [
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.scheduled_completion"),
|
||||||
|
dataIndex: "scheduled_completion",
|
||||||
|
key: "scheduled_completion",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
dateSort(a.scheduled_completion, b.scheduled_completion),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "scheduled_completion" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
<TimeFormatter>{record.scheduled_completion}</TimeFormatter>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
|
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<Link
|
||||||
|
to={"/manage/jobs/" + record.jobid}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<Space>
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.ro_number || t("general.labels.na")}
|
||||||
|
{record.production_vars && record.production_vars.alert ? (
|
||||||
|
<ExclamationCircleFilled className="production-alert" />
|
||||||
|
) : null}
|
||||||
|
{record.suspended && (
|
||||||
|
<PauseCircleOutlined style={{ color: "orangered" }} />
|
||||||
|
)}
|
||||||
|
{record.iouparent && (
|
||||||
|
<Tooltip title={t("jobs.labels.iou")}>
|
||||||
|
<BranchesOutlined style={{ color: "orangered" }} />
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</Space>
|
||||||
|
</Link>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.owner"),
|
||||||
|
dataIndex: "owner",
|
||||||
|
key: "owner",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.ownerid ? (
|
||||||
|
<Link
|
||||||
|
to={"/manage/owners/" + record.ownerid}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
<OwnerNameDisplay ownerObject={record} />
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
<OwnerNameDisplay ownerObject={record} />
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.vehicle"),
|
||||||
|
dataIndex: "vehicle",
|
||||||
|
key: "vehicle",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.vehicleid ? (
|
||||||
|
<Link
|
||||||
|
to={"/manage/vehicles/" + record.vehicleid}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||||
|
record.v_model_desc || ""
|
||||||
|
}`}
|
||||||
|
</span>
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>{`${
|
||||||
|
record.v_model_yr || ""
|
||||||
|
} ${record.v_make_desc || ""} ${record.v_model_desc || ""}`}</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("appointments.fields.alt_transport"),
|
||||||
|
dataIndex: "alt_transport",
|
||||||
|
key: "alt_transport",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "alt_transport" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
filters:
|
||||||
|
(data.scheduled_out_today &&
|
||||||
|
data.scheduled_out_today
|
||||||
|
.map((j) => j.alt_transport)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Alt. Transport*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.alt_transport),
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.alt_transport}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.status"),
|
||||||
|
dataIndex: "status",
|
||||||
|
key: "status",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
|
filters:
|
||||||
|
(data.scheduled_out_today &&
|
||||||
|
data.scheduled_out_today
|
||||||
|
.map((j) => j.status)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Status*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.status}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.lab"),
|
||||||
|
dataIndex: "joblines_body",
|
||||||
|
key: "joblines_body",
|
||||||
|
sorter: (a, b) => a.joblines_body - b.joblines_body,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "joblines_body" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
align: "right",
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.joblines_body.toFixed(1)}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.lar"),
|
||||||
|
dataIndex: "joblines_ref",
|
||||||
|
key: "joblines_ref",
|
||||||
|
sorter: (a, b) => a.joblines_ref - b.joblines_ref,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "joblines_ref" && state.sortedInfo.order,
|
||||||
|
align: "right",
|
||||||
|
render: (text, record) => (
|
||||||
|
<span style={{ fontSize: tvFontSize, fontWeight: tvFontWeight }}>
|
||||||
|
{record.joblines_ref.toFixed(1)}
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.scheduled_completion"),
|
||||||
|
dataIndex: "scheduled_completion",
|
||||||
|
key: "scheduled_completion",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
dateSort(a.scheduled_completion, b.scheduled_completion),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "scheduled_completion" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<TimeFormatter>{record.scheduled_completion}</TimeFormatter>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.ro_number"),
|
||||||
|
dataIndex: "ro_number",
|
||||||
|
key: "ro_number",
|
||||||
|
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link
|
<Link
|
||||||
to={"/manage/jobs/" + record.jobid}
|
to={"/manage/jobs/" + record.jobid}
|
||||||
@@ -61,7 +296,10 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
|||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.ownerid ? (
|
return record.ownerid ? (
|
||||||
<Link
|
<Link
|
||||||
@@ -78,23 +316,16 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ownr_ph1"),
|
title: t("dashboard.labels.phone"),
|
||||||
dataIndex: "ownr_ph1",
|
dataIndex: "ownr_ph",
|
||||||
key: "ownr_ph1",
|
key: "ownr_ph",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.jobid} />
|
<Space size="small" wrap>
|
||||||
),
|
<ChatOpenButton phone={record.ownr_ph1} jobid={record.jobid} />
|
||||||
},
|
<ChatOpenButton phone={record.ownr_ph2} jobid={record.jobid} />
|
||||||
{
|
</Space>
|
||||||
title: t("jobs.fields.ownr_ph2"),
|
|
||||||
dataIndex: "ownr_ph2",
|
|
||||||
key: "ownr_ph2",
|
|
||||||
ellipsis: true,
|
|
||||||
responsive: ["md"],
|
|
||||||
render: (text, record) => (
|
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.jobid} />
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -104,7 +335,7 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ea} jobid={record.jobid} />
|
<a href={`mailto:${record.ownr_ea}`}>{record.ownr_ea}</a>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -112,6 +343,15 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
|||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
key: "vehicle",
|
key: "vehicle",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.vehicleid ? (
|
return record.vehicleid ? (
|
||||||
<Link
|
<Link
|
||||||
@@ -135,43 +375,80 @@ export default function DashboardScheduledOutToday({ data, ...cardProps }) {
|
|||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
},
|
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
||||||
{
|
sortOrder:
|
||||||
title: t("jobs.fields.scheduled_completion"),
|
state.sortedInfo.columnKey === "ins_co_nm" && state.sortedInfo.order,
|
||||||
dataIndex: "scheduled_completion",
|
filters:
|
||||||
key: "scheduled_completion",
|
(data.scheduled_out_today &&
|
||||||
ellipsis: true,
|
data.scheduled_out_today
|
||||||
responsive: ["md"],
|
.map((j) => j.ins_co_nm)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Ins. Co.*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("appointments.fields.alt_transport"),
|
title: t("appointments.fields.alt_transport"),
|
||||||
dataIndex: "alt_transport",
|
dataIndex: "alt_transport",
|
||||||
key: "alt_transport",
|
key: "alt_transport",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "alt_transport" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
|
filters:
|
||||||
|
(data.scheduled_out_today &&
|
||||||
|
data.scheduled_out_today
|
||||||
|
.map((j) => j.alt_transport)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Alt. Transport*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.alt_transport),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleTableChange = (sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, sortedInfo: sorter });
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={t("dashboard.titles.scheduledouttoday", {
|
title={t("dashboard.titles.scheduledoutdate", {
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
date: moment().startOf("day").format("MM/DD/YYYY"),
|
||||||
})}
|
})}
|
||||||
|
extra={
|
||||||
|
<Space>
|
||||||
|
<Typography.Text>{t("general.labels.tvmode")}</Typography.Text>
|
||||||
|
<Switch
|
||||||
|
onClick={() => setIsTvModeScheduledOut(!isTvModeScheduledOut)}
|
||||||
|
defaultChecked={isTvModeScheduledOut}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
{...cardProps}
|
{...cardProps}
|
||||||
>
|
>
|
||||||
<div style={{ height: "100%" }}>
|
<div style={{ height: "100%" }}>
|
||||||
<Table
|
<Table
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
pagination={{ position: "top", defaultPageSize: pageLimit }}
|
pagination={false}
|
||||||
columns={columns}
|
columns={isTvModeScheduledOut ? tvColumns : columns}
|
||||||
scroll={{ x: true, y: "calc(100% - 2em)" }}
|
scroll={{ x: true, y: "calc(100% - 2em)" }}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
style={{ height: "85%" }}
|
style={{ height: "85%" }}
|
||||||
dataSource={data.scheduled_out_today}
|
dataSource={data.scheduled_out_today}
|
||||||
|
size={isTvModeScheduledOut ? "small" : "middle"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -188,6 +465,10 @@ export const DashboardScheduledOutTodayGql = `
|
|||||||
alt_transport
|
alt_transport
|
||||||
clm_no
|
clm_no
|
||||||
jobid: id
|
jobid: id
|
||||||
|
joblines(where: {removed: {_eq: false}}) {
|
||||||
|
mod_lb_hrs
|
||||||
|
mod_lbr_ty
|
||||||
|
}
|
||||||
ins_co_nm
|
ins_co_nm
|
||||||
iouparent
|
iouparent
|
||||||
ownerid
|
ownerid
|
||||||
@@ -200,6 +481,7 @@ export const DashboardScheduledOutTodayGql = `
|
|||||||
production_vars
|
production_vars
|
||||||
ro_number
|
ro_number
|
||||||
scheduled_completion
|
scheduled_completion
|
||||||
|
status
|
||||||
suspended
|
suspended
|
||||||
v_make_desc
|
v_make_desc
|
||||||
v_model_desc
|
v_model_desc
|
||||||
|
|||||||
@@ -1,386 +1,391 @@
|
|||||||
import Icon, { SyncOutlined } from "@ant-design/icons";
|
import Icon, {SyncOutlined} from "@ant-design/icons";
|
||||||
import { gql, useMutation, useQuery } from "@apollo/client";
|
import {gql, useMutation, useQuery} from "@apollo/client";
|
||||||
import { Button, Dropdown, Menu, PageHeader, Space, notification } from "antd";
|
import {Button, Dropdown, Menu, notification, PageHeader, Space} from "antd";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, {useState} from "react";
|
||||||
import { Responsive, WidthProvider } from "react-grid-layout";
|
import {Responsive, WidthProvider} from "react-grid-layout";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { MdClose } from "react-icons/md";
|
import {MdClose} from "react-icons/md";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import {logImEXEvent} from "../../firebase/firebase.utils";
|
||||||
import { UPDATE_DASHBOARD_LAYOUT } from "../../graphql/user.queries";
|
import {UPDATE_DASHBOARD_LAYOUT} from "../../graphql/user.queries";
|
||||||
import {
|
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
|
||||||
selectBodyshop,
|
|
||||||
selectCurrentUser,
|
|
||||||
} from "../../redux/user/user.selectors";
|
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import DashboardMonthlyEmployeeEfficiency, {
|
import DashboardMonthlyEmployeeEfficiency, {
|
||||||
DashboardMonthlyEmployeeEfficiencyGql,
|
DashboardMonthlyEmployeeEfficiencyGql,
|
||||||
} from "../dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component";
|
} from "../dashboard-components/monthly-employee-efficiency/monthly-employee-efficiency.component";
|
||||||
import DashboardMonthlyJobCosting from "../dashboard-components/monthly-job-costing/monthly-job-costing.component";
|
import DashboardMonthlyJobCosting from "../dashboard-components/monthly-job-costing/monthly-job-costing.component";
|
||||||
import DashboardMonthlyLaborSales from "../dashboard-components/monthly-labor-sales/monthly-labor-sales.component";
|
import DashboardMonthlyLaborSales from "../dashboard-components/monthly-labor-sales/monthly-labor-sales.component";
|
||||||
import DashboardMonthlyPartsSales from "../dashboard-components/monthly-parts-sales/monthly-parts-sales.component";
|
import DashboardMonthlyPartsSales from "../dashboard-components/monthly-parts-sales/monthly-parts-sales.component";
|
||||||
import DashboardMonthlyRevenueGraph, {
|
import DashboardMonthlyRevenueGraph, {
|
||||||
DashboardMonthlyRevenueGraphGql,
|
DashboardMonthlyRevenueGraphGql,
|
||||||
} from "../dashboard-components/monthly-revenue-graph/monthly-revenue-graph.component";
|
} from "../dashboard-components/monthly-revenue-graph/monthly-revenue-graph.component";
|
||||||
import DashboardProjectedMonthlySales, {
|
import DashboardProjectedMonthlySales, {
|
||||||
DashboardProjectedMonthlySalesGql,
|
DashboardProjectedMonthlySalesGql,
|
||||||
} from "../dashboard-components/pojected-monthly-sales/projected-monthly-sales.component";
|
} from "../dashboard-components/pojected-monthly-sales/projected-monthly-sales.component";
|
||||||
import DashboardTotalProductionDollars from "../dashboard-components/total-production-dollars/total-production-dollars.component";
|
import DashboardTotalProductionDollars
|
||||||
|
from "../dashboard-components/total-production-dollars/total-production-dollars.component";
|
||||||
import DashboardTotalProductionHours, {
|
import DashboardTotalProductionHours, {
|
||||||
DashboardTotalProductionHoursGql,
|
DashboardTotalProductionHoursGql,
|
||||||
} from "../dashboard-components/total-production-hours/total-production-hours.component";
|
} from "../dashboard-components/total-production-hours/total-production-hours.component";
|
||||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||||
//Combination of the following:
|
//Combination of the following:
|
||||||
// /node_modules/react-grid-layout/css/styles.css
|
// /node_modules/react-grid-layout/css/styles.css
|
||||||
// /node_modules/react-resizable/css/styles.css
|
// /node_modules/react-resizable/css/styles.css
|
||||||
import DashboardScheduledInToday, {
|
import DashboardScheduledInToday, {
|
||||||
DashboardScheduledInTodayGql,
|
DashboardScheduledInTodayGql,
|
||||||
} from "../dashboard-components/scheduled-in-today/scheduled-in-today.component";
|
} from "../dashboard-components/scheduled-in-today/scheduled-in-today.component";
|
||||||
import DashboardScheduledOutToday, {
|
import DashboardScheduledOutToday, {
|
||||||
DashboardScheduledOutTodayGql,
|
DashboardScheduledOutTodayGql,
|
||||||
} from "../dashboard-components/scheduled-out-today/scheduled-out-today.component";
|
} from "../dashboard-components/scheduled-out-today/scheduled-out-today.component";
|
||||||
|
import JobLifecycleDashboardComponent, {
|
||||||
|
JobLifecycleDashboardGQL
|
||||||
|
} from "../dashboard-components/job-lifecycle/job-lifecycle-dashboard.component";
|
||||||
import "./dashboard-grid.styles.scss";
|
import "./dashboard-grid.styles.scss";
|
||||||
import { GenerateDashboardData } from "./dashboard-grid.utils";
|
import {GenerateDashboardData} from "./dashboard-grid.utils";
|
||||||
|
|
||||||
const ResponsiveReactGridLayout = WidthProvider(Responsive);
|
const ResponsiveReactGridLayout = WidthProvider(Responsive);
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
});
|
});
|
||||||
|
|
||||||
export function DashboardGridComponent({ currentUser, bodyshop }) {
|
export function DashboardGridComponent({currentUser, bodyshop}) {
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
...(bodyshop.associations[0].user.dashboardlayout
|
...(bodyshop.associations[0].user.dashboardlayout
|
||||||
? bodyshop.associations[0].user.dashboardlayout
|
? bodyshop.associations[0].user.dashboardlayout
|
||||||
: { items: [], layout: {}, layouts: [] }),
|
: {items: [], layout: {}, layouts: []}),
|
||||||
});
|
|
||||||
|
|
||||||
const { loading, error, data, refetch } = useQuery(
|
|
||||||
createDashboardQuery(state),
|
|
||||||
{ fetchPolicy: "network-only", nextFetchPolicy: "network-only" }
|
|
||||||
);
|
|
||||||
|
|
||||||
const [updateLayout] = useMutation(UPDATE_DASHBOARD_LAYOUT);
|
|
||||||
|
|
||||||
const handleLayoutChange = async (layout, layouts) => {
|
|
||||||
logImEXEvent("dashboard_change_layout");
|
|
||||||
|
|
||||||
setState({ ...state, layout, layouts });
|
|
||||||
|
|
||||||
const result = await updateLayout({
|
|
||||||
variables: {
|
|
||||||
email: currentUser.email,
|
|
||||||
layout: { ...state, layout, layouts },
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
if (!!result.errors) {
|
|
||||||
notification["error"]({
|
|
||||||
message: t("dashboard.errors.updatinglayout", {
|
|
||||||
message: JSON.stringify(result.errors),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleRemoveComponent = (key) => {
|
|
||||||
logImEXEvent("dashboard_remove_component", { name: key });
|
|
||||||
const idxToRemove = state.items.findIndex((i) => i.i === key);
|
|
||||||
|
|
||||||
const items = _.cloneDeep(state.items);
|
const {loading, error, data, refetch} = useQuery(
|
||||||
|
createDashboardQuery(state),
|
||||||
|
{fetchPolicy: "network-only", nextFetchPolicy: "network-only"}
|
||||||
|
);
|
||||||
|
|
||||||
items.splice(idxToRemove, 1);
|
const [updateLayout] = useMutation(UPDATE_DASHBOARD_LAYOUT);
|
||||||
setState({ ...state, items });
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleAddComponent = (e) => {
|
const handleLayoutChange = async (layout, layouts) => {
|
||||||
logImEXEvent("dashboard_add_component", { name: e });
|
logImEXEvent("dashboard_change_layout");
|
||||||
setState({
|
|
||||||
...state,
|
|
||||||
items: [
|
|
||||||
...state.items,
|
|
||||||
{
|
|
||||||
i: e.key,
|
|
||||||
x: (state.items.length * 2) % (state.cols || 12),
|
|
||||||
y: 99, // puts it at the bottom
|
|
||||||
w: componentList[e.key].w || 2,
|
|
||||||
h: componentList[e.key].h || 2,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const dashboarddata = React.useMemo(
|
setState({...state, layout, layouts});
|
||||||
() => GenerateDashboardData(data),
|
|
||||||
[data]
|
|
||||||
);
|
|
||||||
const existingLayoutKeys = state.items.map((i) => i.i);
|
|
||||||
const addComponentOverlay = (
|
|
||||||
<Menu onClick={handleAddComponent}>
|
|
||||||
{Object.keys(componentList).map((key) => (
|
|
||||||
<Menu.Item
|
|
||||||
key={key}
|
|
||||||
value={key}
|
|
||||||
disabled={existingLayoutKeys.includes(key)}
|
|
||||||
>
|
|
||||||
{componentList[key].label}
|
|
||||||
</Menu.Item>
|
|
||||||
))}
|
|
||||||
</Menu>
|
|
||||||
);
|
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
const result = await updateLayout({
|
||||||
|
variables: {
|
||||||
return (
|
email: currentUser.email,
|
||||||
<div>
|
layout: {...state, layout, layouts},
|
||||||
<PageHeader
|
},
|
||||||
extra={
|
});
|
||||||
<Space>
|
if (!!result.errors) {
|
||||||
<Button onClick={() => refetch()}>
|
notification["error"]({
|
||||||
<SyncOutlined />
|
message: t("dashboard.errors.updatinglayout", {
|
||||||
</Button>
|
message: JSON.stringify(result.errors),
|
||||||
<Dropdown overlay={addComponentOverlay} trigger={["click"]}>
|
}),
|
||||||
<Button>{t("dashboard.actions.addcomponent")}</Button>
|
});
|
||||||
</Dropdown>
|
|
||||||
</Space>
|
|
||||||
}
|
}
|
||||||
/>
|
};
|
||||||
|
const handleRemoveComponent = (key) => {
|
||||||
|
logImEXEvent("dashboard_remove_component", {name: key});
|
||||||
|
const idxToRemove = state.items.findIndex((i) => i.i === key);
|
||||||
|
|
||||||
<ResponsiveReactGridLayout
|
const items = _.cloneDeep(state.items);
|
||||||
className="layout"
|
|
||||||
breakpoints={{ lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 }}
|
items.splice(idxToRemove, 1);
|
||||||
cols={{ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 }}
|
setState({...state, items});
|
||||||
width="100%"
|
};
|
||||||
layouts={state.layouts}
|
|
||||||
onLayoutChange={handleLayoutChange}
|
const handleAddComponent = (e) => {
|
||||||
// onBreakpointChange={onBreakpointChange}
|
logImEXEvent("dashboard_add_component", {name: e});
|
||||||
>
|
setState({
|
||||||
{state.items.map((item, index) => {
|
...state,
|
||||||
const TheComponent = componentList[item.i].component;
|
items: [
|
||||||
return (
|
...state.items,
|
||||||
<div
|
{
|
||||||
key={item.i}
|
i: e.key,
|
||||||
data-grid={{
|
x: (state.items.length * 2) % (state.cols || 12),
|
||||||
...item,
|
y: 99, // puts it at the bottom
|
||||||
minH: componentList[item.i].minH || 1,
|
w: componentList[e.key].w || 2,
|
||||||
minW: componentList[item.i].minW || 1,
|
h: componentList[e.key].h || 2,
|
||||||
}}
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const dashboarddata = React.useMemo(
|
||||||
|
() => GenerateDashboardData(data),
|
||||||
|
[data]
|
||||||
|
);
|
||||||
|
const existingLayoutKeys = state.items.map((i) => i.i);
|
||||||
|
const addComponentOverlay = (
|
||||||
|
<Menu onClick={handleAddComponent}>
|
||||||
|
{Object.keys(componentList).map((key) => (
|
||||||
|
<Menu.Item
|
||||||
|
key={key}
|
||||||
|
value={key}
|
||||||
|
disabled={existingLayoutKeys.includes(key)}
|
||||||
|
>
|
||||||
|
{componentList[key].label}
|
||||||
|
</Menu.Item>
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<PageHeader
|
||||||
|
extra={
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => refetch()}>
|
||||||
|
<SyncOutlined/>
|
||||||
|
</Button>
|
||||||
|
<Dropdown overlay={addComponentOverlay} trigger={["click"]}>
|
||||||
|
<Button>{t("dashboard.actions.addcomponent")}</Button>
|
||||||
|
</Dropdown>
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ResponsiveReactGridLayout
|
||||||
|
className="layout"
|
||||||
|
breakpoints={{lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0}}
|
||||||
|
cols={{lg: 12, md: 10, sm: 6, xs: 4, xxs: 2}}
|
||||||
|
width="100%"
|
||||||
|
layouts={state.layouts}
|
||||||
|
onLayoutChange={handleLayoutChange}
|
||||||
|
// onBreakpointChange={onBreakpointChange}
|
||||||
>
|
>
|
||||||
<LoadingSkeleton loading={loading}>
|
{state.items.map((item, index) => {
|
||||||
<Icon
|
const TheComponent = componentList[item.i].component;
|
||||||
component={MdClose}
|
return (
|
||||||
key={item.i}
|
<div
|
||||||
style={{
|
key={item.i}
|
||||||
position: "absolute",
|
data-grid={{
|
||||||
zIndex: "2",
|
...item,
|
||||||
right: ".25rem",
|
minH: componentList[item.i].minH || 1,
|
||||||
top: ".25rem",
|
minW: componentList[item.i].minW || 1,
|
||||||
cursor: "pointer",
|
}}
|
||||||
}}
|
>
|
||||||
onClick={() => handleRemoveComponent(item.i)}
|
<LoadingSkeleton loading={loading}>
|
||||||
/>
|
<Icon
|
||||||
<TheComponent className="dashboard-card" data={dashboarddata} />
|
component={MdClose}
|
||||||
</LoadingSkeleton>
|
key={item.i}
|
||||||
</div>
|
style={{
|
||||||
);
|
position: "absolute",
|
||||||
})}
|
zIndex: "2",
|
||||||
</ResponsiveReactGridLayout>
|
right: ".25rem",
|
||||||
</div>
|
top: ".25rem",
|
||||||
);
|
cursor: "pointer",
|
||||||
|
}}
|
||||||
|
onClick={() => handleRemoveComponent(item.i)}
|
||||||
|
/>
|
||||||
|
<TheComponent className="dashboard-card" bodyshop={bodyshop} data={dashboarddata}/>
|
||||||
|
</LoadingSkeleton>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ResponsiveReactGridLayout>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(DashboardGridComponent);
|
)(DashboardGridComponent);
|
||||||
|
|
||||||
const componentList = {
|
const componentList = {
|
||||||
ProductionDollars: {
|
ProductionDollars: {
|
||||||
label: i18next.t("dashboard.titles.productiondollars"),
|
label: i18next.t("dashboard.titles.productiondollars"),
|
||||||
component: DashboardTotalProductionDollars,
|
component: DashboardTotalProductionDollars,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
w: 1,
|
w: 1,
|
||||||
h: 1,
|
h: 1,
|
||||||
minW: 2,
|
minW: 2,
|
||||||
minH: 1,
|
minH: 1,
|
||||||
},
|
},
|
||||||
ProductionHours: {
|
ProductionHours: {
|
||||||
label: i18next.t("dashboard.titles.productionhours"),
|
label: i18next.t("dashboard.titles.productionhours"),
|
||||||
component: DashboardTotalProductionHours,
|
component: DashboardTotalProductionHours,
|
||||||
gqlFragment: DashboardTotalProductionHoursGql,
|
gqlFragment: DashboardTotalProductionHoursGql,
|
||||||
w: 3,
|
w: 3,
|
||||||
h: 1,
|
h: 1,
|
||||||
minW: 3,
|
minW: 3,
|
||||||
minH: 1,
|
minH: 1,
|
||||||
},
|
},
|
||||||
ProjectedMonthlySales: {
|
ProjectedMonthlySales: {
|
||||||
label: i18next.t("dashboard.titles.projectedmonthlysales"),
|
label: i18next.t("dashboard.titles.projectedmonthlysales"),
|
||||||
component: DashboardProjectedMonthlySales,
|
component: DashboardProjectedMonthlySales,
|
||||||
gqlFragment: DashboardProjectedMonthlySalesGql,
|
gqlFragment: DashboardProjectedMonthlySalesGql,
|
||||||
w: 2,
|
w: 2,
|
||||||
h: 1,
|
h: 1,
|
||||||
minW: 2,
|
minW: 2,
|
||||||
minH: 1,
|
minH: 1,
|
||||||
},
|
},
|
||||||
MonthlyRevenueGraph: {
|
MonthlyRevenueGraph: {
|
||||||
label: i18next.t("dashboard.titles.monthlyrevenuegraph"),
|
label: i18next.t("dashboard.titles.monthlyrevenuegraph"),
|
||||||
component: DashboardMonthlyRevenueGraph,
|
component: DashboardMonthlyRevenueGraph,
|
||||||
gqlFragment: DashboardMonthlyRevenueGraphGql,
|
gqlFragment: DashboardMonthlyRevenueGraphGql,
|
||||||
w: 4,
|
w: 4,
|
||||||
h: 2,
|
h: 2,
|
||||||
minW: 4,
|
minW: 4,
|
||||||
minH: 2,
|
minH: 2,
|
||||||
},
|
},
|
||||||
MonthlyJobCosting: {
|
MonthlyJobCosting: {
|
||||||
label: i18next.t("dashboard.titles.monthlyjobcosting"),
|
label: i18next.t("dashboard.titles.monthlyjobcosting"),
|
||||||
component: DashboardMonthlyJobCosting,
|
component: DashboardMonthlyJobCosting,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
minW: 6,
|
minW: 6,
|
||||||
minH: 3,
|
minH: 3,
|
||||||
w: 6,
|
w: 6,
|
||||||
h: 3,
|
h: 3,
|
||||||
},
|
},
|
||||||
MonthlyPartsSales: {
|
MonthlyPartsSales: {
|
||||||
label: i18next.t("dashboard.titles.monthlypartssales"),
|
label: i18next.t("dashboard.titles.monthlypartssales"),
|
||||||
component: DashboardMonthlyPartsSales,
|
component: DashboardMonthlyPartsSales,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
minW: 2,
|
minW: 2,
|
||||||
minH: 2,
|
minH: 2,
|
||||||
w: 2,
|
w: 2,
|
||||||
h: 2,
|
h: 2,
|
||||||
},
|
},
|
||||||
MonthlyLaborSales: {
|
MonthlyLaborSales: {
|
||||||
label: i18next.t("dashboard.titles.monthlylaborsales"),
|
label: i18next.t("dashboard.titles.monthlylaborsales"),
|
||||||
component: DashboardMonthlyLaborSales,
|
component: DashboardMonthlyLaborSales,
|
||||||
gqlFragment: null,
|
gqlFragment: null,
|
||||||
minW: 2,
|
minW: 2,
|
||||||
minH: 2,
|
minH: 2,
|
||||||
w: 2,
|
w: 2,
|
||||||
h: 2,
|
h: 2,
|
||||||
},
|
},
|
||||||
MonthlyEmployeeEfficency: {
|
// Typo in Efficency should be Efficiency, but changing it would reset users dashboard settings
|
||||||
label: i18next.t("dashboard.titles.monthlyemployeeefficiency"),
|
MonthlyEmployeeEfficency: {
|
||||||
component: DashboardMonthlyEmployeeEfficiency,
|
label: i18next.t("dashboard.titles.monthlyemployeeefficiency"),
|
||||||
gqlFragment: DashboardMonthlyEmployeeEfficiencyGql,
|
component: DashboardMonthlyEmployeeEfficiency,
|
||||||
minW: 2,
|
gqlFragment: DashboardMonthlyEmployeeEfficiencyGql,
|
||||||
minH: 2,
|
minW: 2,
|
||||||
w: 2,
|
minH: 2,
|
||||||
h: 2,
|
w: 2,
|
||||||
},
|
h: 2,
|
||||||
ScheduleInToday: {
|
},
|
||||||
label: i18next.t("dashboard.titles.scheduledintoday", {
|
ScheduleInToday: {
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
label: i18next.t("dashboard.titles.scheduledintoday"),
|
||||||
}),
|
component: DashboardScheduledInToday,
|
||||||
component: DashboardScheduledInToday,
|
gqlFragment: DashboardScheduledInTodayGql,
|
||||||
gqlFragment: DashboardScheduledInTodayGql,
|
minW: 6,
|
||||||
minW: 10,
|
minH: 2,
|
||||||
minH: 2,
|
w: 10,
|
||||||
w: 10,
|
h: 3,
|
||||||
h: 2,
|
},
|
||||||
},
|
ScheduleOutToday: {
|
||||||
ScheduleOutToday: {
|
label: i18next.t("dashboard.titles.scheduledouttoday"),
|
||||||
label: i18next.t("dashboard.titles.scheduledouttoday", {
|
component: DashboardScheduledOutToday,
|
||||||
date: moment().startOf("day").format("MM/DD/YYYY"),
|
gqlFragment: DashboardScheduledOutTodayGql,
|
||||||
}),
|
minW: 6,
|
||||||
component: DashboardScheduledOutToday,
|
minH: 2,
|
||||||
gqlFragment: DashboardScheduledOutTodayGql,
|
w: 10,
|
||||||
minW: 10,
|
h: 3,
|
||||||
minH: 2,
|
},
|
||||||
w: 10,
|
JobLifecycle: {
|
||||||
h: 2,
|
label: i18next.t("dashboard.titles.joblifecycle"),
|
||||||
},
|
component: JobLifecycleDashboardComponent,
|
||||||
|
gqlFragment: JobLifecycleDashboardGQL,
|
||||||
|
minW: 6,
|
||||||
|
minH: 3,
|
||||||
|
w: 6,
|
||||||
|
h: 3,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const createDashboardQuery = (state) => {
|
const createDashboardQuery = (state) => {
|
||||||
const componentBasedAdditions =
|
const componentBasedAdditions =
|
||||||
state &&
|
state &&
|
||||||
Array.isArray(state.layout) &&
|
Array.isArray(state.layout) &&
|
||||||
state.layout
|
state.layout
|
||||||
.map((item, index) => componentList[item.i].gqlFragment || "")
|
.map((item, index) => componentList[item.i].gqlFragment || "")
|
||||||
.join("");
|
.join("");
|
||||||
return gql`
|
return gql`
|
||||||
query QUERY_DASHBOARD_DETAILS {
|
query QUERY_DASHBOARD_DETAILS { ${componentBasedAdditions || ""}
|
||||||
${componentBasedAdditions || ""}
|
monthly_sales: jobs(where: {_and: [
|
||||||
monthly_sales: jobs(where: {_and: [
|
{ voided: {_eq: false}},
|
||||||
{ voided: {_eq: false}},
|
{date_invoiced: {_gte: "${moment()
|
||||||
{date_invoiced: {_gte: "${moment()
|
|
||||||
.startOf("month")
|
.startOf("month")
|
||||||
.startOf("day")
|
.startOf("day")
|
||||||
.toISOString()}"}}, {date_invoiced: {_lte: "${moment()
|
.toISOString()}"}}, {date_invoiced: {_lte: "${moment()
|
||||||
.endOf("month")
|
.endOf("month")
|
||||||
.endOf("day")
|
.endOf("day")
|
||||||
.toISOString()}"}}]}) {
|
.toISOString()}"}}]}) {
|
||||||
id
|
id
|
||||||
ro_number
|
ro_number
|
||||||
date_invoiced
|
date_invoiced
|
||||||
job_totals
|
job_totals
|
||||||
rate_la1
|
rate_la1
|
||||||
rate_la2
|
rate_la2
|
||||||
rate_la3
|
rate_la3
|
||||||
rate_la4
|
rate_la4
|
||||||
rate_laa
|
rate_laa
|
||||||
rate_lab
|
rate_lab
|
||||||
rate_lad
|
rate_lad
|
||||||
rate_lae
|
rate_lae
|
||||||
rate_laf
|
rate_laf
|
||||||
rate_lag
|
rate_lag
|
||||||
rate_lam
|
rate_lam
|
||||||
rate_lar
|
rate_lar
|
||||||
rate_las
|
rate_las
|
||||||
rate_lau
|
rate_lau
|
||||||
rate_ma2s
|
rate_ma2s
|
||||||
rate_ma2t
|
rate_ma2t
|
||||||
rate_ma3s
|
rate_ma3s
|
||||||
rate_mabl
|
rate_mabl
|
||||||
rate_macs
|
rate_macs
|
||||||
rate_mahw
|
rate_mahw
|
||||||
rate_mapa
|
rate_mapa
|
||||||
rate_mash
|
rate_mash
|
||||||
rate_matd
|
rate_matd
|
||||||
joblines(where: { removed: { _eq: false } }) {
|
joblines(where: { removed: { _eq: false } }) {
|
||||||
id
|
id
|
||||||
mod_lbr_ty
|
mod_lbr_ty
|
||||||
mod_lb_hrs
|
mod_lb_hrs
|
||||||
act_price
|
act_price
|
||||||
part_qty
|
part_qty
|
||||||
part_type
|
part_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
production_jobs: jobs(where: { inproduction: { _eq: true } }) {
|
production_jobs: jobs(where: { inproduction: { _eq: true } }) {
|
||||||
id
|
id
|
||||||
ro_number
|
ro_number
|
||||||
ins_co_nm
|
ins_co_nm
|
||||||
job_totals
|
job_totals
|
||||||
joblines(where: { removed: { _eq: false } }) {
|
joblines(where: { removed: { _eq: false } }) {
|
||||||
id
|
id
|
||||||
mod_lbr_ty
|
mod_lbr_ty
|
||||||
mod_lb_hrs
|
mod_lb_hrs
|
||||||
act_price
|
act_price
|
||||||
part_qty
|
part_qty
|
||||||
part_type
|
part_type
|
||||||
}
|
}
|
||||||
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }) {
|
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }) {
|
||||||
aggregate {
|
aggregate {
|
||||||
sum {
|
sum {
|
||||||
mod_lb_hrs
|
mod_lb_hrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }) {
|
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }) {
|
||||||
aggregate {
|
aggregate {
|
||||||
sum {
|
sum {
|
||||||
mod_lb_hrs
|
mod_lb_hrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}`;
|
||||||
`;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
.ant-card-body {
|
.ant-card-body {
|
||||||
height: 80%;
|
height: calc(100% - 2rem);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// // background-color: red;
|
// // background-color: red;
|
||||||
// height: 90%;
|
// height: 90%;
|
||||||
|
|||||||
@@ -3,16 +3,13 @@ import axios from "axios";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||||
import OwnerNameDisplay, {
|
import OwnerNameDisplay, { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||||
OwnerNameDisplayFunction,
|
|
||||||
} from "../owner-name-display/owner-name-display.component";
|
|
||||||
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
|
|
||||||
export default function GlobalSearchOs() {
|
export default function GlobalSearchOs() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const history = useHistory();
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [data, setData] = useState(false);
|
const [data, setData] = useState(false);
|
||||||
|
|
||||||
@@ -21,7 +18,7 @@ export default function GlobalSearchOs() {
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const searchData = await axios.post("/search", {
|
const searchData = await axios.post("/search", {
|
||||||
search: v,
|
search: v
|
||||||
});
|
});
|
||||||
|
|
||||||
const resultsByType = {
|
const resultsByType = {
|
||||||
@@ -29,7 +26,7 @@ export default function GlobalSearchOs() {
|
|||||||
jobs: [],
|
jobs: [],
|
||||||
bills: [],
|
bills: [],
|
||||||
owners: [],
|
owners: [],
|
||||||
vehicles: [],
|
vehicles: []
|
||||||
};
|
};
|
||||||
|
|
||||||
searchData.data.hits.hits.forEach((hit) => {
|
searchData.data.hits.hits.forEach((hit) => {
|
||||||
@@ -50,16 +47,14 @@ export default function GlobalSearchOs() {
|
|||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={job} />
|
<OwnerNameDisplay ownerObject={job} />
|
||||||
</span>
|
</span>
|
||||||
<span>{`${job.v_model_yr || ""} ${
|
<span>{`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${job.v_model_desc || ""}`}</span>
|
||||||
job.v_make_desc || ""
|
|
||||||
} ${job.v_model_desc || ""}`}</span>
|
|
||||||
<span>{`${job.clm_no || ""}`}</span>
|
<span>{`${job.clm_no || ""}`}</span>
|
||||||
<span>{`${job.plate_no || ""}`}</span>
|
<span>{`${job.plate_no || ""}`}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.owners")),
|
label: renderTitle(t("menus.header.search.owners")),
|
||||||
@@ -69,53 +64,39 @@ export default function GlobalSearchOs() {
|
|||||||
value: OwnerNameDisplayFunction(owner),
|
value: OwnerNameDisplayFunction(owner),
|
||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/owners/${owner.id}`}>
|
<Link to={`/manage/owners/${owner.id}`}>
|
||||||
<Space
|
<Space size="small" split={<Divider type="vertical" />} wrap>
|
||||||
size="small"
|
|
||||||
split={<Divider type="vertical" />}
|
|
||||||
wrap
|
|
||||||
>
|
|
||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={owner} />
|
<OwnerNameDisplay ownerObject={owner} />
|
||||||
</span>
|
</span>
|
||||||
<PhoneNumberFormatter>
|
<PhoneNumberFormatter>{owner.ownr_ph1}</PhoneNumberFormatter>
|
||||||
{owner.ownr_ph1}
|
<PhoneNumberFormatter>{owner.ownr_ph2}</PhoneNumberFormatter>
|
||||||
</PhoneNumberFormatter>
|
|
||||||
<PhoneNumberFormatter>
|
|
||||||
{owner.ownr_ph2}
|
|
||||||
</PhoneNumberFormatter>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.vehicles")),
|
label: renderTitle(t("menus.header.search.vehicles")),
|
||||||
options: resultsByType.vehicles.map((vehicle) => {
|
options: resultsByType.vehicles.map((vehicle) => {
|
||||||
return {
|
return {
|
||||||
key: vehicle.id,
|
key: vehicle.id,
|
||||||
value: `${vehicle.v_model_yr || ""} ${
|
value: `${vehicle.v_model_yr || ""} ${vehicle.v_make_desc || ""} ${vehicle.v_model_desc || ""}`,
|
||||||
vehicle.v_make_desc || ""
|
|
||||||
} ${vehicle.v_model_desc || ""}`,
|
|
||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/vehicles/${vehicle.id}`}>
|
<Link to={`/manage/vehicles/${vehicle.id}`}>
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
<Space size="small" split={<Divider type="vertical" />}>
|
||||||
<span>
|
<span>
|
||||||
{`${vehicle.v_model_yr || ""} ${
|
{`${vehicle.v_model_yr || ""} ${vehicle.v_make_desc || ""} ${vehicle.v_model_desc || ""}`}
|
||||||
vehicle.v_make_desc || ""
|
|
||||||
} ${vehicle.v_model_desc || ""}`}
|
|
||||||
</span>
|
</span>
|
||||||
<span>{vehicle.plate_no || ""}</span>
|
<span>{vehicle.plate_no || ""}</span>
|
||||||
<span>
|
<span>
|
||||||
<VehicleVinDisplay>
|
<VehicleVinDisplay>{vehicle.v_vin || ""}</VehicleVinDisplay>
|
||||||
{vehicle.v_vin || ""}
|
|
||||||
</VehicleVinDisplay>
|
|
||||||
</span>
|
</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.payments")),
|
label: renderTitle(t("menus.header.search.payments")),
|
||||||
@@ -133,9 +114,9 @@ export default function GlobalSearchOs() {
|
|||||||
<span>{payment.transactionid || ""}</span>
|
<span>{payment.transactionid || ""}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.bills")),
|
label: renderTitle(t("menus.header.search.bills")),
|
||||||
@@ -151,10 +132,10 @@ export default function GlobalSearchOs() {
|
|||||||
<span>{bill.date}</span>
|
<span>{bill.date}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
}
|
||||||
// {
|
// {
|
||||||
// label: renderTitle(t("menus.header.search.phonebook")),
|
// label: renderTitle(t("menus.header.search.phonebook")),
|
||||||
// options: resultsByType.search_phonebook.map((pb) => {
|
// options: resultsByType.search_phonebook.map((pb) => {
|
||||||
@@ -196,15 +177,7 @@ export default function GlobalSearchOs() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AutoComplete
|
<AutoComplete options={data} onSearch={handleSearch} defaultActiveFirstOption onClear={() => setData([])}>
|
||||||
options={data}
|
|
||||||
onSearch={handleSearch}
|
|
||||||
defaultActiveFirstOption
|
|
||||||
onSelect={(val, opt) => {
|
|
||||||
history.push(opt.label.props.to);
|
|
||||||
}}
|
|
||||||
onClear={() => setData([])}
|
|
||||||
>
|
|
||||||
<Input.Search
|
<Input.Search
|
||||||
size="large"
|
size="large"
|
||||||
placeholder={t("general.labels.globalsearch")}
|
placeholder={t("general.labels.globalsearch")}
|
||||||
|
|||||||
@@ -3,28 +3,19 @@ import { AutoComplete, Divider, Input, Space } from "antd";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { GLOBAL_SEARCH_QUERY } from "../../graphql/search.queries";
|
import { GLOBAL_SEARCH_QUERY } from "../../graphql/search.queries";
|
||||||
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import OwnerNameDisplay, {
|
import OwnerNameDisplay, { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||||
OwnerNameDisplayFunction,
|
|
||||||
} from "../owner-name-display/owner-name-display.component";
|
|
||||||
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
|
|
||||||
export default function GlobalSearch() {
|
export default function GlobalSearch() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const history = useHistory();
|
const [callSearch, { loading, error, data }] = useLazyQuery(GLOBAL_SEARCH_QUERY);
|
||||||
const [callSearch, { loading, error, data }] =
|
|
||||||
useLazyQuery(GLOBAL_SEARCH_QUERY);
|
|
||||||
|
|
||||||
const executeSearch = (v) => {
|
const executeSearch = (v) => {
|
||||||
if (
|
if (v && v.variables.search && v.variables.search !== "" && v.variables.search.length >= 3) callSearch(v);
|
||||||
v &&
|
|
||||||
v.variables.search &&
|
|
||||||
v.variables.search !== "" &&
|
|
||||||
v.variables.search.length >= 3
|
|
||||||
)
|
|
||||||
callSearch(v);
|
|
||||||
};
|
};
|
||||||
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
const debouncedExecuteSearch = _.debounce(executeSearch, 750);
|
||||||
|
|
||||||
@@ -53,15 +44,13 @@ export default function GlobalSearch() {
|
|||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={job} />
|
<OwnerNameDisplay ownerObject={job} />
|
||||||
</span>
|
</span>
|
||||||
<span>{`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${
|
<span>{`${job.v_model_yr || ""} ${job.v_make_desc || ""} ${job.v_model_desc || ""}`}</span>
|
||||||
job.v_model_desc || ""
|
|
||||||
}`}</span>
|
|
||||||
<span>{`${job.clm_no || ""}`}</span>
|
<span>{`${job.clm_no || ""}`}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.owners")),
|
label: renderTitle(t("menus.header.search.owners")),
|
||||||
@@ -75,45 +64,35 @@ export default function GlobalSearch() {
|
|||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={owner} />
|
<OwnerNameDisplay ownerObject={owner} />
|
||||||
</span>
|
</span>
|
||||||
<PhoneNumberFormatter>
|
<PhoneNumberFormatter>{owner.ownr_ph1}</PhoneNumberFormatter>
|
||||||
{owner.ownr_ph1}
|
<PhoneNumberFormatter>{owner.ownr_ph2}</PhoneNumberFormatter>
|
||||||
</PhoneNumberFormatter>
|
|
||||||
<PhoneNumberFormatter>
|
|
||||||
{owner.ownr_ph2}
|
|
||||||
</PhoneNumberFormatter>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.vehicles")),
|
label: renderTitle(t("menus.header.search.vehicles")),
|
||||||
options: data.search_vehicles.map((vehicle) => {
|
options: data.search_vehicles.map((vehicle) => {
|
||||||
return {
|
return {
|
||||||
key: vehicle.id,
|
key: vehicle.id,
|
||||||
value: `${vehicle.v_model_yr || ""} ${
|
value: `${vehicle.v_model_yr || ""} ${vehicle.v_make_desc || ""} ${vehicle.v_model_desc || ""}`,
|
||||||
vehicle.v_make_desc || ""
|
|
||||||
} ${vehicle.v_model_desc || ""}`,
|
|
||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/vehicles/${vehicle.id}`}>
|
<Link to={`/manage/vehicles/${vehicle.id}`}>
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
<Space size="small" split={<Divider type="vertical" />}>
|
||||||
<span>
|
<span>
|
||||||
{`${vehicle.v_model_yr || ""} ${
|
{`${vehicle.v_model_yr || ""} ${vehicle.v_make_desc || ""} ${vehicle.v_model_desc || ""}`}
|
||||||
vehicle.v_make_desc || ""
|
|
||||||
} ${vehicle.v_model_desc || ""}`}
|
|
||||||
</span>
|
</span>
|
||||||
<span>{vehicle.plate_no || ""}</span>
|
<span>{vehicle.plate_no || ""}</span>
|
||||||
<span>
|
<span>
|
||||||
<VehicleVinDisplay>
|
<VehicleVinDisplay>{vehicle.v_vin || ""}</VehicleVinDisplay>
|
||||||
{vehicle.v_vin || ""}
|
|
||||||
</VehicleVinDisplay>
|
|
||||||
</span>
|
</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.payments")),
|
label: renderTitle(t("menus.header.search.payments")),
|
||||||
@@ -131,9 +110,9 @@ export default function GlobalSearch() {
|
|||||||
<span>{payment.transactionid || ""}</span>
|
<span>{payment.transactionid || ""}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.bills")),
|
label: renderTitle(t("menus.header.search.bills")),
|
||||||
@@ -149,46 +128,35 @@ export default function GlobalSearch() {
|
|||||||
<span>{bill.date}</span>
|
<span>{bill.date}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: renderTitle(t("menus.header.search.phonebook")),
|
label: renderTitle(t("menus.header.search.phonebook")),
|
||||||
options: data.search_phonebook.map((pb) => {
|
options: data.search_phonebook.map((pb) => {
|
||||||
return {
|
return {
|
||||||
key: pb.id,
|
key: pb.id,
|
||||||
value: `${pb.firstname || ""} ${pb.lastname || ""} ${
|
value: `${pb.firstname || ""} ${pb.lastname || ""} ${pb.company || ""}`,
|
||||||
pb.company || ""
|
|
||||||
}`,
|
|
||||||
label: (
|
label: (
|
||||||
<Link to={`/manage/phonebook?phonebookentry=${pb.id}`}>
|
<Link to={`/manage/phonebook?phonebookentry=${pb.id}`}>
|
||||||
<Space size="small" split={<Divider type="vertical" />}>
|
<Space size="small" split={<Divider type="vertical" />}>
|
||||||
<span>{`${pb.firstname || ""} ${pb.lastname || ""} ${
|
<span>{`${pb.firstname || ""} ${pb.lastname || ""} ${pb.company || ""}`}</span>
|
||||||
pb.company || ""
|
|
||||||
}`}</span>
|
|
||||||
<PhoneNumberFormatter>{pb.phone1}</PhoneNumberFormatter>
|
<PhoneNumberFormatter>{pb.phone1}</PhoneNumberFormatter>
|
||||||
<span>{pb.email}</span>
|
<span>{pb.email}</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
}),
|
})
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AutoComplete
|
<AutoComplete options={options} onSearch={handleSearch} defaultActiveFirstOption>
|
||||||
options={options}
|
|
||||||
onSearch={handleSearch}
|
|
||||||
defaultActiveFirstOption
|
|
||||||
onSelect={(val, opt) => {
|
|
||||||
history.push(opt.label.props.to);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Input.Search
|
<Input.Search
|
||||||
size="large"
|
size="large"
|
||||||
placeholder={t("general.labels.globalsearch")}
|
placeholder={t("general.labels.globalsearch")}
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ import Icon, {
|
|||||||
FileAddFilled,
|
FileAddFilled,
|
||||||
FileAddOutlined,
|
FileAddOutlined,
|
||||||
FileFilled,
|
FileFilled,
|
||||||
//GlobalOutlined,
|
|
||||||
HomeFilled,
|
HomeFilled,
|
||||||
ImportOutlined, InfoCircleOutlined,
|
ImportOutlined,
|
||||||
LineChartOutlined,
|
LineChartOutlined,
|
||||||
PaperClipOutlined,
|
PaperClipOutlined,
|
||||||
PhoneOutlined,
|
PhoneOutlined,
|
||||||
@@ -23,56 +22,39 @@ import Icon, {
|
|||||||
TeamOutlined,
|
TeamOutlined,
|
||||||
ToolFilled,
|
ToolFilled,
|
||||||
UnorderedListOutlined,
|
UnorderedListOutlined,
|
||||||
UserOutlined,
|
UserOutlined
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import {Layout, Menu, Switch, Tooltip} from "antd";
|
import { Layout, Menu } from "antd";
|
||||||
import React, {useEffect, useState} from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { BsKanban } from "react-icons/bs";
|
import { BsKanban } from "react-icons/bs";
|
||||||
import {
|
import { FaCalendarAlt, FaCarCrash, FaCreditCard, FaFileInvoiceDollar } from "react-icons/fa";
|
||||||
FaCalendarAlt,
|
|
||||||
FaCarCrash,
|
|
||||||
FaCreditCard,
|
|
||||||
FaFileInvoiceDollar,
|
|
||||||
} from "react-icons/fa";
|
|
||||||
import { GiPayMoney, GiPlayerTime, GiSettingsKnobs } from "react-icons/gi";
|
import { GiPayMoney, GiPlayerTime, GiSettingsKnobs } from "react-icons/gi";
|
||||||
import { IoBusinessOutline } from "react-icons/io5";
|
import { IoBusinessOutline } from "react-icons/io5";
|
||||||
import { RiSurveyLine } from "react-icons/ri";
|
import { RiSurveyLine } from "react-icons/ri";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import {
|
import { selectRecentItems, selectSelectedHeader } from "../../redux/application/application.selectors";
|
||||||
selectRecentItems,
|
|
||||||
selectSelectedHeader,
|
|
||||||
} from "../../redux/application/application.selectors";
|
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import { signOutStart } from "../../redux/user/user.actions";
|
import { signOutStart } from "../../redux/user/user.actions";
|
||||||
import {
|
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
selectBodyshop,
|
|
||||||
selectCurrentUser,
|
|
||||||
} from "../../redux/user/user.selectors";
|
|
||||||
import {handleBeta, setBeta, checkBeta} from "../../utils/handleBeta";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
recentItems: selectRecentItems,
|
recentItems: selectRecentItems,
|
||||||
selectedHeader: selectSelectedHeader,
|
selectedHeader: selectSelectedHeader,
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setBillEnterContext: (context) =>
|
setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||||
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
setTimeTicketContext: (context) => dispatch(setModalContext({ context: context, modal: "timeTicket" })),
|
||||||
setTimeTicketContext: (context) =>
|
setPaymentContext: (context) => dispatch(setModalContext({ context: context, modal: "payment" })),
|
||||||
dispatch(setModalContext({ context: context, modal: "timeTicket" })),
|
setReportCenterContext: (context) => dispatch(setModalContext({ context: context, modal: "reportCenter" })),
|
||||||
setPaymentContext: (context) =>
|
|
||||||
dispatch(setModalContext({ context: context, modal: "payment" })),
|
|
||||||
setReportCenterContext: (context) =>
|
|
||||||
dispatch(setModalContext({ context: context, modal: "reportCenter" })),
|
|
||||||
signOutStart: () => dispatch(signOutStart()),
|
signOutStart: () => dispatch(signOutStart()),
|
||||||
setCardPaymentContext: (context) =>
|
setCardPaymentContext: (context) => dispatch(setModalContext({ context: context, modal: "cardPayment" }))
|
||||||
dispatch(setModalContext({ context: context, modal: "cardPayment" })),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function Header({
|
function Header({
|
||||||
@@ -86,37 +68,26 @@ function Header({
|
|||||||
setPaymentContext,
|
setPaymentContext,
|
||||||
setReportCenterContext,
|
setReportCenterContext,
|
||||||
recentItems,
|
recentItems,
|
||||||
setCardPaymentContext,
|
setCardPaymentContext
|
||||||
}) {
|
}) {
|
||||||
const { Simple_Inventory } = useTreatments(
|
const { Simple_Inventory } = useTreatments(["Simple_Inventory"], {}, bodyshop && bodyshop.imexshopid);
|
||||||
["Simple_Inventory"],
|
const { DmsAp } = useTreatments(["DmsAp"], {}, bodyshop && bodyshop.imexshopid);
|
||||||
{},
|
const { ImEXPay } = useTreatments(["ImEXPay"], {}, bodyshop && bodyshop.imexshopid);
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
const { DmsAp } = useTreatments(
|
|
||||||
["DmsAp"],
|
|
||||||
{},
|
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
const { ImEXPay } = useTreatments(
|
|
||||||
["ImEXPay"],
|
|
||||||
{},
|
|
||||||
bodyshop && bodyshop.imexshopid
|
|
||||||
);
|
|
||||||
const [betaSwitch, setBetaSwitch] = useState(false);
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
const deleteBetaCookie = () => {
|
||||||
const isBeta = checkBeta();
|
const cookieExists = document.cookie.split("; ").some((row) => row.startsWith(`betaSwitchImex=`));
|
||||||
setBetaSwitch(isBeta);
|
if (cookieExists) {
|
||||||
}, []);
|
const domain = window.location.hostname.split(".").slice(-2).join(".");
|
||||||
|
document.cookie = `betaSwitchImex=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=.${domain}`;
|
||||||
|
console.log(`betaSwitchImex cookie deleted`);
|
||||||
|
} else {
|
||||||
|
console.log(`betaSwitchImex cookie does not exist`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const betaSwitchChange = (checked) => {
|
deleteBetaCookie();
|
||||||
setBeta(checked);
|
|
||||||
setBetaSwitch(checked);
|
|
||||||
handleBeta();
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout.Header>
|
<Layout.Header>
|
||||||
@@ -134,11 +105,7 @@ function Header({
|
|||||||
<Menu.Item key="schedule" icon={<Icon component={FaCalendarAlt} />}>
|
<Menu.Item key="schedule" icon={<Icon component={FaCalendarAlt} />}>
|
||||||
<Link to="/manage/schedule">{t("menus.header.schedule")}</Link>
|
<Link to="/manage/schedule">{t("menus.header.schedule")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="jobssubmenu" icon={<Icon component={FaCarCrash} />} title={t("menus.header.jobs")}>
|
||||||
key="jobssubmenu"
|
|
||||||
icon={<Icon component={FaCarCrash} />}
|
|
||||||
title={t("menus.header.jobs")}
|
|
||||||
>
|
|
||||||
<Menu.Item key="activejobs" icon={<FileFilled />}>
|
<Menu.Item key="activejobs" icon={<FileFilled />}>
|
||||||
<Link to="/manage/jobs">{t("menus.header.activejobs")}</Link>
|
<Link to="/manage/jobs">{t("menus.header.activejobs")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
@@ -149,9 +116,7 @@ function Header({
|
|||||||
<Link to="/manage/partsqueue">{t("menus.header.parts-queue")}</Link>
|
<Link to="/manage/partsqueue">{t("menus.header.parts-queue")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="availablejobs" icon={<ImportOutlined />}>
|
<Menu.Item key="availablejobs" icon={<ImportOutlined />}>
|
||||||
<Link to="/manage/available">
|
<Link to="/manage/available">{t("menus.header.availablejobs")}</Link>
|
||||||
{t("menus.header.availablejobs")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="newjob" icon={<FileAddOutlined />}>
|
<Menu.Item key="newjob" icon={<FileAddOutlined />}>
|
||||||
<Link to="/manage/jobs/new">{t("menus.header.newjob")}</Link>
|
<Link to="/manage/jobs/new">{t("menus.header.newjob")}</Link>
|
||||||
@@ -162,25 +127,17 @@ function Header({
|
|||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Divider key="div2" />
|
<Menu.Divider key="div2" />
|
||||||
<Menu.Item key="productionlist" icon={<ScheduleOutlined />}>
|
<Menu.Item key="productionlist" icon={<ScheduleOutlined />}>
|
||||||
<Link to="/manage/production/list">
|
<Link to="/manage/production/list">{t("menus.header.productionlist")}</Link>
|
||||||
{t("menus.header.productionlist")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="productionboard" icon={<Icon component={BsKanban} />}>
|
<Menu.Item key="productionboard" icon={<Icon component={BsKanban} />}>
|
||||||
<Link to="/manage/production/board">
|
<Link to="/manage/production/board">{t("menus.header.productionboard")}</Link>
|
||||||
{t("menus.header.productionboard")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Divider key="div3" />
|
<Menu.Divider key="div3" />
|
||||||
<Menu.Item key="scoreboard" icon={<LineChartOutlined />}>
|
<Menu.Item key="scoreboard" icon={<LineChartOutlined />}>
|
||||||
<Link to="/manage/scoreboard">{t("menus.header.scoreboard")}</Link>
|
<Link to="/manage/scoreboard">{t("menus.header.scoreboard")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="customers" icon={<UserOutlined />} title={t("menus.header.customers")}>
|
||||||
key="customers"
|
|
||||||
icon={<UserOutlined />}
|
|
||||||
title={t("menus.header.customers")}
|
|
||||||
>
|
|
||||||
<Menu.Item key="owners" icon={<TeamOutlined />}>
|
<Menu.Item key="owners" icon={<TeamOutlined />}>
|
||||||
<Link to="/manage/owners">{t("menus.header.owners")}</Link>
|
<Link to="/manage/owners">{t("menus.header.owners")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
@@ -188,36 +145,19 @@ function Header({
|
|||||||
<Link to="/manage/vehicles">{t("menus.header.vehicles")}</Link>
|
<Link to="/manage/vehicles">{t("menus.header.vehicles")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="ccs" icon={<CarFilled />} title={t("menus.header.courtesycars")}>
|
||||||
key="ccs"
|
|
||||||
icon={<CarFilled />}
|
|
||||||
title={t("menus.header.courtesycars")}
|
|
||||||
>
|
|
||||||
<Menu.Item key="courtesycarsall" icon={<CarFilled />}>
|
<Menu.Item key="courtesycarsall" icon={<CarFilled />}>
|
||||||
<Link to="/manage/courtesycars">
|
<Link to="/manage/courtesycars">{t("menus.header.courtesycars-all")}</Link>
|
||||||
{t("menus.header.courtesycars-all")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="contracts" icon={<FileFilled />}>
|
<Menu.Item key="contracts" icon={<FileFilled />}>
|
||||||
<Link to="/manage/courtesycars/contracts">
|
<Link to="/manage/courtesycars/contracts">{t("menus.header.courtesycars-contracts")}</Link>
|
||||||
{t("menus.header.courtesycars-contracts")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="newcontract" icon={<FileAddFilled />}>
|
<Menu.Item key="newcontract" icon={<FileAddFilled />}>
|
||||||
<Link to="/manage/courtesycars/contracts/new">
|
<Link to="/manage/courtesycars/contracts/new">{t("menus.header.courtesycars-newcontract")}</Link>
|
||||||
{t("menus.header.courtesycars-newcontract")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="accounting" icon={<DollarCircleFilled />} title={t("menus.header.accounting")}>
|
||||||
key="accounting"
|
<Menu.Item key="bills" icon={<Icon component={FaFileInvoiceDollar} />}>
|
||||||
icon={<DollarCircleFilled />}
|
|
||||||
title={t("menus.header.accounting")}
|
|
||||||
>
|
|
||||||
<Menu.Item
|
|
||||||
key="bills"
|
|
||||||
icon={<Icon component={FaFileInvoiceDollar} />}
|
|
||||||
>
|
|
||||||
<Link to="/manage/bills">{t("menus.header.bills")}</Link>
|
<Link to="/manage/bills">{t("menus.header.bills")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
@@ -226,7 +166,7 @@ function Header({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setBillEnterContext({
|
setBillEnterContext({
|
||||||
actions: {},
|
actions: {},
|
||||||
context: {},
|
context: {}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -235,13 +175,8 @@ function Header({
|
|||||||
{Simple_Inventory.treatment === "on" && (
|
{Simple_Inventory.treatment === "on" && (
|
||||||
<>
|
<>
|
||||||
<Menu.Divider key="div4" />
|
<Menu.Divider key="div4" />
|
||||||
<Menu.Item
|
<Menu.Item key="inventory" icon={<Icon component={FaFileInvoiceDollar} />}>
|
||||||
key="inventory"
|
<Link to="/manage/inventory">{t("menus.header.inventory")}</Link>
|
||||||
icon={<Icon component={FaFileInvoiceDollar} />}
|
|
||||||
>
|
|
||||||
<Link to="/manage/inventory">
|
|
||||||
{t("menus.header.inventory")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -254,7 +189,7 @@ function Header({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPaymentContext({
|
setPaymentContext({
|
||||||
actions: {},
|
actions: {},
|
||||||
context: null,
|
context: null
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
icon={<Icon component={FaCreditCard} />}
|
icon={<Icon component={FaCreditCard} />}
|
||||||
@@ -267,7 +202,7 @@ function Header({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCardPaymentContext({
|
setCardPaymentContext({
|
||||||
actions: {},
|
actions: {},
|
||||||
context: {},
|
context: {}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
icon={<Icon component={FaCreditCard} />}
|
icon={<Icon component={FaCreditCard} />}
|
||||||
@@ -277,9 +212,7 @@ function Header({
|
|||||||
)}
|
)}
|
||||||
<Menu.Divider key="div5" />
|
<Menu.Divider key="div5" />
|
||||||
<Menu.Item key="timetickets" icon={<FieldTimeOutlined />}>
|
<Menu.Item key="timetickets" icon={<FieldTimeOutlined />}>
|
||||||
<Link to="/manage/timetickets">
|
<Link to="/manage/timetickets">{t("menus.header.timetickets")}</Link>
|
||||||
{t("menus.header.timetickets")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
key="entertimetickets"
|
key="entertimetickets"
|
||||||
@@ -290,49 +223,31 @@ function Header({
|
|||||||
context: {
|
context: {
|
||||||
created_by: currentUser.displayName
|
created_by: currentUser.displayName
|
||||||
? currentUser.email.concat(" | ", currentUser.displayName)
|
? currentUser.email.concat(" | ", currentUser.displayName)
|
||||||
: currentUser.email,
|
: currentUser.email
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("menus.header.entertimeticket")}
|
{t("menus.header.entertimeticket")}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Divider key="div6" />
|
<Menu.Divider key="div6" />
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="accountingexport" title={t("menus.header.export")} icon={<ExportOutlined />}>
|
||||||
key="accountingexport"
|
|
||||||
title={t("menus.header.export")}
|
|
||||||
icon={<ExportOutlined />}
|
|
||||||
>
|
|
||||||
<Menu.Item key="receivables">
|
<Menu.Item key="receivables">
|
||||||
<Link to="/manage/accounting/receivables">
|
<Link to="/manage/accounting/receivables">{t("menus.header.accounting-receivables")}</Link>
|
||||||
{t("menus.header.accounting-receivables")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
{(!(
|
{(!((bodyshop && bodyshop.cdk_dealerid) || (bodyshop && bodyshop.pbs_serialnumber)) ||
|
||||||
(bodyshop && bodyshop.cdk_dealerid) ||
|
|
||||||
(bodyshop && bodyshop.pbs_serialnumber)
|
|
||||||
) ||
|
|
||||||
DmsAp.treatment === "on") && (
|
DmsAp.treatment === "on") && (
|
||||||
<Menu.Item key="payables">
|
<Menu.Item key="payables">
|
||||||
<Link to="/manage/accounting/payables">
|
<Link to="/manage/accounting/payables">{t("menus.header.accounting-payables")}</Link>
|
||||||
{t("menus.header.accounting-payables")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
{!(
|
{!((bodyshop && bodyshop.cdk_dealerid) || (bodyshop && bodyshop.pbs_serialnumber)) && (
|
||||||
(bodyshop && bodyshop.cdk_dealerid) ||
|
|
||||||
(bodyshop && bodyshop.pbs_serialnumber)
|
|
||||||
) && (
|
|
||||||
<Menu.Item key="payments">
|
<Menu.Item key="payments">
|
||||||
<Link to="/manage/accounting/payments">
|
<Link to="/manage/accounting/payments">{t("menus.header.accounting-payments")}</Link>
|
||||||
{t("menus.header.accounting-payments")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
<Menu.Item key="export-logs">
|
<Menu.Item key="export-logs">
|
||||||
<Link to="/manage/accounting/exportlogs">
|
<Link to="/manage/accounting/exportlogs">{t("menus.header.export-logs")}</Link>
|
||||||
{t("menus.header.export-logs")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
@@ -340,19 +255,11 @@ function Header({
|
|||||||
<Link to="/manage/phonebook">{t("menus.header.phonebook")}</Link>
|
<Link to="/manage/phonebook">{t("menus.header.phonebook")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="temporarydocs" icon={<PaperClipOutlined />}>
|
<Menu.Item key="temporarydocs" icon={<PaperClipOutlined />}>
|
||||||
<Link to="/manage/temporarydocs">
|
<Link to="/manage/temporarydocs">{t("menus.header.temporarydocs")}</Link>
|
||||||
{t("menus.header.temporarydocs")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="shopsubmenu" title={t("menus.header.shop")} icon={<SettingOutlined />}>
|
||||||
key="shopsubmenu"
|
|
||||||
title={t("menus.header.shop")}
|
|
||||||
icon={<SettingOutlined />}
|
|
||||||
>
|
|
||||||
<Menu.Item key="shop" icon={<Icon component={GiSettingsKnobs} />}>
|
<Menu.Item key="shop" icon={<Icon component={GiSettingsKnobs} />}>
|
||||||
<Link to="/manage/shop?tab=info">
|
<Link to="/manage/shop?tab=info">{t("menus.header.shop_config")}</Link>
|
||||||
{t("menus.header.shop_config")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="dashboard" icon={<DashboardFilled />}>
|
<Menu.Item key="dashboard" icon={<DashboardFilled />}>
|
||||||
<Link to="/manage/dashboard">{t("menus.header.dashboard")}</Link>
|
<Link to="/manage/dashboard">{t("menus.header.dashboard")}</Link>
|
||||||
@@ -363,32 +270,20 @@ function Header({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setReportCenterContext({
|
setReportCenterContext({
|
||||||
actions: {},
|
actions: {},
|
||||||
context: {},
|
context: {}
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("menus.header.reportcenter")}
|
{t("menus.header.reportcenter")}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item key="shop-vendors" icon={<Icon component={IoBusinessOutline} />}>
|
||||||
key="shop-vendors"
|
<Link to="/manage/shop/vendors">{t("menus.header.shop_vendors")}</Link>
|
||||||
icon={<Icon component={IoBusinessOutline} />}
|
|
||||||
>
|
|
||||||
<Link to="/manage/shop/vendors">
|
|
||||||
{t("menus.header.shop_vendors")}
|
|
||||||
</Link>
|
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item key="shop-csi" icon={<Icon component={RiSurveyLine} />}>
|
<Menu.Item key="shop-csi" icon={<Icon component={RiSurveyLine} />}>
|
||||||
<Link to="/manage/shop/csi">{t("menus.header.shop_csi")}</Link>
|
<Link to="/manage/shop/csi">{t("menus.header.shop_csi")}</Link>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.SubMenu
|
<Menu.SubMenu key="user" title={currentUser.displayName || currentUser.email || t("general.labels.unknown")}>
|
||||||
key="user"
|
|
||||||
title={
|
|
||||||
currentUser.displayName ||
|
|
||||||
currentUser.email ||
|
|
||||||
t("general.labels.unknown")
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Menu.Item key="signout" danger onClick={() => signOutStart()}>
|
<Menu.Item key="signout" danger onClick={() => signOutStart()}>
|
||||||
{t("user.actions.signout")}
|
{t("user.actions.signout")}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
@@ -444,17 +339,6 @@ function Header({
|
|||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
))}
|
))}
|
||||||
</Menu.SubMenu>
|
</Menu.SubMenu>
|
||||||
<Menu.Item style={{marginLeft: 'auto'}} key="profile">
|
|
||||||
<Tooltip title="A more modern ImEX Online is ready for you to try! You can switch back at any time.">
|
|
||||||
<InfoCircleOutlined/>
|
|
||||||
<span style={{marginRight: 8}}>Try the new ImEX Online</span>
|
|
||||||
<Switch
|
|
||||||
checked={betaSwitch}
|
|
||||||
onChange={betaSwitchChange}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
</Menu.Item>
|
|
||||||
|
|
||||||
</Menu>
|
</Menu>
|
||||||
</Layout.Header>
|
</Layout.Header>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export default function ScheduleEventContainer({ bodyshop, event, refetch }) {
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: event.job.id,
|
jobid: event.job.id,
|
||||||
operation: AuditTrailMapping.appointmentcancel(lost_sale_reason),
|
operation: AuditTrailMapping.appointmentcancel(lost_sale_reason),
|
||||||
|
type: "appointmentcancel",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobChecklistForm({
|
export function JobChecklistForm({
|
||||||
@@ -183,6 +183,7 @@ export function JobChecklistForm({
|
|||||||
(type === "intake" && bodyshop.md_ro_statuses.default_arrived) ||
|
(type === "intake" && bodyshop.md_ro_statuses.default_arrived) ||
|
||||||
(type === "deliver" && bodyshop.md_ro_statuses.default_delivered)
|
(type === "deliver" && bodyshop.md_ro_statuses.default_delivered)
|
||||||
),
|
),
|
||||||
|
type: "jobchecklist",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
|
|||||||
@@ -18,10 +18,8 @@ export default function JobDetailCardsTotalsComponent({ loading, data }) {
|
|||||||
/>
|
/>
|
||||||
<Statistic
|
<Statistic
|
||||||
className="imex-flex-row__margin-large"
|
className="imex-flex-row__margin-large"
|
||||||
title={t("jobs.fields.ded_amt")}
|
title={t("jobs.fields.customerowing")}
|
||||||
value={Dinero({
|
value={Dinero(data.job_totals.totals.custPayable.total).toFormat()}
|
||||||
amount: Math.round((data.ded_amt || 0) * 100),
|
|
||||||
}).toFormat()}
|
|
||||||
/>
|
/>
|
||||||
<Statistic
|
<Statistic
|
||||||
className="imex-flex-row__margin-large"
|
className="imex-flex-row__margin-large"
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
import { useQuery } from "@apollo/client";
|
||||||
import { Col, Divider, Row, Skeleton, Space, Timeline, Typography } from "antd";
|
import { Col, Row, Skeleton, Timeline, Typography } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
import { GET_JOB_LINE_ORDERS } from "../../graphql/jobs.queries";
|
import { GET_JOB_LINE_ORDERS } from "../../graphql/jobs.queries";
|
||||||
|
import { selectTechnician } from "../../redux/tech/tech.selectors.js";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
import BillDetailEditcontainer from "../bill-detail-edit/bill-detail-edit.container.jsx";
|
||||||
|
|
||||||
export default function JobLinesExpander({ jobline, jobid }) {
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
technician: selectTechnician,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({});
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(JobLinesExpander);
|
||||||
|
|
||||||
|
export function JobLinesExpander({ jobline, jobid, technician }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { loading, error, data } = useQuery(GET_JOB_LINE_ORDERS, {
|
const { loading, error, data } = useQuery(GET_JOB_LINE_ORDERS, {
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
@@ -31,15 +43,31 @@ export default function JobLinesExpander({ jobline, jobid }) {
|
|||||||
{data.parts_order_lines.length > 0 ? (
|
{data.parts_order_lines.length > 0 ? (
|
||||||
data.parts_order_lines.map((line) => (
|
data.parts_order_lines.map((line) => (
|
||||||
<Timeline.Item key={line.id}>
|
<Timeline.Item key={line.id}>
|
||||||
<Space split={<Divider type="vertical" />} wrap>
|
<Row wrap>
|
||||||
<Link
|
<Col span={4}>
|
||||||
to={`/manage/jobs/${jobid}?partsorderid=${line.parts_order.id}`}
|
{!technician ? (
|
||||||
>
|
<Link
|
||||||
{line.parts_order.order_number}
|
to={`/manage/jobs/${jobid}?partsorderid=${line.parts_order.id}`}
|
||||||
</Link>
|
>
|
||||||
<DateFormatter>{line.parts_order.order_date}</DateFormatter>
|
{line.parts_order.order_number}
|
||||||
{line.parts_order.vendor.name}
|
</Link>
|
||||||
</Space>
|
) : (
|
||||||
|
`${line.parts_order.order_number}`
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
<Col span={4}>
|
||||||
|
<DateFormatter>{line.parts_order.order_date}</DateFormatter>
|
||||||
|
</Col>
|
||||||
|
<Col span={4}>{line.parts_order.vendor.name}</Col>
|
||||||
|
{line.backordered_eta ? (
|
||||||
|
<Col span={4}>
|
||||||
|
<span>
|
||||||
|
{`${t("parts_orders.fields.backordered_eta")}: `}
|
||||||
|
<DateFormatter>{line.backordered_eta}</DateFormatter>
|
||||||
|
</span>
|
||||||
|
</Col>
|
||||||
|
) : null}
|
||||||
|
</Row>
|
||||||
</Timeline.Item>
|
</Timeline.Item>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
@@ -51,17 +79,22 @@ export default function JobLinesExpander({ jobline, jobid }) {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col md={24} lg={12}>
|
<Col md={24} lg={12}>
|
||||||
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
|
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
|
||||||
|
<BillDetailEditcontainer />
|
||||||
<Timeline>
|
<Timeline>
|
||||||
{data.billlines.length > 0 ? (
|
{data.billlines.length > 0 ? (
|
||||||
data.billlines.map((line) => (
|
data.billlines.map((line) => (
|
||||||
<Timeline.Item key={line.id}>
|
<Timeline.Item key={line.id}>
|
||||||
<Row wrap>
|
<Row wrap>
|
||||||
<Col span={4}>
|
<Col span={4}>
|
||||||
<Link
|
{!technician ? (
|
||||||
to={`/manage/jobs/${jobid}?tab=partssublet&billid=${line.bill.id}`}
|
<Link
|
||||||
>
|
to={`/manage/jobs/${jobid}?tab=partssublet&billid=${line.bill.id}`}
|
||||||
{line.bill.invoice_number}
|
>
|
||||||
</Link>
|
{line.bill.invoice_number}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
`${line.bill.invoice_number}`
|
||||||
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={4}>
|
<Col span={4}>
|
||||||
<span>
|
<span>
|
||||||
@@ -71,7 +104,7 @@ export default function JobLinesExpander({ jobline, jobid }) {
|
|||||||
</Col>
|
</Col>
|
||||||
<Col span={4}>
|
<Col span={4}>
|
||||||
<span>
|
<span>
|
||||||
{`${t("billlines.fields.actual_cost")}: `}
|
{`${t("billlines.fields.actual_cost")}: `}
|
||||||
<CurrencyFormatter>{line.actual_cost}</CurrencyFormatter>
|
<CurrencyFormatter>{line.actual_cost}</CurrencyFormatter>
|
||||||
</span>
|
</span>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -83,9 +116,7 @@ export default function JobLinesExpander({ jobline, jobid }) {
|
|||||||
</Timeline.Item>
|
</Timeline.Item>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<Timeline.Item>
|
<Timeline.Item>{t("bills.labels.nobilllines")}</Timeline.Item>
|
||||||
{t("parts_orders.labels.notyetordered")}
|
|
||||||
</Timeline.Item>
|
|
||||||
)}
|
)}
|
||||||
</Timeline>
|
</Timeline>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
DeleteFilled,
|
DeleteFilled,
|
||||||
|
EditFilled,
|
||||||
FilterFilled,
|
FilterFilled,
|
||||||
|
HomeOutlined,
|
||||||
|
MinusCircleTwoTone,
|
||||||
|
PlusCircleTwoTone,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
WarningFilled,
|
WarningFilled,
|
||||||
EditFilled,
|
|
||||||
PlusCircleTwoTone,
|
|
||||||
MinusCircleTwoTone,
|
|
||||||
HomeOutlined,
|
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import {
|
import {
|
||||||
@@ -20,6 +20,8 @@ import {
|
|||||||
Tag,
|
Tag,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import _ from "lodash";
|
||||||
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -28,23 +30,19 @@ import { DELETE_JOB_LINE_BY_PK } from "../../graphql/jobs-lines.queries";
|
|||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
import { onlyUnique } from "../../utils/arrayHelper";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
||||||
|
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
|
||||||
import JobLineLocationPopup from "../job-line-location-popup/job-line-location-popup.component";
|
import JobLineLocationPopup from "../job-line-location-popup/job-line-location-popup.component";
|
||||||
import JobLineNotePopup from "../job-line-note-popup/job-line-note-popup.component";
|
import JobLineNotePopup from "../job-line-note-popup/job-line-note-popup.component";
|
||||||
import JobLineStatusPopup from "../job-line-status-popup/job-line-status-popup.component";
|
import JobLineStatusPopup from "../job-line-status-popup/job-line-status-popup.component";
|
||||||
import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-reference.component";
|
import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-reference.component";
|
||||||
// import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
|
import PartsOrderDrawer from "../parts-order-list-table/parts-order-list-table-drawer.component";
|
||||||
// import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
|
|
||||||
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
|
|
||||||
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
||||||
import _ from "lodash";
|
|
||||||
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
|
||||||
import JobLinesExpander from "./job-lines-expander.component";
|
import JobLinesExpander from "./job-lines-expander.component";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import moment from "moment";
|
|
||||||
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -57,6 +55,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
dispatch(setModalContext({ context: context, modal: "jobLineEdit" })),
|
dispatch(setModalContext({ context: context, modal: "jobLineEdit" })),
|
||||||
setPartsOrderContext: (context) =>
|
setPartsOrderContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||||
|
setPartsReceiveContext: (context) =>
|
||||||
|
dispatch(setModalContext({ context: context, modal: "partsReceive" })),
|
||||||
setBillEnterContext: (context) =>
|
setBillEnterContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||||
});
|
});
|
||||||
@@ -66,6 +66,7 @@ export function JobLinesComponent({
|
|||||||
jobRO,
|
jobRO,
|
||||||
technician,
|
technician,
|
||||||
setPartsOrderContext,
|
setPartsOrderContext,
|
||||||
|
setPartsReceiveContext,
|
||||||
loading,
|
loading,
|
||||||
refetch,
|
refetch,
|
||||||
jobLines,
|
jobLines,
|
||||||
@@ -74,6 +75,8 @@ export function JobLinesComponent({
|
|||||||
setJobLineEditContext,
|
setJobLineEditContext,
|
||||||
form,
|
form,
|
||||||
setBillEnterContext,
|
setBillEnterContext,
|
||||||
|
billsQuery,
|
||||||
|
handlePartsOrderOnRowClick,
|
||||||
}) {
|
}) {
|
||||||
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
|
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
|
||||||
|
|
||||||
@@ -341,7 +344,7 @@ export function JobLinesComponent({
|
|||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space>
|
<Space>
|
||||||
{(record.manual_line || jobIsPrivate) && (
|
{(record.manual_line || jobIsPrivate) && !technician && (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
disabled={jobRO}
|
disabled={jobRO}
|
||||||
@@ -424,6 +427,14 @@ export function JobLinesComponent({
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PartsOrderModalContainer />
|
<PartsOrderModalContainer />
|
||||||
|
{!technician && (
|
||||||
|
<PartsOrderDrawer
|
||||||
|
job={job}
|
||||||
|
billsQuery={billsQuery}
|
||||||
|
handleOnRowClick={handlePartsOrderOnRowClick}
|
||||||
|
setPartsReceiveContext={setPartsReceiveContext}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<PageHeader
|
<PageHeader
|
||||||
title={t("jobs.labels.estimatelines")}
|
title={t("jobs.labels.estimatelines")}
|
||||||
extra={
|
extra={
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
import React, { useMemo, useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import JobLinesComponent from "./job-lines.component";
|
import JobLinesComponent from "./job-lines.component";
|
||||||
function JobLinesContainer({ job, joblines, refetch, form, ...rest }) {
|
function JobLinesContainer({
|
||||||
|
job,
|
||||||
|
joblines,
|
||||||
|
billsQuery,
|
||||||
|
handleBillOnRowClick,
|
||||||
|
handlePartsOrderOnRowClick,
|
||||||
|
refetch,
|
||||||
|
form,
|
||||||
|
...rest
|
||||||
|
}) {
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
|
|
||||||
const jobLines = useMemo(() => {
|
const jobLines = useMemo(() => {
|
||||||
@@ -37,6 +46,9 @@ function JobLinesContainer({ job, joblines, refetch, form, ...rest }) {
|
|||||||
<JobLinesComponent
|
<JobLinesComponent
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
jobLines={jobLines}
|
jobLines={jobLines}
|
||||||
|
billsQuery={billsQuery}
|
||||||
|
handleBillOnRowClick={handleBillOnRowClick}
|
||||||
|
handlePartsOrderOnRowClick={handlePartsOrderOnRowClick}
|
||||||
setSearchText={setSearchText}
|
setSearchText={setSearchText}
|
||||||
job={job}
|
job={job}
|
||||||
form={form}
|
form={form}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export function JobEmployeeAssignments({
|
|||||||
jobRO,
|
jobRO,
|
||||||
body,
|
body,
|
||||||
refinish,
|
refinish,
|
||||||
|
|
||||||
prep,
|
prep,
|
||||||
csr,
|
csr,
|
||||||
handleAdd,
|
handleAdd,
|
||||||
@@ -78,7 +77,7 @@ export function JobEmployeeAssignments({
|
|||||||
setVisibility(false);
|
setVisibility(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Assign
|
{t("allocations.actions.assign")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => setVisibility(false)}>Close</Button>
|
<Button onClick={() => setVisibility(false)}>Close</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
@@ -43,12 +43,13 @@ export function JobEmployeeAssignmentsContainer({
|
|||||||
});
|
});
|
||||||
if (refetch) refetch();
|
if (refetch) refetch();
|
||||||
|
|
||||||
insertAuditTrail({
|
if (!!!result.errors) {
|
||||||
jobid: job.id,
|
insertAuditTrail({
|
||||||
operation: AuditTrailMapping.jobassignmentchange(operation, name),
|
jobid: job.id,
|
||||||
});
|
operation: AuditTrailMapping.jobassignmentchange(operation, name),
|
||||||
|
type: "jobassignmentchange",
|
||||||
if (!!result.errors) {
|
});
|
||||||
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.assigning", {
|
message: t("jobs.errors.assigning", {
|
||||||
message: JSON.stringify(result.errors),
|
message: JSON.stringify(result.errors),
|
||||||
@@ -66,17 +67,19 @@ export function JobEmployeeAssignmentsContainer({
|
|||||||
variables: { jobId: job.id, job: { [empAssignment]: null } },
|
variables: { jobId: job.id, job: { [empAssignment]: null } },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!!result.errors) {
|
if (!!!result.errors) {
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobassignmentremoved(operation),
|
||||||
|
type: "jobassignmentremoved",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.assigning", {
|
message: t("jobs.errors.assigning", {
|
||||||
message: JSON.stringify(result.errors),
|
message: JSON.stringify(result.errors),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
insertAuditTrail({
|
|
||||||
jobid: job.id,
|
|
||||||
operation: AuditTrailMapping.jobassignmentremoved(operation),
|
|
||||||
});
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,14 +23,18 @@ import { connect } from "react-redux";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
|
import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries";
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
technician: selectTechnician,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
@@ -41,6 +45,7 @@ export function JobLineConvertToLabor({
|
|||||||
jobline,
|
jobline,
|
||||||
job,
|
job,
|
||||||
insertAuditTrail,
|
insertAuditTrail,
|
||||||
|
technician,
|
||||||
...otherBtnProps
|
...otherBtnProps
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -113,6 +118,7 @@ export function JobLineConvertToLabor({
|
|||||||
hours: calculateAdjustment({ mod_lbr_ty, job, jobline }).toFixed(1),
|
hours: calculateAdjustment({ mod_lbr_ty, job, jobline }).toFixed(1),
|
||||||
mod_lbr_ty,
|
mod_lbr_ty,
|
||||||
}),
|
}),
|
||||||
|
type: "jobmodifylbradj",
|
||||||
});
|
});
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setVisibility(false);
|
setVisibility(false);
|
||||||
@@ -221,7 +227,7 @@ export function JobLineConvertToLabor({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{children}
|
{children}
|
||||||
{jobline.act_price !== 0 && (
|
{jobline.act_price !== 0 && !technician && (
|
||||||
<Popover
|
<Popover
|
||||||
disabled={jobline.convertedtolbr}
|
disabled={jobline.convertedtolbr}
|
||||||
content={overlay}
|
content={overlay}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export default function JobReconciliationBillsTable({
|
|||||||
state.sortedInfo.order,
|
state.sortedInfo.order,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Checkbox disabled checked={record.bill.is_credit_memo} />
|
<Checkbox checked={record.bill.is_credit_memo} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { useMutation, useLazyQuery } from "@apollo/client";
|
|
||||||
import { CheckCircleOutlined } from "@ant-design/icons";
|
import { CheckCircleOutlined } from "@ant-design/icons";
|
||||||
|
import { useLazyQuery, useMutation } from "@apollo/client";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
Form,
|
Form,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
notification,
|
|
||||||
Popover,
|
Popover,
|
||||||
Space,
|
Space,
|
||||||
|
notification,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import {
|
import {
|
||||||
@@ -50,6 +50,7 @@ export default function ScoreboardAddButton({
|
|||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
logImEXEvent("job_close_add_to_scoreboard");
|
logImEXEvent("job_close_add_to_scoreboard");
|
||||||
|
values.date = moment(values.date).format("YYYY-MM-DD");
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
let result;
|
let result;
|
||||||
@@ -177,7 +178,7 @@ export default function ScoreboardAddButton({
|
|||||||
return acc + job.lbr_adjustments[val];
|
return acc + job.lbr_adjustments[val];
|
||||||
}, 0);
|
}, 0);
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
date: new moment(),
|
date: moment(),
|
||||||
bodyhrs: Math.round(v.bodyhrs * 10) / 10,
|
bodyhrs: Math.round(v.bodyhrs * 10) / 10,
|
||||||
painthrs: Math.round(v.painthrs * 10) / 10,
|
painthrs: Math.round(v.painthrs * 10) / 10,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminStatus);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminStatus);
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@ export function JobsAdminStatus({ insertAuditTrail, bodyshop, job }) {
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.admin_jobstatuschange(status),
|
operation: AuditTrailMapping.admin_jobstatuschange(status),
|
||||||
|
type: "admin_jobstatuschange",
|
||||||
});
|
});
|
||||||
// refetch();
|
// refetch();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
@@ -57,6 +57,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
|
|||||||
? DateTimeFormat(changedAuditFields[key])
|
? DateTimeFormat(changedAuditFields[key])
|
||||||
: changedAuditFields[key]
|
: changedAuditFields[key]
|
||||||
),
|
),
|
||||||
|
type: "admin_jobfieldchange",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
@@ -59,6 +59,7 @@ export function JobAdminMarkReexport({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.admin_jobmarkforreexport(),
|
operation: AuditTrailMapping.admin_jobmarkforreexport(),
|
||||||
|
type: "admin_jobmarkforreexport",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
@@ -99,6 +100,7 @@ export function JobAdminMarkReexport({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.admin_jobmarkexported(),
|
operation: AuditTrailMapping.admin_jobmarkexported(),
|
||||||
|
type: "admin_jobmarkexported",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
@@ -124,6 +126,7 @@ export function JobAdminMarkReexport({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.admin_jobuninvoice(),
|
operation: AuditTrailMapping.admin_jobuninvoice(),
|
||||||
|
type: "admin_jobuninvoice",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({});
|
const mapStateToProps = createStructuredSelector({});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminRemoveAR);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminRemoveAR);
|
||||||
@@ -34,6 +34,7 @@ export function JobsAdminRemoveAR({ insertAuditTrail, job }) {
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.admin_job_remove_from_ar(value),
|
operation: AuditTrailMapping.admin_job_remove_from_ar(value),
|
||||||
|
type: "admin_job_remove_from_ar",
|
||||||
});
|
});
|
||||||
setSwitchValue(value);
|
setSwitchValue(value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminUnvoid);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminUnvoid);
|
||||||
|
|
||||||
@@ -49,6 +49,7 @@ export function JobsAdminUnvoid({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.admin_jobunvoid(),
|
operation: AuditTrailMapping.admin_jobunvoid(),
|
||||||
|
type: "admin_jobunvoid",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import {
|
|||||||
useQuery,
|
useQuery,
|
||||||
} from "@apollo/client";
|
} from "@apollo/client";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import { Col, notification, Row } from "antd";
|
import { Col, Row, notification } from "antd";
|
||||||
import Axios from "axios";
|
import Axios from "axios";
|
||||||
import Dinero from "dinero.js";
|
import Dinero from "dinero.js";
|
||||||
import moment from "moment";
|
import moment from "moment-business-days";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -30,8 +30,8 @@ import {
|
|||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
import confirmDialog from "../../utils/asyncConfirm";
|
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
import confirmDialog from "../../utils/asyncConfirm";
|
||||||
import CriticalPartsScan from "../../utils/criticalPartsScan";
|
import CriticalPartsScan from "../../utils/criticalPartsScan";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component";
|
import JobsAvailableScan from "../jobs-available-scan/jobs-available-scan.component";
|
||||||
@@ -47,8 +47,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export function JobsAvailableContainer({
|
export function JobsAvailableContainer({
|
||||||
bodyshop,
|
bodyshop,
|
||||||
@@ -73,7 +73,15 @@ export function JobsAvailableContainer({
|
|||||||
|
|
||||||
const [selectedJob, setSelectedJob] = useState(null);
|
const [selectedJob, setSelectedJob] = useState(null);
|
||||||
const [selectedOwner, setSelectedOwner] = useState(null);
|
const [selectedOwner, setSelectedOwner] = useState(null);
|
||||||
const [partsQueueToggle, setPartsQueueToggle] = useState(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
const [partsQueueToggle, setPartsQueueToggle] = useState(
|
||||||
|
bodyshop.md_functionality_toggles.parts_queue_toggle
|
||||||
|
);
|
||||||
|
const [updateSchComp, setSchComp] = useState({
|
||||||
|
actual_in: moment(),
|
||||||
|
checked: false,
|
||||||
|
scheduled_completion: moment(),
|
||||||
|
automatic: false,
|
||||||
|
});
|
||||||
|
|
||||||
const [insertLoading, setInsertLoading] = useState(false);
|
const [insertLoading, setInsertLoading] = useState(false);
|
||||||
|
|
||||||
@@ -182,6 +190,7 @@ export function JobsAvailableContainer({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: r.data.insert_jobs.returning[0].id,
|
jobid: r.data.insert_jobs.returning[0].id,
|
||||||
operation: AuditTrailMapping.jobimported(),
|
operation: AuditTrailMapping.jobimported(),
|
||||||
|
type: "jobimported",
|
||||||
});
|
});
|
||||||
|
|
||||||
deleteJob({
|
deleteJob({
|
||||||
@@ -197,11 +206,16 @@ export function JobsAvailableContainer({
|
|||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("jobs.errors.creating", { error: err.message }),
|
message: t("jobs.errors.creating", { error: err.message }),
|
||||||
});
|
});
|
||||||
refetch().catch(e => {console.error(`Something went wrong in jobs available table container - ${err.message || ''}`)});
|
refetch().catch((e) => {
|
||||||
|
console.error(
|
||||||
|
`Something went wrong in jobs available table container - ${
|
||||||
|
err.message || ""
|
||||||
|
}`
|
||||||
|
);
|
||||||
|
});
|
||||||
setInsertLoading(false);
|
setInsertLoading(false);
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Supplement scenario
|
//Supplement scenario
|
||||||
@@ -225,6 +239,22 @@ export function JobsAvailableContainer({
|
|||||||
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
//IO-539 Check for Parts Rate on PAL for SGI use case.
|
||||||
await CheckTaxRates(supp, bodyshop);
|
await CheckTaxRates(supp, bodyshop);
|
||||||
|
|
||||||
|
if (updateSchComp.checked === true) {
|
||||||
|
if (updateSchComp.automatic === true) {
|
||||||
|
const job_hrs = supp.joblines.data.reduce(
|
||||||
|
(acc, val) => acc + val.mod_lb_hrs,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
const num_days = job_hrs / bodyshop.target_touchtime;
|
||||||
|
supp.actual_in = updateSchComp.actual_in;
|
||||||
|
supp.scheduled_completion = moment(
|
||||||
|
updateSchComp.actual_in
|
||||||
|
).businessAdd(num_days, "days");
|
||||||
|
} else {
|
||||||
|
supp.scheduled_completion = updateSchComp.scheduled_completion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete supp.owner;
|
delete supp.owner;
|
||||||
delete supp.vehicle;
|
delete supp.vehicle;
|
||||||
delete supp.ins_co_nm;
|
delete supp.ins_co_nm;
|
||||||
@@ -261,9 +291,9 @@ export function JobsAvailableContainer({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
setPartsQueueToggle(bodyshop.md_functionality_toggles.parts_queue_toggle);
|
||||||
|
|
||||||
if (CriticalPartsScanning.treatment === "on") {
|
if (CriticalPartsScanning.treatment === "on") {
|
||||||
CriticalPartsScan(updateResult.data.update_jobs.returning[0].id);
|
CriticalPartsScan(updateResult.data.update_jobs.returning[0].id);
|
||||||
}
|
}
|
||||||
if (updateResult.errors) {
|
if (updateResult.errors) {
|
||||||
@@ -321,6 +351,7 @@ export function JobsAvailableContainer({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: selectedJob,
|
jobid: selectedJob,
|
||||||
operation: AuditTrailMapping.jobsupplement(),
|
operation: AuditTrailMapping.jobsupplement(),
|
||||||
|
type: "jobsupplement",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -367,7 +398,6 @@ export function JobsAvailableContainer({
|
|||||||
|
|
||||||
if (error) return <AlertComponent type="error" message={error.message} />;
|
if (error) return <AlertComponent type="error" message={error.message} />;
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoadingSpinner
|
<LoadingSpinner
|
||||||
loading={insertLoading}
|
loading={insertLoading}
|
||||||
@@ -384,7 +414,6 @@ export function JobsAvailableContainer({
|
|||||||
visible={ownerModalVisible}
|
visible={ownerModalVisible}
|
||||||
onOk={onOwnerFindModalOk}
|
onOk={onOwnerFindModalOk}
|
||||||
onCancel={onOwnerModalCancel}
|
onCancel={onOwnerModalCancel}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<JobsFindModalContainer
|
<JobsFindModalContainer
|
||||||
loading={estDataRaw.loading}
|
loading={estDataRaw.loading}
|
||||||
@@ -398,6 +427,8 @@ export function JobsAvailableContainer({
|
|||||||
modalSearchState={modalSearchState}
|
modalSearchState={modalSearchState}
|
||||||
partsQueueToggle={partsQueueToggle}
|
partsQueueToggle={partsQueueToggle}
|
||||||
setPartsQueueToggle={setPartsQueueToggle}
|
setPartsQueueToggle={setPartsQueueToggle}
|
||||||
|
updateSchComp={updateSchComp}
|
||||||
|
setSchComp={setSchComp}
|
||||||
/>
|
/>
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
||||||
@@ -35,6 +35,7 @@ export function JobsChangeStatus({ job, bodyshop, jobRO, insertAuditTrail }) {
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation: AuditTrailMapping.jobstatuschange(status),
|
operation: AuditTrailMapping.jobstatuschange(status),
|
||||||
|
type: "jobstatuschange",
|
||||||
});
|
});
|
||||||
// refetch();
|
// refetch();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import client from "../../utils/GraphQLClient";
|
import client from "../../utils/GraphQLClient";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -20,6 +22,11 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
|
});
|
||||||
|
|
||||||
function updateJobCache(items) {
|
function updateJobCache(items) {
|
||||||
client.cache.modify({
|
client.cache.modify({
|
||||||
id: "ROOT_QUERY",
|
id: "ROOT_QUERY",
|
||||||
@@ -40,6 +47,7 @@ export function JobsCloseExportButton({
|
|||||||
disabled,
|
disabled,
|
||||||
setSelectedJobs,
|
setSelectedJobs,
|
||||||
refetch,
|
refetch,
|
||||||
|
insertAuditTrail,
|
||||||
}) {
|
}) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -181,6 +189,11 @@ export function JobsCloseExportButton({
|
|||||||
key: "jobsuccessexport",
|
key: "jobsuccessexport",
|
||||||
message: t("jobs.successes.exported"),
|
message: t("jobs.successes.exported"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobId,
|
||||||
|
operation: AuditTrailMapping.jobexported(),
|
||||||
|
type: "jobexported",
|
||||||
|
});
|
||||||
updateJobCache(
|
updateJobCache(
|
||||||
jobUpdateResponse.data.update_jobs.returning.map((job) => job.id)
|
jobUpdateResponse.data.update_jobs.returning.map((job) => job.id)
|
||||||
);
|
);
|
||||||
@@ -192,12 +205,21 @@ export function JobsCloseExportButton({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && successfulTransactions.length > 0) {
|
if (
|
||||||
|
bodyshop.accountingconfig &&
|
||||||
|
bodyshop.accountingconfig.qbo &&
|
||||||
|
successfulTransactions.length > 0
|
||||||
|
) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "success",
|
type: "success",
|
||||||
key: "jobsuccessexport",
|
key: "jobsuccessexport",
|
||||||
message: t("jobs.successes.exported"),
|
message: t("jobs.successes.exported"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: jobId,
|
||||||
|
operation: AuditTrailMapping.jobexported(),
|
||||||
|
type: "jobexported",
|
||||||
|
});
|
||||||
updateJobCache([
|
updateJobCache([
|
||||||
...new Set(
|
...new Set(
|
||||||
successfulTransactions.map(
|
successfulTransactions.map(
|
||||||
@@ -227,4 +249,7 @@ export function JobsCloseExportButton({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(JobsCloseExportButton);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(JobsCloseExportButton);
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsConvertButton({
|
export function JobsConvertButton({
|
||||||
@@ -78,6 +78,7 @@ export function JobsConvertButton({
|
|||||||
operation: AuditTrailMapping.jobconverted(
|
operation: AuditTrailMapping.jobconverted(
|
||||||
res.data.update_jobs.returning[0].ro_number
|
res.data.update_jobs.returning[0].ro_number
|
||||||
),
|
),
|
||||||
|
type: "jobconverted",
|
||||||
});
|
});
|
||||||
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
import { Collapse, Form, Input, InputNumber, Select, Switch } from "antd";
|
import {
|
||||||
|
Collapse,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Select,
|
||||||
|
Space,
|
||||||
|
Switch,
|
||||||
|
} from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -10,6 +18,8 @@ import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
|||||||
import FormItemPhone, {
|
import FormItemPhone, {
|
||||||
PhoneItemFormatterValidation,
|
PhoneItemFormatterValidation,
|
||||||
} from "../form-items-formatted/phone-form-item.component";
|
} from "../form-items-formatted/phone-form-item.component";
|
||||||
|
import JobsDetailChangeEstimator from "../jobs-detail-change-estimator/jobs-detail-change-estimator.component";
|
||||||
|
import JobsDetailChangeFilehandler from "../jobs-detail-change-filehandler/jobs-detail-change-filehandler.component";
|
||||||
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
import JobsDetailRatesChangeButton from "../jobs-detail-rates-change-button/jobs-detail-rates-change-button.component";
|
||||||
import JobsDetailRatesParts from "../jobs-detail-rates/jobs-detail-rates.parts.component";
|
import JobsDetailRatesParts from "../jobs-detail-rates/jobs-detail-rates.parts.component";
|
||||||
import JobsMarkPstExempt from "../jobs-mark-pst-exempt/jobs-mark-pst-exempt.component";
|
import JobsMarkPstExempt from "../jobs-mark-pst-exempt/jobs-mark-pst-exempt.component";
|
||||||
@@ -25,6 +35,15 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { getFieldValue } = form;
|
const { getFieldValue } = form;
|
||||||
|
|
||||||
|
const handleInsCoChange = (value) => {
|
||||||
|
const selectedCompany = bodyshop.md_ins_cos.find((s) => s.name === value);
|
||||||
|
if (selectedCompany) {
|
||||||
|
form.setFieldValue("ins_addr1", selectedCompany.street1);
|
||||||
|
form.setFieldValue("ins_city", selectedCompany.city);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Collapse defaultActiveKey="insurance">
|
<Collapse defaultActiveKey="insurance">
|
||||||
@@ -34,26 +53,20 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
|||||||
forceRender
|
forceRender
|
||||||
>
|
>
|
||||||
<LayoutFormRow>
|
<LayoutFormRow>
|
||||||
<Form.Item label={t("jobs.fields.ins_co_id")} name="ins_co_id">
|
<Form.Item label={t("jobs.fields.clm_no")} name="clm_no">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.policy_no")} name="policy_no">
|
<Form.Item label={t("jobs.fields.policy_no")} name="policy_no">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.clm_no")} name="clm_no">
|
|
||||||
<Input />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("jobs.fields.regie_number")}
|
label={t("jobs.fields.regie_number")}
|
||||||
name="regie_number"
|
name="regie_number"
|
||||||
>
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.loss_date")} name="loss_date">
|
|
||||||
<FormDatePicker />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
||||||
<Select>
|
<Select onChange={handleInsCoChange}>
|
||||||
{bodyshop.md_ins_cos.map((s) => (
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
<Select.Option key={s.name} value={s.name}>
|
<Select.Option key={s.name} value={s.name}>
|
||||||
{s.name}
|
{s.name}
|
||||||
@@ -67,7 +80,15 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
|||||||
<Form.Item label={t("jobs.fields.ins_city")} name="ins_city">
|
<Form.Item label={t("jobs.fields.ins_city")} name="ins_city">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.ins_ct_ln")} name="ins_ct_ln">
|
<Form.Item
|
||||||
|
label={
|
||||||
|
<Space>
|
||||||
|
{t("jobs.fields.ins_ct_ln")}
|
||||||
|
<JobsDetailChangeFilehandler form={form} />
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
name="ins_ct_ln"
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.ins_ct_fn")} name="ins_ct_fn">
|
<Form.Item label={t("jobs.fields.ins_ct_fn")} name="ins_ct_fn">
|
||||||
@@ -95,11 +116,24 @@ export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
|||||||
>
|
>
|
||||||
<FormItemEmail email={getFieldValue("ins_ea")} />
|
<FormItemEmail email={getFieldValue("ins_ea")} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.loss_date")} name="loss_date">
|
||||||
|
<FormDatePicker />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("jobs.fields.kmin")} name="kmin">
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.est_co_nm")} name="est_co_nm">
|
<Form.Item label={t("jobs.fields.est_co_nm")} name="est_co_nm">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.est_ct_fn")} name="est_ct_fn">
|
<Form.Item
|
||||||
|
label={
|
||||||
|
<Space>
|
||||||
|
{t("jobs.fields.est_ct_fn")}
|
||||||
|
<JobsDetailChangeEstimator form={form} />
|
||||||
|
</Space>
|
||||||
|
}
|
||||||
|
name="est_ct_fn"
|
||||||
|
>
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("jobs.fields.est_ct_ln")} name="est_ct_ln">
|
<Form.Item label={t("jobs.fields.est_ct_ln")} name="est_ct_ln">
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ const lossColDamage = { sm: { span: 24 }, md: { span: 6 }, lg: { span: 4 } };
|
|||||||
export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
||||||
const { getFieldValue } = form;
|
const { getFieldValue } = form;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handleInsCoChange = (value) => {
|
||||||
|
const selectedCompany = bodyshop.md_ins_cos.find((s) => s.name === value);
|
||||||
|
if (selectedCompany) {
|
||||||
|
form.setFieldValue("ins_addr1", selectedCompany.street1);
|
||||||
|
form.setFieldValue("ins_city", selectedCompany.city);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<FormRow header={t("jobs.forms.claiminfo")}>
|
<FormRow header={t("jobs.forms.claiminfo")}>
|
||||||
@@ -71,7 +80,7 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
<Form.Item label={t("jobs.fields.ins_co_nm")} name="ins_co_nm">
|
||||||
<Select disabled={jobRO}>
|
<Select disabled={jobRO} onChange={handleInsCoChange}>
|
||||||
{bodyshop.md_ins_cos.map((s) => (
|
{bodyshop.md_ins_cos.map((s) => (
|
||||||
<Select.Option key={s.name} value={s.name}>
|
<Select.Option key={s.name} value={s.name}>
|
||||||
{s.name}
|
{s.name}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export default function AddToProduction(
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: jobId,
|
jobid: jobId,
|
||||||
operation: AuditTrailMapping.jobinproductionchange(!remove),
|
operation: AuditTrailMapping.jobinproductionchange(!remove),
|
||||||
|
type: "jobinproductionchange",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
if (completionCallback) completionCallback();
|
if (completionCallback) completionCallback();
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
dispatch(setModalContext({ context: context, modal: "timeTicket" })),
|
dispatch(setModalContext({ context: context, modal: "timeTicket" })),
|
||||||
setCardPaymentContext: (context) =>
|
setCardPaymentContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "cardPayment" })),
|
dispatch(setModalContext({ context: context, modal: "cardPayment" })),
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsDetailHeaderActions({
|
export function JobsDetailHeaderActions({
|
||||||
@@ -115,6 +115,7 @@ export function JobsDetailHeaderActions({
|
|||||||
? !job.production_vars.alert
|
? !job.production_vars.alert
|
||||||
: true
|
: true
|
||||||
),
|
),
|
||||||
|
type: "alertToggle",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,6 +130,13 @@ export function JobsDetailHeaderActions({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobsuspend(
|
||||||
|
!!job.suspended ? !job.suspended : true
|
||||||
|
),
|
||||||
|
type: "jobsuspend",
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusmenu = (
|
const statusmenu = (
|
||||||
@@ -184,6 +192,7 @@ export function JobsDetailHeaderActions({
|
|||||||
jobid: job.id,
|
jobid: job.id,
|
||||||
operation:
|
operation:
|
||||||
AuditTrailMapping.appointmentcancel(lost_sale_reason),
|
AuditTrailMapping.appointmentcancel(lost_sale_reason),
|
||||||
|
type: "appointmentcancel",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -295,7 +304,7 @@ export function JobsDetailHeaderActions({
|
|||||||
disabled={!job.converted}
|
disabled={!job.converted}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCardPaymentContext({
|
setCardPaymentContext({
|
||||||
actions: {},
|
actions: { refetch },
|
||||||
context: { jobid: job.id },
|
context: { jobid: job.id },
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
@@ -540,6 +549,11 @@ export function JobsDetailHeaderActions({
|
|||||||
notification["success"]({
|
notification["success"]({
|
||||||
message: t("jobs.successes.voided"),
|
message: t("jobs.successes.voided"),
|
||||||
});
|
});
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobvoid(),
|
||||||
|
type: "jobvoid",
|
||||||
|
});
|
||||||
//go back to jobs list.
|
//go back to jobs list.
|
||||||
history.push(`/manage/`);
|
history.push(`/manage/`);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import {
|
|||||||
PauseCircleOutlined,
|
PauseCircleOutlined,
|
||||||
WarningFilled,
|
WarningFilled,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Card, Col, Row, Space, Tag, Tooltip } from "antd";
|
import { Card, Col, Divider, Row, Space, Tag, Tooltip } from "antd";
|
||||||
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -62,6 +63,13 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
${job.v_make_desc || ""}
|
${job.v_make_desc || ""}
|
||||||
${job.v_model_desc || ""}`.trim();
|
${job.v_model_desc || ""}`.trim();
|
||||||
|
|
||||||
|
const bodyHrs = job.joblines
|
||||||
|
.filter((j) => j.mod_lbr_ty !== "LAR")
|
||||||
|
.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
|
||||||
|
const refinishHrs = job.joblines
|
||||||
|
.filter((line) => line.mod_lbr_ty === "LAR")
|
||||||
|
.reduce((acc, val) => acc + val.mod_lb_hrs, 0);
|
||||||
|
|
||||||
const ownerTitle = OwnerNameDisplayFunction(job).trim();
|
const ownerTitle = OwnerNameDisplayFunction(job).trim();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -93,7 +101,13 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
{job.status === bodyshop.md_ro_statuses.default_scheduled &&
|
{job.status === bodyshop.md_ro_statuses.default_scheduled &&
|
||||||
job.scheduled_in ? (
|
job.scheduled_in ? (
|
||||||
<Tag>
|
<Tag>
|
||||||
<DateTimeFormatter>{job.scheduled_in}</DateTimeFormatter>
|
<Link
|
||||||
|
to={`/manage/schedule?date=${moment(
|
||||||
|
job.scheduled_in
|
||||||
|
).format("YYYY-MM-DD")}`}
|
||||||
|
>
|
||||||
|
<DateTimeFormatter>{job.scheduled_in}</DateTimeFormatter>
|
||||||
|
</Link>
|
||||||
</Tag>
|
</Tag>
|
||||||
) : null}
|
) : null}
|
||||||
</Space>
|
</Space>
|
||||||
@@ -123,20 +137,23 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
</DataLabel>
|
</DataLabel>
|
||||||
{job.cccontracts.length > 0 && (
|
{job.cccontracts.length > 0 && (
|
||||||
<DataLabel label={t("jobs.labels.contracts")}>
|
<DataLabel label={t("jobs.labels.contracts")}>
|
||||||
{job.cccontracts.map((c) => (
|
{job.cccontracts.map((c, index) => (
|
||||||
<Link
|
<Space wrap>
|
||||||
key={c.id}
|
<Link
|
||||||
to={`/manage/courtesycars/contracts/${c.id}`}
|
key={c.id}
|
||||||
>{`${c.agreementnumber} - ${c.courtesycar.fleetnumber} ${c.courtesycar.year} ${c.courtesycar.make} ${c.courtesycar.model}`}</Link>
|
to={`/manage/courtesycars/contracts/${c.id}`}
|
||||||
|
>
|
||||||
|
{`${c.agreementnumber} - ${c.courtesycar.fleetnumber} ${c.courtesycar.year} ${c.courtesycar.make} ${c.courtesycar.model}`}
|
||||||
|
{index !== job.cccontracts.length - 1 ? "," : null}
|
||||||
|
</Link>
|
||||||
|
</Space>
|
||||||
))}
|
))}
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<DataLabel label={t("jobs.fields.production_vars.note")}>
|
<DataLabel label={t("jobs.fields.production_vars.note")}>
|
||||||
<ProductionListColumnProductionNote record={job} />
|
<ProductionListColumnProductionNote record={job} />
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
|
<Space wrap>
|
||||||
<Space>
|
|
||||||
{job.special_coverage_policy && (
|
{job.special_coverage_policy && (
|
||||||
<Tag color="tomato">
|
<Tag color="tomato">
|
||||||
<Space>
|
<Space>
|
||||||
@@ -208,6 +225,12 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
{job.owner?.tax_number || ""}
|
{job.owner?.tax_number || ""}
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
)}
|
)}
|
||||||
|
<DataLabel
|
||||||
|
label={t("owners.fields.note")}
|
||||||
|
valueStyle={{ overflow: "hidden", textOverflow: "ellipsis" }}
|
||||||
|
>
|
||||||
|
{job.owner?.note || ""}
|
||||||
|
</DataLabel>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -296,6 +319,11 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<JobEmployeeAssignments job={job} />
|
<JobEmployeeAssignments job={job} />
|
||||||
|
<Divider style={{ margin: ".5rem" }} />
|
||||||
|
<DataLabel label={t("jobs.labels.labor_hrs")}>
|
||||||
|
{bodyHrs.toFixed(1)} / {refinishHrs.toFixed(1)} /{" "}
|
||||||
|
{(bodyHrs + refinishHrs).toFixed(1)}
|
||||||
|
</DataLabel>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -1,44 +1,12 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
|
||||||
import queryString from "query-string";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useHistory, useLocation } from "react-router-dom";
|
|
||||||
import { QUERY_BILLS_BY_JOBID } from "../../graphql/bills.queries";
|
|
||||||
import JobsDetailPliComponent from "./jobs-detail-pli.component";
|
import JobsDetailPliComponent from "./jobs-detail-pli.component";
|
||||||
|
|
||||||
export default function JobsDetailPliContainer({ job }) {
|
export default function JobsDetailPliContainer({
|
||||||
const billsQuery = useQuery(QUERY_BILLS_BY_JOBID, {
|
job,
|
||||||
variables: { jobid: job.id },
|
billsQuery,
|
||||||
fetchPolicy: "network-only",
|
handleBillOnRowClick,
|
||||||
nextFetchPolicy: "network-only",
|
handlePartsOrderOnRowClick,
|
||||||
});
|
}) {
|
||||||
|
|
||||||
const search = queryString.parse(useLocation().search);
|
|
||||||
const history = useHistory();
|
|
||||||
|
|
||||||
const handleBillOnRowClick = (record) => {
|
|
||||||
if (record) {
|
|
||||||
if (record.id) {
|
|
||||||
search.billid = record.id;
|
|
||||||
history.push({ search: queryString.stringify(search) });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete search.billid;
|
|
||||||
history.push({ search: queryString.stringify(search) });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handlePartsOrderOnRowClick = (record) => {
|
|
||||||
if (record) {
|
|
||||||
if (record.id) {
|
|
||||||
search.partsorderid = record.id;
|
|
||||||
history.push({ search: queryString.stringify(search) });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete search.partsorderid;
|
|
||||||
history.push({ search: queryString.stringify(search) });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<JobsDetailPliComponent
|
<JobsDetailPliComponent
|
||||||
job={job}
|
job={job}
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
import { UPDATE_JOBS } from "../../graphql/jobs.queries";
|
import { UPDATE_JOBS } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
import {
|
import {
|
||||||
selectBodyshop,
|
selectBodyshop,
|
||||||
selectCurrentUser,
|
selectCurrentUser,
|
||||||
} from "../../redux/user/user.selectors";
|
} from "../../redux/user/user.selectors";
|
||||||
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
import client from "../../utils/GraphQLClient";
|
import client from "../../utils/GraphQLClient";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -20,6 +22,11 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
|
});
|
||||||
|
|
||||||
function updateJobCache(items) {
|
function updateJobCache(items) {
|
||||||
client.cache.modify({
|
client.cache.modify({
|
||||||
id: "ROOT_QUERY",
|
id: "ROOT_QUERY",
|
||||||
@@ -41,6 +48,7 @@ export function JobsExportAllButton({
|
|||||||
loadingCallback,
|
loadingCallback,
|
||||||
completedCallback,
|
completedCallback,
|
||||||
refetch,
|
refetch,
|
||||||
|
insertAuditTrail,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updateJob] = useMutation(UPDATE_JOBS);
|
const [updateJob] = useMutation(UPDATE_JOBS);
|
||||||
@@ -177,6 +185,13 @@ export function JobsExportAllButton({
|
|||||||
key: "jobsuccessexport",
|
key: "jobsuccessexport",
|
||||||
message: t("jobs.successes.exported"),
|
message: t("jobs.successes.exported"),
|
||||||
});
|
});
|
||||||
|
jobUpdateResponse.data.update_jobs.returning.forEach((job) => {
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: job.id,
|
||||||
|
operation: AuditTrailMapping.jobexported(),
|
||||||
|
type: "jobexported",
|
||||||
|
});
|
||||||
|
});
|
||||||
updateJobCache(
|
updateJobCache(
|
||||||
jobUpdateResponse.data.update_jobs.returning.map(
|
jobUpdateResponse.data.update_jobs.returning.map(
|
||||||
(job) => job.id
|
(job) => job.id
|
||||||
@@ -190,13 +205,17 @@ export function JobsExportAllButton({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && successfulTransactions.length > 0) {
|
if (
|
||||||
|
bodyshop.accountingconfig &&
|
||||||
|
bodyshop.accountingconfig.qbo &&
|
||||||
|
successfulTransactions.length > 0
|
||||||
|
) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "success",
|
type: "success",
|
||||||
key: "jobsuccessexport",
|
key: "jobsuccessexport",
|
||||||
message: t("jobs.successes.exported"),
|
message: t("jobs.successes.exported"),
|
||||||
});
|
});
|
||||||
updateJobCache([
|
const successfulTransactionsSet = [
|
||||||
...new Set(
|
...new Set(
|
||||||
successfulTransactions.map(
|
successfulTransactions.map(
|
||||||
(st) =>
|
(st) =>
|
||||||
@@ -207,7 +226,15 @@ export function JobsExportAllButton({
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
]);
|
];
|
||||||
|
if (successfulTransactionsSet.length > 0) {
|
||||||
|
insertAuditTrail({
|
||||||
|
jobid: successfulTransactionsSet[0],
|
||||||
|
operation: AuditTrailMapping.jobexported(),
|
||||||
|
type: "jobexported",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
updateJobCache(successfulTransactionsSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -225,4 +252,7 @@ export function JobsExportAllButton({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(JobsExportAllButton);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(JobsExportAllButton);
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { SyncOutlined } from "@ant-design/icons";
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
import { Checkbox, Divider, Input, Table, Button } from "antd";
|
import { Button, Checkbox, Divider, Input, Space, Table } from "antd";
|
||||||
import React from "react";
|
import moment from "moment";
|
||||||
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import PhoneFormatter from "../../utils/PhoneFormatter";
|
import PhoneFormatter from "../../utils/PhoneFormatter";
|
||||||
|
import FormDateTimePickerComponent from "../form-date-time-picker/form-date-time-picker.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
|
|
||||||
export default function JobsFindModalComponent({
|
export default function JobsFindModalComponent({
|
||||||
@@ -16,11 +18,13 @@ export default function JobsFindModalComponent({
|
|||||||
jobsListRefetch,
|
jobsListRefetch,
|
||||||
partsQueueToggle,
|
partsQueueToggle,
|
||||||
setPartsQueueToggle,
|
setPartsQueueToggle,
|
||||||
|
updateSchComp,
|
||||||
|
setSchComp,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [modalSearch, setModalSearch] = modalSearchState;
|
const [modalSearch, setModalSearch] = modalSearchState;
|
||||||
const [importOptions, setImportOptions] = importOptionsState;
|
const [importOptions, setImportOptions] = importOptionsState;
|
||||||
|
const [checkUTT, setCheckUTT] = useState(false);
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
@@ -142,6 +146,35 @@ export default function JobsFindModalComponent({
|
|||||||
if (record) {
|
if (record) {
|
||||||
if (record.id) {
|
if (record.id) {
|
||||||
setSelectedJob(record.id);
|
setSelectedJob(record.id);
|
||||||
|
if (record.actual_in && record.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: record.actual_in,
|
||||||
|
scheduled_completion: record.scheduled_completion,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (record.actual_in && !record.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: record.actual_in,
|
||||||
|
scheduled_completion: moment(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!record.actual_in && record.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: moment(),
|
||||||
|
scheduled_completion: moment(record.scheduled_completion),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!record.actual_in && !record.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: moment(),
|
||||||
|
scheduled_completion: moment(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,6 +210,35 @@ export default function JobsFindModalComponent({
|
|||||||
rowSelection={{
|
rowSelection={{
|
||||||
onSelect: (props) => {
|
onSelect: (props) => {
|
||||||
setSelectedJob(props.id);
|
setSelectedJob(props.id);
|
||||||
|
if (props.actual_in && props.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: props.actual_in,
|
||||||
|
scheduled_completion: props.scheduled_completion,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (props.actual_in && !props.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: props.actual_in,
|
||||||
|
scheduled_completion: moment(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!props.actual_in && props.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: moment(),
|
||||||
|
scheduled_completion: moment(props.scheduled_completion),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!props.actual_in && !props.scheduled_completion) {
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
actual_in: moment(),
|
||||||
|
scheduled_completion: moment(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
type: "radio",
|
type: "radio",
|
||||||
selectedRowKeys: [selectedJob],
|
selectedRowKeys: [selectedJob],
|
||||||
@@ -190,23 +252,58 @@ export default function JobsFindModalComponent({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Checkbox
|
<Space>
|
||||||
defaultChecked={importOptions.overrideHeader}
|
<Checkbox
|
||||||
onChange={(e) =>
|
defaultChecked={importOptions.overrideHeader}
|
||||||
setImportOptions({
|
onChange={(e) =>
|
||||||
...importOptions,
|
setImportOptions({
|
||||||
overrideHeaders: e.target.checked,
|
...importOptions,
|
||||||
})
|
overrideHeaders: e.target.checked,
|
||||||
}
|
})
|
||||||
>
|
}
|
||||||
{t("jobs.labels.override_header")}
|
>
|
||||||
</Checkbox>
|
{t("jobs.labels.override_header")}
|
||||||
<Checkbox
|
</Checkbox>
|
||||||
|
<Checkbox
|
||||||
checked={partsQueueToggle}
|
checked={partsQueueToggle}
|
||||||
onChange={(e) => setPartsQueueToggle(e.target.checked)}
|
onChange={(e) => setPartsQueueToggle(e.target.checked)}
|
||||||
>
|
>
|
||||||
{t("bodyshop.fields.md_functionality_toggles.parts_queue_toggle")}
|
{t("bodyshop.fields.md_functionality_toggles.parts_queue_toggle")}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
|
<Checkbox
|
||||||
|
checked={updateSchComp.checked}
|
||||||
|
onChange={(e) =>
|
||||||
|
setSchComp({ ...updateSchComp, checked: e.target.checked })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{t("jobs.labels.update_scheduled_completion")}
|
||||||
|
</Checkbox>
|
||||||
|
{updateSchComp.checked === true ? (
|
||||||
|
<>
|
||||||
|
{checkUTT === false ? (
|
||||||
|
<FormDateTimePickerComponent
|
||||||
|
value={updateSchComp.scheduled_completion}
|
||||||
|
onChange={(e) => {
|
||||||
|
setSchComp({ ...updateSchComp, scheduled_completion: e });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
<Checkbox
|
||||||
|
checked={checkUTT}
|
||||||
|
onChange={(e) => {
|
||||||
|
setCheckUTT(e.target.checked);
|
||||||
|
setSchComp({
|
||||||
|
...updateSchComp,
|
||||||
|
scheduled_completion: null,
|
||||||
|
automatic: true,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("jobs.labels.calc_scheuled_completion")}
|
||||||
|
</Checkbox>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export default connect(
|
|||||||
modalSearchState,
|
modalSearchState,
|
||||||
partsQueueToggle,
|
partsQueueToggle,
|
||||||
setPartsQueueToggle,
|
setPartsQueueToggle,
|
||||||
|
updateSchComp,
|
||||||
|
setSchComp,
|
||||||
...modalProps
|
...modalProps
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -95,6 +97,8 @@ export default connect(
|
|||||||
modalSearchState={modalSearchState}
|
modalSearchState={modalSearchState}
|
||||||
partsQueueToggle={partsQueueToggle}
|
partsQueueToggle={partsQueueToggle}
|
||||||
setPartsQueueToggle={setPartsQueueToggle}
|
setPartsQueueToggle={setPartsQueueToggle}
|
||||||
|
updateSchComp={updateSchComp}
|
||||||
|
setSchComp={setSchComp}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { createStructuredSelector } from "reselect";
|
|||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { pageLimit } from "../../utils/config";
|
import { pageLimit } from "../../utils/config";
|
||||||
|
import { alphaSort, statusSort } from "../../utils/sorters";
|
||||||
import useLocalStorage from "../../utils/useLocalStorage";
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
import StartChatButton from "../chat-open-button/chat-open-button.component";
|
import StartChatButton from "../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
@@ -36,7 +37,10 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
sorter: true, //(a, b) => alphaSort(a.ro_number, b.ro_number),
|
sorter: search?.search
|
||||||
|
? (a, b) =>
|
||||||
|
parseInt((a.ro_number || "0").replace(/\D/g, "")) - parseInt((b.ro_number || "0").replace(/\D/g, ""))
|
||||||
|
: true,
|
||||||
sortOrder: sortcolumn === "ro_number" && sortorder,
|
sortOrder: sortcolumn === "ro_number" && sortorder,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={"/manage/jobs/" + record.id}>
|
<Link to={"/manage/jobs/" + record.id}>
|
||||||
@@ -50,7 +54,6 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
key: "ownr_ln",
|
key: "ownr_ln",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
//sorter: true, // (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
//sorter: true, // (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||||
|
|
||||||
//sortOrder: sortcolumn === "ownr_ln" && sortorder,
|
//sortOrder: sortcolumn === "ownr_ln" && sortorder,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.ownerid ? (
|
return record.ownerid ? (
|
||||||
@@ -68,7 +71,6 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
title: t("jobs.fields.ownr_ph1"),
|
title: t("jobs.fields.ownr_ph1"),
|
||||||
dataIndex: "ownr_ph1",
|
dataIndex: "ownr_ph1",
|
||||||
key: "ownr_ph1",
|
key: "ownr_ph1",
|
||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<StartChatButton phone={record.ownr_ph1} jobid={record.id} />
|
<StartChatButton phone={record.ownr_ph1} jobid={record.id} />
|
||||||
@@ -78,7 +80,6 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
title: t("jobs.fields.ownr_ph2"),
|
title: t("jobs.fields.ownr_ph2"),
|
||||||
dataIndex: "ownr_ph2",
|
dataIndex: "ownr_ph2",
|
||||||
key: "ownr_ph2",
|
key: "ownr_ph2",
|
||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<StartChatButton phone={record.ownr_ph2} jobid={record.id} />
|
<StartChatButton phone={record.ownr_ph2} jobid={record.id} />
|
||||||
@@ -88,9 +89,8 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
title: t("jobs.fields.status"),
|
title: t("jobs.fields.status"),
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: true, // (a, b) => alphaSort(a.status, b.status),
|
sorter: search?.search ? (a, b) => statusSort(a.status, b.status, bodyshop.md_ro_statuses.active_statuses) : true,
|
||||||
sortOrder: sortcolumn === "status" && sortorder,
|
sortOrder: sortcolumn === "status" && sortorder,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.status || t("general.labels.na");
|
return record.status || t("general.labels.na");
|
||||||
@@ -106,7 +106,6 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.vehicle"),
|
||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
key: "vehicle",
|
key: "vehicle",
|
||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.vehicleid ? (
|
return record.vehicleid ? (
|
||||||
@@ -127,7 +126,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
dataIndex: "plate_no",
|
dataIndex: "plate_no",
|
||||||
key: "plate_no",
|
key: "plate_no",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: true, //(a, b) => alphaSort(a.plate_no, b.plate_no),
|
sorter: search?.search ? (a, b) => alphaSort(a.plate_no, b.plate_no) : true,
|
||||||
sortOrder: sortcolumn === "plate_no" && sortorder,
|
sortOrder: sortcolumn === "plate_no" && sortorder,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.plate_no ? record.plate_no : "";
|
return record.plate_no ? record.plate_no : "";
|
||||||
@@ -138,7 +137,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
dataIndex: "clm_no",
|
dataIndex: "clm_no",
|
||||||
key: "clm_no",
|
key: "clm_no",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: true, //(a, b) => alphaSort(a.clm_no, b.clm_no),
|
sorter: search?.search ? (a, b) => alphaSort(a.clm_no, b.clm_no) : true,
|
||||||
sortOrder: sortcolumn === "clm_no" && sortorder,
|
sortOrder: sortcolumn === "clm_no" && sortorder,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
`${record.clm_no || ""}${
|
`${record.clm_no || ""}${
|
||||||
@@ -156,7 +155,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
dataIndex: "clm_total",
|
dataIndex: "clm_total",
|
||||||
key: "clm_total",
|
key: "clm_total",
|
||||||
|
|
||||||
sorter: true, //(a, b) => a.clm_total - b.clm_total,
|
sorter: search?.search ? (a, b) => a.clm_total - b.clm_total : true,
|
||||||
sortOrder: sortcolumn === "clm_total" && sortorder,
|
sortOrder: sortcolumn === "clm_total" && sortorder,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.clm_total ? (
|
return record.clm_total ? (
|
||||||
@@ -170,7 +169,6 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
title: t("jobs.fields.owner_owing"),
|
title: t("jobs.fields.owner_owing"),
|
||||||
dataIndex: "owner_owing",
|
dataIndex: "owner_owing",
|
||||||
key: "owner_owing",
|
key: "owner_owing",
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
|
<CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import useLocalStorage from "../../utils/useLocalStorage";
|
|||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
|
import { OwnerNameDisplayFunction } from "./../owner-name-display/owner-name-display.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -145,7 +146,8 @@ export function JobsList({ bodyshop }) {
|
|||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
@@ -188,7 +190,8 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
sorter: (a, b) =>
|
||||||
|
statusSort(a.status, b.status, bodyshop.md_ro_statuses.active_statuses),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
filteredValue: filter?.status || null,
|
filteredValue: filter?.status || null,
|
||||||
@@ -219,6 +222,15 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
key: "vehicle",
|
key: "vehicle",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.vehicleid ? (
|
return record.vehicleid ? (
|
||||||
<Link
|
<Link
|
||||||
@@ -266,6 +278,9 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "ins_co_nm",
|
dataIndex: "ins_co_nm",
|
||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ins_co_nm" && state.sortedInfo.order,
|
||||||
filteredValue: filter?.ins_co_nm || null,
|
filteredValue: filter?.ins_co_nm || null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
@@ -302,6 +317,13 @@ export function JobsList({ bodyshop }) {
|
|||||||
key: "estimator",
|
key: "estimator",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["xl"],
|
responsive: ["xl"],
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.est_ct_fn || ""} ${a.est_ct_ln || ""}`.trim(),
|
||||||
|
`${b.est_ct_fn || ""} ${b.est_ct_ln || ""}`.trim()
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "estimator" && state.sortedInfo.order,
|
||||||
filterSearch: true,
|
filterSearch: true,
|
||||||
filteredValue: filter?.estimator || null,
|
filteredValue: filter?.estimator || null,
|
||||||
filters:
|
filters:
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobNotesContainer);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobNotesContainer);
|
||||||
|
|
||||||
@@ -49,6 +49,7 @@ export function JobNotesContainer({ jobId, insertAuditTrail }) {
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: jobId,
|
jobid: jobId,
|
||||||
operation: AuditTrailMapping.jobnotedeleted(),
|
operation: AuditTrailMapping.jobnotedeleted(),
|
||||||
|
type: "jobnotedeleted",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setDeleteLoading(false);
|
setDeleteLoading(false);
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
@@ -76,6 +76,7 @@ export function LaborAllocationsAdjustmentEdit({
|
|||||||
values.hours -
|
values.hours -
|
||||||
((adjustments && adjustments[mod_lbr_ty]) || 0).toFixed(1),
|
((adjustments && adjustments[mod_lbr_ty]) || 0).toFixed(1),
|
||||||
}),
|
}),
|
||||||
|
type: "jobmodifylbradj",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("noteUpsert")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("noteUpsert")),
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function NoteUpsertModalContainer({
|
export function NoteUpsertModalContainer({
|
||||||
@@ -70,6 +70,7 @@ export function NoteUpsertModalContainer({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: context.jobId,
|
jobid: context.jobId,
|
||||||
operation: AuditTrailMapping.jobnoteupdated(),
|
operation: AuditTrailMapping.jobnoteupdated(),
|
||||||
|
type: "jobnoteupdated",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (refetch) refetch();
|
if (refetch) refetch();
|
||||||
@@ -102,6 +103,7 @@ export function NoteUpsertModalContainer({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: newJobId,
|
jobid: newJobId,
|
||||||
operation: AuditTrailMapping.jobnoteadded(),
|
operation: AuditTrailMapping.jobnoteadded(),
|
||||||
|
type: "jobnoteadded",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -115,6 +117,7 @@ export function NoteUpsertModalContainer({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: context.jobId,
|
jobid: context.jobId,
|
||||||
operation: AuditTrailMapping.jobnoteadded(),
|
operation: AuditTrailMapping.jobnoteadded(),
|
||||||
|
type: "jobnoteadded",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { Link } from "react-router-dom";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort, statusSort } from "../../utils/sorters";
|
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||||
import OwnerDetailUpdateJobsComponent from "../owner-detail-update-jobs/owner-detail-update-jobs.component";
|
import OwnerDetailUpdateJobsComponent from "../owner-detail-update-jobs/owner-detail-update-jobs.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
@@ -24,7 +25,7 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
|||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
@@ -44,6 +45,15 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
|||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.vehicle"),
|
||||||
dataIndex: "vehicleid",
|
dataIndex: "vehicleid",
|
||||||
key: "vehicleid",
|
key: "vehicleid",
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicleid" && state.sortedInfo.order,
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
record.vehicleid ? (
|
record.vehicleid ? (
|
||||||
<Link to={`/manage/vehicles/${record.vehicleid}`}>
|
<Link to={`/manage/vehicles/${record.vehicleid}`}>
|
||||||
@@ -67,11 +77,28 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
|||||||
title: t("jobs.fields.status"),
|
title: t("jobs.fields.status"),
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
sorter: (a, b) => statusSort(a.status, b.status, bodyshop.md_ro_statuses.statuses),
|
sorter: (a, b) =>
|
||||||
|
statusSort(a.status, b.status, bodyshop.md_ro_statuses.statuses),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
|
filters: bodyshop.md_ro_statuses.statuses.map((status) => ({
|
||||||
|
text: status,
|
||||||
|
value: status,
|
||||||
|
})),
|
||||||
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.actual_completion"),
|
||||||
|
dataIndex: "actual_completion",
|
||||||
|
key: "actual_completion",
|
||||||
|
render: (text, record) => (
|
||||||
|
<DateTimeFormatter>{record.actual_completion}</DateTimeFormatter>
|
||||||
|
),
|
||||||
|
sorter: (a, b) => dateSort(a.actual_completion, b.actual_completion),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "actual_completion" &&
|
||||||
|
state.sortedInfo.order,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.clm_total"),
|
title: t("jobs.fields.clm_total"),
|
||||||
dataIndex: "clm_total",
|
dataIndex: "clm_total",
|
||||||
|
|||||||
@@ -0,0 +1,416 @@
|
|||||||
|
import { DeleteFilled } from "@ant-design/icons";
|
||||||
|
import { useLazyQuery, useMutation } from "@apollo/client";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Drawer,
|
||||||
|
Grid,
|
||||||
|
PageHeader,
|
||||||
|
Popconfirm,
|
||||||
|
Space,
|
||||||
|
Table,
|
||||||
|
} from "antd";
|
||||||
|
import queryString from "query-string";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { QUERY_BILL_BY_PK } from "../../graphql/bills.queries";
|
||||||
|
import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
|
||||||
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
import DataLabel from "../data-label/data-label.component";
|
||||||
|
import FeatureWrapperComponent from "../feature-wrapper/feature-wrapper.component";
|
||||||
|
import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component";
|
||||||
|
import PartsOrderCmReceived from "../parts-order-cm-received/parts-order-cm-received.component";
|
||||||
|
import PartsOrderDeleteLine from "../parts-order-delete-line/parts-order-delete-line.component";
|
||||||
|
import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
|
||||||
|
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
||||||
|
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
jobRO: selectJobReadOnly,
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
setBillEnterContext: (context) =>
|
||||||
|
dispatch(
|
||||||
|
setModalContext({
|
||||||
|
context: context,
|
||||||
|
modal: "billEnter",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
setPartsReceiveContext: (context) =>
|
||||||
|
dispatch(
|
||||||
|
setModalContext({
|
||||||
|
context: context,
|
||||||
|
modal: "partsReceive",
|
||||||
|
})
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
|
export function PartsOrderListTableDrawerComponent({
|
||||||
|
setBillEnterContext,
|
||||||
|
bodyshop,
|
||||||
|
jobRO,
|
||||||
|
job,
|
||||||
|
billsQuery,
|
||||||
|
handleOnRowClick,
|
||||||
|
setPartsReceiveContext,
|
||||||
|
}) {
|
||||||
|
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||||
|
.filter((screen) => !!screen[1])
|
||||||
|
.slice(-1)[0];
|
||||||
|
|
||||||
|
const bpoints = {
|
||||||
|
xs: "100%",
|
||||||
|
sm: "100%",
|
||||||
|
md: "100%",
|
||||||
|
lg: "75%",
|
||||||
|
xl: "75%",
|
||||||
|
xxl: "65%",
|
||||||
|
};
|
||||||
|
const drawerPercentage = selectedBreakpoint
|
||||||
|
? bpoints[selectedBreakpoint[0]]
|
||||||
|
: "100%";
|
||||||
|
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
||||||
|
const Templates = TemplateList("partsorder", { job });
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [state, setState] = useState({
|
||||||
|
sortedInfo: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
const [billData, setBillData] = useState(null);
|
||||||
|
const search = queryString.parse(useLocation().search);
|
||||||
|
const selectedpartsorder = search.partsorderid;
|
||||||
|
|
||||||
|
const [billQuery] = useLazyQuery(QUERY_BILL_BY_PK);
|
||||||
|
const [deletePartsOrder] = useMutation(DELETE_PARTS_ORDER);
|
||||||
|
const parts_orders = billsQuery.data ? billsQuery.data.parts_orders : [];
|
||||||
|
const { refetch } = billsQuery;
|
||||||
|
|
||||||
|
const selectedPartsOrderRecord = parts_orders.find(
|
||||||
|
(r) => r.id === selectedpartsorder
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
if (selectedPartsOrderRecord?.returnfrombill) {
|
||||||
|
try {
|
||||||
|
const { data } = await billQuery({
|
||||||
|
variables: { billid: selectedPartsOrderRecord.returnfrombill },
|
||||||
|
});
|
||||||
|
setBillData(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching bill data:", error);
|
||||||
|
}
|
||||||
|
} else setBillData(null);
|
||||||
|
};
|
||||||
|
fetchData();
|
||||||
|
}, [selectedPartsOrderRecord, billQuery]);
|
||||||
|
|
||||||
|
const recordActions = (record) => (
|
||||||
|
<Space direction="horizontal" wrap>
|
||||||
|
<Button
|
||||||
|
disabled={
|
||||||
|
jobRO ||
|
||||||
|
record.return ||
|
||||||
|
record.vendor.id === bodyshop.inhousevendorid
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
logImEXEvent("parts_order_receive_bill");
|
||||||
|
setPartsReceiveContext({
|
||||||
|
actions: { refetch: refetch },
|
||||||
|
context: {
|
||||||
|
jobId: job.id,
|
||||||
|
job: job,
|
||||||
|
partsorderlines: record.parts_order_lines.map((pol) => ({
|
||||||
|
joblineid: pol.job_line_id,
|
||||||
|
id: pol.id,
|
||||||
|
line_desc: pol.line_desc,
|
||||||
|
quantity: pol.quantity,
|
||||||
|
act_price: pol.act_price,
|
||||||
|
oem_partno: pol.oem_partno,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("parts_orders.actions.receive")}
|
||||||
|
</Button>
|
||||||
|
<Popconfirm
|
||||||
|
title={t("parts_orders.labels.confirmdelete")}
|
||||||
|
disabled={jobRO}
|
||||||
|
onConfirm={async () => {
|
||||||
|
//Delete the parts return.!
|
||||||
|
await deletePartsOrder({
|
||||||
|
variables: { partsOrderId: record.id },
|
||||||
|
update(cache) {
|
||||||
|
cache.modify({
|
||||||
|
fields: {
|
||||||
|
parts_orders(existingPartsOrders, { readField }) {
|
||||||
|
return existingPartsOrders.filter(
|
||||||
|
(billref) => record.id !== readField("id", billref)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button disabled={jobRO}>
|
||||||
|
<DeleteFilled />
|
||||||
|
</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
<FeatureWrapperComponent featureName="bills" noauth={() => null}>
|
||||||
|
<Button
|
||||||
|
disabled={
|
||||||
|
(jobRO ? !record.return : jobRO) ||
|
||||||
|
record.vendor.id === bodyshop.inhousevendorid
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
logImEXEvent("parts_order_receive_bill");
|
||||||
|
setBillEnterContext({
|
||||||
|
actions: { refetch: refetch },
|
||||||
|
context: {
|
||||||
|
job: job,
|
||||||
|
bill: {
|
||||||
|
vendorid: record.vendor.id,
|
||||||
|
is_credit_memo: record.return,
|
||||||
|
billlines: record.parts_order_lines.map((pol) => ({
|
||||||
|
joblineid: pol.job_line_id || "noline",
|
||||||
|
line_desc: pol.line_desc,
|
||||||
|
quantity: pol.quantity,
|
||||||
|
actual_price: pol.act_price,
|
||||||
|
cost_center: pol.jobline?.part_type
|
||||||
|
? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid
|
||||||
|
? pol.jobline.part_type !== "PAE"
|
||||||
|
? pol.jobline.part_type
|
||||||
|
: null
|
||||||
|
: responsibilityCenters.defaults &&
|
||||||
|
(responsibilityCenters.defaults.costs[
|
||||||
|
pol.jobline.part_type
|
||||||
|
] ||
|
||||||
|
null)
|
||||||
|
: null,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("parts_orders.actions.receivebill")}
|
||||||
|
</Button>
|
||||||
|
</FeatureWrapperComponent>
|
||||||
|
<PrintWrapper
|
||||||
|
templateObject={{
|
||||||
|
name: record.return
|
||||||
|
? Templates.parts_return_slip.key
|
||||||
|
: Templates.parts_order.key,
|
||||||
|
variables: { id: record.id },
|
||||||
|
}}
|
||||||
|
messageObject={{
|
||||||
|
subject: record.return
|
||||||
|
? Templates.parts_return_slip.subject
|
||||||
|
: Templates.parts_order.subject,
|
||||||
|
to: record.vendor.email,
|
||||||
|
}}
|
||||||
|
id={job.id}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
|
};
|
||||||
|
|
||||||
|
const rowExpander = (record) => {
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.line_desc"),
|
||||||
|
dataIndex: "line_desc",
|
||||||
|
key: "line_desc",
|
||||||
|
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.quantity"),
|
||||||
|
dataIndex: "quantity",
|
||||||
|
key: "quantity",
|
||||||
|
sorter: (a, b) => a.quantity - b.quantity,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "quantity" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.act_price"),
|
||||||
|
dataIndex: "act_price",
|
||||||
|
key: "act_price",
|
||||||
|
sorter: (a, b) => a.act_price - b.act_price,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<CurrencyFormatter>{record.act_price}</CurrencyFormatter>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
...(selectedPartsOrderRecord && selectedPartsOrderRecord.return
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.cost"),
|
||||||
|
dataIndex: "cost",
|
||||||
|
key: "cost",
|
||||||
|
sorter: (a, b) => a.cost - b.cost,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "cost" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<CurrencyFormatter>{record.cost}</CurrencyFormatter>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.part_type"),
|
||||||
|
dataIndex: "part_type",
|
||||||
|
key: "part_type",
|
||||||
|
render: (text, record) =>
|
||||||
|
record.part_type
|
||||||
|
? t(`joblines.fields.part_types.${record.part_type}`)
|
||||||
|
: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.oem_partno"),
|
||||||
|
dataIndex: "oem_partno",
|
||||||
|
key: "oem_partno",
|
||||||
|
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "oem_partno" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.line_remarks"),
|
||||||
|
dataIndex: "line_remarks",
|
||||||
|
key: "line_remarks",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.status"),
|
||||||
|
dataIndex: "status",
|
||||||
|
key: "status",
|
||||||
|
},
|
||||||
|
|
||||||
|
...(selectedPartsOrderRecord && selectedPartsOrderRecord.return
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.cm_received"),
|
||||||
|
dataIndex: "cm_received",
|
||||||
|
key: "cm_received",
|
||||||
|
render: (text, record) => (
|
||||||
|
<PartsOrderCmReceived
|
||||||
|
orderLineId={record.id}
|
||||||
|
checked={record.cm_received}
|
||||||
|
partsorderid={selectedPartsOrderRecord.id}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.backordered_on"),
|
||||||
|
dataIndex: "backordered_on",
|
||||||
|
key: "backordered_on",
|
||||||
|
render: (text, record) => <DateFormatter>{text}</DateFormatter>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("parts_orders.fields.backordered_eta"),
|
||||||
|
dataIndex: "backordered_eta",
|
||||||
|
key: "backordered_eta",
|
||||||
|
render: (text, record) => (
|
||||||
|
<PartsOrderBackorderEta
|
||||||
|
backordered_eta={record.backordered_eta}
|
||||||
|
disabled={jobRO}
|
||||||
|
partsOrderStatus={record.status}
|
||||||
|
partsLineId={record.id}
|
||||||
|
jobLineId={record.job_line_id}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
title: t("general.labels.actions"),
|
||||||
|
dataIndex: "actions",
|
||||||
|
key: "actions",
|
||||||
|
render: (text, record) => (
|
||||||
|
<Space wrap>
|
||||||
|
<PartsOrderDeleteLine
|
||||||
|
disabled={jobRO}
|
||||||
|
partsOrderStatus={record.status}
|
||||||
|
partsLineId={record.id}
|
||||||
|
partsOrderId={selectedpartsorder}
|
||||||
|
jobLineId={record.job_line_id}
|
||||||
|
/>
|
||||||
|
<PartsOrderLineBackorderButton
|
||||||
|
disabled={jobRO}
|
||||||
|
partsOrderStatus={record.status}
|
||||||
|
partsLineId={record.id}
|
||||||
|
jobLineId={record.job_line_id}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<PageHeader
|
||||||
|
title={
|
||||||
|
billData
|
||||||
|
? `${record.vendor.name} - ${record.order_number} - ${t(
|
||||||
|
"bills.labels.returnfrombill"
|
||||||
|
)}: ${billData.bills_by_pk.invoice_number}`
|
||||||
|
: `${record.vendor.name} - ${record.order_number}`
|
||||||
|
}
|
||||||
|
extra={recordActions(record)}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
scroll={{
|
||||||
|
x: true, //y: "50rem"
|
||||||
|
}}
|
||||||
|
columns={columns}
|
||||||
|
rowKey="id"
|
||||||
|
dataSource={record.parts_order_lines}
|
||||||
|
onChange={handleTableChange}
|
||||||
|
/>
|
||||||
|
<DataLabel label={t("parts_orders.fields.comments")}>
|
||||||
|
<div style={{ whiteSpace: "pre" }}>{record.comments}</div>
|
||||||
|
</DataLabel>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<PartsReceiveModalContainer />
|
||||||
|
<Drawer
|
||||||
|
placement="right"
|
||||||
|
onClose={() => handleOnRowClick(null)}
|
||||||
|
open={selectedpartsorder}
|
||||||
|
closable
|
||||||
|
width={drawerPercentage}
|
||||||
|
>
|
||||||
|
{selectedPartsOrderRecord && rowExpander(selectedPartsOrderRecord)}
|
||||||
|
</Drawer>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(PartsOrderListTableDrawerComponent);
|
||||||
@@ -1,39 +1,21 @@
|
|||||||
import { DeleteFilled, EyeFilled, SyncOutlined } from "@ant-design/icons";
|
import { DeleteFilled, EyeFilled, SyncOutlined } from "@ant-design/icons";
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import {
|
import { Button, Card, Checkbox, Input, Popconfirm, Space, Table } from "antd";
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Checkbox,
|
|
||||||
Drawer,
|
|
||||||
Grid,
|
|
||||||
Input,
|
|
||||||
PageHeader,
|
|
||||||
Popconfirm,
|
|
||||||
Space,
|
|
||||||
Table,
|
|
||||||
} from "antd";
|
|
||||||
import queryString from "query-string";
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { useLocation } from "react-router-dom";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
|
import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
|
||||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import DataLabel from "../data-label/data-label.component";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component";
|
|
||||||
import PartsOrderCmReceived from "../parts-order-cm-received/parts-order-cm-received.component";
|
|
||||||
import PartsOrderDeleteLine from "../parts-order-delete-line/parts-order-delete-line.component";
|
|
||||||
import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component";
|
|
||||||
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container";
|
||||||
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
||||||
|
import PartsOrderDrawer from "./parts-order-list-table-drawer.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
@@ -56,21 +38,6 @@ export function PartsOrderListTableComponent({
|
|||||||
handleOnRowClick,
|
handleOnRowClick,
|
||||||
setPartsReceiveContext,
|
setPartsReceiveContext,
|
||||||
}) {
|
}) {
|
||||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
|
||||||
.filter((screen) => !!screen[1])
|
|
||||||
.slice(-1)[0];
|
|
||||||
|
|
||||||
const bpoints = {
|
|
||||||
xs: "100%",
|
|
||||||
sm: "100%",
|
|
||||||
md: "100%",
|
|
||||||
lg: "75%",
|
|
||||||
xl: "75%",
|
|
||||||
xxl: "65%",
|
|
||||||
};
|
|
||||||
const drawerPercentage = selectedBreakpoint
|
|
||||||
? bpoints[selectedBreakpoint[0]]
|
|
||||||
: "100%";
|
|
||||||
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
||||||
const Templates = TemplateList("partsorder", { job });
|
const Templates = TemplateList("partsorder", { job });
|
||||||
|
|
||||||
@@ -78,10 +45,8 @@ export function PartsOrderListTableComponent({
|
|||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
});
|
});
|
||||||
const search = queryString.parse(useLocation().search);
|
|
||||||
const selectedpartsorder = search.partsorderid;
|
|
||||||
const [searchText, setSearchText] = useState("");
|
|
||||||
|
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
const [deletePartsOrder] = useMutation(DELETE_PARTS_ORDER);
|
const [deletePartsOrder] = useMutation(DELETE_PARTS_ORDER);
|
||||||
|
|
||||||
const parts_orders = billsQuery.data ? billsQuery.data.parts_orders : [];
|
const parts_orders = billsQuery.data ? billsQuery.data.parts_orders : [];
|
||||||
@@ -90,7 +55,11 @@ export function PartsOrderListTableComponent({
|
|||||||
const recordActions = (record, showView = false) => (
|
const recordActions = (record, showView = false) => (
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
{showView && (
|
{showView && (
|
||||||
<Button onClick={() => handleOnRowClick(record)}>
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
handleOnRowClick(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
<EyeFilled />
|
<EyeFilled />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@@ -166,7 +135,7 @@ export function PartsOrderListTableComponent({
|
|||||||
is_credit_memo: record.return,
|
is_credit_memo: record.return,
|
||||||
billlines: record.parts_order_lines.map((pol) => {
|
billlines: record.parts_order_lines.map((pol) => {
|
||||||
return {
|
return {
|
||||||
joblineid: pol.job_line_id,
|
joblineid: pol.job_line_id || "noline",
|
||||||
line_desc: pol.line_desc,
|
line_desc: pol.line_desc,
|
||||||
quantity: pol.quantity,
|
quantity: pol.quantity,
|
||||||
|
|
||||||
@@ -277,164 +246,6 @@ export function PartsOrderListTableComponent({
|
|||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectedPartsOrderRecord = parts_orders.find(
|
|
||||||
(r) => r.id === selectedpartsorder
|
|
||||||
);
|
|
||||||
|
|
||||||
const rowExpander = (record) => {
|
|
||||||
const columns = [
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.line_desc"),
|
|
||||||
dataIndex: "line_desc",
|
|
||||||
key: "line_desc",
|
|
||||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.quantity"),
|
|
||||||
dataIndex: "quantity",
|
|
||||||
key: "quantity",
|
|
||||||
sorter: (a, b) => a.quantity - b.quantity,
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "quantity" && state.sortedInfo.order,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.act_price"),
|
|
||||||
dataIndex: "act_price",
|
|
||||||
key: "act_price",
|
|
||||||
sorter: (a, b) => a.act_price - b.act_price,
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<CurrencyFormatter>{record.act_price}</CurrencyFormatter>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
...(selectedPartsOrderRecord && selectedPartsOrderRecord.return
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.cost"),
|
|
||||||
dataIndex: "cost",
|
|
||||||
key: "cost",
|
|
||||||
sorter: (a, b) => a.cost - b.cost,
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "cost" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<CurrencyFormatter>{record.cost}</CurrencyFormatter>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.part_type"),
|
|
||||||
dataIndex: "part_type",
|
|
||||||
key: "part_type",
|
|
||||||
render: (text, record) =>
|
|
||||||
record.part_type
|
|
||||||
? t(`joblines.fields.part_types.${record.part_type}`)
|
|
||||||
: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.oem_partno"),
|
|
||||||
dataIndex: "oem_partno",
|
|
||||||
key: "oem_partno",
|
|
||||||
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
|
|
||||||
sortOrder:
|
|
||||||
state.sortedInfo.columnKey === "oem_partno" && state.sortedInfo.order,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.line_remarks"),
|
|
||||||
dataIndex: "line_remarks",
|
|
||||||
key: "line_remarks",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.status"),
|
|
||||||
dataIndex: "status",
|
|
||||||
key: "status",
|
|
||||||
},
|
|
||||||
|
|
||||||
...(selectedPartsOrderRecord && selectedPartsOrderRecord.return
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.cm_received"),
|
|
||||||
dataIndex: "cm_received",
|
|
||||||
key: "cm_received",
|
|
||||||
render: (text, record) => (
|
|
||||||
<PartsOrderCmReceived
|
|
||||||
orderLineId={record.id}
|
|
||||||
checked={record.cm_received}
|
|
||||||
partsorderid={selectedPartsOrderRecord.id}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.backordered_on"),
|
|
||||||
dataIndex: "backordered_on",
|
|
||||||
key: "backordered_on",
|
|
||||||
render: (text, record) => <DateFormatter>{text}</DateFormatter>,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: t("parts_orders.fields.backordered_eta"),
|
|
||||||
dataIndex: "backordered_eta",
|
|
||||||
key: "backordered_eta",
|
|
||||||
render: (text, record) => (
|
|
||||||
<PartsOrderBackorderEta
|
|
||||||
backordered_eta={record.backordered_eta}
|
|
||||||
disabled={jobRO}
|
|
||||||
partsOrderStatus={record.status}
|
|
||||||
partsLineId={record.id}
|
|
||||||
jobLineId={record.job_line_id}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
title: t("general.labels.actions"),
|
|
||||||
dataIndex: "actions",
|
|
||||||
key: "actions",
|
|
||||||
render: (text, record) => (
|
|
||||||
<Space wrap>
|
|
||||||
<PartsOrderDeleteLine
|
|
||||||
disabled={jobRO}
|
|
||||||
partsOrderStatus={record.status}
|
|
||||||
partsLineId={record.id}
|
|
||||||
partsOrderId={selectedpartsorder}
|
|
||||||
jobLineId={record.job_line_id}
|
|
||||||
/>
|
|
||||||
<PartsOrderLineBackorderButton
|
|
||||||
disabled={jobRO}
|
|
||||||
partsOrderStatus={record.status}
|
|
||||||
partsLineId={record.id}
|
|
||||||
jobLineId={record.job_line_id}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<PageHeader
|
|
||||||
title={record && `${record.vendor.name} - ${record.order_number}`}
|
|
||||||
extra={recordActions(record)}
|
|
||||||
/>
|
|
||||||
<Table
|
|
||||||
scroll={{
|
|
||||||
x: true, //y: "50rem"
|
|
||||||
}}
|
|
||||||
columns={columns}
|
|
||||||
rowKey="id"
|
|
||||||
dataSource={record.parts_order_lines}
|
|
||||||
/>
|
|
||||||
<DataLabel label={t("parts_orders.fields.comments")}>
|
|
||||||
<div style={{ whiteSpace: "pre" }}>{record.comments}</div>
|
|
||||||
</DataLabel>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const filteredPartsOrders = parts_orders
|
const filteredPartsOrders = parts_orders
|
||||||
? searchText === ""
|
? searchText === ""
|
||||||
? parts_orders
|
? parts_orders
|
||||||
@@ -470,15 +281,12 @@ export function PartsOrderListTableComponent({
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<PartsReceiveModalContainer />
|
<PartsReceiveModalContainer />
|
||||||
<Drawer
|
<PartsOrderDrawer
|
||||||
placement="right"
|
job={job}
|
||||||
onClose={() => handleOnRowClick(null)}
|
billsQuery={billsQuery}
|
||||||
visible={selectedpartsorder}
|
handleOnRowClick={handleOnRowClick}
|
||||||
closable
|
setPartsReceiveContext={setPartsReceiveContext}
|
||||||
width={drawerPercentage}
|
/>
|
||||||
>
|
|
||||||
{selectedPartsOrderRecord && rowExpander(selectedPartsOrderRecord)}
|
|
||||||
</Drawer>
|
|
||||||
<Table
|
<Table
|
||||||
loading={billsQuery.loading}
|
loading={billsQuery.loading}
|
||||||
scroll={{
|
scroll={{
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { DeleteFilled, WarningFilled, DownOutlined } from "@ant-design/icons";
|
import { DeleteFilled, DownOutlined, WarningFilled } from "@ant-design/icons";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import {
|
import {
|
||||||
|
Checkbox,
|
||||||
Divider,
|
Divider,
|
||||||
|
Dropdown,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
|
Menu,
|
||||||
Radio,
|
Radio,
|
||||||
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Tag,
|
Tag,
|
||||||
Select,
|
|
||||||
Menu,
|
|
||||||
Dropdown,
|
|
||||||
Checkbox,
|
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -255,7 +255,7 @@ export function PartsOrderModalComponent({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber min={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("parts_orders.fields.act_price")}
|
label={t("parts_orders.fields.act_price")}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import { useMutation, useQuery, useApolloClient } from "@apollo/client";
|
import { useApolloClient, useMutation, useQuery } from "@apollo/client";
|
||||||
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
import { Form, Modal, notification } from "antd";
|
import { Form, Modal, notification } from "antd";
|
||||||
|
import axios from "axios";
|
||||||
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent, auth } from "../../firebase/firebase.utils";
|
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries";
|
import { UPDATE_JOB_LINE_STATUS } from "../../graphql/jobs-lines.queries";
|
||||||
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import {
|
import {
|
||||||
INSERT_NEW_PARTS_ORDERS,
|
INSERT_NEW_PARTS_ORDERS,
|
||||||
QUERY_PARTS_ORDER_OEC,
|
QUERY_PARTS_ORDER_OEC,
|
||||||
@@ -29,10 +33,6 @@ import { TemplateList } from "../../utils/TemplateConstants";
|
|||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
import PartsOrderModalComponent from "./parts-order-modal.component";
|
import PartsOrderModalComponent from "./parts-order-modal.component";
|
||||||
import axios from "axios";
|
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
|
||||||
import _ from "lodash";
|
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
@@ -45,8 +45,8 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("partsOrder")),
|
||||||
setBillEnterContext: (context) =>
|
setBillEnterContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
dispatch(setModalContext({ context: context, modal: "billEnter" })),
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function PartsOrderModalContainer({
|
export function PartsOrderModalContainer({
|
||||||
@@ -142,6 +142,7 @@ export function PartsOrderModalContainer({
|
|||||||
: AuditTrailMapping.jobspartsorder(
|
: AuditTrailMapping.jobspartsorder(
|
||||||
insertResult.data.insert_parts_orders.returning[0].order_number
|
insertResult.data.insert_parts_orders.returning[0].order_number
|
||||||
),
|
),
|
||||||
|
type: isReturn ? "jobspartsreturn" : "jobspartsorder",
|
||||||
});
|
});
|
||||||
|
|
||||||
const jobLinesResult = await updateJobLines({
|
const jobLinesResult = await updateJobLines({
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import { useQuery } from "@apollo/client";
|
||||||
|
import { Card, Divider, Drawer, Grid } from "antd";
|
||||||
|
import queryString from "query-string";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
|
import { QUERY_PARTS_QUEUE_CARD_DETAILS } from "../../graphql/jobs.queries";
|
||||||
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
import JobsDetailHeader from "../jobs-detail-header/jobs-detail-header.component";
|
||||||
|
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||||
|
import PartsQueueJobLinesComponent from "./parts-queue-job-lines.component";
|
||||||
|
|
||||||
|
export default function PartsQueueDetailCard() {
|
||||||
|
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||||
|
.filter((screen) => !!screen[1])
|
||||||
|
.slice(-1)[0];
|
||||||
|
|
||||||
|
const bpoints = {
|
||||||
|
xs: "100%",
|
||||||
|
sm: "100%",
|
||||||
|
md: "100%",
|
||||||
|
lg: "75%",
|
||||||
|
xl: "75%",
|
||||||
|
xxl: "60%",
|
||||||
|
};
|
||||||
|
const drawerPercentage = selectedBreakpoint
|
||||||
|
? bpoints[selectedBreakpoint[0]]
|
||||||
|
: "100%";
|
||||||
|
|
||||||
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
|
const { selected } = searchParams;
|
||||||
|
const history = useHistory();
|
||||||
|
const { loading, error, data } = useQuery(QUERY_PARTS_QUEUE_CARD_DETAILS, {
|
||||||
|
variables: { id: selected },
|
||||||
|
skip: !selected,
|
||||||
|
fetchPolicy: "network-only",
|
||||||
|
nextFetchPolicy: "network-only",
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const handleDrawerClose = () => {
|
||||||
|
delete searchParams.selected;
|
||||||
|
history.push({
|
||||||
|
search: queryString.stringify({
|
||||||
|
...searchParams,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Drawer
|
||||||
|
visible={!!selected}
|
||||||
|
destroyOnClose
|
||||||
|
width={drawerPercentage}
|
||||||
|
placement="right"
|
||||||
|
onClose={handleDrawerClose}
|
||||||
|
>
|
||||||
|
{loading ? <LoadingSpinner /> : null}
|
||||||
|
{error ? <AlertComponent message={error.message} type="error" /> : null}
|
||||||
|
{data ? (
|
||||||
|
<Card
|
||||||
|
title={
|
||||||
|
<Link to={`/manage/jobs/${data.jobs_by_pk.id}`}>
|
||||||
|
{data.jobs_by_pk.ro_number || t("general.labels.na")}
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<JobsDetailHeader job={data ? data.jobs_by_pk : null} />
|
||||||
|
<Divider type="horizontal" />
|
||||||
|
<PartsQueueJobLinesComponent
|
||||||
|
jobLines={data.jobs_by_pk ? data.jobs_by_pk.joblines : null}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
) : null}
|
||||||
|
</Drawer>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
import { Card, Table } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
|
import { onlyUnique } from "../../utils/arrayHelper";
|
||||||
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
jobRO: selectJobReadOnly,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch) => ({});
|
||||||
|
|
||||||
|
export function PartsQueueJobLinesComponent({ jobRO, loading, jobLines }) {
|
||||||
|
const [state, setState] = useState({
|
||||||
|
sortedInfo: {},
|
||||||
|
filteredInfo: {},
|
||||||
|
});
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: "#",
|
||||||
|
dataIndex: "line_no",
|
||||||
|
key: "line_no",
|
||||||
|
sorter: (a, b) => a.line_no - b.line_no,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "line_no" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.line_desc"),
|
||||||
|
dataIndex: "line_desc",
|
||||||
|
key: "line_desc",
|
||||||
|
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||||
|
onCell: (record) => ({
|
||||||
|
className: record.manual_line && "job-line-manual",
|
||||||
|
style: {
|
||||||
|
...(record.critical ? { boxShadow: " -.5em 0 0 #FFC107" } : {}),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
||||||
|
ellipsis: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.oem_partno"),
|
||||||
|
dataIndex: "oem_partno",
|
||||||
|
key: "oem_partno",
|
||||||
|
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "oem_partno" && state.sortedInfo.order,
|
||||||
|
ellipsis: true,
|
||||||
|
render: (text, record) =>
|
||||||
|
`${record.oem_partno || ""} ${
|
||||||
|
record.alt_partno ? `(${record.alt_partno})` : ""
|
||||||
|
}`.trim(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.part_type"),
|
||||||
|
dataIndex: "part_type",
|
||||||
|
key: "part_type",
|
||||||
|
filteredValue: state.filteredInfo.part_type || null,
|
||||||
|
sorter: (a, b) => alphaSort(a.part_type, b.part_type),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "part_type" && state.sortedInfo.order,
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
text: t("jobs.labels.partsfilter"),
|
||||||
|
value: [
|
||||||
|
"PAN",
|
||||||
|
"PAC",
|
||||||
|
"PAR",
|
||||||
|
"PAL",
|
||||||
|
"PAA",
|
||||||
|
"PAM",
|
||||||
|
"PAP",
|
||||||
|
"PAS",
|
||||||
|
"PASL",
|
||||||
|
"PAG",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAN"),
|
||||||
|
value: ["PAN"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAP"),
|
||||||
|
value: ["PAP"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAL"),
|
||||||
|
value: ["PAL"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAA"),
|
||||||
|
value: ["PAA"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAG"),
|
||||||
|
value: ["PAG"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAS"),
|
||||||
|
value: ["PAS"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PASL"),
|
||||||
|
value: ["PASL"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAC"),
|
||||||
|
value: ["PAC"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAR"),
|
||||||
|
value: ["PAR"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: t("joblines.fields.part_types.PAM"),
|
||||||
|
value: ["PAM"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
onFilter: (value, record) => value.includes(record.part_type),
|
||||||
|
render: (text, record) =>
|
||||||
|
record.part_type
|
||||||
|
? t(`joblines.fields.part_types.${record.part_type}`)
|
||||||
|
: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.part_qty"),
|
||||||
|
dataIndex: "part_qty",
|
||||||
|
key: "part_qty",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.act_price"),
|
||||||
|
dataIndex: "act_price",
|
||||||
|
key: "act_price",
|
||||||
|
sorter: (a, b) => a.act_price - b.act_price,
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order,
|
||||||
|
ellipsis: true,
|
||||||
|
render: (text, record) => (
|
||||||
|
<CurrencyFormatter>
|
||||||
|
{record.db_ref === "900510" || record.db_ref === "900511"
|
||||||
|
? record.prt_dsmk_m
|
||||||
|
: record.act_price}
|
||||||
|
</CurrencyFormatter>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.location"),
|
||||||
|
dataIndex: "location",
|
||||||
|
key: "location",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("joblines.fields.status"),
|
||||||
|
dataIndex: "status",
|
||||||
|
key: "status",
|
||||||
|
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
|
filteredValue: state.filteredInfo.status || null,
|
||||||
|
filters:
|
||||||
|
(jobLines &&
|
||||||
|
jobLines
|
||||||
|
.map((l) => l.status)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Status*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
|
setState((state) => ({
|
||||||
|
...state,
|
||||||
|
filteredInfo: filters,
|
||||||
|
sortedInfo: sorter,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card title={t("jobs.labels.parts_lines")}>
|
||||||
|
<Table
|
||||||
|
columns={columns}
|
||||||
|
rowKey="id"
|
||||||
|
loading={loading}
|
||||||
|
pagination={false}
|
||||||
|
dataSource={jobLines}
|
||||||
|
onChange={handleTableChange}
|
||||||
|
/>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(PartsQueueJobLinesComponent);
|
||||||
@@ -8,30 +8,28 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import AlertComponent from "../../components/alert/alert.component";
|
|
||||||
import JobPartsQueueCount from "../../components/job-parts-queue-count/job-parts-queue-count.component";
|
|
||||||
import JobRemoveFromPartsQueue from "../../components/job-remove-from-parst-queue/job-remove-from-parts-queue.component";
|
|
||||||
import OwnerNameDisplay from "../../components/owner-name-display/owner-name-display.component";
|
|
||||||
import ProductionListColumnComment from "../../components/production-list-columns/production-list-columns.comment.component";
|
|
||||||
import { QUERY_PARTS_QUEUE } from "../../graphql/jobs.queries";
|
import { QUERY_PARTS_QUEUE } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { DateTimeFormatter, TimeAgoFormatter } from "../../utils/DateFormatter";
|
import { DateTimeFormatter, TimeAgoFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { onlyUnique } from "../../utils/arrayHelper";
|
||||||
|
import { pageLimit } from "../../utils/config";
|
||||||
import { alphaSort, dateSort } from "../../utils/sorters";
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import useLocalStorage from "../../utils/useLocalStorage";
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
import {pageLimit} from "../../utils/config";
|
import AlertComponent from "../alert/alert.component";
|
||||||
|
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
||||||
|
import JobRemoveFromPartsQueue from "../job-remove-from-parst-queue/job-remove-from-parts-queue.component";
|
||||||
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../owner-name-display/owner-name-display.component";
|
||||||
|
import ProductionListColumnComment from "../production-list-columns/production-list-columns.comment.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function PartsQueuePageComponent({ bodyshop }) {
|
export function PartsQueueListComponent({ bodyshop }) {
|
||||||
const searchParams = queryString.parse(useLocation().search);
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
const {
|
const { selected, sortcolumn, sortorder, statusFilters } = searchParams;
|
||||||
//page,
|
|
||||||
sortcolumn,
|
|
||||||
sortorder,
|
|
||||||
statusFilters,
|
|
||||||
} = searchParams;
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [filter, setFilter] = useLocalStorage("filter_parts_queue", null);
|
const [filter, setFilter] = useLocalStorage("filter_parts_queue", null);
|
||||||
|
|
||||||
@@ -39,19 +37,8 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
variables: {
|
variables: {
|
||||||
// offset: page ? (page - 1) * 25 : 0,
|
|
||||||
// limit: 25,
|
|
||||||
statuses: (statusFilters && JSON.parse(statusFilters)) ||
|
statuses: (statusFilters && JSON.parse(statusFilters)) ||
|
||||||
bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
||||||
order: [
|
|
||||||
{
|
|
||||||
[sortcolumn || "ro_number"]: sortorder
|
|
||||||
? sortorder === "descend"
|
|
||||||
? "desc"
|
|
||||||
: "asc"
|
|
||||||
: "desc",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,6 +94,17 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
history.push({ search: queryString.stringify(searchParams) });
|
history.push({ search: queryString.stringify(searchParams) });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleOnRowClick = (record) => {
|
||||||
|
if (record?.id) {
|
||||||
|
history.replace({
|
||||||
|
search: queryString.stringify({
|
||||||
|
...searchParams,
|
||||||
|
selected: record.id,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
@@ -125,7 +123,8 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
title: t("jobs.fields.owner"),
|
title: t("jobs.fields.owner"),
|
||||||
dataIndex: "ownr_ln",
|
dataIndex: "ownr_ln",
|
||||||
key: "ownr_ln",
|
key: "ownr_ln",
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: (a, b) =>
|
||||||
|
alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
sortOrder: sortcolumn === "ownr_ln" && sortorder,
|
sortOrder: sortcolumn === "ownr_ln" && sortorder,
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.ownerid ? (
|
return record.ownerid ? (
|
||||||
@@ -139,6 +138,56 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.vehicle"),
|
||||||
|
dataIndex: "vehicle",
|
||||||
|
key: "vehicle",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${
|
||||||
|
a.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
|
),
|
||||||
|
sortOrder: sortcolumn === "vehicle" && sortorder,
|
||||||
|
render: (text, record) => {
|
||||||
|
return record.vehicleid ? (
|
||||||
|
<Link to={"/manage/vehicles/" + record.vehicleid}>
|
||||||
|
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||||
|
record.v_model_desc || ""
|
||||||
|
}`}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||||
|
record.v_model_desc || ""
|
||||||
|
}`}</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.ins_co_nm_short"),
|
||||||
|
dataIndex: "ins_co_nm",
|
||||||
|
key: "ins_co_nm",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
||||||
|
sortOrder: sortcolumn === "ins_co_nm" && sortorder,
|
||||||
|
filteredValue: filter?.ins_co_nm || null,
|
||||||
|
filters:
|
||||||
|
(jobs &&
|
||||||
|
jobs
|
||||||
|
.map((j) => j.ins_co_nm)
|
||||||
|
.filter(onlyUnique)
|
||||||
|
.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s || "No Ins. Co.*",
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.status"),
|
title: t("jobs.fields.status"),
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
@@ -170,23 +219,16 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.scheduled_completion"),
|
||||||
dataIndex: "vehicle",
|
dataIndex: "scheduled_completion",
|
||||||
key: "vehicle",
|
key: "scheduled_completion",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => {
|
sorter: (a, b) =>
|
||||||
return record.vehicleid ? (
|
dateSort(a.scheduled_completion, b.scheduled_completion),
|
||||||
<Link to={"/manage/vehicles/" + record.vehicleid}>
|
sortOrder: sortcolumn === "scheduled_completion" && sortorder,
|
||||||
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
render: (text, record) => (
|
||||||
record.v_model_desc || ""
|
<DateTimeFormatter>{record.scheduled_completion}</DateTimeFormatter>
|
||||||
}`}
|
),
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
|
||||||
record.v_model_desc || ""
|
|
||||||
}`}</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: t("vehicles.fields.plate_no"),
|
// title: t("vehicles.fields.plate_no"),
|
||||||
@@ -198,14 +240,6 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
// return record.plate_no ? record.plate_no : "";
|
// return record.plate_no ? record.plate_no : "";
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
{
|
|
||||||
title: t("jobs.fields.clm_no"),
|
|
||||||
dataIndex: "clm_no",
|
|
||||||
key: "clm_no",
|
|
||||||
ellipsis: true,
|
|
||||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
|
||||||
sortOrder: sortcolumn === "clm_no" && sortorder,
|
|
||||||
},
|
|
||||||
// {
|
// {
|
||||||
// title: t("jobs.fields.clm_total"),
|
// title: t("jobs.fields.clm_total"),
|
||||||
// dataIndex: "clm_total",
|
// dataIndex: "clm_total",
|
||||||
@@ -307,9 +341,23 @@ export function PartsQueuePageComponent({ bodyshop }) {
|
|||||||
style={{ height: "100%" }}
|
style={{ height: "100%" }}
|
||||||
scroll={{ x: true }}
|
scroll={{ x: true }}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
|
rowSelection={{
|
||||||
|
onSelect: (record) => {
|
||||||
|
handleOnRowClick(record);
|
||||||
|
},
|
||||||
|
selectedRowKeys: [selected],
|
||||||
|
type: "radio",
|
||||||
|
}}
|
||||||
|
onRow={(record, rowIndex) => {
|
||||||
|
return {
|
||||||
|
onClick: (event) => {
|
||||||
|
handleOnRowClick(record);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, null)(PartsQueuePageComponent);
|
export default connect(mapStateToProps, null)(PartsQueueListComponent);
|
||||||
@@ -59,8 +59,8 @@ const PaymentExpandedRowComponent = ({ record, bodyshop }) => {
|
|||||||
await insertPayment({
|
await insertPayment({
|
||||||
variables: {
|
variables: {
|
||||||
paymentInput: {
|
paymentInput: {
|
||||||
amount: -refund_response.data.amount,
|
amount: -refund_response?.data?.amount,
|
||||||
transactionid: payment_response.response.receiptelements.transid,
|
transactionid: payment_response?.response?.receiptelements?.transid,
|
||||||
payer: record.payer,
|
payer: record.payer,
|
||||||
type: "Refund",
|
type: "Refund",
|
||||||
jobid: payment_response.jobid,
|
jobid: payment_response.jobid,
|
||||||
@@ -139,8 +139,8 @@ const PaymentExpandedRowComponent = ({ record, bodyshop }) => {
|
|||||||
contentStyle={{ fontWeight: "600" }}
|
contentStyle={{ fontWeight: "600" }}
|
||||||
column={4}
|
column={4}
|
||||||
>
|
>
|
||||||
<Descriptions.Item label={t("job_payments.titles.payer")}>
|
<Descriptions.Item label={t("job_payments.titles.hint")}>
|
||||||
{record.payer}
|
{payment_response?.response?.methodhint}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("job_payments.titles.payername")}>
|
<Descriptions.Item label={t("job_payments.titles.payername")}>
|
||||||
{payment_response?.response?.nameOnCard ?? ""}
|
{payment_response?.response?.nameOnCard ?? ""}
|
||||||
@@ -155,7 +155,7 @@ const PaymentExpandedRowComponent = ({ record, bodyshop }) => {
|
|||||||
{record.transactionid}
|
{record.transactionid}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("job_payments.titles.paymentid")}>
|
<Descriptions.Item label={t("job_payments.titles.paymentid")}>
|
||||||
{payment_response?.response?.paymentreferenceid ?? ""}
|
{payment_response?.ext_paymentid ?? ""}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label={t("job_payments.titles.paymenttype")}>
|
<Descriptions.Item label={t("job_payments.titles.paymenttype")}>
|
||||||
{record.type}
|
{record.type}
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import React from "react";
|
|
||||||
import { Button, notification } from "antd";
|
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Button, notification } from "antd";
|
||||||
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
|
||||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
|
||||||
|
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectPayment } from "../../redux/modals/modals.selectors";
|
||||||
|
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
currentUser: selectCurrentUser,
|
currentUser: selectCurrentUser,
|
||||||
|
paymentModal: selectPayment,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@@ -24,6 +26,7 @@ const PaymentMarkForExportButton = ({
|
|||||||
refetch,
|
refetch,
|
||||||
setPaymentContext,
|
setPaymentContext,
|
||||||
currentUser,
|
currentUser,
|
||||||
|
paymentModal,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [insertExportLog, { loading: exportLogLoading }] =
|
const [insertExportLog, { loading: exportLogLoading }] =
|
||||||
@@ -46,7 +49,6 @@ const PaymentMarkForExportButton = ({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const paymentUpdateResponse = await updatePayment({
|
const paymentUpdateResponse = await updatePayment({
|
||||||
variables: {
|
variables: {
|
||||||
paymentId: payment.id,
|
paymentId: payment.id,
|
||||||
@@ -55,25 +57,33 @@ const PaymentMarkForExportButton = ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!!!paymentUpdateResponse.errors) {
|
if (!!!paymentUpdateResponse.errors) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "success",
|
type: "success",
|
||||||
key: "paymentsuccessmarkforexport",
|
key: "paymentsuccessmarkforexport",
|
||||||
message: t("payments.successes.markexported"),
|
message: t("payments.successes.markexported"),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (refetch) refetch();
|
|
||||||
|
|
||||||
setPaymentContext({
|
setPaymentContext({
|
||||||
actions: {
|
actions: {
|
||||||
refetch,
|
refetch,
|
||||||
},
|
},
|
||||||
context: {
|
context: {
|
||||||
|
...paymentModal.context,
|
||||||
...payment,
|
...payment,
|
||||||
exportedat: today,
|
exportedat: today,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (refetch) {
|
||||||
|
if (paymentModal.context.refetchRequiresContext) {
|
||||||
|
refetch(
|
||||||
|
paymentUpdateResponse &&
|
||||||
|
paymentUpdateResponse.data.update_payments.returning[0]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
refetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("payments.errors.exporting", {
|
message: t("payments.errors.exporting", {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
|
|
||||||
import { Button, Form, Modal, notification, Space } from "antd";
|
import { Button, Form, Modal, notification, Space } from "antd";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -19,8 +18,8 @@ import {
|
|||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
import PaymentForm from "../payment-form/payment-form.component";
|
import PaymentForm from "../payment-form/payment-form.component";
|
||||||
import PaymentReexportButton from "../payment-reexport-button/payment-reexport-button.component";
|
|
||||||
import PaymentMarkForExportButton from "../payment-mark-export-button/payment-mark-export-button-component";
|
import PaymentMarkForExportButton from "../payment-mark-export-button/payment-mark-export-button-component";
|
||||||
|
import PaymentReexportButton from "../payment-reexport-button/payment-reexport-button.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
paymentModal: selectPayment,
|
paymentModal: selectPayment,
|
||||||
@@ -97,16 +96,21 @@ function PaymentModalContainer({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!!!updatedPayment.errors) {
|
if (!!!updatedPayment.errors) {
|
||||||
notification["success"]({ message: t("payments.successes.payment") });
|
notification["success"]({ message: t("payments.successes.paymentupdate") });
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({ message: t("payments.errors.payment") });
|
notification["error"]({ message: t("payments.errors.paymentupdate") });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actions.refetch)
|
if (actions.refetch) {
|
||||||
actions.refetch(
|
if (context.refetchRequiresContext) {
|
||||||
updatedPayment && updatedPayment.data.update_payments.returning[0]
|
actions.refetch(
|
||||||
);
|
updatedPayment && updatedPayment.data.update_payments.returning[0]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
actions.refetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (enterAgain) {
|
if (enterAgain) {
|
||||||
const prev = form.getFieldsValue(["date"]);
|
const prev = form.getFieldsValue(["date"]);
|
||||||
@@ -159,7 +163,7 @@ function PaymentModalContainer({
|
|||||||
}}
|
}}
|
||||||
afterClose={() => form.resetFields()}
|
afterClose={() => form.resetFields()}
|
||||||
footer={
|
footer={
|
||||||
<span>
|
<Space>
|
||||||
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
|
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
|
||||||
<Button loading={loading} onClick={() => form.submit()}>
|
<Button loading={loading} onClick={() => form.submit()}>
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
@@ -175,7 +179,7 @@ function PaymentModalContainer({
|
|||||||
{t("general.actions.saveandnew")}
|
{t("general.actions.saveandnew")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</span>
|
</Space>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{!context || (context && !context.id) ? null : (
|
{!context || (context && !context.id) ? null : (
|
||||||
@@ -194,7 +198,6 @@ function PaymentModalContainer({
|
|||||||
autoComplete={"off"}
|
autoComplete={"off"}
|
||||||
form={form}
|
form={form}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
initialValues={context || {}}
|
|
||||||
disabled={context?.exportedat}
|
disabled={context?.exportedat}
|
||||||
>
|
>
|
||||||
<PaymentForm form={form} />
|
<PaymentForm form={form} />
|
||||||
|
|||||||
@@ -1,17 +1,27 @@
|
|||||||
import React from "react";
|
|
||||||
import { Button, notification } from "antd";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
|
||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
import { Button, notification } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
||||||
|
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||||
|
import { selectPayment } from "../../redux/modals/modals.selectors";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
paymentModal: selectPayment,
|
||||||
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
setPaymentContext: (context) =>
|
setPaymentContext: (context) =>
|
||||||
dispatch(setModalContext({ context: context, modal: "payment" })),
|
dispatch(setModalContext({ context: context, modal: "payment" })),
|
||||||
});
|
});
|
||||||
|
|
||||||
const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
|
const PaymentReexportButton = ({
|
||||||
|
paymentModal,
|
||||||
|
payment,
|
||||||
|
refetch,
|
||||||
|
setPaymentContext,
|
||||||
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT);
|
const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT);
|
||||||
|
|
||||||
@@ -24,25 +34,32 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!!!paymentUpdateResponse.errors) {
|
if (!!!paymentUpdateResponse.errors) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "success",
|
type: "success",
|
||||||
key: "paymentsuccessexport",
|
key: "paymentsuccessexport",
|
||||||
message: t("payments.successes.markreexported"),
|
message: t("payments.successes.markreexported"),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (refetch) refetch();
|
|
||||||
|
|
||||||
setPaymentContext({
|
setPaymentContext({
|
||||||
actions: {
|
actions: {
|
||||||
refetch,
|
refetch,
|
||||||
},
|
},
|
||||||
context: {
|
context: {
|
||||||
|
...paymentModal.context,
|
||||||
...payment,
|
...payment,
|
||||||
exportedat: null,
|
exportedat: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (refetch) {
|
||||||
|
if (paymentModal.context.refetchRequiresContext) {
|
||||||
|
refetch(
|
||||||
|
paymentUpdateResponse &&
|
||||||
|
paymentUpdateResponse.data.update_payments.returning[0]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
refetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
message: t("payments.errors.exporting", {
|
message: t("payments.errors.exporting", {
|
||||||
@@ -63,4 +80,7 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(null, mapDispatchToProps)(PaymentReexportButton);
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(PaymentReexportButton);
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
|||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter, DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import { TemplateList } from "../../utils/TemplateConstants";
|
||||||
|
import { pageLimit } from "../../utils/config";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import CaBcEtfTableModalContainer from "../ca-bc-etf-table-modal/ca-bc-etf-table-modal.container";
|
import CaBcEtfTableModalContainer from "../ca-bc-etf-table-modal/ca-bc-etf-table-modal.container";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
|
||||||
import {pageLimit} from "../../utils/config";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
@@ -184,7 +184,10 @@ export function PaymentsListPaginated({
|
|||||||
}
|
}
|
||||||
: refetch,
|
: refetch,
|
||||||
},
|
},
|
||||||
context: apolloResults ? apolloResults : record,
|
context: {
|
||||||
|
...(apolloResults ? apolloResults : record),
|
||||||
|
refetchRequiresContext: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { Button, Form, Input, PageHeader, Space } from "antd";
|
import { Button, Form, Input, PageHeader, Space } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import {
|
||||||
|
selectAuthLevel,
|
||||||
|
selectBodyshop,
|
||||||
|
} from "../../redux/user/user.selectors";
|
||||||
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
import FormFieldsChanged from "../form-fields-changed-alert/form-fields-changed-alert.component";
|
||||||
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||||
import PhoneFormItem, {
|
import PhoneFormItem, {
|
||||||
@@ -8,12 +14,6 @@ import PhoneFormItem, {
|
|||||||
} from "../form-items-formatted/phone-form-item.component";
|
} from "../form-items-formatted/phone-form-item.component";
|
||||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||||
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
|
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component";
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { createStructuredSelector } from "reselect";
|
|
||||||
import {
|
|
||||||
selectAuthLevel,
|
|
||||||
selectBodyshop,
|
|
||||||
} from "../../redux/user/user.selectors";
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
authLevel: selectAuthLevel,
|
authLevel: selectAuthLevel,
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -46,13 +46,19 @@ export function PhonebookFormComponent({
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
title={`${form.getFieldValue("firstname") || ""} ${
|
title={
|
||||||
form.getFieldValue("lastname") || ""
|
<Form.Item shouldUpdate>
|
||||||
}${
|
{() =>
|
||||||
form.getFieldValue("company")
|
`${form.getFieldValue("firstname") || ""} ${
|
||||||
? ` - ${form.getFieldValue("company")}`
|
form.getFieldValue("lastname") || ""
|
||||||
: ""
|
}${
|
||||||
}`}
|
form.getFieldValue("company")
|
||||||
|
? ` - ${form.getFieldValue("company")}`
|
||||||
|
: ""
|
||||||
|
}`
|
||||||
|
}
|
||||||
|
</Form.Item>
|
||||||
|
}
|
||||||
extra={
|
extra={
|
||||||
<Space>
|
<Space>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
notification,
|
notification,
|
||||||
Popover,
|
Popover,
|
||||||
Radio,
|
Radio,
|
||||||
|
Space,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -115,10 +116,16 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
|
|||||||
>
|
>
|
||||||
<InputNumber min={1} precision={0} max={99} />
|
<InputNumber min={1} precision={0} max={99} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Button type="primary" loading={loading} onClick={handleOk}>
|
<div style={{ display: "flex", justifyContent: "flex-end" }}>
|
||||||
{t("general.actions.print")}
|
<Space>
|
||||||
</Button>
|
<Button type="primary" loading={loading} onClick={handleOk}>
|
||||||
<Button onClick={handleCancel}>{t("general.actions.cancel")}</Button>
|
{t("general.actions.print")}
|
||||||
|
</Button>
|
||||||
|
<Button onClick={handleCancel}>
|
||||||
|
{t("general.actions.cancel")}
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ProductionBoardKanbanComponent({
|
export function ProductionBoardKanbanComponent({
|
||||||
@@ -133,6 +133,7 @@ export function ProductionBoardKanbanComponent({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: card.id,
|
jobid: card.id,
|
||||||
operation: AuditTrailMapping.jobstatuschange(destination.toColumnId),
|
operation: AuditTrailMapping.jobstatuschange(destination.toColumnId),
|
||||||
|
type: "jobstatuschange",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (update.errors) {
|
if (update.errors) {
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ const sortByParentId = (arr) => {
|
|||||||
//console.log("sortByParentId -> byParentsIdsList", byParentsIdsList);
|
//console.log("sortByParentId -> byParentsIdsList", byParentsIdsList);
|
||||||
|
|
||||||
while (byParentsIdsList[parentId]) {
|
while (byParentsIdsList[parentId]) {
|
||||||
sortedList.push(byParentsIdsList[parentId][0]);
|
sortedList.push(...byParentsIdsList[parentId]); //Spread in the whole list in case several items have the same parents.
|
||||||
parentId = byParentsIdsList[parentId][0].id;
|
parentId = byParentsIdsList[parentId][byParentsIdsList[parentId].length -1].id; //Grab the ID from the last one.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byParentsIdsList["null"])
|
if (byParentsIdsList["null"])
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
|||||||
const mapStateToProps = createStructuredSelector({});
|
const mapStateToProps = createStructuredSelector({});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
||||||
@@ -46,6 +46,7 @@ export function ProductionListColumnAlert({ record, insertAuditTrail }) {
|
|||||||
? !record.production_vars.alert
|
? !record.production_vars.alert
|
||||||
: true
|
: true
|
||||||
),
|
),
|
||||||
|
type: "alertToggle",
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (record.refetch) record.refetch();
|
if (record.refetch) record.refetch();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BranchesOutlined, PauseCircleOutlined } from "@ant-design/icons";
|
import { BranchesOutlined, PauseCircleOutlined } from "@ant-design/icons";
|
||||||
import { Space, Tooltip } from "antd";
|
import { Checkbox, Space, Tooltip } from "antd";
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import moment from "moment";
|
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { TimeFormatter } from "../../utils/DateFormatter";
|
import { TimeFormatter } from "../../utils/DateFormatter";
|
||||||
@@ -10,7 +9,7 @@ import { onlyUnique } from "../../utils/arrayHelper";
|
|||||||
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||||
import JobAltTransportChange from "../job-at-change/job-at-change.component";
|
import JobAltTransportChange from "../job-at-change/job-at-change.component";
|
||||||
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay, { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||||
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
|
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
|
||||||
import ProductionListColumnAlert from "./production-list-columns.alert.component";
|
import ProductionListColumnAlert from "./production-list-columns.alert.component";
|
||||||
import ProductionListColumnBodyPriority from "./production-list-columns.bodypriority.component";
|
import ProductionListColumnBodyPriority from "./production-list-columns.bodypriority.component";
|
||||||
@@ -33,11 +32,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
dataIndex: "viewdetail",
|
dataIndex: "viewdetail",
|
||||||
key: "viewdetail",
|
key: "viewdetail",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => <Link to={{ search: `?selected=${record.id}` }}>{i18n.t("general.labels.view")}</Link>
|
||||||
<Link to={{ search: `?selected=${record.id}` }}>
|
|
||||||
{i18n.t("general.labels.view")}
|
|
||||||
</Link>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.ro_number"),
|
title: i18n.t("jobs.fields.ro_number"),
|
||||||
@@ -45,23 +40,18 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
technician ? (
|
technician ? (
|
||||||
<Link to={`/tech/joblookup?selected=${record.id}`}>
|
<Link to={`/tech/joblookup?selected=${record.id}`}>
|
||||||
{record.ro_number}
|
{record.ro_number}
|
||||||
{record.suspended && (
|
{record.suspended && <PauseCircleOutlined style={{ color: "orangered" }} />}
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
|
||||||
)}
|
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<Link to={`/manage/jobs/${record.id}`}>
|
<Link to={`/manage/jobs/${record.id}`}>
|
||||||
<Space>
|
<Space>
|
||||||
{record.ro_number}
|
{record.ro_number}
|
||||||
{record.suspended && (
|
{record.suspended && <PauseCircleOutlined style={{ color: "orangered" }} />}
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
|
||||||
)}
|
|
||||||
{record.iouparent && (
|
{record.iouparent && (
|
||||||
<Tooltip title={i18n.t("jobs.labels.iou")}>
|
<Tooltip title={i18n.t("jobs.labels.iou")}>
|
||||||
<BranchesOutlined style={{ color: "orangered" }} />
|
<BranchesOutlined style={{ color: "orangered" }} />
|
||||||
@@ -69,7 +59,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.owner"),
|
title: i18n.t("jobs.fields.owner"),
|
||||||
@@ -84,9 +74,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record} />
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: (a, b) => alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "ownr" && state.sortedInfo.order
|
||||||
state.sortedInfo.columnKey === "ownr" && state.sortedInfo.order,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.vehicle"),
|
title: i18n.t("jobs.fields.vehicle"),
|
||||||
@@ -95,11 +84,10 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
alphaSort(
|
alphaSort(
|
||||||
a.v_make_desc + a.v_model_desc,
|
`${a.v_model_yr || ""} ${a.v_make_desc || ""} ${a.v_model_desc || ""}`,
|
||||||
b.v_make_desc + b.v_model_desc
|
`${b.v_model_yr || ""} ${b.v_make_desc || ""} ${b.v_model_desc || ""}`
|
||||||
),
|
),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
technician ? (
|
technician ? (
|
||||||
<>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
<>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
|
||||||
@@ -111,7 +99,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
} ${record.v_make_desc || ""} ${record.v_model_desc || ""} ${
|
} ${record.v_make_desc || ""} ${record.v_model_desc || ""} ${
|
||||||
record.v_color || ""
|
record.v_color || ""
|
||||||
} ${record.plate_no || ""}`}</Link>
|
} ${record.plate_no || ""}`}</Link>
|
||||||
),
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.actual_in"),
|
title: i18n.t("jobs.fields.actual_in"),
|
||||||
@@ -119,11 +107,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "actual_in",
|
key: "actual_in",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => dateSort(a.actual_in, b.actual_in),
|
sorter: (a, b) => dateSort(a.actual_in, b.actual_in),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "actual_in" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "actual_in" && state.sortedInfo.order,
|
render: (text, record) => <ProductionListDate record={record} field="actual_in" time />
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListDate record={record} field="actual_in" time />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.actual_in") + " (HH:MM)",
|
title: i18n.t("jobs.fields.actual_in") + " (HH:MM)",
|
||||||
@@ -131,28 +116,16 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "actual_in_time",
|
key: "actual_in_time",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => <TimeFormatter>{record.actual_in}</TimeFormatter>
|
||||||
<TimeFormatter>{record.actual_in}</TimeFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.scheduled_completion"),
|
title: i18n.t("jobs.fields.scheduled_completion"),
|
||||||
dataIndex: "scheduled_completion",
|
dataIndex: "scheduled_completion",
|
||||||
key: "scheduled_completion",
|
key: "scheduled_completion",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) => dateSort(a.scheduled_completion, b.scheduled_completion),
|
||||||
dateSort(a.scheduled_completion, b.scheduled_completion),
|
sortOrder: state.sortedInfo.columnKey === "scheduled_completion" && state.sortedInfo.order,
|
||||||
sortOrder:
|
render: (text, record) => <ProductionListDate record={record} field="scheduled_completion" pastIndicator time />
|
||||||
state.sortedInfo.columnKey === "scheduled_completion" &&
|
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListDate
|
|
||||||
record={record}
|
|
||||||
field="scheduled_completion"
|
|
||||||
pastIndicator
|
|
||||||
time
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.scheduled_completion") + " (HH:MM)",
|
title: i18n.t("jobs.fields.scheduled_completion") + " (HH:MM)",
|
||||||
@@ -160,9 +133,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "scheduled_completion_time",
|
key: "scheduled_completion_time",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => <TimeFormatter>{record.scheduled_completion}</TimeFormatter>
|
||||||
<TimeFormatter>{record.scheduled_completion}</TimeFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.date_last_contacted"),
|
title: i18n.t("jobs.fields.date_last_contacted"),
|
||||||
@@ -170,10 +141,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "date_last_contacted",
|
key: "date_last_contacted",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => dateSort(a.date_last_contacted, b.date_last_contacted),
|
sorter: (a, b) => dateSort(a.date_last_contacted, b.date_last_contacted),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "date_last_contacted" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "date_last_contacted" &&
|
render: (text, record) => <ProductionListLastContacted record={record} />
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => <ProductionListLastContacted record={record} />,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.date_next_contact"),
|
title: i18n.t("jobs.fields.date_next_contact"),
|
||||||
@@ -181,22 +150,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "date_next_contact",
|
key: "date_next_contact",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => dateSort(a.date_next_contact, b.date_next_contact),
|
sorter: (a, b) => dateSort(a.date_next_contact, b.date_next_contact),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "date_next_contact" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "date_next_contact" &&
|
render: (text, record) => <ProductionListDate record={record} field="date_next_contact" pastIndicator time />
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
color:
|
|
||||||
record.date_next_contact &&
|
|
||||||
moment(record.date_next_contact).isBefore(moment())
|
|
||||||
? "red"
|
|
||||||
: "",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ProductionListDate record={record} field="date_next_contact" time />
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.scheduled_delivery"),
|
title: i18n.t("jobs.fields.scheduled_delivery"),
|
||||||
@@ -204,17 +159,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "scheduled_delivery",
|
key: "scheduled_delivery",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => dateSort(a.scheduled_delivery, b.scheduled_delivery),
|
sorter: (a, b) => dateSort(a.scheduled_delivery, b.scheduled_delivery),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "scheduled_delivery" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "scheduled_delivery" &&
|
render: (text, record) => <ProductionListDate record={record} field="scheduled_delivery" pastIndicator time />
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListDate
|
|
||||||
record={record}
|
|
||||||
field="scheduled_delivery"
|
|
||||||
pastIndicator
|
|
||||||
time
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.scheduled_delivery") + " (HH:MM)",
|
title: i18n.t("jobs.fields.scheduled_delivery") + " (HH:MM)",
|
||||||
@@ -222,9 +168,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "scheduled_delivery_time",
|
key: "scheduled_delivery_time",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => <TimeFormatter>{record.scheduled_delivery}</TimeFormatter>
|
||||||
<TimeFormatter>{record.scheduled_delivery}</TimeFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.ins_co_nm"),
|
title: i18n.t("jobs.fields.ins_co_nm"),
|
||||||
@@ -232,8 +176,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "ins_co_nm" && state.sortedInfo.order
|
||||||
state.sortedInfo.columnKey === "ins_co_nm" && state.sortedInfo.order,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.clm_no"),
|
title: i18n.t("jobs.fields.clm_no"),
|
||||||
@@ -241,8 +184,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "clm_no",
|
key: "clm_no",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order
|
||||||
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.clm_total"),
|
title: i18n.t("jobs.fields.clm_total"),
|
||||||
@@ -250,11 +192,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "clm_total",
|
key: "clm_total",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
sorter: (a, b) => a.clm_total - b.clm_total,
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
render: (text, record) => <CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
|
||||||
render: (text, record) => (
|
|
||||||
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.owner_owing"),
|
title: i18n.t("jobs.fields.owner_owing"),
|
||||||
@@ -262,35 +201,36 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "owner_owing",
|
key: "owner_owing",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => a.owner_owing - b.owner_owing,
|
sorter: (a, b) => a.owner_owing - b.owner_owing,
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "owner_owing" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "owner_owing" && state.sortedInfo.order,
|
render: (text, record) => <CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
|
||||||
render: (text, record) => (
|
|
||||||
<CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.ownr_ph1"),
|
title: i18n.t("jobs.fields.ownr_ph1"),
|
||||||
dataIndex: "ownr_ph1",
|
dataIndex: "ownr_ph1",
|
||||||
key: "ownr_ph1",
|
key: "ownr_ph1",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => <PhoneFormatter>{record.ownr_ph1}</PhoneFormatter>
|
||||||
<PhoneFormatter>{record.ownr_ph1}</PhoneFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.ownr_ph2"),
|
title: i18n.t("jobs.fields.ownr_ph2"),
|
||||||
dataIndex: "ownr_ph2",
|
dataIndex: "ownr_ph2",
|
||||||
key: "ownr_ph2",
|
key: "ownr_ph2",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => <PhoneFormatter>{record.ownr_ph2}</PhoneFormatter>
|
||||||
<PhoneFormatter>{record.ownr_ph2}</PhoneFormatter>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.specialcoveragepolicy"),
|
title: i18n.t("jobs.fields.specialcoveragepolicy"),
|
||||||
dataIndex: "special_coverage_policy",
|
dataIndex: "special_coverage_policy",
|
||||||
key: "special_coverage_policy",
|
key: "special_coverage_policy",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => Number(a.special_coverage_policy) - Number(b.special_coverage_policy),
|
||||||
|
sortOrder: state.sortedInfo.columnKey === "special_coverage_policy" && state.sortedInfo.order,
|
||||||
|
filters: [
|
||||||
|
{ text: "True", value: true },
|
||||||
|
{ text: "False", value: false }
|
||||||
|
],
|
||||||
|
onFilter: (value, record) => value === record.special_coverage_policy,
|
||||||
|
render: (text, record) => <Checkbox checked={record.special_coverage_policy} />
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -299,15 +239,23 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "alt_transport",
|
key: "alt_transport",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "alt_transport" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "alt_transport" &&
|
filters:
|
||||||
state.sortedInfo.order,
|
(bodyshop &&
|
||||||
|
bodyshop.appt_alt_transport.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s,
|
||||||
|
value: [s]
|
||||||
|
};
|
||||||
|
})) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.alt_transport),
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<div>
|
<div>
|
||||||
{record.alt_transport}
|
{record.alt_transport}
|
||||||
<JobAltTransportChange job={record} />
|
<JobAltTransportChange job={record} />
|
||||||
</div>
|
</div>
|
||||||
),
|
)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.status"),
|
title: i18n.t("jobs.fields.status"),
|
||||||
@@ -315,9 +263,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "status",
|
key: "status",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => statusSort(a.status, b.status, activeStatuses),
|
sorter: (a, b) => statusSort(a.status, b.status, activeStatuses),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
render: (text, record) => <ProductionListColumnStatus record={record} />
|
||||||
render: (text, record) => <ProductionListColumnStatus record={record} />,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.category"),
|
title: i18n.t("jobs.fields.category"),
|
||||||
@@ -330,37 +277,30 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
bodyshop.md_categories.map((s) => {
|
bodyshop.md_categories.map((s) => {
|
||||||
return {
|
return {
|
||||||
text: s,
|
text: s,
|
||||||
value: [s],
|
value: [s]
|
||||||
};
|
};
|
||||||
})) ||
|
})) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) => value.includes(record.category),
|
onFilter: (value, record) => value.includes(record.category),
|
||||||
sorter: (a, b) => alphaSort(a.category, b.category),
|
sorter: (a, b) => alphaSort(a.category, b.category),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "category" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "category" && state.sortedInfo.order,
|
render: (text, record) => <ProductionListColumnCategory record={record} />
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListColumnCategory record={record} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.bodyhours"),
|
title: i18n.t("production.labels.bodyhours"),
|
||||||
dataIndex: "labhrs",
|
dataIndex: "labhrs",
|
||||||
key: "labhrs",
|
key: "labhrs",
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) => a.labhrs.aggregate.sum.mod_lb_hrs - b.labhrs.aggregate.sum.mod_lb_hrs,
|
||||||
a.labhrs.aggregate.sum.mod_lb_hrs - b.labhrs.aggregate.sum.mod_lb_hrs,
|
sortOrder: state.sortedInfo.columnKey === "labhrs" && state.sortedInfo.order,
|
||||||
sortOrder:
|
render: (text, record) => record.labhrs.aggregate.sum.mod_lb_hrs
|
||||||
state.sortedInfo.columnKey === "labhrs" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => record.labhrs.aggregate.sum.mod_lb_hrs,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.refinishhours"),
|
title: i18n.t("production.labels.refinishhours"),
|
||||||
dataIndex: "larhrs",
|
dataIndex: "larhrs",
|
||||||
key: "larhrs",
|
key: "larhrs",
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) => a.larhrs.aggregate.sum.mod_lb_hrs - b.larhrs.aggregate.sum.mod_lb_hrs,
|
||||||
a.larhrs.aggregate.sum.mod_lb_hrs - b.larhrs.aggregate.sum.mod_lb_hrs,
|
sortOrder: state.sortedInfo.columnKey === "larhrs" && state.sortedInfo.order,
|
||||||
sortOrder:
|
render: (text, record) => record.larhrs.aggregate.sum.mod_lb_hrs
|
||||||
state.sortedInfo.columnKey === "larhrs" && state.sortedInfo.order,
|
|
||||||
render: (text, record) => record.larhrs.aggregate.sum.mod_lb_hrs,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.totalhours"),
|
title: i18n.t("production.labels.totalhours"),
|
||||||
@@ -370,34 +310,36 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
a.labhrs.aggregate.sum.mod_lb_hrs +
|
a.labhrs.aggregate.sum.mod_lb_hrs +
|
||||||
a.larhrs.aggregate.sum.mod_lb_hrs -
|
a.larhrs.aggregate.sum.mod_lb_hrs -
|
||||||
(b.labhrs.aggregate.sum.mod_lb_hrs + b.larhrs.aggregate.sum.mod_lb_hrs),
|
(b.labhrs.aggregate.sum.mod_lb_hrs + b.larhrs.aggregate.sum.mod_lb_hrs),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "totalhours" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "totalhours" && state.sortedInfo.order,
|
|
||||||
render: (text, record) =>
|
render: (text, record) =>
|
||||||
(
|
(record.labhrs.aggregate.sum.mod_lb_hrs + record.larhrs.aggregate.sum.mod_lb_hrs).toFixed(1)
|
||||||
record.labhrs.aggregate.sum.mod_lb_hrs +
|
|
||||||
record.larhrs.aggregate.sum.mod_lb_hrs
|
|
||||||
).toFixed(1),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.alert"),
|
title: i18n.t("production.labels.alert"),
|
||||||
dataIndex: "alert",
|
dataIndex: "alert",
|
||||||
key: "alert",
|
key: "alert",
|
||||||
|
sorter: (a, b) => Number(a.production_vars?.alert || false) - Number(b.production_vars?.alert || false),
|
||||||
render: (text, record) => <ProductionListColumnAlert record={record} />,
|
sortOrder: state.sortedInfo.columnKey === "alert" && state.sortedInfo.order,
|
||||||
|
filters: [
|
||||||
|
{ text: "True", value: true },
|
||||||
|
{ text: "False", value: false }
|
||||||
|
],
|
||||||
|
onFilter: (value, record) => value === (record.production_vars?.alert || false),
|
||||||
|
render: (text, record) => <ProductionListColumnAlert record={record} />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.note"),
|
title: i18n.t("production.labels.note"),
|
||||||
dataIndex: "note",
|
dataIndex: "note",
|
||||||
key: "note",
|
key: "note",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => <ProductionListColumnNote record={record} />,
|
render: (text, record) => <ProductionListColumnNote record={record} />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.comment"),
|
title: i18n.t("production.labels.comment"),
|
||||||
dataIndex: "comment",
|
dataIndex: "comment",
|
||||||
key: "comment",
|
key: "comment",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => <ProductionListColumnComment record={record} />,
|
render: (text, record) => <ProductionListColumnComment record={record} />
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.touchtime"),
|
title: i18n.t("production.labels.touchtime"),
|
||||||
@@ -405,7 +347,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "tt",
|
key: "tt",
|
||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return <ProductionlistColumnTouchTime job={record} />;
|
return <ProductionlistColumnTouchTime job={record} />;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.bodypriority"),
|
title: i18n.t("production.labels.bodypriority"),
|
||||||
@@ -415,11 +357,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
((a.production_vars && a.production_vars.bodypriority) || 11) -
|
((a.production_vars && a.production_vars.bodypriority) || 11) -
|
||||||
((b.production_vars && b.production_vars.bodypriority) || 11),
|
((b.production_vars && b.production_vars.bodypriority) || 11),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "bodypriority" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "bodypriority" && state.sortedInfo.order,
|
render: (text, record) => <ProductionListColumnBodyPriority record={record} />
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListColumnBodyPriority record={record} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.paintpriority"),
|
title: i18n.t("production.labels.paintpriority"),
|
||||||
@@ -429,12 +368,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
((a.production_vars && a.production_vars.paintpriority) || 11) -
|
((a.production_vars && a.production_vars.paintpriority) || 11) -
|
||||||
((b.production_vars && b.production_vars.paintpriority) || 11),
|
((b.production_vars && b.production_vars.paintpriority) || 11),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "paintpriority" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "paintpriority" &&
|
render: (text, record) => <ProductionListColumnPaintPriority record={record} />
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListColumnPaintPriority record={record} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.detailpriority"),
|
title: i18n.t("production.labels.detailpriority"),
|
||||||
@@ -444,110 +379,74 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
((a.production_vars && a.production_vars.detailpriority) || 11) -
|
((a.production_vars && a.production_vars.detailpriority) || 11) -
|
||||||
((b.production_vars && b.production_vars.detailpriority) || 11),
|
((b.production_vars && b.production_vars.detailpriority) || 11),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "detailpriority" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "detailpriority" &&
|
render: (text, record) => <ProductionListColumnDetailPriority record={record} />
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListColumnDetailPriority record={record} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.sublets"),
|
title: i18n.t("production.labels.sublets"),
|
||||||
dataIndex: "sublets",
|
dataIndex: "sublets",
|
||||||
key: "sublets",
|
key: "sublets",
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionSubletsManageComponent subletJobLines={record.subletLines} />
|
||||||
<ProductionSubletsManageComponent subletJobLines={record.subletLines} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.employee_body"),
|
title: i18n.t("jobs.fields.employee_body"),
|
||||||
dataIndex: "employee_body",
|
dataIndex: "employee_body",
|
||||||
key: "employee_body",
|
key: "employee_body",
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "employee_body" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "employee_body" &&
|
|
||||||
state.sortedInfo.order,
|
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
alphaSort(
|
alphaSort(
|
||||||
bodyshop.employees?.find((e) => e.id === a.employee_body)?.first_name,
|
bodyshop.employees?.find((e) => e.id === a.employee_body)?.first_name,
|
||||||
bodyshop.employees?.find((e) => e.id === b.employee_body)?.first_name
|
bodyshop.employees?.find((e) => e.id === b.employee_body)?.first_name
|
||||||
),
|
),
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionListEmployeeAssignment record={record} type="employee_body" />
|
||||||
<ProductionListEmployeeAssignment
|
|
||||||
record={record}
|
|
||||||
type="employee_body"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.employee_prep"),
|
title: i18n.t("jobs.fields.employee_prep"),
|
||||||
dataIndex: "employee_prep",
|
dataIndex: "employee_prep",
|
||||||
key: "employee_prep",
|
key: "employee_prep",
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "employee_prep" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "employee_prep" &&
|
|
||||||
state.sortedInfo.order,
|
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
alphaSort(
|
alphaSort(
|
||||||
bodyshop.employees?.find((e) => e.id === a.employee_prep)?.first_name,
|
bodyshop.employees?.find((e) => e.id === a.employee_prep)?.first_name,
|
||||||
bodyshop.employees?.find((e) => e.id === b.employee_prep)?.first_name
|
bodyshop.employees?.find((e) => e.id === b.employee_prep)?.first_name
|
||||||
),
|
),
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionListEmployeeAssignment record={record} type="employee_prep" />
|
||||||
<ProductionListEmployeeAssignment
|
|
||||||
record={record}
|
|
||||||
type="employee_prep"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.employee_csr"),
|
title: i18n.t("jobs.fields.employee_csr"),
|
||||||
dataIndex: "employee_csr",
|
dataIndex: "employee_csr",
|
||||||
key: "employee_csr",
|
key: "employee_csr",
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "employee_csr" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "employee_csr" && state.sortedInfo.order,
|
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
alphaSort(
|
alphaSort(
|
||||||
bodyshop.employees?.find((e) => e.id === a.employee_csr)?.first_name,
|
bodyshop.employees?.find((e) => e.id === a.employee_csr)?.first_name,
|
||||||
bodyshop.employees?.find((e) => e.id === b.employee_csr)?.first_name
|
bodyshop.employees?.find((e) => e.id === b.employee_csr)?.first_name
|
||||||
),
|
),
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionListEmployeeAssignment record={record} type="employee_csr" />
|
||||||
<ProductionListEmployeeAssignment record={record} type="employee_csr" />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.employee_refinish"),
|
title: i18n.t("jobs.fields.employee_refinish"),
|
||||||
dataIndex: "employee_refinish",
|
dataIndex: "employee_refinish",
|
||||||
key: "employee_refinish",
|
key: "employee_refinish",
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "employee_refinish" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "employee_refinish" &&
|
|
||||||
state.sortedInfo.order,
|
|
||||||
sorter: (a, b) =>
|
sorter: (a, b) =>
|
||||||
alphaSort(
|
alphaSort(
|
||||||
bodyshop.employees?.find((e) => e.id === a.employee_refinish)
|
bodyshop.employees?.find((e) => e.id === a.employee_refinish)?.first_name,
|
||||||
?.first_name,
|
bodyshop.employees?.find((e) => e.id === b.employee_refinish)?.first_name
|
||||||
bodyshop.employees?.find((e) => e.id === b.employee_refinish)
|
|
||||||
?.first_name
|
|
||||||
),
|
),
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionListEmployeeAssignment record={record} type="employee_refinish" />
|
||||||
<ProductionListEmployeeAssignment
|
|
||||||
record={record}
|
|
||||||
type="employee_refinish"
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.labels.parts_received"),
|
title: i18n.t("jobs.labels.parts_received"),
|
||||||
dataIndex: "parts_received",
|
dataIndex: "parts_received",
|
||||||
key: "parts_received",
|
key: "parts_received",
|
||||||
render: (text, record) => (
|
render: (text, record) => <ProductionListColumnPartsReceived record={record} />
|
||||||
<ProductionListColumnPartsReceived record={record} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.partsstatus"),
|
title: i18n.t("jobs.fields.partsstatus"),
|
||||||
dataIndex: "partsstatus",
|
dataIndex: "partsstatus",
|
||||||
key: "partsstatus",
|
key: "partsstatus",
|
||||||
render: (text, record) => (
|
render: (text, record) => <JobPartsQueueCount parts={record.joblines_status} record={record} />
|
||||||
<JobPartsQueueCount parts={record.joblines_status} record={record} />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.labels.estimator"),
|
title: i18n.t("jobs.labels.estimator"),
|
||||||
@@ -558,8 +457,7 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
`${a.est_ct_fn || ""} ${a.est_ct_ln || ""}`.trim(),
|
`${a.est_ct_fn || ""} ${a.est_ct_ln || ""}`.trim(),
|
||||||
`${b.est_ct_fn || ""} ${b.est_ct_ln || ""}`.trim()
|
`${b.est_ct_fn || ""} ${b.est_ct_ln || ""}`.trim()
|
||||||
),
|
),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "estimator" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "estimator" && state.sortedInfo.order,
|
|
||||||
filters:
|
filters:
|
||||||
(data &&
|
(data &&
|
||||||
data
|
data
|
||||||
@@ -568,16 +466,12 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
.map((s) => {
|
.map((s) => {
|
||||||
return {
|
return {
|
||||||
text: s || "N/A",
|
text: s || "N/A",
|
||||||
value: [s],
|
value: [s]
|
||||||
};
|
};
|
||||||
})) ||
|
})) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) =>
|
onFilter: (value, record) => value.includes(`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()),
|
||||||
value.includes(
|
render: (text, record) => `${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
||||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
|
||||||
),
|
|
||||||
render: (text, record) =>
|
|
||||||
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
|
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
|
||||||
@@ -607,12 +501,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "date_repairstarted",
|
key: "date_repairstarted",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
sorter: (a, b) => dateSort(a.date_repairstarted, b.date_repairstarted),
|
sorter: (a, b) => dateSort(a.date_repairstarted, b.date_repairstarted),
|
||||||
sortOrder:
|
sortOrder: state.sortedInfo.columnKey === "date_repairstarted" && state.sortedInfo.order,
|
||||||
state.sortedInfo.columnKey === "date_repairstarted" &&
|
render: (text, record) => <ProductionListDate record={record} field="date_repairstarted" time />
|
||||||
state.sortedInfo.order,
|
|
||||||
render: (text, record) => (
|
|
||||||
<ProductionListDate record={record} field="date_repairstarted" time />
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.fields.date_repairstarted") + " (HH:MM)",
|
title: i18n.t("jobs.fields.date_repairstarted") + " (HH:MM)",
|
||||||
@@ -620,10 +510,8 @@ const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
|||||||
key: "date_repairstarted_time",
|
key: "date_repairstarted_time",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => <TimeFormatter>{record.date_repairstarted}</TimeFormatter>
|
||||||
<TimeFormatter>{record.date_repairstarted}</TimeFormatter>
|
}
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
export default r;
|
export default r;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { useMutation } from "@apollo/client";
|
|||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Col,
|
Col,
|
||||||
notification,
|
|
||||||
Popover,
|
Popover,
|
||||||
Row,
|
Row,
|
||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Spin,
|
Spin,
|
||||||
|
notification,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -25,8 +25,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ProductionListEmpAssignment({
|
export function ProductionListEmpAssignment({
|
||||||
@@ -55,6 +55,7 @@ export function ProductionListEmpAssignment({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: record.id,
|
jobid: record.id,
|
||||||
operation: AuditTrailMapping.jobassignmentchange(empAssignment, name),
|
operation: AuditTrailMapping.jobassignmentchange(empAssignment, name),
|
||||||
|
type: "jobassignmentchange",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!!result.errors) {
|
if (!!result.errors) {
|
||||||
@@ -80,6 +81,7 @@ export function ProductionListEmpAssignment({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: record.id,
|
jobid: record.id,
|
||||||
operation: AuditTrailMapping.jobassignmentremoved(empAssignment),
|
operation: AuditTrailMapping.jobassignmentremoved(empAssignment),
|
||||||
|
type: "jobassignmentremoved",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!!result.errors) {
|
if (!!result.errors) {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export function ProductionListColumnCategory({ record, bodyshop }) {
|
export function ProductionListColumnCategory({ record, bodyshop }) {
|
||||||
const [updateJob] = useMutation(UPDATE_JOB);
|
const [updateJob] = useMutation(UPDATE_JOB);
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import { connect } from "react-redux";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
|
||||||
import { insertAuditTrail } from "../../redux/application/application.actions";
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
import AuditTrailMapping from "../../utils/AuditTrailMappings";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
export function ProductionListColumnStatus({
|
export function ProductionListColumnStatus({
|
||||||
record,
|
record,
|
||||||
@@ -40,6 +40,7 @@ export function ProductionListColumnStatus({
|
|||||||
insertAuditTrail({
|
insertAuditTrail({
|
||||||
jobid: record.id,
|
jobid: record.id,
|
||||||
operation: AuditTrailMapping.jobstatuschange(key),
|
operation: AuditTrailMapping.jobstatuschange(key),
|
||||||
|
type: "jobstatuschange",
|
||||||
});
|
});
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -0,0 +1,432 @@
|
|||||||
|
import {Button, Card, Checkbox, Col, Form, Input, InputNumber, Row, Select} from "antd";
|
||||||
|
import React, {useCallback, useEffect, useMemo, useState} from "react";
|
||||||
|
import {fetchFilterData} from "../../utils/RenderTemplate";
|
||||||
|
import {DeleteFilled} from "@ant-design/icons";
|
||||||
|
import {useTranslation} from "react-i18next";
|
||||||
|
import {getOrderOperatorsByType, getWhereOperatorsByType} from "../../utils/graphQLmodifier";
|
||||||
|
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||||
|
import {generateInternalReflections} from "./report-center-modal-utils";
|
||||||
|
import {FormDatePicker} from "../form-date-picker/form-date-picker.component.jsx";
|
||||||
|
|
||||||
|
export default function ReportCenterModalFiltersSortersComponent({form, bodyshop}) {
|
||||||
|
return (
|
||||||
|
<Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
|
||||||
|
{() => {
|
||||||
|
const key = form.getFieldValue("key");
|
||||||
|
return <RenderFilters form={form} templateId={key} bodyshop={bodyshop}/>;
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters Section
|
||||||
|
* @param filters
|
||||||
|
* @param form
|
||||||
|
* @param bodyshop
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function FiltersSection({filters, form, bodyshop}) {
|
||||||
|
const {t} = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card type='inner' title={t('reportcenter.labels.advanced_filters_filters')} style={{marginTop: '10px'}}>
|
||||||
|
<Form.List name={["filters"]}>
|
||||||
|
{(fields, {add, remove}) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{fields.map((field, index) => (
|
||||||
|
<Form.Item key={field.key}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={10}>
|
||||||
|
<Form.Item
|
||||||
|
key={`${index}field`}
|
||||||
|
label={t('reportcenter.labels.advanced_filters_filter_field')}
|
||||||
|
name={[field.name, "field"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
onChange={() => {
|
||||||
|
// Clear related Fields
|
||||||
|
form.setFieldValue(['filters', field.name, 'value'], null);
|
||||||
|
form.setFieldValue(['filters', field.name, 'operator'], null);
|
||||||
|
}}
|
||||||
|
options={
|
||||||
|
filters.map((f) => {
|
||||||
|
return {
|
||||||
|
value: f.name,
|
||||||
|
label: f?.translation ? (t(f.translation) === f.translation ? f.label : t(f.translation)) : f.label,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={6}>
|
||||||
|
<Form.Item
|
||||||
|
dependencies={[['filters', field.name, "field"],['filters', field.name, "value"]]}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
() => {
|
||||||
|
const name = form.getFieldValue(['filters', field.name, "field"]);
|
||||||
|
const type = filters.find(f => f.name === name)?.type;
|
||||||
|
|
||||||
|
return <Form.Item
|
||||||
|
key={`${index}operator`}
|
||||||
|
label={t('reportcenter.labels.advanced_filters_filter_operator')}
|
||||||
|
name={[field.name, "operator"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
options={ getWhereOperatorsByType(type)}
|
||||||
|
onChange={() => {
|
||||||
|
// Clear related Fields
|
||||||
|
|
||||||
|
form.setFieldValue(['filters', field.name, 'value'], undefined);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={6}>
|
||||||
|
<Form.Item dependencies={[
|
||||||
|
['filters', field.name, "field"],
|
||||||
|
['filters', field.name, "operator"]
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
() => {
|
||||||
|
// Because it looks cleaner than inlining.
|
||||||
|
const name = form.getFieldValue(['filters', field.name, "field"]);
|
||||||
|
const type = filters.find(f => f.name === name)?.type;
|
||||||
|
const reflector = filters.find(f => f.name === name)?.reflector;
|
||||||
|
const operator = form.getFieldValue(['filters', field.name, "operator"]);
|
||||||
|
const operatorType = operator ? getWhereOperatorsByType(type).find((o) => o.value === operator)?.type : null;
|
||||||
|
|
||||||
|
return <Form.Item
|
||||||
|
key={`${index}value`}
|
||||||
|
label={t('reportcenter.labels.advanced_filters_filter_value')}
|
||||||
|
name={[field.name, "value"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
(() => {
|
||||||
|
const generateReflections = (reflector) => {
|
||||||
|
if (!reflector) return [];
|
||||||
|
|
||||||
|
const {name} = reflector;
|
||||||
|
const path = name?.split('.');
|
||||||
|
const upperPath = path?.[0];
|
||||||
|
const finalPath = path?.slice(1).join('.');
|
||||||
|
|
||||||
|
return generateInternalReflections({
|
||||||
|
bodyshop,
|
||||||
|
upperPath,
|
||||||
|
finalPath,
|
||||||
|
t
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const reflections = reflector ? generateReflections(reflector) : [];
|
||||||
|
const fieldPath = [[field.name, "value"]];
|
||||||
|
// We have reflections so we will use a select box
|
||||||
|
if (reflections.length > 0) {
|
||||||
|
// We have reflections and the operator type is array, so we will use a select box with multiple options
|
||||||
|
if (operatorType === "array") {
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
disabled={!operator}
|
||||||
|
mode="multiple"
|
||||||
|
options={reflections}
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
onChange={(value) => {
|
||||||
|
form.setFieldValue(fieldPath, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
options={reflections}
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
onChange={(value) => {
|
||||||
|
form.setFieldValue(fieldPath, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have a type of number, so we will use a number input
|
||||||
|
if (type === "number") {
|
||||||
|
return (
|
||||||
|
<InputNumber
|
||||||
|
disabled={!operator}
|
||||||
|
onChange={(value) => form.setFieldValue(fieldPath, value)}/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have a type of date, so we will use a date picker
|
||||||
|
if (type === "date") {
|
||||||
|
return (
|
||||||
|
<FormDatePicker
|
||||||
|
disabled={!operator}
|
||||||
|
onChange={(date) => form.setFieldValue(fieldPath, date)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// we have a type of boolean, so we will use a select box with a true or false option.
|
||||||
|
if (type === "boolean" || type === "bool") {
|
||||||
|
return (
|
||||||
|
<Select
|
||||||
|
disabled={!operator}
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
label: t('reportcenter.labels.advanced_filters_true'),
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('reportcenter.labels.advanced_filters_false'),
|
||||||
|
value: false
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
onChange={(value) => form.setFieldValue(fieldPath, value)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Input
|
||||||
|
disabled={!operator}
|
||||||
|
onChange={(e) => form.setFieldValue(fieldPath, e.target.value)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
</Form.Item>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
</Col>
|
||||||
|
<Col span={2}>
|
||||||
|
<DeleteFilled
|
||||||
|
style={{margin: "1rem", paddingTop: '23px'}}
|
||||||
|
onClick={() => {
|
||||||
|
remove(field.name);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Form.Item>
|
||||||
|
))}
|
||||||
|
<Form.Item>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
onClick={() => {
|
||||||
|
add();
|
||||||
|
}}
|
||||||
|
style={{width: "100%"}}
|
||||||
|
>
|
||||||
|
{t("general.actions.add")}
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.List>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorters Section
|
||||||
|
* @param sorters
|
||||||
|
* @param form
|
||||||
|
* @returns {JSX.Element}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function SortersSection({sorters}) {
|
||||||
|
const {t} = useTranslation();
|
||||||
|
return (
|
||||||
|
<Card type='inner' title={t('reportcenter.labels.advanced_filters_sorters')} style={{marginTop: '10px'}}>
|
||||||
|
<Form.List name={["sorters"]}>
|
||||||
|
{(fields, {add, remove}) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Sorters
|
||||||
|
{fields.map((field, index) => (
|
||||||
|
<Form.Item key={field.key}>
|
||||||
|
<Row gutter={[16, 16]}>
|
||||||
|
<Col span={11}>
|
||||||
|
<Form.Item
|
||||||
|
key={`${index}field`}
|
||||||
|
label={t('reportcenter.labels.advanced_filters_sorter_field')}
|
||||||
|
name={[field.name, "field"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
options={
|
||||||
|
sorters.map((f) => ({
|
||||||
|
value: f.name,
|
||||||
|
label: f?.translation ? (t(f.translation) === f.translation ? f.label : t(f.translation)) : f.label,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={11}>
|
||||||
|
<Form.Item
|
||||||
|
key={`${index}direction`}
|
||||||
|
label={t('reportcenter.labels.advanced_filters_sorter_direction')}
|
||||||
|
name={[field.name, "direction"]}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
options={getOrderOperatorsByType()}
|
||||||
|
getPopupContainer={trigger => trigger.parentNode}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
|
||||||
|
<Col span={2}>
|
||||||
|
<DeleteFilled
|
||||||
|
style={{margin: "1rem", paddingTop: '23px'}}
|
||||||
|
onClick={() => {
|
||||||
|
remove(field.name);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Form.Item>
|
||||||
|
))}
|
||||||
|
<Form.Item>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
onClick={() => {
|
||||||
|
add();
|
||||||
|
}}
|
||||||
|
style={{width: "100%"}}
|
||||||
|
>
|
||||||
|
{t("general.actions.add")}
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.List>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render Filters
|
||||||
|
* @param templateId
|
||||||
|
* @param form
|
||||||
|
* @param bodyshop
|
||||||
|
* @returns {JSX.Element|null}
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function RenderFilters({templateId, form, bodyshop}) {
|
||||||
|
const [state, setState] = useState(null);
|
||||||
|
const [visible, setVisible] = useState(false);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const {t} = useTranslation();
|
||||||
|
|
||||||
|
const fetch = useCallback(async () => {
|
||||||
|
// Reset all the filters and Sorters.
|
||||||
|
form.resetFields(['filters']);
|
||||||
|
form.resetFields(['sorters']);
|
||||||
|
form.resetFields(['defaultSorters']);
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
|
const data = await fetchFilterData({name: templateId});
|
||||||
|
|
||||||
|
// We have Success
|
||||||
|
if (data?.success) {
|
||||||
|
if (data?.data?.sorters && data?.data?.sorters.length > 0) {
|
||||||
|
const defaultSorters = data?.data?.sorters.filter((sorter) => sorter.hasOwnProperty('default')).map((sorter) => {
|
||||||
|
return {
|
||||||
|
field: sorter.name,
|
||||||
|
direction: sorter.default.direction
|
||||||
|
};
|
||||||
|
}).sort((a, b) => a.default.order - b.default.order);
|
||||||
|
|
||||||
|
form.setFieldValue('defaultSorters', JSON.stringify(defaultSorters));
|
||||||
|
}
|
||||||
|
// Set the state
|
||||||
|
setState(data.data);
|
||||||
|
}
|
||||||
|
// Something went wrong fetching filter data
|
||||||
|
else {
|
||||||
|
setState(null);
|
||||||
|
}
|
||||||
|
setIsLoading(false);
|
||||||
|
}, [templateId, form]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (templateId) {
|
||||||
|
fetch();
|
||||||
|
|
||||||
|
}
|
||||||
|
}, [templateId, fetch]);
|
||||||
|
|
||||||
|
const filters = useMemo(() => state?.filters || [], [state]);
|
||||||
|
const sorters = useMemo(() => state?.sorters || [], [state]);
|
||||||
|
|
||||||
|
if (!templateId) return null;
|
||||||
|
if (isLoading) return <LoadingSkeleton/>;
|
||||||
|
if (!state) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{marginTop: '10px'}}>
|
||||||
|
<Checkbox
|
||||||
|
checked={visible}
|
||||||
|
onChange={(e) => setVisible(e.target.checked)}
|
||||||
|
children={t('reportcenter.labels.advanced_filters')}
|
||||||
|
/>
|
||||||
|
{visible && (
|
||||||
|
<div>
|
||||||
|
{filters.length > 0 && (
|
||||||
|
<FiltersSection filters={filters} form={form} bodyshop={bodyshop}/>
|
||||||
|
)}
|
||||||
|
{sorters.length > 0 && (
|
||||||
|
<SortersSection sorters={sorters} form={form}/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
import {uniqBy} from "lodash";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get value from path
|
||||||
|
* @param obj
|
||||||
|
* @param path
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
const getValueFromPath = (obj, path) => path.split('.').reduce((prev, curr) => prev?.[curr], obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate options from array
|
||||||
|
* @param bodyshop
|
||||||
|
* @param path
|
||||||
|
* @returns {unknown[]}
|
||||||
|
*/
|
||||||
|
const generateOptionsFromArray = (bodyshop, path) => {
|
||||||
|
const options = getValueFromPath(bodyshop, path);
|
||||||
|
return uniqBy(options.map((value) => ({
|
||||||
|
label: value,
|
||||||
|
value: value,
|
||||||
|
})), 'value');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid internal reflections
|
||||||
|
* Note: This is intended for future functionality
|
||||||
|
* @type {{special: string[], bodyshop: [{name: string, type: string}]}}
|
||||||
|
*/
|
||||||
|
const VALID_INTERNAL_REFLECTIONS = {
|
||||||
|
bodyshop: [
|
||||||
|
{
|
||||||
|
name: 'md_ro_statuses.statuses',
|
||||||
|
type: 'kv-to-v'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate options
|
||||||
|
* @param bodyshop
|
||||||
|
* @param path
|
||||||
|
* @param labelPath
|
||||||
|
* @param valuePath
|
||||||
|
* @returns {{label: *, value: *}[]}
|
||||||
|
*/
|
||||||
|
const generateOptionsFromObject = (bodyshop, path, labelPath, valuePath) => {
|
||||||
|
const options = getValueFromPath(bodyshop, path);
|
||||||
|
return uniqBy(Object.values(options).map((value) => ({
|
||||||
|
label: value[labelPath],
|
||||||
|
value: value[valuePath],
|
||||||
|
})), 'value');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate special reflections
|
||||||
|
* @param bodyshop
|
||||||
|
* @param finalPath
|
||||||
|
* @param t - i18n
|
||||||
|
* @returns {{label: *, value: *}[]|{label: *, value: *}[]|{label: string, value: *}[]|*[]}
|
||||||
|
*/
|
||||||
|
const generateSpecialReflections = (bodyshop, finalPath, t) => {
|
||||||
|
switch (finalPath) {
|
||||||
|
case 'payment_payers':
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: t("payments.labels.customer"),
|
||||||
|
value: t("payments.labels.customer"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t("payments.labels.insurance"),
|
||||||
|
value: t("payments.labels.insurance"),
|
||||||
|
},
|
||||||
|
// This is a weird one supposedly only used by one shop and could potentially be
|
||||||
|
// placed behind a SplitSDK
|
||||||
|
{
|
||||||
|
label: t("payments.labels.external"),
|
||||||
|
value: t("payments.labels.external"),
|
||||||
|
}
|
||||||
|
];
|
||||||
|
case 'payment_types':
|
||||||
|
return generateOptionsFromArray(bodyshop, 'md_payment_types');
|
||||||
|
case 'alt_transports':
|
||||||
|
return generateOptionsFromArray(bodyshop, 'appt_alt_transport');
|
||||||
|
case 'lost_sale_reasons':
|
||||||
|
return generateOptionsFromArray(bodyshop, 'md_lost_sale_reasons');
|
||||||
|
// Special case because Referral Sources is an Array, not an Object.
|
||||||
|
case 'referral_source':
|
||||||
|
return generateOptionsFromArray(bodyshop, 'md_referral_sources');
|
||||||
|
case 'class':
|
||||||
|
return generateOptionsFromArray(bodyshop, 'md_classes');
|
||||||
|
case 'cost_centers':
|
||||||
|
return generateOptionsFromObject(bodyshop, 'md_responsibility_centers.costs', 'name', 'name');
|
||||||
|
// Special case because Categories is an Array, not an Object.
|
||||||
|
case 'categories':
|
||||||
|
return generateOptionsFromArray(bodyshop, 'md_categories');
|
||||||
|
case 'insurance_companies':
|
||||||
|
return generateOptionsFromObject(bodyshop, 'md_ins_cos', 'name', 'name');
|
||||||
|
case 'employee_teams':
|
||||||
|
return generateOptionsFromObject(bodyshop, 'employee_teams', 'name', 'id');
|
||||||
|
// Special case because Employees uses a concatenation of first_name and last_name
|
||||||
|
case 'employees':
|
||||||
|
const employeesOptions = getValueFromPath(bodyshop, 'employees');
|
||||||
|
return uniqBy(Object.values(employeesOptions).map((value) => ({
|
||||||
|
label: `${value.first_name} ${value.last_name}`,
|
||||||
|
value: value.id,
|
||||||
|
})), 'value');
|
||||||
|
case 'last_names':
|
||||||
|
return generateOptionsFromObject(bodyshop, 'employees', 'last_name', 'last_name');
|
||||||
|
case 'first_names':
|
||||||
|
return generateOptionsFromObject(bodyshop, 'employees', 'first_name', 'first_name');
|
||||||
|
case 'job_statuses':
|
||||||
|
const statusOptions = getValueFromPath(bodyshop, 'md_ro_statuses.statuses');
|
||||||
|
return Object.values(statusOptions).map((value) => ({
|
||||||
|
label: value,
|
||||||
|
value
|
||||||
|
}));
|
||||||
|
default:
|
||||||
|
console.error('Invalid Special reflection provided by Report Filters');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate bodyshop reflections
|
||||||
|
* @param bodyshop
|
||||||
|
* @param finalPath
|
||||||
|
* @returns {{label: *, value: *}[]|*[]}
|
||||||
|
*/
|
||||||
|
const generateBodyshopReflections = (bodyshop, finalPath) => {
|
||||||
|
const options = getValueFromPath(bodyshop, finalPath);
|
||||||
|
const reflectionRenderer = VALID_INTERNAL_REFLECTIONS.bodyshop.find(reflection => reflection.name === finalPath);
|
||||||
|
if (reflectionRenderer?.type === 'kv-to-v') {
|
||||||
|
return Object.values(options).map((value) => ({
|
||||||
|
label: value,
|
||||||
|
value
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate internal reflections based on the path and bodyshop
|
||||||
|
* @param bodyshop
|
||||||
|
* @param upperPath
|
||||||
|
* @param finalPath
|
||||||
|
* @param t - i18n
|
||||||
|
* @returns {{label: *, value: *}[]|[]|{label: *, value: *}[]|{label: string, value: *}[]|{label: *, value: *}[]|*[]}
|
||||||
|
*/
|
||||||
|
const generateInternalReflections = ({bodyshop, upperPath, finalPath, t}) => {
|
||||||
|
switch (upperPath) {
|
||||||
|
case 'special':
|
||||||
|
return generateSpecialReflections(bodyshop, finalPath, t);
|
||||||
|
case 'bodyshop':
|
||||||
|
return generateBodyshopReflections(bodyshop, finalPath);
|
||||||
|
default:
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export {generateInternalReflections}
|
||||||
@@ -1,70 +1,64 @@
|
|||||||
import { useLazyQuery } from "@apollo/client";
|
import {useLazyQuery} from "@apollo/client";
|
||||||
import {
|
import {Button, Card, Col, DatePicker, Form, Input, Radio, Row, Typography,} from "antd";
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Col,
|
|
||||||
DatePicker,
|
|
||||||
Form,
|
|
||||||
Input,
|
|
||||||
Radio,
|
|
||||||
Row,
|
|
||||||
Typography,
|
|
||||||
} from "antd";
|
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, {useState} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { QUERY_ACTIVE_EMPLOYEES } from "../../graphql/employees.queries";
|
import {QUERY_ACTIVE_EMPLOYEES} from "../../graphql/employees.queries";
|
||||||
import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries";
|
import {QUERY_ALL_VENDORS} from "../../graphql/vendors.queries";
|
||||||
import { selectReportCenter } from "../../redux/modals/modals.selectors";
|
import {selectReportCenter} from "../../redux/modals/modals.selectors";
|
||||||
import DatePIckerRanges from "../../utils/DatePickerRanges";
|
import DatePickerRanges from "../../utils/DatePickerRanges";
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import {GenerateDocument} from "../../utils/RenderTemplate";
|
||||||
import { TemplateList } from "../../utils/TemplateConstants";
|
import {TemplateList} from "../../utils/TemplateConstants";
|
||||||
import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component";
|
import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component";
|
||||||
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
||||||
import "./report-center-modal.styles.scss";
|
import "./report-center-modal.styles.scss";
|
||||||
|
import ReportCenterModalFiltersSortersComponent from "./report-center-modal-filters-sorters-component";
|
||||||
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
reportCenterModal: selectReportCenter,
|
reportCenterModal: selectReportCenter,
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
});
|
});
|
||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(ReportCenterModalComponent);
|
)(ReportCenterModalComponent);
|
||||||
|
|
||||||
export function ReportCenterModalComponent({ reportCenterModal }) {
|
export function ReportCenterModalComponent({reportCenterModal, bodyshop}) {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const Templates = TemplateList("report_center");
|
const Templates = TemplateList("report_center");
|
||||||
const ReportsList = Object.keys(Templates).map((key) => {
|
const ReportsList = Object.keys(Templates).map((key) => {
|
||||||
return Templates[key];
|
return Templates[key];
|
||||||
});
|
});
|
||||||
const { visible } = reportCenterModal;
|
const {open} = reportCenterModal;
|
||||||
|
|
||||||
const [callVendorQuery, { data: vendorData, called: vendorCalled }] =
|
const [callVendorQuery, {data: vendorData, called: vendorCalled}] =
|
||||||
useLazyQuery(QUERY_ALL_VENDORS, {
|
useLazyQuery(QUERY_ALL_VENDORS, {
|
||||||
skip: !(
|
skip: !(
|
||||||
visible &&
|
open &&
|
||||||
Templates[form.getFieldValue("key")] &&
|
Templates[form.getFieldValue("key")] &&
|
||||||
Templates[form.getFieldValue("key")].idtype
|
Templates[form.getFieldValue("key")].idtype
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
const [callEmployeeQuery, { data: employeeData, called: employeeCalled }] =
|
const [callEmployeeQuery, {data: employeeData, called: employeeCalled}] =
|
||||||
useLazyQuery(QUERY_ACTIVE_EMPLOYEES, {
|
useLazyQuery(QUERY_ACTIVE_EMPLOYEES, {
|
||||||
skip: !(
|
skip: !(
|
||||||
visible &&
|
open &&
|
||||||
Templates[form.getFieldValue("key")] &&
|
Templates[form.getFieldValue("key")] &&
|
||||||
Templates[form.getFieldValue("key")].idtype
|
Templates[form.getFieldValue("key")].idtype
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -72,244 +66,256 @@ export function ReportCenterModalComponent({ reportCenterModal }) {
|
|||||||
const end = values.dates ? values.dates[1] : null;
|
const end = values.dates ? values.dates[1] : null;
|
||||||
const { id } = values;
|
const { id } = values;
|
||||||
|
|
||||||
await GenerateDocument(
|
const templateConfig = {
|
||||||
{
|
name: values.key,
|
||||||
name: values.key,
|
variables: {
|
||||||
variables: {
|
...(start
|
||||||
...(start
|
? {start: moment(start).startOf("day").format("YYYY-MM-DD")}
|
||||||
? { start: moment(start).startOf("day").format("YYYY-MM-DD") }
|
: {}),
|
||||||
: {}),
|
...(end ? {end: moment(end).endOf("day").format("YYYY-MM-DD")} : {}),
|
||||||
...(end
|
...(start ? {starttz: moment(start).startOf("day")} : {}),
|
||||||
? { end: moment(end).endOf("day").format("YYYY-MM-DD") }
|
...(end ? {endtz: moment(end).endOf("day")} : {}),
|
||||||
: {}),
|
|
||||||
...(start ? { starttz: moment(start).startOf("day") } : {}),
|
|
||||||
...(end ? { endtz: moment(end).endOf("day") } : {}),
|
|
||||||
|
|
||||||
...(id ? { id: id } : {}),
|
...(id ? {id: id} : {}),
|
||||||
|
},
|
||||||
|
filters: values.filters,
|
||||||
|
sorters: values.sorters,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_.isString(values.defaultSorters) && !_.isEmpty(values.defaultSorters)) {
|
||||||
|
templateConfig.defaultSorters = JSON.parse(values.defaultSorters);
|
||||||
|
}
|
||||||
|
|
||||||
|
await GenerateDocument(
|
||||||
|
templateConfig,
|
||||||
|
{
|
||||||
|
to: values.to,
|
||||||
|
subject: Templates[values.key]?.subject,
|
||||||
},
|
},
|
||||||
},
|
values.sendbyexcel === "excel"
|
||||||
{
|
? "x"
|
||||||
to: values.to,
|
: values.sendby === "email"
|
||||||
subject: Templates[values.key]?.subject,
|
? "e"
|
||||||
},
|
: "p",
|
||||||
values.sendbyexcel === "excel"
|
id
|
||||||
? "x"
|
|
||||||
: values.sendby === "email"
|
|
||||||
? "e"
|
|
||||||
: "p",
|
|
||||||
id
|
|
||||||
);
|
);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const FilteredReportsList =
|
const FilteredReportsList =
|
||||||
search !== ""
|
search !== ""
|
||||||
? ReportsList.filter((r) =>
|
? ReportsList.filter((r) =>
|
||||||
r.title.toLowerCase().includes(search.toLowerCase())
|
r.title.toLowerCase().includes(search.toLowerCase())
|
||||||
)
|
)
|
||||||
: ReportsList;
|
: ReportsList;
|
||||||
|
|
||||||
//Group it, create cards, and then filter out.
|
//Group it, create cards, and then filter out.
|
||||||
|
|
||||||
const grouped = _.groupBy(FilteredReportsList, "group");
|
const grouped = _.groupBy(FilteredReportsList, "group");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Form
|
<Form
|
||||||
onFinish={handleFinish}
|
onFinish={handleFinish}
|
||||||
autoComplete={"off"}
|
autoComplete={"off"}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
form={form}
|
form={form}
|
||||||
>
|
|
||||||
<Input.Search
|
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
|
||||||
value={search}
|
|
||||||
/>
|
|
||||||
<Form.Item
|
|
||||||
name="key"
|
|
||||||
label={t("reportcenter.labels.key")}
|
|
||||||
// className="radio-group-columns"
|
|
||||||
rules={[
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<Radio.Group>
|
<Input.Search
|
||||||
{/* {Object.keys(Templates).map((key) => (
|
onChange={(e) => setSearch(e.target.value)}
|
||||||
|
value={search}
|
||||||
|
/>
|
||||||
|
<Form.Item name="defaultSorters" hidden/>
|
||||||
|
<Form.Item
|
||||||
|
name="key"
|
||||||
|
label={t("reportcenter.labels.key")}
|
||||||
|
// className="radio-group-columns"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Radio.Group>
|
||||||
|
{/* {Object.keys(Templates).map((key) => (
|
||||||
<Radio key={key} value={key}>
|
<Radio key={key} value={key}>
|
||||||
{Templates[key].title}
|
{Templates[key].title}
|
||||||
</Radio>
|
</Radio>
|
||||||
))} */}
|
))} */}
|
||||||
|
|
||||||
<Row gutter={[16, 16]}>
|
<Row gutter={[16, 16]}>
|
||||||
{Object.keys(grouped).map((key) => (
|
{Object.keys(grouped).map((key) => (
|
||||||
<Col md={8} sm={12} key={key}>
|
<Col md={8} sm={12} key={key}>
|
||||||
<Card.Grid
|
<Card.Grid
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
maxHeight: "33vh",
|
maxHeight: "33vh",
|
||||||
overflowY: "scroll",
|
overflowY: "scroll",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography.Title level={4}>
|
<Typography.Title level={4}>
|
||||||
{t(`reportcenter.labels.groups.${key}`)}
|
{t(`reportcenter.labels.groups.${key}`)}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
<ul style={{ columns: "2 auto" }}>
|
<ul style={{ listStyleType: 'none', columns: "2 auto"}}>
|
||||||
{grouped[key].map((item) => (
|
{grouped[key].map((item) => (
|
||||||
<li key={item.key}>
|
<li key={item.key}>
|
||||||
<Radio key={item.key} value={item.key}>
|
<Radio key={item.key} value={item.key}>
|
||||||
{item.title}
|
{item.title}
|
||||||
</Radio>
|
</Radio>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</Card.Grid>
|
</Card.Grid>
|
||||||
</Col>
|
</Col>
|
||||||
))}
|
))}
|
||||||
</Row>
|
</Row>
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
<Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
|
||||||
{() => {
|
{() => {
|
||||||
const key = form.getFieldValue("key");
|
const key = form.getFieldValue("key");
|
||||||
if (!key) return null;
|
if (!key) return null;
|
||||||
//Kind of Id
|
//Kind of Id
|
||||||
const rangeFilter = Templates[key] && Templates[key].rangeFilter;
|
const rangeFilter = Templates[key] && Templates[key].rangeFilter;
|
||||||
if (!rangeFilter) return null;
|
if (!rangeFilter) return null;
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{t("reportcenter.labels.filterson", {
|
|
||||||
object: rangeFilter.object,
|
|
||||||
field: rangeFilter.field,
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
|
||||||
{() => {
|
|
||||||
const key = form.getFieldValue("key");
|
|
||||||
const currentId = form.getFieldValue("id");
|
|
||||||
if (!key) return null;
|
|
||||||
//Kind of Id
|
|
||||||
const idtype = Templates[key] && Templates[key].idtype;
|
|
||||||
if (!idtype && currentId) {
|
|
||||||
form.setFieldsValue({ id: null });
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!vendorCalled && idtype === "vendor") callVendorQuery();
|
|
||||||
if (!employeeCalled && idtype === "employee") callEmployeeQuery();
|
|
||||||
if (idtype === "vendor")
|
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<div>
|
||||||
name="id"
|
{t("reportcenter.labels.filterson", {
|
||||||
label={t("reportcenter.labels.vendor")}
|
object: rangeFilter.object,
|
||||||
rules={[
|
field: rangeFilter.field,
|
||||||
{
|
})}
|
||||||
required: true,
|
</div>
|
||||||
//message: t("general.validation.required"),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<VendorSearchSelect
|
|
||||||
options={vendorData ? vendorData.vendors : []}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
);
|
);
|
||||||
if (idtype === "employee")
|
}}
|
||||||
return (
|
</Form.Item>
|
||||||
<Form.Item
|
<ReportCenterModalFiltersSortersComponent form={form} bodyshop={bodyshop} />
|
||||||
name="id"
|
<Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
|
||||||
label={t("reportcenter.labels.employee")}
|
{() => {
|
||||||
rules={[
|
const key = form.getFieldValue("key");
|
||||||
{
|
const currentId = form.getFieldValue("id");
|
||||||
required: true,
|
if (!key) return null;
|
||||||
//message: t("general.validation.required"),
|
//Kind of Id
|
||||||
},
|
const idtype = Templates[key] && Templates[key].idtype;
|
||||||
]}
|
if (!idtype && currentId) {
|
||||||
>
|
form.setFieldsValue({id: null});
|
||||||
<EmployeeSearchSelect
|
return null;
|
||||||
options={employeeData ? employeeData.employees : []}
|
}
|
||||||
/>
|
if (!vendorCalled && idtype === "vendor") callVendorQuery();
|
||||||
</Form.Item>
|
if (!employeeCalled && idtype === "employee") callEmployeeQuery();
|
||||||
);
|
if (idtype === "vendor")
|
||||||
else return null;
|
return (
|
||||||
}}
|
<Form.Item
|
||||||
</Form.Item>
|
name="id"
|
||||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
label={t("reportcenter.labels.vendor")}
|
||||||
{() => {
|
rules={[
|
||||||
const key = form.getFieldValue("key");
|
{
|
||||||
const datedisable = Templates[key] && Templates[key].datedisable;
|
required: true,
|
||||||
if (datedisable !== true) {
|
//message: t("general.validation.required"),
|
||||||
return (
|
},
|
||||||
<Form.Item
|
]}
|
||||||
name="dates"
|
>
|
||||||
label={t("reportcenter.labels.dates")}
|
<VendorSearchSelect
|
||||||
rules={[
|
options={vendorData ? vendorData.vendors : []}
|
||||||
{
|
/>
|
||||||
required: true,
|
</Form.Item>
|
||||||
//message: t("general.validation.required"),
|
);
|
||||||
},
|
if (idtype === "employee")
|
||||||
]}
|
return (
|
||||||
>
|
<Form.Item
|
||||||
<DatePicker.RangePicker
|
name="id"
|
||||||
format="MM/DD/YYYY"
|
label={t("reportcenter.labels.employee")}
|
||||||
ranges={DatePIckerRanges}
|
rules={[
|
||||||
/>
|
{
|
||||||
</Form.Item>
|
required: true,
|
||||||
);
|
//message: t("general.validation.required"),
|
||||||
} else return null;
|
},
|
||||||
}}
|
]}
|
||||||
</Form.Item>
|
>
|
||||||
<Form.Item style={{ margin: 0, padding: 0 }} dependencies={["key"]}>
|
<EmployeeSearchSelect
|
||||||
{() => {
|
options={employeeData ? employeeData.employees : []}
|
||||||
const key = form.getFieldValue("key");
|
/>
|
||||||
//Kind of Id
|
</Form.Item>
|
||||||
const reporttype = Templates[key] && Templates[key].reporttype;
|
);
|
||||||
|
else return null;
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
|
||||||
|
{() => {
|
||||||
|
const key = form.getFieldValue("key");
|
||||||
|
const datedisable = Templates[key] && Templates[key].datedisable;
|
||||||
|
|
||||||
if (reporttype === "excel")
|
// TODO: MERGE NOTE, Ranges turns to presets in DatePicker.RangePicker
|
||||||
return (
|
|
||||||
<Form.Item
|
|
||||||
label={t("general.labels.sendby")}
|
|
||||||
name="sendbyexcel"
|
|
||||||
initialValue="excel"
|
|
||||||
>
|
|
||||||
<Radio.Group>
|
|
||||||
<Radio value="excel">{t("general.labels.excel")}</Radio>
|
|
||||||
</Radio.Group>
|
|
||||||
</Form.Item>
|
|
||||||
);
|
|
||||||
if (reporttype !== "excel")
|
|
||||||
return (
|
|
||||||
<Form.Item
|
|
||||||
label={t("general.labels.sendby")}
|
|
||||||
name="sendby"
|
|
||||||
initialValue="print"
|
|
||||||
>
|
|
||||||
<Radio.Group>
|
|
||||||
<Radio value="email">{t("general.labels.email")}</Radio>
|
|
||||||
<Radio value="print">{t("general.labels.print")}</Radio>
|
|
||||||
</Radio.Group>
|
|
||||||
</Form.Item>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<div
|
if (datedisable !== true) {
|
||||||
style={{
|
return (
|
||||||
display: "flex",
|
<Form.Item
|
||||||
justifyContent: "center",
|
name="dates"
|
||||||
marginTop: "1rem",
|
label={t("reportcenter.labels.dates")}
|
||||||
}}
|
rules={[
|
||||||
>
|
{
|
||||||
<Button onClick={() => form.submit()} style={{}} loading={loading}>
|
required: true,
|
||||||
{t("reportcenter.actions.generate")}
|
//message: t("general.validation.required"),
|
||||||
</Button>
|
},
|
||||||
</div>
|
]}
|
||||||
</Form>
|
>
|
||||||
</div>
|
<DatePicker.RangePicker
|
||||||
|
format="MM/DD/YYYY"
|
||||||
|
ranges={DatePickerRanges}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
} else return null;
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
|
||||||
|
{() => {
|
||||||
|
const key = form.getFieldValue("key");
|
||||||
|
//Kind of Id
|
||||||
|
const reporttype = Templates[key] && Templates[key].reporttype;
|
||||||
|
|
||||||
|
if (reporttype === "excel")
|
||||||
|
return (
|
||||||
|
<Form.Item
|
||||||
|
label={t("general.labels.sendby")}
|
||||||
|
name="sendbyexcel"
|
||||||
|
initialValue="excel"
|
||||||
|
>
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value="excel">{t("general.labels.excel")}</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
if (reporttype !== "excel")
|
||||||
|
return (
|
||||||
|
<Form.Item
|
||||||
|
label={t("general.labels.sendby")}
|
||||||
|
name="sendby"
|
||||||
|
initialValue="print"
|
||||||
|
>
|
||||||
|
<Radio.Group>
|
||||||
|
<Radio value="email">{t("general.labels.email")}</Radio>
|
||||||
|
<Radio value="print">{t("general.labels.print")}</Radio>
|
||||||
|
</Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
marginTop: "1rem",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button onClick={() => form.submit()} style={{}} loading={loading}>
|
||||||
|
{t("reportcenter.actions.generate")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Icon from "@ant-design/icons";
|
import Icon from "@ant-design/icons";
|
||||||
import { Popover } from "antd";
|
import { Popover, Space } from "antd";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useMemo } from "react";
|
import React, { useMemo } from "react";
|
||||||
@@ -69,19 +69,22 @@ export function ScheduleCalendarHeaderComponent({
|
|||||||
{loadData && loadData.allJobsOut ? (
|
{loadData && loadData.allJobsOut ? (
|
||||||
loadData.allJobsOut.map((j) => (
|
loadData.allJobsOut.map((j) => (
|
||||||
<tr key={j.id}>
|
<tr key={j.id}>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link>
|
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link> (
|
||||||
|
{j.status})
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
<OwnerNameDisplay ownerObject={j} />
|
<OwnerNameDisplay ownerObject={j} />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
{`(${(
|
{`(${j.labhrs?.aggregate?.sum?.mod_lb_hrs?.toFixed(1) || 0}/${
|
||||||
j.labhrs.aggregate.sum.mod_lb_hrs +
|
j.larhrs?.aggregate?.sum?.mod_lb_hrs?.toFixed(1) || 0
|
||||||
j.larhrs.aggregate.sum.mod_lb_hrs
|
}/${(
|
||||||
|
j.labhrs.aggregate?.sum?.mod_lb_hrs +
|
||||||
|
j.larhrs.aggregate?.sum?.mod_lb_hrs
|
||||||
).toFixed(1)} ${t("general.labels.hours")})`}
|
).toFixed(1)} ${t("general.labels.hours")})`}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
<DateTimeFormatter>
|
<DateTimeFormatter>
|
||||||
{j.scheduled_completion}
|
{j.scheduled_completion}
|
||||||
</DateTimeFormatter>
|
</DateTimeFormatter>
|
||||||
@@ -90,7 +93,9 @@ export function ScheduleCalendarHeaderComponent({
|
|||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<tr>
|
<tr>
|
||||||
<td>{t("appointments.labels.nocompletingjobs")}</td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
|
{t("appointments.labels.nocompletingjobs")}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -105,27 +110,30 @@ export function ScheduleCalendarHeaderComponent({
|
|||||||
{loadData && loadData.allJobsIn ? (
|
{loadData && loadData.allJobsIn ? (
|
||||||
loadData.allJobsIn.map((j) => (
|
loadData.allJobsIn.map((j) => (
|
||||||
<tr key={j.id}>
|
<tr key={j.id}>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link>
|
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link>
|
||||||
{j.status}
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
<OwnerNameDisplay ownerObject={j} />
|
<OwnerNameDisplay ownerObject={j} />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
{`(${(
|
{`(${j.labhrs?.aggregate?.sum.mod_lb_hrs?.toFixed(1) || 0}/${
|
||||||
j.labhrs.aggregate.sum.mod_lb_hrs +
|
j.larhrs?.aggregate?.sum?.mod_lb_hrs?.toFixed(1) || 0
|
||||||
j.larhrs.aggregate.sum.mod_lb_hrs
|
}/${(
|
||||||
|
j.labhrs?.aggregate?.sum?.mod_lb_hrs +
|
||||||
|
j.larhrs?.aggregate?.sum?.mod_lb_hrs
|
||||||
).toFixed(1)} ${t("general.labels.hours")})`}
|
).toFixed(1)} ${t("general.labels.hours")})`}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
<DateTimeFormatter>{j.scheduled_in}</DateTimeFormatter>
|
<DateTimeFormatter>{j.scheduled_in}</DateTimeFormatter>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<tr>
|
<tr>
|
||||||
<td>{t("appointments.labels.noarrivingjobs")}</td>
|
<td style={{ padding: "2.5px" }}>
|
||||||
|
{t("appointments.labels.noarrivingjobs")}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -136,25 +144,32 @@ export function ScheduleCalendarHeaderComponent({
|
|||||||
const LoadComponent = loadData ? (
|
const LoadComponent = loadData ? (
|
||||||
<div>
|
<div>
|
||||||
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
<div className="imex-flex-row imex-flex-row__flex-space-around">
|
||||||
<Popover
|
<Space>
|
||||||
placement={"bottom"}
|
<Popover
|
||||||
content={jobsInPopup}
|
placement={"bottom"}
|
||||||
trigger="hover"
|
content={jobsInPopup}
|
||||||
title={t("appointments.labels.arrivingjobs")}
|
trigger="hover"
|
||||||
>
|
title={t("appointments.labels.arrivingjobs")}
|
||||||
<Icon component={MdFileDownload} style={{ color: "green" }} />
|
>
|
||||||
{(loadData.allHoursIn || 0) && loadData.allHoursIn.toFixed(2)}
|
<Icon component={MdFileDownload} style={{ color: "green" }} />
|
||||||
</Popover>
|
{(loadData.allHoursInBody || 0) &&
|
||||||
<Popover
|
loadData.allHoursInBody.toFixed(1)}
|
||||||
placement={"bottom"}
|
/
|
||||||
content={jobsOutPopup}
|
{(loadData.allHoursInRefinish || 0) &&
|
||||||
trigger="hover"
|
loadData.allHoursInRefinish.toFixed(1)}
|
||||||
title={t("appointments.labels.completingjobs")}
|
/{(loadData.allHoursIn || 0) && loadData.allHoursIn.toFixed(1)}
|
||||||
>
|
</Popover>
|
||||||
<Icon component={MdFileUpload} style={{ color: "red" }} />
|
<Popover
|
||||||
{(loadData.allHoursOut || 0) && loadData.allHoursOut.toFixed(2)}
|
placement={"bottom"}
|
||||||
</Popover>
|
content={jobsOutPopup}
|
||||||
<ScheduleCalendarHeaderGraph loadData={loadData} />
|
trigger="hover"
|
||||||
|
title={t("appointments.labels.completingjobs")}
|
||||||
|
>
|
||||||
|
<Icon component={MdFileUpload} style={{ color: "red" }} />
|
||||||
|
{(loadData.allHoursOut || 0) && loadData.allHoursOut.toFixed(1)}
|
||||||
|
</Popover>
|
||||||
|
<ScheduleCalendarHeaderGraph loadData={loadData} />
|
||||||
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul style={{ listStyleType: "none", columns: "2 auto", padding: 0 }}>
|
<ul style={{ listStyleType: "none", columns: "2 auto", padding: 0 }}>
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
toggleModalVisible: () => dispatch(toggleModalVisible("schedule")),
|
toggleModalVisible: () => dispatch(toggleModalVisible("schedule")),
|
||||||
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
setEmailOptions: (e) => dispatch(setEmailOptions(e)),
|
||||||
insertAuditTrail: ({ jobid, operation }) =>
|
insertAuditTrail: ({ jobid, operation, type }) =>
|
||||||
dispatch(insertAuditTrail({ jobid, operation })),
|
dispatch(insertAuditTrail({ jobid, operation, type })),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function ScheduleJobModalContainer({
|
export function ScheduleJobModalContainer({
|
||||||
@@ -146,6 +146,7 @@ export function ScheduleJobModalContainer({
|
|||||||
operation: AuditTrailMapping.appointmentinsert(
|
operation: AuditTrailMapping.appointmentinsert(
|
||||||
DateTimeFormat(values.start)
|
DateTimeFormat(values.start)
|
||||||
),
|
),
|
||||||
|
type: "appointmentinsert",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
|||||||
return acc + value.bodyhrs;
|
return acc + value.bodyhrs;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
|
const numJobs = entries.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={moment(date).format("D - ddd")}
|
title={moment(date).format("D - ddd")}
|
||||||
@@ -33,17 +35,18 @@ export function ScoreboardDayStats({ bodyshop, date, entries }) {
|
|||||||
>
|
>
|
||||||
<Statistic
|
<Statistic
|
||||||
valueStyle={{ color: dailyBodyTarget > bodyHrs ? "red" : "green" }}
|
valueStyle={{ color: dailyBodyTarget > bodyHrs ? "red" : "green" }}
|
||||||
label="B"
|
label="Body"
|
||||||
value={bodyHrs.toFixed(1)}
|
value={bodyHrs.toFixed(1)}
|
||||||
/>
|
/>
|
||||||
<Statistic
|
<Statistic
|
||||||
valueStyle={{ color: dailyPaintTarget > paintHrs ? "red" : "green" }}
|
valueStyle={{ color: dailyPaintTarget > paintHrs ? "red" : "green" }}
|
||||||
label="P"
|
label="Refinish"
|
||||||
value={paintHrs.toFixed(1)}
|
value={paintHrs.toFixed(1)}
|
||||||
/>
|
/>
|
||||||
<Divider style={{ margin: 0 }} />
|
<Divider style={{ margin: 0 }} />
|
||||||
|
<Statistic label="Total" value={(bodyHrs + paintHrs).toFixed(1)} />
|
||||||
<Statistic value={(bodyHrs + paintHrs).toFixed(1)} />
|
<Divider style={{ margin: 0 }} />
|
||||||
|
<Statistic label="Jobs" value={numJobs} />
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
import { useMutation } from "@apollo/client";
|
import { useMutation } from "@apollo/client";
|
||||||
import { Button, Card, Dropdown, Form, InputNumber, notification } from "antd";
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Dropdown,
|
||||||
|
Form,
|
||||||
|
InputNumber,
|
||||||
|
notification,
|
||||||
|
Space,
|
||||||
|
} from "antd";
|
||||||
|
import moment from "moment";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { UPDATE_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
|
import { UPDATE_SCOREBOARD_ENTRY } from "../../graphql/scoreboard.queries";
|
||||||
@@ -13,6 +22,7 @@ export default function ScoreboardEntryEdit({ entry }) {
|
|||||||
|
|
||||||
const handleFinish = async (values) => {
|
const handleFinish = async (values) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
values.date = moment(values.date).format("YYYY-MM-DD");
|
||||||
const result = await updateScoreboardentry({
|
const result = await updateScoreboardentry({
|
||||||
variables: { sbId: entry.id, sbInput: values },
|
variables: { sbId: entry.id, sbInput: values },
|
||||||
});
|
});
|
||||||
@@ -77,13 +87,14 @@ export default function ScoreboardEntryEdit({ entry }) {
|
|||||||
>
|
>
|
||||||
<InputNumber precision={1} />
|
<InputNumber precision={1} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Space wrap>
|
||||||
<Button type="primary" loading={loading} htmlType="submit">
|
<Button type="primary" loading={loading} htmlType="submit">
|
||||||
{t("general.actions.save")}
|
{t("general.actions.save")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => setVisible(false)}>
|
<Button onClick={() => setVisible(false)}>
|
||||||
{t("general.actions.cancel")}
|
{t("general.actions.cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
|
</Space>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { SyncOutlined } from "@ant-design/icons";
|
||||||
import { useQuery } from "@apollo/client";
|
import { useQuery } from "@apollo/client";
|
||||||
import { Button, Card, Input, Modal, Space, Table, Typography } from "antd";
|
import { Button, Card, Input, Modal, Space, Table, Typography } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@@ -5,12 +6,14 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { QUERY_SCOREBOARD_PAGINATED } from "../../graphql/scoreboard.queries";
|
import { QUERY_SCOREBOARD_PAGINATED } from "../../graphql/scoreboard.queries";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
|
import { pageLimit } from "../../utils/config";
|
||||||
|
import { alphaSort, dateSort } from "../../utils/sorters";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay, {
|
||||||
|
OwnerNameDisplayFunction,
|
||||||
|
} from "../owner-name-display/owner-name-display.component";
|
||||||
import ScoreboardEntryEdit from "../scoreboard-entry-edit/scoreboard-entry-edit.component";
|
import ScoreboardEntryEdit from "../scoreboard-entry-edit/scoreboard-entry-edit.component";
|
||||||
import ScoreboardRemoveButton from "../scoreboard-remove-button/scorebard-remove-button.component";
|
import ScoreboardRemoveButton from "../scoreboard-remove-button/scorebard-remove-button.component";
|
||||||
import { SyncOutlined } from "@ant-design/icons";
|
|
||||||
import {pageLimit} from "../../utils/config";
|
|
||||||
export default function ScoreboardJobsList({ scoreBoardlist }) {
|
export default function ScoreboardJobsList({ scoreBoardlist }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
@@ -44,6 +47,7 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
dataIndex: "ro_number",
|
dataIndex: "ro_number",
|
||||||
key: "ro_number",
|
key: "ro_number",
|
||||||
|
sorter: (a, b) => alphaSort(a.job.ro_number, b.job.ro_number),
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={"/manage/jobs/" + record.job.id}>
|
<Link to={"/manage/jobs/" + record.job.id}>
|
||||||
{record.job.ro_number || t("general.labels.na")}
|
{record.job.ro_number || t("general.labels.na")}
|
||||||
@@ -55,7 +59,11 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
OwnerNameDisplayFunction(a.job),
|
||||||
|
OwnerNameDisplayFunction(b.job)
|
||||||
|
),
|
||||||
render: (text, record) => <OwnerNameDisplay ownerObject={record.job} />,
|
render: (text, record) => <OwnerNameDisplay ownerObject={record.job} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -63,6 +71,15 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
key: "vehicle",
|
key: "vehicle",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.job.v_model_yr || ""} ${a.job.v_make_desc || ""} ${
|
||||||
|
a.job.v_model_desc || ""
|
||||||
|
}`,
|
||||||
|
`${b.job.v_model_yr || ""} ${b.job.v_make_desc || ""} ${
|
||||||
|
b.job.v_model_desc || ""
|
||||||
|
}`
|
||||||
|
),
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>{`${record.job.v_model_yr || ""} ${
|
<span>{`${record.job.v_model_yr || ""} ${
|
||||||
record.job.v_make_desc || ""
|
record.job.v_make_desc || ""
|
||||||
@@ -73,17 +90,20 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
title: t("scoreboard.fields.date"),
|
title: t("scoreboard.fields.date"),
|
||||||
dataIndex: "date",
|
dataIndex: "date",
|
||||||
key: "date",
|
key: "date",
|
||||||
|
sorter: (a, b) => dateSort(a.date, b.date),
|
||||||
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
|
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: t("scoreboard.fields.painthrs"),
|
|
||||||
dataIndex: "painthrs",
|
|
||||||
key: "painthrs",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: t("scoreboard.fields.bodyhrs"),
|
title: t("scoreboard.fields.bodyhrs"),
|
||||||
dataIndex: "bodyhrs",
|
dataIndex: "bodyhrs",
|
||||||
key: "bodyhrs",
|
key: "bodyhrs",
|
||||||
|
sorter: (a, b) => Number(a.bodyhrs) - Number(b.bodyhrs),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("scoreboard.fields.painthrs"),
|
||||||
|
dataIndex: "painthrs",
|
||||||
|
key: "painthrs",
|
||||||
|
sorter: (a, b) => Number(a.painthrs) - Number(b.painthrs),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("general.labels.actions"),
|
title: t("general.labels.actions"),
|
||||||
@@ -104,8 +124,9 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
visible={state.visible}
|
visible={state.visible}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
width="80%"
|
width="80%"
|
||||||
|
closable={false}
|
||||||
cancelButtonProps={{ style: { display: "none" } }}
|
cancelButtonProps={{ style: { display: "none" } }}
|
||||||
onCancel={() =>
|
onOk={() =>
|
||||||
setState((state) => ({
|
setState((state) => ({
|
||||||
...state,
|
...state,
|
||||||
visible: false,
|
visible: false,
|
||||||
|
|||||||
@@ -29,10 +29,13 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
let ret = {
|
let ret = {
|
||||||
todayBody: 0,
|
todayBody: 0,
|
||||||
todayPaint: 0,
|
todayPaint: 0,
|
||||||
|
todayJobs: 0,
|
||||||
weeklyPaint: 0,
|
weeklyPaint: 0,
|
||||||
|
weeklyJobs: 0,
|
||||||
weeklyBody: 0,
|
weeklyBody: 0,
|
||||||
toDateBody: 0,
|
toDateBody: 0,
|
||||||
toDatePaint: 0,
|
toDatePaint: 0,
|
||||||
|
toDateJobs: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const today = moment();
|
const today = moment();
|
||||||
@@ -40,6 +43,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
dateHash[today.format("YYYY-MM-DD")].forEach((d) => {
|
dateHash[today.format("YYYY-MM-DD")].forEach((d) => {
|
||||||
ret.todayBody = ret.todayBody + d.bodyhrs;
|
ret.todayBody = ret.todayBody + d.bodyhrs;
|
||||||
ret.todayPaint = ret.todayPaint + d.painthrs;
|
ret.todayPaint = ret.todayPaint + d.painthrs;
|
||||||
|
ret.todayJobs++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +53,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => {
|
dateHash[StartOfWeek.format("YYYY-MM-DD")].forEach((d) => {
|
||||||
ret.weeklyBody = ret.weeklyBody + d.bodyhrs;
|
ret.weeklyBody = ret.weeklyBody + d.bodyhrs;
|
||||||
ret.weeklyPaint = ret.weeklyPaint + d.painthrs;
|
ret.weeklyPaint = ret.weeklyPaint + d.painthrs;
|
||||||
|
ret.weeklyJobs++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
StartOfWeek = StartOfWeek.add(1, "day");
|
StartOfWeek = StartOfWeek.add(1, "day");
|
||||||
@@ -60,6 +65,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
dateHash[startOfMonth.format("YYYY-MM-DD")].forEach((d) => {
|
dateHash[startOfMonth.format("YYYY-MM-DD")].forEach((d) => {
|
||||||
ret.toDateBody = ret.toDateBody + d.bodyhrs;
|
ret.toDateBody = ret.toDateBody + d.bodyhrs;
|
||||||
ret.toDatePaint = ret.toDatePaint + d.painthrs;
|
ret.toDatePaint = ret.toDatePaint + d.painthrs;
|
||||||
|
ret.toDateJobs++;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
startOfMonth = startOfMonth.add(1, "day");
|
startOfMonth = startOfMonth.add(1, "day");
|
||||||
@@ -87,7 +93,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
<Statistic
|
<Statistic
|
||||||
title={t("scoreboard.labels.dailytarget")}
|
title={t("scoreboard.labels.dailytarget")}
|
||||||
value={bodyshop.scoreboard_target.dailyBodyTarget}
|
value={bodyshop.scoreboard_target.dailyBodyTarget}
|
||||||
prefix="B"
|
prefix={t("scoreboard.labels.bodyabbrev")}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
@@ -140,7 +146,7 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={bodyshop.scoreboard_target.dailyPaintTarget}
|
value={bodyshop.scoreboard_target.dailyPaintTarget}
|
||||||
prefix="P"
|
prefix={t("scoreboard.labels.refinishabbrev")}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
@@ -181,7 +187,12 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
<Divider style={{ margin: 5 }} />
|
<Divider style={{ margin: 5 }} />
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Col {...statSpans}></Col>
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={"\u00A0"}
|
||||||
|
prefix={t("scoreboard.labels.total")}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
<Col {...statSpans}>
|
<Col {...statSpans}>
|
||||||
<Statistic
|
<Statistic
|
||||||
value={(values.todayPaint + values.todayBody).toFixed(1)}
|
value={(values.todayPaint + values.todayBody).toFixed(1)}
|
||||||
@@ -240,6 +251,29 @@ export function ScoreboardTargetsTable({ bodyshop, scoreBoardlist }) {
|
|||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Divider style={{ margin: 5 }} />
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic
|
||||||
|
value={"\u00A0"}
|
||||||
|
prefix={t("scoreboard.labels.jobs")}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={values.todayJobs} />
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans} />
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={values.weeklyJobs} />
|
||||||
|
</Col>
|
||||||
|
<Col {...statSpans} />
|
||||||
|
<Col {...statSpans} />
|
||||||
|
<Col {...statSpans}>
|
||||||
|
<Statistic value={values.toDateJobs} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
|
||||||
import { Form } from "antd";
|
import { Form } from "antd";
|
||||||
|
import React from "react";
|
||||||
import ConfigFormComponents from "../config-form-components/config-form-components.component";
|
import ConfigFormComponents from "../config-form-components/config-form-components.component";
|
||||||
|
|
||||||
export default function ShopCsiConfigForm({ selectedCsi }) {
|
export default function ShopCsiConfigForm({ selectedCsi }) {
|
||||||
@@ -9,7 +9,7 @@ export default function ShopCsiConfigForm({ selectedCsi }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
The Config Form {readOnly}
|
{readOnly}
|
||||||
{selectedCsi && (
|
{selectedCsi && (
|
||||||
<Form form={form} onFinish={handleFinish}>
|
<Form form={form} onFinish={handleFinish}>
|
||||||
<ConfigFormComponents
|
<ConfigFormComponents
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { CheckCircleFilled } from "@ant-design/icons";
|
import { CheckCircleFilled } from "@ant-design/icons";
|
||||||
|
import { useQuery } from "@apollo/client";
|
||||||
import { Button, Col, List, Row } from "antd";
|
import { Button, Col, List, Row } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useQuery } from "@apollo/client";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { GET_ALL_QUESTION_SETS } from "../../graphql/csi.queries";
|
import { GET_ALL_QUESTION_SETS } from "../../graphql/csi.queries";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import { DateFormatter } from "../../utils/DateFormatter";
|
||||||
@@ -21,7 +21,6 @@ export default function ShopCsiConfig() {
|
|||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
The Config Form
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col span={3}>
|
<Col span={3}>
|
||||||
<List
|
<List
|
||||||
@@ -42,7 +41,8 @@ export default function ShopCsiConfig() {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={21}>
|
<Col span={1} />
|
||||||
|
<Col span={20}>
|
||||||
<ShopCsiConfigForm selectedCsi={selectedCsi} />
|
<ShopCsiConfigForm selectedCsi={selectedCsi} />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
Input,
|
Input,
|
||||||
InputNumber,
|
InputNumber,
|
||||||
Select,
|
Select,
|
||||||
|
Space,
|
||||||
Switch,
|
Switch,
|
||||||
Typography,
|
Typography,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
@@ -17,6 +18,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { useTreatments } from "@splitsoftware/splitio-react";
|
import { useTreatments } from "@splitsoftware/splitio-react";
|
||||||
|
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||||
|
|
||||||
const SelectorDiv = styled.div`
|
const SelectorDiv = styled.div`
|
||||||
.ant-form-item .ant-select {
|
.ant-form-item .ant-select {
|
||||||
@@ -191,7 +193,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
<LayoutFormRow header={t("bodyshop.labels.dms.cdk.payers")}>
|
<LayoutFormRow header={t("bodyshop.labels.dms.cdk.payers")}>
|
||||||
<Form.List name={["cdk_configuration", "payers"]}>
|
<Form.List name={["cdk_configuration", "payers"]}>
|
||||||
{(fields, { add, remove }) => {
|
{(fields, { add, remove, move }) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
@@ -249,11 +251,18 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<DeleteFilled
|
<Space align="center">
|
||||||
onClick={() => {
|
<DeleteFilled
|
||||||
remove(field.name);
|
onClick={() => {
|
||||||
}}
|
remove(field.name);
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
<FormListMoveArrows
|
||||||
|
move={move}
|
||||||
|
index={index}
|
||||||
|
total={fields.length}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
))}
|
))}
|
||||||
@@ -345,7 +354,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
id="costs"
|
id="costs"
|
||||||
>
|
>
|
||||||
<Form.List name={["md_responsibility_centers", "costs"]}>
|
<Form.List name={["md_responsibility_centers", "costs"]}>
|
||||||
{(fields, { add, remove }) => {
|
{(fields, { add, remove, move }) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
@@ -462,12 +471,18 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
<Input onBlur={handleBlur} />
|
<Input onBlur={handleBlur} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
|
<Space align="center">
|
||||||
<DeleteFilled
|
<DeleteFilled
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
remove(field.name);
|
remove(field.name);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<FormListMoveArrows
|
||||||
|
move={move}
|
||||||
|
index={index}
|
||||||
|
total={fields.length}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
))}
|
))}
|
||||||
@@ -493,7 +508,7 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
id="profits"
|
id="profits"
|
||||||
>
|
>
|
||||||
<Form.List name={["md_responsibility_centers", "profits"]}>
|
<Form.List name={["md_responsibility_centers", "profits"]}>
|
||||||
{(fields, { add, remove }) => {
|
{(fields, { add, remove, move }) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
@@ -595,11 +610,18 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
|
|||||||
<Input onBlur={handleBlur} />
|
<Input onBlur={handleBlur} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
<DeleteFilled
|
<Space align="center">
|
||||||
onClick={() => {
|
<DeleteFilled
|
||||||
remove(field.name);
|
onClick={() => {
|
||||||
}}
|
remove(field.name);
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
<FormListMoveArrows
|
||||||
|
move={move}
|
||||||
|
index={index}
|
||||||
|
total={fields.length}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
</LayoutFormRow>
|
</LayoutFormRow>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -39,8 +39,23 @@ export function ShopInfoROStatusComponent({ bodyshop, form }) {
|
|||||||
form.getFieldValue(["md_ro_statuses", "statuses"]) || []
|
form.getFieldValue(["md_ro_statuses", "statuses"]) || []
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [productionStatus, setProductionStatus] = useState(
|
||||||
|
(
|
||||||
|
form.getFieldValue(["md_ro_statuses", "production_statuses"]) || []
|
||||||
|
).concat(
|
||||||
|
form.getFieldValue(["md_ro_statuses", "additional_board_statuses"]) || []
|
||||||
|
) || []
|
||||||
|
);
|
||||||
|
|
||||||
const handleBlur = () => {
|
const handleBlur = () => {
|
||||||
setOptions(form.getFieldValue(["md_ro_statuses", "statuses"]));
|
setOptions(form.getFieldValue(["md_ro_statuses", "statuses"]));
|
||||||
|
setProductionStatus(
|
||||||
|
form
|
||||||
|
.getFieldValue(["md_ro_statuses", "production_statuses"])
|
||||||
|
.concat(
|
||||||
|
form.getFieldValue(["md_ro_statuses", "additional_board_statuses"])
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -346,7 +361,7 @@ export function ShopInfoROStatusComponent({ bodyshop, form }) {
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Select>
|
<Select>
|
||||||
{options.map((item, idx) => (
|
{productionStatus.map((item, idx) => (
|
||||||
<Select.Option key={idx} value={item}>
|
<Select.Option key={idx} value={item}>
|
||||||
{item}
|
{item}
|
||||||
</Select.Option>
|
</Select.Option>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user