completed_yesterday.blade.php 27 KB

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