Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +14 −1 Original line number Diff line number Diff line Loading @@ -2452,6 +2452,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ]; } // Liste des états d'avancements // Trie $sortDirections = [ 'desc' => 'Décroissant', Loading Loading @@ -2899,7 +2902,17 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } break; case 'aj': $filterIds = $this->getActivityService()->getActivityIdsByJalon($crit['val1']); $progressStr = $params[2]; $progressArray = null; if( $progressStr != null && $progressStr != "" && $progressStr != 'null' && $progressStr != 'undefined' ){ $progressArray = explode(',', $progressStr); $crit['val1'] = $value1; $crit['val2'] = implode(',', $progressArray); } else { $crit['val2'] = ''; } $filterIds = $this->getActivityService()->getActivityIdsByJalon($crit['val1'], $progressArray); break; case 'ds' : $qb->andWhere('dis.id = :discipline'); Loading module/Oscar/src/Oscar/Entity/ActivityDate.php +9 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,15 @@ class ActivityDate implements ITrackable const VALUE_CANCELED = 200; const VALUE_REFUSED = 400; static public function progressInfos() { return [ self::VALUE_TODO => "A faire", self::VALUE_INPROGRESS => "En cours", self::VALUE_VALIDED => "Validé", self::VALUE_CANCELED => "Annulé", self::VALUE_REFUSED => "Refusé" ]; } /** * Données (la date) Loading module/Oscar/src/Oscar/Service/ProjectGrantService.php +9 −3 Original line number Diff line number Diff line Loading @@ -402,13 +402,19 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi } public function getActivityIdsByJalon($jalonTypeId) public function getActivityIdsByJalon($jalonTypeId, $progression = null ) { $q = $this->getActivityRepository()->createQueryBuilder('c') ->select('c.id') ->innerJoin('c.milestones', 'm') ->where('m.type = :jalonId') ->setParameter('jalonId', $jalonTypeId); ->where('m.type = :jalonId'); if( is_array($progression) ){ $q->andWhere('m.finished IN(:progression)') ->setParameter('progression', $progression); } $q->setParameter('jalonId', $jalonTypeId); $activities = $q->getQuery()->getResult(); return array_map('current', $activities); Loading module/Oscar/view/oscar/project-grant/advanced-search.phtml +81 −4 Original line number Diff line number Diff line Loading @@ -252,11 +252,24 @@ <div class="icon-calendar"></div> <small>{{typeLabel}}</small> {{#if error}}<strong class="text-danger"><i class="icon-attention-1"></i> {{error}}</strong>{{/if}} <select class="select2 form-control val1 changer types" id="filter_jalon"> <select class="select2 form-control val1 changer types hideval2" id="filter_jalon"> <?php foreach( $filterJalons as $jalon ): ?> <option value="<?= $jalon['id'] ?>"><?= $jalon['label'] ?></option> <option value="<?= $jalon['id'] ?>" data-progress="<?= $jalon['finishable'] ? 'on' : 'off' ?>"><?= $jalon['label'] ?></option> <?php endforeach; ?> </select> <div class="progression val2-options"> <i class="icon-cog"></i> Options <div class="choose"> <?php foreach( \Oscar\Entity\ActivityDate::progressInfos() as $value=>$label ): $uniq = uniqid('cb'); ?> <div> <label for="<?= $uniq ?>"> <input id="<?= $uniq ?>" type="checkbox" value="<?= $value ?>" class="val2 changer" /> <?= $label ?> </label> </div> <?php endforeach; ?> </div> </div> <input type="hidden" name="criteria[]" class="criteria" value="{{criteria}}"/> <nav> <a href="#" class="delete"> Loading Loading @@ -704,6 +717,7 @@ }; var addcriterie = function (datas) { console.log("DATAS:", datas); datas.typeLabel = (labelsType[datas.type]); datas.criteria = datas.type + ";" + datas.val1 + ";" + datas.val2; Loading Loading @@ -767,9 +781,42 @@ applyChange = function(){ console.log('applyChange'); var filter = dom; var val2 = ""; // Afficher/montrer les options var select = dom.find('.val1.hideval2'); if( select.length ){ var opt = select.find('option[value="' + select.val() +'"]'); if( opt[0].dataset.progress && opt[0].dataset.progress == 'off' ){ dom.addClass('hideval2-on') } else { dom.removeClass('hideval2-on') } } // Checkbox ? var checkboxs = filter.find('.val2[type="checkbox"]'); if( checkboxs.length > 1 ){ var values = []; checkboxs.each(i => { var checkbox = checkboxs[i]; if( checkbox.checked ){ values.push(checkbox.value); } }); val2 = values.join(','); } else { var val2Elem = filter.find('.val2'); if( val2Elem ){ val2 = val2Elem.val(); } } filter.find('.criteria').val(datas.type + ';' + filter.find('.val1').val() + ';' + filter.find('.val2').val()); + ';' + val2); }; Loading Loading @@ -812,7 +859,6 @@ }; }, processResults: function (data, page) { console.log(data); return {results: data.datas}; }, cache: true Loading Loading @@ -869,6 +915,37 @@ dom.find('.val2').val(datas.val2); } if(datas.type == 'aj' && datas.val2 != null ){ var option = dom.find('option[value="'+ datas.val1 +'"]'); // On affiche ou pas les options if( option ){ try{ if(option[0].dataset.progress && option[0].dataset.progress == 'off'){ dom.addClass('hideval2-on'); } } catch (error){ console.log(error); } } console.log("AJ", datas); var val2 = "" +datas.val2; if( val2.indexOf(',') > 0 ){ checked = val2.split(','); } else { checked = [val2]; } console.log("checked", checked); var checkboxs = dom.find('input[type="checkbox"]'); checkboxs.each(i => { if( checked.indexOf(checkboxs[i].value) >= 0 ){ checkboxs[i].checked = true; } }) } if(datas.type == 'add' || datas.type == 'adf' || datas.type == 'adm' || datas.type == 'ads' || datas.type == 'adp' || datas.type == 'adc') { $('.datepicker').datepicker({ format: "yyyy-mm-dd", Loading public/css/_common.scss +25 −0 Original line number Diff line number Diff line Loading @@ -6602,4 +6602,29 @@ $weekHightlightColor: #80b7ec; ; } .val2-options { opacity: 1; position: relative; } .val2-options:hover .choose { display: block; } .val2-options .choose { display: none; } .val2-options .choose { padding: 1em; position: absolute; z-index: 1000; } .hideval2-on { .val2-options { display: none; } } @import "modules/oscar-autocompleter.scss"; @import "vue-select.css"; No newline at end of file Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +14 −1 Original line number Diff line number Diff line Loading @@ -2452,6 +2452,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ]; } // Liste des états d'avancements // Trie $sortDirections = [ 'desc' => 'Décroissant', Loading Loading @@ -2899,7 +2902,17 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } break; case 'aj': $filterIds = $this->getActivityService()->getActivityIdsByJalon($crit['val1']); $progressStr = $params[2]; $progressArray = null; if( $progressStr != null && $progressStr != "" && $progressStr != 'null' && $progressStr != 'undefined' ){ $progressArray = explode(',', $progressStr); $crit['val1'] = $value1; $crit['val2'] = implode(',', $progressArray); } else { $crit['val2'] = ''; } $filterIds = $this->getActivityService()->getActivityIdsByJalon($crit['val1'], $progressArray); break; case 'ds' : $qb->andWhere('dis.id = :discipline'); Loading
module/Oscar/src/Oscar/Entity/ActivityDate.php +9 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,15 @@ class ActivityDate implements ITrackable const VALUE_CANCELED = 200; const VALUE_REFUSED = 400; static public function progressInfos() { return [ self::VALUE_TODO => "A faire", self::VALUE_INPROGRESS => "En cours", self::VALUE_VALIDED => "Validé", self::VALUE_CANCELED => "Annulé", self::VALUE_REFUSED => "Refusé" ]; } /** * Données (la date) Loading
module/Oscar/src/Oscar/Service/ProjectGrantService.php +9 −3 Original line number Diff line number Diff line Loading @@ -402,13 +402,19 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi } public function getActivityIdsByJalon($jalonTypeId) public function getActivityIdsByJalon($jalonTypeId, $progression = null ) { $q = $this->getActivityRepository()->createQueryBuilder('c') ->select('c.id') ->innerJoin('c.milestones', 'm') ->where('m.type = :jalonId') ->setParameter('jalonId', $jalonTypeId); ->where('m.type = :jalonId'); if( is_array($progression) ){ $q->andWhere('m.finished IN(:progression)') ->setParameter('progression', $progression); } $q->setParameter('jalonId', $jalonTypeId); $activities = $q->getQuery()->getResult(); return array_map('current', $activities); Loading
module/Oscar/view/oscar/project-grant/advanced-search.phtml +81 −4 Original line number Diff line number Diff line Loading @@ -252,11 +252,24 @@ <div class="icon-calendar"></div> <small>{{typeLabel}}</small> {{#if error}}<strong class="text-danger"><i class="icon-attention-1"></i> {{error}}</strong>{{/if}} <select class="select2 form-control val1 changer types" id="filter_jalon"> <select class="select2 form-control val1 changer types hideval2" id="filter_jalon"> <?php foreach( $filterJalons as $jalon ): ?> <option value="<?= $jalon['id'] ?>"><?= $jalon['label'] ?></option> <option value="<?= $jalon['id'] ?>" data-progress="<?= $jalon['finishable'] ? 'on' : 'off' ?>"><?= $jalon['label'] ?></option> <?php endforeach; ?> </select> <div class="progression val2-options"> <i class="icon-cog"></i> Options <div class="choose"> <?php foreach( \Oscar\Entity\ActivityDate::progressInfos() as $value=>$label ): $uniq = uniqid('cb'); ?> <div> <label for="<?= $uniq ?>"> <input id="<?= $uniq ?>" type="checkbox" value="<?= $value ?>" class="val2 changer" /> <?= $label ?> </label> </div> <?php endforeach; ?> </div> </div> <input type="hidden" name="criteria[]" class="criteria" value="{{criteria}}"/> <nav> <a href="#" class="delete"> Loading Loading @@ -704,6 +717,7 @@ }; var addcriterie = function (datas) { console.log("DATAS:", datas); datas.typeLabel = (labelsType[datas.type]); datas.criteria = datas.type + ";" + datas.val1 + ";" + datas.val2; Loading Loading @@ -767,9 +781,42 @@ applyChange = function(){ console.log('applyChange'); var filter = dom; var val2 = ""; // Afficher/montrer les options var select = dom.find('.val1.hideval2'); if( select.length ){ var opt = select.find('option[value="' + select.val() +'"]'); if( opt[0].dataset.progress && opt[0].dataset.progress == 'off' ){ dom.addClass('hideval2-on') } else { dom.removeClass('hideval2-on') } } // Checkbox ? var checkboxs = filter.find('.val2[type="checkbox"]'); if( checkboxs.length > 1 ){ var values = []; checkboxs.each(i => { var checkbox = checkboxs[i]; if( checkbox.checked ){ values.push(checkbox.value); } }); val2 = values.join(','); } else { var val2Elem = filter.find('.val2'); if( val2Elem ){ val2 = val2Elem.val(); } } filter.find('.criteria').val(datas.type + ';' + filter.find('.val1').val() + ';' + filter.find('.val2').val()); + ';' + val2); }; Loading Loading @@ -812,7 +859,6 @@ }; }, processResults: function (data, page) { console.log(data); return {results: data.datas}; }, cache: true Loading Loading @@ -869,6 +915,37 @@ dom.find('.val2').val(datas.val2); } if(datas.type == 'aj' && datas.val2 != null ){ var option = dom.find('option[value="'+ datas.val1 +'"]'); // On affiche ou pas les options if( option ){ try{ if(option[0].dataset.progress && option[0].dataset.progress == 'off'){ dom.addClass('hideval2-on'); } } catch (error){ console.log(error); } } console.log("AJ", datas); var val2 = "" +datas.val2; if( val2.indexOf(',') > 0 ){ checked = val2.split(','); } else { checked = [val2]; } console.log("checked", checked); var checkboxs = dom.find('input[type="checkbox"]'); checkboxs.each(i => { if( checked.indexOf(checkboxs[i].value) >= 0 ){ checkboxs[i].checked = true; } }) } if(datas.type == 'add' || datas.type == 'adf' || datas.type == 'adm' || datas.type == 'ads' || datas.type == 'adp' || datas.type == 'adc') { $('.datepicker').datepicker({ format: "yyyy-mm-dd", Loading
public/css/_common.scss +25 −0 Original line number Diff line number Diff line Loading @@ -6602,4 +6602,29 @@ $weekHightlightColor: #80b7ec; ; } .val2-options { opacity: 1; position: relative; } .val2-options:hover .choose { display: block; } .val2-options .choose { display: none; } .val2-options .choose { padding: 1em; position: absolute; z-index: 1000; } .hideval2-on { .val2-options { display: none; } } @import "modules/oscar-autocompleter.scss"; @import "vue-select.css"; No newline at end of file