|
|
@@ -4,6 +4,7 @@ Lib::loadClass('RouteBase');
|
|
|
Lib::loadClass('TypespecialVariable');
|
|
|
Lib::loadClass('Request');
|
|
|
Lib::loadClass('Response');
|
|
|
+Lib::loadClass('UI');
|
|
|
|
|
|
class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
|
|
|
|
@@ -14,8 +15,8 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
}
|
|
|
|
|
|
public function defaultAction() {
|
|
|
- SE_Layout::gora();
|
|
|
- if (1 != V::get('_print', '', $_GET)) SE_Layout::menu();
|
|
|
+ UI::gora();
|
|
|
+ if (1 != V::get('_print', '', $_GET)) UI::menu();
|
|
|
try {
|
|
|
$data = array();
|
|
|
$data['id_order'] = V::get('ID_ORDER', 0, $_REQUEST, 'int');
|
|
|
@@ -23,13 +24,13 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
$data = $this->setProps($data);
|
|
|
$this->approveFormView($data);
|
|
|
} catch (Exception $e) {
|
|
|
- SE_Layout::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
+ UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
}
|
|
|
- SE_Layout::dol();
|
|
|
+ UI::dol();
|
|
|
}
|
|
|
|
|
|
public function approveOrderAction() {
|
|
|
- SE_Layout::gora();
|
|
|
+ UI::gora();
|
|
|
try {
|
|
|
$data = array();
|
|
|
$data['id_order'] = V::get('id_order', 0, $_REQUEST, 'int');
|
|
|
@@ -41,10 +42,10 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
$affected = DB::getDB()->UPDATE_OBJ('CRM_LISTA_ZASOBOW_ORDERS', (object)$sqlObj);
|
|
|
echo '<div class="container">';
|
|
|
if ($affected >= 0) {
|
|
|
- SE_Layout::alert('success', "Przekazano do ostatecznego zatwierdzenia");
|
|
|
+ UI::alert('success', "Przekazano do ostatecznego zatwierdzenia");
|
|
|
// TODO: show link to final approve if has access?
|
|
|
} else {
|
|
|
- SE_Layout::alert('danger', "Wystąpiły błędy podczas zmieniania statusu zamówienia");
|
|
|
+ UI::alert('danger', "Wystąpiły błędy podczas zmieniania statusu zamówienia");
|
|
|
}
|
|
|
?>
|
|
|
<div style="text-align:center">
|
|
|
@@ -53,13 +54,13 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
<?php
|
|
|
echo '</div>';
|
|
|
} catch (Exception $e) {
|
|
|
- SE_Layout::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
+ UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
}
|
|
|
- SE_Layout::dol();
|
|
|
+ UI::dol();
|
|
|
}
|
|
|
|
|
|
public function rejectOrderAction() {
|
|
|
- SE_Layout::gora();
|
|
|
+ UI::gora();
|
|
|
try {
|
|
|
$data = array();
|
|
|
$data['id_order'] = V::get('id_order', 0, $_REQUEST, 'int');
|
|
|
@@ -71,9 +72,9 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
$affected = DB::getDB()->UPDATE_OBJ('CRM_LISTA_ZASOBOW_ORDERS', (object)$sqlObj);
|
|
|
echo '<div class="container">';
|
|
|
if ($affected >= 0) {
|
|
|
- SE_Layout::alert('success', "Zmieniono status zamówienia na ODRZUCONE");
|
|
|
+ UI::alert('success', "Zmieniono status zamówienia na ODRZUCONE");
|
|
|
} else {
|
|
|
- SE_Layout::alert('danger', "Wystąpiły błędy podczas zmieniania statusu zamówienia");
|
|
|
+ UI::alert('danger', "Wystąpiły błędy podczas zmieniania statusu zamówienia");
|
|
|
}
|
|
|
?>
|
|
|
<div style="text-align:center">
|
|
|
@@ -82,9 +83,9 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
<?php
|
|
|
echo '</div>';
|
|
|
} catch (Exception $e) {
|
|
|
- SE_Layout::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
+ UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
|
|
|
}
|
|
|
- SE_Layout::dol();
|
|
|
+ UI::dol();
|
|
|
}
|
|
|
|
|
|
public function setProps($data) {
|
|
|
@@ -100,6 +101,8 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
, r.ID_PROJECT
|
|
|
, sum(o.OFFER_PRICE_PER_UNIT * o.OFFER_QUANTITY) as SUM_NETTO
|
|
|
, p.M_DIST_DESC
|
|
|
+ , r.A_RECORD_CREATE_AUTHOR
|
|
|
+ , r.A_RECORD_CREATE_DATE
|
|
|
from CRM_LISTA_ZASOBOW_ORDERS r
|
|
|
join IN7_MK_BAZA_DYSTRYBUCJI p on(p.ID = r.ID_PROJECT)
|
|
|
left join CRM_LISTA_ZASOBOW_OFFERS o on(
|
|
|
@@ -121,37 +124,69 @@ class Route_UrlAction_ProjektyProNetMediaApproveZam extends RouteBase {// TODO:
|
|
|
}
|
|
|
|
|
|
public function approveFormView($data) {
|
|
|
- ?>
|
|
|
-<div class="container">
|
|
|
- <h1><?= ('zlecenie' == $data['ORDER_TYPE']) ? "Zlecenie" : "Zamówienie"; ?>: <?php echo $data['zamowienie_label']; ?>
|
|
|
- <br><small>Dotyczy projektu: <?php echo $data['project_label']; ?></small>
|
|
|
- </h1>
|
|
|
+ UI::startContainer();
|
|
|
+ echo UI::h('h1', [], [
|
|
|
+ ('zlecenie' == $data['ORDER_TYPE']) ? "Zlecenie" : "Zamówienie",
|
|
|
+ " " . $data['zamowienie_label'],
|
|
|
+ '<br>' . "<small>Dotyczy projektu: {$data['project_label']}</small>"
|
|
|
+ ]);
|
|
|
+ echo UI::h('div', ['class'=>"alert alert-info"], "Suma netto zamówienia: <b>{$data['zamowienie_suma']}</b>");
|
|
|
+ echo UI::h('form', ['style'=>"text-align:center"], [
|
|
|
+ UI::h('h3', [], "Przekazanie do ostatecznego zatwierdzenia"),
|
|
|
+ UI::h('input', ['type'=>"hidden", 'name'=>"_route", 'value'=>"UrlAction_ProjektyProNetMediaApproveZam"]),
|
|
|
+ UI::h('input', ['type'=>"hidden", 'name'=>"_task", 'value'=>""]),
|
|
|
+ UI::h('input', ['type'=>"hidden", 'name'=>"id_order", 'value'=>$data['id_order']]),
|
|
|
+ UI::h('button', ['onClick'=>"return approveOrder(this);", 'class'=>"btn btn-lg btn-primary"], "Zatwierdzam"),
|
|
|
+ UI::h('button', ['onClick'=>"return rejectOrder(this);", 'class'=>"btn btn-lg btn-danger", 'style'=>"margin-left:30px"], "Nie zatwierdzam"),
|
|
|
+ UI::h('a', [
|
|
|
+ 'href' => $this->getLink('msgs') . "&id_order={$data['id_order']}",// "index.php?_route=TableMsgs&_task=tableRow&idTable=13555&idRow=4",
|
|
|
+ 'class'=>"btn btn-lg btn-warning",
|
|
|
+ 'style'=>"margin-left:30px"
|
|
|
+ ], "Do wyjaśnienia"),
|
|
|
+ ]);
|
|
|
+ echo UI::h('hr');
|
|
|
+ Router::getRoute('UrlAction_ProjektyProNetMediaZamZlec')->previewOrder($data['id_order']);
|
|
|
+ UI::endContainer();
|
|
|
+ echo UI::h('script', [], "
|
|
|
+ function approveOrder(fld) {
|
|
|
+ var frm = fld.form;
|
|
|
+ frm['_task'].value='approveOrder';
|
|
|
+ }
|
|
|
+ function rejectOrder(fld) {
|
|
|
+ var frm = fld.form;
|
|
|
+ frm['_task'].value='rejectOrder';
|
|
|
+ }
|
|
|
+ ");
|
|
|
+ }
|
|
|
|
|
|
- <?php echo SE_Layout::alert('info', "Suma netto zamówienia: <b>{$data['zamowienie_suma']}</b>"); ?>
|
|
|
+ public function msgsAction() {
|
|
|
+ UI::gora();
|
|
|
+ UI::menu();
|
|
|
+ try {
|
|
|
+ $data = $this->setProps([
|
|
|
+ 'id_order' => V::get('id_order', 0, $_GET, 'int')
|
|
|
+ ]);
|
|
|
+ UI::startContainer();
|
|
|
+ echo UI::h('h1', [], [
|
|
|
+ ('zlecenie' == $data['ORDER_TYPE']) ? "Zlecenie" : "Zamówienie",
|
|
|
+ " " . $data['zamowienie_label'],
|
|
|
+ '<br>' . "<small>Dotyczy projektu: {$data['project_label']}</small>"
|
|
|
+ ]);
|
|
|
|
|
|
- <form style="text-align:center">
|
|
|
- <h3>Przekazanie do ostatecznego zatwierdzenia</h3>
|
|
|
- <input type="hidden" name="_route" value="UrlAction_ProjektyProNetMediaApproveZam">
|
|
|
- <input type="hidden" name="_task" value="">
|
|
|
- <input type="hidden" name="id_order" value="<?php echo $data['id_order']; ?>">
|
|
|
- <button onClick="return approveOrder(this);" class="btn btn-lg btn-primary">Zatwierdzam</button>
|
|
|
- <button onClick="return rejectOrder(this);" class="btn btn-lg btn-danger" style="margin-left:30px">Nie zatwierdzam</button>
|
|
|
- </form>
|
|
|
+ $author = V::get('A_RECORD_CREATE_AUTHOR', '', $data['orderRaw']);
|
|
|
+ if ($author) echo UI::h('h4', [], "Autor: {$author}");
|
|
|
|
|
|
- <hr>
|
|
|
- <?php Router::getRoute('UrlAction_ProjektyProNetMediaZamZlec')->previewOrder($data['id_order']);?>
|
|
|
-</div>
|
|
|
-<script>
|
|
|
-function approveOrder(fld) {
|
|
|
- var frm = fld.form;
|
|
|
- frm['_task'].value='approveOrder';
|
|
|
-}
|
|
|
-function rejectOrder(fld) {
|
|
|
- var frm = fld.form;
|
|
|
- frm['_task'].value='rejectOrder';
|
|
|
-}
|
|
|
-</script>
|
|
|
- <?php
|
|
|
+ $idTable = DB::getPDO()->fetchValue("
|
|
|
+ select z.ID
|
|
|
+ from CRM_LISTA_ZASOBOW z
|
|
|
+ where z.`DESC` = 'CRM_LISTA_ZASOBOW_ORDERS'
|
|
|
+ and z.`TYPE` = 'TABELA'
|
|
|
+ ");
|
|
|
+ Router::getRoute('TableMsgs')->tableRowMsgs($idTable, $data['id_order']);
|
|
|
+ } catch (Exception $e) {
|
|
|
+ UI::alert('danger', $e->getMessage());
|
|
|
+ }
|
|
|
+ UI::dol();
|
|
|
}
|
|
|
|
|
|
}
|