mirror of
https://github.com/Fluffy-Bean/TastyBites.git
synced 2024-12-28 02:16:07 +00:00
delivery fee
This commit is contained in:
parent
dcfec1e2db
commit
60ee8e49ae
|
@ -33,7 +33,8 @@
|
||||||
let unavailableItems: boolean;
|
let unavailableItems: boolean;
|
||||||
Cart.subscribe(() => {
|
Cart.subscribe(() => {
|
||||||
items = Cart.getEntries();
|
items = Cart.getEntries();
|
||||||
totalPrice = Cart.getTotalPrice();
|
totalPrice = 1.50 + Cart.getTotalPrice();
|
||||||
|
if (CheckoutData.delivery) totalPrice += 3.00
|
||||||
unavailableItems = Cart.getEntries().some(([_, item]) => item.data.availability === false);
|
unavailableItems = Cart.getEntries().some(([_, item]) => item.data.availability === false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -49,9 +50,14 @@
|
||||||
).addTo(leafletMap);
|
).addTo(leafletMap);
|
||||||
L.marker([50.82304922105467, -0.432780150496344]).addTo(leafletMap);
|
L.marker([50.82304922105467, -0.432780150496344]).addTo(leafletMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$: if (CheckoutData.delivery) {
|
||||||
|
totalPrice = 1.50 + 3.00 + Cart.getTotalPrice();
|
||||||
|
}
|
||||||
$: if (!CheckoutData.delivery) {
|
$: if (!CheckoutData.delivery) {
|
||||||
// Rendering maybe off-centered since map was initialized when div was hidden
|
// Rendering maybe off-centered since map was initialized when div was hidden
|
||||||
setTimeout(() => { leafletMap.invalidateSize() }, 1);
|
setTimeout(() => { leafletMap.invalidateSize() }, 1);
|
||||||
|
totalPrice = 1.50 + Cart.getTotalPrice();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
|
@ -233,6 +239,18 @@
|
||||||
<td>{item.amount}</td>
|
<td>{item.amount}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/each}
|
{/each}
|
||||||
|
<tr class="table-row-border">
|
||||||
|
<td>£1.50</td>
|
||||||
|
<td>Online order Fee</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{#if CheckoutData.delivery}
|
||||||
|
<tr>
|
||||||
|
<td>£3.00</td>
|
||||||
|
<td>Delivery fee</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
@ -424,6 +442,10 @@
|
||||||
color: $color-on-error;
|
color: $color-on-error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.table-row-border {
|
||||||
|
border-top: 2px solid rgba($color-dark, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
th, td {
|
th, td {
|
||||||
padding: $spacing-xsmall $spacing-small;
|
padding: $spacing-xsmall $spacing-small;
|
||||||
font-size: $font-size-small;
|
font-size: $font-size-small;
|
||||||
|
|
Loading…
Reference in a new issue