-
-
-
- {{item.detail}}
-
-
- {{item.detail}}
-
-
-
- {{item.time_interval}}
-
-
-
+
+
+ Load more
+
@@ -96,14 +100,15 @@ export default {
loadingNotification:false,
bellBadge : 0,
unread_message_length:0,
+ url: '/api/notification/user',
+ pagination: [],
}),
-
computed: mapGetters({
user: 'auth/user'
}),
mounted(){
- this.getNotification();
+ this.getNotification(this.url);
},
methods: {
async logout(){
@@ -113,15 +118,16 @@ export default {
// Redirect to login.
this.$router.push({ name: 'login' });
},
- getNotification(){
+ getNotification(url){
this.notification = [];
this.loadingNotification=true;
axios
- .get('/api/notification/user/')
+ .get(url)
.then((response) => {
this.loadingNotification=false;
- this.notification = response.data;
- this.bellBadge = this.notification.unread_message.length;
+ this.notification = response.data.message.data;
+ this.bellBadge = response.data.unread_message.length;
+ this.makePagination(response.data.message);
console.log(response.data);
}).catch((error) => {
console.log(error)
@@ -130,11 +136,40 @@ export default {
})
})
},
+ makePagination(data){
+ let pagination ={
+ current_page: data.current_page,
+ last_page: data.last_page,
+ next_page_url: data.next_page_url,
+ prev_page_url: data.prev_page_url
+ };
+ this.pagination = pagination;
+ },
+ fetchPaginateBooking(url) {
+ this.url = url;
+ this.loadingNotification=true;
+ if(this.url !== null){
+ axios
+ .get(url)
+ .then((response) => {
+ this.loadingNotification=false;
+ this.notification = this.notification.concat(response.data.message.data);
+ this.bellBadge = response.data.unread_message.length;
+ this.makePagination(response.data.message);
+ console.log(this.notification);
+ }).catch((error) => {
+ console.log(error)
+ this.$router.push({
+ name: 'notfound'
+ })
+ })
+ }
+ },
readNotification(notification_id){
axios
.post('/api/notification/read-notification/'+notification_id)
.then((response) => {
- this.getNotification();
+ this.getNotification(this.url);
}).catch((error) => {
console.log(error)
this.$router.push({
@@ -156,9 +191,16 @@ export default {
margin: -.375rem 0;
}
.el-dropdown-menu{
- max-height: 50%;
+ height: 50%;
+}
+#notification{
overflow-y: scroll;
overflow-x: hidden;
+ max-height: 100%;
+}
+#notification-load-more{
+ position: absolute;
+ width: 100%;
}
.el-dropdown-menu__item {
line-height: 26px;
diff --git a/resources/assets/js/pages/admin/home.vue b/resources/assets/js/pages/admin/home.vue
index a595a717..167a4daf 100644
--- a/resources/assets/js/pages/admin/home.vue
+++ b/resources/assets/js/pages/admin/home.vue
@@ -81,7 +81,6 @@ export default {
axios.get(this.url).then(response => {
this.bookingTable = response.data.data;
$this.makePagination(this.bookingTable);
- console.log(response.data.data);
})
},
RefreshBooking() {
@@ -106,7 +105,6 @@ export default {
prev_page_url: data.prev_page_url
}
this.pagination = pagination
- console.log(this.pagination)
},
fetchPaginateBooking(url) {
this.url = url
diff --git a/resources/assets/js/pages/home.vue b/resources/assets/js/pages/home.vue
index 4ed1c829..0842ba43 100644
--- a/resources/assets/js/pages/home.vue
+++ b/resources/assets/js/pages/home.vue
@@ -597,6 +597,7 @@ export default {
}
axios.post('api/booking', newBooking)
.then((response) => {
+ console.log(response);
this.loading = false
// push with return id
this.$router.push({