diff --git a/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx b/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx index e54dfd7ab..4e9bfd975 100644 --- a/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx +++ b/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx @@ -1,10 +1,13 @@ import moment from "moment"; +import queryString from "query-string"; import React from "react"; import { Calendar, momentLocalizer } from "react-big-calendar"; -//import "react-big-calendar/lib/css/react-big-calendar.css"; -import "./schedule-calendar.styles.scss"; +import { useHistory, useLocation } from "react-router-dom"; import DateCellWrapper from "../schedule-datecellwrapper/schedule-datecellwrapper.component"; import Event from "../schedule-event/schedule-event.container"; +//import "react-big-calendar/lib/css/react-big-calendar.css"; +import "./schedule-calendar.styles.scss"; + const localizer = momentLocalizer(moment); export default function ScheduleCalendarWrapperComponent({ @@ -13,20 +16,26 @@ export default function ScheduleCalendarWrapperComponent({ defaultView, ...otherProps }) { + const search = queryString.parse(useLocation().search); + const history = useHistory(); + return ( { + search.date = date.toISOString().substr(0, 10); + history.push({ search: queryString.stringify(search) }); + }} step={30} showMultiDayTimes localizer={localizer} min={new Date("2020-01-01T06:00:00")} //TODO Read from business settings. max={new Date("2020-01-01T20:00:00")} components={{ - event: e => { - return Event({ event: e.event, refetch: refetch }); - }, - dateCellWrapper: DateCellWrapper + event: (e) => Event({ event: e.event, refetch: refetch }), + dateCellWrapper: DateCellWrapper, }} {...otherProps} /> diff --git a/client/src/components/schedule-calendar/schedule-calendar.container.jsx b/client/src/components/schedule-calendar/schedule-calendar.container.jsx index 8184eb686..a518dca98 100644 --- a/client/src/components/schedule-calendar/schedule-calendar.container.jsx +++ b/client/src/components/schedule-calendar/schedule-calendar.container.jsx @@ -12,7 +12,7 @@ export default function ScheduleCalendarContainer() { if (loading) return ; if (error) return ; - let normalizedData = data.appointments.map(e => { + let normalizedData = data.appointments.map((e) => { //Required becuase Hasura returns a string instead of a date object. return Object.assign( {}, diff --git a/hasura/migrations/1588869001045_run_sql_migration/down.yaml b/hasura/migrations/1588869001045_run_sql_migration/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1588869001045_run_sql_migration/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1588869001045_run_sql_migration/up.yaml b/hasura/migrations/1588869001045_run_sql_migration/up.yaml new file mode 100644 index 000000000..0203370b6 --- /dev/null +++ b/hasura/migrations/1588869001045_run_sql_migration/up.yaml @@ -0,0 +1,19 @@ +- args: + cascade: true + read_only: false + sql: "CREATE OR REPLACE VIEW \"public\".\"productionview\" AS \n SELECT j.id,\n + \ j.status,\n j.ro_number,\n j.est_number,\n j.ownr_fn,\n j.ownr_ln,\n + \ j.v_model_yr,\n j.v_model_desc,\n j.clm_no,\n j.v_make_desc,\n + \ j.v_color,\n j.plate_no,\n j.actual_in,\n j.scheduled_completion,\n + \ j.scheduled_delivery,\n j.ins_co_nm,\n j.clm_total,\n j.ownr_ph1,\n + \ j.special_coverage_policy,\n j.production_vars,\n lab.labhrs,\n lar.larhrs,\n + \ j.shopid,\n parts.partcount\n FROM (((jobs j\n LEFT JOIN ( SELECT + l.jobid,\n sum(l.mod_lb_hrs) AS labhrs\n FROM joblines + l\n WHERE (l.mod_lbr_ty = 'LAB'::text)\n GROUP BY l.jobid) + lab ON ((lab.jobid = j.id)))\n LEFT JOIN ( SELECT l2.jobid,\n sum(l2.mod_lb_hrs) + AS larhrs\n FROM joblines l2\n WHERE (l2.mod_lbr_ty = 'LAR'::text)\n + \ GROUP BY l2.jobid) lar ON ((lar.jobid = j.id)))\n LEFT JOIN ( + SELECT l3.jobid,\n json_agg(l3.status) AS partcount\n FROM + joblines l3\n where l3.part_type IS NOT NULL\n GROUP BY l3.jobid) + parts ON ((parts.jobid = j.id)))\n WHERE (j.inproduction = true);" + type: run_sql diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index f41f0ccb9..7a4963f80 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -439,6 +439,7 @@ tables: - federal_tax_id - id - insurance_vendor_id + - invoice_tax_rates - logo_img_path - md_order_statuses - md_responsibility_centers @@ -474,6 +475,7 @@ tables: - federal_tax_id - id - insurance_vendor_id + - invoice_tax_rates - logo_img_path - md_order_statuses - md_responsibility_centers @@ -1080,28 +1082,32 @@ tables: - active: _eq: true columns: - - id - - created_at - - updated_at - - invoiceid - - line_desc - - actual_price - actual_cost + - actual_price + - applicable_taxes - cost_center + - created_at + - id + - invoiceid - joblineid + - line_desc + - quantity + - updated_at select_permissions: - role: user permission: columns: - actual_cost - actual_price + - applicable_taxes - cost_center - - line_desc - created_at - - updated_at - - joblineid - id - invoiceid + - joblineid + - line_desc + - quantity + - updated_at filter: invoice: job: @@ -1119,13 +1125,15 @@ tables: columns: - actual_cost - actual_price + - applicable_taxes - cost_center - - line_desc - created_at - - updated_at - - joblineid - id - invoiceid + - joblineid + - line_desc + - quantity + - updated_at filter: invoice: job: @@ -1190,33 +1198,39 @@ tables: - active: _eq: true columns: - - id - created_at - - updated_at - - vendorid - - jobid - date - due_date - exported - exported_at - - is_credit_memo - - total + - federal_tax_rate + - id - invoice_number + - is_credit_memo + - jobid + - local_tax_rate + - state_tax_rate + - total + - updated_at + - vendorid select_permissions: - role: user permission: columns: - - exported - - is_credit_memo + - created_at - date - due_date - - total - - invoice_number - - created_at + - exported - exported_at - - updated_at + - federal_tax_rate - id + - invoice_number + - is_credit_memo - jobid + - local_tax_rate + - state_tax_rate + - total + - updated_at - vendorid filter: job: @@ -1232,17 +1246,20 @@ tables: - role: user permission: columns: - - exported - - is_credit_memo + - created_at - date - due_date - - total - - invoice_number - - created_at + - exported - exported_at - - updated_at + - federal_tax_rate - id + - invoice_number + - is_credit_memo - jobid + - local_tax_rate + - state_tax_rate + - total + - updated_at - vendorid filter: job: