|
@@ -8,6 +8,7 @@ Lib::loadClass('Response');
|
|
|
Lib::loadClass('ProcesHelper');
|
|
Lib::loadClass('ProcesHelper');
|
|
|
Lib::loadClass('Route_UrlAction');
|
|
Lib::loadClass('Route_UrlAction');
|
|
|
Lib::loadClass('UI');
|
|
Lib::loadClass('UI');
|
|
|
|
|
+Lib::loadClass('TableAjax');
|
|
|
|
|
|
|
|
class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
|
|
|
|
|
@@ -103,7 +104,7 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
|
|
|
$acl->init($force = false);
|
|
$acl->init($force = false);
|
|
|
$widgetProject['typeSpecial'] = Typespecial::getInstance($widgetProject['idKomorka'], $colName = $widgetProject['fieldName']);
|
|
$widgetProject['typeSpecial'] = Typespecial::getInstance($widgetProject['idKomorka'], $colName = $widgetProject['fieldName']);
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return $widgetProject;
|
|
return $widgetProject;
|
|
|
}
|
|
}
|
|
@@ -477,7 +478,6 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
|
|
|
$items_count = V::get('items_count', 0, $data);
|
|
$items_count = V::get('items_count', 0, $data);
|
|
|
$widgetCompanies = V::get('widgetCompanies', array(), $data);
|
|
$widgetCompanies = V::get('widgetCompanies', array(), $data);
|
|
|
$widgetProject = V::get('widgetProject', array(), $data);
|
|
$widgetProject = V::get('widgetProject', array(), $data);
|
|
|
- $saveOrderNotesLink = "index.php?_route=UrlAction_ProjektyProNetMediaZamZlec&_task=updateOrderNoteAjax";
|
|
|
|
|
|
|
|
|
|
$projOrders = ($id_project > 0)
|
|
$projOrders = ($id_project > 0)
|
|
|
? DB::getPDO()->fetchAll("
|
|
? DB::getPDO()->fetchAll("
|
|
@@ -492,247 +492,181 @@ class Route_UrlAction_ProjektyProNetMediaZamZlec extends RouteBase {// TODO: Url
|
|
|
")
|
|
")
|
|
|
: array();
|
|
: array();
|
|
|
|
|
|
|
|
-?>
|
|
|
|
|
-<div class="container" style="margin-top:2em">
|
|
|
|
|
- <form action="" method="get" class="form-horizontal">
|
|
|
|
|
- <input type="hidden" name="_route" value="UrlAction_ProjektyProNetMediaZamZlec">
|
|
|
|
|
- <div class="form-group">
|
|
|
|
|
- <label for="id_project" class="col-sm-2 control-label">Projekt</label>
|
|
|
|
|
- <div class="col-sm-4">
|
|
|
|
|
- <?php if ($widgetProject['typeSpecial']) : ?>
|
|
|
|
|
- <?php
|
|
|
|
|
- $fName = $widgetProject['fieldName'];
|
|
|
|
|
- $fldParams = array();
|
|
|
|
|
- $fldParams['allowCreate'] = false;
|
|
|
|
|
- $fldParams['ajaxDataUrlBase'] = $widgetProject['dataUrl'];
|
|
|
|
|
- if ($data['id_project'] > 0) {
|
|
|
|
|
- $tsValues = $widgetProject['typeSpecial']->getValuesWithExports($q = $data['id_project']);
|
|
|
|
|
- if (!empty($tsValues[ $data['id_project'] ])) {
|
|
|
|
|
- $fldParams['typespecialValue'] = $tsValues[ $data['id_project'] ]->param_out;
|
|
|
|
|
|
|
+ UI::startContainer(['style'=>"margin-top:2em"]);
|
|
|
|
|
+ UI::startTag('form', ['action'=>"", 'method'=>"get", 'class'=>"form-horizontal"]);
|
|
|
|
|
+ echo UI::h('input', ['type'=>"hidden", 'name'=>"_route", 'value'=>"UrlAction_ProjektyProNetMediaZamZlec"]);
|
|
|
|
|
+ UI::startTag('div', ['class'=>"form-group"]);
|
|
|
|
|
+ echo UI::h('label', ['for'=>"id_project", 'class'=>"col-sm-2 control-label"], "Projekt");
|
|
|
|
|
+ UI::startTag('div', ['class'=>"col-sm-4"]);
|
|
|
|
|
+ if ($widgetProject['typeSpecial']) {
|
|
|
|
|
+ $fName = $widgetProject['fieldName'];
|
|
|
|
|
+ $fldParams = array();
|
|
|
|
|
+ $fldParams['allowCreate'] = false;
|
|
|
|
|
+ $fldParams['ajaxDataUrlBase'] = $widgetProject['dataUrl'];
|
|
|
|
|
+ if ($data['id_project'] > 0) {
|
|
|
|
|
+ $tsValues = $widgetProject['typeSpecial']->getValuesWithExports($q = $data['id_project']);
|
|
|
|
|
+ if (!empty($tsValues[ $data['id_project'] ])) {
|
|
|
|
|
+ $fldParams['typespecialValue'] = $tsValues[ $data['id_project'] ]->param_out;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
|
|
|
|
|
+ echo $widgetProject['typeSpecial']->showFormItem($idTbl = $widgetProject['idTabela'], $fName, $selValue = $data['id_project'], $fldParams);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ echo UI::h('input', ['type'=>"number", 'name'=>$widgetProject['fieldName'], 'value'=>$data['id_project'], 'class'=>"form-control"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ UI::endTag('div');// .col-sm-4
|
|
|
|
|
+ UI::endTag('div');// .form-group
|
|
|
|
|
+
|
|
|
|
|
+ UI::startTag('div', ['class'=>"form-group"]);
|
|
|
|
|
+ echo UI::h('label', ['for'=>"id_company", 'class'=>"col-sm-2 control-label"], "Dostawca");
|
|
|
|
|
+ UI::startTag('div', ['class'=>"col-sm-10"]);
|
|
|
|
|
+ if ($widgetCompanies['typeSpecial']) {
|
|
|
|
|
+ $fName = $widgetCompanies['fieldName'];
|
|
|
|
|
+ $fldParams = array();
|
|
|
|
|
+ $fldParams['allowCreate'] = false;
|
|
|
|
|
+ $fldParams['ajaxDataUrlBase'] = $widgetCompanies['dataUrl'];
|
|
|
|
|
+ if ($id_company > 0) {
|
|
|
|
|
+ $tsValues = $widgetCompanies['typeSpecial']->getEditSelectedValuesByIds(-1, $id = $id_company, $fName, $fieldValue = $id_company);
|
|
|
|
|
+ if (1 == count($tsValues)) {
|
|
|
|
|
+ $fldParams['typespecialValue'] = array_values($tsValues);
|
|
|
|
|
+ $fldParams['typespecialValue'] = reset($fldParams['typespecialValue']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
|
|
|
|
|
+ echo $widgetCompanies['typeSpecial']->showFormItem($tblID = -1, $fName, $selValue = $id_company, $fldParams);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ echo UI::h('input', ['type'=>"number", 'name'=>"id_company", 'value'=>$id_company, 'class'=>"form-control"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ UI::endTag('div');// .col-sm-10
|
|
|
|
|
+ UI::endTag('div');// .form-group
|
|
|
|
|
+ // <div class="form-group">
|
|
|
|
|
+ // <label for="items_count" class="col-sm-2 control-label">Ilość pozycji</label>
|
|
|
|
|
+ // <div class="col-sm-4">
|
|
|
|
|
+ // <input type="number" name="items_count" value="$items_count" class="form-control">
|
|
|
|
|
+ // </div>
|
|
|
|
|
+ // </div>
|
|
|
|
|
+
|
|
|
|
|
+ echo UI::h('div', ['class'=>"form-group"], [
|
|
|
|
|
+ UI::h('div', ['class'=>"col-sm-offset-2 col-sm-10"], [
|
|
|
|
|
+ UI::h('input', ['type'=>"hidden", 'name'=>"_task", 'value'=>""]),
|
|
|
|
|
+ " ", UI::h('label', [], "Dodaj nowe"),
|
|
|
|
|
+ " ", UI::h('button', ['type'=>"submit", 'class'=>"btn btn-primary", 'onclick'=>"return submitZamowienie(this);"], "Zamówienie"),
|
|
|
|
|
+ " ", UI::h('button', ['type'=>"submit", 'class'=>"btn btn-primary", 'onclick'=>"return submitZlecenie(this);"], "Zlecenie")
|
|
|
|
|
+ ])
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ UI::endTag('form');
|
|
|
|
|
+
|
|
|
|
|
+ UI::endContainer();
|
|
|
|
|
+
|
|
|
|
|
+ echo UI::h('hr');
|
|
|
|
|
+
|
|
|
|
|
+ echo UI::h('style', ['type' => "text/css"], "
|
|
|
|
|
+ .orders_cell__order_notes .edit_note_btn { opacity:0.1; cursor:pointer }
|
|
|
|
|
+ .orders_cell__order_notes:hover .edit_note_btn { opacity:1; color:#337AB7 }
|
|
|
|
|
+ ");
|
|
|
|
|
+
|
|
|
|
|
+ if (!empty($projOrders)) {
|
|
|
|
|
+ UI::startContainer(['style'=>"margin-top:2em"]);
|
|
|
|
|
+ $idTableOrders = ProcesHelper::getZasobTableID('CRM_LISTA_ZASOBOW_ORDERS');
|
|
|
|
|
+ UI::table([
|
|
|
|
|
+ 'disable_lp' => true,
|
|
|
|
|
+ 'cell_padding' => 6,
|
|
|
|
|
+ 'cols' => [
|
|
|
|
|
+ '#',
|
|
|
|
|
+ 'status',
|
|
|
|
|
+ 'uwagi',
|
|
|
|
|
+ 'nr zlecenia',
|
|
|
|
|
+ 'nr budowy',
|
|
|
|
|
+ ],
|
|
|
|
|
+ 'rows' => array_map(function ($order) use ($idTableOrders) {
|
|
|
|
|
+ $changeState = array();
|
|
|
|
|
+ $urlFunctions = Route_UrlAction::getTableFunctions($idTableOrders, $order['ID'], 'CRM_LISTA_ZASOBOW_ORDERS', User::getLogin());
|
|
|
|
|
+ //DBG::_(true, true, 'urlFunctions', $urlFunctions);
|
|
|
|
|
+ if ('WERSJA_ROBOCZA' == $order['APPROVE_STATUS']) {
|
|
|
|
|
+ foreach ($urlFunctions as $fun) {
|
|
|
|
|
+ if ('ProjektyProNetMediaRequestApproveZam' == $fun['name']) {
|
|
|
|
|
+ $changeState['OCZEKUJE_ZATWIERDZENIA'] = $fun;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
|
|
|
|
|
- echo $widgetProject['typeSpecial']->showFormItem($idTbl = $widgetProject['idTabela'], $fName, $selValue = $data['id_project'], $fldParams);
|
|
|
|
|
- ?>
|
|
|
|
|
- <?php else : ?>
|
|
|
|
|
- <input type="number" name="<?= $widgetProject['fieldName']; ?>" value="<?= $data['id_project']; ?>" class="form-control">
|
|
|
|
|
- <?php endif; ?>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="form-group">
|
|
|
|
|
- <label for="id_company" class="col-sm-2 control-label">Dostawca</label>
|
|
|
|
|
- <div class="col-sm-10">
|
|
|
|
|
- <?php if ($widgetCompanies['typeSpecial']) : ?>
|
|
|
|
|
- <?php
|
|
|
|
|
- $fName = $widgetCompanies['fieldName'];
|
|
|
|
|
- $fldParams = array();
|
|
|
|
|
- $fldParams['allowCreate'] = false;
|
|
|
|
|
- $fldParams['ajaxDataUrlBase'] = $widgetCompanies['dataUrl'];
|
|
|
|
|
- if ($id_company > 0) {
|
|
|
|
|
- $tsValues = $widgetCompanies['typeSpecial']->getEditSelectedValuesByIds(-1, $id = $id_company, $fName, $fieldValue = $id_company);
|
|
|
|
|
- if (1 == count($tsValues)) {
|
|
|
|
|
- $fldParams['typespecialValue'] = array_values($tsValues);
|
|
|
|
|
- $fldParams['typespecialValue'] = reset($fldParams['typespecialValue']);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else if ('OCZEKUJE_ZATWIERDZENIA' == $order['APPROVE_STATUS']) {
|
|
|
|
|
+ foreach ($urlFunctions as $fun) {
|
|
|
|
|
+ if ('ProjektyProNetMediaApproveZam' == $fun['name']) {
|
|
|
|
|
+ $changeState['OCZEKUJE_OSTATECZNEGO_ZATWIERDZENIA'] = $fun;
|
|
|
}
|
|
}
|
|
|
- //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
|
|
|
|
|
- echo $widgetCompanies['typeSpecial']->showFormItem($tblID = -1, $fName, $selValue = $id_company, $fldParams);
|
|
|
|
|
- ?>
|
|
|
|
|
- <?php else : ?>
|
|
|
|
|
- <input type="number" name="id_company" value="<?php echo $id_company; ?>" class="form-control">
|
|
|
|
|
- <?php endif; ?>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-<!--
|
|
|
|
|
- <div class="form-group">
|
|
|
|
|
- <label for="items_count" class="col-sm-2 control-label">Ilość pozycji</label>
|
|
|
|
|
- <div class="col-sm-4">
|
|
|
|
|
- <input type="number" name="items_count" value="<?php echo $items_count; ?>" class="form-control">
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
--->
|
|
|
|
|
- <div class="form-group">
|
|
|
|
|
- <div class="col-sm-offset-2 col-sm-10">
|
|
|
|
|
- <input type="hidden" name="_task" value="">
|
|
|
|
|
- <label>Dodaj nowe </label>
|
|
|
|
|
- <button type="submit" class="btn btn-primary" onclick="return submitZamowienie(this);">Zamówienie</button>
|
|
|
|
|
- <button type="submit" class="btn btn-primary" onclick="return submitZlecenie(this);">Zlecenie</button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </form>
|
|
|
|
|
-
|
|
|
|
|
- <hr>
|
|
|
|
|
-<style type="text/css">
|
|
|
|
|
-.orders_cell__order_notes .edit_note_btn { display:none }
|
|
|
|
|
-.orders_cell__order_notes:hover .edit_note_btn { display:inline-block }
|
|
|
|
|
-</style>
|
|
|
|
|
-<?php if (!empty($projOrders)) : ?>
|
|
|
|
|
- <table class="table table-bordered table-hover">
|
|
|
|
|
- <thead>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <th>#</th>
|
|
|
|
|
- <th>status</th>
|
|
|
|
|
- <th>uwagi</th>
|
|
|
|
|
- <th>nr zlecenia</th>
|
|
|
|
|
- <th>nr budowy</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </thead>
|
|
|
|
|
- <tbody>
|
|
|
|
|
- <?php foreach ($projOrders as $order) : ?>
|
|
|
|
|
- <?php
|
|
|
|
|
- $changeState = array();
|
|
|
|
|
- $idTableOrders = ProcesHelper::getZasobTableID('CRM_LISTA_ZASOBOW_ORDERS');
|
|
|
|
|
- $urlFunctions = Route_UrlAction::getTableFunctions($idTableOrders, $order['ID'], 'CRM_LISTA_ZASOBOW_ORDERS', User::getLogin());
|
|
|
|
|
- //DBG::_(true, true, 'urlFunctions', $urlFunctions);
|
|
|
|
|
- if ('WERSJA_ROBOCZA' == $order['APPROVE_STATUS']) {
|
|
|
|
|
- foreach ($urlFunctions as $fun) {
|
|
|
|
|
- if ('ProjektyProNetMediaRequestApproveZam' == $fun['name']) {
|
|
|
|
|
- $changeState['OCZEKUJE_ZATWIERDZENIA'] = $fun;
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if ('OCZEKUJE_ZATWIERDZENIA' == $order['APPROVE_STATUS']) {
|
|
|
|
|
- foreach ($urlFunctions as $fun) {
|
|
|
|
|
- if ('ProjektyProNetMediaApproveZam' == $fun['name']) {
|
|
|
|
|
- $changeState['OCZEKUJE_OSTATECZNEGO_ZATWIERDZENIA'] = $fun;
|
|
|
|
|
|
|
+ else if ('OCZEKUJE_OSTATECZNEGO_ZATWIERDZENIA' == $order['APPROVE_STATUS']) {
|
|
|
|
|
+ foreach ($urlFunctions as $fun) {
|
|
|
|
|
+ if ('ProjektyProNetMediaFinalApproveZam' == $fun['name']) {
|
|
|
|
|
+ $changeState['ZATWIERDZONE'] = $fun;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if ('OCZEKUJE_OSTATECZNEGO_ZATWIERDZENIA' == $order['APPROVE_STATUS']) {
|
|
|
|
|
- foreach ($urlFunctions as $fun) {
|
|
|
|
|
- if ('ProjektyProNetMediaFinalApproveZam' == $fun['name']) {
|
|
|
|
|
- $changeState['ZATWIERDZONE'] = $fun;
|
|
|
|
|
|
|
+ $changeStateOut = "";
|
|
|
|
|
+ if (!empty($changeState)) {
|
|
|
|
|
+ foreach ($changeState as $key => $fun) {
|
|
|
|
|
+ $changeStateOut .= UI::h('a', [
|
|
|
|
|
+ 'href' => $this->generateFunctionLink($fun, $idTableOrders, $order['ID'], $order),
|
|
|
|
|
+ 'class' => "btn btn-xs btn-default"
|
|
|
|
|
+ ], "Zmień na: {$key}");
|
|
|
|
|
+ $changeStateOut .= " ";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
+ return [
|
|
|
|
|
+ '#' => $order['ID'] . UI::h('a', [
|
|
|
|
|
+ 'href' => "index.php?_route=UrlAction_ProjektyProNetMediaZamZlec&_task={$order['ORDER_TYPE']}&id={$order['ID']}",
|
|
|
|
|
+ 'class' => "btn btn-link btn-xs"
|
|
|
|
|
+ ], "Edytuj {$order['ORDER_TYPE']}"),
|
|
|
|
|
+ 'status' => $order['APPROVE_STATUS'] . " " . $changeStateOut,
|
|
|
|
|
+ '@class[uwagi]' => 'orders_cell__order_notes',
|
|
|
|
|
+ 'uwagi' => UI::h('span', ['class'=>"order-notes"], $order['ORDER_NOTES']) . " " .
|
|
|
|
|
+ UI::h('i', [
|
|
|
|
|
+ 'onClick' => "return p5UI__Clickable(this, 'p5:ZamZlec:editNote', {idOrder: '{$order['ID']}', label: '{$order['ORDER_LABEL']}'})",
|
|
|
|
|
+ 'class' => "glyphicon glyphicon-pencil edit_note_btn",
|
|
|
|
|
+ 'title' => "Edytuj"
|
|
|
|
|
+ ]),
|
|
|
|
|
+ 'nr zlecenia' => $order['ORDER_LABEL'],
|
|
|
|
|
+ 'nr budowy' => $order['obcy_nr_sprawy'],
|
|
|
|
|
+ ];
|
|
|
|
|
+ }, $projOrders)
|
|
|
|
|
+ ]);
|
|
|
|
|
+ UI::endContainer();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $filterInit = [];
|
|
|
|
|
+ $forceFilterInit = [];
|
|
|
|
|
+
|
|
|
|
|
+ $acl = Core_AclHelper::getAclByNamespace('default_db/CRM_LISTA_ZASOBOW_ORDERS');
|
|
|
|
|
+
|
|
|
|
|
+ $syncUrl = Request::getPathUri() . 'index.php?_route=ViewTableAjax&namespace=' . $acl->getNamespace();
|
|
|
|
|
+ $tbl = new TableAjax($acl);
|
|
|
|
|
+ $tblLabel = $acl->getNamespace();
|
|
|
|
|
+ if ('default_db' == $acl->getSourceName()) {
|
|
|
|
|
+ $tblLabel = array();
|
|
|
|
|
+ $zasobObj = ProcesHelper::getZasobTableInfo($acl->getID());
|
|
|
|
|
+ if (!$zasobObj) throw new Exception("Zasob TABELA ID=" . $acl->getID() . " nie istnieje");
|
|
|
|
|
+ if (!empty($zasobObj->DESC_PL)) $tblLabel []= $zasobObj->DESC_PL;
|
|
|
|
|
+ if (!empty($zasobObj->OPIS)) $tblLabel []= $zasobObj->OPIS;
|
|
|
|
|
+ $tblLabel = implode(" - ", $tblLabel);
|
|
|
}
|
|
}
|
|
|
- ?>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>
|
|
|
|
|
- <?php echo $order['ID']; ?>
|
|
|
|
|
- <a href="index.php?_route=UrlAction_ProjektyProNetMediaZamZlec&_task=<?php echo $order['ORDER_TYPE']; ?>&id=<?php echo $order['ID']; ?>"
|
|
|
|
|
- class="btn btn-link btn-xs">Edytuj <?php echo $order['ORDER_TYPE']; ?></a>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td><?php echo $order['APPROVE_STATUS']; ?>
|
|
|
|
|
- <?php if (!empty($changeState)) : ?>
|
|
|
|
|
- <?php foreach ($changeState as $key => $fun) : ?>
|
|
|
|
|
- <a href="<?php echo $this->generateFunctionLink($fun, $idTableOrders, $order['ID'], $order); ?>" class="btn btn-xs btn-default">Zmień na: <?php echo $key; ?></a>
|
|
|
|
|
- <?php endforeach; ?>
|
|
|
|
|
- <?php endif; ?>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td class="orders_cell__order_notes">
|
|
|
|
|
- <span class="order-notes"><?php echo $order['ORDER_NOTES']; ?></span>
|
|
|
|
|
- <button onClick="return p5UI__Clickable(this, 'p5:ZamZlec:editNote', {idOrder: '<?= $order['ID']; ?>', label: '<?= $order['ORDER_LABEL']; ?>'})"
|
|
|
|
|
- class="btn btn-xs btn-link edit_note_btn">Edytuj</button>
|
|
|
|
|
- </td>
|
|
|
|
|
- <td><?php echo $order['ORDER_LABEL']; ?></td>
|
|
|
|
|
- <td><?php echo $order['obcy_nr_sprawy']; ?></td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <?php endforeach; ?>
|
|
|
|
|
- </tbody>
|
|
|
|
|
- </table>
|
|
|
|
|
-</div>
|
|
|
|
|
-<?php endif; ?>
|
|
|
|
|
-<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">
|
|
|
|
|
-<script src="static/sweetalert2.min.js"></script>
|
|
|
|
|
-<script>
|
|
|
|
|
-function submitZamowienie(fld) {
|
|
|
|
|
- var frm = fld.form;
|
|
|
|
|
- frm['_task'].value='addZamowienie';
|
|
|
|
|
-}
|
|
|
|
|
-function submitZlecenie(fld) {
|
|
|
|
|
- var frm = fld.form;
|
|
|
|
|
- frm['_task'].value='addZlecenie';
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-(function() {
|
|
|
|
|
- var _saveOrderNotesLink = "<?= $saveOrderNotesLink; ?>";
|
|
|
|
|
- var _dbg = <?= (DBG::isActive()) ? "1" : "0" ?>;
|
|
|
|
|
-
|
|
|
|
|
- jQuery(document).on('p5:ZamZlec:editNote:click', function(e, n, payload) {
|
|
|
|
|
- if (!payload || !payload.props || !payload.props.idOrder) return false;
|
|
|
|
|
- // TODO: load current value for field 'ORDER_NOTES' from ajax
|
|
|
|
|
- // superagent
|
|
|
|
|
- // .post(_saveOrderNotesLink)
|
|
|
|
|
- // .type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
|
|
|
|
|
- // .send({
|
|
|
|
|
- // notes: orderNotes
|
|
|
|
|
- // })
|
|
|
|
|
- // .set('Accept', 'application/json')
|
|
|
|
|
- // .end(function(err, res) {
|
|
|
|
|
- // if(_dbg)console.log('#widget-zamzlec/editOrderNotes: res:', res, 'res.body:', res.body)
|
|
|
|
|
- // if (err || !res.ok) {
|
|
|
|
|
- // // jQuery(document).trigger('DBG:notify', {type: 'warning', msg: 'Req error', err: err});
|
|
|
|
|
- // reject("Request error")
|
|
|
|
|
- // } else {
|
|
|
|
|
- // if ('application/json' !== res.type) {
|
|
|
|
|
- // reject("Wrong response type - required json")
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // if (!res.body.id || res.body.id <= 0) reject(res.body.msg || "Wystąpiły błędy podczas dodawaniu kosztu")
|
|
|
|
|
- // resolve(res.body)
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
- var orderNotes = jQuery(n).parent().find('.order-notes').text()
|
|
|
|
|
- zamZlec__editOrderNote(n, payload.props.idOrder, payload.props.label || '', orderNotes)
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- function zamZlec__editOrderNote(n, idOrder, orderLabel, orderNotes) {
|
|
|
|
|
- var noteNode = n;
|
|
|
|
|
- console.log('TODO: edit note for idOrder('+idOrder+') orderNotes', orderNotes)
|
|
|
|
|
- swal({
|
|
|
|
|
- title: 'Uwagi do zamówienia',
|
|
|
|
|
- html: 'nr: "' + orderLabel + '" (id:'+idOrder+')',
|
|
|
|
|
- animation: false,
|
|
|
|
|
- input: 'textarea',
|
|
|
|
|
- inputPlaceholder: 'uwagi...',
|
|
|
|
|
- inputValue: orderNotes,
|
|
|
|
|
- // inputAttributes: {'step': '0.01'},
|
|
|
|
|
- showCancelButton: true,
|
|
|
|
|
- confirmButtonText: 'Zapisz',
|
|
|
|
|
- showLoaderOnConfirm: true,
|
|
|
|
|
- showCloseButton: true,
|
|
|
|
|
- preConfirm: function(orderNotes) {
|
|
|
|
|
- return new Promise(function(resolve, reject) {
|
|
|
|
|
- if (orderNotes.length > 255) reject('Przekroczono limit długości znaków')
|
|
|
|
|
- superagent
|
|
|
|
|
- .post(_saveOrderNotesLink)
|
|
|
|
|
- .type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
|
|
|
|
|
- .send({
|
|
|
|
|
- id: idOrder,
|
|
|
|
|
- notes: orderNotes
|
|
|
|
|
- })
|
|
|
|
|
- .set('Accept', 'application/json')
|
|
|
|
|
- .end(function(err, res) {
|
|
|
|
|
- if(_dbg)console.log('#widget-zamzlec/editOrderNotes: res:', res, 'res.body:', res.body)
|
|
|
|
|
- if (err || !res.ok) {
|
|
|
|
|
- reject((res.body && res.body.msg) ? res.body.msg || "Request error" : "Request error")
|
|
|
|
|
- } else {
|
|
|
|
|
- if ('application/json' !== res.type) {
|
|
|
|
|
- reject("Wrong response type - required json")
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- if (!res.body.order || res.body.order.ID <= 0) reject(res.body.msg || "Wystąpiły błędy")
|
|
|
|
|
- resolve(res.body.order)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- allowOutsideClick: false
|
|
|
|
|
- }).then(function(order) {
|
|
|
|
|
- if(_dbg)console.log('#widget-zamzlec/editOrderNotes: order:', order)
|
|
|
|
|
- zamZlec__renderNote(order.ID, order.ORDER_NOTES, n)
|
|
|
|
|
- }).catch(function(e) {
|
|
|
|
|
- // eg. hit Cancel
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function zamZlec__renderNote(idOrder, notes, noteNode) {
|
|
|
|
|
- console.log('TODO: edit note for idOrder('+idOrder+'), noteNode:', noteNode, 'notes:', notes);
|
|
|
|
|
- jQuery(noteNode).parent().find('.order-notes').text(notes)
|
|
|
|
|
- }
|
|
|
|
|
-})();
|
|
|
|
|
-</script>
|
|
|
|
|
-<?php
|
|
|
|
|
|
|
+ $tbl->setSyncUrl($syncUrl);
|
|
|
|
|
+ $tbl->setLabel($tblLabel);
|
|
|
|
|
+ $tbl->addRowFunction('edit');
|
|
|
|
|
+ // $tbl->addRowFunction('hist');
|
|
|
|
|
+ // $tbl->addRowFunction('files');
|
|
|
|
|
+ $tbl->addRowFunction('msgs');
|
|
|
|
|
+
|
|
|
|
|
+ $tbl->setFilterInit($filterInit);
|
|
|
|
|
+ if (!empty($forceFilterInit)) $tbl->setForceFilterInit($forceFilterInit);
|
|
|
|
|
+ echo $tbl->render();
|
|
|
|
|
+ }
|
|
|
|
|
+ echo UI::h('link', ['rel'=>"stylesheet", 'type'=>"text/css", 'href'=>"static/sweetalert2.min.css"]);
|
|
|
|
|
+ echo UI::h('script', ['src'=>'static/sweetalert2.min.js']);
|
|
|
|
|
+ UI::inlineJS(__FILE__ . ".zam-zlec-list.js", [
|
|
|
|
|
+ 'SAVE_ORDER_NOTES_URL' => "index.php?_route=UrlAction_ProjektyProNetMediaZamZlec&_task=updateOrderNoteAjax",
|
|
|
|
|
+ 'DBG' => (DBG::isActive()) ? "1" : "0"
|
|
|
|
|
+ ]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function generateFunctionLink($fun, $idTableOrders, $idOrder, $order) {
|
|
public function generateFunctionLink($fun, $idTableOrders, $idOrder, $order) {
|