From f35315c490897e01c135945acddd452d32924e4f Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Tue, 27 Sep 2022 15:52:47 -0400 Subject: [PATCH 1/2] Add selection buttons --- src/components/AllocationClientSpecifics.js | 193 +++++++++++--------- 1 file changed, 102 insertions(+), 91 deletions(-) diff --git a/src/components/AllocationClientSpecifics.js b/src/components/AllocationClientSpecifics.js index 9569339e..6376c3bb 100644 --- a/src/components/AllocationClientSpecifics.js +++ b/src/components/AllocationClientSpecifics.js @@ -44,7 +44,8 @@ const AllocationClientSpecifics = (props) => { project, setContributor, setProject, - setNewAllocation + setNewAllocation, + allocationSelection } = props const { @@ -174,99 +175,109 @@ const AllocationClientSpecifics = (props) => { return ( - - - - - - - - - - - {`${paymentAmount}`} - - - - - {`${payment.date_paid - ? moment.utc(payment.date_paid, 'x').format('MM/DD/YYYY') - : '' - }`} - {`${ - !payment.date_paid && payment.date_incurred - ? 'Warning: This payment has not been paid' - : '' + {allocationSelection[0] + ? ( + + + + + + + + + + + {`${paymentAmount}`} + + + + + {`${payment.date_paid + ? moment.utc(payment.date_paid, 'x').format('MM/DD/YYYY') + : '' + }`} + {`${ + !payment.date_paid && payment.date_incurred + ? 'Warning: This payment has not been paid' + : '' - }`} - - - - - - + }`} + + + + + + - - - - - - - - - - {selectedProject ? selectedProject.name : 'No selected'} - - - - - {`${githubProjectHandle}`} - - - - {openProjectsList - ? - : - } - - - - - {listProjects({ - projects, - selectedProject: selectedProject - })} - - - - - - - - - {selectedContributor ? selectedContributor.name : 'No selected'} - - - - - {`${githubContributorHandle}`} - - - - {openContributorsList - ? - : - } - - - - - {listContributors(contributors)} - - - + + + + + + + + + + {selectedProject ? selectedProject.name : 'No selected'} + + + + + {`${githubProjectHandle}`} + + + + {openProjectsList + ? + : + } + + + + + {listProjects({ + projects, + selectedProject: selectedProject + })} + + + + + + + + + {selectedContributor ? selectedContributor.name : 'No selected'} + + + + + {`${githubContributorHandle}`} + + + + {openContributorsList + ? + : + } + + + + + {listContributors(contributors)} + + + - + + ) : ( + + + 'test' + + + ) + } ) From b1f0940366044cad7b501e5ca1a0f51937f626a2 Mon Sep 17 00:00:00 2001 From: Ovidio Rodriguez Date: Tue, 27 Sep 2022 15:53:17 -0400 Subject: [PATCH 2/2] Selection buttons --- src/components/AllocationAddForm.js | 42 ++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/components/AllocationAddForm.js b/src/components/AllocationAddForm.js index f88809ab..b1c792f3 100644 --- a/src/components/AllocationAddForm.js +++ b/src/components/AllocationAddForm.js @@ -61,6 +61,7 @@ const AllocationAddForm = (props) => { } = props const [allocationTypes, setAllocationTypes] = useState([1, 0]) + const [allocationSelection, setAllocationSelection] = useState([1, 0]) const [contributorAllocations, setContributorAllocations] = useState(null) const [contributorRates, setContributorRates] = useState(null) const [displayError, setDisplayError] = useState(false) @@ -84,6 +85,14 @@ const AllocationAddForm = (props) => { setAllocationTypes([...allocationTypesState]) } + const addAllocationOrLinkPayment = (props) => { + const { allocationSelection, selection } = props + const selectionState = allocationSelection + fill(selectionState, 0) + selectionState[selection] = 1 + setAllocationSelection([...selectionState]) + } + const handleAlertClose = (event, reason) => { if (reason === 'clickaway') { return @@ -427,7 +436,37 @@ const AllocationAddForm = (props) => { > - {`Add Allocation`} + {project && + `Add Allocation` + } + {client && !selectedProject && + + + + + } @@ -457,6 +496,7 @@ const AllocationAddForm = (props) => { setNewAllocation={setNewAllocation} setContributor={setSelectedContributor} setProject={setSelectedProject} + allocationSelection={allocationSelection} /> ) : (