fix conflicts

This commit is contained in:
Marion Muszynski 2017-03-21 13:29:38 +01:00
commit 0aef5e434f
9 changed files with 931 additions and 572 deletions

View File

@ -11,6 +11,7 @@ require_once('../modules/privatesales_extrafields/privatesales_extrafields.php')
if (isset($_GET['getSales'])){
global $cookie;
$type = $_GET['type'];
if($type == 'finished'){
$sales = Sale::getSales(NULL, NULL, NULL, FALSE , FALSE, FALSE, '`position` DESC', NULL, NULL, FALSE, FALSE);
@ -25,12 +26,21 @@ if (isset($_GET['getSales'])){
$extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids);
$employees = array();
foreach(Db::getInstance()->ExecuteS('
SELECT `id_employee`, `firstname`, `lastname`
FROM `'._DB_PREFIX_.'employee`
') as $row) {
$employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname'];
}
foreach(Db::getInstance()->ExecuteS('
SELECT `id_employee`, `firstname`, `lastname`
FROM `'._DB_PREFIX_.'employee`
') as $row) {
$employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname'];
}
$sale_shipping = array();
foreach(Db::getInstance()->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'privatesale_shipping_sale`
WHERE 1
') as $ss) {
$sale_shipping[$ss['id_sale']] = $ss['id_shipping'];
}
echo "<thead><tr>
<th>ID</th>
@ -43,9 +53,9 @@ if (isset($_GET['getSales'])){
<th>Commercial</th>
<th>FR</th>
<th>ES</th>
<th align='center'>Delay</th>
<th>Shipping</th>
<th>Position</th>
<th style='width: 68px;'>Actions</th>
<th>Actions</th>
</tr></thead>
<tbody id='saleActive' class='sortable'>";
@ -58,43 +68,74 @@ if (isset($_GET['getSales'])){
<td><strong>'.$sale->title[intval($cookie->id_lang)].'</strong><br/><span style="color:#666; font-style:italic">'.$extrafields[$sale->id][1].'</span></td>
<td>'.$sale->date_start.'</td>
<td>'.$sale->date_end.'</td>
<td>'.($sale->enabled? '<img src="../img/admin/module_install.png"/>':'<img src="../img/admin/module_notinstall.png"/>').'</td>';
<td align="center">'.($sale->enabled? '<span class="anticon anticon-checkmark text-green-light"></span>':'<span class="anticon anticon-cross text-rose"></span>').'</td>';
if($sale->new == 0){
echo "<td>Non</td>";
echo "<td align='center'>Non</td>";
}
else if($sale->new == 1){
echo "<td>Oui</td>";
echo "<td align='center'>Oui</td>";
}
else if($sale->new == 3){
echo "<td>Non défini</td>";
echo "<td align='center'>Non défini</td>";
}
echo '<td>'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'</td>
<td '.(in_array('fr', $sale->versions) ? 'class="green"' : 'class="red"').'>FR</td>
<td '.(in_array('es', $sale->versions) ? 'class="green"' : 'class="red"').'>ES</td>
<td>'.$delay.'</td>
<td class="position">';
<td class="text-center '.(in_array('fr', $sale->versions) ? 'green' : 'rose').'">FR</td>
<td class="text-center '.(in_array('es', $sale->versions) ? 'green' : 'rose').'">ES</td>
<td align="center">'.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').'</td>
<td align="center" class="position">';
if($key != 0){
echo '<a href="" class="updatePosition" data-way="0" data-position='. $sale->position .'><img title="Haut" alt="Haut" src="../img/admin/up.gif"></a>';
echo '<a href="#" onclick="updatePositionVP(0,'. $sale->position .'); return false;" class="updatePosition" data-way="0" data-position='. $sale->position .'><img title="Haut" alt="Haut" src="../img/admin/up.gif"></a>';
}
if($key + 1 != count($sales)){
echo '<a href="" class="updatePosition" data-way="1" data-position='. $sale->position .'><img title="Bas" alt="Bas" src="../img/admin/down.gif"></a>';
echo ' <a href="#" class="updatePosition" onclick="updatePositionVP(1,'. $sale->position .'); return false;" data-way="1" data-position='. $sale->position .'><img title="Bas" alt="Bas" src="../img/admin/down.gif"></a>';
}
$category_link = Link::getCategoryLink($sale->id_category);
$category_link_bo = '?tab=AdminCatalog&viewcategory&id_category='.$sale->id_category.'&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee));
echo '</td>
<td>
'.($export? '<a onclick="window.open(this.href); return false;" href="'.__PS_BASE_URI__.'modules/exports/exports/privatesales.php?id_sale='.$sale->id.'&amp;adtoken='.Tools::encrypt('PrivateSalesDirectExtract'.$sale->id).'"><img style="cursor: pointer;" title="Exporter cette vente" alt="" src="../img/admin/export.gif"></a>': '').'
<img style="cursor: pointer;" onclick="itemEdition('.$sale->id.')" title="Éditer cette vente" alt="" src="../img/admin/edit.gif">
<img style="cursor: pointer;" onclick="itemDeletion('.$sale->id.')" title="Supprimer cette vente" alt="" src="../img/admin/delete.gif">
<a href="'.$category_link.'" target="_blank">
<img style="cursor: pointer;" title="Voir cette vente" alt="" src="../img/admin/details.gif">
</a>
<div class="input-group-btn" role="group">
<button class="btn btn-default" onclick="itemEdition('.$sale->id.')" title="Editer la vente">
<span class="anticon anticon-pencil2"></span>
</button>
<a href="'.$category_link.'" target="_blank" class="btn btn-default" title="Voir la vente sur le site">
<span class="anticon anticon-eye"></span>
</a>
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="anticon anticon-menu"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
'.($export? '
<li>
<a onclick="window.open(this.href); return false;" href="'.__PS_BASE_URI__.'modules/exports/exports/privatesales.php?id_sale='.$sale->id.'&amp;adtoken='.Tools::encrypt('PrivateSalesDirectExtract'.$sale->id).'">
<i class="glyphicon glyphicon-new-window"></i> Exporter
</a>
</li>':'').'
<li>
<a onclick="window.open(this.href); return false;" href="'.$category_link_bo.'">
<i class="glyphicon glyphicon-eye-open"></i> Voir Catégorie BO
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a style="cursor: pointer;" onclick="itemDeletion('.$sale->id.')">
<span class="anticon anticon-bin"></span> Supprimer
</a>
</li>
</ul>
</div>
</td>
</tr>
';
// '.($export? '<a onclick="window.open(this.href); return false;" href="'.__PS_BASE_URI__.'modules/exports/exports/privatesales.php?id_sale='.$sale->id.'&amp;adtoken='.Tools::encrypt('PrivateSalesDirectExtract'.$sale->id).'"><img style="cursor: pointer;" title="Exporter cette vente" alt="" src="../img/admin/export.gif"></a>': '').'
// <img style="cursor: pointer;" onclick="itemEdition('.$sale->id.')" title="Éditer cette vente" alt="" src="../img/admin/edit.gif">
// <img style="cursor: pointer;" onclick="itemDeletion('.$sale->id.')" title="Supprimer cette vente" alt="" src="../img/admin/delete.gif">
// <a href="'.$category_link.'" target="_blank">
// <img style="cursor: pointer;" title="Voir cette vente" alt="" src="../img/admin/details.gif">
// </a>
}
echo "</tbody>";
die();

View File

@ -167,7 +167,6 @@ class HelperFormBootstrap{
public function generateInput($input) {
$this->addInput($input);
$result = $this->_html;
$this->_html = '';
return $result;
@ -353,31 +352,74 @@ class HelperFormBootstrap{
}
public function inputSelect2($p = array()) {
$this->_html .='
$all_opt = array();
$this->_html .='
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
'.(isset($p['label'])?'<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : 'col-md-3 col-sm-3 col-xs-12').'">'.$p['label'].'</label>':'').'
'.(isset($p['label'])?'<label class="'.(isset($p['label-class']) ? $p['label-class'] : 'control-label col-md-3 col-sm-3 col-xs-12').'">'.$p['label'].'</label>':'').'
<div class="'.(isset($p['label'])?(isset($p['select-class']) ? $p['select-class'] :'col-md-9 col-sm-9 col-xs-12'):'').'">
<select class="form-control" name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" tabindex="-1">';
<select class="form-control" name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" '.((isset($p['multiple']) && $p['multiple'])?'multiple':'').' tabindex="-1">';
foreach($p['options'] as $opt) {
$selected = '';
if (
(isset($opt['selected']) && $opt['selected']) ||
(isset($this->_object) && $this->_object->{$p['name']} == $opt['value'])
)
) {
$selected = ' selected="selected"';
$this->_html .= '<option id="' . $p['name'] . '_' . $opt['value'] . '" value="' . $opt['value'] . '"'. $selected .'>'.$opt['label'].'</option>';
}
$disabled = '';
if (isset($opt['disabled']) && $opt['disabled']) {
$disabled = ' disabled="disabled"';
}
$this->_html .= '<option id="' . $p['name'] . '_' . $opt['value'] . '" value="' . $opt['value'] . '"'. $selected .' '.$disabled.'>'.$opt['label'].'</option>';
$all_opt[] = $opt['value'];
}
$this->_html .='</select>
</div>
</div>
<script>
$(document).ready(function() {
$("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2({
placeholder: "'.(isset($p['placeholder'])?$p['placeholder']:'').'",
allowClear: true
$this->_html .='</select>';
if((isset($p['option_all']) && $p['option_all']) || (isset($p['option_clear']) && $p['option_clear'])) {
$this->_html .='
<div class="btn-group btn-group-sm" role="group">
'.((isset($p['option_all']) && $p['option_all'])?'<button type="button" class="select_all_for_'.(isset($p['id']) ? $p['id'] : $p['name']).' btn btn-default">Tout</button>':'').'
'.((isset($p['option_clear']) && $p['option_clear'])?'<button type="button" class="clear_for_'.(isset($p['id']) ? $p['id'] : $p['name']).' btn btn-default">Clear</button>':'');
if(isset($p['buttons']) && is_array($p['buttons'])){
foreach ($p['buttons'] as $button) {
$this->_html .='<button type="button" class="'.$button['class'].(isset($p['id']) ? $p['id'] : $p['name']).' btn btn-default">'.$button['label'].'</button>';
}
}
$this->_html .='
</div>';
}
$this->_html .='</div>
</div>';
if(isset($p['multiple']) && $p['multiple']){
$this->_html .='<script>
$(document).ready(function() {
$("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2({
maximumSelectionLength: '.count($p['options']).',
placeholder: "'.(isset($p['placeholder'])?$p['placeholder']:'').'",
allowClear: true
});
'.((isset($p['option_all']) && $p['option_all'])?'$(".select_all_for_'.(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(["'.(implode('","',$all_opt)).'"]).trigger("change"); });':'').'
'.((isset($p['option_clear']) && $p['option_clear'])?'$(".clear_for_'.(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(null).trigger("change"); });':'');
if(isset($p['buttons']) && is_array($p['buttons'])){
foreach ($p['buttons'] as $button) {
$this->_html .='$(".'.$button['class'].(isset($p['id']) ? $p['id'] : $p['name']).'").on("click", function () { $("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2().val(['.$button['value'].']).trigger("change"); });';
}
}
$this->_html .='
});
</script>';
} else {
$this->_html .='<script>
$(document).ready(function() {
$("#'.(isset($p['id']) ? $p['id'] : $p['name']).'").select2({
placeholder: "'.(isset($p['placeholder'])?$p['placeholder']:'').'",
allowClear: true
});
});
});
</script>';
</script>';
}
}
public function inputUploadImage($p = array()) {
@ -437,11 +479,11 @@ class HelperFormBootstrap{
});
$(\'#'.$p['id'].' .image-preview-clear\').click(function(){
$(\'#'.$p['id'].'\').attr("data-content","").popover(\'hide\');
$(\'#'.$p['id'].' .image-preview-filename\').val("");
$(\'#'.$p['id'].' .image-preview-clear\').hide();
$(\'#'.$p['id'].' .image-preview-input input:file\').val("");
$("#'.$p['id'].' .image-preview-input-title").text("Ouvrir");
$(\'.image-preview\').attr("data-content","").popover(\'hide\');
$(\'.image-preview-filename\').val("");
$(\'.image-preview-clear\').hide();
$(\'.image-preview-input input:file\').val("");
$(".image-preview-input-title").text("Browse");
});
// Create the preview image
$("#'.$p['id'].' .image-preview-input input:file").change(function (){
@ -587,6 +629,7 @@ class HelperFormBootstrap{
}
$default_value = (isset($p['default']) ? $p['default'] : '');
$disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : '');
$this->_html .= '
<div class="form-group '.(isset($p['class-group'])?$p['class-group']:'').'">
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">'.$p['label']. ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '</label>
@ -622,6 +665,35 @@ class HelperFormBootstrap{
</div>';
}
public function inputTextarea($p = array()){
if (isset($p['lang']) && $p['lang'] === true) {
return $this->inputTextareaL($p);
}
}
public function inputTextareaL($p = array()){
$default_value = (isset($p['default']) ? $p['default'] : '');
$defaultLanguage = $p['default_language'] ? $p['default_language'] : 2;
$this->_html .= '
<div class="form-group">
<label class="control-label '.(isset($p['label-class']) ? $p['label-class'] : '').'">
<span class="pull-left">'.$p['label'].'</span>
'.$this->displayFlags($p['languages'], $defaultLanguage, $p['id_langs'], $p['name'],true,false,$p['link_flag_img']).'
<div class="clearfix"></div>
</label>
<div class="'.(isset($p['input-class']) ? $p['input-class'] : '').'">';
foreach ($p['languages'] as $language) {
$default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value;
$this->_html .= '
<div>
<textarea class="form-control" rows="3" name="'.$p['name'].'_'.$language['id_lang'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';'.(isset($p['css']) ? $p['css'].'"' : '').'">'.str_replace('\r\n', "\n", ($this->_object ? $this->_object->{$p['name']}[(int)$language['id_lang']] : $default_lang)).'</textarea>
</div>';
}
$this->_html .= '<div class="clearfix"></div>
</div>
</div>';
}
public function inputFile($p = array()){
$this->_html .= '
<div class="form-group ' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">

View File

@ -158,6 +158,10 @@ form label{
.panel-toolbox>li>a:hover {
background: #F5F7FA;
}
.panel_toolbox>li {
float: left;
cursor: pointer;
}
.panel-content {
padding: 0 5px;
position: relative;
@ -289,8 +293,8 @@ div.tagsinput span.tag a {
opacity: 0.6;
}
/* form */
.form-control {
/* form img */
.form-control.image-preview-filename {
height: 28px;
line-height: 28px;
}
@ -320,6 +324,8 @@ div.tagsinput span.tag a {
.image-preview-input-title {
margin-left:2px;
}
/* switch */
.checkbox.input-switch label, .radio.input-switch label {
padding-left: 0px;
width: auto;
@ -343,6 +349,15 @@ textarea {
padding:0;
}
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 5px;
color: #737373;
font-size: 11px;
font-style: italic;
}
/* table */
table.table-custombordered {
border: 1px solid rgba(221,221,221,0.78);
@ -360,10 +375,40 @@ table.table tr th {
.select2-results ul li{
text-align: left;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice{
border: 1px solid #504d8b;
background: #796dc7;
color: #fff;
padding: 3px;
border-radius: 2px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{
color: #fff;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
font-size: 12px;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #504d8b;
color: white;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice{
margin-top: 2px;
margin-bottom: 2px;
}
/* Language choice box */
.flags_custom{
float: left;
position: relative;
}
.language_flags.language_flags_custom{
position: absolute;
z-index: 999;
margin: 0;
width: 120px;
right: 0;
}
/* Smart Wizar */
.form_wizard .stepContainer {
@ -449,4 +494,4 @@ table.table tr th {
.form_wizard .loader {
display: none; }
.form_wizard .msgBox {
display: none; }
display: none; }

View File

@ -1,8 +1,20 @@
$(function() {
/* Switch */
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
elems.forEach(function(html) {
var switchery = new Switchery(html, { size: 'small', color: '#504d8b' });
});
});
});
function changeLang(field, fieldsString, id_language_new, iso_code, display)
{
var fields = fieldsString.split('¤');
for (var i = 0; i < fields.length; ++i)
{
getE(fields[i] + '_' + id_language).style.display = 'none';
getE(fields[i] + '_' + id_language_new).style.display = display;
getE('language_current_' + fields[i]).src = '../img/l/' + id_language_new + '.jpg';
}
getE('languages_' + field).style.display = 'none';
id_language = id_language_new;
}

View File

@ -578,6 +578,7 @@ class AdminLabelGenerate extends AdminTab {
$this->_html .= $helperForm->renderScript();
$this->_html .= $helperForm->renderScript();
echo $this->_html;
}

File diff suppressed because it is too large Load Diff

View File

@ -186,9 +186,9 @@ class PrivateSales_ExtraFields extends Module {
SELECT *
FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` s
WHERE s.`id_sale` = '.(int) $params['sale']->id.'
') as $value) {
') as $value) {
if($fields_values[$value['id_field']] === NULL) {
if($fields_values[$value['id_field']] === NULL) {
$fields_values[$value['id_field']] = array();
}
$fields_values[$value['id_field']][$value['id_lang']] = $value['value'];
@ -201,38 +201,45 @@ class PrivateSales_ExtraFields extends Module {
// SELECT *
// FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` s
// WHERE s.`id_sale` = '.(int) $params['sale']->id.'
// ') as $value) {
// ') as $value) {
// if($fields_values[$value['id_field']] === NULL) {
// if($fields_values[$value['id_field']] === NULL) {
// $fields_values[$value['id_field']] = array();
// }
// $fields_values[$value['id_field']][$value['id_lang']] = $value['value'];
// }
$imgs = array('thumb','liston','listoff','fb','salebg','trailerbg','trailercenter');
$images = array();
foreach($imgs as $img) {
$images[] = 'img_'.$img;
}
$divLangName = array();
foreach($fields as $field) {
$divLangName[] = 'm_extrafields_'.$field['id_field'].'_value';
}
$divLangName = implode('¤', $divLangName);
$divLangName = implode('¤', $divLangName).'¤description¤video¤'.implode('¤', $images);
foreach($fields as $field) {
echo '<label>'.$field['name'].'</label>
<div class="margin-form">';
echo '<div class="form-group">
<label class="control-label" >'.$field['name'].'</label>
<div class="">';
foreach($this->_languages as $language) {
echo '<div id="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">';
if($field['type'] == 1) {
echo '<textarea style="width: 500px; height: 150px;" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'">'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'</textarea>';
echo '<textarea class="form-control" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'">'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'</textarea>';
} else {
echo '<input type="text" style="width: 500px;" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'" value="'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'" />';
echo '<input type="text" class="form-control" name="m_extrafields_'.$field['id_field'].'_value_'.$language['id_lang'].'" value="'.Tools::safeOutput($fields_values[$field['id_field']][$language['id_lang']], TRUE).'" />';
}
echo '
</div>';
}
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'm_extrafields_'.$field['id_field'].'_value');
echo '<div class="clear"></div>
</div>
</div>';
}
}
@ -272,7 +279,7 @@ class PrivateSales_ExtraFields extends Module {
public function hookPrivateSales_Listing($params) {
global $cookie;
$ids = array();
if(isset($params['sales'])){
foreach($params['sales'] as $sale) {
@ -286,7 +293,7 @@ class PrivateSales_ExtraFields extends Module {
}
if(isset($params['futuresales'])){
foreach($params['futuresales'] as $sale) {
$ids[] = $sale->id;
$ids[] = $sale->id;
}
}
@ -315,7 +322,7 @@ class PrivateSales_ExtraFields extends Module {
{
global $cookie;
$result = array();
foreach (Db::getInstance()->ExecuteS('
SELECT f.`blank`, l.`name`, l.`format`, s.`value`, s.`id_sale`, f.id_field
FROM `'._DB_PREFIX_.'privatesale_extrafield` f
@ -331,5 +338,5 @@ class PrivateSales_ExtraFields extends Module {
}
return $result;
}
}

View File

@ -180,19 +180,20 @@ class PrivateSales_Shipping extends Module {
<div class="clear"></div>
</div>';
} else {
echo '
<label>'.$this->l('Shipping:').'</label>
<div class="margin-form">
echo '<div class="form-group">
<label class="control-label">'.$this->l('Shipping:').'</label>
<div class="">
<div id="tags" style="float: left;">
<select id="s_shipping" name="s_shipping">
<option value=""></option>';
<select class="form-control" id="s_shipping" name="s_shipping">
<option value="">Choisir un expediteur</option>';
foreach($shipping as $ship) {
echo '<option value="'.$ship['id_shipping'].'"'.(isset($ship['id_shipping']) && $ship['id_sale'] !== NULL?' selected="selected"':'').'>'.$ship['value'].'</option>';
echo '<option value="'.$ship['id_shipping'].'"'.(isset($ship['id_shipping']) && (isset($ship['id_sale']) && $ship['id_sale'] !== NULL)?' selected="selected"':'').'>'.$ship['value'].'</option>';
}
echo '
</select>
</div>
<div class="clear"></div>
</div>
</div>';
}
}

View File

@ -184,31 +184,42 @@ class PrivateSales_Tags extends Module {
<div class="clear"></div>
</div>';
} else {
echo '
<label>'.$this->l('Tags:').'</label>
<div class="margin-form">
<div id="tags" style="float: left;">
<select id="m_tag" name="m_tag[]" multiple="multiple" size="5">
<option value=""></option>
<optgroup label="'.$this->l('Select one or more tags:').'">';
echo '<div class="form-group">
<label class="control-label">'.$this->l('Tags:').'</label>
<div class="">
<select id="m_tag" name="m_tag[]" multiple="multiple" size="5" class="form-control">';
$all_opt = array();
foreach($tags as $tag) {
$all_opt[] = $tag['id_tag'];
echo '<option value="'.$tag['id_tag'].'"'.(isset($tag['id_sale']) && $tag['id_sale'] !== NULL?' selected="selected"':'').'>'.$tag['value'].'</option>';
}
echo '
</optgroup>
</select>
</div>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="select_all_for_m_tag btn btn-default">Tout</button>
<button type="button" class="clear_for_m_tag btn btn-default">Clear</button>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#m_tag").multiSelect({
selectAllText: "'.$this->l('Select all').'",
noneSelected: "&nbsp;",
oneOrMoreSelected: "*"
});
$("#m_tag").select2({
maximumSelectionLength: '.count($tags).',
placeholder: "'.$this->l('Select one or more tags:').'",
allowClear: true
});
$(".select_all_for_m_tag").on("click", function () { $("#m_tag").select2().val(["'.(implode('","',$all_opt)).'"]).trigger("change"); });
$(".clear_for_m_tag").on("click", function () { $("#m_tag").select2().val(null).trigger("change"); });
});
</script>
<div class="clear"></div>
</div>';
</div>';
// $(document).ready(function() {
// $("#m_tag").multiSelect({
// selectAllText: "'.$this->l('Select all').'",
// noneSelected: "&nbsp;",
// oneOrMoreSelected: "*"
// });
}
}