mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	activity vue corrections
This commit is contained in:
		| @@ -36,23 +36,27 @@ export default { | ||||
|    data() { | ||||
|       return { | ||||
|          personsBlocs: [ | ||||
|             {  key: 'personsAssociated', title: 'activity.bloc_persons_associated',  | ||||
|             {  key: 'personsAssociated',  | ||||
|                title: 'activity.bloc_persons_associated',  | ||||
|                persons: []  | ||||
|             }, | ||||
|             {  key: 'personsNotAssociated', title: 'activity.bloc_persons_not_associated',  | ||||
|             {  key: 'personsNotAssociated',  | ||||
|                title: 'activity.bloc_persons_not_associated',  | ||||
|                persons: []  | ||||
|             }, | ||||
|             {  key: 'thirdparty', title: 'activity.bloc_thirdparty',  | ||||
|             {  key: 'thirdparty',  | ||||
|                title: 'activity.bloc_thirdparty',  | ||||
|                persons: [] | ||||
|             }, | ||||
|             {  key: 'users', title: 'activity.bloc_users',  | ||||
|             {  key: 'users',  | ||||
|                title: 'activity.bloc_users',  | ||||
|                persons: [] | ||||
|             }, | ||||
|          ], | ||||
|          addPersons: { | ||||
|             key: 'activity', | ||||
|             options: { | ||||
|                type: ['person', 'thirdparty'], // TODO 'user' | ||||
|                type: ['person', 'thirdparty'], // TODO add 'user' | ||||
|                priority: null, | ||||
|                uniq: false, | ||||
|             } | ||||
| @@ -67,6 +71,9 @@ export default { | ||||
|          accompanyingCourse: state => state.activity.accompanyingPeriod | ||||
|       }) | ||||
|    }, | ||||
|    mounted() { | ||||
|       this.setPersonsInBloc(); | ||||
|    }, | ||||
|    methods: { | ||||
|       addNewPersons({ selected, modal }) { | ||||
|          console.log('@@@ CLICK button addNewPersons', selected); | ||||
| @@ -76,29 +83,29 @@ export default { | ||||
|          ); | ||||
|          this.$refs.addPersons.resetSearch(); // to cast child method | ||||
|          modal.showModal = false; | ||||
|           | ||||
|          this.setPersonsInBloc(); | ||||
|       }, | ||||
|       setPersonsInBloc() { | ||||
|          let participations = this.getCourseParticipations(); | ||||
|       setPersonsInBloc() {          | ||||
|          let personsAssociated = []; | ||||
|          let personsNotAssociated = this.persons; | ||||
|           | ||||
|          let participations = this.getCourseParticipations();          | ||||
|          this.persons.forEach(person => { | ||||
|             participations.forEach(participation => { | ||||
|                if (person.id === participation.id) { | ||||
|                   console.log(person.id); | ||||
|                   personsAssociated.push(person); | ||||
|                   personsNotAssociated = personsNotAssociated.filter(p => p !== person); | ||||
|                } | ||||
|             }); | ||||
|          }); | ||||
|           | ||||
|          this.personsBlocs.forEach(bloc => { | ||||
|             switch (bloc.key) { | ||||
|                case 'personsAssociated': | ||||
|                   console.log('personsAssociated', personsAssociated); | ||||
|                   bloc.persons = personsAssociated; | ||||
|                   break; | ||||
|                case 'personsNotAssociated': | ||||
|                   console.log('personsNotAssociated', personsNotAssociated); | ||||
|                   bloc.persons = personsNotAssociated; | ||||
|                   break; | ||||
|                case 'thirdparty': | ||||
| @@ -113,7 +120,7 @@ export default { | ||||
|       getCourseParticipations() { | ||||
|          let participations = []; | ||||
|          this.accompanyingCourse.participations.forEach(participation => { | ||||
|             if (participation.endDate) { | ||||
|             if (!participation.endDate) { | ||||
|                participations.push(participation.person); | ||||
|             } | ||||
|          }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user