From 325a82ac866673c01a39a876b5dd37bf3ab78ba6 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 14 Apr 2020 17:38:05 -0700 Subject: [PATCH] BOD-23 Added schema changes for time tickets + redux config for time ticket modal + scaffolding for time ticket modal. --- bodyshop_translations.babel | 120 ++++++++++++++ .../employee-search-select.component.jsx | 54 +++++++ .../jobs-detail-labor.container.jsx | 45 ++++++ .../time-ticket-modal.component.jsx | 109 +++++++++++++ .../time-ticket-modal.container.jsx | 150 ++++++++++++++++++ client/src/graphql/jobs-lines.queries.js | 20 +++ client/src/graphql/timetickets.queries.js | 32 ++++ .../contract-detail.page.container.jsx | 2 +- .../jobs-detail.page.component.jsx | 5 +- .../pages/manage/manage.page.component.jsx | 4 + client/src/redux/modals/modals.reducer.js | 15 +- client/src/redux/modals/modals.selectors.js | 5 + client/src/translations/en_us/common.json | 11 ++ client/src/translations/es/common.json | 11 ++ client/src/translations/fr/common.json | 11 ++ .../down.yaml | 5 + .../up.yaml | 29 ++++ .../down.yaml | 24 +++ .../up.yaml | 40 +++++ .../down.yaml | 6 + .../up.yaml | 36 +++++ .../down.yaml | 6 + .../up.yaml | 34 ++++ .../down.yaml | 6 + .../up.yaml | 35 ++++ .../down.yaml | 6 + .../up.yaml | 17 ++ 27 files changed, 829 insertions(+), 9 deletions(-) create mode 100644 client/src/components/employee-search-select/employee-search-select.component.jsx create mode 100644 client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx create mode 100644 client/src/components/time-ticket-modal/time-ticket-modal.component.jsx create mode 100644 client/src/components/time-ticket-modal/time-ticket-modal.container.jsx create mode 100644 client/src/graphql/timetickets.queries.js create mode 100644 hasura/migrations/1586907397057_create_table_public_timetickets/down.yaml create mode 100644 hasura/migrations/1586907397057_create_table_public_timetickets/up.yaml create mode 100644 hasura/migrations/1586907431308_track_all_relationships/down.yaml create mode 100644 hasura/migrations/1586907431308_track_all_relationships/up.yaml create mode 100644 hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/down.yaml create mode 100644 hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/up.yaml create mode 100644 hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/down.yaml create mode 100644 hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/up.yaml create mode 100644 hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/down.yaml create mode 100644 hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/up.yaml create mode 100644 hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/down.yaml create mode 100644 hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/up.yaml diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 3bed9a060..d8304ef62 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -10863,6 +10863,126 @@ + + timetickets + + + fields + + + employee + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + labels + + + edit + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + flat_rate + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + new + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + straight_time + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + + + titles diff --git a/client/src/components/employee-search-select/employee-search-select.component.jsx b/client/src/components/employee-search-select/employee-search-select.component.jsx new file mode 100644 index 000000000..f73429be2 --- /dev/null +++ b/client/src/components/employee-search-select/employee-search-select.component.jsx @@ -0,0 +1,54 @@ +import { Select, Tag } from "antd"; +import React, { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; +import CurrencyFormatter from "../../utils/CurrencyFormatter"; +const { Option } = Select; +//To be used as a form element only. + +const EmployeeSearchSelect = ({ value, onChange, options, onSelect }) => { + const [option, setOption] = useState(value); + const { t } = useTranslation(); + useEffect(() => { + if (onChange) { + onChange(option); + } + }, [option, onChange]); + + return ( + + ); +}; +export default EmployeeSearchSelect; diff --git a/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx b/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx new file mode 100644 index 000000000..52f33e1c7 --- /dev/null +++ b/client/src/components/jobs-detail-labor/jobs-detail-labor.container.jsx @@ -0,0 +1,45 @@ +import React from "react"; +import { Button } from "antd"; + +import { connect } from "react-redux"; +import { setModalContext } from "../../redux/modals/modals.actions"; +import AlertComponent from "../alert/alert.component"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import { useQuery } from "@apollo/react-hooks"; +import { QUERY_TICKETS_BY_JOBID } from "../../graphql/timetickets.queries"; + +const mapDispatchToProps = (dispatch) => ({ + setTimeTicketContext: (context) => + dispatch(setModalContext({ context: context, modal: "timeTicket" })), +}); + +export function JobsDetailLaborContainer({ jobId, setTimeTicketContext }) { + const { loading, error, data, refetch } = useQuery(QUERY_TICKETS_BY_JOBID, { + variables: { jobid: jobId }, + skip: !!!jobId, + }); + + if (loading) return ; + if (error) return ; + + return ( +
+ {jobId} + + {JSON.stringify(data)} +
+ ); +} + +export default connect(null, mapDispatchToProps)(JobsDetailLaborContainer); diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx new file mode 100644 index 000000000..8847c6271 --- /dev/null +++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx @@ -0,0 +1,109 @@ +import { DatePicker, Form, Input, Switch } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import CurrencyInput from "../form-items-formatted/currency-form-item.component"; +import JobSearchSelect from "../job-search-select/job-search-select.component"; +import EmployeeSearchSelect from "../employee-search-select/employee-search-select.component"; + +export default function TimeTicketModalComponent({ + form, + roAutoCompleteOptions, + employeeAutoCompleteOptions, + loadJobLines, + responsibilityCenters, +}) { + const { t } = useTranslation(); + + return ( +
+
+ + { + if (form.getFieldValue("jobid") !== null) { + loadJobLines({ + variables: { id: form.getFieldValue("jobid") }, + }); + } + }} + /> + + + + +
+
+ + + + + + + + + + + + +
+ + +
+ ); +} diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx new file mode 100644 index 000000000..099eedd2e --- /dev/null +++ b/client/src/components/time-ticket-modal/time-ticket-modal.container.jsx @@ -0,0 +1,150 @@ +import { useLazyQuery, useMutation, useQuery } from "@apollo/react-hooks"; +import { Form, Modal, notification, Button } from "antd"; +import React, { useState, useEffect } from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { INSERT_NEW_INVOICE } from "../../graphql/invoices.queries"; +import { ACTIVE_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries"; +import { toggleModalVisible } from "../../redux/modals/modals.actions"; +import { selectTimeTicket } from "../../redux/modals/modals.selectors"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import TimeTicketModalComponent from "./time-ticket-modal.component"; +import { QUERY_EMPLOYEES } from "../../graphql/employees.queries"; +import { GET_JOB_LINES_BY_PK_MINIMAL } from "../../graphql/jobs-lines.queries"; +const mapStateToProps = createStructuredSelector({ + timeTicketModal: selectTimeTicket, + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + toggleModalVisible: () => dispatch(toggleModalVisible("timeTicket")), +}); + +function TimeTicketModalContainer({ + timeTicketModal, + toggleModalVisible, + bodyshop, +}) { + const [form] = Form.useForm(); + const { t } = useTranslation(); + const [enterAgain, setEnterAgain] = useState(false); + // const [insertInvoice] = useMutation(INSERT_NEW_INVOICE); + + const { data: RoAutoCompleteData } = useQuery(ACTIVE_JOBS_FOR_AUTOCOMPLETE, { + variables: { statuses: bodyshop.md_ro_statuses.open_statuses || ["Open"] }, + skip: !timeTicketModal.visible, + }); + + const { data: EmployeeAutoCompleteData } = useQuery(QUERY_EMPLOYEES, { + skip: !timeTicketModal.visible, + }); + + const [loadJobLines, { data: jobLinesData }] = useLazyQuery( + GET_JOB_LINES_BY_PK_MINIMAL + ); + + const handleFinish = (values) => { + // insertInvoice({ + // variables: { + // invoice: [ + // Object.assign({}, values, { + // invoicelines: { data: values.invoicelines }, + // }), + // ], + // }, + // }) + // .then((r) => { + // notification["success"]({ + // message: t("invoices.successes.created"), + // }); + // if (timeTicketModal.actions.refetch) + // timeTicketModal.actions.refetch(); + // if (enterAgain) { + // form.resetFields(); + // } else { + // toggleModalVisible(); + // } + // setEnterAgain(false); + // }) + // .catch((error) => { + // setEnterAgain(false); + // notification["error"]({ + // message: t("invoices.errors.creating", { + // message: JSON.stringify(error), + // }), + // }); + // }); + }; + + const handleCancel = () => { + toggleModalVisible(); + }; + + useEffect(() => { + if (enterAgain) form.submit(); + }, [enterAgain, form]); + + return ( + form.submit()} + onCancel={handleCancel} + afterClose={() => form.resetFields()} + footer={ + + + + {timeTicketModal.context && timeTicketModal.context.id ? null : ( + + )} + + } + destroyOnClose + > +
{ + setEnterAgain(false); + console.log("Finish failed"); + }} + initialValues={{ + jobid: timeTicketModal.context.jobId || null, + }} + > + + + {JSON.stringify(jobLinesData)} +
+ ); +} + +export default connect( + mapStateToProps, + mapDispatchToProps +)(TimeTicketModalContainer); diff --git a/client/src/graphql/jobs-lines.queries.js b/client/src/graphql/jobs-lines.queries.js index 4f7bb7be1..c7f843d5e 100644 --- a/client/src/graphql/jobs-lines.queries.js +++ b/client/src/graphql/jobs-lines.queries.js @@ -45,6 +45,26 @@ export const GET_JOB_LINES_BY_PK = gql` } `; +export const GET_JOB_LINES_BY_PK_MINIMAL = gql` + query GET_JOB_LINES_BY_PK_MINIMAL($id: uuid!) { + joblines(where: { jobid: { _eq: $id } }, order_by: { unq_seq: asc }) { + id + line_desc + part_type + oem_partno + db_price + act_price + part_qty + mod_lbr_ty + db_hrs + mod_lb_hrs + lbr_op + lbr_amt + op_code_desc + } + } +`; + export const UPDATE_JOB_LINE_STATUS = gql` mutation UPDATE_JOB_LINE_STATUS($ids: [uuid!]!, $status: String!) { update_joblines(where: { id: { _in: $ids } }, _set: { status: $status }) { diff --git a/client/src/graphql/timetickets.queries.js b/client/src/graphql/timetickets.queries.js new file mode 100644 index 000000000..0493615ba --- /dev/null +++ b/client/src/graphql/timetickets.queries.js @@ -0,0 +1,32 @@ +import { gql } from "apollo-boost"; + +export const QUERY_TICKETS_BY_JOBID = gql` + query QUERY_TICKETS_BY_JOBID($jobid: uuid!) { + timetickets(where: { jobid: { _eq: $jobid } }) { + actualhrs + cost_center + ciecacode + rate + productivehrs + id + employee { + employee_number + first_name + last_name + id + } + } + } +`; + +export const INSERT_NEW_TIME_TICKET = gql` + mutation INSERT_NEW_TIME_TICKET( + $timeTicketInput: [timetickets_insert_input!]! + ) { + insert_timetickets(objects: $timeTicketInput) { + returning { + id + } + } + } +`; diff --git a/client/src/pages/contract-detail/contract-detail.page.container.jsx b/client/src/pages/contract-detail/contract-detail.page.container.jsx index e996a1348..2f88551d8 100644 --- a/client/src/pages/contract-detail/contract-detail.page.container.jsx +++ b/client/src/pages/contract-detail/contract-detail.page.container.jsx @@ -46,7 +46,7 @@ export function ContractDetailPageContainer({ setBreadcrumbs }) { { link: "/manage/courtesycars/contracts/new", label: t("titles.bc.contracts-detail", { - number: data.cccontracts_by_pk.agreementnumber || "", + number: (data && data.cccontracts_by_pk.agreementnumber) || "", }), }, ]); diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index a25b9ab1b..7f71aae0f 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -69,6 +69,9 @@ const JobsDetailPliContainer = lazy(() => const JobsDetailAuditContainer = lazy(() => import("../../components/audit-trail-list/audit-trail-list.container") ); +const JobsDetailLaborContainer = lazy(() => + import("../../components/jobs-detail-labor/jobs-detail-labor.container") +); const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -237,7 +240,7 @@ export function JobsDetailPage({ } key="labor" > - Labor + const EnterInvoiceModalContainer = lazy(() => import("../../components/invoice-enter-modal/invoice-enter-modal.container") ); +const TimeTicketModalContainer = lazy(() => + import("../../components/time-ticket-modal/time-ticket-modal.container") +); const { Header, Content, Footer } = Layout; export default function Manage({ match }) { @@ -102,6 +105,7 @@ export default function Manage({ match }) { + diff --git a/client/src/redux/modals/modals.reducer.js b/client/src/redux/modals/modals.reducer.js index 7e75b8842..1520b4989 100644 --- a/client/src/redux/modals/modals.reducer.js +++ b/client/src/redux/modals/modals.reducer.js @@ -4,8 +4,8 @@ const baseModal = { visible: false, context: {}, actions: { - refetch: null - } + refetch: null, + }, }; const INITIAL_STATE = { @@ -14,7 +14,8 @@ const INITIAL_STATE = { courtesyCarReturn: { ...baseModal }, noteUpsert: { ...baseModal }, schedule: { ...baseModal }, - partsOrder: { ...baseModal } + partsOrder: { ...baseModal }, + timeTicket: { ...baseModal }, }; const modalsReducer = (state = INITIAL_STATE, action) => { @@ -24,8 +25,8 @@ const modalsReducer = (state = INITIAL_STATE, action) => { ...state, [action.payload]: { ...state[action.payload], - visible: !state[action.payload].visible - } + visible: !state[action.payload].visible, + }, }; case ModalsActionTypes.SET_MODAL_CONTEXT: return { @@ -33,8 +34,8 @@ const modalsReducer = (state = INITIAL_STATE, action) => { [action.payload.modal]: { ...state[action.payload.modal], ...action.payload.context, - visible: true - } + visible: true, + }, }; default: return state; diff --git a/client/src/redux/modals/modals.selectors.js b/client/src/redux/modals/modals.selectors.js index 85908aa18..9f40c9f83 100644 --- a/client/src/redux/modals/modals.selectors.js +++ b/client/src/redux/modals/modals.selectors.js @@ -31,3 +31,8 @@ export const selectPartsOrder = createSelector( [selectModals], modals => modals.partsOrder ); + +export const selectTimeTicket = createSelector( + [selectModals], + modals => modals.timeTicket +); \ No newline at end of file diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 32f508593..867dad4c4 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -712,6 +712,17 @@ "state": "Error reading page state. Please refresh." } }, + "timetickets": { + "fields": { + "employee": "Employee" + }, + "labels": { + "edit": "Edit Time Ticket", + "flat_rate": "Flat Rate", + "new": "New Time Ticket", + "straight_time": "Straight Time" + } + }, "titles": { "app": "Bodyshop by ImEX Systems", "bc": { diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 35295cf77..4797e15e7 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -712,6 +712,17 @@ "state": "Error al leer el estado de la página. Porfavor refresca." } }, + "timetickets": { + "fields": { + "employee": "" + }, + "labels": { + "edit": "", + "flat_rate": "", + "new": "", + "straight_time": "" + } + }, "titles": { "app": "Carrocería de ImEX Systems", "bc": { diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index d7d645164..e0b14233a 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -712,6 +712,17 @@ "state": "Erreur lors de la lecture de l'état de la page. Rafraichissez, s'il vous plait." } }, + "timetickets": { + "fields": { + "employee": "" + }, + "labels": { + "edit": "", + "flat_rate": "", + "new": "", + "straight_time": "" + } + }, "titles": { "app": "Carrosserie par ImEX Systems", "bc": { diff --git a/hasura/migrations/1586907397057_create_table_public_timetickets/down.yaml b/hasura/migrations/1586907397057_create_table_public_timetickets/down.yaml new file mode 100644 index 000000000..882adffb8 --- /dev/null +++ b/hasura/migrations/1586907397057_create_table_public_timetickets/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: DROP TABLE "public"."timetickets"; + type: run_sql diff --git a/hasura/migrations/1586907397057_create_table_public_timetickets/up.yaml b/hasura/migrations/1586907397057_create_table_public_timetickets/up.yaml new file mode 100644 index 000000000..06a8b6c21 --- /dev/null +++ b/hasura/migrations/1586907397057_create_table_public_timetickets/up.yaml @@ -0,0 +1,29 @@ +- args: + cascade: false + read_only: false + sql: CREATE EXTENSION IF NOT EXISTS pgcrypto; + type: run_sql +- args: + cascade: false + read_only: false + sql: "CREATE TABLE \"public\".\"timetickets\"(\"id\" uuid NOT NULL DEFAULT gen_random_uuid(), + \"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\" timestamptz + NOT NULL DEFAULT now(), \"date\" date NOT NULL DEFAULT now(), \"cost_center\" + text NOT NULL, \"employeeid\" uuid NOT NULL, \"jobid\" uuid NOT NULL, \"rate\" + numeric NOT NULL DEFAULT 0, \"productivehrs\" numeric NOT NULL DEFAULT 0, \"actualhrs\" + numeric NOT NULL DEFAULT 0, \"clockon\" timestamptz, \"clockoff\" timestamptz, + \"ciecacode\" text NOT NULL, PRIMARY KEY (\"id\") , FOREIGN KEY (\"employeeid\") + REFERENCES \"public\".\"employees\"(\"id\") ON UPDATE restrict ON DELETE restrict, + FOREIGN KEY (\"jobid\") REFERENCES \"public\".\"jobs\"(\"id\") ON UPDATE restrict + ON DELETE restrict);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS + TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\" + = NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_timetickets_updated_at\"\nBEFORE + UPDATE ON \"public\".\"timetickets\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT + ON TRIGGER \"set_public_timetickets_updated_at\" ON \"public\".\"timetickets\" + \nIS 'trigger to set value of column \"updated_at\" to current timestamp on + row update';" + type: run_sql +- args: + name: timetickets + schema: public + type: add_existing_table_or_view diff --git a/hasura/migrations/1586907431308_track_all_relationships/down.yaml b/hasura/migrations/1586907431308_track_all_relationships/down.yaml new file mode 100644 index 000000000..1e6704090 --- /dev/null +++ b/hasura/migrations/1586907431308_track_all_relationships/down.yaml @@ -0,0 +1,24 @@ +- args: + relationship: timetickets + table: + name: employees + schema: public + type: drop_relationship +- args: + relationship: timetickets + table: + name: jobs + schema: public + type: drop_relationship +- args: + relationship: job + table: + name: timetickets + schema: public + type: drop_relationship +- args: + relationship: employee + table: + name: timetickets + schema: public + type: drop_relationship diff --git a/hasura/migrations/1586907431308_track_all_relationships/up.yaml b/hasura/migrations/1586907431308_track_all_relationships/up.yaml new file mode 100644 index 000000000..5c7630853 --- /dev/null +++ b/hasura/migrations/1586907431308_track_all_relationships/up.yaml @@ -0,0 +1,40 @@ +- args: + name: timetickets + table: + name: employees + schema: public + using: + foreign_key_constraint_on: + column: employeeid + table: + name: timetickets + schema: public + type: create_array_relationship +- args: + name: timetickets + table: + name: jobs + schema: public + using: + foreign_key_constraint_on: + column: jobid + table: + name: timetickets + schema: public + type: create_array_relationship +- args: + name: job + table: + name: timetickets + schema: public + using: + foreign_key_constraint_on: jobid + type: create_object_relationship +- args: + name: employee + table: + name: timetickets + schema: public + using: + foreign_key_constraint_on: employeeid + type: create_object_relationship diff --git a/hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/down.yaml b/hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/down.yaml new file mode 100644 index 000000000..fdcea370b --- /dev/null +++ b/hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: timetickets + schema: public + type: drop_insert_permission diff --git a/hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/up.yaml b/hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/up.yaml new file mode 100644 index 000000000..3fa31fb9f --- /dev/null +++ b/hasura/migrations/1586907537557_update_permission_user_public_table_timetickets/up.yaml @@ -0,0 +1,36 @@ +- args: + permission: + allow_upsert: true + check: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - id + - created_at + - updated_at + - date + - cost_center + - employeeid + - jobid + - rate + - productivehrs + - actualhrs + - clockon + - clockoff + - ciecacode + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: timetickets + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/down.yaml b/hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/down.yaml new file mode 100644 index 000000000..270f493b2 --- /dev/null +++ b/hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: timetickets + schema: public + type: drop_select_permission diff --git a/hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/up.yaml b/hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/up.yaml new file mode 100644 index 000000000..5ad4ebe3e --- /dev/null +++ b/hasura/migrations/1586907552709_update_permission_user_public_table_timetickets/up.yaml @@ -0,0 +1,34 @@ +- args: + permission: + allow_aggregations: false + columns: + - date + - actualhrs + - productivehrs + - rate + - ciecacode + - cost_center + - clockoff + - clockon + - created_at + - updated_at + - employeeid + - id + - jobid + computed_fields: [] + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + limit: null + role: user + table: + name: timetickets + schema: public + type: create_select_permission diff --git a/hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/down.yaml b/hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/down.yaml new file mode 100644 index 000000000..2cca595cb --- /dev/null +++ b/hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: timetickets + schema: public + type: drop_update_permission diff --git a/hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/up.yaml b/hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/up.yaml new file mode 100644 index 000000000..04b050c44 --- /dev/null +++ b/hasura/migrations/1586907564632_update_permission_user_public_table_timetickets/up.yaml @@ -0,0 +1,35 @@ +- args: + permission: + columns: + - date + - actualhrs + - productivehrs + - rate + - ciecacode + - cost_center + - clockoff + - clockon + - created_at + - updated_at + - employeeid + - id + - jobid + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + localPresets: + - key: "" + value: "" + set: {} + role: user + table: + name: timetickets + schema: public + type: create_update_permission diff --git a/hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/down.yaml b/hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/down.yaml new file mode 100644 index 000000000..92ce7cf39 --- /dev/null +++ b/hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/down.yaml @@ -0,0 +1,6 @@ +- args: + role: user + table: + name: timetickets + schema: public + type: drop_delete_permission diff --git a/hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/up.yaml b/hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/up.yaml new file mode 100644 index 000000000..d84cea1b8 --- /dev/null +++ b/hasura/migrations/1586907569694_update_permission_user_public_table_timetickets/up.yaml @@ -0,0 +1,17 @@ +- args: + permission: + filter: + job: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: timetickets + schema: public + type: create_delete_permission