diff --git a/src/frontend/src/apis/bom.api.ts b/src/frontend/src/apis/bom.api.ts index 0930251cd9..215861dfb1 100644 --- a/src/frontend/src/apis/bom.api.ts +++ b/src/frontend/src/apis/bom.api.ts @@ -144,9 +144,13 @@ export const assignMaterialToAssembly = async (materialId: string, payload: { as }; export const getAssembliesForWbsElement = async (wbsNum: WbsNumber) => { - return axios.get(apiUrls.bomGetAssembliesByWbsNum(wbsNum)); + return axios.get(apiUrls.bomGetAssembliesByWbsNum(wbsNum), { + transformResponse: (data) => JSON.parse(data) + }); }; export const getMaterialsForWbsElement = async (wbsNum: WbsNumber) => { - return axios.get(apiUrls.bomGetMaterialsByWbsNum(wbsNum)); + return axios.get(apiUrls.bomGetMaterialsByWbsNum(wbsNum), { + transformResponse: (data) => JSON.parse(data) + }); }; diff --git a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTable.tsx b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTable.tsx index fda3715149..d771a396e1 100644 --- a/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTable.tsx +++ b/src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/BOMTable.tsx @@ -18,7 +18,7 @@ const BOMTable: React.FC = ({ setHideColumn, columns, materials, const [openRows, setOpenRows] = useState([]); const arrowSymbol = (rowId: string) => { - return openRows.includes(rowId) ? '⮝' : '⮟'; + return openRows.includes(rowId) ? '▼' : '▶'; }; const noAssemblyMaterials = materials.filter((material) => !material.assembly); @@ -49,9 +49,7 @@ const BOMTable: React.FC = ({ setHideColumn, columns, materials, type: '', name: '', manufacturer: '', - manufacturerPN: `Assembly - ${assembly.name}: $${centsToDollar( - assembly.materials.reduce(addMaterialCosts, 0) - )} ${arrowSymbol(assembly.assemblyId)}`, + manufacturerPN: `Assembly - ${assembly.name}: $${centsToDollar(assembly.materials.reduce(addMaterialCosts, 0))} ${arrowSymbol(assembly.assemblyId)}`, pdmFileName: '', quantity: '', price: '', @@ -66,7 +64,7 @@ const BOMTable: React.FC = ({ setHideColumn, columns, materials, return ( { if (assembliesIsLoading || materialsIsLoading || !materials || !assemblies) return ; + console.log(assemblies); const totalCost = materials.reduce(addMaterialCosts, 0); return ( @@ -55,7 +56,7 @@ const BOMTab = ({ project }: { project: Project }) => { assemblies={assemblies} /> setShowAddAssembly(false)} wbsElement={project} /> - + { setHideColumn={setHideColumn} /> - + setShowAddMaterial(true)} diff --git a/src/frontend/src/utils/urls.ts b/src/frontend/src/utils/urls.ts index 19e0b1d0aa..3a34691cba 100644 --- a/src/frontend/src/utils/urls.ts +++ b/src/frontend/src/utils/urls.ts @@ -144,7 +144,7 @@ const financeLeadershipApprove = (id: string) => `${financeEndpoints()}/${id}/le const bomEndpoints = () => `${API_URL}/projects/bom`; const materialEndpoints = () => `${bomEndpoints()}/material`; const assemblyEndpoints = () => `${bomEndpoints()}/assembly`; -const bomGetMaterialsByWbsNum = (wbsNum: WbsNumber) => `${materialEndpoints}/${wbsPipe(wbsNum)}`; +const bomGetMaterialsByWbsNum = (wbsNum: WbsNumber) => `${bomEndpoints()}/${wbsPipe(wbsNum)}/materials`; const bomGetAllUnits = () => `${bomEndpoints()}/units`; const bomGetAllMaterialTypes = () => `${bomEndpoints()}/material-type`; const bomGetAllManufacturers = () => `${bomEndpoints()}/manufacturer`;