asusg_settings_task.php 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834
  1. <?php
  2. defined('YII_DEBUG') or define('YII_DEBUG', true);
  3. defined('YII_ENV') or define('YII_ENV', 'dev');
  4. require __DIR__ . '/api/vendor/autoload.php';
  5. require __DIR__ . '/api/vendor/yiisoft/yii2/Yii.php';
  6. $config = require __DIR__ . '/api/config/web.php';
  7. (new yii\web\Application($config));
  8. require_once "doctrine/bootstrap.php";
  9. include 'CheckPoint.php';
  10. include 'CheckPointType.php';
  11. use CheckPoints\CheckPoint;
  12. use CheckPointTypes\CheckPointType;
  13. header("Expires: 0");
  14. header("Content-Type: text/html; charset=utf-8");
  15. session_start();
  16. if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 6000)) {
  17. // last request was more than 30 minutes ago
  18. session_unset(); // unset $_SESSION variable for the run-time
  19. session_destroy(); // destroy session data in storage
  20. }
  21. $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
  22. $add = 'Login Area';
  23. foreach (array_keys($_REQUEST) as $var) {
  24. ${$var} = $_REQUEST[$var];
  25. //if ($name == "Admin12") {
  26. // echo "<b>$var:</b> ${$var} <br>";
  27. //}
  28. }
  29. if ($act == "exit")
  30. {
  31. session_unset();
  32. session_destroy();
  33. session_start();
  34. }
  35. if ($_SESSION['cmdlevel'])
  36. $cmdlevel = $_SESSION['cmdlevel'];
  37. if ($_SESSION['hostid'])
  38. $agent_id = $_SESSION['hostid'];
  39. if ($_SESSION['add'])
  40. $add = $_SESSION['add'];
  41. if ($_SESSION['id'])
  42. $id = $_SESSION['id'];
  43. if ($_SESSION['login'])
  44. $login = $_SESSION['login'];
  45. if ($_SESSION['name'])
  46. $name = $_SESSION['name'];
  47. foreach (array_keys($_SESSION) as $var) {
  48. ${$var} = $_SESSION[$var];
  49. //if ($name == "Admin12") {
  50. //echo "from session: <b>$var:</b> ${$var} <br>";
  51. //}
  52. }
  53. include 'functions.php';
  54. include 'auth.php';
  55. $logged_me_in_successfully234 = 0;
  56. $incl = '';
  57. if (!$_SESSION['pass'] && !$_SESSION['login'])
  58. {
  59. $table = 'accounts';
  60. $result=mysqli_query($link, "SELECT id, login, name, cmdlevel FROM $table WHERE login='".$login."' AND password='".md5($pass)."'");
  61. $res1 = mysqli_fetch_array($result);
  62. $cmdlevel = $res1['cmdlevel'];
  63. $name = $res1['name'];
  64. $id = $res1['id'];
  65. if ($cmdlevel == '10')
  66. {
  67. $add = "Head Administrator";
  68. }
  69. else if ($cmdlevel == '1')
  70. {
  71. $add = "Company Administrator";
  72. }
  73. else if ($cmdlevel == '2')
  74. {
  75. $add = "Company Operator";
  76. }
  77. if (mysqli_num_rows($result))
  78. {
  79. $_SESSION['pass']=$pass;
  80. $_SESSION['login']=$login;
  81. $_SESSION['name']=$name;
  82. $_SESSION['add']=$add;
  83. $_SESSION['cmdlevel']=$cmdlevel;
  84. $_SESSION['id']=$id;
  85. $logged_me_in_successfully234 = 1;
  86. }
  87. }
  88. else
  89. $logged_me_in_successfully234 = 1;
  90. $query = mysqli_query($link, "update accounts set last_seen_web =NOW() where id=".$id);
  91. $getincl = GetInclude($act, intval($cmdlevel));
  92. $incl = $getincl[0];
  93. $accnum = $getincl[1];
  94. $status_id = \Yii::$app->request->get('status');
  95. ?>
  96. <!DOCTYPE html>
  97. <html lang="en">
  98. <head>
  99. <!-- Basic Page Needs
  100. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  101. <meta charset="utf-8">
  102. <title>ASUSG</title>
  103. <meta name="description" content="">
  104. <meta name="author" content="">
  105. <!-- Mobile Specific Metas
  106. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  107. <meta name="viewport" content="width=device-width, initial-scale=1">
  108. <!-- FONT
  109. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  110. <link rel="stylesheet" href="/lte/bower_components/bootstrap/dist/css/bootstrap.min.css">
  111. <!-- Font Awesome -->
  112. <link rel="stylesheet" href="/lte/bower_components/font-awesome/css/font-awesome.min.css">
  113. <!-- Ionicons -->
  114. <link rel="stylesheet" href="/lte/bower_components/Ionicons/css/ionicons.min.css">
  115. <!-- Theme style -->
  116. <link rel="stylesheet" href="/lte/dist/css/AdminLTE.min.css">
  117. <!-- AdminLTE Skins. Choose a skin from the css/skins
  118. folder instead of downloading all of them to reduce the load. -->
  119. <link rel="stylesheet" href="/lte/dist/css/skins/_all-skins.min.css">
  120. <!-- Morris chart -->
  121. <link rel="stylesheet" href="/lte/bower_components/morris.js/morris.css">
  122. <!-- jvectormap -->
  123. <link rel="stylesheet" href="/lte/bower_components/jvectormap/jquery-jvectormap.css">
  124. <!-- Date Picker -->
  125. <link rel="stylesheet" href="/lte/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  126. <!-- Daterange picker -->
  127. <link rel="stylesheet" href="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  128. <!-- bootstrap wysihtml5 - text editor -->
  129. <link rel="stylesheet" href="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
  130. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
  131. <link rel="stylesheet" href="/lte/bower_components/select2/dist/css/select2.min.css">
  132. </head>
  133. <body onload="accon(<? echo $accnum;?>)" >
  134. <!--<div style="min-width: 960px; height: 100%;">-->
  135. <?
  136. $post = \Yii::$app->request->post();
  137. $get_id = \Yii::$app->request->get('id');
  138. $mycompany = getCompanyByAccount($id);
  139. if (!isset($companyID))
  140. {
  141. // echo "ses com ".$_SESSION['company'];
  142. if ($_SESSION['company'])
  143. $companyID = $_SESSION['company'];
  144. else
  145. {
  146. $companyID = $mycompany[0];
  147. $_SESSION['company'] = $companyID;
  148. }
  149. }
  150. else
  151. {
  152. $_SESSION['company'] = $companyID;
  153. }
  154. $companyname = getCompanyByID($companyID)[1];
  155. if ((int)$_POST['appMykey'] == 123465) {$logged_me_in_successfully234 = 1;}
  156. if ($logged_me_in_successfully234 == 0)
  157. {
  158. echo "<center>";
  159. GetEnterForm();
  160. echo("<font color='red'><b>Access denied. Incorrect login or password</b><font>");
  161. echo "</center>";
  162. return;
  163. }
  164. //$asusgEmployeeEntity = \app\models\entity\AsusgEmployee::find()->orderBy(['name' => SORT_ASC])->all();
  165. $asusgEmployeeEntity = \app\models\entity\Accounts::find()->where(['company' => $companyID])->orderBy(['name' => SORT_ASC])->all();
  166. $asusgJobplanEntity = \app\models\entity\AsusgJobplan::find()->orderBy(['name' => SORT_ASC])->all();
  167. if ( null != $post['typefix'] and null != $post['loco_seria']) {
  168. $asusgProjectTypeEntity = \app\models\entity\AsusgProjectType::findOne(['repair_type' => explode('_',$post['typefix'])[0], 'loco_serie_id' => $post['loco_seria']]);
  169. $asusgJobsModel = (new \yii\db\Query())->select(['jobtype_id'])->from('asusg_job2command')->where(['asusg_projecttype_id' => $asusgProjectTypeEntity->id])->groupBy(['jobtype_id'])->all();
  170. $types = [];
  171. foreach( $asusgJobsModel as $model){
  172. $types[] = $model['jobtype_id'];
  173. }
  174. $jobtypesEntity = \app\models\entity\Jobtypes::find()->where(['id' => $types])->all();
  175. }
  176. else if( null != $get_id){
  177. $asusgJob2LaunchEntity = \app\models\entity\AsusgJob2Launch::find()->where(['asusg_project_id' => $get_id])->all();
  178. $asusgProjectsEntity = \app\models\entity\AsusgProject::findOne(['id' => $get_id]);
  179. $asusgProjectTypeEntity = \app\models\entity\AsusgProjectType::findOne(['repair_type' => $asusgProjectsEntity->repair_type, 'loco_serie_id' => $asusgProjectsEntity->loco_serie_id]);
  180. $asusgJobsModel = (new \yii\db\Query())->select(['jobtype_id'])->from('asusg_job2command')->where(['asusg_projecttype_id' => $asusgProjectTypeEntity->id])->groupBy(['jobtype_id'])->all();
  181. $types = [];
  182. foreach( $asusgJobsModel as $model){
  183. $types[] = $model['jobtype_id'];
  184. }
  185. $jobtypesEntity = \app\models\entity\Jobtypes::find()->where(['id' => $types])->all();
  186. }
  187. else {
  188. $asusgJob2ProjectEntity = \app\models\entity\AsusgJob2Project::find()->orderBy(['job_order' => SORT_ASC])->all();
  189. }
  190. $tasktypesEntity = \app\models\entity\Tasktypes::find()->where(['main_task' => 0,'company' => $companyID])->orderBy(['name' => SORT_ASC])->all();
  191. $locomotiveSeriesEntity = \app\models\entity\LocomotiveSeries::find()->orderBy(['name' => SORT_ASC])->all();
  192. $typeFix = \app\models\entity\Repairtypes::find()->all();
  193. //$typeFix = ['1' => 'TO-1','2' => 'TO-2','3' => 'TO-3','4' => 'TO-4','5' => 'TO-5',];
  194. //$projectsLocotechEntity = getLocomotiveList();
  195. $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(["!=", "uuid" , ''])->all();
  196. $series = LocoSeries::GetAllNames();
  197. $startPr = \Yii::$app->request->post('startPr');
  198. if( isset($startPr)) {
  199. $asusgProjectEntity = new \app\models\entity\AsusgProject();
  200. $asusgProjectEntity->loco_serie_id = \Yii::$app->request->post('loco_seria');
  201. $asusgProjectEntity->loco_number = \Yii::$app->request->post('loco_number');
  202. $asusgProjectEntity->repair_type = \Yii::$app->request->post('typefix');
  203. $asusgProjectEntity->section_a = \Yii::$app->request->post('section_a');
  204. $asusgProjectEntity->section_b = \Yii::$app->request->post('section_b');
  205. $asusgProjectEntity->section_c = \Yii::$app->request->post('section_c');
  206. try {
  207. $asusgProjectEntity->save();
  208. } catch (\yii\db\Exception $exception) {
  209. $loadFormError = 'Данные не сохранились.';
  210. }
  211. }
  212. ?>
  213. <!-- HTML -->
  214. <div class="wrapper">
  215. <header class="main-header">
  216. <!-- Logo -->
  217. <a href="/asusg_plan.php" class="logo">
  218. <!-- mini logo for sidebar mini 50x50 pixels -->
  219. <span class="logo-mini"><b>A</b>LT</span>
  220. <!-- logo for regular state and mobile devices -->
  221. <span class="logo-lg"><b>АСУ</b>СГ</span>
  222. </a>
  223. <!-- Header Navbar: style can be found in header.less -->
  224. <nav class="navbar navbar-static-top">
  225. <!-- Sidebar toggle button-->
  226. <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
  227. <span class="sr-only">Toggle navigation</span>
  228. </a>
  229. </nav>
  230. </header>
  231. <aside class="main-sidebar">
  232. <section class="sidebar">
  233. <form action="#" method="get" class="sidebar-form">
  234. <div class="input-group">
  235. <input type="text" name="q" class="form-control" placeholder="Search...">
  236. <span class="input-group-btn">
  237. <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
  238. </button>
  239. </span>
  240. </div>
  241. </form>
  242. <?php require_once 'asusg_menu.php';?>
  243. </section>
  244. </aside>
  245. <div class="content-wrapper">
  246. <section class="content-header">
  247. <h1>Список задач</h1>
  248. <ol class="breadcrumb">
  249. <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
  250. <li class="active">Dashboard</li>
  251. </ol>
  252. </section>
  253. <section class="content">
  254. <div class="row">
  255. <div class="col-md-12">
  256. <div class="nav-tabs-custom">
  257. <ul class="nav nav-tabs">
  258. <li class="active"><a href="#tab_1" data-toggle="tab">Новый вариант</a></li>
  259. <li><a href="#tab_2" data-toggle="tab">Альтернативный вариант</a></li>
  260. <li class="pull-right"><a href="#" class="text-muted"><i class="fa fa-gear"></i></a></li>
  261. </ul>
  262. <div class="tab-content">
  263. <!-- НАЧАЛО ПЕРВОЙ ВКЛАДКИ -->
  264. <div class="tab-pane active" id="tab_1">
  265. <div class="row">
  266. <div class="col-xs-12">
  267. <? //foreach( $asusgJobplanEntity as $template ):?>
  268. <div class="box box-primary">
  269. <div class="box-header with-border">
  270. <h3 class="box-title"><?php// echo $template->name;?></h3>
  271. <div class="box-tools pull-right">
  272. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  273. </button>
  274. </div>
  275. </div>
  276. <div class="box-body">
  277. <?php //var_dump($post);?>
  278. <form id="submit_editor_start_form" active="post" method="post">
  279. <div class="row">
  280. <div class="col-xs-3">
  281. <div class="form-group">
  282. <label for="exampleInputPassword1">Вид ремонта</label>
  283. <p><?php echo $asusgProjectsEntity->repairtypes->name;?></p>
  284. </div>
  285. </div>
  286. <div class="col-xs-3">
  287. <div class="form-group">
  288. <label for="exampleInputEmail1">Серия локомотива</label>
  289. <p><?php echo $asusgProjectsEntity->locomotiveSeries->name;?></p>
  290. </div>
  291. </div>
  292. <div class="col-xs-3">
  293. <div id="error_number_input" class="form-group">
  294. <label for="exampleInputPassword1">Номер локомотива</label>
  295. <p><?php echo $asusgProjectsEntity->loco_number;?></p>
  296. </div>
  297. </div>
  298. <div class="col-xs-3">
  299. <div class="form-group">
  300. <label for="exampleInputPassword1">8-ми знак: Секция А</label>
  301. <input type="text" class="form-control" id="numberA" name="section_a" value="<?php echo $asusgProjectsEntity->section_a;?>">
  302. </div>
  303. </div>
  304. <div class="col-xs-3">
  305. <!-- <div class="form-group">
  306. <label for="exampleInputPassword1">Редактировать проект</label>
  307. <button id="submit_editor_start" type="button" class="btn btn-block btn-primary bindProjectTypes" >Редактировать</button>
  308. </div>-->
  309. </div>
  310. <div class="col-xs-3 col-xs-offset-6">
  311. <div class="form-group">
  312. <label for="exampleInputPassword1">8-ми знак: Секция Б</label>
  313. <input type="text" class="form-control" id="numberB" name="section_b" value="<?php echo $asusgProjectsEntity->section_b;?>">
  314. </div>
  315. </div>
  316. <div class="col-xs-3 col-xs-offset-9">
  317. <div class="form-group">
  318. <label for="exampleInputPassword1">8-ми знак: Секция В</label>
  319. <input type="text" class="form-control" id="numberB" name="section_c" value="<?php echo $asusgProjectsEntity->section_c;?>">
  320. </div>
  321. </div>
  322. </div>
  323. <div class="row">
  324. <div class="col-xs-2">
  325. </div>
  326. </div>
  327. </form>
  328. <form id="start_proj" active="post">
  329. <div id="jobs_create_list" class="box-body" >
  330. <div class="row">
  331. <ul id="sortable" class="list-unstyled list_asusg_command_<?php echo $template->asusg_id;?> sortable job_container">
  332. <? $i = 100;?>
  333. <? foreach ($asusgJob2LaunchEntity as $item):?>
  334. <li id="li_<?php echo $item->asusg_project_id;?>_<?php echo $item->asusg_jobplan_id;?>_<? echo $i;?>" class="ui-state-default" data_id="<?php echo $item->asusg_project_id;?>_<?php echo $item->asusg_jobplan_id;?>_<? echo $i;?>">
  335. <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
  336. <div class="box box-warning">
  337. <div class="box-header with-border">
  338. <h3 class="box-title"><?php //echo $item->tasktypes->name;?></h3>
  339. <div class="box-tools pull-right">
  340. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  341. <button type="button" class="btn btn-box-tool remove_command_button" data-widget="remove" data_id="<?php echo $item->asusg_project_id;?>_<?php echo $item->asusg_jobplan_id;?>_<? echo $i;?>"><i class="fa fa-times"></i></button>
  342. <div class="col-xs-3 ">
  343. <div class="form-group">
  344. <label>Работы АСУ СГ</label>
  345. <select class="form-control select2" style="width: 100%;" <? if ( 1 == $status_id):?> name="newListJ_<? echo $i;?>"<? endif;?> >
  346. <? foreach( $asusgJobplanEntity as $plan):?>
  347. <option value="<?php echo $plan->id?>" <? if ( $plan->id == $item->asusgJobplan->id) { echo "selected=selected";}?>><?php echo $plan->name?></option>
  348. <? endforeach;?>
  349. </select>
  350. </div>
  351. </div>
  352. <div class="col-xs-2 col-xs-offset-2">
  353. <div class="form-group">
  354. <label>Сотрудник 1</label>
  355. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  356. <option value='0'>-- Список сотрудников --</option>
  357. <? foreach( $asusgEmployeeEntity as $plan):?>
  358. <option value="<?php echo $plan->id?>" <?php echo ($item-> asusg_employee_id1 == $plan->id)?'selected="selected"':'';?>><?php echo $plan->name?></option>
  359. <? endforeach;?>
  360. </select>
  361. </div>
  362. <div class="form-group">
  363. <label>Должность 1</label>
  364. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  365. <option value='0'>-- Список должностей --</option>
  366. <? foreach( $jobtypesEntity as $job):?>
  367. <option value="<?php echo $job->id?>" <?php echo ($item->jobtype_id1 == $job->id)?'selected="selected"':'';?>><?php echo $job->name?></option>
  368. <? endforeach;?>
  369. </select>
  370. </div>
  371. </div>
  372. <div class="col-xs-2 ">
  373. <div class="form-group">
  374. <label>Сотрудник 2</label>
  375. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  376. <option value='0'>-- Список сотрудников --</option>
  377. <? foreach( $asusgEmployeeEntity as $plan):?>
  378. <option value="<?php echo $plan->id?>" <?php echo ($item-> asusg_employee_id2 == $plan->id)?'selected="selected"':'';?>><?php echo $plan->name?></option>
  379. <? endforeach;?>
  380. </select>
  381. </div>
  382. <div class="form-group">
  383. <label>Должность 2</label>
  384. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  385. <option value='0'>-- Список должностей --</option>
  386. <? foreach( $jobtypesEntity as $job):?>
  387. <option value="<?php echo $job->id?>" <?php echo ($item->jobtype_id2 == $job->id)?'selected="selected"':'';?>><?php echo $job->name?></option>
  388. <? endforeach;?>
  389. </select>
  390. </div>
  391. </div>
  392. <div class="col-xs-2 ">
  393. <div class="form-group">
  394. <label>Сотрудник 3</label>
  395. <select class="form-control select2" style="width: 100%;" name="newList3_<? echo $i;?>">
  396. <option value='0'>-- Список сотрудников --</option>
  397. <? foreach( $asusgEmployeeEntity as $plan):?>
  398. <option value="<?php echo $plan->id?>" <?php echo ($item-> asusg_employee_id3 == $plan->id)?'selected="selected"':'';?>><?php echo $plan->name?></option>
  399. <? endforeach;?>
  400. </select>
  401. </div>
  402. <div class="form-group">
  403. <label>Должность 3</label>
  404. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  405. <option value='0'>-- Список должностей --</option>
  406. <? foreach( $jobtypesEntity as $job):?>
  407. <option value="<?php echo $job->id?>" <?php echo ($item->jobtype_id3 == $job->id)?'selected="selected"':'';?>><?php echo $job->name?></option>
  408. <? endforeach;?>
  409. </select>
  410. </div>
  411. </div>
  412. </div>
  413. </div>
  414. </div>
  415. </li>
  416. <? $i++;?>
  417. <? endforeach;?>
  418. <? foreach ([]/*$asusgProjectTypeEntity->job2Project*/ as $item):?>
  419. <? //if ($item->asusg_job_id == $template->asusg_id):?>
  420. <li id="li_<?php echo $item->asusg_projecttype_id;?>_<?php echo $item->asusg_jobplan_id;?>_<? echo $i;?>" class="ui-state-default" data_id="<?php echo $item->asusg_projecttype_id;?>_<?php echo $item->asusg_jobplan_id;?>_<? echo $i;?>">
  421. <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
  422. <div class="box box-warning">
  423. <div class="box-header with-border">
  424. <h3 class="box-title"><?php //echo $item->tasktypes->name;?></h3>
  425. <div class="box-tools pull-right">
  426. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  427. <button type="button" class="btn btn-box-tool remove_command_button" data-widget="remove" data_id="<?php echo $item->asusg_projecttype_id;?>_<?php echo $item->asusg_jobplan_id;?>_<? echo $i;?>"><i class="fa fa-times"></i></button>
  428. <div class="col-xs-3 ">
  429. <div class="form-group">
  430. <label>Работы АСУ СГ</label>
  431. <select class="form-control select2" style="width: 100%;" name="newListJ_<? echo $i;?>">
  432. <? foreach( $asusgJobplanEntity as $plan):?>
  433. <option value="<?php echo $plan->id?>" <? if ( $plan->id == $item->jobplan->id) { echo "selected=selected";}?>><?php echo $plan->name?></option>
  434. <? endforeach;?>
  435. </select>
  436. </div>
  437. </div>
  438. <div class="col-xs-2 col-xs-offset-2">
  439. <div class="form-group">
  440. <label>Сотрудник 1</label>
  441. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  442. <option value='0'>-- Список сотрудников --</option>
  443. <? foreach( $asusgEmployeeEntity as $plan):?>
  444. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  445. <? endforeach;?>
  446. </select>
  447. </div>
  448. <div class="form-group">
  449. <label>Должность 1</label>
  450. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  451. <option value='0'>-- Список должностей --</option>
  452. <? foreach( $jobtypesEntity as $job):?>
  453. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  454. <? endforeach;?>
  455. </select>
  456. </div>
  457. </div>
  458. <div class="col-xs-2 ">
  459. <div class="form-group">
  460. <label>Сотрудник 2</label>
  461. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  462. <option value='0'>-- Список сотрудников --</option>
  463. <? foreach( $asusgEmployeeEntity as $plan):?>
  464. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  465. <? endforeach;?>
  466. </select>
  467. </div>
  468. <div class="form-group">
  469. <label>Должность 2</label>
  470. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  471. <option value='0'>-- Список должностей --</option>
  472. <? foreach( $jobtypesEntity as $job):?>
  473. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  474. <? endforeach;?>
  475. </select>
  476. </div>
  477. </div>
  478. <div class="col-xs-2 ">
  479. <div class="form-group">
  480. <label>Сотрудник 3</label>
  481. <select class="form-control select2" style="width: 100%;" name="newList3_<? echo $i;?>">
  482. <option value='0'>-- Список сотрудников --</option>
  483. <? foreach( $asusgEmployeeEntity as $plan):?>
  484. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  485. <? endforeach;?>
  486. </select>
  487. </div>
  488. </div>
  489. </div>
  490. </div>
  491. </div>
  492. </li>
  493. <? //endif;?>
  494. <? $i++;?>
  495. <? endforeach;?>
  496. </ul>
  497. </div>
  498. </div>
  499. <div class="box-body" >
  500. <div class="row">
  501. <div class="col-xs-2">
  502. <div class="form-group">
  503. <button id="add_jobs_part" type="button" class="btn btn-block btn-success " >Добавить работу</button>
  504. </div>
  505. </div>
  506. </div>
  507. <div class="row">
  508. <div class="col-xs-2">
  509. <div class="form-group">
  510. <label for="exampleInputPassword1">Запустить команду</label>
  511. <button id="submit_start_proj" type="button" class="btn btn-block btn-danger bindProjectTypes" data="<?php echo \Yii::$app->request->get('id');?>">Спланировать</button>
  512. </div>
  513. <div class="form-group">
  514. <? if ($loadFormError):?>
  515. <p><?php echo $loadFormError;?></p>
  516. <? endif;?>
  517. <label for="exampleInputPassword1">Запустить проект</label>
  518. <button id="submit_go_go_proj" class="btn btn-block btn-primary disabled" user_id="<?php echo $id;?>" data="<?php echo \Yii::$app->request->get('id');?>">Запустить</button>
  519. </div>
  520. </div>
  521. </div>
  522. </div>
  523. </form>
  524. </div>
  525. </div>
  526. <? //endforeach;?>
  527. </div>
  528. </div>
  529. </div>
  530. <!-- КОНЕЦ ПЕРВОЙ ВКЛАДКИ -->
  531. <!-- НАЧАЛО ВТОРОЙ ВКЛАДКИ -->
  532. <div class="tab-pane" id="tab_2">
  533. dgdgfsdfg
  534. </div>
  535. <!-- КОНЕЦ ВТОРОЙ ВКЛАДКИ -->
  536. </div>
  537. </div>
  538. </div>
  539. </div>
  540. </section>
  541. <!-- /.content -->
  542. </div>
  543. <!-- /.content-wrapper -->
  544. <footer class="main-footer">
  545. </footer>
  546. <!-- Add the sidebar's background. This div must be placed
  547. immediately after the control sidebar -->
  548. <div class="control-sidebar-bg"></div>
  549. </div>
  550. <!-- HTML -->
  551. <div class="ASU_select0" style="display:none">
  552. <select class="form-control select2 hide_field_select_0" style="width: 100%;" name="newListJ_<? echo $i;?>">
  553. <? foreach( $asusgJobplanEntity as $plan):?>
  554. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  555. <? endforeach;?>
  556. </select>
  557. </div>
  558. <div class="ASU_select1" style="display:none">
  559. <select class="form-control select2 hide_field_select_1" style="width: 100%;" name="newList1_<? echo $i;?>">
  560. <option value='0'>-- Список сотрудников --</option>
  561. <? foreach( $asusgEmployeeEntity as $plan):?>
  562. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  563. <? endforeach;?>
  564. </select>
  565. </div>
  566. <div class="ASU_select1_j" style="display:none">
  567. <select class="form-control select2 hide_field_select_1_j" style="width: 100%;" name="newList1j_<? echo $i;?>">
  568. <option value='0'>-- Список должностей --</option>
  569. <? foreach( $jobtypesEntity as $job):?>
  570. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  571. <? endforeach;?>
  572. </select>
  573. </div>
  574. <div class="ASU_select2" style="display:none">
  575. <select class="form-control select2 hide_field_select_2" style="width: 100%;" name="newList2_<? echo $i;?>">
  576. <option value='0'>-- Список сотрудников --</option>
  577. <? foreach( $asusgEmployeeEntity as $plan):?>
  578. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  579. <? endforeach;?>
  580. </select>
  581. </div>
  582. <div class="ASU_select2_j" style="display:none">
  583. <select class="form-control select2 hide_field_select_2_j" style="width: 100%;" name="newList2j_<? echo $i;?>">
  584. <option value='0'>-- Список должностей --</option>
  585. <? foreach( $jobtypesEntity as $job):?>
  586. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  587. <? endforeach;?>
  588. </select>
  589. </div>
  590. <div class="ASU_select3" style="display:none">
  591. <select class="form-control select2 hide_field_select_3" style="width: 100%;" name="newList3_<? echo $i;?>">
  592. <option value='0'>-- Список сотрудников --</option>
  593. <? foreach( $asusgEmployeeEntity as $plan):?>
  594. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  595. <? endforeach;?>
  596. </select>
  597. </div>
  598. <div class="ASU_select3_j" style="display:none">
  599. <select class="form-control select2 hide_field_select_3_j" style="width: 100%;" name="newList3j_<? echo $i;?>">
  600. <option value='0'>-- Список должностей --</option>
  601. <? foreach( $jobtypesEntity as $job):?>
  602. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  603. <? endforeach;?>
  604. </select>
  605. </div>
  606. <!-- End Document
  607. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  608. <script src="/lte/bower_components/jquery/dist/jquery.min.js"></script>
  609. <!-- jQuery UI 1.11.4 -->
  610. <script src="/lte/bower_components/jquery-ui/jquery-ui.min.js"></script>
  611. <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  612. <script>
  613. $.widget.bridge('uibutton', $.ui.button);
  614. </script>
  615. <!-- Bootstrap 3.3.7 -->
  616. <script src="/lte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  617. <!-- Morris.js charts -->
  618. <script src="/lte/bower_components/raphael/raphael.min.js"></script>
  619. <script src="/lte/bower_components/morris.js/morris.min.js"></script>
  620. <!-- Sparkline -->
  621. <script src="/lte/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
  622. <!-- jvectormap -->
  623. <script src="/lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
  624. <script src="/lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
  625. <!-- jQuery Knob Chart -->
  626. <script src="/lte/bower_components/jquery-knob/dist/jquery.knob.min.js"></script>
  627. <!-- daterangepicker -->
  628. <script src="/lte/bower_components/moment/min/moment.min.js"></script>
  629. <script src="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
  630. <!-- datepicker -->
  631. <script src="/lte/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
  632. <!-- Bootstrap WYSIHTML5 -->
  633. <script src="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
  634. <!-- Slimscroll -->
  635. <script src="/lte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
  636. <!-- FastClick -->
  637. <script src="/lte/bower_components/fastclick/lib/fastclick.js"></script>
  638. <!-- AdminLTE App -->
  639. <script src="/lte/dist/js/adminlte.min.js"></script>
  640. <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  641. <script src="/lte/dist/js/pages/dashboard.js"></script>
  642. <!-- AdminLTE for demo purposes -->
  643. <script src="/lte/dist/js/demo.js"></script>
  644. <script src="/loco.js"></script>
  645. <script src="/mail.js"></script>
  646. <script src="/lte/bower_components/select2/dist/js/select2.full.min.js"></script>
  647. <script>
  648. $( function() {
  649. $( ".sortable" ).sortable();
  650. $( ".sortable" ).disableSelection();
  651. } );
  652. </script>
  653. </body>
  654. </html>
  655. <?php
  656. function GetEnterForm()
  657. {
  658. echo "<article>
  659. <form method='post' action='?login'>
  660. <table>
  661. <tr>
  662. <td width=70>
  663. <b>Login</b>
  664. </td>
  665. <td>
  666. &nbsp;
  667. </td>
  668. <td>
  669. <input type='text' name=login value=''><br/>
  670. </td>
  671. </tr>
  672. <tr>
  673. <td>
  674. <b>Password </b>
  675. </td>
  676. <td>
  677. &nbsp;
  678. </td>
  679. <td>
  680. <input type='password' name=pass value=''>
  681. </td>
  682. </tr>
  683. <tr>
  684. <td></td>
  685. <td>&nbsp;</td>
  686. <td>
  687. <input type='submit' value='Enter'>
  688. </td>
  689. </tr>
  690. </table>
  691. </form>
  692. </article>";
  693. }
  694. function getLocomotiveList(){
  695. $result = [];
  696. //var_dump($companyID);
  697. $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(['company' => 2] )->orderBy(['id' => SORT_DESC])->all();
  698. $listArray = [];
  699. foreach( $projectsLocotechEntity as $item){ //var_dump($item->projecttypes->name);echo "\n";
  700. //$tempArray = GetTasksForProject($item->id);
  701. $status = GetProjectStatus($item->id);
  702. if ($status != 2 && $status != 1) {continue;}
  703. $countDone = ['done' => 0, 'all' => 0 ];
  704. foreach( GetTasksForProject($item->id) as $proj) { //var_dump($proj);echo "<br>";
  705. $countDone['all']++;
  706. $tempArray = $proj;
  707. $tempArray['status'] = CheckAcceptedStatus($proj);
  708. $tempArray['name'] = GetTaskNameAndDesc($proj['type'])[0];
  709. //$tempArray['listAccounts'] = $this->getAccountListForTask($proj['type']);
  710. if ( 5 == $tempArray['status'] ) {$countDone['done']++;}
  711. //$countDone['all'] ." / " . $countDone['done'];
  712. $listArray[] = $tempArray;
  713. }
  714. $result[$item->id]['countDone'] = [ 'done' => $countDone['done'], 'all' => $countDone['all'] ];
  715. //$tempArray['name'] = GetTaskNameAndDesc($tempArray['type'])[0];
  716. $result[$item->id]['arr'] = $listArray;//GetTasksForProject($item->id);
  717. $result[$item->id]['obj'] = $item;
  718. $listArray = [];
  719. }
  720. //exit;
  721. return $result;
  722. }
  723. function CheckAcceptedStatus($task) {
  724. $result = false;
  725. $query = "select if(tx.total = tx.finished, 5, if (tx.accepted <> tx.finished, if(tx.attention > 0, 7, 2), if (tx.accepted = 0, 1, 3))) as taskstatus
  726. from (select count(t.id) as total,
  727. sum(if(t.accepted_time is not null, 1, 0)) as accepted,
  728. sum(if(t.finished_time is not null, 1, 0)) as finished,
  729. sum(if(t.finished_time is null, if(timestampdiff(MINUTE, t.accepted_time, NOW()) > tt.time_to_complete_minutes, 1, 0), 0)) as attention
  730. from tasks t
  731. right join tasktypes tt on t.type = tt.id
  732. where t.parent_id = ".$task['id'].") tx;";
  733. $result = \Yii::$app->db->createCommand($query)->queryAll();
  734. $result = $result[0]["taskstatus"];
  735. return $result;
  736. }
  737. ?>