change input to select

This commit is contained in:
Marion Muszynski 2017-10-23 16:18:37 +02:00
parent 430de0c2e4
commit cdf4f68b74

View File

@ -530,6 +530,23 @@ class AdminPhileaMagistor extends AdminTab {
); );
} }
$id_non_philea_sales = array();
foreach(Db::getInstance()->ExecuteS('
SELECT p.`id_sale`, c.`name`, c.`id_category`
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `'._DB_PREFIX_.'category_lang` c ON (c.`id_category` = p.`id_category`)
WHERE c.`id_lang` = '.$cookie->id_lang.'
AND p.`id_sale` NOT IN ('.implode(',',$philea_sales).')
AND p.`date_start` > DATE_SUB(NOW(), INTERVAL 3 MONTH)
ORDER BY p.`id_sale` DESC
') as $row) {
$extrafields = Category::getSalesInfos(array((int) $row['id_category']));
$id_non_philea_sales[] = array(
'label' => (int) $row['id_sale'].' - '.$row['name'].(empty($extrafields[(int) $row['id_category']]['sales'][1])?'':' - '.$extrafields[(int) $row['id_category']]['sales'][1]) ,
'value' => (int) $row['id_sale']
);
}
$helperForm = new HelperFormBootstrap(); $helperForm = new HelperFormBootstrap();
$helperForm->_select2 = true; $helperForm->_select2 = true;
$helperForm->_inputMask = true; $helperForm->_inputMask = true;
@ -657,8 +674,12 @@ class AdminPhileaMagistor extends AdminTab {
<div class="pull-right"> <div class="pull-right">
<form class="form-inline" action="" method="post"> <form class="form-inline" action="" method="post">
<label>Ajouter une vente (non philéa) : </label> <label>Ajouter une vente (non philéa) : </label>
<input class="form-control input-sm" type="text" name="id_sale"/> <select class="form-control" id="id_no_philea_sale" name="id_sale">';
<input class="btn btn-primary btn-sm" type="submit" name="addNoPhileaSale" value="Add"/> foreach ($id_non_philea_sales as $key => $sale) {
$form.='<option value="'.$sale['value'].'">'.$sale['label'].'</option>';
}
$form .='</select>
<input class="btn btn-primary btn-sm" type="submit" name="addNoPhileaSale" value="Ajouter"/>
</form> </form>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
@ -860,6 +881,11 @@ class AdminPhileaMagistor extends AdminTab {
<script type="text/javascript"> <script type="text/javascript">
$("document").ready(function(){ $("document").ready(function(){
$("#id_no_philea_sale").select2({
placeholder: "",
allowClear: true
});
$(".see_more").click(function(){ $(".see_more").click(function(){
$(this).toggleClass("anticon-zoom-in"); $(this).toggleClass("anticon-zoom-in");
$(this).toggleClass("anticon-zoom-out"); $(this).toggleClass("anticon-zoom-out");