feat(products): compute price tiers from objective price/use
This commit is contained in:
parent
c5ea38880c
commit
83ba4cc5c0
13 changed files with 664 additions and 48 deletions
|
|
@ -20,7 +20,6 @@
|
|||
];
|
||||
const textures = ['watery', 'gel', 'emulsion', 'cream', 'oil', 'balm', 'foam', 'fluid'];
|
||||
const absorptionSpeeds = ['very_fast', 'fast', 'moderate', 'slow', 'very_slow'];
|
||||
const priceTiers = ['budget', 'mid', 'premium', 'luxury'];
|
||||
const skinTypes = ['dry', 'oily', 'combination', 'sensitive', 'normal', 'acne_prone'];
|
||||
const skinConcerns = [
|
||||
'acne', 'rosacea', 'hyperpigmentation', 'aging', 'dehydration',
|
||||
|
|
@ -71,13 +70,6 @@
|
|||
very_slow: m["productForm_absorptionVerySlow"]()
|
||||
});
|
||||
|
||||
const priceTierLabels = $derived<Record<string, string>>({
|
||||
budget: m["productForm_priceBudget"](),
|
||||
mid: m["productForm_priceMid"](),
|
||||
premium: m["productForm_pricePremium"](),
|
||||
luxury: m["productForm_priceLuxury"]()
|
||||
});
|
||||
|
||||
const skinTypeLabels = $derived<Record<string, string>>({
|
||||
dry: m["productForm_skinTypeDry"](),
|
||||
oily: m["productForm_skinTypeOily"](),
|
||||
|
|
@ -210,7 +202,8 @@
|
|||
if (r.recommended_time) recommendedTime = r.recommended_time;
|
||||
if (r.texture) texture = r.texture;
|
||||
if (r.absorption_speed) absorptionSpeed = r.absorption_speed;
|
||||
if (r.price_tier) priceTier = r.price_tier;
|
||||
if (r.price_amount != null) priceAmount = String(r.price_amount);
|
||||
if (r.price_currency) priceCurrency = r.price_currency;
|
||||
if (r.leave_on != null) leaveOn = String(r.leave_on);
|
||||
if (r.size_ml != null) sizeMl = String(r.size_ml);
|
||||
if (r.full_weight_g != null) fullWeightG = String(r.full_weight_g);
|
||||
|
|
@ -260,7 +253,8 @@
|
|||
let leaveOn = $state(untrack(() => (product?.leave_on != null ? String(product.leave_on) : 'true')));
|
||||
let texture = $state(untrack(() => product?.texture ?? ''));
|
||||
let absorptionSpeed = $state(untrack(() => product?.absorption_speed ?? ''));
|
||||
let priceTier = $state(untrack(() => product?.price_tier ?? ''));
|
||||
let priceAmount = $state(untrack(() => (product?.price_amount != null ? String(product.price_amount) : '')));
|
||||
let priceCurrency = $state(untrack(() => product?.price_currency ?? 'PLN'));
|
||||
let fragranceFree = $state(
|
||||
untrack(() => (product?.fragrance_free != null ? String(product.fragrance_free) : ''))
|
||||
);
|
||||
|
|
@ -776,16 +770,13 @@
|
|||
<CardContent class="space-y-4">
|
||||
<div class="grid grid-cols-2 gap-4 sm:grid-cols-3">
|
||||
<div class="space-y-2">
|
||||
<Label>{m["productForm_priceTier"]()}</Label>
|
||||
<input type="hidden" name="price_tier" value={priceTier} />
|
||||
<Select type="single" value={priceTier} onValueChange={(v) => (priceTier = v)}>
|
||||
<SelectTrigger>{priceTier ? priceTierLabels[priceTier] : m["productForm_selectTier"]()}</SelectTrigger>
|
||||
<SelectContent>
|
||||
{#each priceTiers as p}
|
||||
<SelectItem value={p}>{priceTierLabels[p]}</SelectItem>
|
||||
{/each}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Label for="price_amount">Price</Label>
|
||||
<Input id="price_amount" name="price_amount" type="number" min="0" step="0.01" placeholder="e.g. 79.99" bind:value={priceAmount} />
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<Label for="price_currency">Currency</Label>
|
||||
<Input id="price_currency" name="price_currency" maxlength={3} placeholder="PLN" bind:value={priceCurrency} />
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue