%PDF- %PDF-
Direktori : /home/ugotscom/bos_naturals/resources/js/components/ |
Current File : /home/ugotscom/bos_naturals/resources/js/components/users.vue |
<template> <div class="container"> <div class="row"> <div class="col"> <div class="card border-left-primary shadow h-100 py-2"> <div class="card-body"> <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Total Leads</div> <div class="h5 mb-0 font-weight-bold text-gray-800"> <p>{{count['total']}}</p></div> <router-link @click="say()">click me</router-link> </div> </div> </div> <div class="col"> <div class="card border-left-primary shadow h-100 py-2"> <div class="card-body"> <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Site Visit Pending</div> <div class="h5 mb-0 font-weight-bold text-gray-800">{{count['sitevisit']}}</div> </div> </div> </div> <div class="col"> <div class="card border-left-primary shadow h-100 py-2"> <div class="card-body"> <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Quote in Progress</div> <div class="h5 mb-0 font-weight-bold text-gray-800">{{count['quoteinprogreess']}}</div> </div> </div> </div> <div class="col"> <div class="card border-left-primary shadow h-100 py-2"> <div class="card-body"> <div class="text-xs font-weight-bold text-primary text-uppercase mb-1">Won</div> <div class="h5 mb-0 font-weight-bold text-gray-800">{{count['won']}}</div> </div> </div> </div> </div> <div class="row"> <div class="col-md-8"> <input type="text" class="form-control" @input="isTyping = true" v-model="searchQuery" placeholder="Search Maintenance Leads by Id or Name"> </div> <div class="col-md-4"> <select v-model="dataFilter" v-on:click="changeItem()"> <option value="0">All</option> <option value="1">Open Leads</option> <option value="2">Site Visit Assigned</option> <option value="3">Quote in Progress</option> <option value="4">Quoted</option> <option value="5">Won</option> <option value="6">Rejected</option> <option value="8">Lost</option> </select> </div> </div> <div class="row justify-content-center"> <div class="col-md-12"> <table class="table table-bordered"> <thead> <tr> <th scope="col">Id</th> <th scope="col">Client Name</th> <th scope="col">Company Name</th> <th scope="col">Role</th> <th scope="col">Status</th> <th scope="col">Action</th> </tr> </thead> <tbody> <tr v-for ="user in users" :key="user.leadid"> <th scope="row">{{user.id}}</th> <td>{{user.name}}</td> <td v-if="user.company==1">VFM</td> <td v-else>Karetakers</td> <td>{{user.role}}</td> <td><div class="something" v-if="authenticated"> Will show if user authenticated. </div></td> <td><router-link>View</router-link></td> </tr> </tbody> </table> <pagination :data="users" @pagination-change-page="getResults"></pagination> </div> </div> </div> </template> <script> export default { mounted() { console.log('Component mounted.') }, data(){ return { users:{}, searchQuery:'', isTyping: false, isLoading: false, counts:{}, count:[], dataFilter:0, } }, watch: { searchQuery: _.debounce(function() { this.isTyping = false; }, 1000), isTyping: function(value) { if (!value) { this.searchUser(this.searchQuery); } } }, methods:{ searchUser: function(searchQuery) { this.isLoading = true; axios.get('users/searchquery?q=' + searchQuery) .then(response => { this.isLoading = false; this.users = response.data; }); }, loadtotalcount(){ axios.get('/maintenance/totalcount') .then(response => { this.count = response.data }) }, getResults(page = 1) { axios.get('/maintenance/leads/'+this.dataFilter+'?page=' + page) .then(response => { this.users = response.data; }); }, loadusers(){ axios.get('/users').then(({data})=> (this.users = data)); }, changeItem(){ axios.get('/maintenance/leads/'+this.dataFilter).then(({data})=> (this.users = data)); }, getPosts: function() { axios.get('/leads').then(function(response){ this.rows = response.data; }.bind(this)); }, getcount(){ axios.get('/leads').then(({data})=> (this.counts = data)); } }, created: function(){ this.loadusers(), this.loadtotalcount() }, } </script> <style scoped> .status-style{ text-align: center; color: #fff; } </style>