diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 74c41de5e..cefdf5565 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1338,7 +1338,7 @@ labels - deductfromlabor + deductedfromlbr false @@ -2160,6 +2160,27 @@ + + editadjwarning + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + entered_total false @@ -20482,6 +20503,27 @@ + + removedpartsstrikethrough + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + @@ -24744,6 +24786,27 @@ + + received + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + return_created false @@ -27368,6 +27431,27 @@ + + employee + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + generateasemail false @@ -31727,6 +31811,27 @@ fields + + active + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + am false diff --git a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx index 8d764bb5e..4d5316370 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx @@ -1,5 +1,5 @@ import { useMutation, useQuery } from "@apollo/client"; -import { Button, Form } from "antd"; +import { Button, Form, Popconfirm } from "antd"; import moment from "moment"; import queryString from "query-string"; import React, { useEffect, useState } from "react"; @@ -19,6 +19,7 @@ export default function BillDetailEditcontainer() { const search = queryString.parse(useLocation().search); const { t } = useTranslation(); const [form] = Form.useForm(); + const [visible, setVisible] = useState(false); const [updateLoading, setUpdateLoading] = useState(false); const [update_bill] = useMutation(UPDATE_BILL); const [insertBillLine] = useMutation(INSERT_NEW_BILL_LINES); @@ -29,6 +30,15 @@ export default function BillDetailEditcontainer() { skip: !!!search.billid, }); + const handleSave = () => { + //It's got a previously deducted bill line! + if (data.bills_by_pk.billlines.filter((b) => b.deductedfromlbr).length > 0) + setVisible(true); + else { + form.submit(); + } + }; + const handleFinish = async (values) => { setUpdateLoading(true); //let adjustmentsToInsert = {}; @@ -42,7 +52,7 @@ export default function BillDetailEditcontainer() { ); billlines.forEach((billline) => { - const { deductfromlabor, ...il } = billline; + const { deductedfromlbr, ...il } = billline; delete il.__typename; //Need to compare this line to the previous version of the line to see if there is a change in the adjustments. @@ -52,7 +62,7 @@ export default function BillDetailEditcontainer() { if (theOldBillLine) { //It was there! Need to change the diff. - if (theOldBillLine.deductfromlabor !== deductfromlabor) { + if (theOldBillLine.deductedfromlbr !== deductedfromlbr) { //There's a different } } @@ -64,7 +74,7 @@ export default function BillDetailEditcontainer() { billLineId: il.id, billLine: { ...il, - deductedfromlbr: deductfromlabor, + deductedfromlbr: deductedfromlbr, joblineid: il.joblineid === "noline" ? null : il.joblineid, }, }, @@ -78,7 +88,7 @@ export default function BillDetailEditcontainer() { billLines: [ { ...il, - deductedfromlbr: deductfromlabor, + deductedfromlbr: deductedfromlbr, billid: search.billid, joblineid: il.joblineid === "noline" ? null : il.joblineid, }, @@ -93,6 +103,7 @@ export default function BillDetailEditcontainer() { await refetch(); form.resetFields(); form.resetFields(); + setVisible(false); setUpdateLoading(false); }; @@ -109,19 +120,28 @@ export default function BillDetailEditcontainer() { return ( -
form.submit()} + onCancel={() => setVisible(false)} + okButtonProps={{ loading: updateLoading }} + title={t("bills.labels.editadjwarning")} > + + { const { - deductfromlabor, + deductedfromlbr, lbr_adjustment, location: lineLocation, ...restI } = i; - if (deductfromlabor) { + if (deductedfromlbr) { adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] = (adjustmentsToInsert[lbr_adjustment.mod_lbr_ty] || 0) - restI.actual_price / lbr_adjustment.rate; } return { ...restI, - deductedfromlbr: deductfromlabor, + deductedfromlbr: deductedfromlbr, joblineid: i.joblineid === "noline" ? null : i.joblineid, }; }), diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index 769c17d81..276612e8e 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -248,19 +248,19 @@ export function BillEnterModalLinesComponent({ prev.billlines[index] && - prev.billlines[index].deductfromlabor !== + prev.billlines[index].deductedfromlbr !== cur.billlines[index] && - cur.billlines[index].deductfromlabor + cur.billlines[index].deductedfromlbr } > {() => { @@ -268,7 +268,7 @@ export function BillEnterModalLinesComponent({ getFieldValue([ "billlines", field.name, - "deductfromlabor", + "deductedfromlbr", ]) ) return ( diff --git a/client/src/components/job-costing-modal/job-costing-modal.component.jsx b/client/src/components/job-costing-modal/job-costing-modal.component.jsx index a811e69ec..ab99d2512 100644 --- a/client/src/components/job-costing-modal/job-costing-modal.component.jsx +++ b/client/src/components/job-costing-modal/job-costing-modal.component.jsx @@ -176,7 +176,7 @@ export function JobCostingModalComponent({ bodyshop, job }) { ).toFixed(2); if (isNaN(summaryData.gppercent)) summaryData.gppercentFormatted = 0; else if (!isFinite(summaryData.gppercent)) - summaryData.gppercentFormatted = "-∞"; + summaryData.gppercentFormatted = "- ∞"; else { summaryData.gppercentFormatted = summaryData.gppercent; } diff --git a/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx b/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx index cd45c8722..3850cf359 100644 --- a/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx +++ b/client/src/components/job-reconciliation-modal/job-reconciliation.modal.container.jsx @@ -1,11 +1,15 @@ +import { useQuery } from "@apollo/client"; import { Modal } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; +import { GET_JOB_RECONCILIATION_BY_PK } from "../../graphql/jobs.queries"; import { toggleModalVisible } from "../../redux/modals/modals.actions"; import { selectReconciliation } from "../../redux/modals/modals.selectors"; import JobReconciliationModalComponent from "./job-reconciliation-modal.component"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import AlertComponent from "../alert/alert.component"; const mapStateToProps = createStructuredSelector({ reconciliationModal: selectReconciliation, @@ -20,7 +24,12 @@ function JobReconciliationModalContainer({ }) { const { t } = useTranslation(); const { context, visible } = reconciliationModal; - const { job, bills } = context; + const { job } = context; + + const { loading, error, data } = useQuery(GET_JOB_RECONCILIATION_BY_PK, { + variables: { id: job && job.id }, + skip: !(job && job.id) || !visible, + }); const handleCancel = () => { toggleModalVisible(); @@ -37,7 +46,15 @@ function JobReconciliationModalContainer({ cancelButtonProps={{ display: "none" }} destroyOnClose > - + + {error && } + {data && ( + + )} + ); } diff --git a/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx b/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx index 089dfe1d4..4c35fdd94 100644 --- a/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx +++ b/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.component.jsx @@ -3,6 +3,7 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { alphaSort } from "../../utils/sorters"; +import "./job-reconciliation-parts-table.styles.scss"; export default function JobReconcilitionPartsTable({ jobLineState, @@ -114,7 +115,11 @@ export default function JobReconcilitionPartsTable({ onChange: handleOnRowClick, selectedRowKeys: selectedLines, }} + rowClassName={(record) => record.removed && "text-strikethrough"} /> +
+ {t("jobs.labels.reconciliation.removedpartsstrikethrough")} +
); } diff --git a/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.styles.scss b/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.styles.scss new file mode 100644 index 000000000..fffdb8790 --- /dev/null +++ b/client/src/components/job-reconciliation-parts-table/job-reconciliation-parts-table.styles.scss @@ -0,0 +1,3 @@ +.text-strikethrough { + text-decoration: line-through; +} diff --git a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx index 4f3474750..11330c5b9 100644 --- a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx +++ b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.component.jsx @@ -39,7 +39,9 @@ export default function JobReconciliationTotals({ return acc.add( Dinero({ amount: Math.round((val.actual_price || 0) * 100), - }).multiply(val.quantity || 1) + }) + .multiply(val.quantity || 1) + .multiply(val.bill.is_credit_memo ? -1 : 1) ); }, Dinero()), }; @@ -97,6 +99,7 @@ export default function JobReconciliationTotals({ onClick={() => { jobLineState[1]([]); billLineState[1]([]); + setErrors([]); }} > {t("jobs.labels.reconciliation.clear")} diff --git a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js index e679b1102..cb4b9fc82 100644 --- a/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js +++ b/client/src/components/job-reconciliation-totals/job-reconciliation-totals.utility.js @@ -23,11 +23,6 @@ export const reconcileByAssocLine = ( setErrors((errors) => [ ...errors, ..._.uniqBy(duplicatedJobLinesbyInvoiceId).map((dupedId) => { - console.log( - "dupedId", - dupedId, - billLines.find((b) => b.id === dupedId) - ); return i18next.t("jobs.labels.reconciliation.multiplebilllines", { line_desc: jobLines.find((j) => j.id === dupedId)?.line_desc, }); diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx index b01e0b352..b2ab847ac 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.csi.component.jsx @@ -14,6 +14,11 @@ import { TemplateList } from "../../utils/TemplateConstants"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { Link } from "react-router-dom"; +import parsePhoneNumber from "libphonenumber-js"; +import { + openChatByPhone, + setMessage, +} from "../../redux/messaging/messaging.actions"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser' @@ -21,12 +26,16 @@ const mapStateToProps = createStructuredSelector({ }); const mapDispatchToProps = (dispatch) => ({ setEmailOptions: (e) => dispatch(setEmailOptions(e)), + openChatByPhone: (phone) => dispatch(openChatByPhone(phone)), + setMessage: (text) => dispatch(setMessage(text)), }); export function JobsDetailHeaderCsi({ setEmailOptions, bodyshop, job, + openChatByPhone, + setMessage, ...props }) { const { t } = useTranslation(); @@ -36,52 +45,90 @@ export function JobsDetailHeaderCsi({ const handleCreateCsi = async (e) => { logImEXEvent("job_create_csi"); - const questionSetResult = await client.query({ - query: GET_CURRENT_QUESTIONSET_ID, - }); + //Is tehre already a CSI? + if (job.csi_invites.length === 0) { + const questionSetResult = await client.query({ + query: GET_CURRENT_QUESTIONSET_ID, + }); - if (questionSetResult.data.csiquestions.length > 0) { - const result = await insertCsi({ - variables: { - csiInput: { - jobid: job.id, - bodyshopid: bodyshop.id, - questionset: questionSetResult.data.csiquestions[0].id, - relateddata: { - job: { - id: job.id, - ownr_fn: job.ownr_fn, - ro_number: job.ro_number, - v_model_yr: job.v_model_yr, - v_make_desc: job.v_make_desc, - v_model_desc: job.v_model_desc, - }, - bodyshop: { - city: bodyshop.city, - email: bodyshop.email, - state: bodyshop.state, - country: bodyshop.country, - address1: bodyshop.address1, - address2: bodyshop.address2, - shopname: bodyshop.shopname, - zip_post: bodyshop.zip_post, - logo_img_path: bodyshop.logo_img_path, + if (questionSetResult.data.csiquestions.length > 0) { + const result = await insertCsi({ + variables: { + csiInput: { + jobid: job.id, + bodyshopid: bodyshop.id, + questionset: questionSetResult.data.csiquestions[0].id, + relateddata: { + job: { + id: job.id, + ownr_fn: job.ownr_fn, + ro_number: job.ro_number, + v_model_yr: job.v_model_yr, + v_make_desc: job.v_make_desc, + v_model_desc: job.v_model_desc, + }, + bodyshop: { + city: bodyshop.city, + email: bodyshop.email, + state: bodyshop.state, + country: bodyshop.country, + address1: bodyshop.address1, + address2: bodyshop.address2, + shopname: bodyshop.shopname, + zip_post: bodyshop.zip_post, + logo_img_path: bodyshop.logo_img_path, + }, }, }, }, - }, - }); + }); - if (!!!result.errors) { - notification["success"]({ message: t("csi.successes.created") }); + if (!!!result.errors) { + notification["success"]({ message: t("csi.successes.created") }); + } else { + notification["error"]({ + message: t("csi.errors.creating", { + message: JSON.stringify(result.errors), + }), + }); + return; + } + if (e.key === "email") + setEmailOptions({ + messageOptions: { + to: [job.ownr_ea], + replyTo: bodyshop.email, + }, + template: { + name: TemplateList("job").csi_invitation.key, + variables: { + id: result.data.insert_csi.returning[0].id, + }, + }, + }); + + if (e.key === "text") { + const p = parsePhoneNumber(job.ownr_ph1, "CA"); + if (p && p.isValid()) { + // openChatByPhone({ + // phone_num: p.formatInternational(), + // jobid: job.id, + // }); + setMessage( + `${window.location.protocol}//${window.location.host}/csi/${result.data.insert_csi.returning[0].id}` + ); + } else { + notification["error"]({ + message: t("messaging.error.invalidphone"), + }); + } + } } else { notification["error"]({ - message: t("csi.errors.creating", { - message: JSON.stringify(result.errors), - }), + message: t("csi.errors.notconfigured"), }); - return; } + } else { if (e.key === "email") setEmailOptions({ messageOptions: { @@ -91,17 +138,27 @@ export function JobsDetailHeaderCsi({ template: { name: TemplateList("job").csi_invitation.key, variables: { - id: result.data.insert_csi.returning[0].id, + id: job.csi_invites[0].id, }, }, }); if (e.key === "text") { + const p = parsePhoneNumber(job.ownr_ph1, "CA"); + if (p && p.isValid()) { + // openChatByPhone({ + // phone_num: p.formatInternational(), + // jobid: job.id, + // }); + setMessage( + `${window.location.protocol}//${window.location.host}/csi/${job.csi_invites[0].id}` + ); + } else { + notification["error"]({ + message: t("messaging.error.invalidphone"), + }); + } } - } else { - notification["error"]({ - message: t("csi.errors.notconfigured"), - }); } }; @@ -122,13 +179,26 @@ export function JobsDetailHeaderCsi({ {t("general.labels.text")} - {job.csiinvites.map((item, idx) => ( - - - {item.completedon} - - - ))} + {job.csiinvites.map((item, idx) => { + return item.completedon ? ( + + + {item.completedon} + + + ) : ( + { + navigator.clipboard.writeText( + `${window.location.protocol}//${window.location.host}/csi/${item.id}` + ); + }} + > + {t("general.actions.copylink")} + + ); + })} ); } diff --git a/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx b/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx index 46d4d1be7..62d7e6202 100644 --- a/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx +++ b/client/src/components/jobs-detail-rates/jobs-detail-rates.parts.component.jsx @@ -136,6 +136,46 @@ export function JobsDetailRatesParts({ jobRO, expanded, required = true }) {
+ + + + + + + + + + + + + + + + + { + const [ + callEmployeeQuery, + { data: employeeData, called: employeeCalled }, + ] = useLazyQuery(QUERY_ACTIVE_EMPLOYEES, { + skip: !( + visible && + Templates[form.getFieldValue("key")] && + Templates[form.getFieldValue("key")].idtype + ), + }); + + const handleFinish = async (values) => { + setLoading(true); const start = values.dates[0]; const end = values.dates[1]; const { id } = values; console.log("values", values); - GenerateDocument( + await GenerateDocument( { name: values.key, variables: { @@ -56,6 +74,7 @@ export function ReportCenterModalComponent({ reportCenterModal }) { }, values.email ? "e" : "p" ); + setLoading(false); }; return ( @@ -89,7 +108,8 @@ export function ReportCenterModalComponent({ reportCenterModal }) { //Kind of Id const idtype = Templates[key] && Templates[key].idtype; if (!idtype) return null; - if (!called && idtype === "vendor") callVendorQuery(); + if (!vendorCalled && idtype === "vendor") callVendorQuery(); + if (!employeeCalled && idtype === "employee") callEmployeeQuery(); if (idtype === "vendor") return ( - + + + ); + if (idtype === "employee") + return ( + + ); else return null; @@ -138,7 +177,7 @@ export function ReportCenterModalComponent({ reportCenterModal }) { marginTop: "1rem", }} > - diff --git a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx index 1990837b8..1d12f6cdb 100644 --- a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx +++ b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx @@ -68,7 +68,7 @@ export function TimeTicketsSummaryEmployees({ const handlePrintEmployeeTicket = async (empId) => { GenerateDocument( { - name: TemplateList().time_tickets_by_employee.key, + name: TemplateList().timetickets_employee.key, variables: { id: empId, start: startDate, end: endDate }, }, {}, diff --git a/client/src/components/vendors-form/vendors-form.component.jsx b/client/src/components/vendors-form/vendors-form.component.jsx index 456146eae..3118ae96c 100644 --- a/client/src/components/vendors-form/vendors-form.component.jsx +++ b/client/src/components/vendors-form/vendors-form.component.jsx @@ -6,6 +6,7 @@ import { InputNumber, Select, Space, + Switch, Typography, } from "antd"; import React from "react"; @@ -49,6 +50,14 @@ export default function VendorsFormComponent({ > + + + { key: "schedule", disabled: false, }, - timetickets: { - title: i18n.t("reportcenter.templates.timetickets"), - description: "Est Detail", - subject: i18n.t("reportcenter.templates.timetickets"), - key: "timetickets", - disabled: false, - }, + purchases_by_vendor_detailed_date_range: { title: i18n.t( "reportcenter.templates.purchases_by_vendor_detailed_date_range" @@ -357,12 +351,19 @@ export const TemplateList = (type, context) => { idtype: "vendor", disabled: false, }, + timetickets: { + title: i18n.t("reportcenter.templates.timetickets"), + description: "Est Detail", + subject: i18n.t("reportcenter.templates.timetickets"), + key: "timetickets", + disabled: false, + }, timetickets_employee: { title: i18n.t("reportcenter.templates.timetickets_employee"), description: "Est Detail", subject: i18n.t("reportcenter.templates.timetickets_employee"), key: "timetickets_employee", - idtype: "vendor", + idtype: "employee", disabled: false, }, timetickets_summary: { @@ -370,7 +371,7 @@ export const TemplateList = (type, context) => { description: "Est Detail", subject: i18n.t("reportcenter.templates.timetickets_summary"), key: "timetickets_summary", - idtype: "vendor", + //idtype: "vendor", disabled: false, }, } diff --git a/hasura/migrations/1616459494455_alter_table_public_vendors_add_column_active/down.yaml b/hasura/migrations/1616459494455_alter_table_public_vendors_add_column_active/down.yaml new file mode 100644 index 000000000..985c6b070 --- /dev/null +++ b/hasura/migrations/1616459494455_alter_table_public_vendors_add_column_active/down.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."vendors" DROP COLUMN "active"; + type: run_sql diff --git a/hasura/migrations/1616459494455_alter_table_public_vendors_add_column_active/up.yaml b/hasura/migrations/1616459494455_alter_table_public_vendors_add_column_active/up.yaml new file mode 100644 index 000000000..d42900f0e --- /dev/null +++ b/hasura/migrations/1616459494455_alter_table_public_vendors_add_column_active/up.yaml @@ -0,0 +1,6 @@ +- args: + cascade: false + read_only: false + sql: ALTER TABLE "public"."vendors" ADD COLUMN "active" boolean NOT NULL DEFAULT + true; + type: run_sql diff --git a/hasura/migrations/1616459505404_update_permission_user_public_table_vendors/down.yaml b/hasura/migrations/1616459505404_update_permission_user_public_table_vendors/down.yaml new file mode 100644 index 000000000..069eb786a --- /dev/null +++ b/hasura/migrations/1616459505404_update_permission_user_public_table_vendors/down.yaml @@ -0,0 +1,41 @@ +- args: + role: user + table: + name: vendors + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - bodyshopid + - city + - cost_center + - country + - created_at + - discount + - due_date + - email + - favorite + - id + - name + - phone + - state + - street1 + - street2 + - updated_at + - zip + set: {} + role: user + table: + name: vendors + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1616459505404_update_permission_user_public_table_vendors/up.yaml b/hasura/migrations/1616459505404_update_permission_user_public_table_vendors/up.yaml new file mode 100644 index 000000000..07671753b --- /dev/null +++ b/hasura/migrations/1616459505404_update_permission_user_public_table_vendors/up.yaml @@ -0,0 +1,42 @@ +- args: + role: user + table: + name: vendors + schema: public + type: drop_insert_permission +- args: + permission: + check: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + columns: + - active + - bodyshopid + - city + - cost_center + - country + - created_at + - discount + - due_date + - email + - favorite + - id + - name + - phone + - state + - street1 + - street2 + - updated_at + - zip + set: {} + role: user + table: + name: vendors + schema: public + type: create_insert_permission diff --git a/hasura/migrations/1616459520408_update_permission_user_public_table_vendors/down.yaml b/hasura/migrations/1616459520408_update_permission_user_public_table_vendors/down.yaml new file mode 100644 index 000000000..fcd8afa18 --- /dev/null +++ b/hasura/migrations/1616459520408_update_permission_user_public_table_vendors/down.yaml @@ -0,0 +1,42 @@ +- args: + role: user + table: + name: vendors + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - bodyshopid + - city + - cost_center + - country + - created_at + - discount + - due_date + - email + - favorite + - id + - name + - phone + - state + - street1 + - street2 + - updated_at + - zip + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: vendors + schema: public + type: create_select_permission diff --git a/hasura/migrations/1616459520408_update_permission_user_public_table_vendors/up.yaml b/hasura/migrations/1616459520408_update_permission_user_public_table_vendors/up.yaml new file mode 100644 index 000000000..944fccf8b --- /dev/null +++ b/hasura/migrations/1616459520408_update_permission_user_public_table_vendors/up.yaml @@ -0,0 +1,43 @@ +- args: + role: user + table: + name: vendors + schema: public + type: drop_select_permission +- args: + permission: + allow_aggregations: false + columns: + - active + - bodyshopid + - city + - cost_center + - country + - created_at + - discount + - due_date + - email + - favorite + - id + - name + - phone + - state + - street1 + - street2 + - updated_at + - zip + computed_fields: [] + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + role: user + table: + name: vendors + schema: public + type: create_select_permission diff --git a/hasura/migrations/1616459530975_update_permission_user_public_table_vendors/down.yaml b/hasura/migrations/1616459530975_update_permission_user_public_table_vendors/down.yaml new file mode 100644 index 000000000..e94d250ff --- /dev/null +++ b/hasura/migrations/1616459530975_update_permission_user_public_table_vendors/down.yaml @@ -0,0 +1,41 @@ +- args: + role: user + table: + name: vendors + schema: public + type: drop_update_permission +- args: + permission: + columns: + - bodyshopid + - city + - cost_center + - country + - created_at + - discount + - due_date + - email + - favorite + - id + - name + - phone + - state + - street1 + - street2 + - updated_at + - zip + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + set: {} + role: user + table: + name: vendors + schema: public + type: create_update_permission diff --git a/hasura/migrations/1616459530975_update_permission_user_public_table_vendors/up.yaml b/hasura/migrations/1616459530975_update_permission_user_public_table_vendors/up.yaml new file mode 100644 index 000000000..a586fd5b7 --- /dev/null +++ b/hasura/migrations/1616459530975_update_permission_user_public_table_vendors/up.yaml @@ -0,0 +1,42 @@ +- args: + role: user + table: + name: vendors + schema: public + type: drop_update_permission +- args: + permission: + columns: + - active + - bodyshopid + - city + - cost_center + - country + - created_at + - discount + - due_date + - email + - favorite + - id + - name + - phone + - state + - street1 + - street2 + - updated_at + - zip + filter: + bodyshop: + associations: + _and: + - user: + authid: + _eq: X-Hasura-User-Id + - active: + _eq: true + set: {} + role: user + table: + name: vendors + schema: public + type: create_update_permission diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index ab5d2c563..24d0c1da1 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -1743,13 +1743,15 @@ tables: - active: _eq: true columns: - - jobid - conversationid + - id + - jobid select_permissions: - role: user permission: columns: - conversationid + - id - jobid filter: conversation: @@ -4114,6 +4116,7 @@ tables: - active: _eq: true columns: + - active - bodyshopid - city - cost_center @@ -4135,6 +4138,7 @@ tables: - role: user permission: columns: + - active - bodyshopid - city - cost_center @@ -4165,6 +4169,7 @@ tables: - role: user permission: columns: + - active - bodyshopid - city - cost_center