%PDF- %PDF-
Direktori : /home/ugotscom/.trash/karetakers/resources/js/components/ |
Current File : /home/ugotscom/.trash/karetakers/resources/js/components/leads.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 Clients</div> <div class="h5 mb-0 font-weight-bold text-gray-800"> <p>{{counts.length}}</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">Clients</div> <div class="h5 mb-0 font-weight-bold text-gray-800">220</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">Current Projects</div> <div class="h5 mb-0 font-weight-bold text-gray-800">12</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">Leads</div> <div class="h5 mb-0 font-weight-bold text-gray-800">220</div> </div> </div> </div> </div> <div class="row justify-content-center"> <div class="col-md-12"> <input type="text" class="form-control" @input="isTyping = true" v-model="searchQuery" placeholder="Type your keyword"> <table class="table table-bordered"> <thead> <tr> <th scope="col">Id</th> <th scope="col">Client Name</th> <th scope="col">Email</th> <th scope="col">Status</th> <th scope="col">Location</th> </tr> </thead> <tbody> <tr v-for ="user in users.data" :key="user.id"> <th scope="row">{{user.id}}</th> <td>{{user.lead_name}}</td> <td>{{user.email}}</td> <td> <div v-bind:style="{ backgroundColor: user.color }" class="status-style"> {{user.status}} </div> </td> <td>{{user.location}}</td> <td><router-link ></router-link></td> <td><router-link v-bind:to="'/viewlead/'+user.id">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:{} } }, 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('leads/searchquery?q=' + searchQuery) .then(response => { this.isLoading = false; this.users = response.data; }); }, getResults(page = 1) { axios.get('leads?page=' + page) .then(response => { this.users = response.data; }); }, loadusers(){ axios.get('/leads').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.counta() }, } </script> <style scoped> .status-style{ text-align: center; color: #fff; } </style>