Remove NewBook room blocking — app never writes to NewBook

Unsellable flag is in-app visibility only; staff mark rooms out of
order in NewBook through their own process. NewBook use is now
read-only (room sync + occupancy filter).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-03 21:37:52 +00:00
parent 6ca395097e
commit 3289a31027
9 changed files with 11 additions and 114 deletions

View file

@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react'
import { X, Camera } from 'lucide-react'
import type { Category, Location, Task, Priority, AppConfig, Asset } from '../types'
import { PRIORITIES, PRIORITY_LABELS } from '../types'
import { createTask, fetchTasks, uploadTaskPhoto, blockRoomInNewbook, fetchAssets } from '../api'
import { createTask, fetchTasks, uploadTaskPhoto, fetchAssets } from '../api'
import AssigneeSelect, { type Assignment } from './AssigneeSelect'
import { PriorityBadge, StatusBadge } from './shared'
@ -33,7 +33,6 @@ export default function NewTaskModal({ categories, locations, config, onClose, o
contractor_id: config?.default_contractor_id ?? null,
})
const location = useMemo(() => locations.find(l => l.id === locationId), [locations, locationId])
const locationAssets = useMemo(
() => assets.filter(a => a.location_id === locationId),
[assets, locationId]
@ -75,14 +74,6 @@ export default function NewTaskModal({ categories, locations, config, onClose, o
await uploadTaskPhoto(task.id, file, 'report').catch(() => {})
}
// Explicit confirm — never block a room in NewBook silently
if (unusable && location?.source === 'newbook') {
const ok = window.confirm(
`Also mark ${location.name} as out of order in NewBook (status: ${config?.newbook_block_status || 'Maintenance'}) so it can't be sold?`
)
if (ok) await blockRoomInNewbook(task.id).catch(err => window.alert(`NewBook block failed: ${err.message}`))
}
onCreated()
onClose()
} catch (err) {
@ -157,10 +148,15 @@ export default function NewTaskModal({ categories, locations, config, onClose, o
</div>
</div>
<label className="field-check" style={{ marginBottom: 12 }}>
<label className="field-check" style={{ marginBottom: unusable ? 4 : 12 }}>
<input type="checkbox" checked={unusable} onChange={e => setUnusable(e.target.checked)} />
Makes this location unusable / unsellable
</label>
{unusable && (
<div className="field-hint" style={{ marginBottom: 12 }}>
This flag is for visibility here only mark the room out of order in NewBook as usual.
</div>
)}
<div className="field-row">
<div className="field">