add user search in creation.vue

This commit is contained in:
ogerly 2021-11-23 16:14:24 +01:00
parent d6e8d0cc6b
commit 9873ac6eee
7 changed files with 57 additions and 72 deletions

View File

@ -4,9 +4,10 @@
<h3>
{{
this.type === 'singleCreation'
? 'Einzelschöpfung für ' + item.first_name + ' ' + item.last_name + ''
? 'Einzelschöpfung für ' + item.firstName + ' ' + item.lastName + ''
: 'Massenschöpfung für ' + Object.keys(this.itemsMassCreation).length + ' Mitglieder'
}}
{{ item }}
</h3>
<div v-show="this.type === 'massCreation' && Object.keys(this.itemsMassCreation).length <= 0">
Bitte wähle ein oder Mehrere Mitglieder aus für die du Schöpfen möchtest
@ -105,7 +106,6 @@
:disabled="radioSelected === '' || value <= 0 || text.length < 10"
>
Update Schöpfung ({{ type }},{{ pagetype }})
{{ creationUserData }}
</b-button>
<b-button
@ -130,7 +130,7 @@ export default {
props: {
type: {
type: String,
required: true,
required: false,
},
pagetype: {
type: String,
@ -246,7 +246,7 @@ export default {
if (this.type === 'singleCreation') {
// hinweis das eine einzelne schöpfung ausgeführt wird an (Vorname)
alert('SUBMIT CREATION => ' + this.type + ' >> für ' + this.item.first_name + '')
alert('SUBMIT CREATION => ' + this.type + ' >> für ' + this.item.firstName + '')
// erstellen eines Arrays (submitObj) mit allen Daten
this.submitObj = [
{
@ -262,15 +262,12 @@ export default {
// hinweis das eine ein einzelne Schöpfung abgesendet wird an (email)
alert('UPDATE EINZEL SCHÖPFUNG ABSENDEN FÜR >> ')
// umschreiben, update eine bestehende Schöpfung eine
this.creationUserData.datum = this.radioSelected.long
this.creationUserData.creation_gdd = this.value
this.creationUserData.text = this.text
// this.$store.commit('update-creation-user-data', this.submitObj)
} else {
// hinweis das eine ein einzelne Schöpfung abgesendet wird an (email)
alert('EINZEL SCHÖPFUNG ABSENDEN FÜR >> ' + this.item.first_name + '')
alert('EINZEL SCHÖPFUNG ABSENDEN FÜR >> ' + this.item.firstName + '')
// $store - offene Schöpfungen hochzählen
this.$store.commit('openCreationsPlus', 1)
}

View File

@ -64,10 +64,9 @@
<creation-formular
type="singleCreation"
:pagetype="type"
:creation="getCreationInMonths(row.item.creation)"
:creation="row.item.creation"
:item="row.item"
:creationUserData="creationData"
@update-creation-user-data="UpdateCreationUserData"
/>
<b-button size="sm" @click="row.toggleDetails">
@ -75,7 +74,7 @@
:icon="type === 'PageCreationConfirm' ? 'x' : 'eye-slash-fill'"
aria-label="Help"
></b-icon>
Details verbergen von {{ row.item.first_name }} {{ row.item.last_name }}
Details verbergen von {{ row.item.firstName }} {{ row.item.lastName }}
</b-button>
</b-card>
</template>
@ -149,7 +148,7 @@ export default {
},
data() {
return {
creationData: [],
creationData: {},
overlay: false,
overlayBookmarkType: '',
overlayItem: [],
@ -217,9 +216,6 @@ export default {
alert(JSON.stringify(item))
this.$emit('remove-confirm-result', item, 'remove')
},
getCreationInMonths(creation) {
return creation.split(',')
},
editCreationUserTable(row, rowItem) {
alert('editCreationUserTable')
if (!row.detailsShowing) {

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag'
export const searchUsers = gql`
query($searchText: String!) {
query ($searchText: String!) {
searchUsers(searchText: $searchText) {
firstName
lastName

View File

@ -25,7 +25,6 @@ import moment from 'vue-moment'
const httpLink = new HttpLink({ uri: CONFIG.GRAPHQL_URI })
const authLink = new ApolloLink((operation, forward) => {
const token = store.state.token
operation.setContext({

View File

@ -44,6 +44,7 @@
<script>
import CreationFormular from '../components/CreationFormular.vue'
import UserTable from '../components/UserTable.vue'
import { searchUsers } from '../graphql/searchUsers'
export default {
name: 'overview',
@ -57,49 +58,19 @@ export default {
Searchfields: [
{ key: 'bookmark', label: 'merken' },
{ key: 'first_name', label: 'Firstname' },
{ key: 'last_name', label: 'Lastname' },
{ key: 'firstName', label: 'Firstname' },
{ key: 'lastName', label: 'Lastname' },
{ key: 'creation', label: 'Creation' },
{ key: 'email', label: 'Email' },
],
fields: [
{ key: 'email', label: 'Email' },
{ key: 'first_name', label: 'Firstname' },
{ key: 'last_name', label: 'Lastname' },
{ key: 'firstName', label: 'Firstname' },
{ key: 'lastName', label: 'Lastname' },
{ key: 'creation', label: 'Creation' },
{ key: 'bookmark', label: 'löschen' },
],
searchResult: [
{
id: 1,
email: 'dickerson@web.de',
first_name: 'Dickerson',
last_name: 'Macdonald',
creation: '450,200,700',
},
{
id: 2,
email: 'larsen@woob.de',
first_name: 'Larsen',
last_name: 'Shaw',
creation: '300,200,1000',
},
{
id: 3,
email: 'geneva@tete.de',
first_name: 'Geneva',
last_name: 'Wilson',
creation: '350,200,900',
},
{
id: 4,
email: 'viewrter@asdfvb.com',
first_name: 'Soledare',
last_name: 'Takker',
creation: '100,400,800',
},
],
itemsList: this.searchResult,
itemsList: [],
massCreation: [],
radioSelectedMass: '',
criteria: '',
@ -107,9 +78,30 @@ export default {
}
},
created() {
this.itemsList = this.searchResult
this.getUsers()
},
methods: {
getUsers() {
this.$apollo
.query({
query: searchUsers,
variables: {
searchText: this.criteria,
},
})
.then((result) => {
console.log('getUsers result', result)
this.itemsList = result.data.searchUsers.map((user) => {
return {
...user,
// showDetails: true,
}
})
})
.catch((error) => {
this.$toasted.error(error.message)
})
},
updateItem(e, event) {
let index = 0
let findArr = {}

View File

@ -27,8 +27,8 @@ export default {
fields: [
{ key: 'bookmark', label: 'löschen' },
{ key: 'email', label: 'Email' },
{ key: 'first_name', label: 'Vorname' },
{ key: 'last_name', label: 'Nachname' },
{ key: 'firstName', label: 'Vorname' },
{ key: 'lastName', label: 'Nachname' },
{
key: 'creation_gdd',
label: 'Schöpfung',
@ -52,9 +52,9 @@ export default {
{
id: 1,
email: 'dickerson@web.de',
first_name: 'Dickerson',
last_name: 'Macdonald',
creation: '450,200,700',
firstName: 'Dickerson',
lastName: 'Macdonald',
creation: '[450,200,700]',
creation_gdd: '1000',
text: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam ',
@ -67,9 +67,9 @@ export default {
{
id: 2,
email: 'larsen@woob.de',
first_name: 'Larsen',
last_name: 'Shaw',
creation: '300,200,1000',
firstName: 'Larsen',
lastName: 'Shaw',
creation: '[300,200,1000]',
creation_gdd: '1000',
text: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam ',
@ -82,9 +82,9 @@ export default {
{
id: 3,
email: 'geneva@tete.de',
first_name: 'Geneva',
last_name: 'Wilson',
creation: '350,200,900',
firstName: 'Geneva',
lastName: 'Wilson',
creation: '[350,200,900]',
creation_gdd: '1000',
text: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam',
creation_date: {
@ -96,8 +96,9 @@ export default {
{
id: 4,
email: 'viewrter@asdfvb.com',
first_name: 'Soledare',
last_name: 'Takker',
firstName: 'Soledare',
lastName: 'Takker',
creation: '[100,400,800]',
creation_gdd: '500',
text: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo ',
creation_date: {
@ -109,9 +110,9 @@ export default {
{
id: 5,
email: 'dickerson@web.de',
first_name: 'Dickerson',
last_name: 'Macdonald',
creation: '100,400,800',
firstName: 'Dickerson',
lastName: 'Macdonald',
creation: '[100,400,800]',
creation_gdd: '200',
text: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At',
creation_date: {

View File

@ -33,7 +33,7 @@ export default {
{ key: 'firstName', label: 'Firstname' },
{ key: 'lastName', label: 'Lastname' },
{ key: 'creation', label: 'Creation' },
{ key: 'showDetails', label: 'Details' },
{ key: 'show_details', label: 'Details' },
],
searchResult: [],
massCreation: [],
@ -53,11 +53,11 @@ export default {
},
})
.then((result) => {
console.log('getUsers result', result)
console.log('getUsers result', result)
this.searchResult = result.data.searchUsers.map((user) => {
return {
...user,
showDetails: false,
// showDetails: true,
}
})
})