|
@@ -9,51 +9,63 @@ Lib::loadClass('Response');
|
|
|
|
|
|
|
|
class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
|
|
|
|
|
|
|
|
- public function getResByParentAjaxAction(){
|
|
|
|
|
|
|
+ public function getResByParentAjaxAction() {
|
|
|
try {
|
|
try {
|
|
|
- if(!isset($_GET['parent_id'])) throw new Exception("ID is not set.");
|
|
|
|
|
- $parent_id = DB::getPDO()->quote($_GET['parent_id'], PDO::PARAM_INT);
|
|
|
|
|
- $rows = DB::getPDO()->fetchAll("
|
|
|
|
|
- select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
|
|
|
|
|
- from CRM_LISTA_ZASOBOW g
|
|
|
|
|
- left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
|
|
|
|
|
- left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
|
|
|
|
|
- left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
|
|
|
|
|
- where g.`PARENT_ID` = ".$parent_id." ORDER BY g.SORT_PRIO
|
|
|
|
|
- ");
|
|
|
|
|
- Response::sendJsonExit($rows);
|
|
|
|
|
- } catch (Exception $e) {
|
|
|
|
|
- UI::alert('danger', "Error: " . $e->getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ $idParent = V::get('parent_id', 0, $_GET, 'int');
|
|
|
|
|
+ if ($idParent <= 0) throw new Exception("ID is not set.");
|
|
|
|
|
+ $sqlIdParent = DB::getPDO()->quote($idParent, PDO::PARAM_INT);
|
|
|
|
|
+ $rows = DB::getPDO()->fetchAll("
|
|
|
|
|
+ select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
|
|
|
|
|
+ from CRM_LISTA_ZASOBOW g
|
|
|
|
|
+ left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
|
|
|
|
|
+ left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
|
|
|
|
|
+ left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
|
|
|
|
|
+ where g.`PARENT_ID` = {$sqlIdParent}
|
|
|
|
|
+ ORDER BY g.SORT_PRIO ASC, g.ID DESC
|
|
|
|
|
+ ");
|
|
|
|
|
+ Response::sendJsonExit($rows);
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ UI::alert('danger', "Error: " . $e->getMessage());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function getResAjaxAction(){
|
|
|
|
|
|
|
+ public function getResAjaxAction() {
|
|
|
try {
|
|
try {
|
|
|
- if(!isset($_GET['word'])) throw new Exception("word is not set.");
|
|
|
|
|
- $word = DB::getPDO()->quote("%".$_GET['word']."%", PDO::PARAM_STR);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ $word = V::get('word', '', $_GET);
|
|
|
$filter = isset($_GET['filter']) ? (int)$_GET['filter'] : 0;
|
|
$filter = isset($_GET['filter']) ? (int)$_GET['filter'] : 0;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
$sqlFilter = "";
|
|
$sqlFilter = "";
|
|
|
- switch($filter){
|
|
|
|
|
- case 2: $sqlFilter = "AND (g.`TYPE` = 'TABELA' OR g.`TYPE` = 'KOMORKA')";break;
|
|
|
|
|
- case 1: $sqlFilter = "AND (g.`TYPE` = 'STANOWISKO' OR g.`TYPE` = 'DZIAL' OR g.`TYPE` = 'PODMIOT')";break;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (!empty($word)) {
|
|
|
|
|
+ $sqlWord = DB::getPDO()->quote("%{$word}%", PDO::PARAM_STR);
|
|
|
|
|
+ if (is_numeric($word)) {
|
|
|
|
|
+ $sqlFilter .= "AND (g.`DESC` LIKE {$sqlWord} OR g.`ID` LIKE {$sqlWord})" . "\n";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $sqlFilter .= "AND g.`DESC` LIKE {$sqlWord}" . "\n";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- $rows = DB::getPDO()->fetchAll("
|
|
|
|
|
- select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
|
|
|
|
|
- from CRM_LISTA_ZASOBOW g
|
|
|
|
|
- left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
|
|
|
|
|
- left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
|
|
|
|
|
- left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
|
|
|
|
|
- where (g.`DESC` LIKE ".$word." OR g.`ID` LIKE ".$word.")
|
|
|
|
|
- ".$sqlFilter."
|
|
|
|
|
- LIMIT 0,100
|
|
|
|
|
- ");
|
|
|
|
|
- Response::sendJsonExit($rows);
|
|
|
|
|
- } catch (Exception $e) {
|
|
|
|
|
- UI::alert('danger', "Error: " . $e->getMessage());
|
|
|
|
|
|
|
+ switch ($filter) {
|
|
|
|
|
+ case 2: $sqlFilter .= "AND (g.`TYPE` = 'TABELA' OR g.`TYPE` = 'KOMORKA')" . "\n"; break;
|
|
|
|
|
+ case 1: $sqlFilter .= "AND (g.`TYPE` = 'STANOWISKO' OR g.`TYPE` = 'DZIAL' OR g.`TYPE` = 'PODMIOT')" . "\n"; break;
|
|
|
}
|
|
}
|
|
|
|
|
+ $sql = "
|
|
|
|
|
+ select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
|
|
|
|
|
+ from CRM_LISTA_ZASOBOW g
|
|
|
|
|
+ left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
|
|
|
|
|
+ left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
|
|
|
|
|
+ left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
|
|
|
|
|
+ where g.`A_STATUS` not in ('DELETED')
|
|
|
|
|
+ and (p1.ID is null or p1.`A_STATUS` not in ('DELETED'))
|
|
|
|
|
+ and (p2.ID is null or p2.`A_STATUS` not in ('DELETED'))
|
|
|
|
|
+ and (p3.ID is null or p3.`A_STATUS` not in ('DELETED'))
|
|
|
|
|
+ {$sqlFilter}
|
|
|
|
|
+ limit 100
|
|
|
|
|
+ ";
|
|
|
|
|
+ DBG::_('DBG_SQL', '>1', 'sql', $sql, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+ $rows = DB::getPDO()->fetchAll($sql);
|
|
|
|
|
+ Response::sendJsonExit($rows);
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ UI::alert('danger', "Error: " . $e->getMessage());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getSingleResAjaxReponseCallback() {
|
|
public function getSingleResAjaxReponseCallback() {
|
|
@@ -109,7 +121,7 @@ class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @se
|
|
|
<div id="wrapper" class="toggled" style="overflow:hidden">
|
|
<div id="wrapper" class="toggled" style="overflow:hidden">
|
|
|
<div id='sidebar-wrapper'><div id="side"></div></div>
|
|
<div id='sidebar-wrapper'><div id="side"></div></div>
|
|
|
<div id='page-content-wrapper'>
|
|
<div id='page-content-wrapper'>
|
|
|
- <div id="left" style='width:40px;'>
|
|
|
|
|
|
|
+ <div id="left">
|
|
|
|
|
|
|
|
<button class='lButton btn btn-default' id="btnZasoby" style="top:150px"><p>Zasoby</p></button>
|
|
<button class='lButton btn btn-default' id="btnZasoby" style="top:150px"><p>Zasoby</p></button>
|
|
|
<button class='lButton btn btn-default' style="top:315px" id="btnProcesy"><p>Procesy</p></button>
|
|
<button class='lButton btn btn-default' style="top:315px" id="btnProcesy"><p>Procesy</p></button>
|
|
@@ -122,8 +134,7 @@ class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @se
|
|
|
</div>
|
|
</div>
|
|
|
<script>var BASE_URL = '<?= Request::getPathUri(); ?>';var mainProces_id = <?= $id; ?>;</script>
|
|
<script>var BASE_URL = '<?= Request::getPathUri(); ?>';var mainProces_id = <?= $id; ?>;</script>
|
|
|
<script src="static/sweetalert2.min.js"></script>
|
|
<script src="static/sweetalert2.min.js"></script>
|
|
|
- <script src="static/procesEditor.js?v=16"></script>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <script src="static/procesEditor.js?v=17<?php if (V::get('DBG', '', $_GET)) echo "&_time=" . time(); ?>"></script>
|
|
|
<?php
|
|
<?php
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -196,6 +207,15 @@ class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @se
|
|
|
#wrapper.toggled {
|
|
#wrapper.toggled {
|
|
|
padding-left: 600px;
|
|
padding-left: 600px;
|
|
|
}
|
|
}
|
|
|
|
|
+#wrapper #left { width:40px }
|
|
|
|
|
+#wrapper #left .lButton {
|
|
|
|
|
+ width:40px;
|
|
|
|
|
+ -webkit-transition: all 0.5s ease;
|
|
|
|
|
+ -moz-transition: all 0.5s ease;
|
|
|
|
|
+ -o-transition: all 0.5s ease;
|
|
|
|
|
+ transition: all 0.5s ease;
|
|
|
|
|
+}
|
|
|
|
|
+#wrapper.toggled #left .lButton { width:39px }
|
|
|
#side {
|
|
#side {
|
|
|
padding: 15px;
|
|
padding: 15px;
|
|
|
height: 100%;
|
|
height: 100%;
|