Skip to content

Commit e907c18

Browse files
committed
updated request
1 parent f58aeb1 commit e907c18

File tree

1 file changed

+79
-56
lines changed

1 file changed

+79
-56
lines changed

usr-web/src/routes/(apps)/manifest/+page.svelte

Lines changed: 79 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
let pending_order_store_in: string = $state('');
8989
let pending_order_team: Team | '' = $state('');
9090
let pending_order_reason = $state('');
91-
let change_order_ref_number: number | undefined = $state(undefined);
91+
let update_order_ref_number: number | undefined = $state(undefined);
9292
let updated_order_status: OrderStatus['status'] | '' = $state('');
9393
9494
function populatePending() {
@@ -102,6 +102,7 @@
102102
pending_order_store_in = order.store_in;
103103
pending_order_team = order.team;
104104
pending_order_reason = order.reason;
105+
update_order_ref_number = order.reference_number;
105106
}
106107
}
107108
@@ -124,13 +125,24 @@
124125
}
125126
126127
function exportCSV() {
127-
const header = ['Name', 'Vendor', 'Link', 'Count', 'Unit Cost', 'Store In', 'Team', 'Reason', 'Subtotal', 'Status'];
128+
const header = [
129+
'Name',
130+
'Vendor',
131+
'Link',
132+
'Count',
133+
'Unit Cost',
134+
'Store In',
135+
'Team',
136+
'Reason',
137+
'Subtotal',
138+
'Status'
139+
];
128140
const lines = [header.join(',')];
129141
130142
for (const o of orders) {
131143
const st = statuses
132-
.filter(s => s.order_id === o.id)
133-
.map(s => {
144+
.filter((s) => s.order_id === o.id)
145+
.map((s) => {
134146
const date = s.date as Date;
135147
const day = String(date.getDate()).padStart(2, '0');
136148
const month = String(date.getMonth() + 1).padStart(2, '0');
@@ -139,18 +151,11 @@
139151
})
140152
.join(',');
141153
const sub = (o.count * (o.unit_cost as number)).toFixed(2);
142-
lines.push([
143-
o.name,
144-
o.vendor,
145-
o.link,
146-
o.count,
147-
o.unit_cost,
148-
o.store_in,
149-
o.team,
150-
o.reason,
151-
sub,
152-
st,
153-
].map(String).join(','));
154+
lines.push(
155+
[o.name, o.vendor, o.link, o.count, o.unit_cost, o.store_in, o.team, o.reason, sub, st]
156+
.map(String)
157+
.join(',')
158+
);
154159
}
155160
156161
const csv = new Blob([lines.join('\n')], { type: 'text/csv' });
@@ -215,12 +220,17 @@
215220
<td class="order-name">{order.name}</td>
216221
<td class="order-status">
217222
{#each statusesOf(order.id) as status}
218-
<p><span class="italic">{status.status}</span>: {status.date.toLocaleString('en-US', {
219-
weekday: 'short',
220-
year: 'numeric',
221-
month: 'long',
222-
day: 'numeric'
223-
})}</p>
223+
<p>
224+
<span class="italic">{status.status}</span>: {status.date.toLocaleString(
225+
'en-US',
226+
{
227+
weekday: 'short',
228+
year: 'numeric',
229+
month: 'long',
230+
day: 'numeric'
231+
}
232+
)}
233+
</p>
224234
{/each}
225235
</td>
226236
<td class="order-vendor">{order.vendor}</td>
@@ -389,7 +399,7 @@
389399
team: pending_order_team,
390400
reason: pending_order_reason,
391401
store_in: pending_order_store_in,
392-
change_order_ref_number
402+
change_order_ref_number: update_order_ref_number
393403
})
394404
});
395405
if (response.ok) {
@@ -409,15 +419,6 @@
409419
{:else}
410420
{@render input()}
411421

412-
<label>
413-
Ref Number
414-
<input
415-
type="number"
416-
bind:value={change_order_ref_number}
417-
placeholder="Reference Number"
418-
/>
419-
</label>
420-
421422
<button
422423
onclick={async () => {
423424
if (
@@ -474,6 +475,14 @@
474475
<option value="Delivered">Delivered</option>
475476
<option value="InStorage">In Storage</option>
476477
</select>
478+
<label>
479+
Ref Number
480+
<input
481+
type="number"
482+
bind:value={update_order_ref_number}
483+
placeholder="Reference Number"
484+
/>
485+
</label>
477486

478487
<button
479488
onclick={async () => {
@@ -488,7 +497,8 @@
488497
},
489498
body: JSON.stringify({
490499
id: selectedOrderId,
491-
status: updated_order_status
500+
status: updated_order_status,
501+
ref_number: update_order_ref_number
492502
})
493503
});
494504
if (response.ok) {
@@ -532,39 +542,52 @@
532542
{/if}
533543
{:else if tabIndex === 4}
534544
{#snippet cost(team: string)}
535-
<p>{team} Total: {(expenditures[team] ?? 0).toLocaleString(
536-
'en-US',
537-
{ style: 'currency', currency: 'USD' }
538-
)}</p>
545+
<p>
546+
{team} Total: {(expenditures[team] ?? 0).toLocaleString('en-US', {
547+
style: 'currency',
548+
currency: 'USD'
549+
})}
550+
</p>
539551
{/snippet}
540-
{@render cost("Software")}
541-
{@render cost("Mechanical")}
542-
{@render cost("Electrical")}
543-
<p>Club Total: {(Object.values(expenditures).reduce((a, b) => a + b)).toLocaleString(
544-
'en-US',
545-
{ style: 'currency', currency: 'USD' }
546-
)}</p>
547-
548-
<section class="flex flex-col w-min" style:background-color="darkgray">
549-
<div class="relative flex flex-row gap-10 w-min pt-8 pr-8 pl-20" style:min-height="20rem">
552+
{@render cost('Software')}
553+
{@render cost('Mechanical')}
554+
{@render cost('Electrical')}
555+
<p>
556+
Club Total: {Object.values(expenditures)
557+
.reduce((a, b) => a + b)
558+
.toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
559+
</p>
560+
561+
<section class="flex w-min flex-col" style:background-color="darkgray">
562+
<div class="relative flex w-min flex-row gap-10 pl-20 pr-8 pt-8" style:min-height="20rem">
550563
{#each { length: Math.floor(maxExpenditure / costIncrement) + 1 } as _, i}
551-
<div class="absolute flex flex-row" style:width={"calc(100% - 5rem)"} style:right="1rem" style:bottom={`calc((100% - 2rem) * ${i*costIncrement / maxExpenditure})`}>
564+
<div
565+
class="absolute flex flex-row"
566+
style:width={'calc(100% - 5rem)'}
567+
style:right="1rem"
568+
style:bottom={`calc((100% - 2rem) * ${(i * costIncrement) / maxExpenditure})`}
569+
>
552570
<div class="w-full border-t-2 border-black"></div>
553-
<p class="absolute mr-2" style:bottom="-0.75rem" style:right="100%">${i * costIncrement}</p>
571+
<p class="absolute mr-2" style:bottom="-0.75rem" style:right="100%">
572+
${i * costIncrement}
573+
</p>
554574
</div>
555575
{/each}
556576

557577
{#snippet bar(team: string)}
558-
<div class="flex flex-col" style:z-index=1>
559-
<div class="flex flex-col justify-end flex-grow items-center">
560-
<div style:background-color="darkred" style:height={`calc(100% * ${expenditures[team] / maxExpenditure})`} style:width="3rem">
561-
</div>
578+
<div class="flex flex-col" style:z-index="1">
579+
<div class="flex flex-grow flex-col items-center justify-end">
580+
<div
581+
style:background-color="darkred"
582+
style:height={`calc(100% * ${expenditures[team] / maxExpenditure})`}
583+
style:width="3rem"
584+
></div>
562585
</div>
563586
</div>
564587
{/snippet}
565-
{@render bar("Software")}
566-
{@render bar("Mechanical")}
567-
{@render bar("Electrical")}
588+
{@render bar('Software')}
589+
{@render bar('Mechanical')}
590+
{@render bar('Electrical')}
568591
</div>
569592
<div class="flex flex-row gap-4" style:margin-left="4.5rem">
570593
<p>Software</p>

0 commit comments

Comments
 (0)