fix groups selected and css changements for tags

This commit is contained in:
Marion Muszynski 2017-01-02 16:44:29 +01:00
parent 966dee6a6e
commit 23116193ed
2 changed files with 34 additions and 22 deletions

View File

@ -135,16 +135,16 @@ class AdminPrivateSalesSales extends AdminTab {
color: #ffffff;
}
.green {
background : #dffad3;
color: #88AF4D!important;
background : #C0E3B5;
color: #55b239!important;
font-weight:bold;
}
.red {
background : #f29b9b;
}
.rose {
background : #e36ea2;
color: rgba(255, 255, 255,0.7)!important;
background : rgba(226,110,162,0.2);
color: #e36ea2!important;
}
.table tr:nth-child(even) {
background: #F1F1F1;
@ -172,7 +172,9 @@ class AdminPrivateSalesSales extends AdminTab {
$categories = Db::getInstance()->ExecuteS('
SELECT c.`id_category`, l.`name`, l.`link_rewrite`
FROM `'._DB_PREFIX_.'category` c, `'._DB_PREFIX_.'category_lang` l
WHERE c.`id_category` = l.`id_category` AND l.`id_lang` = '.intval($cookie->id_lang).' AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').'
WHERE c.`id_category` = l.`id_category`
AND l.`id_lang` = '.intval($cookie->id_lang).'
AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').'
ORDER BY c.`id_category`
');
@ -548,11 +550,11 @@ class AdminPrivateSalesSales extends AdminTab {
'selected'=>false,
),
);
foreach($id_version_options as $version) {
if(isset($this->cursale->id) && in_array($version, $this->cursale->versions)){
foreach($id_version_options as &$version) {
if(isset($this->cursale->id) && in_array($version['value'], $this->cursale->versions)){
$version['selected'] = true;
}
if(!isset($this->cursale->id) && $version == 'fr') {
if(!isset($this->cursale->id) && $version['value'] == 'fr') {
$version['selected'] = true;
}
}
@ -941,9 +943,9 @@ class AdminPrivateSalesSales extends AdminTab {
<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>'.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').'</td>
<td align="center">'.(isset($sale_shipping[(int) $sale->id])? ($sale_shipping[(int) $sale->id] == 1? 'Philea': ''): '').'</td>
<td>'. $sale->forward_news .'</td>
<td align="center">'. $sale->forward_news .'</td>
<td align="center" class="position">';
if($key != 0){

View File

@ -186,30 +186,40 @@ class PrivateSales_Tags extends Module {
} else {
echo '<div class="form-group">
<label class="control-label">'.$this->l('Tags:').'</label>
<div class="">
<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:').'">';
<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>';
</div>';
// $(document).ready(function() {
// $("#m_tag").multiSelect({
// selectAllText: "'.$this->l('Select all').'",
// noneSelected: "&nbsp;",
// oneOrMoreSelected: "*"
// });
}
}