mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
update creation data
This commit is contained in:
parent
5089152be7
commit
fd068bcd0f
@ -2,7 +2,6 @@ import { mount } from '@vue/test-utils'
|
||||
import CreationFormular from './CreationFormular.vue'
|
||||
|
||||
const localVue = global.localVue
|
||||
<<<<<<< HEAD
|
||||
|
||||
const mocks = {
|
||||
$moment: jest.fn(() => {
|
||||
@ -23,14 +22,6 @@ const propsData = {
|
||||
creation: {},
|
||||
itemsMassCreation: {},
|
||||
}
|
||||
=======
|
||||
const propsData = {
|
||||
type: 'STRING',
|
||||
creation: [100, 500, 1000],
|
||||
itemUser: [],
|
||||
}
|
||||
const mocks = { $moment: jest.fn() }
|
||||
>>>>>>> ddaaab9c (add Tests, CreationFormular.spec.js, NavBar.spec.js, UserTable.spec.js)
|
||||
|
||||
describe('CreationFormular', () => {
|
||||
let wrapper
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
size="lg"
|
||||
@change="updateRadioSelected(beforeLastMonth, 0, creation[0])"
|
||||
>
|
||||
{{ beforeLastMonth }} {{ creation[0] != null ? creation[0] + ' GDD' : '' }}
|
||||
{{ beforeLastMonth.short }} {{ creation[0] != null ? creation[0] + ' GDD' : '' }}
|
||||
</b-form-radio>
|
||||
</b-col>
|
||||
<b-col>
|
||||
@ -36,7 +36,7 @@
|
||||
size="lg"
|
||||
@change="updateRadioSelected(lastMonth, 1, creation[1])"
|
||||
>
|
||||
{{ lastMonth }} {{ creation[1] != null ? creation[1] + ' GDD' : '' }}
|
||||
{{ lastMonth.short }} {{ creation[1] != null ? creation[1] + ' GDD' : '' }}
|
||||
</b-form-radio>
|
||||
</b-col>
|
||||
<b-col class="text-right">
|
||||
@ -46,7 +46,7 @@
|
||||
size="lg"
|
||||
@change="updateRadioSelected(currentMonth, 2, creation[2])"
|
||||
>
|
||||
{{ currentMonth }} {{ creation[2] != null ? creation[2] + ' GDD' : '' }}
|
||||
{{ currentMonth.short }} {{ creation[2] != null ? creation[2] + ' GDD' : '' }}
|
||||
</b-form-radio>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -73,6 +73,7 @@
|
||||
:min="rangeMin"
|
||||
:max="rangeMax"
|
||||
step="10"
|
||||
@load="checkFormForUpdate('range')"
|
||||
></b-input>
|
||||
</b-row>
|
||||
<b-row class="m-4">
|
||||
@ -83,6 +84,7 @@
|
||||
v-model="text"
|
||||
:state="text.length >= 10"
|
||||
placeholder="Mindestens 10 Zeichen eingeben"
|
||||
@load="checkFormForUpdate('text')"
|
||||
rows="3"
|
||||
></b-form-textarea>
|
||||
</div>
|
||||
@ -96,6 +98,18 @@
|
||||
<b-col class="text-center">
|
||||
<div class="text-right">
|
||||
<b-button
|
||||
v-if="pagetype === 'PageCreationConfirm'"
|
||||
type="button"
|
||||
variant="success"
|
||||
@click="submitCreation"
|
||||
:disabled="radioSelected === '' || value <= 0 || text.length < 10"
|
||||
>
|
||||
Update Schöpfung ({{ type }},{{ pagetype }})
|
||||
{{ creationUserData }}
|
||||
</b-button>
|
||||
|
||||
<b-button
|
||||
v-else
|
||||
type="button"
|
||||
variant="success"
|
||||
@click="submitCreation"
|
||||
@ -118,10 +132,19 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
pagetype: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
item: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
creationUserData: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
creation: {
|
||||
type: Object,
|
||||
required: true,
|
||||
@ -138,9 +161,18 @@ export default {
|
||||
value: 0,
|
||||
rangeMin: 0,
|
||||
rangeMax: 1000,
|
||||
currentMonth: this.$moment().format('MMMM'),
|
||||
lastMonth: this.$moment().subtract(1, 'month').format('MMMM'),
|
||||
beforeLastMonth: this.$moment().subtract(2, 'month').format('MMMM'),
|
||||
currentMonth: {
|
||||
short: this.$moment().format('MMMM'),
|
||||
long: this.$moment().format('DD/MM/YYYY'),
|
||||
},
|
||||
lastMonth: {
|
||||
short: this.$moment().subtract(1, 'month').format('MMMM'),
|
||||
long: this.$moment().subtract(1, 'month').format('DD/MM/YYYY'),
|
||||
},
|
||||
beforeLastMonth: {
|
||||
short: this.$moment().subtract(2, 'month').format('MMMM'),
|
||||
long: this.$moment().subtract(2, 'month').format('DD/MM/YYYY'),
|
||||
},
|
||||
submitObj: null,
|
||||
isdisabled: true,
|
||||
}
|
||||
@ -160,6 +192,18 @@ export default {
|
||||
this.rangeMax = openCreation
|
||||
}
|
||||
},
|
||||
checkFormForUpdate(input) {
|
||||
switch (input) {
|
||||
case 'text':
|
||||
this.text = this.creationUserData.text
|
||||
break
|
||||
case 'range':
|
||||
this.value = this.creationUserData.creation_gdd
|
||||
break
|
||||
default:
|
||||
alert("I don't know such values")
|
||||
}
|
||||
},
|
||||
submitCreation() {
|
||||
// Formular Prüfen ob ein Zeitraum ausgewählt wurde. Ansonsten abbrechen und Hinweis anzeigen
|
||||
if (this.radioSelected === '') {
|
||||
@ -207,16 +251,29 @@ export default {
|
||||
this.submitObj = [
|
||||
{
|
||||
item: this.item,
|
||||
datum: this.radioSelected,
|
||||
datum: this.radioSelected.long,
|
||||
amount: this.value,
|
||||
text: this.text,
|
||||
moderator: this.$store.state.moderator,
|
||||
},
|
||||
]
|
||||
// hinweis das eine ein einzelne Schöpfung abgesendet wird an (email)
|
||||
alert('EINZEL SCHÖPFUNG ABSENDEN FÜR >> ' + this.item.first_name + '')
|
||||
// $store - offene Schöpfungen hochzählen
|
||||
this.$store.commit('openCreationsPlus', 1)
|
||||
|
||||
if (this.pagetype === 'PageCreationConfirm') {
|
||||
// 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 + '')
|
||||
// $store - offene Schöpfungen hochzählen
|
||||
this.$store.commit('openCreationsPlus', 1)
|
||||
}
|
||||
}
|
||||
|
||||
// das absendeergebniss im string ansehen
|
||||
|
||||
@ -6,11 +6,7 @@ const localVue = global.localVue
|
||||
const mocks = {
|
||||
$store: {
|
||||
state: {
|
||||
<<<<<<< HEAD
|
||||
openCreations: 1,
|
||||
=======
|
||||
openCreations: 0,
|
||||
>>>>>>> ddaaab9c (add Tests, CreationFormular.spec.js, NavBar.spec.js, UserTable.spec.js)
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -19,11 +15,7 @@ describe('NavBar', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
<<<<<<< HEAD
|
||||
return mount(NavBar, { localVue, mocks })
|
||||
=======
|
||||
return mount(NavBar, { mocks, localVue })
|
||||
>>>>>>> ddaaab9c (add Tests, CreationFormular.spec.js, NavBar.spec.js, UserTable.spec.js)
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
|
||||
@ -7,24 +7,10 @@ describe('UserTable', () => {
|
||||
let wrapper
|
||||
|
||||
const propsData = {
|
||||
<<<<<<< HEAD
|
||||
type: 'Type',
|
||||
itemsUser: [],
|
||||
fieldsTable: [],
|
||||
creation: {},
|
||||
=======
|
||||
type: 'TableName',
|
||||
itemUser: [
|
||||
{
|
||||
id: 1,
|
||||
email: 'dickerson@web.de',
|
||||
first_name: 'Dickerson',
|
||||
last_name: 'Macdonald',
|
||||
creation: '450,200,700',
|
||||
},
|
||||
],
|
||||
creation: [null, null, null],
|
||||
>>>>>>> ddaaab9c (add Tests, CreationFormular.spec.js, NavBar.spec.js, UserTable.spec.js)
|
||||
}
|
||||
|
||||
const Wrapper = () => {
|
||||
|
||||
@ -37,7 +37,12 @@
|
||||
stacked="md"
|
||||
>
|
||||
<template #cell(edit_creation)="row">
|
||||
<b-button variant="info" size="lg" @click="row.toggleDetails" class="mr-2">
|
||||
<b-button
|
||||
variant="info"
|
||||
size="lg"
|
||||
@click="editCreationUserTable(row, row.item)"
|
||||
class="mr-2"
|
||||
>
|
||||
<b-icon v-if="row.detailsShowing" icon="x" aria-label="Help"></b-icon>
|
||||
<b-icon v-else icon="pencil-square" aria-label="Help"></b-icon>
|
||||
</b-button>
|
||||
@ -58,8 +63,11 @@
|
||||
|
||||
<creation-formular
|
||||
type="singleCreation"
|
||||
:pagetype="type"
|
||||
:creation="getCreationInMonths(row.item.creation)"
|
||||
:item="row.item"
|
||||
:creationUserData="creationData"
|
||||
@update-creation-user-data="UpdateCreationUserData"
|
||||
/>
|
||||
|
||||
<b-button size="sm" @click="row.toggleDetails">
|
||||
@ -141,6 +149,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
creationData: [],
|
||||
overlay: false,
|
||||
overlayBookmarkType: '',
|
||||
overlayItem: [],
|
||||
@ -200,17 +209,27 @@ export default {
|
||||
}
|
||||
|
||||
if (this.type === 'PageCreationConfirm') {
|
||||
this.$emit('update-confirm-result', item, 'remove')
|
||||
this.$emit('remove-confirm-result', item, 'remove')
|
||||
}
|
||||
},
|
||||
bookmarkConfirm(item) {
|
||||
alert('die schöpfung bestätigen und abschließen')
|
||||
alert(JSON.stringify(item))
|
||||
this.$emit('update-confirm-result', item, 'remove')
|
||||
this.$emit('remove-confirm-result', item, 'remove')
|
||||
},
|
||||
getCreationInMonths(creation) {
|
||||
return creation.split(',')
|
||||
},
|
||||
editCreationUserTable(row, rowItem) {
|
||||
alert('editCreationUserTable')
|
||||
if (!row.detailsShowing) {
|
||||
alert('offen edit loslegen')
|
||||
// this.item = rowItem
|
||||
this.creationData = rowItem
|
||||
// alert(this.creationData)
|
||||
}
|
||||
row.toggleDetails()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -8,9 +8,8 @@
|
||||
class="mt-4"
|
||||
type="PageCreationConfirm"
|
||||
:itemsUser="confirmResult"
|
||||
:creation="creation"
|
||||
:fieldsTable="fields"
|
||||
@update-confirm-result="updateConfirmResult"
|
||||
@remove-confirm-result="removeConfirmResult"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -30,9 +29,21 @@ export default {
|
||||
{ key: 'email', label: 'Email' },
|
||||
{ key: 'first_name', label: 'Vorname' },
|
||||
{ key: 'last_name', label: 'Nachname' },
|
||||
{ key: 'creation_gdd', label: 'GDD' },
|
||||
{
|
||||
key: 'creation_gdd',
|
||||
label: 'Schöpfung',
|
||||
formatter: (value) => {
|
||||
return value + ' GDD'
|
||||
},
|
||||
},
|
||||
{ key: 'text', label: 'Text' },
|
||||
{ key: 'creation_date', label: 'Datum' },
|
||||
{
|
||||
key: 'creation_date',
|
||||
label: 'Datum',
|
||||
formatter: (value) => {
|
||||
return value.long
|
||||
},
|
||||
},
|
||||
{ key: 'creation_moderator', label: 'Moderator' },
|
||||
{ key: 'edit_creation', label: 'ändern' },
|
||||
{ key: 'confirm', label: 'speichern' },
|
||||
@ -47,7 +58,10 @@ export default {
|
||||
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: '01/11/2021',
|
||||
creation_date: {
|
||||
short: 'November',
|
||||
long: '22/11/2021',
|
||||
},
|
||||
creation_moderator: 'Manuela Gast',
|
||||
},
|
||||
{
|
||||
@ -59,7 +73,10 @@ export default {
|
||||
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: '01/11/2021',
|
||||
creation_date: {
|
||||
short: 'November',
|
||||
long: '03/11/2021',
|
||||
},
|
||||
creation_moderator: 'Manuela Gast',
|
||||
},
|
||||
{
|
||||
@ -70,7 +87,10 @@ export default {
|
||||
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: '01/11/2021',
|
||||
creation_date: {
|
||||
short: 'September',
|
||||
long: '27/09/2021',
|
||||
},
|
||||
creation_moderator: 'Manuela Gast',
|
||||
},
|
||||
{
|
||||
@ -80,8 +100,10 @@ export default {
|
||||
last_name: 'Takker',
|
||||
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: '01/10/2021',
|
||||
creation_date: {
|
||||
short: 'Oktober',
|
||||
long: '12/10/2021',
|
||||
},
|
||||
creation_moderator: 'Evelyn Roller',
|
||||
},
|
||||
{
|
||||
@ -92,16 +114,18 @@ export default {
|
||||
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: '01/09/2021',
|
||||
creation_date: {
|
||||
short: 'September',
|
||||
long: '05/09/2021',
|
||||
},
|
||||
creation_moderator: 'Manuela Gast',
|
||||
},
|
||||
],
|
||||
creation: [null, null, null],
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
updateConfirmResult(e, event) {
|
||||
removeConfirmResult(e, event) {
|
||||
if (event === 'remove') {
|
||||
let index = 0
|
||||
let findArr = {}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user