diff --git a/adm/helpers/HelperFormBootstrap.php b/adm/helpers/HelperFormBootstrap.php index 4c636151..65e82821 100644 --- a/adm/helpers/HelperFormBootstrap.php +++ b/adm/helpers/HelperFormBootstrap.php @@ -160,7 +160,7 @@ class HelperFormBootstrap{ } } - public static function generateInput($input) { + public function generateInput($input) { $this->addInput($input); $result = $this->_html; diff --git a/modules/labelgenerate/AdminLabelGenerate.php b/modules/labelgenerate/AdminLabelGenerate.php index 5054245e..746bef7f 100644 --- a/modules/labelgenerate/AdminLabelGenerate.php +++ b/modules/labelgenerate/AdminLabelGenerate.php @@ -5,6 +5,7 @@ if(!defined('_PS_VERSION_')) { require_once dirname(__FILE__).'/../privatesales/Sale.php'; require_once dirname(__FILE__).'/models/generatebarcode.php'; +require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php'); class AdminLabelGenerate extends AdminTab { @@ -309,102 +310,195 @@ class AdminLabelGenerate extends AdminTab { } } - $this->_html .= '
- '.$this->l('Sale selection').' -
-

- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
+ $helperForm = new HelperFormBootstrap(); + $helperForm->_select2 = true; + + $id_sale_options = array(); + foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC', 500) as $sale) { + + + $id_sale_options[(int)$sale->id] = array( + 'label' => $sale->id.' - '.$sale->title[(int) $cookie->id_lang], + 'value' => (int) $sale->id + ); + if($sale->id == $current_sale) { + $id_sale_options[(int)$sale->id]['selected'] = true; + } + } + + $this->_html .= $helperForm->renderStyle(); + + $this->_html .= '
+
+

'.$this->l('Génération EAN').'

+
-
-

'; - /*$this->_html .='
- '.$this->l('Rack barcode').' -
- -
-
-

';*/ +
+
'; + $input = array( + 'type' => 'select2', + 'label' => $this->l('Select a sale:'), + 'label-class' => 'text-left', + 'select-class' => 'text-left', + 'name' => 'id_sale', + 'id' => 'id_sale', + 'options' => $id_sale_options, + ); + $this->_html .= $helperForm->generateInput($input).' +
+
+
+
+
+ + + + + +
+
'; - $this->_html.= ''; - $this->_html.= ''; - $this->_html.= ''; - $this->_html.= ''; + $("#generateRef").click(function(){ + if ($("#id_sale").val() != 999999) { + $(\'#category_selector\').hide(); + document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateRef=1&id_sale=\' + $("#id_sale").val(); + } + }); + + $("#generateALLEAN").click(function(){ + if ($("#id_sale").val() != 999999) { + $(\'#category_selector\').hide(); + document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateALLEAN=1&id_sale=\' + $("#id_sale").val(); + } + }); + + $("#deleteEAN").click(function(){ + ok = confirm("Êtes vous sur de vouloir supprimer les eans de cette vente ?") + if (ok == true){ + if ($("#id_sale").val() != 999999) { + document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&deleteEAN=1&id_sale=\' + $("#id_sale").val(); + } + } + }); + + $("#generateRack").click(function(){ + document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&rack=1\'; + }); + + }); + '; + + + $this->_html .= $helperForm->renderScript(); + + // $this->_html .= '
+ // '.$this->l('Sale selection').' + //
+ //

+ // + //
+ //
+ //
+ // + //
+ //
+ //
+ // + //
+ //
+ //
+ // + //
+ //
+ //
+ // + //
+ //
+ //
+ //

'; + + // /*$this->_html .='
+ // '.$this->l('Rack barcode').' + //
+ // + //
+ //
+ //

';*/ + + + // $this->_html.= ''; + // $this->_html.= ''; + // $this->_html.= ''; + // $this->_html.= ''; echo $this->_html;