Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Harin329 committed Jul 18, 2023
2 parents 61dced6 + c89ddee commit c85b61f
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 12 deletions.
1 change: 1 addition & 0 deletions backend/src/controllers/costCentreController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class CostCentreController {
const costCenterData = {
cost_center_id: req.body.cost_center_id,
cost_center_name: req.body.cost_center_name,
cost_center_investigator: req.body.cost_center_investigator,
cost_center_contact: req.body.cost_center_contact,
cost_center_email: req.body.cost_center_email,
cost_center_address: req.body.cost_center_address,
Expand Down
3 changes: 2 additions & 1 deletion backend/src/models/costCentre.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ export class CostCentre {

insertCostCentre(newCostCentre, result) {
con.query(
"CALL save_cost_center(?, ?, ?, ?, ?, ?)",
"CALL save_cost_center(?, ?, ?, ?, ?, ?, ?)",
[
newCostCentre.cost_center_id,
newCostCentre.cost_center_name,
newCostCentre.cost_center_investigator,
newCostCentre.cost_center_contact,
newCostCentre.cost_center_email,
newCostCentre.cost_center_address,
Expand Down
1 change: 1 addition & 0 deletions database/init/cost_centers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ BEGIN
CREATE TABLE `cost_centers` (
cost_center_id VARCHAR(50) NOT NULL,
cost_center_name VARCHAR(50),
cost_center_investigator VARCHAR(255),
cost_center_contact VARCHAR(255),
cost_center_email VARCHAR(255),
cost_center_address VARCHAR(255),
Expand Down
4 changes: 4 additions & 0 deletions database/procedures/costCenterProc.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ DELIMITER $$
CREATE PROCEDURE `save_cost_center` (
IN `_cost_center_id` VARCHAR(50),
IN `_cost_center_name` VARCHAR(50),
IN `_cost_center_investigator` VARCHAR(255),
IN `_cost_center_contact` VARCHAR(255),
IN `_cost_center_email` VARCHAR(255),
IN `_cost_center_address` VARCHAR(255),
Expand All @@ -17,6 +18,7 @@ CREATE PROCEDURE `save_cost_center` (
INSERT INTO `cost_centers` (
`cost_center_id`,
`cost_center_name`,
`cost_center_investigator`,
`cost_center_contact`,
`cost_center_email`,
`cost_center_address`,
Expand All @@ -26,13 +28,15 @@ VALUES
(
`_cost_center_id`,
`_cost_center_name`,
`_cost_center_investigator`,
`_cost_center_contact`,
`_cost_center_email`,
`_cost_center_address`,
`_cost_center_type`
) ON DUPLICATE KEY UPDATE
cost_centers.cost_center_id=_cost_center_id,
cost_centers.cost_center_name=_cost_center_name,
cost_centers.cost_center_investigator=_cost_center_investigator,
cost_centers.cost_center_contact=_cost_center_contact,
cost_centers.cost_center_email=_cost_center_email,
cost_centers.cost_center_address=_cost_center_address,
Expand Down
5 changes: 4 additions & 1 deletion database/procedures/formCreator/load-questions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ END $$
CREATE PROCEDURE `load_costs` ()

BEGIN
SELECT question, answer, questions_cost.fk_answer_id, organization_name, cost, questions_cost.*
SELECT question, answer, questions_cost.fk_answer_id, organization_name, cost, questions_cost.*, forms.form_name
FROM
questions

Expand All @@ -105,6 +105,9 @@ BEGIN
LEFT JOIN organizations
ON organizations.organization_type = questions_cost.price_category

LEFT JOIN forms
ON forms.form_id = questions.fk_form_id

WHERE cost IS NOT NULL
ORDER BY
position_index;
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/components/ClinicalBox/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,17 @@
font-weight: 600;
color: #DEDEDE;
cursor: pointer;
}

.clinicalXView {
flex: 0.01;
width: 50%;
text-align: left;
margin-top: 8px;
}

.clinicalX {
width: 20px;
height: 20px;
cursor: pointer;
}
10 changes: 8 additions & 2 deletions frontend/src/components/ClinicalBox/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useDispatch, useSelector } from "react-redux";
import uuid from "react-uuid";
import "./index.css";
import { ADD_CLINICAL_RESPONSE } from "../../redux/actions/formActions";
import X from "../../assets/X.png";
import { ADD_CLINICAL_RESPONSE, REMOVE_CLINICAL_RESPONSE } from "../../redux/actions/formActions";

function ClinicalBox({ question, option }) {
const dispatch = useDispatch();
Expand All @@ -16,7 +17,7 @@ function ClinicalBox({ question, option }) {
</div>
<div className="clinicalHeader">
<div className="headerLeft">Sample ID</div>
<div className="headerRight">Authorized By</div>
<div className="headerRight">Ordering Pathologist</div>
</div>
{Object.values(clinicalList)
.filter((value) => value.answer === option.answer_id)
Expand Down Expand Up @@ -52,6 +53,11 @@ function ClinicalBox({ question, option }) {
}}
/>
</div>
<div className="clinicalXView" onClick={() => {
dispatch({ type: REMOVE_CLINICAL_RESPONSE, payload: clinical.clinical_id })
}}>
<img src={X} className="clinicalX" alt="Delete Service" />
</div>
</div>
))}
<div
Expand Down
38 changes: 34 additions & 4 deletions frontend/src/components/CostCenterTable/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useRef, useContext, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Table, Form, Popconfirm, Input } from "antd";
import { Table, Form, Popconfirm, Input, Select } from "antd";
import "antd/dist/antd.min.css";
import "./index.css";
import RejectUser from "../../assets/RejectUser.png";
Expand All @@ -12,6 +12,8 @@ import {
POST_COSTCENTER,
} from "../../redux/actions/billingActions";

const costCenterTypes = ["Industry", "Internal", "External"];

const CostCenterTable = () => {
const columns = [
{
Expand All @@ -22,7 +24,14 @@ const CostCenterTable = () => {
width: "20%",
},
{
title: "Principal Contact",
title: "Principal Investigator",
dataIndex: "cost_center_investigator",
key: "cost_center_investigator",
editable: true,
width: "10%",
},
{
title: "Billing Contact",
dataIndex: "cost_center_contact",
key: "cost_center_contact",
editable: true,
Expand All @@ -40,14 +49,34 @@ const CostCenterTable = () => {
dataIndex: "cost_center_email",
key: "cost_center_email",
editable: true,
width: "20%",
width: "10%",
},
{
title: "Type",
dataIndex: "cost_center_type",
key: "cost_center_type",
editable: true,
width: "9%",
render: (_, record) =>
dataSource.length >= 1 ? (
<Select
style={{ width: "100%" }}
placeholder="Please select"
defaultValue={[]}
value={{
label: record.cost_center_type,
value: record.cost_center_type,
}}
onChange={(newList) => {
dispatch({ type: POST_COSTCENTER, payload: { ...record, cost_center_type: newList } });
}}
options={costCenterTypes.map((type) => {
return {
label: type,
value: type,
};
})}
/>
) : null,
},
{
title: "",
Expand Down Expand Up @@ -85,6 +114,7 @@ const CostCenterTable = () => {
const newData = {
cost_center_id: uuid(),
cost_center_name: "New Cost Center",
cost_center_investigator: "New Investigator",
cost_center_contact: "New Contact",
cost_center_email: "New Email",
cost_center_address: "New Address",
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/components/CostTable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ const CostTable = () => {
dataIndex: "service",
key: "service",
editable: false,
width: "35%",
width: "25%",
},
{
title: "Form",
dataIndex: "form_name",
key: "form_name",
editable: false,
width: "19%",
},
{
title: "Description",
dataIndex: "description",
key: "description",
editable: false,
width: "29%",
width: "20%",
},
{
title: "Internal Cost",
Expand Down Expand Up @@ -162,7 +169,7 @@ const CostTable = () => {
const newData = {
answer_id: row.key,
org_type: row.dataIndex.charAt(0).toUpperCase() + row.dataIndex.slice(1),
cost: row[row.dataIndex].slice(1),
cost: row[row.dataIndex].charAt(0) === "$" ? row[row.dataIndex].slice(1) : row[row.dataIndex],
cost_id: row.idMap[row.dataIndex],
quantifiable: row.quantifiable,
unit: row.unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const InvoiceTemplate = ({ customer, costcenterMap, invoicNum }) => {
<p className="header-table-title">Project Details: </p>
<p className="header-table-content">
Project ID: {customer.fk_project_id}<br />
Principal Investigator: {customer.cost_center_contact}<br />
Principal Investigator: {customer.cost_center_investigator}<br />
</p>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/redux/actions/formActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const ADD_OTHER_RESPONSE = "ADD_OTHER_RESPONSE";
export const REMOVE_OTHER_RESPONSE = "REMOVE_OTHER_RESPONSE";

export const ADD_CLINICAL_RESPONSE = "ADD_CLINICAL_RESPONSE";
export const REMOVE_CLINICAL_RESPONSE = "REMOVE_CLINICAL_RESPONSE";

export const SUBMIT_FORM = "SUBMIT_FORM";

Expand Down
1 change: 1 addition & 0 deletions frontend/src/redux/api/costcenterApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export const postCostCenterApi = async (payload) => {
var data = JSON.stringify({
cost_center_id: payload.cost_center_id,
cost_center_name: payload.cost_center_name,
cost_center_investigator: payload.cost_center_investigator,
cost_center_contact: payload.cost_center_contact,
cost_center_email: payload.cost_center_email,
cost_center_address: payload.cost_center_address,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/redux/reducers/costReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const costTableServices = (state = defaultCostDataSourceData, action) => {
} else {
pricingMap.set(item.fk_answer_id, {
key: item.fk_answer_id,
form_name: item.form_name,
service: item.answer,
description: item.question,
idMap: {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/redux/reducers/formReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
REMOVE_ALL_RESPONSE,
SET_DRAFTS,
SET_ALL_DRAFTS,
REMOVE_CLINICAL_RESPONSE,
} from "../actions/formActions";

const defaultQuestionlist = {
Expand Down Expand Up @@ -342,6 +343,10 @@ const clinicalResponses = (state = defaultClinicalResponses, action) => {
state[action.payload.clinical_id] = action.payload;
return { ...state };
}
case REMOVE_CLINICAL_RESPONSE: {
delete state[action.payload];
return { ...state };
}
default: {
return state;
}
Expand Down

0 comments on commit c85b61f

Please sign in to comment.