Loading front/src/EntityWithRole.vue +93 −8 Original line number Diff line number Diff line <template> <div> <template> <div class="oscar-ajax" v-show="loading || error"> <div class="oscar-ajax-content"> Loading @@ -15,7 +14,7 @@ </div> </div> </template> <code>{{ entityEdited }}</code> <div class="overlay" v-if="entityDelete"> <div class="overlay-content"> <i class="icon-cancel-outline overlay-closer" @click="entityDelete = null"></i> Loading Loading @@ -62,6 +61,7 @@ en tant que <em>{{ entityEdited.role }}</em> </span> </h2> <input type="hidden" name="enroled" class="form-control select2" v-model="entityEdited.enrolled"/> <div class="row"> Loading Loading @@ -172,7 +172,56 @@ <i class="icon-doc-add"></i> Nouveau </a> <a class="oscar-link" @click="handlerEditEnable()"> <i class="icon-edit"></i> Modifier </a> </nav> <section v-if="editMode"> <div class="alert alert-info"> Détails des affectations. Une personne peut apparaître plusieurs fois selon le contexte et le rôle </div> <article class="row card" v-for="e in sortedFull"> <div class="col-md-6"> <i class="icon-cube" v-if="e.context == 'activity'"></i> <i class="icon-cubes" v-else></i> <strong>{{ e.enrolledLabel }}</strong> <small> (<span v-if="e.context == 'activity'"> <i class="icon-cube"></i> {{ e.contextKey }}</span> <span v-else> <i class="icon-cubes"></i> {{ e.contextKey }}</span>) </small> </div> <div class="col-md-3"> <em :class="{'bold': e.rolePrincipal }">{{ e.roleLabel }}</em> </div> <div class="col-md-3 text-right"> <a @click="handlerEdit(e)" style="white-space: nowrap"> <i class="icon-pencil-1 icon-clickable" v-if="manage"></i> Modifier </a> <a @click="handlerDelete(e)" style="white-space: nowrap"> <i class="icon-trash icon-clickable" v-if="manage"></i> Supprimer </a> </div> </article> </section> <section v-else> <span class="cartouche" v-for="e in stacked" :class="e.hasPrimary ? 'primary' : 'default' "> {{ e.enrolledLabel }} <span class="addon principal" > <span v-for="r in e.roles" class="addon-module" :class="{'primary': r.rolePrincipal}"> {{ r.role }} </span> </span> </span> </section> <!-- <span class="cartouche" v-for="e in entities" :class="{'primary': e.rolePrincipal, 'outofdate past': e.past }"> <i v-if="e.context == 'activity'" class="icon-cube"></i> <i v-else class="icon-cubes"></i> Loading @@ -184,6 +233,7 @@ <i class="icon-trash icon-clickable" v-if="manage" @click="handlerDelete(e)"></i> </span> </span> --> </div> </template> <script> Loading Loading @@ -221,10 +271,42 @@ export default { entityDelete: null, entityNew: null, error: null, loading: false loading: false, editMode: false }; }, computed: { sortedFull(){ console.log("sort"); return this.entities.sort( (a, b) => a.enrolled - b.enrolled ) }, stacked(){ let stacks = {}; this.entities.forEach(i => { let id = i.enrolled; if( !stacks.hasOwnProperty(id) ){ stacks[id] = { enrolled: i.enrolled, enrolledLabel: i.enrolledLabel, hasPrimary: false } stacks[id]['roles'] = {}; } stacks[id]['roles'][i.roleId] = { role: i.roleLabel, roleId: i.roleId, rolePrincipal: i.rolePrincipal, context: i.context, }; if( i.rolePrincipal ){ stacks[id].hasPrimary = true; } }) return stacks; } }, methods: { handlerEdit(item) { Loading Loading @@ -266,9 +348,12 @@ export default { document.location = url; }, handlerEditEnable() { this.editMode = !this.editMode; }, performDelete() { this.loading = "Suppression..."; console.log(url, this.entityDelete); var url = this.entityDelete.urlDelete; this.entityDelete = null; Loading module/Oscar/src/Oscar/Command/OscarNotificationsMailsPersonsCommand.php +9 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Oscar\Service\OscarUserContext; use Oscar\Service\PersonService; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; Loading @@ -19,6 +20,7 @@ class OscarNotificationsMailsPersonsCommand extends OscarCommandAbstract { $this ->setDescription("Déclenche la procédure d'envoi des notifications par mail") ->addOption('date', 'd', InputOption::VALUE_OPTIONAL, 'date de déclenchement', null) ; } Loading @@ -28,9 +30,15 @@ class OscarNotificationsMailsPersonsCommand extends OscarCommandAbstract $io = new SymfonyStyle($input, $output); $date = $input->getOption('date'); $dateRef = null; if( $date ){ $dateRef = new \DateTime(date('Y-m-d ') . $date); } /** @var PersonService $personService */ $personService = $this->getServicemanager()->get(PersonService::class); $personService->mailPersonsWithUnreadNotification(null, $io); $personService->mailPersonsWithUnreadNotification($dateRef->format('Y-m-d H:i:s'), $io); } } No newline at end of file module/Oscar/src/Oscar/Controller/ProjectGrantController.php +6 −0 Original line number Diff line number Diff line Loading @@ -2124,6 +2124,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $editable = $editableA; $deletable = $deletableA; $context = "activity"; $contextKey = $activityPerson->getActivity()->getOscarNum(); $idEnroller = $activityPerson->getActivity()->getId(); } else { $urlDelete = $deletableA ? $this->url()->fromRoute( Loading @@ -2137,6 +2138,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $editable = $editableP; $deletable = $deletableP; $context = "project"; $contextKey = $activityPerson->getProject()->getAcronym(); $idEnroller = $activityPerson->getProject()->getId(); } $urlShow = false; Loading @@ -2155,6 +2157,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'rolePrincipal' => $activityPerson->isPrincipal(), 'urlDelete' => $urlDelete, 'context' => $context, 'contextKey' => $contextKey, 'urlEdit' => $urlEdit, 'urlShow' => $urlShow, 'past' => $activityPerson->isPast(), Loading Loading @@ -2223,10 +2226,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $editable = $editableA; $deletable = $deletableA; $context = "activity"; $contextKey = $activityOrganization->getActivity()->getOscarNum(); } else { $editable = $editableP; $deletable = $deletableP; $context = "project"; $contextKey = $activityOrganization->getProject()->getAcronym(); } $urlDelete = $deletableA ? $this->url()->fromRoute( Loading @@ -2252,6 +2257,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'rolePrincipal' => $activityOrganization->isPrincipal(), 'urlDelete' => $urlDelete, 'context' => $context, 'contextKey' => $contextKey, 'urlEdit' => $urlEdit, 'urlShow' => $urlShow, 'enroller' => $activity->getId(), Loading module/Oscar/src/Oscar/Entity/PersonRepository.php +4 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,10 @@ class PersonRepository extends EntityRepository implements IConnectedRepository ) ) ->innerJoin(NotificationPerson::class, 'n', Join::WITH, $qb->expr()->eq('p.id', 'n.person')) ->where('n.read IS NULL') ->innerJoin('n.notification', 'nt') ->where('n.read IS NULL AND nt.dateEffective <= :now') ->orderBy('p.lastname', 'ASC') ->setParameter('now', date('Y-m-d')) ->getQuery() ->getResult(); Loading module/Oscar/src/Oscar/Formatter/EnrollToArrayFormatter.php +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ class EnrollToArrayFormatter $output['rolePrincipal'] = $affectation->getRoleObj()->isPrincipal(); $output['roleId'] = $affectation->getRoleObj()->getId(); $output['context'] = $context; $output['contextKey'] = ''; if( $context == 'activity' ){ $output['contextKey'] = $affectation->getEnroller()->getOscarNum(); } if( $context == 'project' ){ $output['contextKey'] = $affectation->getEnroller()->getAcronym(); } $manage = false; $show = false; Loading Loading
front/src/EntityWithRole.vue +93 −8 Original line number Diff line number Diff line <template> <div> <template> <div class="oscar-ajax" v-show="loading || error"> <div class="oscar-ajax-content"> Loading @@ -15,7 +14,7 @@ </div> </div> </template> <code>{{ entityEdited }}</code> <div class="overlay" v-if="entityDelete"> <div class="overlay-content"> <i class="icon-cancel-outline overlay-closer" @click="entityDelete = null"></i> Loading Loading @@ -62,6 +61,7 @@ en tant que <em>{{ entityEdited.role }}</em> </span> </h2> <input type="hidden" name="enroled" class="form-control select2" v-model="entityEdited.enrolled"/> <div class="row"> Loading Loading @@ -172,7 +172,56 @@ <i class="icon-doc-add"></i> Nouveau </a> <a class="oscar-link" @click="handlerEditEnable()"> <i class="icon-edit"></i> Modifier </a> </nav> <section v-if="editMode"> <div class="alert alert-info"> Détails des affectations. Une personne peut apparaître plusieurs fois selon le contexte et le rôle </div> <article class="row card" v-for="e in sortedFull"> <div class="col-md-6"> <i class="icon-cube" v-if="e.context == 'activity'"></i> <i class="icon-cubes" v-else></i> <strong>{{ e.enrolledLabel }}</strong> <small> (<span v-if="e.context == 'activity'"> <i class="icon-cube"></i> {{ e.contextKey }}</span> <span v-else> <i class="icon-cubes"></i> {{ e.contextKey }}</span>) </small> </div> <div class="col-md-3"> <em :class="{'bold': e.rolePrincipal }">{{ e.roleLabel }}</em> </div> <div class="col-md-3 text-right"> <a @click="handlerEdit(e)" style="white-space: nowrap"> <i class="icon-pencil-1 icon-clickable" v-if="manage"></i> Modifier </a> <a @click="handlerDelete(e)" style="white-space: nowrap"> <i class="icon-trash icon-clickable" v-if="manage"></i> Supprimer </a> </div> </article> </section> <section v-else> <span class="cartouche" v-for="e in stacked" :class="e.hasPrimary ? 'primary' : 'default' "> {{ e.enrolledLabel }} <span class="addon principal" > <span v-for="r in e.roles" class="addon-module" :class="{'primary': r.rolePrincipal}"> {{ r.role }} </span> </span> </span> </section> <!-- <span class="cartouche" v-for="e in entities" :class="{'primary': e.rolePrincipal, 'outofdate past': e.past }"> <i v-if="e.context == 'activity'" class="icon-cube"></i> <i v-else class="icon-cubes"></i> Loading @@ -184,6 +233,7 @@ <i class="icon-trash icon-clickable" v-if="manage" @click="handlerDelete(e)"></i> </span> </span> --> </div> </template> <script> Loading Loading @@ -221,10 +271,42 @@ export default { entityDelete: null, entityNew: null, error: null, loading: false loading: false, editMode: false }; }, computed: { sortedFull(){ console.log("sort"); return this.entities.sort( (a, b) => a.enrolled - b.enrolled ) }, stacked(){ let stacks = {}; this.entities.forEach(i => { let id = i.enrolled; if( !stacks.hasOwnProperty(id) ){ stacks[id] = { enrolled: i.enrolled, enrolledLabel: i.enrolledLabel, hasPrimary: false } stacks[id]['roles'] = {}; } stacks[id]['roles'][i.roleId] = { role: i.roleLabel, roleId: i.roleId, rolePrincipal: i.rolePrincipal, context: i.context, }; if( i.rolePrincipal ){ stacks[id].hasPrimary = true; } }) return stacks; } }, methods: { handlerEdit(item) { Loading Loading @@ -266,9 +348,12 @@ export default { document.location = url; }, handlerEditEnable() { this.editMode = !this.editMode; }, performDelete() { this.loading = "Suppression..."; console.log(url, this.entityDelete); var url = this.entityDelete.urlDelete; this.entityDelete = null; Loading
module/Oscar/src/Oscar/Command/OscarNotificationsMailsPersonsCommand.php +9 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Oscar\Service\OscarUserContext; use Oscar\Service\PersonService; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; Loading @@ -19,6 +20,7 @@ class OscarNotificationsMailsPersonsCommand extends OscarCommandAbstract { $this ->setDescription("Déclenche la procédure d'envoi des notifications par mail") ->addOption('date', 'd', InputOption::VALUE_OPTIONAL, 'date de déclenchement', null) ; } Loading @@ -28,9 +30,15 @@ class OscarNotificationsMailsPersonsCommand extends OscarCommandAbstract $io = new SymfonyStyle($input, $output); $date = $input->getOption('date'); $dateRef = null; if( $date ){ $dateRef = new \DateTime(date('Y-m-d ') . $date); } /** @var PersonService $personService */ $personService = $this->getServicemanager()->get(PersonService::class); $personService->mailPersonsWithUnreadNotification(null, $io); $personService->mailPersonsWithUnreadNotification($dateRef->format('Y-m-d H:i:s'), $io); } } No newline at end of file
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +6 −0 Original line number Diff line number Diff line Loading @@ -2124,6 +2124,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $editable = $editableA; $deletable = $deletableA; $context = "activity"; $contextKey = $activityPerson->getActivity()->getOscarNum(); $idEnroller = $activityPerson->getActivity()->getId(); } else { $urlDelete = $deletableA ? $this->url()->fromRoute( Loading @@ -2137,6 +2138,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $editable = $editableP; $deletable = $deletableP; $context = "project"; $contextKey = $activityPerson->getProject()->getAcronym(); $idEnroller = $activityPerson->getProject()->getId(); } $urlShow = false; Loading @@ -2155,6 +2157,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'rolePrincipal' => $activityPerson->isPrincipal(), 'urlDelete' => $urlDelete, 'context' => $context, 'contextKey' => $contextKey, 'urlEdit' => $urlEdit, 'urlShow' => $urlShow, 'past' => $activityPerson->isPast(), Loading Loading @@ -2223,10 +2226,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif $editable = $editableA; $deletable = $deletableA; $context = "activity"; $contextKey = $activityOrganization->getActivity()->getOscarNum(); } else { $editable = $editableP; $deletable = $deletableP; $context = "project"; $contextKey = $activityOrganization->getProject()->getAcronym(); } $urlDelete = $deletableA ? $this->url()->fromRoute( Loading @@ -2252,6 +2257,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'rolePrincipal' => $activityOrganization->isPrincipal(), 'urlDelete' => $urlDelete, 'context' => $context, 'contextKey' => $contextKey, 'urlEdit' => $urlEdit, 'urlShow' => $urlShow, 'enroller' => $activity->getId(), Loading
module/Oscar/src/Oscar/Entity/PersonRepository.php +4 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,10 @@ class PersonRepository extends EntityRepository implements IConnectedRepository ) ) ->innerJoin(NotificationPerson::class, 'n', Join::WITH, $qb->expr()->eq('p.id', 'n.person')) ->where('n.read IS NULL') ->innerJoin('n.notification', 'nt') ->where('n.read IS NULL AND nt.dateEffective <= :now') ->orderBy('p.lastname', 'ASC') ->setParameter('now', date('Y-m-d')) ->getQuery() ->getResult(); Loading
module/Oscar/src/Oscar/Formatter/EnrollToArrayFormatter.php +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ class EnrollToArrayFormatter $output['rolePrincipal'] = $affectation->getRoleObj()->isPrincipal(); $output['roleId'] = $affectation->getRoleObj()->getId(); $output['context'] = $context; $output['contextKey'] = ''; if( $context == 'activity' ){ $output['contextKey'] = $affectation->getEnroller()->getOscarNum(); } if( $context == 'project' ){ $output['contextKey'] = $affectation->getEnroller()->getAcronym(); } $manage = false; $show = false; Loading