|
@@ -8,6 +8,7 @@
|
|
|
let isLoading = true;
|
|
let isLoading = true;
|
|
|
let user = null;
|
|
let user = null;
|
|
|
let currency = 'USD';
|
|
let currency = 'USD';
|
|
|
|
|
+ let orderBy = 'total';
|
|
|
|
|
|
|
|
$: authentication.subscribe((value) => {
|
|
$: authentication.subscribe((value) => {
|
|
|
isAuthenticated = !!value;
|
|
isAuthenticated = !!value;
|
|
@@ -31,6 +32,14 @@
|
|
|
} else {
|
|
} else {
|
|
|
localStorage.setItem('defaultCurrency', 'USD');
|
|
localStorage.setItem('defaultCurrency', 'USD');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ const defaultOrder = localStorage.getItem('defaultOrder');
|
|
|
|
|
+ if(defaultOrder) {
|
|
|
|
|
+ orderBy = defaultOrder;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ localStorage.setItem('defaultOrder', 'total');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('Error parsing stored auth:', error);
|
|
console.error('Error parsing stored auth:', error);
|
|
|
} finally {
|
|
} finally {
|
|
@@ -47,6 +56,11 @@
|
|
|
localStorage.setItem('defaultCurrency', currency);
|
|
localStorage.setItem('defaultCurrency', currency);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function updateOrderBy(event) {
|
|
|
|
|
+ orderBy = event.target.value;
|
|
|
|
|
+ localStorage.setItem('defaultOrder', orderBy);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<svelte:head>
|
|
<svelte:head>
|
|
@@ -68,6 +82,15 @@
|
|
|
</select>
|
|
</select>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <div class="button-container">
|
|
|
|
|
+ <select class="form-control order-select" on:change={updateOrderBy} value={orderBy}>
|
|
|
|
|
+ <option value="code">Order by Code</option>
|
|
|
|
|
+ <option value="name">Order by Name</option>
|
|
|
|
|
+ <option value="total" selected>Order by Total</option>
|
|
|
|
|
+ <option value="weight">Order by Weight</option>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<div class="button-container">
|
|
<div class="button-container">
|
|
|
<select class="form-control order-select">
|
|
<select class="form-control order-select">
|
|
|
<option value="light">Light</option>
|
|
<option value="light">Light</option>
|