Merged in feature/IO-1828-Front-End-Package-Updates (pull request #1146)

Feature/IO-1828 Front End Package Updates
This commit is contained in:
Dave Richer
2024-01-09 23:39:53 +00:00
6 changed files with 169 additions and 162 deletions

View File

@@ -16,6 +16,7 @@ const BillLineSearchSelect = (
ref={ref} ref={ref}
showSearch showSearch
popupMatchSelectWidth={false} popupMatchSelectWidth={false}
optionLabelProp={"name"}
// optionFilterProp="line_desc" // optionFilterProp="line_desc"
filterOption={(inputValue, option) => { filterOption={(inputValue, option) => {
return ( return (
@@ -57,6 +58,9 @@ const BillLineSearchSelect = (
style={{ style={{
...(item.removed ? { textDecoration: "line-through" } : {}), ...(item.removed ? { textDecoration: "line-through" } : {}),
}} }}
name={`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
item.oem_partno ? ` - ${item.oem_partno}` : ""
}${item.alt_partno ? ` (${item.alt_partno})` : ""}`.trim()}
> >
<span> <span>
{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${ {`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${

View File

@@ -76,7 +76,7 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
const mileageOver = nextservicekm ? nextservicekm <= mileage : false; const mileageOver = nextservicekm ? nextservicekm <= mileage : false;
const dueForService = const dueForService =
nextservicedate && dayjs(nextservicedate).end('day').isSameOrBefore(dayjs()); nextservicedate && dayjs(nextservicedate).endOf('day').isSameOrBefore(dayjs());
return ( return (
<Space> <Space>

View File

@@ -222,7 +222,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
{`${job.v_vin || t("general.labels.na")}`} {`${job.v_vin || t("general.labels.na")}`}
</VehicleVinDisplay> </VehicleVinDisplay>
{bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? ( {bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? (
job.v_vin.length !== 17 ? ( job.v_vin?.length !== 17 ? (
<WarningFilled style={{ color: "tomato", marginLeft: ".3rem" }} /> <WarningFilled style={{ color: "tomato", marginLeft: ".3rem" }} />
) : null ) : null
) : null} ) : null}

View File

@@ -1,10 +1,10 @@
import _ from "lodash/"; import {groupBy} from "lodash";
const sortByParentId = (arr) => { const sortByParentId = (arr) => {
// return arr.reduce((accumulator, currentValue) => { // return arr.reduce((accumulator, currentValue) => {
// //Find the parent item. // //Find the parent item.
// let item = accumulator.find((x) => x.id === currentValue.kanbanparent); // let item = accumulator.find((x) => x.id === currentValue.kanbanparent);
// //Get index of praent item // //Get index of parent item
// let index = accumulator.indexOf(item); // let index = accumulator.indexOf(item);
// index = index !== -1 ? index + 1 : 0; // index = index !== -1 ? index + 1 : 0;
@@ -12,9 +12,9 @@ const sortByParentId = (arr) => {
// return accumulator; // return accumulator;
// }, []); // }, []);
var parentId = "-1"; let parentId = "-1";
var sortedList = []; const sortedList = [];
var byParentsIdsList = _.groupBy(arr, "kanbanparent"); // Create a new array with objects indexed by parentId const byParentsIdsList = groupBy(arr, "kanbanparent"); // Create a new array with objects indexed by parentId
//console.log("sortByParentId -> byParentsIdsList", byParentsIdsList); //console.log("sortByParentId -> byParentsIdsList", byParentsIdsList);
while (byParentsIdsList[parentId]) { while (byParentsIdsList[parentId]) {
@@ -41,7 +41,6 @@ const sortByParentId = (arr) => {
export const createBoardData = (AllStatuses, Jobs, filter) => { export const createBoardData = (AllStatuses, Jobs, filter) => {
const {search, employeeId} = filter; const {search, employeeId} = filter;
console.log("==========GENERATING BOARD DATA=============");
const boardLanes = { const boardLanes = {
columns: AllStatuses.map((s) => { columns: AllStatuses.map((s) => {
return { return {
@@ -73,12 +72,13 @@ export const createBoardData = (AllStatuses, Jobs, filter) => {
return include; return include;
}); });
const DataGroupedByStatus = _.groupBy(filteredJobs, (d) => d.status); const DataGroupedByStatus = groupBy(filteredJobs, (d) => d.status);
Object.keys(DataGroupedByStatus).map((statusGroupKey) => { Object.keys(DataGroupedByStatus).map((statusGroupKey) => {
try { try {
boardLanes.columns.find((l) => l.id === statusGroupKey).cards = const needle = boardLanes.columns.find((l) => l.id === statusGroupKey);
sortByParentId(DataGroupedByStatus[statusGroupKey]); if (!needle?.cards) return null;
needle.cards = sortByParentId(DataGroupedByStatus[statusGroupKey]);
} catch (error) { } catch (error) {
console.log("Error while creating board card", error); console.log("Error while creating board card", error);
} }

View File

@@ -2,6 +2,7 @@ import { HeartOutlined } from "@ant-design/icons";
import {Select, Space, Tag} from "antd"; import {Select, Space, Tag} from "antd";
import React, {forwardRef, useEffect, useState} from "react"; import React, {forwardRef, useEffect, useState} from "react";
import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import PhoneNumberFormatter from "../../utils/PhoneFormatter";
const {Option} = Select; const {Option} = Select;
//To be used as a form element only. //To be used as a form element only.
@@ -41,6 +42,7 @@ const VendorSearchSelect = (
optionFilterProp="name" optionFilterProp="name"
onSelect={onSelect} onSelect={onSelect}
disabled={disabled || false} disabled={disabled || false}
optionLabelProp={"name"}
> >
{favorites {favorites
? favorites.map((o) => ( ? favorites.map((o) => (
@@ -81,6 +83,7 @@ const VendorSearchSelect = (
</Space> </Space>
</div> </div>
</Option> </Option>
)) ))
: null} : null}
</Select> </Select>

View File

@@ -1,6 +1,6 @@
import { useMutation, useQuery } from "@apollo/client"; import { useMutation, useQuery } from "@apollo/client";
import { Form, notification } from "antd"; import { Form, notification } from "antd";
import dayjs from "dayjs"; import dayjs from "../../utils/day";
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";