fix conflicts

This commit is contained in:
Marion Muszynski 2017-01-05 11:14:54 +01:00
commit e93de310ec

View File

@ -195,6 +195,17 @@ class AdminPrivateSalesSales extends AdminTab {
.button.purple:focus{
background-color: rgba(86,84,133,1.6);
}
#delivery_mode{
margin-bottom:5px;
}
.carriers_info{
background:#fff;
padding:10px;
border: 1px solid #ccc;
}
.carriers_hidden{
display:none;
}
</style>
<form action="'.$currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales').'" method="post" enctype="multipart/form-data">
<fieldset>
@ -453,34 +464,73 @@ class AdminPrivateSalesSales extends AdminTab {
WHERE c.`deleted` != 1
');
$carriers_default = array(22, 87, 88, 89); // prod
// $carriers_default = array(22, 46, 47, 48); // dev
// $carriers_default = array(87, 88, 89); // prod
$carriers_default = array(45, 47, 48); // dev
echo '<label>'.$this->l('Carriers:').'</label>
<div class="margin-form">
<div id="carriers" style="float: left;">
<select id="m_carriers" name="m_groups[]" multiple="multiple" size="5">
<option value=""></option>
<optgroup label="'.$this->l('Select one or more carriers:').'">';
if( Tools::getIsset('edit')) {
foreach($carriers as $carrier) {
echo '<option value="'.$carrier['id_carrier'].'"'.(isset($carrier['id_sale']) && $carrier['id_sale'] !== NULL?' selected="selected"':'').'>'.$carrier['name'].'</option>';
}
} else{
foreach($carriers as $carrier) {
echo '<option value="'.$carrier['id_carrier'].'"'.(in_array($carrier['id_carrier'], $carriers_default) ? ' selected="selected"':'').'>'.$carrier['name'].'</option>';
}
<select id="delivery_mode" name="delivery_mode" >
<option value="0">'.$this->l('Select Expedition').'</option>
<option value="1">'.$this->l('Expédition classique').'</option>
<option value="2">'.$this->l('Expédition domicile uniquement').'</option>
<option value="3">'.$this->l('Expédition dropshipping').'</option>
</select>
<div class="carriers_info" '.(($cookie->id_employee == 1)?'':'style="display:none;"').'>
<h3>'.$this->l('Transporteurs selectionnés : ').'</h3>
<div class="info"></div>
</div>
<div class="carriers_hidden">';
if(Tools::getIsset('edit')) {
foreach($carriers as $carrier) {
echo '<input name="m_carriers[]" type="checkbox" value="'.$carrier['id_carrier'].'"'.(isset($carrier['id_sale']) && $carrier['id_sale'] !== NULL? ' checked="checked"':'').' data-carrier-name="'.$carrier['name'].'"/>';
}
echo '
</optgroup>
</select>
</div>
} else {
foreach($carriers as $carrier) {
echo '<input name="m_carriers[]" type="checkbox" value="'.$carrier['id_carrier'].'"'.(in_array($carrier['id_carrier'], $carriers_default) ? ' checked="checked"':'').' data-carrier-name="'.$carrier['name'].'"/>';
}
}
echo '</div></div>
<script type="text/javascript">
$(document).ready(function() {
$("#m_carriers").multiSelect({
selectAllText: "'.$this->l('Select all').'",
noneSelected: "&nbsp;",
oneOrMoreSelected: "*"
var carriers_selected = [];
var carriers_info = "";
$("input[name=\'m_carriers[]\']:checked").each(function(i, el) {
carriers_info += "<p>"+$(el).data("carrier-name")+"</p>";
carriers_selected.push($(el).val());
});
$(".carriers_info div.info").html(carriers_info);
console.log($.inArray("45",carriers_selected));
if ($.inArray("45",carriers_selected)!= -1 && $.inArray("47",carriers_selected)!= -1 && $.inArray("48",carriers_selected)!= -1) {
$("#delivery_mode option[value=\'1\']").attr("selected","selected");
} else if ($.inArray("45",carriers_selected)!= -1) {
console.log("test");
$("#delivery_mode option[value=\'2\']").attr("selected","selected");
} else if ($.inArray("22",carriers_selected)!= -1) {
$("#delivery_mode option[value=\'3\']").attr("selected","selected");
}
$("#delivery_mode").change(function(){
carriers_info = "";
$("input[name=\'m_carriers[]\']").each(function(i, el) {
$(el).attr("checked",false);
});
var selected_carriers = [];
if($(this).val() == 1) {
selected_carriers = ["45", "47", "48"];
} else if($(this).val() == 2) {
selected_carriers = ["45"];
} else if($(this).val() == 3) {
selected_carriers = ["22"];
}
$("input[name=\'m_carriers[]\']").each(function(){
if ($.inArray($(this).val(),selected_carriers) != -1){
$(this).attr("checked",true);
carriers_info += "<p>"+$(this).data("carrier-name")+"</p>";
}
});
$(".carriers_info div.info").empty();
$(".carriers_info div.info").html(carriers_info);
});
});
</script>
@ -628,7 +678,8 @@ class AdminPrivateSalesSales extends AdminTab {
$(this).addClass('active');
$('.list_vente').empty();
var loader = "<p style='text-align:center'><img style='margin:0 auto;' src='../img/loader_payment.gif' /></p>";
var loader = "<p style='text-align:center'><img src='../img/loader_payment.gif' /></p>";
$('.list_vente').html(loader);
$.ajax({
@ -728,7 +779,7 @@ class AdminPrivateSalesSales extends AdminTab {
';
echo '<fieldset class="space bg-grey">
echo '<fieldset class="space bg-grey">
<legend><img src="'.__PS_BASE_URI__.'modules/privatesales/prefs.gif" alt="" title="" /> '.$this->l('Sales list').'</legend>
<table class="table list_vente" style="width: 100%;">
<thead>