mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-29 20:05:51 +02:00
Setting to show only available items. On by default.
This commit is contained in:
parent
97b4b25933
commit
c8a1e41abb
|
@ -10,6 +10,7 @@ class Settings extends Model {
|
|||
STORE_KEYS.forEach((store) => {
|
||||
this[store] = stores[store].defaultChecked;
|
||||
});
|
||||
this.onlyAvailable = true;
|
||||
|
||||
let settings = localStorage.getItem("settings");
|
||||
if (settings) {
|
||||
|
|
|
@ -21,22 +21,23 @@ class SettingsView extends View {
|
|||
></custom-checkbox>`
|
||||
).join("")}
|
||||
</div>
|
||||
<label
|
||||
>Start-Datum für Diagramme
|
||||
<div class="flex flex-row gap-2">
|
||||
Start-Datum für Diagramme
|
||||
<input
|
||||
x-id="startDate"
|
||||
x-change
|
||||
x-state
|
||||
type="date"
|
||||
class="cursor-pointer inline-flex items-center gap-x-1 rounded-full bg-white border border-gray-400 px-2 py-1 text-xs font-medium text-gray-600"
|
||||
/></label>
|
||||
<label>
|
||||
class="flex-grow cursor-pointer inline-flex items-center gap-x-1 rounded-full bg-white border border-gray-400 px-2 py-1 text-xs font-medium text-gray-600">
|
||||
</div>
|
||||
<div class="flex flex-row gap-2">
|
||||
Diagramm Typ
|
||||
<select x-id="chartType" x-change x-state>
|
||||
<select x-id="chartType" x-change x-state class="flex-grow">
|
||||
<option value="stepped">Stufen</option>
|
||||
<option value="lines">Linien</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<custom-checkbox x-id="onlyAvailable" x-state x-change label="Nur verfügbare Produkte anzeigen" checked></custom-checkbox>
|
||||
</div>
|
||||
`;
|
||||
this.setupEventHandlers();
|
||||
|
|
|
@ -180,6 +180,10 @@ class ItemsFilter extends View {
|
|||
return;
|
||||
}
|
||||
|
||||
if (settings.onlyAvailable) {
|
||||
filteredItems = filteredItems.filter((item) => !item.unavailable);
|
||||
}
|
||||
|
||||
this.model.lastDate = null;
|
||||
if (this._filterByPriceChanges) {
|
||||
if (elements.priceChangesToday.checked) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user