mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
on-the-fly: close modal only after validation
This commit is contained in:
parent
4afea55465
commit
1f0ef6e187
@ -90,7 +90,7 @@ export default {
|
|||||||
OnTheFlyThirdparty,
|
OnTheFlyThirdparty,
|
||||||
OnTheFlyCreate
|
OnTheFlyCreate
|
||||||
},
|
},
|
||||||
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent', 'canCloseModal'],
|
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent'],
|
||||||
emits: ['saveFormOnTheFly'],
|
emits: ['saveFormOnTheFly'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -162,16 +162,6 @@ export default {
|
|||||||
return 'entity-' + this.type + ' badge-' + this.type;
|
return 'entity-' + this.type + ' badge-' + this.type;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
canCloseModal: {
|
|
||||||
handler: function(val, oldVal) {
|
|
||||||
if (val) {
|
|
||||||
this.closeModal();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.modal.showModal = false;
|
this.modal.showModal = false;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="show"></on-the-fly></li>
|
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="show"></on-the-fly></li>
|
||||||
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" :canCloseModal="canCloseOnTheFlyModal"></on-the-fly></li>
|
<li><on-the-fly :type="participation.person.type" :id="participation.person.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" ref="onTheFly"></on-the-fly></li>
|
||||||
<li>
|
<li>
|
||||||
<button v-if="!participation.endDate"
|
<button v-if="!participation.endDate"
|
||||||
class="btn btn-sm btn-remove"
|
class="btn btn-sm btn-remove"
|
||||||
@ -90,7 +90,6 @@ export default {
|
|||||||
hLevel: 1
|
hLevel: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
canCloseOnTheFlyModal: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -126,8 +125,8 @@ export default {
|
|||||||
|
|
||||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
this.$store.dispatch('addPerson', { target: payload.target, body: response });
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
@ -148,7 +147,7 @@ export default {
|
|||||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<template v-slot:record-actions>
|
<template v-slot:record-actions>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" ref="onTheFly"></on-the-fly></li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</third-party-render-box>
|
</third-party-render-box>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<template v-slot:record-actions>
|
<template v-slot:record-actions>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" ref="onTheFly"></on-the-fly></li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</person-render-box>
|
</person-render-box>
|
||||||
@ -92,7 +92,7 @@
|
|||||||
<template v-slot:record-actions>
|
<template v-slot:record-actions>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" ref="onTheFly"></on-the-fly></li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</third-party-render-box>
|
</third-party-render-box>
|
||||||
@ -114,7 +114,7 @@
|
|||||||
<template v-slot:record-actions>
|
<template v-slot:record-actions>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="show"></on-the-fly></li>
|
||||||
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" :canCloseModal="canCloseOnTheFlyModal"></on-the-fly></li>
|
<li><on-the-fly :type="accompanyingCourse.requestor.type" :id="accompanyingCourse.requestor.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" ref="onTheFly"></on-the-fly></li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</person-render-box>
|
</person-render-box>
|
||||||
@ -189,7 +189,6 @@ export default {
|
|||||||
uniq: true,
|
uniq: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
canCloseOnTheFlyModal: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -268,7 +267,7 @@ export default {
|
|||||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
@ -289,7 +288,7 @@ export default {
|
|||||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
:id="resource.resource.id"
|
:id="resource.resource.id"
|
||||||
action="edit"
|
action="edit"
|
||||||
@saveFormOnTheFly="saveFormOnTheFly"
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
:canCloseModal="canCloseOnTheFlyModal">
|
ref="onTheFly">
|
||||||
</on-the-fly>
|
</on-the-fly>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -82,7 +82,7 @@
|
|||||||
:id="resource.resource.id"
|
:id="resource.resource.id"
|
||||||
action="edit"
|
action="edit"
|
||||||
@saveFormOnTheFly="saveFormOnTheFly"
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
:canCloseModal="canCloseOnTheFlyModal">
|
ref="onTheFly">
|
||||||
</on-the-fly>
|
</on-the-fly>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -116,11 +116,6 @@ export default {
|
|||||||
},
|
},
|
||||||
props: ['resource'],
|
props: ['resource'],
|
||||||
emits: ['remove'],
|
emits: ['remove'],
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
canCloseOnTheFlyModal: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
parent() {
|
parent() {
|
||||||
return {
|
return {
|
||||||
@ -159,7 +154,7 @@ export default {
|
|||||||
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
this.$store.dispatch('addPerson', { target: payload.target, body: response })
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
@ -180,7 +175,7 @@ export default {
|
|||||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
:buttonText="$t('onthefly.create.button', {q: query})"
|
:buttonText="$t('onthefly.create.button', {q: query})"
|
||||||
action="create"
|
action="create"
|
||||||
@saveFormOnTheFly="saveFormOnTheFly"
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
:canCloseModal="canCloseOnTheFlyModal">
|
ref="onTheFly">
|
||||||
</on-the-fly>
|
</on-the-fly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -121,7 +121,6 @@ export default {
|
|||||||
selected: [],
|
selected: [],
|
||||||
priorSuggestion: {}
|
priorSuggestion: {}
|
||||||
},
|
},
|
||||||
canCloseOnTheFlyModal: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -271,7 +270,7 @@ export default {
|
|||||||
makeFetch('POST', '/api/1.0/person/person.json', data)
|
makeFetch('POST', '/api/1.0/person/person.json', data)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.newPriorSuggestion(response);
|
this.newPriorSuggestion(response);
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
@ -287,7 +286,7 @@ export default {
|
|||||||
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
|
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.newPriorSuggestion(response);
|
this.newPriorSuggestion(response);
|
||||||
this.canCloseOnTheFlyModal = true;
|
this.$refs.onTheFly.closeModal();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
@ -299,7 +298,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.canCloseOnTheFlyModal = false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user