Merged in feature/2020-06-04 (pull request #93)

Feature/2020 06 04
This commit is contained in:
Patrick Fic
2021-06-02 17:09:31 +00:00
38 changed files with 515 additions and 78 deletions

View File

@@ -26853,6 +26853,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>orderedby</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>quantity</name>
<definition_loaded>false</definition_loaded>

View File

@@ -54,7 +54,7 @@ export default function AccountingPayablesTableComponent({
ellipsis: true,
sorter: (a, b) => alphaSort(a.job.ownr_ln, b.job.ownr_ln),
sortOrder:
state.sortedInfo.columnKey === "ownr_ln" && state.sortedInfo.order,
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
render: (text, record) => {
return record.job.owner ? (
<Link to={"/manage/owners/" + record.job.owner.id}>

View File

@@ -1,3 +1,4 @@
import { Space } from "antd";
import React from "react";
import PhoneNumberFormatter from "../../utils/PhoneFormatter";
import ChatConversationTitleTags from "../chat-conversation-title-tags/chat-conversation-title-tags.component";
@@ -5,20 +6,16 @@ import ChatTagRoContainer from "../chat-tag-ro/chat-tag-ro.container";
export default function ChatConversationTitle({ conversation }) {
return (
<div>
<div className="imex-flex-row">
<ChatConversationTitleTags
jobConversations={
(conversation && conversation.job_conversations) || []
}
/>
<ChatTagRoContainer conversation={conversation || []} />
</div>
<div className="imex-flex-row">
<PhoneNumberFormatter>
{conversation && conversation.phone_num}
</PhoneNumberFormatter>
</div>
</div>
<Space flex>
<PhoneNumberFormatter>
{conversation && conversation.phone_num}
</PhoneNumberFormatter>
<ChatConversationTitleTags
jobConversations={
(conversation && conversation.job_conversations) || []
}
/>
<ChatTagRoContainer conversation={conversation || []} />
</Space>
);
}

View File

@@ -1,5 +1,5 @@
import { CloseCircleOutlined, LoadingOutlined } from "@ant-design/icons";
import { Select, Empty } from "antd";
import { Select, Empty, Space } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
@@ -13,27 +13,27 @@ export default function ChatTagRoComponent({
const { t } = useTranslation();
return (
<div>
<Select
showSearch
autoFocus
style={{
width: 300,
}}
placeholder={t("general.labels.search")}
filterOption={false}
onSearch={handleSearch}
onSelect={handleInsertTag}
notFoundContent={loading ? <LoadingOutlined /> : <Empty />}
>
{roOptions.map((item, idx) => (
<Select.Option key={item.id || idx}>
{` ${item.ro_number || ""} | ${item.ownr_fn || ""} ${
item.ownr_ln || ""
} ${item.ownr_co_nm || ""}`}
</Select.Option>
))}
</Select>
<Space flex>
<div style={{ width: "15rem" }}>
<Select
showSearch
autoFocus
dropdownMatchSelectWidth
placeholder={t("general.labels.search")}
filterOption={false}
onSearch={handleSearch}
onSelect={handleInsertTag}
notFoundContent={loading ? <LoadingOutlined /> : <Empty />}
>
{roOptions.map((item, idx) => (
<Select.Option key={item.id || idx}>
{` ${item.ro_number || ""} | ${item.ownr_fn || ""} ${
item.ownr_ln || ""
} ${item.ownr_co_nm || ""}`}
</Select.Option>
))}
</Select>
</div>
{loading ? <LoadingOutlined /> : null}
{loading ? (
@@ -41,6 +41,6 @@ export default function ChatTagRoComponent({
) : (
<CloseCircleOutlined onClick={() => setVisible(false)} />
)}
</div>
</Space>
);
}

View File

@@ -29,7 +29,7 @@ export default function JobDetailCardsNotesComponent({ loading, data }) {
bordered
dataSource={data.notes}
renderItem={(item) => (
<List.Item>
<List.Item style={{ whiteSpace: "pre-line" }}>
{item.critical ? (
<EyeInvisibleFilled style={{ margin: 4, color: "red" }} />
) : null}

View File

@@ -8,8 +8,8 @@ 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 { DateTimeFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import { DateFormatter } from "../../utils/DateFormatter";
import { alphaSort, dateSort } from "../../utils/sorters";
import { TemplateList } from "../../utils/TemplateConstants";
import DataLabel from "../data-label/data-label.component";
import PrintWrapperComponent from "../print-wrapper/print-wrapper.component";
@@ -40,14 +40,14 @@ export function JobPayments({
});
const columns = [
{
title: t("payments.fields.created_at"),
dataIndex: "created_at",
key: "created_at",
title: t("payments.fields.date"),
dataIndex: "date",
key: "date",
sorter: (a, b) => dateSort(a.date, b.date),
sortOrder:
state.sortedInfo.columnKey === "created_at" && state.sortedInfo.order,
render: (text, record) => (
<DateTimeFormatter>{record.created_at}</DateTimeFormatter>
),
state.sortedInfo.columnKey === "date" && state.sortedInfo.order,
render: (text, record) => <DateFormatter>{record.date}</DateFormatter>,
},
{
title: t("payments.fields.payer"),

View File

@@ -39,24 +39,20 @@ export default async function DuplicateJob(
line.manual_line = true;
});
newJob.joblines = keepJobLines ? _tempLines : [];
newJob.job_totals = (
await Axios.post("/job/totals", {
job: newJob,
})
).data;
delete newJob.joblines;
newJob.joblines = keepJobLines ? { data: _tempLines } : null;
apolloClient
.mutate({
mutation: INSERT_NEW_JOB,
variables: { job: [newJob] },
})
.then((res2) => {
if (completionCallback)
completionCallback(res2.data.insert_jobs.returning[0].id);
});
const res2 = await apolloClient.mutate({
mutation: INSERT_NEW_JOB,
variables: { job: [newJob] },
});
await Axios.post("/job/totalsssu", {
id: res2.data.insert_jobs.returning[0].id,
});
if (completionCallback)
completionCallback(res2.data.insert_jobs.returning[0].id);
//insert the new job. call the callback with the returned ID when done.

View File

@@ -2,7 +2,7 @@ import { DetermineFileType } from "../documents-upload/documents-upload.utility"
export const GenerateSrcUrl = (value) => {
let extension = value.extension;
if (extension && extension.includes("heic")) extension = "jpg";
if (extension && extension.toLowerCase().includes("heic")) extension = "jpg";
return `${process.env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
value.type

View File

@@ -166,7 +166,6 @@ function JobsDocumentsComponent({
zIndex: "5",
}}
onClick={() => {
console.log(`Clicked`);
const newWindow = window.open(
`${window.location.protocol}//${window.location.host}/edit?documentId=${galleryImages.images[index].id}`,
"_blank",

View File

@@ -57,6 +57,9 @@ export function JobNotesComponent({
dataIndex: "text",
key: "text",
ellipsis: true,
render: (text, record) => (
<span style={{ whiteSpace: "pre-line" }}>{text}</span>
),
},
{

View File

@@ -237,6 +237,11 @@ export function PartsOrderListTableComponent({
<DateFormatter>{record.deliver_by}</DateFormatter>
),
},
{
title: t("parts_orders.fields.orderedby"),
dataIndex: "orderedby",
key: "orderedby",
},
{
title: t("general.labels.actions"),
dataIndex: "actions",
@@ -336,6 +341,7 @@ export function PartsOrderListTableComponent({
/>
),
},
{
title: t("general.labels.actions"),
dataIndex: "actions",

View File

@@ -73,6 +73,7 @@ export default function PartsOrderModalComponent({
<Form.Item required={false} key={field.key}>
<LayoutFormRow grow noDivider>
<Form.Item
span={8}
label={t("parts_orders.fields.line_desc")}
key={`${index}line_desc`}
name={[field.name, "line_desc"]}

View File

@@ -81,6 +81,7 @@ export function PartsOrderModalContainer({
po: [
{
...values,
orderedby: currentUser.email,
jobid: jobId,
user_email: currentUser.email,
return: isReturn,

View File

@@ -73,7 +73,7 @@ export const QUERY_BILLS_BY_JOBID = gql`
order_date
deliver_by
return
orderedby
parts_order_lines {
id
act_price

View File

@@ -565,6 +565,7 @@ export const GET_JOB_BY_PK = gql`
stripeid
transactionid
memo
date
}
cccontracts {
id

View File

@@ -1602,6 +1602,7 @@
"oem_partno": "Part #",
"order_date": "Order Date",
"order_number": "Order Number",
"orderedby": "Ordered By",
"quantity": "Qty.",
"return": "Return",
"status": "Status"

View File

@@ -1602,6 +1602,7 @@
"oem_partno": "",
"order_date": "",
"order_number": "",
"orderedby": "",
"quantity": "",
"return": "",
"status": ""

View File

@@ -1602,6 +1602,7 @@
"oem_partno": "",
"order_date": "",
"order_number": "",
"orderedby": "",
"quantity": "",
"return": "",
"status": ""

View File

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

View File

@@ -0,0 +1,6 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."conversations" ADD COLUMN "archived" boolean NOT NULL
DEFAULT false;
type: run_sql

View File

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

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: ALTER TABLE "public"."parts_orders" ADD COLUMN "orderedby" text NULL;
type: run_sql

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."parts_orders" drop constraint "parts_orders_orderedby_fkey";
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."parts_orders"
add constraint "parts_orders_orderedby_fkey"
foreign key ("orderedby")
references "public"."users"
("email") on update set null on delete set null;
type: run_sql

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: parts_orders
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- created_at
- deliver_by
- id
- jobid
- order_date
- order_number
- return
- returnfrombill
- status
- updated_at
- user_email
- vendorid
set: {}
role: user
table:
name: parts_orders
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: parts_orders
schema: public
type: drop_insert_permission
- args:
permission:
check:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
columns:
- created_at
- deliver_by
- id
- jobid
- order_date
- order_number
- orderedby
- return
- returnfrombill
- status
- updated_at
- user_email
- vendorid
set: {}
role: user
table:
name: parts_orders
schema: public
type: create_insert_permission

View File

@@ -0,0 +1,38 @@
- args:
role: user
table:
name: parts_orders
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- created_at
- deliver_by
- id
- jobid
- order_date
- order_number
- return
- returnfrombill
- status
- updated_at
- user_email
- vendorid
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: parts_orders
schema: public
type: create_select_permission

View File

@@ -0,0 +1,39 @@
- args:
role: user
table:
name: parts_orders
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: false
columns:
- created_at
- deliver_by
- id
- jobid
- order_date
- order_number
- orderedby
- return
- returnfrombill
- status
- updated_at
- user_email
- vendorid
computed_fields: []
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: parts_orders
schema: public
type: create_select_permission

View File

@@ -0,0 +1,36 @@
- args:
role: user
table:
name: parts_orders
schema: public
type: drop_update_permission
- args:
permission:
columns:
- created_at
- deliver_by
- id
- jobid
- order_date
- order_number
- returnfrombill
- status
- updated_at
- user_email
- vendorid
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: parts_orders
schema: public
type: create_update_permission

View File

@@ -0,0 +1,37 @@
- args:
role: user
table:
name: parts_orders
schema: public
type: drop_update_permission
- args:
permission:
columns:
- created_at
- deliver_by
- id
- jobid
- order_date
- order_number
- orderedby
- returnfrombill
- status
- updated_at
- user_email
- vendorid
filter:
job:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: parts_orders
schema: public
type: create_update_permission

View File

@@ -0,0 +1,30 @@
- args:
role: user
table:
name: conversations
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- phone_num
- created_at
- updated_at
- bodyshopid
- id
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: conversations
schema: public
type: create_select_permission

View File

@@ -0,0 +1,31 @@
- args:
role: user
table:
name: conversations
schema: public
type: drop_select_permission
- args:
permission:
allow_aggregations: true
columns:
- archived
- bodyshopid
- created_at
- id
- phone_num
- updated_at
computed_fields: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
role: user
table:
name: conversations
schema: public
type: create_select_permission

View File

@@ -0,0 +1,29 @@
- args:
role: user
table:
name: conversations
schema: public
type: drop_update_permission
- args:
permission:
columns:
- phone_num
- created_at
- updated_at
- bodyshopid
- id
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: conversations
schema: public
type: create_update_permission

View File

@@ -0,0 +1,30 @@
- args:
role: user
table:
name: conversations
schema: public
type: drop_update_permission
- args:
permission:
columns:
- archived
- bodyshopid
- created_at
- id
- phone_num
- updated_at
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: conversations
schema: public
type: create_update_permission

View File

@@ -0,0 +1,12 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."exportlog" drop constraint "exportlog_billid_fkey",
add constraint "exportlog_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id")
on update restrict
on delete restrict;
type: run_sql

View File

@@ -0,0 +1,10 @@
- args:
cascade: false
read_only: false
sql: |-
alter table "public"."exportlog" drop constraint "exportlog_billid_fkey",
add constraint "exportlog_billid_fkey"
foreign key ("billid")
references "public"."bills"
("id") on update cascade on delete cascade;
type: run_sql

View File

@@ -1114,11 +1114,12 @@ tables:
- role: user
permission:
columns:
- phone_num
- created_at
- updated_at
- archived
- bodyshopid
- created_at
- id
- phone_num
- updated_at
filter:
bodyshop:
associations:
@@ -1133,11 +1134,12 @@ tables:
- role: user
permission:
columns:
- phone_num
- created_at
- updated_at
- archived
- bodyshopid
- created_at
- id
- phone_num
- updated_at
filter:
bodyshop:
associations:
@@ -3622,6 +3624,7 @@ tables:
- jobid
- order_date
- order_number
- orderedby
- return
- returnfrombill
- status
@@ -3638,6 +3641,7 @@ tables:
- jobid
- order_date
- order_number
- orderedby
- return
- returnfrombill
- status
@@ -3664,6 +3668,7 @@ tables:
- jobid
- order_date
- order_number
- orderedby
- returnfrombill
- status
- updated_at

View File

@@ -265,11 +265,11 @@ function GenerateCostingData(job) {
acc.labor[laborProfitCenter].add(laborAmount);
if (val.mod_lbr_ty === "LAR") {
if (!acc.labor[defaultProfits["MAPA"]])
acc.labor[defaultProfits["MAPA"]] = Dinero();
if (!acc.parts[defaultProfits["MAPA"]])
acc.parts[defaultProfits["MAPA"]] = Dinero();
materialsHours.mapaHrs += val.mod_lb_hrs || 0;
acc.labor[defaultProfits["MAPA"]] = acc.labor[
acc.parts[defaultProfits["MAPA"]] = acc.parts[
defaultProfits["MAPA"]
].add(
Dinero({
@@ -277,11 +277,11 @@ function GenerateCostingData(job) {
}).multiply(val.mod_lb_hrs || 0)
);
}
if (!acc.labor[defaultProfits["MASH"]])
acc.labor[defaultProfits["MASH"]] = Dinero();
if (!acc.parts[defaultProfits["MASH"]])
acc.parts[defaultProfits["MASH"]] = Dinero();
if (val.mod_lbr_ty !== "LAR") {
acc.labor[defaultProfits["MASH"]] = acc.labor[
acc.parts[defaultProfits["MASH"]] = acc.parts[
defaultProfits["MASH"]
].add(
Dinero({
@@ -402,6 +402,7 @@ function GenerateCostingData(job) {
}).multiply(materialsHours.mapaHrs)
);
}
if (job.bodyshop.jc_hourly_rates && job.bodyshop.jc_hourly_rates.mash) {
if (
!billTotalsByCostCenters[