[repo.ue] fixed get(code), get(null) already worked | [webpack.ue.view] fixed 'form_by_id' that is now declared before fetching UEs
This commit is contained in:
parent
6c0b6fe32a
commit
843251449f
|
@ -174,7 +174,7 @@ class ue extends Repo_i {
|
||||||
public function get(?String $code=null) : array{
|
public function get(?String $code=null) : array{
|
||||||
|
|
||||||
/* (1) Manage if no id given */
|
/* (1) Manage if no id given */
|
||||||
$cond = is_null($code) ? '' : 'AND `ue.`code` = :code';
|
$cond = is_null($code) ? '' : 'HAVING `ue`.`code` = :code';
|
||||||
$parm = is_null($code) ? [] : [':code' => $code];
|
$parm = is_null($code) ? [] : [':code' => $code];
|
||||||
|
|
||||||
/* (2) Prepare Statement */
|
/* (2) Prepare Statement */
|
||||||
|
@ -206,8 +206,8 @@ class ue extends Repo_i {
|
||||||
OR TP2.Formation_idFormation = Formation.idFormation
|
OR TP2.Formation_idFormation = Formation.idFormation
|
||||||
GROUP BY `ue2`.`code`
|
GROUP BY `ue2`.`code`
|
||||||
) formlist ON formlist.code = ue.code
|
) formlist ON formlist.code = ue.code
|
||||||
##$cond
|
|
||||||
GROUP BY `ue`.`code`
|
GROUP BY `ue`.`code`
|
||||||
|
$cond
|
||||||
ORDER BY `ue`.`label` ASC");
|
ORDER BY `ue`.`label` ASC");
|
||||||
|
|
||||||
/* (3) Bind params and execute statement */
|
/* (3) Bind params and execute statement */
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
<div v-show='gstore.edit_i!=pi' :class="ue.required ? 'sub warning' : 'sub'">{{ ue.required ? 'UE obligatoire' : 'UE optionnelle' }}</div>
|
<div v-show='gstore.edit_i!=pi' :class="ue.required ? 'sub warning' : 'sub'">{{ ue.required ? 'UE obligatoire' : 'UE optionnelle' }}</div>
|
||||||
<div v-show='gstore.edit_i!=pi' class='sub'><strong>{{ ue.volumeCours + ue.volumeTD + ue.volumeTP }}h</strong> totales</div>
|
<div v-show='gstore.edit_i!=pi' class='sub'><strong>{{ ue.volumeCours + ue.volumeTD + ue.volumeTP }}h</strong> totales</div>
|
||||||
<div v-show='gstore.edit_i!=pi' class='taglist'>
|
<div v-show='gstore.edit_i!=pi' class='taglist'>
|
||||||
<span v-for='form_id in ue.formations' :class="!!gstore.form_by_id(form_id).isInternal ? 'search' : ''">{{ gstore.form_by_id(form_id).labelForm }}</span>
|
<span v-for='form_id in ue.formations' :class="!!gstore.form_by_id(form_id).isInternal ? 'search' : ''">{{ gstore.form_by_id(form_id).labelForm || '???' }}</span>
|
||||||
<span class='search'>M2 INFO (S1)</span>
|
<span class='search'>M2 INFO (S1)</span>
|
||||||
<span>LPRO</span>
|
<span>LPRO</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,23 +1,4 @@
|
||||||
/* (1) Load ues
|
/* (1) Load formations
|
||||||
---------------------------------------------------------*/
|
|
||||||
/* (1) Initialize list */
|
|
||||||
gstore.add('ues', []);
|
|
||||||
|
|
||||||
/* (2) Get ues */
|
|
||||||
api.call('GET ue/', { vh: true }, function(rs){
|
|
||||||
|
|
||||||
// {1} If error -> abort //
|
|
||||||
if( rs.error !== 0 )return console.log('No UE found, error: '+rs.error);
|
|
||||||
console.log(rs);
|
|
||||||
|
|
||||||
// {2} Store ues //
|
|
||||||
gstore.get.ues = rs.ues;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (2) Load formations
|
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
/* (1) Initialize list */
|
/* (1) Initialize list */
|
||||||
gstore.add('formations', []);
|
gstore.add('formations', []);
|
||||||
|
@ -40,14 +21,14 @@ gstore.add('form_by_id', function(form_id){
|
||||||
|
|
||||||
/* (1) Abort if wrong form_id */
|
/* (1) Abort if wrong form_id */
|
||||||
if( form_id == null )
|
if( form_id == null )
|
||||||
return null;
|
return { idForm: null, labelForm: null };
|
||||||
|
|
||||||
/* (2.1) Find index in gstore */
|
/* (2.1) Find index in gstore */
|
||||||
var gi = gstore.get.formations.map( (data, i) => { return ( data.idForm && data.idForm == form_id ) ? i : ''; }).join('');
|
var gi = gstore.get.formations.map( (data, i) => { return ( data.idForm && data.idForm == form_id ) ? i : ''; }).join('');
|
||||||
|
|
||||||
/* (2.2) Exit if not found */
|
/* (2.2) Exit if not found */
|
||||||
if( isNaN(gi) )
|
if( isNaN(gi) )
|
||||||
return null;
|
return { idForm: null, labelForm: null };
|
||||||
|
|
||||||
return gstore.get.formations[gi];
|
return gstore.get.formations[gi];
|
||||||
|
|
||||||
|
@ -56,6 +37,31 @@ gstore.add('form_by_id', function(form_id){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* (2) Load ues
|
||||||
|
---------------------------------------------------------*/
|
||||||
|
/* (1) Initialize list */
|
||||||
|
gstore.add('ues', []);
|
||||||
|
|
||||||
|
/* (2) Get ues */
|
||||||
|
api.call('GET ue/', { vh: true }, function(rs){
|
||||||
|
|
||||||
|
// {1} If error -> abort //
|
||||||
|
if( rs.error !== 0 )return console.log('No UE found, error: '+rs.error);
|
||||||
|
console.log(rs);
|
||||||
|
|
||||||
|
// {2} Store ues //
|
||||||
|
gstore.get.ues = rs.ues;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (2) Manage Instant Search (IS)
|
/* (2) Manage Instant Search (IS)
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
/* (1) Define global timeout index */
|
/* (1) Define global timeout index */
|
||||||
|
|
Loading…
Reference in New Issue