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.

index.blade.php 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. @extends('eep-hr.layout.master')
  2. @section('page_title', 'Dashboard')
  3. @section('subpage', 'Graph & Summary Report')
  4. @section('img_profile', asset($user->StaffDetail->user_pic))
  5. @section('login_name', $user->StaffDetail->name )
  6. @section('last_login', $user->last_login_at )
  7. @section('content')
  8. <style>
  9. .ui-tabs .ui-tabs-nav li.ui-tabs-active a { color: #EA5730 !important; }
  10. .ui-widget-content .bRed { color: #fff !important; }
  11. </style>
  12. <!-- Table dealer -->
  13. <div class="fluid">
  14. <div class="widget grid2 widgetH"></div>
  15. <div class="widget grid8">
  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" width="100%">
  20. <thead>
  21. <tr>
  22. <th>#</th>
  23. <th width="50">Image</th>
  24. <th>Name</th>
  25. <th>IC</th>
  26. <th>Email</th>
  27. <th>Phone</th>
  28. <th width="90">Actions</th>
  29. </tr>
  30. </thead>
  31. </table>
  32. </div>
  33. <div class="dialog-delete" title="Delete Agent">
  34. <p id="inner-delete"></p>
  35. </div>
  36. </div>
  37. <div class="widget grid2 widgetH"></div>
  38. </div>
  39. @endsection
  40. @section('external_js')
  41. <script>
  42. function deleteA(cid,name) {
  43. var cid = cid;
  44. var name = name;
  45. $('.dialog-delete').attr('data-id' , cid);
  46. document.getElementById("inner-delete").innerHTML = "<p>Are you sure want to delete this agent ( " + name + " )?</p>";
  47. $('.dialog-delete').dialog('open');
  48. return false;
  49. };
  50. $(document).ready(function(){
  51. var origin = window.location.origin;
  52. var curr = '{{ $user->_id }}';
  53. //===== Dynamic table toolbars =====//
  54. $('#dyn1 .tOptions').click(function () {
  55. $('#dyn .tablePars').slideToggle(200);
  56. });
  57. $('.tOptions').click(function () {
  58. $(this).toggleClass("act");
  59. });
  60. //======= Filter data table ========//
  61. $('#agent').DataTable({
  62. "scrollX": true,
  63. "bJQueryUI": false,
  64. "bAutoWidth": true,
  65. "bSort": false,
  66. "sPaginationType": "full_numbers",
  67. "sDom": '<"tablePars"fl>t<"tableFooter"ip>',
  68. "oLanguage": {
  69. "sLengthMenu": "<span class='showentries'>Show entries:</span> _MENU_"
  70. },
  71. "ordering": false,
  72. "serverSide": true,
  73. "processing": true,
  74. "ajax": "{{ url('/dealer/get-agent-list') }}",
  75. "columns": [
  76. { "data": "index","name": "index"},
  77. { "data": "image","name": "image"},
  78. { "data": "name","name": "name"},
  79. { "data": "ic","name": "ic"},
  80. { "data": "email","name": "email"},
  81. { "data": "phone","name": "phone"},
  82. { "data": "action","name": "action"},
  83. ],
  84. "columnDefs": [
  85. {
  86. "render": function ( data, type, row ) {
  87. return '<a href="'+origin+'/assets/img/big.png" title="" class="lightbox"><img src="'+origin+'/'+data+'" alt="" width="37px" height="auto"/></a>';
  88. },
  89. "targets": 1
  90. },
  91. {
  92. "render": function ( data, type, row ) {
  93. if (data.indexOf("-You") >= 0) {
  94. var split = data.split('-');
  95. return '<small class="label label-info">'+split[1]+'</small>&nbsp;'+split[0];
  96. }else if (data.indexOf("New/") >= 0) {
  97. var split = data.split('/');
  98. return '<small class="label label-warning">'+split[0]+'</small>&nbsp;'+split[1];
  99. }else {
  100. return data;
  101. }
  102. },
  103. "targets": 2
  104. },
  105. {
  106. "render": function ( data, type, row ) {
  107. if(data == curr)
  108. {
  109. var link = "{{ url('/dealer/agent/edit-agent') }}"+"/"+data;
  110. return '<a href="'+link+'" class="tablectrl_medium bLightBlue tipS" title="Edit Dealer"><span class="iconb" data-icon="&#xe003;"></span></a>';
  111. }else {
  112. var link = "{{ url('/dealer/agent/edit-agent') }}"+"/"+data;
  113. return '<a href="'+link+'" class="tablectrl_medium bLightBlue tipS" title="Edit Dealer"><span class="iconb" data-icon="&#xe003;"></span></a> <a class="tablectrl_medium bRed tipS delModule" onclick="deleteA(\''+data+'\',\'' + row.name + '\', )" title="Delete Agent"><span class="iconb" data-icon="&#xe136;"></span></a>';
  114. }
  115. },
  116. "targets": 6
  117. },
  118. ],
  119. });
  120. //===== Modal =====//
  121. $('.dialog-delete').dialog({
  122. autoOpen: false,
  123. width: 400,
  124. modal: true,
  125. buttons: {
  126. "Yes!": function () {
  127. var cid = $(this).data('id');
  128. $.ajax({
  129. type: "POST",
  130. url: "{{url('/dealer/delete-agent')}}",
  131. data: { "_token": "{{ csrf_token() }}", id: cid },
  132. success:function(data){
  133. if(data == "true"){
  134. window.location.reload();
  135. }else if(data == "false"){
  136. alert("ERROR!! Cant Delete Agent !");
  137. }
  138. }
  139. });
  140. },
  141. "Cancel": function () {
  142. $(this).dialog("close");
  143. $('.dialog-delete').removeAttr('data-id');
  144. }
  145. }
  146. });
  147. $('.tipS').tipsy({gravity: 's',fade: true, html:true});
  148. });
  149. </script>
  150. @endsection