mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'onTheFly' of gitlab.com:Chill-Projet/chill-bundles into onTheFly
This commit is contained in:
commit
440e21a83b
@ -4,9 +4,9 @@ const fetchScopes = () => {
|
|||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
console.log(data);
|
//console.log(data);
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log(data);
|
//console.log(data);
|
||||||
resolve(data.results);
|
resolve(data.results);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -134,6 +134,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openModal() {
|
openModal() {
|
||||||
|
console.log('## OPEN ON THE FLY MODAL');
|
||||||
|
console.log('## type:', this.type, ', action:', this.action);
|
||||||
this.modal.showModal = true;
|
this.modal.showModal = true;
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
//this.$refs.search.focus();
|
//this.$refs.search.focus();
|
||||||
@ -173,11 +175,11 @@ export default {
|
|||||||
|
|
||||||
this.modal.showModal = false;
|
this.modal.showModal = false;
|
||||||
},
|
},
|
||||||
goToLocation(id, type){
|
goToLocation(id, type) {
|
||||||
if(type == 'person'){
|
if (type == 'person') {
|
||||||
window.location = `../../person/${id}/general`
|
window.location = `../../person/${id}/general`;
|
||||||
} else if(type == 'thirdparty') {
|
} else if (type == 'thirdparty') {
|
||||||
window.location = `../../thirdparty/thirdparty/${id}/show`
|
window.location = `../../thirdparty/thirdparty/${id}/show`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" :class="{ active: isActive('person') }">
|
<a class="nav-link" :class="{ active: isActive('person') }">
|
||||||
<label for="person">
|
<label for="person">
|
||||||
<input type="radio" name="person" v-model="radioType" value="person">
|
<input type="radio" name="person" id="person" v-model="radioType" value="person">
|
||||||
{{ $t('onthefly.create.person') }}
|
{{ $t('onthefly.create.person') }}
|
||||||
</label>
|
</label>
|
||||||
</a>
|
</a>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" :class="{ active: isActive('thirdparty') }">
|
<a class="nav-link" :class="{ active: isActive('thirdparty') }">
|
||||||
<label for="thirdparty">
|
<label for="thirdparty">
|
||||||
<input type="radio" name="thirdparty" v-model="radioType" value="thirdparty">
|
<input type="radio" name="thirdparty" id="thirdparty" v-model="radioType" value="thirdparty">
|
||||||
{{ $t('onthefly.create.thirdparty') }}
|
{{ $t('onthefly.create.thirdparty') }}
|
||||||
</label>
|
</label>
|
||||||
</a>
|
</a>
|
||||||
@ -56,6 +56,7 @@ export default {
|
|||||||
radioType: {
|
radioType: {
|
||||||
set(type) {
|
set(type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
console.log('## type:', type, ', action:', this.action);
|
||||||
},
|
},
|
||||||
get() {
|
get() {
|
||||||
return this.type;
|
return this.type;
|
||||||
|
@ -153,9 +153,9 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.initAddressContext();
|
this.initAddressContext();
|
||||||
|
|
||||||
console.log('ac.locationStatus', this.accompanyingCourse.locationStatus);
|
//console.log('ac.locationStatus', this.accompanyingCourse.locationStatus);
|
||||||
console.log('ac.location (temporary location)', this.accompanyingCourse.location);
|
//console.log('ac.location (temporary location)', this.accompanyingCourse.location);
|
||||||
console.log('ac.personLocation', this.accompanyingCourse.personLocation);
|
//console.log('ac.personLocation', this.accompanyingCourse.personLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
|
||||||
|
import { thirdpartyMessages } from 'ChillThirdPartyAssets/vuejs/_js/i18n';
|
||||||
import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
|
import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
|
||||||
|
|
||||||
const appMessages = {
|
const appMessages = {
|
||||||
@ -137,7 +138,7 @@ const appMessages = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.assign(appMessages.fr, personMessages.fr, addressMessages.fr);
|
Object.assign(appMessages.fr, personMessages.fr, thirdpartyMessages.fr, addressMessages.fr);
|
||||||
|
|
||||||
export {
|
export {
|
||||||
appMessages
|
appMessages
|
||||||
|
@ -48,7 +48,7 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
|||||||
return state.accompanyingCourse.location !== null;
|
return state.accompanyingCourse.location !== null;
|
||||||
},
|
},
|
||||||
isScopeValid(state) {
|
isScopeValid(state) {
|
||||||
console.log('is scope valid', state.accompanyingCourse.scopes.length > 0);
|
//console.log('is scope valid', state.accompanyingCourse.scopes.length > 0);
|
||||||
return state.accompanyingCourse.scopes.length > 0;
|
return state.accompanyingCourse.scopes.length > 0;
|
||||||
},
|
},
|
||||||
validationKeys(state, getters) {
|
validationKeys(state, getters) {
|
||||||
|
@ -229,7 +229,7 @@ export default {
|
|||||||
return item.result.type + item.result.id;
|
return item.result.type + item.result.id;
|
||||||
},
|
},
|
||||||
addPriorSuggestion() {
|
addPriorSuggestion() {
|
||||||
console.log('echo', this.hasPriorSuggestion);
|
//console.log('addPriorSuggestion', this.hasPriorSuggestion);
|
||||||
if (this.hasPriorSuggestion) {
|
if (this.hasPriorSuggestion) {
|
||||||
console.log('addPriorSuggestion',);
|
console.log('addPriorSuggestion',);
|
||||||
this.suggested.unshift(this.priorSuggestion);
|
this.suggested.unshift(this.priorSuggestion);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-if="options.addInfo == true" class="moreinfo">
|
<p v-if="options.addInfo === true" class="moreinfo">
|
||||||
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
|
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
|
||||||
<time v-if="person.birthdate && !person.deathdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}">
|
<time v-if="person.birthdate && !person.deathdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}">
|
||||||
{{ $t(getGenderTranslation) + ' ' + $d(birthdate, 'text') }}
|
{{ $t(getGenderTranslation) + ' ' + $d(birthdate, 'text') }}
|
||||||
@ -142,7 +142,7 @@ export default {
|
|||||||
props: ['person', 'options', 'render', 'returnPath'],
|
props: ['person', 'options', 'render', 'returnPath'],
|
||||||
computed: {
|
computed: {
|
||||||
getGenderTranslation: function() {
|
getGenderTranslation: function() {
|
||||||
return this.person.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
return this.person.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
||||||
},
|
},
|
||||||
isMultiline: function() {
|
isMultiline: function() {
|
||||||
if(this.options.isMultiline){
|
if(this.options.isMultiline){
|
||||||
@ -152,7 +152,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getGenderIcon: function() {
|
getGenderIcon: function() {
|
||||||
return this.person.gender == 'woman' ? 'fa-venus' : this.person.gender == 'man' ? 'fa-mars' : 'fa-neuter';
|
return this.person.gender === 'woman' ? 'fa-venus' : this.person.gender === 'man' ? 'fa-mars' : 'fa-neuter';
|
||||||
},
|
},
|
||||||
birthdate: function(){
|
birthdate: function(){
|
||||||
if(this.person.birthdate !== null){
|
if(this.person.birthdate !== null){
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<option value="man">{{ $t('person.gender.man') }}</option>
|
<option value="man">{{ $t('person.gender.man') }}</option>
|
||||||
<option value="neuter">{{ $t('person.gender.neuter') }}</option>
|
<option value="neuter">{{ $t('person.gender.neuter') }}</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="gender">{{ $t('person.gender.title') }}</label>
|
<label>{{ $t('person.gender.title') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
@ -159,9 +159,17 @@ export default {
|
|||||||
getPerson(this.id)
|
getPerson(this.id)
|
||||||
.then(person => new Promise((resolve, reject) => {
|
.then(person => new Promise((resolve, reject) => {
|
||||||
this.person = person;
|
this.person = person;
|
||||||
//console.log('get person', this.person);
|
console.log('get person', this.person);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
},
|
||||||
|
postData() {
|
||||||
|
postPerson(this.person)
|
||||||
|
.then(person => new Promise((resolve, reject) => {
|
||||||
|
this.person = person;
|
||||||
|
console.log('post person', this.person);
|
||||||
|
resolve();
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,17 @@
|
|||||||
|
|
||||||
<div :class="'denomination h' + options.hLevel">
|
<div :class="'denomination h' + options.hLevel">
|
||||||
|
|
||||||
<a v-if="this.options.addLink == true" href="#">
|
<a v-if="this.options.addLink === true" href="#">
|
||||||
<span class="name">{{ thirdparty.text }}</span>
|
<span class="name">{{ thirdparty.text }}</span>
|
||||||
</a>
|
</a>
|
||||||
<span class="name">{{ thirdparty.text }}</span>
|
<span class="name">{{ thirdparty.text }}</span>
|
||||||
|
|
||||||
<span v-if="options.addId == true" class="id-number" :title="'n° ' + thirdparty.id">{{ thirdparty.id }}</span>
|
<span v-if="options.addId == true" class="id-number" :title="'n° ' + thirdparty.id">{{ thirdparty.id }}</span>
|
||||||
<span v-if="options.addEntity == true && thirdparty.type == 'thirdparty'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.thirdparty') }}</span>
|
<span v-if="options.addEntity == true && thirdparty.type === 'thirdparty'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.thirdparty') }}</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-if="this.options.addInfo == true" class="moreinfo">
|
<p v-if="this.options.addInfo === true" class="moreinfo">
|
||||||
<i v-if="thirdparty.birthdate" :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
|
<i v-if="thirdparty.birthdate" :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
|
||||||
<time v-if="thirdparty.birthdate" datetime="{{ thirdparty.birthdate.datetime }}" title="{{ birthdate }}">
|
<time v-if="thirdparty.birthdate" datetime="{{ thirdparty.birthdate.datetime }}" title="{{ birthdate }}">
|
||||||
{{ $t(getGender) + ' ' + $d(birthdate, 'short') }}
|
{{ $t(getGender) + ' ' + $d(birthdate, 'short') }}
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<time v-else-if="thirdparty.deathdate" datetime="{{ thirdparty.deathdate.datetime }}" title="{{ thirdparty.deathdate }}">
|
<time v-else-if="thirdparty.deathdate" datetime="{{ thirdparty.deathdate.datetime }}" title="{{ thirdparty.deathdate }}">
|
||||||
{{ birthdate }} - {{ deathdate }}
|
{{ birthdate }} - {{ deathdate }}
|
||||||
</time>
|
</time>
|
||||||
<span v-if="options.addAge == true" class="age">{{ thirdparty.age }}</span>
|
<span v-if="options.addAge === true" class="age">{{ thirdparty.age }}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -80,10 +80,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getGender: function() {
|
getGender: function() {
|
||||||
return this.thirdparty.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
return this.thirdparty.gender === 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
||||||
},
|
},
|
||||||
getGenderIcon: function() {
|
getGenderIcon: function() {
|
||||||
return this.thirdparty.gender == 'woman' ? 'fa-venus' : this.thirdparty.gender == 'man' ? 'fa-mars' : 'fa-neuter';
|
return this.thirdparty.gender === 'woman' ? 'fa-venus' : this.thirdparty.gender === 'man' ? 'fa-mars' : 'fa-neuter';
|
||||||
},
|
},
|
||||||
birthdate: function(){
|
birthdate: function(){
|
||||||
var date = new Date(this.thirdparty.birthdate.datetime);
|
var date = new Date(this.thirdparty.birthdate.datetime);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="action === 'show'">
|
<div v-if="action === 'show'">
|
||||||
<div class="flex-table">
|
<div class="flex-table">
|
||||||
<third-party-render-box
|
<third-party-render-box
|
||||||
:thirdparty="thirdparty"
|
:thirdparty="thirdparty"
|
||||||
@ -19,15 +19,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="action === 'edit' || action === 'create'">
|
<div v-else-if="action === 'edit' || action === 'create'">
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
|
||||||
<input class="form-control form-control-lg" id="firstname" v-model="thirdparty.firstName" v-bind:placeholder="$t('thirdparty.firstname')" />
|
|
||||||
<label for="firstname">{{ $t('thirdparty.firstname') }}</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
<div class="form-floating mb-3">
|
||||||
<input class="form-control form-control-lg" id="lastname" v-model="thirdparty.lastName" v-bind:placeholder="$t('thirdparty.lastname')" />
|
<input class="form-control form-control-lg" id="name" v-model="thirdparty.name" v-bind:placeholder="$t('thirdparty.name')" />
|
||||||
<label for="lastname">{{ $t('thirdparty.lastname') }}</label>
|
<label for="name">{{ $t('thirdparty.name') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
@ -48,11 +43,18 @@
|
|||||||
aria-describedby="phonenumber" />
|
aria-describedby="phonenumber" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<add-address
|
||||||
|
:options="this.addAddress.options"
|
||||||
|
:context="this.addAddress.context"
|
||||||
|
:address-changed-callback="submitAddress">
|
||||||
|
</add-address>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue';
|
import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue';
|
||||||
|
import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress';
|
||||||
import { getThirdparty, postThirdparty } from '../../_api/OnTheFly';
|
import { getThirdparty, postThirdparty } from '../../_api/OnTheFly';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -60,31 +62,56 @@ export default {
|
|||||||
props: ['id', 'type', 'action'],
|
props: ['id', 'type', 'action'],
|
||||||
components: {
|
components: {
|
||||||
ThirdPartyRenderBox,
|
ThirdPartyRenderBox,
|
||||||
|
AddAddress
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
thirdparty: {
|
thirdparty: {
|
||||||
type: 'thirdparty'
|
type: 'thirdparty'
|
||||||
|
},
|
||||||
|
addAddress: {
|
||||||
|
context: {
|
||||||
|
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
//button: {
|
||||||
|
// text: {
|
||||||
|
// create: 'courselocation.add_temporary_address',
|
||||||
|
// edit: 'courselocation.edit_temporary_address'
|
||||||
|
// }
|
||||||
|
//},
|
||||||
|
//title: {
|
||||||
|
// create: 'courselocation.add_temporary_address',
|
||||||
|
// edit: 'courselocation.edit_temporary_address'
|
||||||
|
//},
|
||||||
|
openPanesInModal: true,
|
||||||
|
hideAddress: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadThirdparty(){
|
loadData(){
|
||||||
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
||||||
this.thirdparty = thirdparty;
|
this.thirdparty = thirdparty;
|
||||||
|
console.log('get thirdparty', thirdparty);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
postData() {
|
postData() {
|
||||||
postThirdparty(this.thirdparty).then(thirdparty => new Promise((resolve, reject) => {
|
postThirdparty(this.thirdparty).then(thirdparty => new Promise((resolve, reject) => {
|
||||||
this.thirdparty = thirdparty;
|
this.thirdparty = thirdparty;
|
||||||
|
console.log('post thirdparty', thirdparty);
|
||||||
resolve();
|
resolve();
|
||||||
}))
|
}))
|
||||||
|
},
|
||||||
|
submitAddress(payload) {
|
||||||
|
console.log('submitAddress', payload);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.action !== 'create'){
|
if (this.action !== 'create') {
|
||||||
this.loadThirdparty();
|
this.loadData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
const thirdpartyMessages = {
|
||||||
|
fr: {
|
||||||
|
thirdparty: {
|
||||||
|
name: "Dénomination",
|
||||||
|
email: "Courriel",
|
||||||
|
phonenumber: "Téléphone",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export { thirdpartyMessages };
|
@ -56,6 +56,8 @@ class ThirdPartyVoter extends AbstractChillVoter implements ProvideRoleHierarchy
|
|||||||
*/
|
*/
|
||||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||||
{
|
{
|
||||||
|
return true;
|
||||||
|
|
||||||
$user = $token->getUser();
|
$user = $token->getUser();
|
||||||
|
|
||||||
if (!$user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user