Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop
This commit is contained in:
commit
d3208d27e8
@ -127,25 +127,45 @@ class AdminAntSupplierDemand extends AdminTab
|
|||||||
|
|
||||||
$id_lang = (int)$cookie->id_lang;
|
$id_lang = (int)$cookie->id_lang;
|
||||||
|
|
||||||
|
$query_state = array(1,2,3);
|
||||||
|
if(Tools::getValue('query_state')){
|
||||||
|
$wanted_state = Tools::getValue('query_state');
|
||||||
|
$query_state = array((int)$wanted_state);
|
||||||
|
}
|
||||||
|
|
||||||
if(Tools::getValue('from') && Tools::getValue('to') && Tools::getValue('filter')){
|
if(Tools::getValue('from') && Tools::getValue('to') && Tools::getValue('filter')){
|
||||||
$datefrom = DateTime::createFromFormat('d/m/Y', Tools::getValue('from'));
|
$datefrom = DateTime::createFromFormat('d/m/Y', Tools::getValue('from'));
|
||||||
$dateto = DateTime::createFromFormat('d/m/Y', Tools::getValue('to'));
|
$dateto = DateTime::createFromFormat('d/m/Y', Tools::getValue('to'));
|
||||||
$supplier_demands = SupplierDemand::getDemands(false,
|
$supplier_demands = SupplierDemand::getDemands(false,
|
||||||
'sd.date_add > "'.$datefrom->format('Y-m-d').' 00:00:00" AND sd.date_add < "'.$dateto->format('Y-m-d').' 23:59:59" ORDER BY sd.date_add DESC'
|
'sd.date_add > "'.$datefrom->format('Y-m-d').' 00:00:00" AND sd.date_add < "'.$dateto->format('Y-m-d').' 23:59:59" '.(!empty($query_state) ? 'AND sd.`id_state` IN ('.implode(',',$query_state).')' : '').' ORDER BY sd.date_add DESC'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$supplier_demands = SupplierDemand::getDemands();
|
$supplier_demands = SupplierDemand::getDemands($query_state);
|
||||||
}
|
}
|
||||||
$states = SupplierDemand::$states;
|
$states = SupplierDemand::$states;
|
||||||
|
$counts = array(
|
||||||
|
"done" => SupplierDemand::getCountDemands(array(5)),
|
||||||
|
"no_answered" => SupplierDemand::getCountDemands(array(4)),
|
||||||
|
"in_progress" => SupplierDemand::getCountDemands(array(1,2,3))
|
||||||
|
);
|
||||||
$_current_index = ($this->config_tab ? $currentIndex . '&token=' . Tools::getAdminTokenLite($this->controller) : $_SERVER['REQUEST_URI']);
|
$_current_index = ($this->config_tab ? $currentIndex . '&token=' . Tools::getAdminTokenLite($this->controller) : $_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
$this->_html .='
|
$this->_html .='
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-content">
|
||||||
|
<a href="'.$_current_index.'" class="btn btn-warning" role="button">En cours <span class="badge">'.$counts['in_progress'].'</span></a>
|
||||||
|
<a href="'.$_current_index.'&query_state=5" class="btn btn-primary" role="button">SAV réglé <span class="badge">'.$counts['done'].'</span></a>
|
||||||
|
<a href="'.$_current_index.'&query_state=4" class="btn btn-danger" role="button">Pas de réponse <span class="badge">'.$counts['no_answered'].'</span></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-title">
|
<div class="panel-title">
|
||||||
<h2><span class="text-rose anticon anticon-list"></span> '.$this->l('Liste des demandes fournisseurs').'</h2>
|
<h2><span class="text-rose anticon anticon-list"></span> '.$this->l('Liste des demandes fournisseurs').'</h2>
|
||||||
<div class="col-lg-4 pull-right">
|
<div class="col-lg-4 pull-right">
|
||||||
<form method="POST" action="'.$_current_index.'&filter=1">
|
<form method="POST" action="'.$_current_index.'&filter=1'.(Tools::getValue('query_state')?'&query_state='.Tools::getValue('query_state'):'').'">
|
||||||
<div class="input-group input-group-sm">
|
<div class="input-group input-group-sm">
|
||||||
<span class="input-group-addon"><i class="anticon anticon-calendar"></i></span>
|
<span class="input-group-addon"><i class="anticon anticon-calendar"></i></span>
|
||||||
<input type="text" class="form-control input-sm" id="hasDatepicker_1" name="from" value="'.(Tools::getValue('from')?Tools::getValue('from'):'').'">
|
<input type="text" class="form-control input-sm" id="hasDatepicker_1" name="from" value="'.(Tools::getValue('from')?Tools::getValue('from'):'').'">
|
||||||
@ -165,6 +185,8 @@ class AdminAntSupplierDemand extends AdminTab
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="text-left">'.$this->l('ID').'</th>
|
<th class="text-left">'.$this->l('ID').'</th>
|
||||||
<th class="text-center">'.$this->l('Order').'</th>
|
<th class="text-center">'.$this->l('Order').'</th>
|
||||||
|
<th class="text-left">'.$this->l('Product').'</th>
|
||||||
|
<th class="text-left">'.$this->l('Sale').'</th>
|
||||||
<th class="text-center">'.$this->l('Status').'</th>
|
<th class="text-center">'.$this->l('Status').'</th>
|
||||||
<th class="text-center">'.$this->l('Date').'</th>
|
<th class="text-center">'.$this->l('Date').'</th>
|
||||||
<th class="text-center">'.$this->l('Renewed').'</th>
|
<th class="text-center">'.$this->l('Renewed').'</th>
|
||||||
@ -175,10 +197,13 @@ class AdminAntSupplierDemand extends AdminTab
|
|||||||
foreach ($supplier_demands as $supplier_demand)
|
foreach ($supplier_demands as $supplier_demand)
|
||||||
{
|
{
|
||||||
$renews_number = SupplierDemand::getCountRenews((int)$supplier_demand['id_supplier_demand']);
|
$renews_number = SupplierDemand::getCountRenews((int)$supplier_demand['id_supplier_demand']);
|
||||||
|
$info = SupplierDemand::getSaleStatic((int)$supplier_demand['id_supplier_demand'], true);
|
||||||
$this->_html .='
|
$this->_html .='
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="middle" align="left">#'.$supplier_demand['id_supplier_demand'].'</td>
|
<td valign="middle" align="left">#'.$supplier_demand['id_supplier_demand'].'</td>
|
||||||
<td valign="middle" align="center"><b>N° '.$supplier_demand['id_order'].'</b></td>
|
<td valign="middle" align="center"><b>N° '.$supplier_demand['id_order'].'</b></td>
|
||||||
|
<td valign="middle" align="left"><b>'.$info['product_name'].'</b></td>
|
||||||
|
<td valign="middle" align="left">'.$info['category_name'].'</td>
|
||||||
<td valign="middle" align="center"><span class="'.$states[$supplier_demand['id_state']]['icon'].'"></span> '.$states[$supplier_demand['id_state']]['name'].'</td>
|
<td valign="middle" align="center"><span class="'.$states[$supplier_demand['id_state']]['icon'].'"></span> '.$states[$supplier_demand['id_state']]['name'].'</td>
|
||||||
<td valign="middle" align="center">'.date('d/m/Y',strtotime($supplier_demand['date_add'])).'</td>
|
<td valign="middle" align="center">'.date('d/m/Y',strtotime($supplier_demand['date_add'])).'</td>
|
||||||
<td valign="middle" align="center">'.($renews_number>1?'<span class="label label-danger">'.$renews_number.'</span>':'<span class="label label-default">'.$renews_number.'</span>').'</td>
|
<td valign="middle" align="center">'.($renews_number>1?'<span class="label label-danger">'.$renews_number.'</span>':'<span class="label label-default">'.$renews_number.'</span>').'</td>
|
||||||
@ -255,8 +280,10 @@ class AdminAntSupplierDemand extends AdminTab
|
|||||||
<div class="panel-content">
|
<div class="panel-content">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<img src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-product_carre.jpg"':'').'" width="200px">
|
<a href="index.php?tab=AdminCatalog&updateproduct&id_product='.$product['product_id'].'&token=' . Tools::getAdminTokenLite('AdminCatalog').'" target="_blank">
|
||||||
<p class="text-center">'.$product['product_name'].'</p>
|
<img src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-product_carre.jpg"':'').'" width="200px">
|
||||||
|
</a>
|
||||||
|
<p class="text-center"><a href="index.php?tab=AdminCatalog&updateproduct&id_product='.$product['product_id'].'&token=' . Tools::getAdminTokenLite('AdminCatalog').'" target="_blank">'.$product['product_name'].'</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
@ -24,7 +24,7 @@ class SupplierDemand extends ObjectModel
|
|||||||
),
|
),
|
||||||
5 => array(
|
5 => array(
|
||||||
'name' => "SAV réglé",
|
'name' => "SAV réglé",
|
||||||
'icon' => 'anticon anticon-checkmark text-green',
|
'icon' => 'anticon anticon-checkmark text-green-light',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -89,7 +89,26 @@ class SupplierDemand extends ObjectModel
|
|||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'supplier_demand` sd
|
FROM `'._DB_PREFIX_.'supplier_demand` sd
|
||||||
WHERE 1
|
WHERE 1
|
||||||
'.(!empty($states) ? 'AND sd.`state` IN ('.implode(',',$states).')' : '').'
|
'.(!empty($states) ? 'AND sd.`id_state` IN ('.implode(',',$states).')' : '').'
|
||||||
|
ORDER BY sd.date_add DESC
|
||||||
|
');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCountDemands($states = array(), $where = false)
|
||||||
|
{
|
||||||
|
if($where){
|
||||||
|
return Db::getInstance()->getValue('
|
||||||
|
SELECT COUNT(`id_supplier_demand`)
|
||||||
|
FROM `'._DB_PREFIX_.'supplier_demand` sd
|
||||||
|
WHERE '.$where.'
|
||||||
|
');
|
||||||
|
} else {
|
||||||
|
return Db::getInstance()->getValue('
|
||||||
|
SELECT COUNT(`id_supplier_demand`)
|
||||||
|
FROM `'._DB_PREFIX_.'supplier_demand` sd
|
||||||
|
WHERE 1
|
||||||
|
'.(!empty($states) ? 'AND sd.`id_state` IN ('.implode(',',$states).')' : '').'
|
||||||
ORDER BY sd.date_add DESC
|
ORDER BY sd.date_add DESC
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
@ -168,4 +187,27 @@ class SupplierDemand extends ObjectModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSale($with_product = false)
|
||||||
|
{
|
||||||
|
return self::getSaleStatic($this->id, $with_product);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSaleStatic($id_supplier_demand, $with_product = false)
|
||||||
|
{
|
||||||
|
$product = self::getProductStatic($id_supplier_demand);
|
||||||
|
$sale = Db::getInstance()->getRow("
|
||||||
|
SELECT ps.`id_sale`, cl.`name` as `category_name`
|
||||||
|
FROM `" . _DB_PREFIX_ . "product_ps_cache` ps
|
||||||
|
LEFT JOIN `" . _DB_PREFIX_ . "privatesale` s ON (s.`id_sale` = ps.`id_sale`)
|
||||||
|
LEFT JOIN `" . _DB_PREFIX_ . "category_lang` cl ON (cl.`id_category` = s.`id_category`)
|
||||||
|
WHERE ps.`id_product` = " . (int)$product['product_id']."
|
||||||
|
AND cl.`id_lang` = 2"
|
||||||
|
);
|
||||||
|
|
||||||
|
if($with_product){
|
||||||
|
return array_merge($sale, $product);
|
||||||
|
}
|
||||||
|
return $sale;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user