diff --git a/admin/src/components/CreationFormular.spec.js b/admin/src/components/CreationFormular.spec.js index b3807b16f..27e942501 100644 --- a/admin/src/components/CreationFormular.spec.js +++ b/admin/src/components/CreationFormular.spec.js @@ -56,7 +56,7 @@ const mocks = { const propsData = { type: '', creation: [], - itemsMassCreation: {}, + userSelectedInMassCreation: {}, } describe('CreationFormular', () => { diff --git a/admin/src/components/UserTable.spec.js b/admin/src/components/UserTable.spec.js index 4910c7e80..1136fe82a 100644 --- a/admin/src/components/UserTable.spec.js +++ b/admin/src/components/UserTable.spec.js @@ -199,11 +199,6 @@ describe('UserTable', () => { }) }) }) - - // it('expect(wrapper.html()).', () => { - // // eslint-disable-next-line no-console - // console.log(wrapper.html()) - // }) }) describe('type UserListSearch', () => { @@ -214,11 +209,6 @@ describe('UserTable', () => { it('has a DIV element with the class.component-user-table', () => { expect(wrapper.find('.component-user-table').exists()).toBeTruthy() }) - - // it('expect(wrapper.html()).', () => { - // // eslint-disable-next-line no-console - // console.log(wrapper.html()) - // }) }) describe('type UserListMassCreation', () => { @@ -229,11 +219,6 @@ describe('UserTable', () => { it('has a DIV element with the class.component-user-table', () => { expect(wrapper.find('.component-user-table').exists()).toBeTruthy() }) - - // it('expect(wrapper.html()).', () => { - // // eslint-disable-next-line no-console - // console.log(wrapper.html()) - // }) }) describe('type PageCreationConfirm', () => { @@ -244,48 +229,6 @@ describe('UserTable', () => { it('has a DIV element with the class.component-user-table', () => { expect(wrapper.find('.component-user-table').exists()).toBeTruthy() }) - - // it('expect(wrapper.html()).', () => { - // // eslint-disable-next-line no-console - // console.log(wrapper.html()) - // }) }) - /** - - - - - - - - */ }) }) diff --git a/admin/src/pages/Creation.spec.js b/admin/src/pages/Creation.spec.js index 01a884f54..dc2fa90df 100644 --- a/admin/src/pages/Creation.spec.js +++ b/admin/src/pages/Creation.spec.js @@ -127,8 +127,8 @@ describe('Creation', () => { ]) }) - it('adds the pushed item to itemsMassCreation', () => { - expect(wrapper.vm.itemsMassCreation).toEqual([ + it('adds the pushed item to userSelectedInMassCreation', () => { + expect(wrapper.vm.userSelectedInMassCreation).toEqual([ { userId: 2, firstName: 'Benjamin', @@ -156,8 +156,8 @@ describe('Creation', () => { ) }) - it('removes the item from itemsMassCreation', () => { - expect(wrapper.vm.itemsMassCreation).toEqual([]) + it('removes the item from userSelectedInMassCreation', () => { + expect(wrapper.vm.userSelectedInMassCreation).toEqual([]) }) it('adds the item to itemsList', () => { @@ -221,8 +221,8 @@ describe('Creation', () => { wrapper.findComponent({ name: 'CreationFormular' }).vm.$emit('remove-all-bookmark') }) - it('removes all items from itemsMassCreation', () => { - expect(wrapper.vm.itemsMassCreation).toEqual([]) + it('removes all items from userSelectedInMassCreation', () => { + expect(wrapper.vm.userSelectedInMassCreation).toEqual([]) }) it('adds all items to itemsList', () => { diff --git a/admin/src/pages/Creation.vue b/admin/src/pages/Creation.vue index ba7b3f0d1..6fb2e0ac3 100644 --- a/admin/src/pages/Creation.vue +++ b/admin/src/pages/Creation.vue @@ -28,7 +28,7 @@ -
+
+ userSelectedInMassCreation: {{ userSelectedInMassCreation }} +
{{ $t('multiple_creation_text') }}
@@ -62,6 +64,11 @@ export default { CreationFormular, UserTable, }, + props: { + userSelectedInMassCreation: { + type: Array, + }, + }, data() { return { showArrays: false, @@ -104,8 +111,7 @@ export default { { key: 'bookmark', label: this.$t('remove') }, ], itemsList: [], - itemsMassCreation: [], - itemsMassCreationReverse: [], + itemsMassCreationReverse: this.userSelectedInMassCreation, radioSelectedMass: '', criteria: '', creation: [null, null, null], @@ -137,6 +143,7 @@ export default { showDetails: false, } }) + this.updateItem(this.userSelectedInMassCreation, 'mounted') }) .catch((error) => { this.$toasted.error(error.message) @@ -151,22 +158,29 @@ export default { findArr = this.itemsList.find((item) => e.userId === item.userId) index = this.itemsList.indexOf(findArr) this.itemsList.splice(index, 1) - this.itemsMassCreation.push(findArr) + this.userSelectedInMassCreation.push(findArr) break case 'remove': - findArr = this.itemsMassCreation.find((item) => e.userId === item.userId) - index = this.itemsMassCreation.indexOf(findArr) - this.itemsMassCreation.splice(index, 1) + findArr = this.userSelectedInMassCreation.find((item) => e.userId === item.userId) + index = this.userSelectedInMassCreation.indexOf(findArr) + this.userSelectedInMassCreation.splice(index, 1) this.itemsList.push(findArr) break + case 'mounted': + this.userSelectedInMassCreation.map((value, key) => { + findArr = this.itemsList.find((item) => value.userId === item.userId) + index = this.itemsList.indexOf(findArr) + this.itemsList.splice(index, 1) + }) + break default: throw new Error(event) } - this.itemsMassCreationReverse = this.itemsMassCreation + this.itemsMassCreationReverse = this.userSelectedInMassCreation this.itemsMassCreationReverse.reverse() }, removeAllBookmark() { - this.itemsMassCreation = [] + this.userSelectedInMassCreation = [] this.getUsers() }, }, diff --git a/admin/src/router/routes.js b/admin/src/router/routes.js index 72e7b1ac5..2d7667329 100644 --- a/admin/src/router/routes.js +++ b/admin/src/router/routes.js @@ -18,6 +18,7 @@ const routes = [ { path: '/creation', component: () => import('@/pages/Creation.vue'), + props: { userSelectedInMassCreation: [] }, }, { path: '/creation-confirm',