Reload ajax page after submit

This commit is contained in:
Michael RICOIS 2018-02-20 15:46:42 +01:00
parent f7a4656e9d
commit 2a1c162040

View File

@ -21,6 +21,8 @@ class AdminAntLogistic extends AdminTab
{
public $_html = '';
public $submitShipAfter = false;
private function stripaccents($str)
{
return preg_replace(
@ -332,8 +334,8 @@ class AdminAntLogistic extends AdminTab
$render = $logistics_carriers['mondialrelay']->renderLabel(new Order($id_order), $weight, $result[1]);
$this->printLabel($render,true);
} elseif(Tools::isSubmit('submitShip') && ($id_order = (int) Tools::getValue('id_order'))) {
$order = new Order((int) $id_order);
$order = new Order((int) $id_order);
$to_ship = array();
foreach(Db::getInstance()->ExecuteS('
SELECT d.`id_order_detail`, SUM(d.`product_quantity`) AS `product_quantity`, SUM(d.`product_quantity_refunded`) AS `product_quantity_refunded`, SUM(d.`product_quantity_return`) AS `product_quantity_return`, SUM(w.`quantity`) AS `quantity_sent`
@ -426,6 +428,8 @@ class AdminAntLogistic extends AdminTab
} else {
$this->_html .= '<p class="error">'.$this->l('Please enter a weight and select at least one product').'</p><br />';
}
$this->submitShipAfter = true;
}
} elseif(Tools::isSubmit('submitMod') && ($id_order = (int) Tools::getValue('id_order'))) {
$product_ids = Tools::getValue('product_ids');
@ -472,7 +476,7 @@ class AdminAntLogistic extends AdminTab
public function display()
{
global $cookie, $logistics_carriers;
$unavailable_carriers = array();
foreach($logistics_carriers as $name => $class) {
@ -787,14 +791,25 @@ class AdminAntLogistic extends AdminTab
}
}
});
}
</script>
}';
if ($this->submitShipAfter && Tools::getIsset('id_order')) {
$helperForm->_js .= '
$(function() {
$("#manualinput").val('.Tools::getValue('id_order').');
$("#barcodeinput").val("");
loadOrder(null, true);
});
';
}
$helperForm->_js .= '</script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/ant_logistic/libs/jquery.hotkeys.js"></script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/ant_logistic/libs/jquery.multiselect.min.js"></script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/ant_logistic/libs/jquery.multiselect.filter.min.js"></script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/ant_logistic/script.js?v=1"></script>';
$this->_html.='
$helperForm->_js .='
<div class="modal" id="confirm" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">