blob: cc1c9ce538eeb7be1aaa5f1094086e2a2b65db3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<div .table>
<div .tr .sepBelow>
<div .itemH>
<div .th>Item
<div .th>Type
<div .th>Bought
<div .th>Expires
<div .th>Opened
<div .th>Status
<div .th>Actions
$if isJust (preview insertForm =<< formState)
$with Just InsertForm{..} <- formState
<form .tr .sepBelow action=@{InventoryListingR} method=post enctype=#{fsInsertEncoding}>
<div .td>
^{fsInsertForm}
<div .td>
<button type=submit>
Insert
$forall WithType (Entity itemId Item{..}) itemType <- stock
$if Just itemId == (preview updateId =<< formState)
$with Just UpdateForm{..} <- formState
<form .tr .color action=@{UpdateItemR fsUpdateId}##{toPathPiece fsUpdateId} method=post enctype=#{fsUpdateEncoding} ##{toPathPiece fsUpdateId}>
<div .itemId>#{humanId itemId}
^{fsUpdateForm}
<div .td>
<button type=submit>
Save Changes
$else
<div .tr .color ##{toPathPiece itemId}>
<div .itemId>#{humanId itemId}
<div .kind>#{itemKind}
<div .type>#{itemType}
<div .td .day>
$case itemBought
$of DateUnknown
<hr>
$of DateKnown d
#{dayFormat d}
<div .td .day>
$case itemExpires
$of DateNever
<hr>
$of DateKnown d
<span :d < today:.expired :d < addDays 7 today:.expireWeek :d < addGregorianMonthsRollOver 1 today:.expireMonth>#{dayFormat d}
<div .td .day>
$case itemOpened
$of DateKnown d
#{dayFormat d}
$of DateUnknown
Yes
$of DateNever
<form method=post action=@{OpenItemR itemId}>
<button type=submit>
Open
<div .td>
<ul .status>
$if itemRunningLow
<li>Running low
<div .td>
<form method=get action=@{UpdateItemR itemId}##{toPathPiece itemId}>
<button type=submit>
Edit
<form method=post action=@{DeleteItemR itemId}>
<button type=submit>
Delete
|