added the cable estimator and the pdf stuff that goes with it
This commit is contained in:
parent
9074120f74
commit
e039a75bf8
26 changed files with 3157 additions and 24 deletions
71
src/cableEstimator/cableMounting.tsx
Normal file
71
src/cableEstimator/cableMounting.tsx
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import { Box, Typography } from "@mui/material";
|
||||
import { jsonBin, CableSum, getBracket } from "common/DataImports/BinCables/BinCableImporter";
|
||||
import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
||||
//import { getTableIcons } from "common/ResponsiveTable";
|
||||
//import MaterialTable from "material-table";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { distanceConversion, getDistanceUnit } from "utils";
|
||||
|
||||
interface Props {
|
||||
bin: jsonBin;
|
||||
}
|
||||
|
||||
export default function CableMounting(props: Props) {
|
||||
const { bin } = props;
|
||||
// const [tablePage, setTablePage] = useState(0)
|
||||
// const [pageSize, setPageSize] = useState(10)
|
||||
|
||||
const roofDist = (distance: number) => {
|
||||
return distance / Math.cos(bin.RoofAngle * (Math.PI / 180));
|
||||
};
|
||||
|
||||
const columns: Column<CableSum>[] = [
|
||||
{
|
||||
title: "Orbit",
|
||||
render: (row: CableSum) => <Box padding={2}>{row.Orbit === 0 ? "Center" : row.Orbit}</Box>
|
||||
},
|
||||
{
|
||||
title: "From Center " + (getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET ? "(ft)" : "(m)"),
|
||||
render: (row: CableSum) => (
|
||||
<Box padding={2}>{distanceConversion(row.DistanceFromCenter).toFixed(2)}</Box>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: "Along Roof" + (getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET ? "(ft)" : "(m)"),
|
||||
render: (row: CableSum) => (
|
||||
<Box padding={2}>{distanceConversion(roofDist(row.DistanceFromCenter)).toFixed(2)}</Box>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: "Bracket",
|
||||
render: (row: CableSum) => {
|
||||
let bracketType = "None"
|
||||
let bracket = getBracket(row.Bracket)
|
||||
if(row.Orbit !== 0 && bracket !== undefined) {
|
||||
bracketType = bracket.Name + " (" + row.NumberOfCables + ")"
|
||||
}else {
|
||||
bracketType = "Unknown"
|
||||
}
|
||||
return (
|
||||
<Box padding={2}>
|
||||
{bracketType}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
return (
|
||||
<ResponsiveTable<CableSum>
|
||||
title={<Typography style={{ fontSize: 20, fontWeight: 650 }}>Install Guide</Typography>}
|
||||
rows={bin.CableSums}
|
||||
columns={columns}
|
||||
page={0}
|
||||
pageSize={0}
|
||||
handleRowsPerPageChange={()=>{}}
|
||||
setPage={()=>{}}
|
||||
total={0}
|
||||
hidePagination
|
||||
/>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue