magic box: v1.0
This commit is contained in:
@@ -20,10 +20,18 @@
|
||||
<h2><i class="fa fa-c-changelog fa-inline"></i>Boite magique</h2>
|
||||
<div id="add_user" class="magic_box tiny_round">
|
||||
<h3><i class="fa fa-inline fa-c-profile"></i>Ajouter un user</h3>
|
||||
<p><input type="text" class="tiny_round" id="first_name" name="first_name" /></p>
|
||||
<p><input type="text" class="tiny_round" id="last_name" name="last_name" /></p>
|
||||
<p><input type="text" class="tiny_round" id="email" name="email" /></p>
|
||||
<p id="companies"></p>
|
||||
<form id="form_add_user" name="form_add_user">
|
||||
<p><input type="text" class="tiny_round" id="first_name" name="first_name" /></p>
|
||||
<p><input type="text" class="tiny_round" id="last_name" name="last_name" /></p>
|
||||
<p><input type="text" class="tiny_round" id="email" name="email" /></p>
|
||||
<p id="companies"></p>
|
||||
</form>
|
||||
</div>
|
||||
<div id="add_company" class="magic_box tiny_round">
|
||||
<h3><i class="fa fa-inline fa-c-company"></i>Ajouter une entreprise</h3>
|
||||
<form id="form_add_company" name="form_add_company">
|
||||
<p><input type="text" class="tiny_round" id="company" name="company" /></p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,14 +84,35 @@ function initAdminPanel(asAdmin)
|
||||
//Add user
|
||||
$('#first_name').addDefaultValue('Prénom');
|
||||
$('#last_name').addDefaultValue('Nom');
|
||||
addSelect($('#companies'), asAdmin.companies);
|
||||
addSelect($('#companies'), asAdmin.companies, 0, 'id');
|
||||
$('#email').addDefaultValue('Email');
|
||||
$('#add_user').addButton('ok', 'Créer', function(){}, 'submit_new_user', 'heavy inverse');
|
||||
$('#add_user').addButton('ok', 'Créer', function(){submitAdmin('add_user');}, 'submit_new_user', 'heavy inverse');
|
||||
|
||||
//Add company
|
||||
$('#company').addDefaultValue('Entreprise');
|
||||
$('#add_company').addButton('ok', 'Créer', function(){submitAdmin('add_company', true);}, 'submit_new_user', 'heavy inverse');
|
||||
|
||||
//Show panel
|
||||
$('#admin').show();
|
||||
}
|
||||
|
||||
function submitAdmin(sAction, bReboot)
|
||||
{
|
||||
bReboot = bReboot || false;
|
||||
databap.saveForm
|
||||
(
|
||||
sAction,
|
||||
databap.getMainElem('#form_'+sAction),
|
||||
function(oData)
|
||||
{
|
||||
databap.feedback(oData.result, oData.desc);
|
||||
if(oData.result==self.consts.success && bReboot) location.reload();
|
||||
},
|
||||
true,
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
function addSelect($Box, asOptions, sSelectedValue, sSelectId, sSelectClass)
|
||||
{
|
||||
sSelectedValue = sSelectedValue || 0;
|
||||
|
||||
Reference in New Issue
Block a user