Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
Christophe Latour 2017-08-24 10:58:40 +02:00
commit 5d179855db
3 changed files with 143 additions and 73 deletions

View File

@ -103,12 +103,13 @@ if($cookie->isLoggedBack() && $cart = Tools::getValue('id_cart')) {
var isocode = "'.$address['MR_Selected_Pays'].'";
var postcode = "'.$address['MR_Selected_CP'].'";
var mode = "24R";
var weight = '.(int)$weight.';
var weight = '.(int)($weight * 1000).';
if( weight == 0 ) weight = 100;
var t;
$(document).ready(function () {
$("#Zone_Widget").MR_ParcelShopPicker({
UseSSL : true,
Weight: weight,
Target: "#Target_Widget",
TargetDisplay: "#TargetDisplay_Widget",
TargetDisplayInfoPR: "#TargetDisplayInfoPR_Widget",

View File

@ -2,7 +2,7 @@
if(!defined('_PS_VERSION_')) {
exit;
}
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
include _PS_ROOT_DIR_.'/modules/privatesales/Sale.php';
@ -100,105 +100,155 @@ class AdminLogisticsPending extends AdminTab {
$sales_info[(int)$row['id_sale']]['orders'][(int)$row['id_order']]['products'][] = $p;
}
echo '<style>
$helper = new HelperFormBootstrap();
$helper->_css .= '
<style>
.table tr th{
background: #F4E6C9 url(../adm/themes/origins_lite/news-bg.gif) repeat-x top left;
padding: 4px 6px;
}
.table > tbody > tr > td{
vertical-align: middle;
}
.table .table{
margin-bottom:0px;
}
.table tr td.product_name {
box-sizing: border-box;
width: 500px;
}
.table .tr-order{
background-color: #1ABB9C;
}
.table tr.tr-order td,
.table tr.tr-order td a{
color:#fff;
}
</style>';
echo '<script>
$helper->_js .= '
<script>
function check_all(element)
{
$(\'#\'+element+\' input\').each(function(){
if ($(\'#all_\'+element).is(\':checked\')) {
$(this).attr(\'checked\',\'checked\');
if(!$(this).is(\':checked\')){
$(this).prop(\'checked\', true);
}
} else {
$(this).attr(\'checked\',\'\');
if($(this).is(\':checked\')){
$(this).removeAttr(\'checked\');
}
}
});
}
function toggleText(element, target){
$(target).slideToggle();
if ($(element).hasClass(\'toggle-more\')) {
$(element).removeClass(\'toggle-more\');
$(element).text(\'+\');
$(element).parent(\'tr\').css(\'background-color\',\'#fff\');
$(element).parent(\'tr\').children(\'td\').css(\'color\',\'#000\');
} else {
$(element).addClass(\'toggle-more\');
$(element).text(\'-\');
$(element).parent(\'tr\').css(\'background-color\',\'#FFA74E\');
$(element).parent(\'tr\').children(\'td\').css(\'color\',\'#fff\');
}
$(target).slideToggle();
}
</script>';
echo '<h2>'.$this->l('Commandes en attente avec produits retenus').' '.(!empty($distinct_orders)?'('.count($distinct_orders).')':'').'</h2>';
echo '<h3>'.$this->l('Commandes en attente').' ('.$total_pending_orders.')</h3>';
$html = $helper->renderStyle();
$html .= '
<div class="row">
<div class="col-md-12">
<div class="panel">
<div class="panel-title">
<h2 style="font-size:24px;"><span class="anticon anticon-loop text-rose" style="font-size:24px;"></span> '.$this->l('Liste des commandes en attente').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">
<h6><b>'.$this->l('Commandes en attente avec produits retenus').' : '.(!empty($distinct_orders)?count($distinct_orders):'0').'</b></h6>
<h6><b>'.$this->l('Commandes en attente').' : '.$total_pending_orders.'</b></h6>';
if (!empty($sales_info)) {
echo '<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
<table class="table" style="margin-top:30px; width: 100%" cellspacing="0">
$html .= '
<form action="'.$currentIndex.'&token='.$this->token.'" method="post">
<table class="table table-custombordered" style="margin-top:30px; width: 100%" cellspacing="0">
<thead>
<tr>
<th>'.$this->l('Sale ID').'</th>
<th>'.$this->l('Title').'</th>
<th>'.$this->l('Date start').'</th>
<th align="center">'.$this->l('Nb orders').'</th>
<th align="center">'.$this->l('Check all').'</th>
<th align="center">'.$this->l('See orders').'</th>
<th class="text-center">'.$this->l('Nb orders').'</th>
<th class="text-center">'.$this->l('Check all').'</th>
<th class="text-center">'.$this->l('See orders').'</th>
</tr>
</thead>
<tbody>';
foreach ($sales_info as $key => $sale) {
echo '<tr style="background-color: #fff;">
$html .= '
<tr style="background-color: #fff;">
<td>'.$sale['id_sale'].'</td>
<td>'.$sale['title'].'</td>
<td>'.$sale['date_start'].'</td>
<td><b>'.$sale['title'].'</b></td>
<td>'.date('d/m/Y H:i',strtotime($sale['date_start'])).'</td>
<td align="center">'.count($sale['orders']).'</td>
<td align="center"><input type="checkbox" name="sales[]" id="all_sale_'.(int)$sale['id_sale'].'" value="'.(int)$sale['id_sale'].'" onclick="check_all(\'sale_'.(int)$sale['id_sale'].'\');"/></td>
<td align="center" style="cursor:pointer;font-size: 20px;" id="sale_toggle_'.(int)$sale['id_sale'].'" onclick="toggleText(\'#sale_toggle_'.(int)$sale['id_sale'].'\', \'#sale_'.(int)$sale['id_sale'].'\');">'.$this->l('+').'</td>
</tr>
<tr id="sale_'.(int)$sale['id_sale'].'" style="display:none;">
<td colspan="6" style="padding: 0;">
<table class="table" style="width: 100%; border:none;" cellpadding="0" cellspacing="0">';
<table class="table table-custombordered" style="width: 100%; border:none;" cellpadding="0" cellspacing="0">';
foreach ($sale['orders'] as $k => $order) {
echo '<tr style="background-color: lightblue;">
<td><a target="_blank" href="'.__PS_BASE_URI__.'adm/index.php?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.Tools::getAdminTokenLite('AdminOrders').'">'.$order['id_order'].'</a></td>
$html .= '
<tr class="tr-order">
<td><a target="_blank" href="'.__PS_BASE_URI__.'adm/index.php?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.Tools::getAdminTokenLite('AdminOrders').'">Cmd #'.$order['id_order'].'</a></td>
<td>'.$order['customer'].'</td>
<td>'.$order['total_paid'].'</td>
<td>'.$order['payment'].'</td>
<td>'.$order['total_paid'].' </td>
<td><span class="anticon anticon-'.($order['payment']=="Paybox"?'credit-card':'paypal').'"></span> '.$order['payment'].'</td>
<td><input type="checkbox" name="orders[]" value="'.(int)$order['id_order'].'"/></td>
</tr>
<tr>
<td colspan="5" style="padding: 0;">
<table class="table" style="width: 100%" id="order_'.(int)$sale['id_order'].'">';
foreach ($order['products'] as $ke => $product) {
echo '<tr style="background-color: #fff;font-size: 12px;">
<td align="center" style="width:150px;"><img src="'.$product['image'].'" alt="" width="100" height="auto" /></td>
<td class="alt_row product_name"><span>'.$product['product_name'].'</span></td>
<td class="alt_row" align="center">'.($product['product_reference']?$product['product_reference']:'-').'</td>
$html .= '
<tr style="background-color: #fff;font-size: 12px;">
<td align="center" style="width:100px;"><img src="'.$product['image'].'" alt="" width="70" height="auto" /></td>
<td class="alt_row product_name" valign="middle"><span>'.$product['product_name'].'</span></td>
<td class="alt_row text-center" valign="middle" align="center">'.($product['product_reference']?$product['product_reference']:'-').'</td>
</tr>';
}
echo '</table>
</td>
</tr>';
}
echo '</table>
</td>
</tr>';
}
echo '</tbody>
$html .= '
</table>
<p style="width:100%;text-align:right;"><input class="button" type="submit" name="submitPrint" value="'.$this->l('Print').'"></p>
</td>
</tr>';
}
$html .= '
</table>
</td>
</tr>';
}
$html .= '</tbody>
</table>
<p style="width:100%;text-align:right;"><input class="btn btn-primary" type="submit" name="submitPrint" value="'.$this->l('Print').'"></p>
</form>';
} else {
echo '<p>'.$this->l('Aucune Commandes en attente').'</p>';
$html .= '<p>'.$this->l('Aucune Commandes en attente').'</p>';
}
$html .= '
</div>
</div>
</div>
</div>';
$html .= $helper->renderScript();
echo $html;
}
public function postProcess()
@ -207,8 +257,25 @@ class AdminLogisticsPending extends AdminTab {
if(Tools::isSubmit('submitPrint')) {
$orders = Tools::getValue('orders');
if (!empty($orders)) {
$orders = array_unique($orders);
Tools::redirectAdmin('pdf.php?pendingorders&orders='.implode(',', $orders) .'&token='.$this->token);
$_orders = array();
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity`,
d.`product_reference`, COUNT(d.id_order_detail) as `nb_p`
FROM `'._DB_PREFIX_.'privatesale_category` c
LEFT JOIN `'._DB_PREFIX_.'product` p
ON c.`id_category` = p.`id_category_default`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
ON d.`product_id` = p.`id_product`
WHERE d.`id_order` IN ('.implode(', ', $orders).')
GROUP BY d.`id_order`
ORDER BY `nb_p` ASC, d.`product_reference`
') as $row) {
if(!isset($_orders[(int)$row['id_order']])) {
$_orders[(int)$row['id_order']] = (int)$row['id_order'];
}
}
$_orders = array_unique($_orders);
Tools::redirectAdmin('pdf.php?pendingorders&orders='.implode(',', $_orders) .'&token='.$this->token);
} else {
$this->_errors[] = $this->l('No selected orders for these sales');
}

View File

@ -820,6 +820,7 @@ class AdminPrivateSalesSales extends AdminTab {
$.ajax({
url: "ajax_vp.php",
type: 'GET',
async: false,
data: 'position=' + position + '&way='+ way +'&updatePosition',
success: function() {
var type = $('.tri.active').attr('name');
@ -932,6 +933,7 @@ class AdminPrivateSalesSales extends AdminTab {
$.ajax({
url: "ajax_vp.php",
type: "GET",
async: false,
data: "id_sale=" + id_sale + "&position=" + diff +"&updatePositionDrag",
success: function(html) {
var loader = "<p style=\"text-align:center\"><img style=\"display:inline-block;\" src=\"../img/loader_payment.gif\" /></p>";