task.blade.php 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. @extends('layouts.master')
  2. @section('style')
  3. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>
  4. <link rel="stylesheet" href="{{ URL::asset('assets/css/jquery.datetimepicker.css') }}">
  5. @endsection
  6. @section('content')
  7. <!-- Main content -->
  8. <section class="content">
  9. <!-- Main row -->
  10. <div class="row">
  11. <div class="col-md-12">
  12. <section class="panel tasks-widget">
  13. <header class="panel-heading" style="height:40px;">
  14. <div class="pull-left">
  15. {{$title}}
  16. </div>
  17. <div>
  18. <button class="btn btn-success btn-xs pull-right" data-toggle="modal" data-target="#myModal1">Add task</button>
  19. <button class="btn btn-warning btn-xs pull-right" data-toggle="modal" data-target="#myModal2" style="margin-right:5px;">Assign task</button>
  20. </div>
  21. </header>
  22. <div class="table-responsive project-list">
  23. @if (session('data'))
  24. <div class="alert alert-success">
  25. {{ session('data') }}
  26. </div>
  27. @endif
  28. @if(count($tasks) > 0)
  29. <table class="table table-hover">
  30. <thead>
  31. <tr>
  32. <th>
  33. #
  34. </th>
  35. <th>
  36. Task Name
  37. </th>
  38. <th>
  39. Project
  40. </th>
  41. <th>
  42. Assigned users
  43. </th>
  44. <th>
  45. Estimated Time
  46. </th>
  47. <th>
  48. Description
  49. </th>
  50. <th>
  51. Status
  52. </th>
  53. <th>
  54. Action
  55. </th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. @foreach($tasks as $key=>$info)
  60. <tr>
  61. <td>
  62. {{++$key}}
  63. </td>
  64. <td>
  65. <b>{{ substr($info->name, 0, 25)}}</b>
  66. </td>
  67. <td>
  68. <b style="color:red">{{ !empty($info->proj_name->name) ? $info->proj_name->name : "N/A" }} </b>
  69. </td>
  70. <td>
  71. {{ $info->user->name }}
  72. </td>
  73. <td>
  74. {{ date("F jS", strtotime($info->dead_line)) }}
  75. </td>
  76. <td>
  77. {!! substr($info->description, 0, 40) !!}
  78. </td>
  79. <td>
  80. @if($info->status == 1)
  81. <a href="{{url("admin/change_task_status/$info->id")}}">
  82. <i style="color:red;font-size: 15px;" class="fa fa-square-o" aria-hidden="true"></i>
  83. </a>
  84. <b style="color:red;font-size: 12px;">PENDING</b>
  85. @elseif($info->status == 6)
  86. <b style="color:#398439;font-size: 12px;">DONE</b>
  87. @elseif($info->status == 2)
  88. <a href="{{url("admin/change_task_status/$info->id")}}">
  89. <i style="color:#d58512;font-size: 15px;" class="fa fa-square-o" aria-hidden="true"></i>
  90. </a>
  91. <b style="color:#053071;font-size: 12px;">IN PROGRESS</b>
  92. @elseif($info->status == 3)
  93. <b style="color:#053071;font-size: 12px;">COMPLETED</b>
  94. @endif
  95. </td>
  96. <td>
  97. <input type="hidden" class="cls-project-id" value="{{$info->proj_id}}">
  98. <span class="cls-assign" data-task_id="{{$info->id}}" data-toggle="modal" data-target=".bs-example-modal-lg" aria-hidden="true" style="cursor:pointer;">
  99. <button class="btn btn-sm btn-default" data-toggle="tooltip" title="Assigned User & Comments" data-placement="top"> <i class="fa fa-pencil-square-o" aria-hidden="true"></i> </button>
  100. </span>
  101. <a onclick="return confirm ('want to delete?')" href="{{url("admin/remove_task/$info->id")}}" class="btn btn-sm btn-default" data-toggle="tooltip" title="Delete" data-placement="top">
  102. <i class="fa fa-trash-o" aria-hidden="true"></i>
  103. </a>
  104. </td>
  105. </tr>
  106. @endforeach
  107. </tbody>
  108. </table>
  109. @else
  110. <br/><p class="text-center text-danger"> Tasks is Empty!</p>
  111. @endif
  112. <hr>
  113. </hr>
  114. </div>
  115. <div class="panel-body text-center">
  116. <div class=" add-task-row">
  117. </div>
  118. <div class="table-foot">
  119. {{ $tasks->links() }}
  120. </div>
  121. </div>
  122. </section>
  123. </div>
  124. </div>
  125. </section>
  126. <!-- row end -->
  127. <!-- /.content -->
  128. <!-- Modal Add Task -->
  129. <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  130. <div class="modal-dialog" role="document">
  131. <div class="modal-content">
  132. <div class="modal-header">
  133. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  134. <h4 class="modal-title" id="gridSystemModalLabel">{{$title}}</h4>
  135. </div>
  136. <div class="modal-body">
  137. <form role="form" action="{{url('admin/add_task')}}" method="POST">
  138. {!! csrf_field() !!}
  139. <div class="form-group">
  140. <label for="Add new Project">
  141. New Task
  142. </label>
  143. <input name="name" class="form-control" id="new-project" placeholder="Add new task" required="" type="new-project">
  144. </input>
  145. </div>
  146. <div class="form-group">
  147. <label for="Add new Project">
  148. Type
  149. </label>
  150. <select name="task_type" id="" class="form-control">
  151. <option value="0">Select project</option>
  152. <option value="1">Regular</option>
  153. <option value="2">Normal</option>
  154. </select>
  155. </div>
  156. <div class="form-group">
  157. <label for="priority">
  158. Priority
  159. </label>
  160. <select name="priority" class="form-control" id="priority" required>
  161. <option disabled="" selected="" value="">Choice Task Priority</option>
  162. <option value="1">Low</option>
  163. <option value="2">Mid</option>
  164. <option value="3">High</option>
  165. </select>
  166. </div>
  167. <div class="form-group">
  168. <label for="proj">
  169. Projects
  170. </label>
  171. <select name="proj_id" id="proj" class="form-control" required>
  172. <option value="0">Select project</option>
  173. @if(!empty($projectss))
  174. @foreach($projectss as $pro)
  175. <option value="{{$pro->id}}">{{$pro->name}}</option>
  176. @endforeach
  177. @endif
  178. </select>
  179. </div>
  180. <div class="form-group">
  181. <label for="user_id">
  182. User
  183. </label>
  184. <select name="user_id" id="user_id" class="form-control" required>
  185. <option value="0">Select project</option>
  186. @if(!empty($users))
  187. @foreach($users as $user)
  188. <option value="{{$user->id}}">{{$user->name}}</option>
  189. @endforeach
  190. @endif
  191. </select>
  192. </div>
  193. <div class="form-group">
  194. <label for="dead_line">
  195. Deadline
  196. </label>
  197. <input name="dead_line" id="dead_line" type="text" class="form-control date" placeholder="Select Date and Time" required="">
  198. </input>
  199. </div>
  200. <div class="form-group">
  201. <label for="Add new Project">
  202. Description
  203. </label>
  204. <input name="description" class="form-control" id="new-project" placeholder="Description" type="new-project">
  205. </input>
  206. </div>
  207. <div class="form-group">
  208. <label for="Add new Project">
  209. Estimated Time(In hours)
  210. </label>
  211. <input name="estimated_time" class="form-control" id="new-project" placeholder="Estimated time in hour" type="new-project">
  212. </input>
  213. </div>
  214. </div>
  215. <div class="modal-footer">
  216. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  217. <button type="submit" class="btn btn-primary">Add</button>
  218. </div>
  219. </form>
  220. </div><!-- /.modal-content -->
  221. </div><!-- /.modal-dialog -->
  222. </div><!-- /.modal -->
  223. <!-- Modal assign -->
  224. <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  225. <div class="modal-dialog" role="document">
  226. <div class="modal-content">
  227. <div class="modal-header">
  228. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  229. <h4 class="modal-title" id="gridSystemModalLabel">Assign Task</h4>
  230. </div>
  231. <div class="modal-body">
  232. <form role="form" action="{{url('admin/assign_task')}}" method="POST">
  233. {!! csrf_field() !!}
  234. <div class="form-group">
  235. <label for="Add new Project">
  236. Projects
  237. </label>
  238. <select name="proj_id" id="" class="cls-proj form-control">
  239. <option value="0">Select project</option>
  240. @if(!empty($projectss))
  241. @foreach($projectss as $pro)
  242. <option value="{{$pro->id}}">{{$pro->name}}</option>
  243. @endforeach
  244. @endif
  245. </select>
  246. </div>
  247. <div class="form-group">
  248. <label for="Add new Project">
  249. Task
  250. </label>
  251. <select name="task_id" id="" class="cls-tasks form-control">
  252. <option value="0">Select project first</option>
  253. </select>
  254. </div>
  255. <div class="form-group">
  256. <label for="Add new Project">
  257. Assign To
  258. </label>
  259. <select name="types" id="id-group-user" class="form-control">
  260. <option value="0">Select project</option>
  261. <option value="1">Group</option>
  262. <option value="2">User</option>
  263. </select>
  264. </div>
  265. <div class="form-group cls-group">
  266. <label for="Add new Project">
  267. Group
  268. </label>
  269. <select name="group_id" id="" class="form-control">
  270. @foreach($groups as $grps)
  271. <option value="{{$grps->id}}">{{$grps->group_name}}</option>
  272. @endforeach
  273. </select>
  274. </div>
  275. <div class="form-group cls-user">
  276. <label for="Add new Project">
  277. User
  278. </label>
  279. <select name="user_id" id="" class="form-control">
  280. @foreach($users as $usr)
  281. <option value="{{$usr->id}}">{{$usr->name}}</option>
  282. @endforeach
  283. </select>
  284. </div>
  285. <div class="form-group">
  286. <label for="Add new Project">
  287. Estimated Time(In hours)
  288. </label>
  289. <input name="estimated_time" class="form-control" id="new-project" placeholder="Estimated time in hour" type="new-project">
  290. </input>
  291. </div>
  292. </div>
  293. <div class="modal-footer">
  294. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  295. <button type="submit" class="btn btn-primary">Assign</button>
  296. </div>
  297. </form>
  298. </div><!-- /.modal-content -->
  299. </div><!-- /.modal-dialog -->
  300. </div>
  301. <!-- Modal assign task -->
  302. <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  303. <div class="modal-dialog modal-lg">
  304. <div class="modal-content">
  305. <div class="modal-header">
  306. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  307. <h4 class="modal-title" id="gridSystemModalLabel">Assign Task</h4>
  308. </div>
  309. <div class="modal-body">
  310. <div class="row">
  311. <script src="{{URL::asset('assets/ckeditor/ckeditor.js')}}"></script>
  312. <div class="col-md-7">
  313. <b>Assinged users:</b>
  314. <div class="assinged-users">
  315. </div>
  316. </div>
  317. <div class="col-md-5">
  318. <input type="hidden" name="id_task_id" id="id_task_id" value="">
  319. <div class="form-group">
  320. <label for="Add new Project">
  321. User
  322. </label>
  323. <select name="user_id" id="id_user_id" class="form-control cls-proj-user">
  324. </select>
  325. </div>
  326. <div class="form-group">
  327. <label for="Add new Project">
  328. Estimated Time
  329. </label>
  330. <br>
  331. <input type="text" id="id_estimated_time" name="estimated_time" class="form-control">
  332. </div>
  333. <div class="form-group">
  334. <button class="btn btn-primary assign-task-user">Assign</button>
  335. </div>
  336. </div>
  337. </div>
  338. <div class="row">
  339. <div class="col-md-12">
  340. <div style="margin-bottom:10px;">
  341. <b>Details:</b> <span class="cls-task-details"></span>
  342. </div>
  343. <textarea class="form-control" name="comment_txt" id="comment_txt" cols="" rows="2" placeholder="Post comment here"></textarea>
  344. <button class="btn btn-success add-task-comment" style="margin-top:5px;">Post Comment</button>
  345. <button class="btn btn-success add-task-comment-doc" style="margin-top:5px;" data-toggle="modal" data-target="#add_doc_task_modal">Attach Documnet</button>
  346. <br><br>
  347. <b>Comments:</b><br>
  348. <div class="comments-cls" style="height:400px;overflow:scroll;">
  349. </div>
  350. </div>
  351. </div>
  352. <div class="row">
  353. <div class="col-md-12">
  354. <br/>
  355. <b>Activity Logs:</b><br>
  356. <div class="show-logs" style="height:150px;overflow:scroll;">
  357. </div>
  358. </div>
  359. </div>
  360. </div>
  361. <div class="modal-footer">
  362. <div class="row">
  363. <div class="col-md-10">
  364. Change status to:
  365. <button data-id='2' class="btn btn-primary cls-change-created btn-xs">In-process</button>
  366. <span class="show-change-btn">
  367. <button data-id='3' class="btn btn-primary cls-change-created btn-xs">Completed</button>
  368. <button data-id='4' class="btn btn-primary cls-change-created btn-xs">Checking</button>
  369. <button data-id='5' class="btn btn-primary cls-change-created btn-xs">Bug-fixing</button>
  370. <button data-id='6' class="btn btn-primary cls-change-created btn-xs">Done</button>
  371. </span>
  372. </div>
  373. <div class="col-md-2">
  374. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  375. </div>
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380. </div>
  381. <!-- Assign task finished -->
  382. @endsection
  383. @section('script')
  384. <script type="text/javascript">
  385. $(document).ready(function(){
  386. $('.cls-group').hide();
  387. $('.cls-user').hide();
  388. });
  389. $('.cls-proj').change(function(event){
  390. var proj_id = $(this).val();
  391. $.ajax({
  392. url: "{{url("admin/change_tast_by_proj")}}",
  393. type: 'POST',
  394. data: { proj_id:proj_id},
  395. })
  396. .done(function(data){
  397. $('.cls-tasks').html(data);
  398. });
  399. });
  400. $('#id-group-user').change(function(event)
  401. {
  402. var chk_id = $(this).val();
  403. if(chk_id == 1){
  404. $('.cls-group').show();
  405. $('.cls-user').hide();
  406. }
  407. else if(chk_id == 2){
  408. $('.cls-group').hide();
  409. $('.cls-user').show();
  410. }
  411. else{
  412. $('.cls-group').hide();
  413. $('.cls-user').hide();
  414. }
  415. });
  416. </script>
  417. <script src="{{URL::asset('assets/js/jquery.datetimepicker.full.min.js')}}" type="text/javascript"></script>
  418. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js" type="text/javascript"></script>
  419. <script type="text/javascript">
  420. $( ".date" ).datetimepicker({
  421. dateFormat: 'dd/mm/yy',
  422. timeFormat: 'HH:mm',
  423. });
  424. //jQuery('#datetimepicker').datetimepicker();
  425. $('.bs-example-modal-lg').on('shown.bs.modal', function () {
  426. datePicker1();
  427. });
  428. function datePicker1(){
  429. $( "#id_estimated_time" ).datetimepicker({
  430. });
  431. }
  432. jQuery('#datetimepicker').datetimepicker({
  433. format:'Y-m-d H:i:s',
  434. lang:'ru'
  435. });
  436. $(document).ready(function() {
  437. var timeout = setTimeout("location.reload(true);",600000);
  438. function resetTimeout() {
  439. clearTimeout(timeout);
  440. timeout = setTimeout("location.reload(true);",600000);
  441. }
  442. $('.cls-assign').click(function(event)
  443. {
  444. var proj_id = $('.cls-project-id').val();
  445. var task_id = $(this).data('task_id');
  446. $('#id_task_id').val(task_id);
  447. $.ajax({
  448. url: "{{url('admin/user_list_for_task_assign')}}",
  449. type: 'POST',
  450. data: {proj_id: proj_id, task_id: task_id},
  451. })
  452. .done(function(data) {
  453. var status = data[4];
  454. if(status > 1)
  455. {
  456. $('.show-change-btn').show();
  457. }
  458. else{
  459. $('.show-change-btn').hide();
  460. }
  461. $('.cls-proj-user').html(data[0]);
  462. $('.assinged-users').html(data[1]);
  463. $('.show-logs').html(data[2]);
  464. $('.comments-cls').html(data[3]);
  465. $('.cls-task-details').html(data[5]);
  466. $('#id_estimated_time').val(data[6]);
  467. });
  468. });
  469. $('.assign-task-user').click(function(event)
  470. {
  471. //url('admin/task_assign_to_user')
  472. //var id_estimated_time = $('#id_estimated_time').val();
  473. var id_estimated_time = $('#id_estimated_time').val();
  474. //var min = $('#id_estimated_time_min').val();
  475. //var id_estimated_time = hours+":"+min+":00";
  476. var id_user_id = $('#id_user_id').val();
  477. var id_task_id = $('#id_task_id').val();
  478. if(id_estimated_time !=''){
  479. $.ajax({
  480. url: "{{url('admin/task_assign_to_user')}}",
  481. type: 'POST',
  482. data: {id_estimated_time: id_estimated_time,id_user_id: id_user_id,id_task_id: id_task_id},
  483. })
  484. .done(function(data) {
  485. $('.assinged-users').html(data);
  486. });
  487. }
  488. else{
  489. alert('Please define time estimate!');
  490. }
  491. });
  492. $('.assinged-users').on('click','.remove-task-assign-user',function(){
  493. var id = $(this).prev('input').val();
  494. var task_id = $('#id_task_id').val();
  495. $.ajax({
  496. url: "{{url('admin/remove_assign_task_user')}}",
  497. type: 'POST',
  498. data: {id: id,task_id: task_id},
  499. })
  500. .done(function(data) {
  501. $('.assinged-users').html(data);
  502. });
  503. });
  504. $('.add-task-comment').click(function(event) {
  505. var comment = $('#comment_txt').val();
  506. var task_id = $('#id_task_id').val();
  507. if(comment.length > 0){
  508. $.ajax({
  509. url: "{{url('admin/add_task_comment')}}",
  510. type: 'POST',
  511. data: {comment: comment,task_id: task_id},
  512. })
  513. .done(function(data) {
  514. $('.comments-cls').html(data);
  515. });
  516. }
  517. else{
  518. alert('Please fill-up comment field.');
  519. }
  520. });
  521. $('.comments-cls').on('click','.edit_comment',function(){
  522. var id = $(this).data('id');
  523. $.ajax({
  524. url: '{{url('admin/edit_comment_form')}}',
  525. type: 'POST',
  526. data: {id: id},
  527. })
  528. .done(function(data) {
  529. $('.modal-edit').modal('show');
  530. $('.update-comment').val(data['comment']);
  531. $('.update-comment-id').val(data['id']);
  532. });
  533. });
  534. $('.comments-cls').on('click','.remove_comment',function(){
  535. var id = $(this).data('id');
  536. var task_id = $('#id_task_id').val();
  537. $.ajax({
  538. url: "{{url('admin/remove_comment')}}",
  539. type: 'POST',
  540. data: {id: id,task_id: task_id},
  541. })
  542. .done(function(data) {
  543. $('.comments-cls').html(data);
  544. });
  545. });
  546. $('.save-updated-comment').click(function(event) {
  547. var id = $('.update-comment-id').val();
  548. var comment = $('.update-comment').val();
  549. var task_id = $('#id_task_id').val();
  550. $.ajax({
  551. url: '{{url('admin/save_update_comment')}}',
  552. type: 'POST',
  553. data: {id: id,comment: comment,task_id: task_id},
  554. })
  555. .done(function(data) {
  556. $('.modal-edit').modal('hide');
  557. $('.comments-cls').html(data);
  558. $('.update-comment').val('');
  559. alert('Data updated successfully!');
  560. });
  561. });
  562. $('.cls-change-created').click(function(event)
  563. {
  564. if(confirm("Are you sure you want to change status ?"))
  565. {
  566. var task_id = $('#id_task_id').val();
  567. var status = $(this).data('id');
  568. $.ajax({
  569. url: "{{url('admin/change_to_process')}}",
  570. type: 'POST',
  571. data: {task_id: task_id, status: status},
  572. })
  573. .done(function(data) {
  574. if(data == 'Yes'){
  575. alert('Status Changed !!');
  576. location.reload();
  577. }
  578. else{
  579. alert('Status Not Changed !!');
  580. }
  581. });
  582. }
  583. });
  584. $('.upload-cls').click(function(event)
  585. {
  586. var id = $('.cls-project-id').val();
  587. $('.cls-proj-id').val(id);
  588. });
  589. $('.cls-pm').click(function(event) {
  590. var id = $(this).val();
  591. var pm_status;
  592. if($(this).attr('checked')){
  593. pm_status = 1 ; //check
  594. }
  595. else{
  596. pm_status = 0 ; //uncheck
  597. }
  598. $.ajax({
  599. url: "{{url('admin/make_pm')}}",
  600. type: 'POST',
  601. data: {id: id,pm_status: pm_status},
  602. })
  603. .done(function(data) {
  604. alert(data);
  605. });
  606. });
  607. $('.add-task-comment-doc').click(function(event) {
  608. var task_id = $('#id_task_id').val();
  609. $('.cls-task-doc-id').val(task_id);
  610. });
  611. $('.attatch-close-btn').click(function(event) {
  612. location.reload();
  613. });
  614. $('.attatchment-doc-comment').click(function(event) {
  615. //this event only for fetch the comments after close
  616. //attatchemnt dropzone.
  617. var comment = '';
  618. var task_id = $('#id_task_id').val();
  619. $.ajax({
  620. url: "{{url('admin/add_task_comment')}}",
  621. type: 'POST',
  622. data: {comment: comment,task_id: task_id},
  623. })
  624. .done(function(data){
  625. $('.comments-cls').html(data);
  626. });
  627. });
  628. });
  629. </script>
  630. @endsection