|
@@ -14,14 +14,15 @@ import ModalAddUser from './modal/ModalAddUser.vue'
|
|
import ModalUpdateUsername from './modal/ModalUpdateUsername.vue'
|
|
import ModalUpdateUsername from './modal/ModalUpdateUsername.vue'
|
|
import ModalUpdatePassword from "./modal/ModalUpdatePassword.vue"
|
|
import ModalUpdatePassword from "./modal/ModalUpdatePassword.vue"
|
|
import ModalToast from "./modal/ModalToast.vue"
|
|
import ModalToast from "./modal/ModalToast.vue"
|
|
|
|
+import ModalExpiredNotifications from "./modal/ModalExpiredNotifications.vue"
|
|
import {useAuthStore} from '../stores/auth.js'
|
|
import {useAuthStore} from '../stores/auth.js'
|
|
import {usePlaceStore} from '../stores/place.js'
|
|
import {usePlaceStore} from '../stores/place.js'
|
|
-import {useThingStore, typePlace} from '../stores/thing.js'
|
|
|
|
|
|
+import {typePlace, useThingStore} from '../stores/thing.js'
|
|
import {useImageStore} from '../stores/image.js'
|
|
import {useImageStore} from '../stores/image.js'
|
|
import {useTagStore} from '../stores/tag.js'
|
|
import {useTagStore} from '../stores/tag.js'
|
|
import * as auth from "../auth/auth.js"
|
|
import * as auth from "../auth/auth.js"
|
|
import * as client from "../client/client.js"
|
|
import * as client from "../client/client.js"
|
|
-import {formatDate} from "../helpers/date.js"
|
|
|
|
|
|
+import {formatDateRusStr} from "../helpers/date.js"
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -36,6 +37,7 @@ export default {
|
|
ModalSearchThing,
|
|
ModalSearchThing,
|
|
ModalTags,
|
|
ModalTags,
|
|
ModalShowImage,
|
|
ModalShowImage,
|
|
|
|
+ ModalExpiredNotifications,
|
|
ModalAddUser,
|
|
ModalAddUser,
|
|
ModalUpdateUsername,
|
|
ModalUpdateUsername,
|
|
ModalUpdatePassword,
|
|
ModalUpdatePassword,
|
|
@@ -89,9 +91,7 @@ export default {
|
|
if (name === "setSelectedThing" && args.length) {
|
|
if (name === "setSelectedThing" && args.length) {
|
|
if (args[0] !== this.thingStore.selectedThing) {
|
|
if (args[0] !== this.thingStore.selectedThing) {
|
|
after(() => {
|
|
after(() => {
|
|
- let thingID = this.thingStore.selectedThing
|
|
|
|
-
|
|
|
|
- this.refreshThingImages(thingID)
|
|
|
|
|
|
+ this.refreshThingImages(this.thingStore.selectedThing)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -103,6 +103,7 @@ export default {
|
|
switch (name) {
|
|
switch (name) {
|
|
case "setAuth":
|
|
case "setAuth":
|
|
this.refreshPlaces()
|
|
this.refreshPlaces()
|
|
|
|
+ this.refreshExpiredNotifications()
|
|
break
|
|
break
|
|
case "resetAuth":
|
|
case "resetAuth":
|
|
this.resetPlaces()
|
|
this.resetPlaces()
|
|
@@ -114,6 +115,7 @@ export default {
|
|
// Refresh places after start
|
|
// Refresh places after start
|
|
if (this.authStore.isAuth) {
|
|
if (this.authStore.isAuth) {
|
|
this.refreshPlaces()
|
|
this.refreshPlaces()
|
|
|
|
+ this.refreshExpiredNotifications()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -191,7 +193,7 @@ export default {
|
|
"id": thing.id,
|
|
"id": thing.id,
|
|
"title": thing.title,
|
|
"title": thing.title,
|
|
"desc": thing.description,
|
|
"desc": thing.description,
|
|
- "date": formatDate(thing.updated_at),
|
|
|
|
|
|
+ "date": formatDateRusStr(thing.updated_at),
|
|
"tags": thing.tags
|
|
"tags": thing.tags
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -211,7 +213,7 @@ export default {
|
|
"image": host + image.image,
|
|
"image": host + image.image,
|
|
"place_id": image.place_id,
|
|
"place_id": image.place_id,
|
|
"thing_id": image.thing_id,
|
|
"thing_id": image.thing_id,
|
|
- "date": formatDate(image.created_at),
|
|
|
|
|
|
+ "date": formatDateRusStr(image.created_at),
|
|
})
|
|
})
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -229,12 +231,25 @@ export default {
|
|
"image": host + image.image,
|
|
"image": host + image.image,
|
|
"place_id": image.place_id,
|
|
"place_id": image.place_id,
|
|
"thing_id": image.thing_id,
|
|
"thing_id": image.thing_id,
|
|
- "date": formatDate(image.created_at),
|
|
|
|
|
|
+ "date": formatDateRusStr(image.created_at),
|
|
})
|
|
})
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ refreshExpiredNotifications() {
|
|
|
|
+ const interval = setInterval(() => {
|
|
|
|
+ if (this.$refs.modalExpiredNotifications) {
|
|
|
|
+ clearInterval(interval)
|
|
|
|
+
|
|
|
|
+ let res = this.request(client.methodGet, client.routeGetExpiredNotifications)
|
|
|
|
+ if (Array.isArray(res.data.notifications) && res.data.notifications.length) {
|
|
|
|
+ this.$refs.modalExpiredNotifications.init(res.data.notifications)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, 100)
|
|
|
|
+ },
|
|
|
|
+
|
|
// Actions
|
|
// Actions
|
|
|
|
|
|
addPlace() {
|
|
addPlace() {
|
|
@@ -361,7 +376,12 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ afterExpiredNotification(placeID, thingID) {
|
|
|
|
+ this.resetTags()
|
|
|
|
+ this.refreshPlaces(placeID)
|
|
|
|
+ this.refreshThings(placeID)
|
|
|
|
+ this.thingStore.setSelectedThing(thingID)
|
|
|
|
+ },
|
|
logout() {
|
|
logout() {
|
|
auth.clearToken()
|
|
auth.clearToken()
|
|
this.authStore.resetAuth()
|
|
this.authStore.resetAuth()
|
|
@@ -586,6 +606,7 @@ export default {
|
|
<ModalSearchThing ref="modalSearchThing" @after-search-thing="afterSearchThing" @after-filter-tag="afterFilterTag"></ModalSearchThing>
|
|
<ModalSearchThing ref="modalSearchThing" @after-search-thing="afterSearchThing" @after-filter-tag="afterFilterTag"></ModalSearchThing>
|
|
<ModalTags ref="modalTags" @after-tags="afterTags"></ModalTags>
|
|
<ModalTags ref="modalTags" @after-tags="afterTags"></ModalTags>
|
|
<ModalShowImage ref="modalShowImage"></ModalShowImage>
|
|
<ModalShowImage ref="modalShowImage"></ModalShowImage>
|
|
|
|
+ <ModalExpiredNotifications ref="modalExpiredNotifications" @after-expired-notification="afterExpiredNotification"></ModalExpiredNotifications>
|
|
<ModalAddUser ref="modalAddUser" @after-add-user="afterAddUser"></ModalAddUser>
|
|
<ModalAddUser ref="modalAddUser" @after-add-user="afterAddUser"></ModalAddUser>
|
|
<ModalUpdateUsername ref="modalUpdateUsername" @after-update-username="afterUpdateUsername"></ModalUpdateUsername>
|
|
<ModalUpdateUsername ref="modalUpdateUsername" @after-update-username="afterUpdateUsername"></ModalUpdateUsername>
|
|
<ModalUpdatePassword ref="modalUpdatePassword" @after-update-password="afterUpdatePassword"></ModalUpdatePassword>
|
|
<ModalUpdatePassword ref="modalUpdatePassword" @after-update-password="afterUpdatePassword"></ModalUpdatePassword>
|