Compare commits
3 Commits
04ff1b012b
...
68a8865dc6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68a8865dc6 | ||
|
|
aaf20ac9f3 | ||
|
|
76a9d4c1b3 |
@@ -150,9 +150,7 @@ createApp({
|
||||
this.users = [];
|
||||
this.status = '';
|
||||
this.error = '';
|
||||
this.view = 'byAud';
|
||||
// опционально: редирект на страницу логина
|
||||
// window.location.href = '/login';
|
||||
window.location.href = '/login';
|
||||
},
|
||||
authHeaders() {
|
||||
const h = {};
|
||||
@@ -162,6 +160,10 @@ createApp({
|
||||
async fetchAuth(url, options = {}) {
|
||||
const opt = { ...options, headers: { ...(options.headers||{}), ...this.authHeaders() } };
|
||||
const res = await fetch(url, opt);
|
||||
if (res.status === 401) {
|
||||
this.logout();
|
||||
return;
|
||||
}
|
||||
if (!res.ok) {
|
||||
const text = await res.text();
|
||||
throw new Error(`HTTP ${res.status}: ${text}`);
|
||||
@@ -305,6 +307,11 @@ createApp({
|
||||
const d = new Date(dateStr);
|
||||
return d.toLocaleString('ru-RU');
|
||||
},
|
||||
formatTime(dateStr) {
|
||||
if (!dateStr) return '';
|
||||
const d = new Date(dateStr);
|
||||
return d.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' });
|
||||
},
|
||||
async loadEquipmentTypes() {
|
||||
try {
|
||||
this.equipmentTypes = await fetchJSON('/equipment-types/');
|
||||
|
||||
@@ -419,11 +419,11 @@
|
||||
|
||||
<div v-if="canEdit" class="mb-4">
|
||||
<h5>Добавить заметку</h5>
|
||||
<div class="row g-2 align-items-end">
|
||||
<div class="row g-2">
|
||||
<div class="col-md-8">
|
||||
<textarea class="form-control" v-model="newZametkaText" rows="3" placeholder="Текст заметки..."></textarea>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="col-md-8">
|
||||
<button class="btn btn-success" @click="createZametka">Добавить</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -436,8 +436,10 @@
|
||||
<div v-for="z in zametki" :key="z.id" class="card mb-2">
|
||||
<div class="card-body">
|
||||
<p class="card-text" style="white-space: pre-wrap;">{{ z.txtzam }}</p>
|
||||
<small class="text-muted">{{ formatDate(z.created_date) }}</small>
|
||||
<button v-if="canEdit" class="btn btn-sm btn-outline-success float-end" @click="resolveZametka(z.id)">Решено</button>
|
||||
<div>
|
||||
<small class="text-muted">{{ formatTime(z.created_date) }}</small>
|
||||
</div>
|
||||
<button v-if="canEdit" class="btn btn-sm btn-outline-success mt-1" @click="resolveZametka(z.id)">Решено</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -733,6 +735,6 @@
|
||||
|
||||
<script src="/app/vue.global.prod.js"></script>
|
||||
<script src="/app/bootstrap.bundle.min.js"></script>
|
||||
<script src="/app/app.js" defer></script>
|
||||
<script src="/app/app.js?v=2" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user