update css labelgenerate before updating size of label

This commit is contained in:
Marion Muszynski 2017-01-27 15:16:30 +01:00
parent 6d4ccad85f
commit 8a2af96f1e
2 changed files with 184 additions and 90 deletions

View File

@ -160,7 +160,7 @@ class HelperFormBootstrap{
}
}
public static function generateInput($input) {
public function generateInput($input) {
$this->addInput($input);
$result = $this->_html;

View File

@ -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 .= '<fieldset>
<legend>'.$this->l('Sale selection').'</legend>
<div class="" style="text-align:center;">
<label for="id_sale" style="display: inline; float: none; width: auto;">'.$this->l('Select a sale:').'</label><br/><br class="clear"/>
<select class="chosen-select" id="id_sale" name="id_sale">
<option value=""></option>
';
foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC', 500) as $sale) {
$this->_html .= '<option value="'.(int) $sale->id.'"'.($sale->id == $current_sale? ' selected="selected"': '').'>'.$sale->id.' - '.$sale->title[(int) $cookie->id_lang].'</option>';
}
$this->_html .= '
</select>
<br class="clear"/>
<br class="clear"/>
<div style="text-align:center">
<button class="button" id="generateRef" style="display:inline-block">Générer les Ref pour tous les produits vendus</button>
</div>
<br class="clear"/>
<div style="text-align:center">
<button class="button" id="generateEAN" style="display:inline-block">Générer les EANs pour produits vendus</button>
</div>
<br class="clear"/>
<div style="text-align:center">
<button class="button" id="generateALLEAN" style="display:inline-block">Générer les EANs pour tous les produits d\'une vente</button>
</div>
<br class="clear"/>
<div style="text-align:center">
<button class="button" id="deleteEAN" style="display:inline-block">Supprimer les EANs</button>
</div>
$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 .= '<div class="panel">
<div class="panel-title">
<h2><span class="anticon anticon-barcode"></span> '.$this->l('Génération EAN').'</h2>
<div class="clearfix"></div>
</div>
</fieldset>
<br /><br />';
/*$this->_html .='<fieldset>
<legend>'.$this->l('Rack barcode').'</legend>
<div class="margin-form">
<button class="button" id="generateRack">'.$this->l('Generate rack').'</button>
</div>
</fieldset>
<br /><br />';*/
<div class="panel-content">
<div class="col-md-5 col-md-offset-3">';
$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).'
<div class="clearfix"></div>
</div>
<div class="clear"></div>
<div class="ln_solid-small"></div>
<div class="text-center">
<button class="btn btn-primary" id="generateRef" style="display:inline-block">Générer Refs (vendus)</button>
<button class="btn btn-primary" id="generateEAN" style="display:inline-block">Générer EANs (vendus)</button>
<button class="btn btn-primary" id="generateALLEAN" style="display:inline-block">Générer EANs (tous)</button>
<button class="btn btn-default" id="deleteEAN" style="display:inline-block">Supprimer les EANs</button>
<button class="hidden btn btn-default" id="generateRack" style="display:inline-block">Générer Rack</button>
</div>
</div>';
$this->_html.= '<link type="text/css" rel="stylesheet" href="'._MODULE_DIR_.'bulkupdate/chosen.min.css" />';
$this->_html.= '<style>.chosen-drop{text-align:left;}</style>';
$this->_html.= '<script type="text/javascript" src="'._MODULE_DIR_.'bulkupdate/chosen.jquery.min.js"></script>';
$this->_html.= '<script type="text/javascript">
$(function() {
$(".chosen-select").chosen(
{
allow_single_deselect:true,
placeholder_text_single : "Choisir une vente",
no_results_text : "Aucun résultat",
enable_split_word_search : true,
search_contains : true,
}
);
$(".chosen-select").chosen().change( function() {});
$("#generateEAN").click(function(){
if ($(".chosen-select").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateEAN=1&id_sale=\' + $(".chosen-select").val();
}
});
$("#generateRef").click(function(){
if ($(".chosen-select").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateRef=1&id_sale=\' + $(".chosen-select").val();
}
});
$("#generateALLEAN").click(function(){
if ($(".chosen-select").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateALLEAN=1&id_sale=\' + $(".chosen-select").val();
}
});
$("#deleteEAN").click(function(){
ok = confirm("Êtes vous sur de vouloir supprimer les eans de cette vente ?")
if (ok == true){
if ($(".chosen-select").val() != 999999) {
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&deleteEAN=1&id_sale=\' + $(".chosen-select").val();
}
}
});
$("#generateRack").click(function(){
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&rack=1\';
});
$helperForm->_js .='<script type="text/javascript">
$(function() {
$("#generateEAN").click(function(){
if ($("#id_sale").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateEAN=1&id_sale=\' + $("#id_sale").val();
}
});
</script>';
$("#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\';
});
});
</script>';
$this->_html .= $helperForm->renderScript();
// $this->_html .= '<fieldset>
// <legend>'.$this->l('Sale selection').'</legend>
// <div class="" style="text-align:center;">
// <label for="id_sale" style="display: inline; float: none; width: auto;">'.$this->l('Select a sale:').'</label><br/><br class="clear"/>
// <select class="chosen-select" id="id_sale" name="id_sale">
// <option value=""></option>
// ';
// foreach(Sale::getSales(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC', 500) as $sale) {
// $this->_html .= '<option value="'.(int) $sale->id.'"'.($sale->id == $current_sale? ' selected="selected"': '').'>'.$sale->id.' - '.$sale->title[(int) $cookie->id_lang].'</option>';
// }
// $this->_html .= '
// </select>
// <br class="clear"/>
// <br class="clear"/>
// <div style="text-align:center">
// <button class="button" id="generateRef" style="display:inline-block">Générer les Ref pour tous les produits vendus</button>
// </div>
// <br class="clear"/>
// <div style="text-align:center">
// <button class="button" id="generateEAN" style="display:inline-block">Générer les EANs pour produits vendus</button>
// </div>
// <br class="clear"/>
// <div style="text-align:center">
// <button class="button" id="generateALLEAN" style="display:inline-block">Générer les EANs pour tous les produits d\'une vente</button>
// </div>
// <br class="clear"/>
// <div style="text-align:center">
// <button class="button" id="deleteEAN" style="display:inline-block">Supprimer les EANs</button>
// </div>
// </div>
// </fieldset>
// <br /><br />';
// /*$this->_html .='<fieldset>
// <legend>'.$this->l('Rack barcode').'</legend>
// <div class="margin-form">
// <button class="button" id="generateRack">'.$this->l('Generate rack').'</button>
// </div>
// </fieldset>
// <br /><br />';*/
// $this->_html.= '<link type="text/css" rel="stylesheet" href="'._MODULE_DIR_.'bulkupdate/chosen.min.css" />';
// $this->_html.= '<style>.chosen-drop{text-align:left;}</style>';
// $this->_html.= '<script type="text/javascript" src="'._MODULE_DIR_.'bulkupdate/chosen.jquery.min.js"></script>';
// $this->_html.= '<script type="text/javascript">
// $(function() {
// $(".chosen-select").chosen(
// {
// allow_single_deselect:true,
// placeholder_text_single : "Choisir une vente",
// no_results_text : "Aucun résultat",
// enable_split_word_search : true,
// search_contains : true,
// }
// );
// $(".chosen-select").chosen().change( function() {});
// $("#generateEAN").click(function(){
// if ($(".chosen-select").val() != 999999) {
// $(\'#category_selector\').hide();
// document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateEAN=1&id_sale=\' + $(".chosen-select").val();
// }
// });
// $("#generateRef").click(function(){
// if ($(".chosen-select").val() != 999999) {
// $(\'#category_selector\').hide();
// document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateRef=1&id_sale=\' + $(".chosen-select").val();
// }
// });
// $("#generateALLEAN").click(function(){
// if ($(".chosen-select").val() != 999999) {
// $(\'#category_selector\').hide();
// document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateALLEAN=1&id_sale=\' + $(".chosen-select").val();
// }
// });
// $("#deleteEAN").click(function(){
// ok = confirm("Êtes vous sur de vouloir supprimer les eans de cette vente ?")
// if (ok == true){
// if ($(".chosen-select").val() != 999999) {
// document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&deleteEAN=1&id_sale=\' + $(".chosen-select").val();
// }
// }
// });
// $("#generateRack").click(function(){
// document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&rack=1\';
// });
// });
// </script>';
echo $this->_html;