Skip to content

Commit

Permalink
fix: unable to edit
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Sep 25, 2023
1 parent b6597c5 commit 8239719
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ interface AreFormFieldsDisabledOptions {
}

function areFormFieldsDisabled(options: AreFormFieldsDisabledOptions) {
console.log({
options,
});

/** non-active incidents are always editable */
if (!options.isActiveIncidentsList) return false;
/** dispatch can always edit the fields */
Expand Down Expand Up @@ -103,10 +107,10 @@ export function ManageIncidentModal<T extends LeoIncident | EmsFdIncident>({
const isOfficerIncidents = router.pathname.includes("/officer");

const activeUnit = isOfficerIncidents ? activeOfficer : isEmsFdIncidents ? activeDeputy : null;
const isActiveIncidentsList = isOfficerIncidents || isEmsFdIncidents;
const isReadOnly = isOfficerIncidents || isEmsFdIncidents;

const areFieldsDisabled = areFormFieldsDisabled({
isActiveIncidentsList,
isActiveIncidentsList: !isReadOnly,
isDispatch,
hasActiveDispatchers,
incident,
Expand Down Expand Up @@ -298,11 +302,7 @@ export function ManageIncidentModal<T extends LeoIncident | EmsFdIncident>({
</FormRow>

{incident ? (
<InvolvedUnitsTable
type={type}
isDisabled={areFieldsDisabled}
incident={incident}
/>
<InvolvedUnitsTable type={type} isDisabled={isReadOnly} incident={incident} />
) : null}
</div>

Expand Down Expand Up @@ -336,7 +336,7 @@ export function ManageIncidentModal<T extends LeoIncident | EmsFdIncident>({
{incident ? (
<IncidentEventsArea
handleStateUpdate={handleAddUpdateCallEvent}
disabled={areFieldsDisabled}
disabled={isReadOnly}
incident={incident}
/>
) : null}
Expand Down

0 comments on commit 8239719

Please sign in to comment.