mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-13 14:33:17 +03:30
fix : search user
This commit is contained in:
@@ -1,68 +1,85 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<v-container>
|
<v-container>
|
||||||
<material-card class color="black" title="New Message" text>
|
<material-card class color="black" text title="New Message">
|
||||||
<v-layout wrap class="px-4 mb-3">
|
<v-layout class="px-4 mb-3" wrap>
|
||||||
<v-flex xs12 sm12 md12>
|
<v-flex md12 sm12 xs12>
|
||||||
<v-autocomplete
|
<v-autocomplete
|
||||||
:items="items"
|
v-model="user_id"
|
||||||
:loading="loading"
|
:items="items"
|
||||||
:search-input.sync="search"
|
:loading="loading"
|
||||||
v-model="user_id"
|
:search-input.sync="search"
|
||||||
item-text="name"
|
color="black"
|
||||||
item-value="id"
|
item-text="name"
|
||||||
label="Search"
|
item-value="id"
|
||||||
persistent-hint
|
label="Search"
|
||||||
prepend-icon="fas fa-search"
|
persistent-hint
|
||||||
color="black"
|
prepend-icon="fas fa-search"
|
||||||
>
|
>
|
||||||
<template v-slot:no-data>
|
<template v-slot:no-data>
|
||||||
<v-list-tile>
|
<v-list-tile>
|
||||||
<v-list-tile-content>
|
<v-list-tile-content>
|
||||||
<v-list-tile-title class="black--text">
|
<v-list-tile-title class="black--text">
|
||||||
{{ loading ? 'Searching...' : 'please search the contact name' }}
|
{{ loading ? 'Searching...' : 'please search the contact name' }}
|
||||||
</v-list-tile-title>
|
</v-list-tile-title>
|
||||||
</v-list-tile-content>
|
</v-list-tile-content>
|
||||||
</v-list-tile>
|
</v-list-tile>
|
||||||
</template>
|
</template>
|
||||||
</v-autocomplete>
|
<template v-slot:chip="{ item }">
|
||||||
</v-flex>
|
{{ item.name }}
|
||||||
</v-layout>
|
<span class="px-1" v-if="item.roles && item.roles.length"> -
|
||||||
<ticket-send-message :user-id="user_id" />
|
<span v-for="(role, key) in item.roles" :key="key">
|
||||||
</material-card>
|
{{ role.name === 'Admin' ? 'Suport' : role.name }}
|
||||||
</v-container>
|
</span>
|
||||||
</div>
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:item="{ item }">
|
||||||
|
{{ item.name }}
|
||||||
|
<span class="px-1" v-if="item.roles && item.roles.length"> -
|
||||||
|
<span v-for="(role, key) in item.roles" :key="key">
|
||||||
|
{{ role.name === 'Admin' ? 'Suport' : role.name }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</v-autocomplete>
|
||||||
|
</v-flex>
|
||||||
|
</v-layout>
|
||||||
|
<ticket-send-message :user-id="user_id"/>
|
||||||
|
</material-card>
|
||||||
|
</v-container>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { ApiService } from "@/services";
|
import {ApiService} from "@/services";
|
||||||
import { urls } from "@/config/urls";
|
import {urls} from "@/config/urls";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
items: [],
|
items: [],
|
||||||
search: "",
|
search: "",
|
||||||
user_id: 0
|
user_id: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
search(val) {
|
search(val) {
|
||||||
val && val.length > 2 && this.querySelections(val);
|
val && val.length > 2 && this.querySelections(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async querySelections(val) {
|
||||||
|
if (!this.loading) {
|
||||||
|
this.loading = true;
|
||||||
|
const result = await ApiService.get(urls.userSearch(val));
|
||||||
|
if (result && result.data.data) {
|
||||||
|
this.items = result.data.data;
|
||||||
|
this.loading = false;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
}
|
||||||
async querySelections(val) {
|
},
|
||||||
if (!this.loading) {
|
|
||||||
this.loading = true;
|
|
||||||
const result = await ApiService.get(urls.userSearch(val));
|
|
||||||
if (result && result.data.data) {
|
|
||||||
this.items = result.data.data;
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user