feat: repair-POS integration, receipt formats, manager overrides, price adjustments
- Add thermal/full-page receipt format toggle (per-device, localStorage) - Full-page receipt uses clean invoice layout matching repair PDF style - Settings page reorganized into tabbed sections (Store, Locations, Modules, Receipt, POS Security, Advanced) - Manager override system: configurable PIN prompt for void, refund, discount, cash in/out - Discount threshold setting: require manager approval above X% - Consumable product type: tracked for internal job costing, excluded from POS search, receipts, and customer-facing totals - Repair line item dialog: product picker dropdown for parts/consumables from inventory - Repair → POS checkout: load ready-for-pickup tickets into repair_payment transactions with proper tax categories (labor=service, parts=goods) - Transaction completion auto-updates repair ticket status to picked_up - POS Repairs dialog with Pickup and New Intake tabs, customer account lookup - Inline price adjustment on cart items: % off, $ off, or set price with live preview - Order-level discount button with same three input modes - Backend: migration 0043 (consumable enum + is_consumable flag), createFromRepairTicket service, ready-for-pickup endpoint - Fix: backend dev script uses --env-file for turbo compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import { Separator } from '@/components/ui/separator'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { ArrowDownToLine, ArrowUpFromLine } from 'lucide-react'
|
||||
import { toast } from 'sonner'
|
||||
import { ManagerOverrideDialog, requiresOverride } from './pos-manager-override'
|
||||
|
||||
interface POSDrawerDialogProps {
|
||||
open: boolean
|
||||
@@ -28,6 +29,8 @@ export function POSDrawerDialog({ open, onOpenChange, drawer }: POSDrawerDialogP
|
||||
const [adjustView, setAdjustView] = useState<'cash_in' | 'cash_out' | null>(null)
|
||||
const [adjAmount, setAdjAmount] = useState('')
|
||||
const [adjReason, setAdjReason] = useState('')
|
||||
const [overrideOpen, setOverrideOpen] = useState(false)
|
||||
const [pendingAdjustView, setPendingAdjustView] = useState<'cash_in' | 'cash_out' | null>(null)
|
||||
|
||||
// Fetch adjustments for open drawer
|
||||
const { data: adjData } = useQuery({
|
||||
@@ -93,6 +96,7 @@ export function POSDrawerDialog({ open, onOpenChange, drawer }: POSDrawerDialogP
|
||||
if (adjustView && isOpen) {
|
||||
const isCashIn = adjustView === 'cash_in'
|
||||
return (
|
||||
<>
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-sm">
|
||||
<DialogHeader>
|
||||
@@ -136,10 +140,12 @@ export function POSDrawerDialog({ open, onOpenChange, drawer }: POSDrawerDialogP
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-sm">
|
||||
<DialogHeader>
|
||||
@@ -164,7 +170,14 @@ export function POSDrawerDialog({ open, onOpenChange, drawer }: POSDrawerDialogP
|
||||
<Button
|
||||
variant="outline"
|
||||
className="h-11 gap-2"
|
||||
onClick={() => setAdjustView('cash_in')}
|
||||
onClick={() => {
|
||||
if (requiresOverride('cash_in_out')) {
|
||||
setPendingAdjustView('cash_in')
|
||||
setOverrideOpen(true)
|
||||
} else {
|
||||
setAdjustView('cash_in')
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ArrowDownToLine className="h-4 w-4 text-green-600" />
|
||||
Cash In
|
||||
@@ -172,7 +185,14 @@ export function POSDrawerDialog({ open, onOpenChange, drawer }: POSDrawerDialogP
|
||||
<Button
|
||||
variant="outline"
|
||||
className="h-11 gap-2"
|
||||
onClick={() => setAdjustView('cash_out')}
|
||||
onClick={() => {
|
||||
if (requiresOverride('cash_in_out')) {
|
||||
setPendingAdjustView('cash_out')
|
||||
setOverrideOpen(true)
|
||||
} else {
|
||||
setAdjustView('cash_out')
|
||||
}
|
||||
}}
|
||||
>
|
||||
<ArrowUpFromLine className="h-4 w-4 text-red-600" />
|
||||
Cash Out
|
||||
@@ -260,5 +280,16 @@ export function POSDrawerDialog({ open, onOpenChange, drawer }: POSDrawerDialogP
|
||||
)}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<ManagerOverrideDialog
|
||||
open={overrideOpen}
|
||||
onOpenChange={setOverrideOpen}
|
||||
action={pendingAdjustView === 'cash_in' ? 'Cash In' : 'Cash Out'}
|
||||
onAuthorized={() => {
|
||||
if (pendingAdjustView) setAdjustView(pendingAdjustView)
|
||||
setPendingAdjustView(null)
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user