asusg_settings_task_cmpl.php 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  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. //$asusgJob2ProjectEntity = \app\models\entity\AsusgJob2Project::find()->where(['asusg_projecttype_id' => $post['typefix'], 'asusg_jobplan_id' => $post['loco_seria']])->orderBy(['job_order' => SORT_ASC])->all();
  170. }
  171. else if( null != $get_id){
  172. $asusgProjectTypeEntity = \app\models\entity\AsusgJob2Launch::find()->where(['asusg_project_id' => $get_id])->all();
  173. $asusgProjectsEntity = \app\models\entity\AsusgProject::findOne(['id' => $get_id]);
  174. }
  175. else {
  176. $asusgJob2ProjectEntity = \app\models\entity\AsusgJob2Command::find()->orderBy(['job_order' => SORT_ASC])->all();
  177. }
  178. $tasktypesEntity = \app\models\entity\Tasktypes::find()->where(['main_task' => 0,'company' => $companyID])->orderBy(['name' => SORT_ASC])->all();
  179. $locomotiveSeriesEntity = \app\models\entity\LocomotiveSeries::find()->orderBy(['name' => SORT_ASC])->all();
  180. $typeFix = \app\models\entity\Repairtypes::find()->all();
  181. //$typeFix = ['1' => 'TO-1','2' => 'TO-2','3' => 'TO-3','4' => 'TO-4','5' => 'TO-5',];
  182. //$projectsLocotechEntity = getLocomotiveList();
  183. $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(["!=", "uuid" , ''])->all();
  184. $series = LocoSeries::GetAllNames();
  185. /*
  186. $startPr = \Yii::$app->request->post('startPr');
  187. if( isset($startPr)) {
  188. $asusgProjectEntity = new \app\models\entity\AsusgProject();
  189. $asusgProjectEntity->loco_serie_id = \Yii::$app->request->post('loco_seria');
  190. $asusgProjectEntity->loco_number = \Yii::$app->request->post('loco_number');
  191. $asusgProjectEntity->repair_type = \Yii::$app->request->post('typefix');
  192. $asusgProjectEntity->section_a = \Yii::$app->request->post('section_a');
  193. $asusgProjectEntity->section_b = \Yii::$app->request->post('section_b');
  194. $asusgProjectEntity->section_c = \Yii::$app->request->post('section_c');
  195. try {
  196. $asusgProjectEntity->save();
  197. } catch (\yii\db\Exception $exception) {
  198. $loadFormError = 'Данные не сохранились.';
  199. }
  200. }
  201. */
  202. $percent = getCompliteStatus();
  203. ?>
  204. <!-- HTML -->
  205. <div class="wrapper">
  206. <header class="main-header">
  207. <!-- Logo -->
  208. <a href="/asusg_plan.php" class="logo">
  209. <!-- mini logo for sidebar mini 50x50 pixels -->
  210. <span class="logo-mini"><b>A</b>LT</span>
  211. <!-- logo for regular state and mobile devices -->
  212. <span class="logo-lg"><b>АСУ</b>СГ</span>
  213. </a>
  214. <!-- Header Navbar: style can be found in header.less -->
  215. <nav class="navbar navbar-static-top">
  216. <!-- Sidebar toggle button-->
  217. <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
  218. <span class="sr-only">Toggle navigation</span>
  219. </a>
  220. </nav>
  221. </header>
  222. <aside class="main-sidebar">
  223. <section class="sidebar">
  224. <form action="#" method="get" class="sidebar-form">
  225. <div class="input-group">
  226. <input type="text" name="q" class="form-control" placeholder="Search...">
  227. <span class="input-group-btn">
  228. <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
  229. </button>
  230. </span>
  231. </div>
  232. </form>
  233. <?php require_once 'asusg_menu.php';?>
  234. </section>
  235. </aside>
  236. <div class="content-wrapper">
  237. <section class="content-header">
  238. <h1>Список задач</h1>
  239. <ol class="breadcrumb">
  240. <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
  241. <li class="active">Dashboard</li>
  242. </ol>
  243. </section>
  244. <section class="content">
  245. <div class="row">
  246. <div class="col-md-12">
  247. <div class="nav-tabs-custom">
  248. <ul class="nav nav-tabs">
  249. <li class="active"><a href="#tab_1" data-toggle="tab">Новый вариант</a></li>
  250. <li><a href="#tab_2" data-toggle="tab">Альтернативный вариант</a></li>
  251. <li class="pull-right"><a href="#" class="text-muted"><i class="fa fa-gear"></i></a></li>
  252. </ul>
  253. <div class="tab-content">
  254. <!-- НАЧАЛО ПЕРВОЙ ВКЛАДКИ -->
  255. <div class="tab-pane active" id="tab_1">
  256. <div class="row">
  257. <div class="col-xs-12">
  258. <? //foreach( $asusgJobplanEntity as $template ):?>
  259. <div class="box box-primary">
  260. <div class="box-header with-border">
  261. <h3 class="box-title"><?php// echo $template->name;?></h3>
  262. <div class="box-tools pull-right">
  263. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  264. </button>
  265. </div>
  266. </div>
  267. <div class="box-body">
  268. <?php //var_dump($post);?>
  269. <form id="submit_editor_start_form" active="post" method="post">
  270. <div class="row">
  271. <div class="col-xs-3">
  272. <div class="form-group">
  273. <label for="exampleInputPassword1">Вид ремонта</label>
  274. <p><?php echo $asusgProjectsEntity->repairtypes->name;?></p>
  275. </div>
  276. </div>
  277. <div class="col-xs-3">
  278. <div class="form-group">
  279. <label for="exampleInputEmail1">Серия локомотива</label>
  280. <p><?php echo $asusgProjectsEntity->locomotiveSeries->name;?></p>
  281. </div>
  282. </div>
  283. <div class="col-xs-3">
  284. <div id="error_number_input" class="form-group">
  285. <label for="exampleInputPassword1">Номер локомотива</label>
  286. <p><?php echo $asusgProjectsEntity->loco_number;?></p>
  287. </div>
  288. </div>
  289. <div class="col-xs-3">
  290. <div class="form-group">
  291. <label for="exampleInputPassword1">8-ми знак: Секция А</label>
  292. <input type="text" class="form-control" id="numberA" name="section_a">
  293. </div>
  294. </div>
  295. <div class="col-xs-3">
  296. <!-- <div class="form-group">
  297. <label for="exampleInputPassword1">Редактировать проект</label>
  298. <button id="submit_editor_start" type="button" class="btn btn-block btn-primary bindProjectTypes" >Редактировать</button>
  299. </div>-->
  300. </div>
  301. <div class="col-xs-3 col-xs-offset-6">
  302. <div class="form-group">
  303. <label for="exampleInputPassword1">8-ми знак: Секция Б</label>
  304. <input type="text" class="form-control" id="numberB" name="section_b">
  305. </div>
  306. </div>
  307. <div class="col-xs-3 col-xs-offset-9">
  308. <div class="form-group">
  309. <label for="exampleInputPassword1">8-ми знак: Секция В</label>
  310. <input type="text" class="form-control" id="numberB" name="section_c">
  311. </div>
  312. </div>
  313. </div>
  314. <div class="row">
  315. <div class="col-xs-2">
  316. </div>
  317. </div>
  318. </form>
  319. <form id="start_proj" active="post">
  320. <div id="jobs_create_list" class="box-body" >
  321. <div class="row">
  322. <div class="box-body">
  323. <table class="table table-bordered">
  324. <tbody>
  325. <tr>
  326. <th >Работы АСУ СГ</th>
  327. <th>Процент выполнения работы</th>
  328. <th>Сотрудник 1</th>
  329. <th >Сотрудник 2</th>
  330. <th >Сотрудник 3</th>
  331. </tr>
  332. <? foreach ($asusgProjectTypeEntity as $item):?>
  333. <? $employeesCount = ((0 < $item->asusg_employee_id1) ? 1 : 0) + ((0 < $item->asusg_employee_id2) ? 1 : 0) + ((0 < $item->asusg_employee_id3) ? 1 : 0);?>
  334. <? $completedPercent = $percent[$item->id]; ?>
  335. <tr>
  336. <td>
  337. <? foreach( $asusgJobplanEntity as $plan):?>
  338. <? if ( $plan->id == $item->asusgJobplan->id):?>
  339. <?php echo $plan->name?>
  340. <? endif; ?>
  341. <? endforeach;?>
  342. </td>
  343. <? if ($completedPercent == 0.0)
  344. {
  345. echo '<td>';
  346. }
  347. else if ($completedPercent >= 100.0)
  348. {
  349. echo '<td style="background:lightgreen;">';
  350. }
  351. else
  352. {
  353. echo '<td style="background:yellow;">';
  354. }
  355. ?>
  356. <p><?php echo number_format((float)$completedPercent, 2, '.', '');?> %</p>
  357. </td>
  358. <td>
  359. <? foreach( $asusgEmployeeEntity as $plan):?>
  360. <? echo ( $plan->id == $item->asusg_employee_id1)? (''.$plan->name . '<br>' . number_format((float)$completedPercent / $employeesCount, 2, '.', '')).' %' : '';?>
  361. <? endforeach;?>
  362. </td>
  363. <td>
  364. <? foreach( $asusgEmployeeEntity as $plan):?>
  365. <? echo ( $plan->id == $item->asusg_employee_id2)? (''.$plan->name . '<br>' . number_format((float)$completedPercent / $employeesCount, 2, '.', '')).' %' :'';?>
  366. <? endforeach;?>
  367. </td>
  368. <td>
  369. <? foreach( $asusgEmployeeEntity as $plan):?>
  370. <? echo ( $plan->id == $item->asusg_employee_id3)? (''.$plan->name . '<br>' . number_format((float)$completedPercent / $employeesCount, 2, '.', '')).' %' :'';?>
  371. <? endforeach;?>
  372. </td>
  373. </tr>
  374. <? endforeach;?>
  375. </tbody>
  376. </table>
  377. </div>
  378. <ul id="sortable" class="list-unstyled list_asusg_command_<?php echo $template->asusg_id;?> sortable job_container">
  379. <? $i = 100;?>
  380. <? $asusgProjectTypeEntity = [];?>
  381. <? foreach ($asusgProjectTypeEntity as $item):?>
  382. <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;?>">
  383. <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
  384. <div class="box box-warning">
  385. <div class="box-header with-border">
  386. <h3 class="box-title"><?php //echo $item->tasktypes->name;?></h3>
  387. <div class="box-tools pull-right">
  388. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  389. <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>
  390. <div class="col-xs-2 ">
  391. <div class="form-group">
  392. <label>Работы АСУ СГ</label>
  393. <select class="form-control select2" style="width: 100%;" <? if ( 1 == $status_id):?> name="newListJ_<? echo $i;?>" <? endif;?>>
  394. <? foreach( $asusgJobplanEntity as $plan):?>
  395. <option value="<?php echo $plan->id?>" <? if ( $plan->id == $item->asusgJobplan->id) { echo "selected=selected";}?>><?php echo $plan->name?></option>
  396. <? endforeach;?>
  397. </select>
  398. </div>
  399. </div>
  400. <div class="col-xs-2 ">
  401. <div class="form-group">
  402. <label>Процент выполнения работы</label>
  403. <p><?php echo $percent[$item->id];?> %</p>
  404. </div>
  405. </div>
  406. <div class="col-xs-2 col-xs-offset-1">
  407. <div class="form-group">
  408. <label>Сотрудник 1</label>
  409. <select class="form-control select2" style="width: 100%;" <? if ( 1 == $status_id):?> name="newList1_<? echo $i;?>" <? endif;?>>
  410. <option value='0'>-- Список сотрудников --</option>
  411. <? foreach( $asusgEmployeeEntity as $plan):?>
  412. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  413. <? endforeach;?>
  414. </select>
  415. </div>
  416. </div>
  417. <div class="col-xs-2 ">
  418. <div class="form-group">
  419. <label>Сотрудник 2</label>
  420. <select class="form-control select2" style="width: 100%;" <? if ( 1 == $status_id):?> name="newList2_<? echo $i;?>" <? endif;?>>
  421. <option value='0'>-- Список сотрудников --</option>
  422. <? foreach( $asusgEmployeeEntity as $plan):?>
  423. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  424. <? endforeach;?>
  425. </select>
  426. </div>
  427. </div>
  428. <div class="col-xs-2 ">
  429. <div class="form-group">
  430. <label>Сотрудник 3</label>
  431. <select class="form-control select2" style="width: 100%;" <? if ( 1 == $status_id):?> name="newList3_<? echo $i;?>" <? endif;?>>
  432. <option value='0'>-- Список сотрудников --</option>
  433. <? foreach( $asusgEmployeeEntity as $plan):?>
  434. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  435. <? endforeach;?>
  436. </select>
  437. </div>
  438. </div>
  439. </div>
  440. </div>
  441. </div>
  442. </li>
  443. <? $i++;?>
  444. <? endforeach;?>
  445. <? foreach ($asusgProjectTypeEntity->job2Project as $item):?>
  446. <? //if ($item->asusg_job_id == $template->asusg_id):?>
  447. <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;?>">
  448. <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
  449. <div class="box box-warning">
  450. <div class="box-header with-border">
  451. <h3 class="box-title"><?php //echo $item->tasktypes->name;?></h3>
  452. <div class="box-tools pull-right">
  453. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  454. <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>
  455. <div class="col-xs-3 ">
  456. <div class="form-group">
  457. <label>Работы АСУ СГ</label>
  458. <select class="form-control select2" style="width: 100%;" name="newListJ_<? echo $i;?>">
  459. <? foreach( $asusgJobplanEntity as $plan):?>
  460. <option value="<?php echo $plan->id?>" <? if ( $plan->id == $item->jobplan->id) { echo "selected=selected";}?>><?php echo $plan->name?></option>
  461. <? endforeach;?>
  462. </select>
  463. </div>
  464. </div>
  465. <div class="col-xs-2 col-xs-offset-2">
  466. <div class="form-group">
  467. <label>Сотрудник 1</label>
  468. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  469. <option value='0'>-- Список сотрудников --</option>
  470. <? foreach( $asusgEmployeeEntity as $plan):?>
  471. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  472. <? endforeach;?>
  473. </select>
  474. </div>
  475. </div>
  476. <div class="col-xs-2 ">
  477. <div class="form-group">
  478. <label>Сотрудник 2</label>
  479. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  480. <option value='0'>-- Список сотрудников --</option>
  481. <? foreach( $asusgEmployeeEntity as $plan):?>
  482. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  483. <? endforeach;?>
  484. </select>
  485. </div>
  486. </div>
  487. <div class="col-xs-2 ">
  488. <div class="form-group">
  489. <label>Сотрудник 3</label>
  490. <select class="form-control select2" style="width: 100%;" name="newList3_<? echo $i;?>">
  491. <option value='0'>-- Список сотрудников --</option>
  492. <? foreach( $asusgEmployeeEntity as $plan):?>
  493. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  494. <? endforeach;?>
  495. </select>
  496. </div>
  497. </div>
  498. </div>
  499. </div>
  500. </div>
  501. </li>
  502. <? //endif;?>
  503. <? $i++;?>
  504. <? endforeach;?>
  505. </ul>
  506. </div>
  507. </div>
  508. <div class="box-body" >
  509. <div class="row">
  510. <div class="col-xs-2">
  511. <div class="form-group">
  512. <button id="add_jobs_part" type="button" class="btn btn-block btn-success " >Запланировать работу</button>
  513. </div>
  514. </div>
  515. </div>
  516. <div class="row">
  517. <div class="col-xs-2">
  518. <div class="form-group">
  519. <button id="submit_start_proj" type="button" class="btn btn-block btn-danger bindProjectTypes" data="<?php echo \Yii::$app->request->get('id');?>">Добавить к проекту</button>
  520. </div>
  521. <!--
  522. <div class="form-group">
  523. <?// if ($loadFormError):?>
  524. <p><?php //echo $loadFormError;?></p>
  525. <? //endif;?>
  526. <label for="exampleInputPassword1">Запустить проект</label>
  527. <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>
  528. </div>
  529. -->
  530. </div>
  531. </div>
  532. </div>
  533. </form>
  534. </div>
  535. </div>
  536. <? //endforeach;?>
  537. </div>
  538. </div>
  539. </div>
  540. <!-- КОНЕЦ ПЕРВОЙ ВКЛАДКИ -->
  541. <!-- НАЧАЛО ВТОРОЙ ВКЛАДКИ -->
  542. <div class="tab-pane" id="tab_2">
  543. dgdgfsdfg
  544. </div>
  545. <!-- КОНЕЦ ВТОРОЙ ВКЛАДКИ -->
  546. </div>
  547. </div>
  548. </div>
  549. </div>
  550. </section>
  551. <!-- /.content -->
  552. </div>
  553. <!-- /.content-wrapper -->
  554. <footer class="main-footer">
  555. </footer>
  556. <!-- Add the sidebar's background. This div must be placed
  557. immediately after the control sidebar -->
  558. <div class="control-sidebar-bg"></div>
  559. </div>
  560. <!-- HTML -->
  561. <div class="ASU_select0" style="display:none">
  562. <select class="form-control select2 hide_field_select_0" style="width: 100%;" name="newListJ_<? echo $i;?>">
  563. <? foreach( $asusgJobplanEntity as $plan):?>
  564. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  565. <? endforeach;?>
  566. </select>
  567. </div>
  568. <div class="ASU_select1" style="display:none">
  569. <select class="form-control select2 hide_field_select_1" style="width: 100%;" name="newList1_<? echo $i;?>">
  570. <option value='0'>-- Список сотрудников --</option>
  571. <? foreach( $asusgEmployeeEntity as $plan):?>
  572. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  573. <? endforeach;?>
  574. </select>
  575. </div>
  576. <div class="ASU_select2" style="display:none">
  577. <select class="form-control select2 hide_field_select_2" style="width: 100%;" name="newList2_<? echo $i;?>">
  578. <option value='0'>-- Список сотрудников --</option>
  579. <? foreach( $asusgEmployeeEntity as $plan):?>
  580. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  581. <? endforeach;?>
  582. </select>
  583. </div>
  584. <div class="ASU_select3" style="display:none">
  585. <select class="form-control select2 hide_field_select_3" style="width: 100%;" name="newList3_<? echo $i;?>">
  586. <option value='0'>-- Список сотрудников --</option>
  587. <? foreach( $asusgEmployeeEntity as $plan):?>
  588. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  589. <? endforeach;?>
  590. </select>
  591. </div>
  592. <!-- End Document
  593. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  594. <script src="/lte/bower_components/jquery/dist/jquery.min.js"></script>
  595. <!-- jQuery UI 1.11.4 -->
  596. <script src="/lte/bower_components/jquery-ui/jquery-ui.min.js"></script>
  597. <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  598. <script>
  599. $.widget.bridge('uibutton', $.ui.button);
  600. </script>
  601. <!-- Bootstrap 3.3.7 -->
  602. <script src="/lte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  603. <!-- Morris.js charts -->
  604. <script src="/lte/bower_components/raphael/raphael.min.js"></script>
  605. <script src="/lte/bower_components/morris.js/morris.min.js"></script>
  606. <!-- Sparkline -->
  607. <script src="/lte/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
  608. <!-- jvectormap -->
  609. <script src="/lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
  610. <script src="/lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
  611. <!-- jQuery Knob Chart -->
  612. <script src="/lte/bower_components/jquery-knob/dist/jquery.knob.min.js"></script>
  613. <!-- daterangepicker -->
  614. <script src="/lte/bower_components/moment/min/moment.min.js"></script>
  615. <script src="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
  616. <!-- datepicker -->
  617. <script src="/lte/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
  618. <!-- Bootstrap WYSIHTML5 -->
  619. <script src="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
  620. <!-- Slimscroll -->
  621. <script src="/lte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
  622. <!-- FastClick -->
  623. <script src="/lte/bower_components/fastclick/lib/fastclick.js"></script>
  624. <!-- AdminLTE App -->
  625. <script src="/lte/dist/js/adminlte.min.js"></script>
  626. <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  627. <script src="/lte/dist/js/pages/dashboard.js"></script>
  628. <!-- AdminLTE for demo purposes -->
  629. <script src="/lte/dist/js/demo.js"></script>
  630. <script src="/loco.js"></script>
  631. <script src="/mail.js"></script>
  632. <script src="/lte/bower_components/select2/dist/js/select2.full.min.js"></script>
  633. <script>
  634. $( function() {
  635. $( ".sortable" ).sortable();
  636. $( ".sortable" ).disableSelection();
  637. } );
  638. </script>
  639. </body>
  640. </html>
  641. <?php
  642. function GetEnterForm()
  643. {
  644. echo "<article>
  645. <form method='post' action='?login'>
  646. <table>
  647. <tr>
  648. <td width=70>
  649. <b>Login</b>
  650. </td>
  651. <td>
  652. &nbsp;
  653. </td>
  654. <td>
  655. <input type='text' name=login value=''><br/>
  656. </td>
  657. </tr>
  658. <tr>
  659. <td>
  660. <b>Password </b>
  661. </td>
  662. <td>
  663. &nbsp;
  664. </td>
  665. <td>
  666. <input type='password' name=pass value=''>
  667. </td>
  668. </tr>
  669. <tr>
  670. <td></td>
  671. <td>&nbsp;</td>
  672. <td>
  673. <input type='submit' value='Enter'>
  674. </td>
  675. </tr>
  676. </table>
  677. </form>
  678. </article>";
  679. }
  680. function getLocomotiveList(){
  681. $result = [];
  682. //var_dump($companyID);
  683. $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(['company' => 2] )->orderBy(['id' => SORT_DESC])->all();
  684. $listArray = [];
  685. foreach( $projectsLocotechEntity as $item){ //var_dump($item->projecttypes->name);echo "\n";
  686. //$tempArray = GetTasksForProject($item->id);
  687. $status = GetProjectStatus($item->id);
  688. if ($status != 2 && $status != 1) {continue;}
  689. $countDone = ['done' => 0, 'all' => 0 ];
  690. foreach( GetTasksForProject($item->id) as $proj) { //var_dump($proj);echo "<br>";
  691. $countDone['all']++;
  692. $tempArray = $proj;
  693. $tempArray['status'] = CheckAcceptedStatus($proj);
  694. $tempArray['name'] = GetTaskNameAndDesc($proj['type'])[0];
  695. //$tempArray['listAccounts'] = $this->getAccountListForTask($proj['type']);
  696. if ( 5 == $tempArray['status'] ) {$countDone['done']++;}
  697. //$countDone['all'] ." / " . $countDone['done'];
  698. $listArray[] = $tempArray;
  699. }
  700. $result[$item->id]['countDone'] = [ 'done' => $countDone['done'], 'all' => $countDone['all'] ];
  701. //$tempArray['name'] = GetTaskNameAndDesc($tempArray['type'])[0];
  702. $result[$item->id]['arr'] = $listArray;//GetTasksForProject($item->id);
  703. $result[$item->id]['obj'] = $item;
  704. $listArray = [];
  705. }
  706. //exit;
  707. return $result;
  708. }
  709. function CheckAcceptedStatus($task) {
  710. $result = false;
  711. $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
  712. from (select count(t.id) as total,
  713. sum(if(t.accepted_time is not null, 1, 0)) as accepted,
  714. sum(if(t.finished_time is not null, 1, 0)) as finished,
  715. sum(if(t.finished_time is null, if(timestampdiff(MINUTE, t.accepted_time, NOW()) > tt.time_to_complete_minutes, 1, 0), 0)) as attention
  716. from tasks t
  717. right join tasktypes tt on t.type = tt.id
  718. where t.parent_id = ".$task['id'].") tx;";
  719. $result = \Yii::$app->db->createCommand($query)->queryAll();
  720. $result = $result[0]["taskstatus"];
  721. return $result;
  722. }
  723. function getCompliteStatus() {
  724. global $link;
  725. $result = [];
  726. $getParams = \Yii::$app->request->get('id');
  727. $query = 'select aj2l.asusg_project_id, t.asusg_job_mapped_id, count(t.id) total, sum(case when t.status = 5 then 1 else 0 end) finished
  728. from tasks t
  729. left join asusg_job2launch aj2l on t.asusg_job_mapped_id = aj2l.id
  730. where aj2l.asusg_project_id = '. $getParams .'
  731. group by t.asusg_job_mapped_id
  732. order by aj2l.job_order;';
  733. $resQuery = mysqli_query($link, $query);
  734. while($res = mysqli_fetch_assoc($resQuery)){
  735. $tempArr = [];
  736. $percent = ((int)$res["finished"]/(int)$res["total"])*100;
  737. $result[$res["asusg_job_mapped_id"]]= $percent;
  738. }
  739. //echo "<pre>";
  740. //var_dump($result);
  741. // echo "</pre>";
  742. return $result;
  743. }
  744. ?>