40 lines
3.1 KiB
Handlebars
40 lines
3.1 KiB
Handlebars
<div class="page-header">
|
|
<div>
|
|
<h2>Weather locations</h2>
|
|
<p>Save the locations used by weather regions and control how often their snapshots refresh.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card card-outline card-primary" data-table-search-container data-table-pagination-card>
|
|
<div class="card-header">
|
|
<h3 class="card-title">Saved locations</h3>
|
|
<div class="card-tools d-flex flex-nowrap align-items-center gap-2">
|
|
<div class="input-group input-group-sm flex-shrink-1 table-search-group" style="width: min(14rem, 100%);">
|
|
<span class="input-group-text" role="button" tabindex="0" aria-label="Search" data-table-search-toggle><i class="bi bi-search"></i></span>
|
|
<input type="search" class="form-control" placeholder="Search weather locations" aria-label="Search weather locations" data-table-search />
|
|
</div>
|
|
{{#if (hasPermission currentUser 'weather.create')}}<a class="btn btn-primary btn-sm" href="/data-sources/weather/new">Add<span class="table-action-context"> location</span></a>{{/if}}
|
|
</div>
|
|
</div>
|
|
<div class="card-body table-responsive p-0">
|
|
<table class="table table-striped w-100 mb-0" data-table-searchable>
|
|
<thead><tr><th data-table-sort-key="name">Name</th><th data-table-sort-key="location">Location</th><th data-table-sort-key="provider">Provider</th><th data-table-sort-key="interval">Refresh interval</th><th>Status</th><th>Actions</th></tr></thead>
|
|
<tbody>
|
|
{{#if weatherLocations.length}}
|
|
{{#each weatherLocations}}
|
|
<tr data-table-search-row>
|
|
<td data-label="Name">{{name}}</td><td data-label="Location">{{location_label}}<br><small class="text-muted">{{latitude}}, {{longitude}} · {{timezone}}</small></td><td data-label="Provider">{{provider}}</td><td data-label="Refresh interval">{{intervalLabel}}</td><td data-label="Status"><span class="badge text-bg-{{#if enabled}}success{{else}}danger{{/if}}">{{#if enabled}}Enabled{{else}}Disabled{{/if}}</span></td>
|
|
<td data-label="Actions"><div class="actions">
|
|
{{#if (hasPermission ../currentUser 'weather.update')}}<a class="btn btn-sm btn-primary" href="/data-sources/weather/{{id}}/edit">Edit</a>{{/if}}
|
|
{{#if (hasPermission ../currentUser 'weather.create')}}<a class="btn btn-sm btn-secondary" href="/data-sources/weather/{{id}}/duplicate">Dupe</a>{{/if}}
|
|
{{#if (hasPermission ../currentUser 'weather.delete')}}<form class="inline-form" method="post" action="/data-sources/weather/{{id}}/delete" data-confirm-message="Delete this weather location?">{{#if inUse}}<button class="btn btn-sm btn-outline-danger" type="submit" disabled>Delete</button>{{else}}<button class="btn btn-sm btn-danger" type="submit">Delete</button>{{/if}}</form>{{/if}}
|
|
</div></td>
|
|
</tr>
|
|
{{/each}}
|
|
{{else}}<tr data-table-search-empty-default><td colspan="6" class="empty">No weather locations yet.</td></tr>{{/if}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{> table-pagination pagination=pagination basePath="/data-sources/weather" alwaysShow=true}}
|
|
</div>
|