You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

view_customer.blade.php 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. @extends('customer-service.layout.master')
  2. @section('ptitle','Customer Service')
  3. @section('page_title', 'Customers & Subscribers')
  4. @section('subpage', 'Graph & Summary Report')
  5. @section('img_profile', asset($user->StaffDetail->user_pic))
  6. @section('login_name', $user->StaffDetail->name )
  7. @section('last_login', $user->last_login_at )
  8. @section('content')
  9. <style>
  10. .ui-tabs .ui-tabs-nav li.ui-tabs-active a { color: #EA5730 !important; }
  11. .ui-widget-content .bRed { color: #fff !important; }
  12. </style>
  13. <!-- Table dealer -->
  14. <div class="fluid">
  15. <div class="widget grid12">
  16. <div class="whead"><h6>Customer's List ( Resident & Business )</h6></div>
  17. <div id="dyn1" class="responsive shownpars cuss">
  18. <a class="tOptions" title="Options"><img src="{{ url('assets/img/icons/options') }}" alt="" /></a>
  19. @if($user->StaffDetail->position == 'Customer Service')
  20. <table id="customer" cellpadding="0" cellspacing="0" border="0" class="dTable tMedia" width="100%">
  21. <thead>
  22. <tr>
  23. <th>#</th>
  24. <th>Type Application</th>
  25. <th>Customer Name</th>
  26. <th>Contact No.</th>
  27. <th>Unit No.</th>
  28. <th>Building</th>
  29. <th>Street</th>
  30. <!-- <th>Postcode</th> -->
  31. <th>Need Phone</th>
  32. <th>Email</th>
  33. <th>W/O</th>
  34. <th width="90">Actions</th>
  35. </tr>
  36. </thead>
  37. </table>
  38. @elseif($user->StaffDetail->position == 'Careline')
  39. <table id="view_customer" cellpadding="0" cellspacing="0" border="0" class="dTable tMedia" width="100%">
  40. <thead>
  41. <tr>
  42. <th>#</th>
  43. <th>Type Application</th>
  44. <th>Customer Name</th>
  45. <th>Contact No.</th>
  46. <th>Unit No.</th>
  47. <th>Building</th>
  48. <th>Street</th>
  49. <th>Need Phone</th>
  50. <th>Email</th>
  51. </tr>
  52. </thead>
  53. </table>
  54. @endif
  55. </div>
  56. <div class="dialog-delete" title="Delete Customer">
  57. <p id="inner-delete"></p>
  58. </div>
  59. </div>
  60. </div>
  61. @endsection
  62. @section('external_js')
  63. <script>
  64. function deleteA(cid,name) {
  65. var cid = cid;
  66. var name = name;
  67. $('.dialog-delete').attr('data-id' , cid);
  68. document.getElementById("inner-delete").innerHTML = "<p>Are you sure want to delete this Customer ( " + name + " )?</p>";
  69. $('.dialog-delete').dialog('open');
  70. return false;
  71. };
  72. $(document).ready(function(){
  73. var origin = window.location.origin;
  74. //===== Dynamic table toolbars =====//
  75. $('#dyn1 .tOptions').click(function () {
  76. $('#dyn .tablePars').slideToggle(200);
  77. });
  78. $('.tOptions').click(function () {
  79. $(this).toggleClass("act");
  80. });
  81. //======= Filter data table ========//
  82. var table = $('#customer').DataTable({
  83. "bJQueryUI": false,
  84. "bAutoWidth": true,
  85. "bSort": false,
  86. "sPaginationType": "full_numbers",
  87. "sDom": '<"tablePars"fl>t<"tableFooter"ip>',
  88. "oLanguage": {
  89. "sLengthMenu": "<span class='showentries'>Show entries:</span> _MENU_"
  90. },
  91. "ordering": false,
  92. "serverSide": true,
  93. "processing": true,
  94. "ajax": "{{ url('/customer-service/get-all-new-customer/null/null/null') }}",
  95. "columns": [
  96. { "data": "formT","name": "formT"},
  97. { "data": "type","name": "type"},
  98. { "data": "name","name": "name"},
  99. { "data": "phone","name": "phone"},
  100. { "data": "unit","name": "unit"},
  101. { "data": "building","name": "building"},
  102. { "data": "street","name": "street"},
  103. // { "data": "postcode", "name": "postcode"},
  104. { "data": "need_phone","name": "need_phone"},
  105. { "data": "email","name": "email"},
  106. { "data": "action1","name": "action1"},
  107. { "data": "action2","name": "action2"},
  108. ],
  109. "columnDefs": [
  110. {
  111. "render": function ( data, type, row ) {
  112. if (data.indexOf("New/") >= 0) {
  113. var split = data.split('/');
  114. return '<small class="label label-warning">'+split[0]+'</small>&nbsp;'+split[1];
  115. }else {
  116. return data;
  117. }
  118. },
  119. "targets": 0
  120. },
  121. {
  122. "render": function ( data, type, row ) {
  123. if (data.indexOf("D/") >= 0) {
  124. var split = data.split('/');
  125. return '<small class="label label-purple">'+split[0]+'</small> &nbsp;'+split[1];
  126. }else {
  127. return data;
  128. }
  129. },
  130. "targets": 2
  131. },
  132. {
  133. "render": function ( data, type, row ) {
  134. if(data == 'unverified'){
  135. var link = "{{ url('/customer-service/update-email-status') }}"+"/"+row.action2;
  136. return '<div class="btn-group"><a href="" class="tablectrl_medium bRed tipS" data-toggle="dropdown" original-title="Waiting for verifying"><span class="iconb" data-icon=""></span></a> <ul class="dropdown-menu pull-right"><li><a href="'+link+'">Force Verify</a></li></ul></div>';
  137. }else {
  138. return '<a class="tablectrl_medium bGreen isDisabled tipS" link-disabled="" original-title="Success verifying"><span class="iconb" data-icon=""></span></a>';
  139. }
  140. },
  141. "targets": 8
  142. },
  143. {
  144. "render": function ( data, type, row ) {
  145. if(data != ''){
  146. if (row.formT.indexOf("B") >= 0){
  147. var link1 = "{{ url('/customer-service/work-order/add/schedule') }}"+"/non-prelaid/"+data;
  148. var link2 = "{{ url('/customer-service/work-order/add/schedule') }}"+"/prelaid/"+data;
  149. return '<div class="btn-group"><a href="" class="tablectrl_medium bPurple tipS" data-toggle="dropdown" original-title="Work Order"><span>W/O</span></a> <ul class="dropdown-menu pull-right"><li><a href="'+link1+'">Non Prelaid W/O</a></li><li><a href="'+link2+'"> Prelaid W/O</a></li></ul></div>';
  150. }else {
  151. if (data.indexOf("Non/") >= 0) {
  152. var split = data.split('Non/');
  153. var link = "{{ url('/customer-service/work-order/add/schedule') }}"+"/non-prelaid/"+split[1];
  154. return '<a href="'+link+'" class="tablectrl_medium bPurple tipS" title="Non Prelaid<"><span>Non Prelaid</span></a>';
  155. }else {
  156. var link = "{{ url('/customer-service/work-order/add/schedule') }}"+"/prelaid/"+data;
  157. return '<a href="'+link+'" class="tablectrl_medium bPurple tipS" title="Create New W/O"><span>W/O</span></a>';
  158. }
  159. }
  160. }else {
  161. return data;
  162. }
  163. },
  164. "targets": 9
  165. },
  166. {
  167. "render": function ( data, type, row ) {
  168. var link = "{{ url('/customer-service/edit/customer') }}"+"/"+data;
  169. var link2 = "{{ url('/customer-service/customer/pdf') }}"+"/"+data;
  170. return '<a target="_blank" href="'+link2+'" class="tablectrl_medium bPurple tipS" original-title="View Subscribers"><span class="iconb" data-icon=""></span></a> <a href="'+link+'" class="tablectrl_medium bLightBlue tipS" title="Edit Agent"><span class="iconb" data-icon="&#xe003;"></span></a> <a class="tablectrl_medium bRed tipS delModule" onclick="deleteA(\''+data+'\',\'' + row.name + '\', )" title="Delete Customer"><span class="iconb" data-icon="&#xe136;"></span></a>';
  171. },
  172. "targets": 10
  173. }
  174. ],
  175. });
  176. var table = $('#view_customer').DataTable({
  177. "bJQueryUI": false,
  178. "bAutoWidth": true,
  179. "bSort": false,
  180. "sPaginationType": "full_numbers",
  181. "sDom": '<"tablePars"fl>t<"tableFooter"ip>',
  182. "oLanguage": {
  183. "sLengthMenu": "<span class='showentries'>Show entries:</span> _MENU_"
  184. },
  185. "ordering": false,
  186. "serverSide": true,
  187. "processing": true,
  188. "ajax": "{{ url('/customer-service/get-all-new-customer/null/null/null') }}",
  189. "columns": [
  190. { "data": "formT","name": "formT"},
  191. { "data": "type","name": "type"},
  192. { "data": "name","name": "name"},
  193. { "data": "phone","name": "phone"},
  194. { "data": "unit","name": "unit"},
  195. { "data": "building","name": "building"},
  196. { "data": "street","name": "street"},
  197. // { "data": "postcode", "name": "postcode"},
  198. { "data": "need_phone","name": "need_phone"},
  199. { "data": "email","name": "email"},
  200. ],
  201. "columnDefs": [
  202. {
  203. "render": function ( data, type, row ) {
  204. if (data.indexOf("New/") >= 0) {
  205. var split = data.split('/');
  206. return '<small class="label label-warning">'+split[0]+'</small>&nbsp;'+split[1];
  207. }else {
  208. return data;
  209. }
  210. },
  211. "targets": 0
  212. },
  213. {
  214. "render": function ( data, type, row ) {
  215. if (data.indexOf("D/") >= 0) {
  216. var split = data.split('/');
  217. return '<small class="label label-purple">'+split[0]+'</small> &nbsp;'+split[1];
  218. }else {
  219. return data;
  220. }
  221. },
  222. "targets": 2
  223. },
  224. {
  225. "render": function ( data, type, row ) {
  226. if(data == 'unverified'){
  227. return '<a href="" class="tablectrl_medium bRed tipS" data-toggle="dropdown" original-title="Waiting for verifying"><span class="iconb" data-icon=""></span></a>';
  228. }else {
  229. return '<a class="tablectrl_medium bGreen isDisabled tipS" link-disabled="" original-title="Success verifying"><span class="iconb" data-icon=""></span></a>';
  230. }
  231. },
  232. "targets": 8
  233. },
  234. ],
  235. });
  236. //===== Modal =====//
  237. $('.dialog-delete').dialog({
  238. autoOpen: false,
  239. width: 400,
  240. modal: true,
  241. buttons: {
  242. "Yes!": function () {
  243. var id = $(this).data('id');
  244. // window.alert(email);
  245. $.ajax({
  246. type: "POST",
  247. url: "{{ url('/customer-service/delete-new-customer') }}",
  248. data: { "_token": "{{ csrf_token() }}", id: id },
  249. success:function(data)
  250. {
  251. if(data == "true"){
  252. window.location.reload();
  253. }else if(data == "false"){
  254. alert("ERROR!! Cant Delete Customer !");
  255. }
  256. }
  257. });
  258. },
  259. "Cancel": function () {
  260. $(this).dialog("close");
  261. $('.dialog-delete').removeAttr('data-id');
  262. }
  263. }
  264. });
  265. $('.tipS').tipsy({gravity: 's',fade: true, html:true});
  266. /*** Filter ***/
  267. $('#fbtype,#fbbuilding,#fbdealer').on('change', function() {
  268. var link = "{{ url('/customer-service/get-all-new-customer') }}" +"/"+$('#fbtype').val()+"/"+$('#fbbuilding').val()+"/"+$('#fbdealer').val();
  269. table.ajax.url( link ).load();
  270. });
  271. });
  272. </script>
  273. @endsection