feat(routines): add minimize_products option for batch suggestions
This commit is contained in:
parent
40f9a353bb
commit
609995732b
4 changed files with 26 additions and 4 deletions
|
|
@ -150,6 +150,7 @@ export const suggestBatch = (body: {
|
|||
to_date: string;
|
||||
notes?: string;
|
||||
include_minoxidil_beard?: boolean;
|
||||
minimize_products?: boolean;
|
||||
}): Promise<BatchSuggestion> => api.post('/routines/suggest-batch', body);
|
||||
|
||||
export const getGroomingSchedule = (): Promise<GroomingSchedule[]> =>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ export const actions: Actions = {
|
|||
const to_date = form.get('to_date') as string;
|
||||
const notes = (form.get('notes') as string) || undefined;
|
||||
const include_minoxidil_beard = form.get('include_minoxidil_beard') === 'on';
|
||||
const minimize_products = form.get('minimize_products') === 'on';
|
||||
|
||||
if (!from_date || !to_date) {
|
||||
return fail(400, { error: 'Daty początkowa i końcowa są wymagane.' });
|
||||
|
|
@ -54,7 +55,7 @@ export const actions: Actions = {
|
|||
}
|
||||
|
||||
try {
|
||||
const batch = await suggestBatch({ from_date, to_date, notes, include_minoxidil_beard });
|
||||
const batch = await suggestBatch({ from_date, to_date, notes, include_minoxidil_beard, minimize_products });
|
||||
return { batch, from_date, to_date };
|
||||
} catch (e) {
|
||||
return fail(502, { error: (e as Error).message });
|
||||
|
|
|
|||
|
|
@ -286,6 +286,18 @@
|
|||
<p class="text-xs text-muted-foreground">{m["suggest_minoxidilToggleHint"]()}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-start gap-3 rounded-md border border-border px-3 py-2">
|
||||
<input
|
||||
id="batch_minimize_products"
|
||||
name="minimize_products"
|
||||
type="checkbox"
|
||||
class="mt-0.5 h-4 w-4 rounded border-input"
|
||||
/>
|
||||
<div class="space-y-0.5">
|
||||
<Label for="batch_minimize_products" class="font-medium">Minimalizuj produkty</Label>
|
||||
<p class="text-xs text-muted-foreground">Ogranicz liczbę różnych produktów</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button type="submit" disabled={loadingBatch} class="w-full">
|
||||
{#if loadingBatch}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue