Revert "fix: allow Edit only on Available assets"
This reverts commit 72cdae3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
72cdae3d1c
commit
0d2e7585b8
@ -168,21 +168,18 @@ export default function AssetDetails() {
|
|||||||
const isAssigned = isAssetState(row, ASSET_STATE.ASSIGNED)
|
const isAssigned = isAssetState(row, ASSET_STATE.ASSIGNED)
|
||||||
const isAvailable = isAssetState(row, ASSET_STATE.AVAILABLE)
|
const isAvailable = isAssetState(row, ASSET_STATE.AVAILABLE)
|
||||||
const isUnderRepair = isAssetState(row, ASSET_STATE.UNDER_REPAIR)
|
const isUnderRepair = isAssetState(row, ASSET_STATE.UNDER_REPAIR)
|
||||||
// ASSIGNED, Send for Repair and Edit (Asset details) run in Available;
|
// ASSIGNED and Send for Repair run in Available; Reassigned in Assigned; Lost
|
||||||
// Reassigned in Assigned; Lost in either; Repair Completed in Under Repair.
|
// in either; Repair Completed in Under Repair; Edit in all three. RETURNED
|
||||||
// The builder has Asset details in Available only, so the runtime rejects it
|
// runs in any state but Closed, and the runtime says if the state doesn't
|
||||||
// elsewhere ("Asset details" is not allowed in "Assigned"). RETURNED runs in
|
// allow it. If the view sends no state, let the runtime decide rather than
|
||||||
// any state but Closed, and the runtime says if the state doesn't allow it.
|
// hiding the buttons.
|
||||||
// If the view sends no state, let the runtime decide rather than hiding the
|
|
||||||
// buttons.
|
|
||||||
const isOpen = !state || isAvailable || isAssigned || isUnderRepair
|
|
||||||
const canAssign = !state || isAvailable
|
const canAssign = !state || isAvailable
|
||||||
const canReassign = !state || isAssigned
|
const canReassign = !state || isAssigned
|
||||||
const canReturn = !isAssetState(row, ASSET_STATE.CLOSED) && !isEndState(row)
|
const canReturn = !isAssetState(row, ASSET_STATE.CLOSED) && !isEndState(row)
|
||||||
const canReportLost = !state || isAvailable || isAssigned
|
const canReportLost = !state || isAvailable || isAssigned
|
||||||
const canSendForRepair = !state || isAvailable
|
const canSendForRepair = !state || isAvailable
|
||||||
const canCompleteRepair = !state || isUnderRepair
|
const canCompleteRepair = !state || isUnderRepair
|
||||||
const canEdit = !state || isAvailable
|
const canEdit = !state || isAvailable || isAssigned || isUnderRepair
|
||||||
|
|
||||||
// Assigned or reassigned, whichever is newer, is who has it now.
|
// Assigned or reassigned, whichever is newer, is who has it now.
|
||||||
const current = currentAssignment(row)
|
const current = currentAssignment(row)
|
||||||
@ -254,12 +251,7 @@ export default function AssetDetails() {
|
|||||||
<Button icon="history" onClick={load} disabled={loading}>
|
<Button icon="history" onClick={load} disabled={loading}>
|
||||||
{loading ? 'Refreshing…' : 'Refresh'}
|
{loading ? 'Refreshing…' : 'Refresh'}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button icon="edit" onClick={() => openActivity('edit')} disabled={!canEdit}>
|
||||||
icon="edit"
|
|
||||||
onClick={() => openActivity('edit')}
|
|
||||||
disabled={!canEdit}
|
|
||||||
title={canEdit ? undefined : 'Only an Available asset can be edited. Return it first.'}
|
|
||||||
>
|
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@ -297,7 +289,7 @@ export default function AssetDetails() {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{!isOpen && (
|
{!canEdit && (
|
||||||
<div className="notice notice--warning" role="status">
|
<div className="notice notice--warning" role="status">
|
||||||
<Icon name="alert" size={15} />
|
<Icon name="alert" size={15} />
|
||||||
<span>
|
<span>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user