303 lines
16 KiB
PHP
303 lines
16 KiB
PHP
<?php
|
|
session_start();
|
|
header('Content-type: text/html; charset=UTF-8');
|
|
|
|
if (isset($_SESSION['usa_id'])||isset($_SESSION['com_id'])) {
|
|
require_once($_SERVER["DOCUMENT_ROOT"] . "/superadm/php/inc_functions.php");
|
|
require_once($_SERVER["DOCUMENT_ROOT"] . "/superadm/php/inc_manager.php");
|
|
require_once($_SERVER["DOCUMENT_ROOT"] . "/php/inc_fx_rabais_batch.php");
|
|
//error_reporting(E_ALL);
|
|
//ini_set("display_errors", 1);
|
|
global $vDomaine;
|
|
?>
|
|
<style type="text/css">
|
|
body {color: #fff; font-family: "Arial"; font-size: 12px;}
|
|
h1 {color: #000; font-size: 24px;}
|
|
h2 {color: #000; font-size: 16px;}
|
|
.codes {color: #333;}
|
|
.resume {background: #ddd; border: 1px solid #bbb; color: #000; margin-bottom: 10px; padding: 10px; width: 400px;}
|
|
/* FORMULAIRES */
|
|
label.error {background-position: left top; background-repeat: no-repeat; display: block; float: left; font-size: 0.9em; font-style: italic; font-weight: bold; line-height: 18px; margin: 5px; padding-left: 18px; width: auto;}
|
|
div.msg label.error, label.success, label.msg, label.promo {background-position: left top; background-repeat: no-repeat; display: block; float: none; font-size: 0.9em; font-style: italic; font-weight: bold; line-height: 18px; margin: 5px; padding-left: 18px; width: auto;}
|
|
label.error {background-image: url(images/error.png); color: #c33;}
|
|
label.success {background-image: url(images/tick.png); color: #529214;}
|
|
label.msg {background-image: url(images/information.png); color: #0072bc;}
|
|
div.error {display: none;}
|
|
div.error, div.msg {background-color: #ffb; border: 1px solid #feb; margin-bottom: 10px; padding: 3px;}
|
|
|
|
input, textarea, select {background: #fff; border: 1px solid #ffa200; color: #333; font-size: 1em; padding: 1px;}
|
|
textarea {font-size: 1.2em;}
|
|
select {padding: 0;}
|
|
select option {padding-right: 10px;}
|
|
input.error, textarea.error {background: #e99; border: 1px solid #c33;}
|
|
|
|
fieldset {border: none; margin-bottom: 10px;}
|
|
fieldset legend {color: #000; font-weight: bold; padding: 2px 5px;}
|
|
fieldset label.form {color: #333; float: left; margin: 5px; text-align: right; width: 180px;}
|
|
fieldset label.info {color: #666; float: left; font: italic bold 11px "Trebuchet MS"; margin: 5px;}
|
|
fieldset input, fieldset textarea, fieldset select, fieldset p, fieldset button, fieldset img {float: left; margin: 5px;}
|
|
fieldset br {clear: left;}
|
|
fieldset input.chk_input, fieldset #panier input.chk_input, fieldset #panier input.chk_termes, fieldset label.chk_label {float: left; margin: 0 5px 0 0;}
|
|
fieldset label.chk_label {color: #333;}
|
|
fieldset p img {float: none; margin: 0; padding-right: 3px; vertical-align: text-top;}
|
|
|
|
button {background: #ffa200; border: 1px solid #ddd; color: #333; cursor: pointer; display: block; font-size: 1em; font-weight: bold; line-height: 130%; outline: none; overflow: visible; padding: 5px 10px; text-decoration: none; text-transform: lowercase; width: auto;}
|
|
button:hover {background: #000; color: #ddd; cursor: pointer; text-decoration: none;}
|
|
button:active {background: #999; color: #333; cursor: pointer; text-decoration: none;}
|
|
</style>
|
|
|
|
<link type="text/css" rel="stylesheet" href="<?php echo $vDomaine; ?>/libs/jquery-ui-1.12.1/jquery-ui.min.css">
|
|
<script type="text/javascript" src="<?php echo $vDomaine; ?>/libs/jquery/jquery-3.4.1.min.js"></script>
|
|
<script type="text/javascript" src="<?php echo $vDomaine; ?>/libs/jquery-ui-1.12.1/jquery-ui.min.js"></script>
|
|
<script type="text/javascript" src="<?php echo $vDomaine; ?>/plugins/jqery.validate-1.19.1/jquery.validate.min.js"></script>
|
|
<script type="text/javascript" src="<?php echo $vDomaine; ?>/plugins/jqery.validate-1.19.1/additional-methods.min.js"></script>
|
|
|
|
|
|
<?php
|
|
// fonction qui génère un numéro de série (JSP)
|
|
// créé : 2013-02-05
|
|
|
|
if (isset($_POST['btn_save'])) {
|
|
$strKey = fxCreerRabais();
|
|
?>
|
|
<script type="text/javascript">
|
|
window.location.href = '<?php echo $vDomaine; ?>/maj_rabais.php?batch=<?php echo $strKey; ?>';
|
|
</script>
|
|
<?php
|
|
}
|
|
elseif (isset($_POST['btn_next'])) { // ÉTAPE 2
|
|
$tabEpreuves = fxGetEpreuvesRabais($_POST['sel_evenement']);
|
|
$tabProduits = fxGetProduitsRabais($_POST['sel_evenement']);
|
|
?>
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
$("#frm_rabais").validate({
|
|
rules: {
|
|
txt_nb: {
|
|
required: true,
|
|
digits: true
|
|
},
|
|
txt_description_fr: "required",
|
|
txt_description_en: "required",
|
|
txt_pourcent: {
|
|
required: true,
|
|
digits: true
|
|
},
|
|
txt_montant: {
|
|
required: true,
|
|
number: true
|
|
},
|
|
txt_date_limite: {
|
|
required: true,
|
|
dateCA: true
|
|
},
|
|
txt_date_limite_debut: {
|
|
dateCA: true
|
|
},
|
|
txt_qte: {
|
|
required: true,
|
|
digits: true
|
|
},
|
|
txt_priorite: {
|
|
required: true,
|
|
digits: true
|
|
},
|
|
rab_nb_epr_diff2: {
|
|
digits: true
|
|
}
|
|
},
|
|
messages: {
|
|
txt_nb: {
|
|
required: "Veuillez entrer le nombre de rabais",
|
|
digits: "Le nombre de rabais doit être un nombbre entier"
|
|
},
|
|
txt_description_fr: "Veuillez entrer la description en français",
|
|
txt_description_en: "Veuillez entrer la description en anglais",
|
|
txt_pourcent: {
|
|
required: "Veuillez entrer le puorcent (%)",
|
|
digits: "Le pourcent ($) doit être un nombbre entier"
|
|
},
|
|
txt_montant: {
|
|
required: "Veuillez entrer le montant ($)",
|
|
number: "Le montant ($) doit être un nombbre décimal"
|
|
},
|
|
txt_date_limite: {
|
|
required: "Veuillez entrer la date limite",
|
|
dateCA: "La date limite doit être sous le format AAAA-MM-JJ"
|
|
},
|
|
txt_date_limite_debut: {
|
|
dateCA: "La date limite doit être sous le format AAAA-MM-JJ"
|
|
},
|
|
txt_qte: {
|
|
required: "Veuillez entrer la quantité",
|
|
digits: "La quantité doit être un nombbre entier"
|
|
},
|
|
txt_priorite: {
|
|
required: "Veuillez entrer la priorité",
|
|
digits: "La priorité doit être un nombbre entier"
|
|
},
|
|
rab_nb_epr_diff2: {
|
|
digits: "La nombre d'épreuves doit être un nombbre entier"
|
|
}
|
|
}
|
|
});
|
|
|
|
$('#txt_date_limite,#txt_date_limite_debut').datepicker({
|
|
showOn: "button",
|
|
buttonImage: '<?php echo $vDomaine; ?>/images/date.png',
|
|
buttonImageOnly: true,
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
dateFormat: 'yy-mm-dd',
|
|
showAnim: 'slideDown',
|
|
yearRange: '-1:+20'
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<h1>Créer des codes rabais</h1>
|
|
<h2>Étape 2: définir les détails</h2>
|
|
<form action="maj_rabais.php" method="post" id="frm_rabais" name="frm_rabais">
|
|
<fieldset>
|
|
<input type="hidden" id="txt_ajoute_par" name="txt_ajoute_par" value="<?php echo $_POST['txt_ajoute_par']; ?>" />
|
|
<input type="hidden" id="sel_evenement" name="sel_evenement" value="<?php echo $_POST['sel_evenement']; ?>" />
|
|
<label class="form">S'applique aux épreuves :</label>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($tabEpreuves); $intCtr++) {
|
|
if ($intCtr > 1) {
|
|
?>
|
|
<label class="form"><span></span></label>
|
|
<?php
|
|
}
|
|
?>
|
|
<p><input type="checkbox" id="epr_id_<?php echo $intCtr; ?>" name="epr_id[]" value="<?php echo $tabEpreuves[$intCtr]['epr_id']; ?>" class="chk_input"> <label for="epr_id_<?php echo $intCtr; ?>" class="chk_label"><?php echo $tabEpreuves[$intCtr]['epr_id'] . ' - ' . fxUnescape($tabEpreuves[$intCtr]['epr_type_fr']); ?> <?php echo fxUnescape($tabEpreuves[$intCtr]['epr_nom_fr']); ?></label></p>
|
|
<br>
|
|
<?php
|
|
}
|
|
?>
|
|
<?php
|
|
if (count($tabProduits) > 0) {
|
|
?>
|
|
<label class="form">S'applique aux produits :</label>
|
|
<?php
|
|
for ($intCtr = 1; $intCtr <= count($tabProduits); $intCtr++) {
|
|
if ($intCtr > 1) {
|
|
?>
|
|
<label class="form"><span></span></label>
|
|
<?php
|
|
}
|
|
?>
|
|
<p><input type="checkbox" id="pro_id_<?php echo $intCtr; ?>" name="pro_id[]" value="<?php echo $tabProduits[$intCtr]['pro_id']; ?>" class="chk_input"> <label for="pro_id_<?php echo $intCtr; ?>" class="chk_label"><?php echo $tabProduits[$intCtr]['pro_id'] . ' - ' . fxUnescape($tabProduits[$intCtr]['pro_nom_fr']); ?></label></p>
|
|
<br>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
<label for="txt_nb" class="form">Nombre de rabais :</label>
|
|
<input type="text" id="txt_nb" name="txt_nb" value="10" size="3" maxlength="3" />
|
|
<br />
|
|
<label for="txt_description_fr" class="form">Description (français) :</label>
|
|
<input type="text" id="txt_description_fr" name="txt_description_fr" value="Rabais 100%" size="30" maxlength="50" />
|
|
<br />
|
|
<label for="txt_description_en" class="form">Description (anglais) :</label>
|
|
<input type="text" id="txt_description_en" name="txt_description_en" value="Discount 100%" size="30" maxlength="50" />
|
|
<br />
|
|
<label for="txt_pourcent" class="form">Pourcent (%) :</label>
|
|
<input type="text" id="txt_pourcent" name="txt_pourcent" value="100" size="5" maxlength="3" />
|
|
<label class="info">* mettre 0 si n/a</label>
|
|
<br />
|
|
<label for="txt_montant" class="form">Montant ($) :</label>
|
|
<input type="text" id="txt_montant" name="txt_montant" value="0" size="5" maxlength="6" />
|
|
<label class="info">* mettre 0 si n/a</label>
|
|
<br />
|
|
<label for="txt_date_limite_debut" class="form">Date limite pour début d'utilisation :</label>
|
|
<input type="text" id="txt_date_limite_debut" name="txt_date_limite_debut" size="10" maxlength="10" />
|
|
<br />
|
|
<label for="txt_heure_limite_debut" class="form">Heure limite pour début d'utilisation :</label>
|
|
<input type="text" id="txt_heure_limite_debut" name="txt_heure_limite_debut" size="10" maxlength="8" /> ex. 23:59:59
|
|
<br />
|
|
<label for="txt_date_limite" class="form">Date limite pour fin d'utilisation :</label>
|
|
<input type="text" id="txt_date_limite" name="txt_date_limite" size="10" maxlength="10" />
|
|
<br />
|
|
<label for="txt_heure_limite_fin" class="form">Heure limite pour fin d'utilisation :</label>
|
|
<input type="text" id="txt_heure_limite_fin" name="txt_heure_limite_fin" size="10" maxlength="8" /> ex. 23:59:59
|
|
<br />
|
|
<label for="txt_qte" class="form">Quantité :</label>
|
|
<input type="text" id="txt_qte" name="txt_qte" value="1" size="3" maxlength="10" />
|
|
<label class="info">* pour chaque rabais</label>
|
|
<br />
|
|
<label for="txt_priorite" class="form">Priorité :</label>
|
|
<input type="text" id="txt_priorite" name="txt_priorite" value="99" size="3" maxlength="10" />
|
|
<br />
|
|
<h2>Rabais pour un nombre limite d'épreuves</h2>
|
|
<label for="rab_plus_moins_cher" class="form">S'applique aux: :</label>
|
|
<select id="rab_plus_moins_cher" name="rab_plus_moins_cher">
|
|
<option value="1" selected="selected">Moins chères</option>
|
|
<option value="2">Plus chères</option>
|
|
</select>
|
|
<br />
|
|
<label for="rab_nb_epr_diff2" class="form">Sur combien d'épreuves ? :</label>
|
|
<input type="text" id="rab_nb_epr_diff2" name="rab_nb_epr_diff2" value="0" size="2" maxlength="2" />
|
|
<br />
|
|
<label class="form"><span></span></label>
|
|
<button type="submit" id="btn_save" name="btn_save">Ajouter</button>
|
|
<br>
|
|
<label class="form"><span></span></label>
|
|
<p><a href="maj_rabais.php?p=<?php echo $_POST['txt_ajoute_par']; ?>">« retour</a></p>
|
|
<br>
|
|
</fieldset>
|
|
</form>
|
|
<?php
|
|
}
|
|
else { // ÉTAPE 1
|
|
if (empty($_GET['p']) && empty($_GET['batch'])) {
|
|
?>
|
|
<h1>Accès refusé !</h1>
|
|
<?php
|
|
} elseif (!empty($_GET['batch'])) {
|
|
fxShowBatchRabais($_GET['batch']);
|
|
} else {
|
|
?>
|
|
<script type="text/javascript">
|
|
$().ready(function () {
|
|
$("#frm_rabais").validate({
|
|
rules: {
|
|
sel_evenement: "required"
|
|
},
|
|
messages: {
|
|
sel_evenement: "Veuillez choisir un événement"
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<h1>Créer des codes rabais</h1>
|
|
<h2>Étape 1: Choisir l'événement</h2>
|
|
<form action="maj_rabais.php" method="post" id="frm_rabais" name="frm_rabais">
|
|
<fieldset>
|
|
<input type="hidden" id="txt_ajoute_par" name="txt_ajoute_par" value="<?php echo $_GET['p']; ?>" />
|
|
<label for="sel_evenement" class="form">Événement :</label>
|
|
<select id="sel_evenement" name="sel_evenement">
|
|
<option value="" selected="selected">-- Faites un choix --</option>
|
|
<?php
|
|
$tabEvenements = fxGetEvenementsRabais();
|
|
|
|
for ($intCtr = 1; $intCtr <= count($tabEvenements); $intCtr++) {
|
|
?>
|
|
<option value="<?php echo $tabEvenements[$intCtr]['eve_id']; ?>"><?php echo $tabEvenements[$intCtr]['eve_id'] . ' - ' . $tabEvenements[$intCtr]['eve_nom_fr']; ?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
<br />
|
|
<label class="form"><span></span></label>
|
|
<button type="submit" id="btn_next" name="btn_next">Suivant</button>
|
|
</fieldset>
|
|
</form>
|
|
<?php
|
|
}
|
|
}
|
|
} else {
|
|
echo '<h1>Accès refusé!</h1>';
|
|
}
|