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.

agent_list.blade.php 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. @extends('market.layout.master')
  2. @section('ptitle', 'Marketing')
  3. @section('page_title', 'Dashboard')
  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>Agent's List</h6></div>
  17. <div id="dyn1" class="shownpars cuss responsive">
  18. <a class="tOptions" title="Options"><img src="{{ url('assets/img/icons/options') }}" alt="" /></a>
  19. <table id="agent" cellpadding="0" cellspacing="0" border="0" class="dTable tMedia" style="width:100%">
  20. <thead>
  21. <tr>
  22. <th>#</th>
  23. <th>Image</th>
  24. <th>Agent Name</th>
  25. <th>NRIC</th>
  26. <th>Email</th>
  27. <th>Contact No.</th>
  28. <th>Company</th>
  29. <th>Position</th>
  30. <th width="90">Actions</th>
  31. </tr>
  32. </thead>
  33. </table>
  34. </div>
  35. <div class="dialog-delete" title="Delete Agent">
  36. <p id="inner-delete"></p>
  37. </div>
  38. </div>
  39. </div>
  40. @endsection
  41. @section('external_js')
  42. <script>
  43. function deleteA(cid,name,email) {
  44. var cid = cid;
  45. var name = name;
  46. var email = email;
  47. $('.dialog-delete').attr('data-id' , cid);
  48. document.getElementById("inner-delete").innerHTML = "<p>Are you sure want to delete this Agent ( " + name + " )?</p>";
  49. $('.dialog-delete').dialog('open');
  50. return false;
  51. };
  52. $(document).ready(function(){
  53. var origin = window.location.origin;
  54. var curr = '{{ $user->_id }}';
  55. //===== Dynamic table toolbars =====//
  56. $('#dyn1 .tOptions').click(function () {
  57. $('#dyn .tablePars').slideToggle(200);
  58. });
  59. $('.tOptions').click(function () {
  60. $(this).toggleClass("act");
  61. });
  62. //======= Filter data table ========//
  63. $('#agent').DataTable({
  64. "bJQueryUI": false,
  65. "bAutoWidth": true,
  66. "bSort": false,
  67. "sPaginationType": "full_numbers",
  68. "sDom": '<"tablePars"fl>t<"tableFooter"ip>',
  69. "oLanguage": {
  70. "sLengthMenu": "<span class='showentries'>Show entries:</span> _MENU_"
  71. },
  72. "ordering": false,
  73. "serverSide": true,
  74. "processing": true,
  75. "ajax": "{{ url('/marketing/get-agent-list') }}",
  76. "columns": [
  77. { "data": "index","name": "index"},
  78. { "data": "user_pic","name": "user_pic"},
  79. { "data": "name","name": "name"},
  80. { "data": "ic","name": "ic"},
  81. { "data": "email","name": "email"},
  82. { "data": "phone","name": "phone"},
  83. { "data": "company_id", "name": "company_id"},
  84. { "data": "position","name": "position"},
  85. { "data": "action","name": "action"},
  86. ],
  87. "columnDefs": [
  88. {
  89. "render": function ( data, type, row ) {
  90. var link = "{{ url('/marketing/agent/edit') }}"+"/"+data;
  91. var claimlink = "{{ url('/marketing/agent/claim-all') }}"+"/"+data;
  92. return '<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 + '\',\'' + row.email + '\', )" title="Delete Agent"><span class="iconb" data-icon="&#xe136;"></span></a> <a href="'+claimlink+'" class="tablectrl_medium bGold tipS" title="Claim"><span class="iconb" data-icon="&#xe002"></span></a>';
  93. },
  94. "targets": 8
  95. },
  96. {
  97. "render": function ( data, type, row ) {
  98. return '<img src="{{url('')}}/'+row.user_pic+'" alt="" width="37px" height="36px">';
  99. },
  100. "targets": 1
  101. },
  102. ],
  103. });
  104. //===== Modal =====//
  105. $('.dialog-delete').dialog({
  106. autoOpen: false,
  107. width: 400,
  108. modal: true,
  109. buttons: {
  110. "Yes!": function () {
  111. var id = $(this).data('id');
  112. // window.alert(email);
  113. $.ajax({
  114. type: "POST",
  115. url: "{{ url('/marketing/agent/delete-agent') }}",
  116. // "_token": "{{ csrf_token() }}"
  117. data: { "_token": "{{ csrf_token() }}", id: id },
  118. success:function(data)
  119. {
  120. if(data == "true"){
  121. window.location.reload();
  122. }else if(data == "false"){
  123. alert("ERROR!! Cant Delete Agent !");
  124. }
  125. }
  126. });
  127. },
  128. "Cancel": function () {
  129. $(this).dialog("close");
  130. $('.dialog-delete').removeAttr('data-id');
  131. }
  132. }
  133. });
  134. $('.tipS').tipsy({gravity: 's',fade: true, html:true});
  135. });
  136. </script>
  137. @endsection