[webpack.teacher.view] added fetching categories for 'create' card
This commit is contained in:
parent
c6fc6631fb
commit
8f47e3d7ae
|
@ -216,10 +216,10 @@
|
|||
|
||||
"category": {
|
||||
"GET": {
|
||||
"des" : "Get all data about a professor category",
|
||||
"des" : "Get all data about a given category | all",
|
||||
"per": [],
|
||||
"par": {
|
||||
"URL0":{"des" : "Id of the category", "typ": "id", "ren": "idCat", "opt" : true}
|
||||
"URL0": { "des": "Id of the category", "typ": "id", "ren": "cat_id", "opt": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,17 +6,11 @@
|
|||
|
||||
<div class='card container'>
|
||||
|
||||
<section
|
||||
data-id='create'
|
||||
data-category=''
|
||||
data-lname=''
|
||||
data-fname=''>
|
||||
<section data-create>
|
||||
|
||||
<select class='category'>
|
||||
<option value='1'>blsdblasd1</option>
|
||||
<option value='2'>blsdblasd2</option>
|
||||
<option value='3'>blsdblasd3</option>
|
||||
<option value='4'>blsdblasd4</option>
|
||||
<option selected='selected' disabled='disabled'>Catégorie d'enseignant</option>
|
||||
<option v-for='cat in gstore.categories' :value='cat.idCategorie'>{{ cat.labelCategorie }}</option>
|
||||
</select>
|
||||
<h1>
|
||||
<input type='text' placeholder='Prénom Nom' value='Prénom Nom'>
|
||||
|
|
|
@ -17,6 +17,26 @@ api.call('GET professor/1/', { vh: true }, function(rs){
|
|||
|
||||
|
||||
|
||||
|
||||
/* (2) Load categories (for creating a professor)
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Initialize list */
|
||||
gstore.add('categories', []);
|
||||
|
||||
/* (2) Get categories */
|
||||
api.call('GET category', { vh: true }, function(rs){
|
||||
|
||||
// {1} If error -> abort //
|
||||
if( rs.error !== 0 )return console.log('No categorie found, error: '+rs.error);
|
||||
console.log(rs);
|
||||
|
||||
// {2} Store categories //
|
||||
gstore.get.categories = rs.categories;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* (2) Define filters' callback
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Define global callback */
|
||||
|
|
Loading…
Reference in New Issue