update template add user to add quota, still need to show/hidde quota based on enable or not and impement
backend processing
This commit is contained in:
parent
4c47de3fc5
commit
f9e0312c89
|
@ -129,7 +129,14 @@ class User extends \descartes\Controller
|
|||
*/
|
||||
public function add()
|
||||
{
|
||||
return $this->render('user/add');
|
||||
$now = new \DateTime();
|
||||
$now_plus_one_month = clone $now;
|
||||
$now_plus_one_month->add(new \DateInterval('P1M'));
|
||||
|
||||
$now = $now->format('Y-m-d H:i:00');
|
||||
$now_plus_one_month = $now_plus_one_month->format('Y-m-d H:i:00');
|
||||
|
||||
return $this->render('user/add', ['now' => $now, 'now_plus_one_month' => $now_plus_one_month]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,15 +52,105 @@
|
|||
<input name="password" class="form-control" type="password" placeholder="Mot de passe de l'utilisateur">
|
||||
</div>
|
||||
</div>
|
||||
<?php if (isset($_SESSION['user']['admin']) && $_SESSION['user']['admin']) { ?>
|
||||
<div class="form-group">
|
||||
<label>Niveau administrateur : </label>
|
||||
<div class="form-group">
|
||||
<input name="admin" type="radio" value="1" required <?= (isset($_SESSION['previous_http_post']['admin']) && (bool) $_SESSION['previous_http_post']['admin']) ? 'checked' : ''; ?>/> Oui
|
||||
<input name="admin" type="radio" value="0" required <?= (isset($_SESSION['previous_http_post']['admin']) && !(bool) $_SESSION['previous_http_post']['admin']) ? 'checked' : ''; ?>/> Non
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label>Niveau administrateur : </label>
|
||||
<div class="form-group">
|
||||
<input name="admin" type="radio" value="1" required <?= (isset($_SESSION['previous_http_post']['admin']) && (bool) $_SESSION['previous_http_post']['admin']) ? 'checked' : ''; ?>/> Oui
|
||||
<input name="admin" type="radio" value="0" required <?= (isset($_SESSION['previous_http_post']['admin']) && !(bool) $_SESSION['previous_http_post']['admin']) ? 'checked' : ''; ?>/> Non
|
||||
</div>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend>Quota de SMS</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Définir un quota pour cet utilisateur : </label>
|
||||
<p class="italic small help">
|
||||
Définir un quota pour un utilisateur vous permet de choisir combien de SMS cet utilisateur pourras envoyer sur une période donnée.
|
||||
</p>
|
||||
|
||||
<div class="form-group">
|
||||
<input name="quota_enable" type="radio" value="1" required <?= (isset($_SESSION['previous_http_post']['quota_enable']) && (bool) $_SESSION['previous_http_post']['quota_enable']) ? 'checked' : ''; ?>/> Oui
|
||||
<input name="quota_enable" type="radio" value="0" required <?= (isset($_SESSION['previous_http_post']['quota_enable']) && !(bool) $_SESSION['previous_http_post']['quota_enable']) ? 'checked' : ''; ?>/> Non
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Nombre de SMS disponibles</label>
|
||||
<input name="quota_credit" class="form-control" type="number" required placeholder="Crédit de base" value="<?php $this->s($_SESSION['previous_http_post']['quota_credit'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>SMS additionels</label>
|
||||
<p class="italic small help">
|
||||
SMS venants s'ajouter au crédit de base. Vous pouvez par exemple utiliser des SMS additionels pour augmenter temporairement la limite de SMS d'un utilisateur.
|
||||
</p>
|
||||
<input name="quota_additional" class="form-control" type="number" required placeholder="Nombre de SMS additionel au crédit de base" value="<?php $this->s($_SESSION['previous_http_post']['quota_additional'] ?? '') ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date de début du quota</label>
|
||||
<input name="quota_start_date" class="form-control form-datetime auto-width" type="text" required readonly value="<?php $this->s($_SESSION['previous_http_post']['quota_start_date'] ?? $now) ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Durée du quota : </label>
|
||||
<p class="italic small help">
|
||||
Sur quelle durée le quota doit-il s'appliqué. Une fois cette durée passée, le quota sera soit désactivé soit renouvelé automatiquement.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<select name="quota_renew_interval" class="form-control" required>
|
||||
<option value="P1D" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P1D' ? 'selected' : '' ?>>1 jour</option>
|
||||
<option value="P15D" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P15D' ? 'selected' : '' ?>>15 jours</option>
|
||||
<option value="P28D" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P28D' ? 'selected' : '' ?>>28 jours</option>
|
||||
<option value="P30D" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P30D' ? 'selected' : '' ?>>30 jours</option>
|
||||
<option value="P31D" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P31D' ? 'selected' : '' ?>>31 jours</option>
|
||||
<option value="P1W" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P1W' ? 'selected' : '' ?>>1 semaine</option>
|
||||
<option value="P2W" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P2W' ? 'selected' : '' ?>>2 semaines</option>
|
||||
<option value="P3W" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P3W' ? 'selected' : '' ?>>3 semaines</option>
|
||||
<option value="P4W" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P4W' ? 'selected' : '' ?>>4 semaines</option>
|
||||
<option value="P1M" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P1M' ? 'selected' : '' ?>>1 mois</option>
|
||||
<option value="P2M" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P2M' ? 'selected' : '' ?>>2 mois</option>
|
||||
<option value="P3M" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P3M' ? 'selected' : '' ?>>3 mois</option>
|
||||
<option value="P6M" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P6M' ? 'selected' : '' ?>>6 mois</option>
|
||||
<option value="P9M" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P9M' ? 'selected' : '' ?>>9 mois</option>
|
||||
<option value="P12M" <?= ($_SESSION['previous_http_post']['quota_renew_interval'] ?? '') == 'P12M' ? 'selected' : '' ?>>12 mois</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Renouveler automatiquement le quota : </label>
|
||||
<p class="italic small help">
|
||||
Si activé, le crédit consommé sera automatiquement remis à zéro et le quota renouvelé pour la même durée à chaque fois qu'il arrivera à sa fin.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<input name="quota_auto_renew" type="radio" value="1" required <?= (isset($_SESSION['previous_http_post']['quota_auto_renew']) && (bool) $_SESSION['previous_http_post']['quota_auto_renew']) ? 'checked' : ''; ?>/> Oui
|
||||
<input name="quota_auto_renew" type="radio" value="0" required <?= (isset($_SESSION['previous_http_post']['quota_auto_renew']) && !(bool) $_SESSION['previous_http_post']['quota_auto_renew']) ? 'checked' : ''; ?>/> Non
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Reporter les SMS non consommés à la fin de la période : </label>
|
||||
<p class="italic small help">
|
||||
Si activé, les SMS non consommés serons reportés au mois suivant sous la forme de crédit additionel. Sinon, les SMS non utilisés seront simplement perdus.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<input name="quota_report_unused" type="radio" value="1" required <?= (isset($_SESSION['previous_http_post']['quota_report_unused']) && (bool) $_SESSION['previous_http_post']['quota_report_unused']) ? 'checked' : ''; ?>/> Oui
|
||||
<input name="quota_report_unused" type="radio" value="0" required <?= (isset($_SESSION['previous_http_post']['quota_report_unused']) && !(bool) $_SESSION['previous_http_post']['quota_report_unused']) ? 'checked' : ''; ?>/> Non
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Reporter les SMS additionels non consommés à la fin de la période : </label>
|
||||
<p class="italic small help">
|
||||
Si activé, les SMS additionels non consommés serons reportés au mois suivant sous la forme de crédit additionel. Sinon, les SMS additionels non utilisés seront simplement perdus.
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<input name="quota_report_unused_additional" type="radio" value="1" required <?= (isset($_SESSION['previous_http_post']['quota_report_unused_additional']) && (bool) $_SESSION['previous_http_post']['quota_report_unused_additional']) ? 'checked' : ''; ?>/> Oui
|
||||
<input name="quota_report_unused_additional" type="radio" value="0" required <?= (isset($_SESSION['previous_http_post']['quota_report_unused_additional']) && !(bool) $_SESSION['previous_http_post']['quota_report_unused_additional']) ? 'checked' : ''; ?>/> Non
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<a class="btn btn-danger" href="<?php echo \descartes\Router::url('User', 'list'); ?>">Annuler</a>
|
||||
<input type="submit" class="btn btn-success" value="Enregistrer le user" />
|
||||
</form>
|
||||
|
@ -71,5 +161,17 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
jQuery('.form-datetime').datetimepicker(
|
||||
{
|
||||
format: 'yyyy-mm-dd hh:ii:ss',
|
||||
autoclose: true,
|
||||
minuteStep: 1,
|
||||
language: 'fr'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$this->render('incs/footer');
|
||||
|
|
Loading…
Reference in New Issue