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 10KB

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