show.blade.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. @extends('layouts.master')
  2. @section('content')
  3. <section class="content">
  4. <div class="row">
  5. <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
  6. <div class="panel panel-default">
  7. <div class="panel-heading">
  8. <?php
  9. $priority='';
  10. switch ($ticket->priority) {
  11. case '1':
  12. $priority="<span class='label label-default'>Low</span>";
  13. break;
  14. case '2':
  15. $priority="<span class='label label-info'>Medium</span>";
  16. break;
  17. case '3':
  18. $priority="<span class='label label-warning'>High</span>";
  19. break;
  20. case '4':
  21. $priority="<span class='label label-danger'>Urgent</span>";
  22. break;
  23. default:
  24. break;
  25. }
  26. ?>
  27. <span class="label label-info" style="font-size: 14px !important;">{{ @$ticket->user->company_data?$ticket->user->company_data->name:'' }}</span>
  28. <h3 class="panel-title" style="margin-top: 10px;">{{ $ticket->title }} {!! $priority !!}</h3>
  29. <h6>
  30. Opened by <strong>{{ $ticket->created_user?$ticket->created_user->name:'' }}</strong> on <strong>{{ date('m d, Y',strtotime($ticket->created_at)) }} </strong> at <strong>{{ date('h:m A',strtotime($ticket->created_at)) }}</strong> for <strong>{{ $ticket->service?$ticket->service->name:'' }}</strong>
  31. <div class='pull-right'>
  32. status :
  33. <select id="status" {{ \Auth::user()->utype==3?'disabled':'' }}>
  34. <option {{ $ticket->status==0?'selected':'' }} value="0">Initiated</option>
  35. <option {{ $ticket->status==1?'selected':'' }} value="1">In Process</option>
  36. <option {{ $ticket->status==2?'selected':'' }} value="2">Onhold</option>
  37. <option {{ $ticket->status==3?'selected':'' }} value="3">Closed</option>
  38. </select>
  39. <input type="hidden" name="hdn_ticket_id" value="{{ $ticket->id }}">
  40. </div>
  41. </h6>
  42. <div class="clearfix"></div>
  43. @if( !empty( $ticket->ticket_document ))
  44. <div class="form-group">
  45. Download document: <a target="_blank" href="{{ url('public/ticket_document/'.$ticket->ticket_document) }}">{{ $ticket->ticket_document }}</a>
  46. </div>
  47. @endif
  48. </div>
  49. <div class="panel-body">
  50. {{ $ticket->details }}
  51. <div id="comment">
  52. <div id="comment-box">
  53. </div>
  54. <hr>
  55. <textarea name="comment" id="txt_comment" class='form-control'></textarea> <br>
  56. <button type="button" id='btnComment' data-ticket='{{ $ticket->id }}' class="btn btn-defaut"><i class="fa fa-comment"></i> Reply </button>
  57. <hr>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. </section>
  64. @stop
  65. @section('style')
  66. <style>
  67. #comment{
  68. margin-top: 15px;
  69. }
  70. .comment-item{
  71. padding: 10px;
  72. }
  73. .comment-head{
  74. font-size: 13px;
  75. padding: 15px;
  76. background: #f5f5f5;
  77. }
  78. .comment-body{
  79. padding: 10px;
  80. }
  81. .label{
  82. padding: 0.2em 0.3em .2em !important;
  83. font-size: 60% !important;
  84. }
  85. </style>
  86. @stop
  87. @section('script')
  88. <script type="text/javascript">
  89. $(document).ready(function() {
  90. get_comments();
  91. $('#btnComment').click(function(){
  92. var ticket=$(this).data('ticket');
  93. var comment=$('#txt_comment').val();
  94. var token='{{ csrf_token() }}';
  95. if(comment.length>0){
  96. $.ajax({
  97. url: '{{ url('ticket/comment/save') }}',
  98. type: 'POST',
  99. data: {ticket: ticket,comment:comment,_token:token}
  100. })
  101. .done(function(res) {
  102. get_comments();
  103. $('#txt_comment').val('');
  104. });
  105. }
  106. });
  107. @if(\Auth::user()->utype!=3)
  108. $('#status').change(function(){
  109. var st=$(this).val();
  110. var token='{{ csrf_token() }}';
  111. var conf=confirm('Are you sure to change status ??');
  112. if(!conf) return false;
  113. if(st.length>0)
  114. {
  115. var ticket_id=$('input[name="hdn_ticket_id"]').val();
  116. $.ajax({
  117. url: '{{ url('ticket/status/change') }}',
  118. type: 'POST',
  119. data: {status: st,ticket_id:ticket_id,_token:token}
  120. })
  121. .done(function(res) {
  122. if(res=="ok")
  123. {
  124. alert("status changed successfully !");
  125. }
  126. });
  127. }
  128. });
  129. @endif
  130. });
  131. function get_comments()
  132. {
  133. $.ajax({
  134. url: '{{ url('ticket/comments') }}/{{ $ticket->id }}',
  135. type: 'GET'
  136. })
  137. .done(function(res) {
  138. $('#comment-box').html(res);
  139. });
  140. }
  141. </script>
  142. @stop