Dashboard sipadu mbip
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_api_key.blade.php 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. @extends('layout.master', ['uid' => $user->_id, 'token' => $user->token_firebase])
  2. @section('page_title', 'Kompaun')
  3. @section('sub_page_title', '')
  4. @section('name', $user->StaffDetail->full_name)
  5. @section('img_profile', $user->StaffDetail->profile_img)
  6. @section('content')
  7. <style type="text/css">
  8. select.form-control, select.form-control:focus, select.form-control:hover {
  9. border: 1px solid #ccc !important;
  10. height: auto !important;
  11. }
  12. .panel-group .panel {
  13. margin-bottom: 0;
  14. overflow: hidden;
  15. border-radius: 4px;
  16. }
  17. .panel-default {
  18. border-color: #ddd;
  19. }
  20. .panel-default>.panel-heading {
  21. color: #333;
  22. background-color: #f5f5f5;
  23. border-color: #ddd;
  24. }
  25. .panel-title {
  26. margin-top: 0;
  27. margin-bottom: 0;
  28. font-size: 16px;
  29. color: inherit;
  30. }
  31. .panel-body .table>thead>tr>th, .panel-body .table>tbody>tr>th, .panel-body .table>tfoot>tr>th, .panel-body .table>thead>tr>td, .panel-body .table>tbody>tr>td, .panel-body .table>tfoot>tr>td , .panel-body div{
  32. padding: 8px 15px;
  33. line-height: 1.428571429;
  34. vertical-align: top;
  35. border-top: 1px solid #ddd;
  36. }
  37. .glyphicon { margin-right:10px; }
  38. .panel-body { padding:0px; }
  39. .panel-body table tr td { padding-left: 15px }
  40. .panel-body table tr td a:hover , .panel-body div a:hover{ color: #d84315 !important; }
  41. .panel-body .table, .panel-body div {margin-bottom: 0px; }
  42. .active { color: #d84315; }
  43. .active:hover { color: #d84315; }
  44. hr {
  45. margin-top: 0.6rem !important;
  46. margin-bottom: 0.6rem !important;
  47. }
  48. </style>
  49. <div class="inner-page">
  50. <div class="row">
  51. <div class="col-md-12">
  52. <div class="fluid">
  53. @if(count($errors) > 0)
  54. <div class="alert alert-danger icons-alert">
  55. @foreach($errors->all() as $error)
  56. <p>{{$error}}</p>
  57. @endforeach
  58. </div>
  59. @endif
  60. @if(Session::get('error_msg'))
  61. <div class="alert alert-danger icons-alert">
  62. {!! Session::get('error_msg') !!}
  63. </div>
  64. @elseif(Session::get('success_msg'))
  65. <div class="alert alert-success icons-alert">
  66. {!! Session::get('success_msg') !!}
  67. </div>
  68. @endif
  69. </div>
  70. </div>
  71. </div>
  72. <div class="row">
  73. <div class="col-xl-2 col-md-12">
  74. <div class="panel panel-default">
  75. <div class="panel-heading">
  76. <h4 class="panel-title"> Navigasi </h4>
  77. </div>
  78. <div class="panel-body">
  79. <div>
  80. <a href="{{ url('/main/api-key') }}" class="active">Senarai Api Key</a>
  81. </div>
  82. <div>
  83. <a href="{{ url('/main/api-integration') }}">Senarai Api Integrasi</a>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <div class="col-xl-10">
  89. <div class="card">
  90. <div class="card-header">
  91. <h5>Manage your application Api Keys</h5>
  92. <button type="button" class="btn btn-sm btn-outline-danger float-right waves-effect" data-toggle="modal" data-target="#TambahApi">Create New Api Key</button>
  93. </div>
  94. <div class="card-block">
  95. <div class="dt-responsive table-responsive">
  96. <table id="api" class="table table-sm table-striped table-bordered nowrap">
  97. <thead>
  98. <tr>
  99. <th>Name</th>
  100. <th>Key Prefix</th>
  101. <th>Scopes</th>
  102. <th>Action</th>
  103. </tr>
  104. </thead>
  105. <tfoot>
  106. <tr>
  107. <th>Name</th>
  108. <th>Key Prefix</th>
  109. <th>Scopes</th>
  110. <th>Action</th>
  111. </tr>
  112. </tfoot>
  113. </table>
  114. </div>
  115. </div>
  116. <!-- <div class="animation-modal"> -->
  117. <div class="modal fade" id="TambahApi" tabindex="-1" role="dialog">
  118. <div class="modal-dialog modal-lg" role="document">
  119. <div class="modal-content">
  120. <div class="modal-header">
  121. <h4 class="modal-title">Create New Api Key</h4>
  122. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  123. <span aria-hidden="true">&times;</span>
  124. </button>
  125. </div>
  126. <div class="modal-body">
  127. <form action="{{ url('/main/add-api-key') }}" class="main cussPayment" method="POST">
  128. <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" />
  129. <div class="row clearfix">
  130. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  131. <label for="subject"><b>Name <code>*</code></b></label>
  132. <div class="form-group">
  133. <input type="text" name="name" id="name" class="form-control" required="">
  134. </div>
  135. </div>
  136. </div>
  137. <div class="row clearfix">
  138. <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
  139. <label for="subject"><b>Please scopes: </b></label>
  140. </div>
  141. </div>
  142. <div class="row clearfix">
  143. <div class="col-lg-1"></div>
  144. <div class="col-lg-3"><label for="subject">Compound Apis</label></div>
  145. <div class="col-lg-8">
  146. <div class="row">
  147. <div class="col-md-12">
  148. <div class="border-checkbox-section">
  149. <div class="border-checkbox-group border-checkbox-group-primary">
  150. <input class="border-checkbox" type="checkbox" id="compound_search" name="compound_search">
  151. <label class="border-checkbox-label" for="compound_search">compound.search</label>
  152. </div>
  153. </div>
  154. </div>
  155. <div class="col-md-12">
  156. <div class="border-checkbox-section">
  157. <div class="border-checkbox-group border-checkbox-group-primary">
  158. <input class="border-checkbox" type="checkbox" id="compound_update" name="compound_update">
  159. <label class="border-checkbox-label" for="compound_update">compound.update.status</label>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. <hr>
  167. <button type="button" class="btn btn-sm btn-default waves-effect float-left" data-dismiss="modal">Close</button>
  168. <button type="submit" class="btn btn-sm btn-danger float-right waves-effect">Create Api Key</button>
  169. </form>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. @endsection
  179. @section('external_js')
  180. <script type="text/javascript">
  181. $.ajaxSetup({
  182. headers: {
  183. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  184. }
  185. });
  186. var table = $('#api').DataTable({
  187. "ordering": false,
  188. "serverSide": true,
  189. "processing": true,
  190. "ajax": "{{ url('/api/setting/api-key/list') }}",
  191. "columns": [
  192. { "data": "index","name": "index"},
  193. { "data": "key_prefix","name": "key_prefix"},
  194. { "data": "scopes","name": "scopes"},
  195. { "data": "action", "name": "action"}
  196. ],
  197. "columnDefs": [
  198. {
  199. "render": function ( data, type, row ) {
  200. if (data.indexOf("New/") >= 0) {
  201. var split = data.split('/');
  202. return '<label class="label label-success">'+split[0]+'</label>&nbsp;'+split[1];
  203. }else {
  204. return data;
  205. }
  206. },
  207. "targets": 0,
  208. },
  209. {
  210. "render": function ( data, type, row ) {
  211. var name = '';
  212. if (row.index.indexOf("New/") >= 0) {
  213. var split = row.index.split('/');
  214. name = split[1];
  215. }else {
  216. name = row.index;
  217. }
  218. return '<div class="btn-group btn-group-sm" style="float: none;"> <a onclick="deleteA(\''+data+'\',\'' + name + '\')" data-toggle="tooltip" data-placement="top" title="Delete Api Key" class="tabledit-delete-button btn btn-danger waves-effect waves-light" style="float: none;"><span class="icofont icofont-ui-delete" style="color:white"></span></a></div>';
  219. },
  220. "targets": 3,
  221. },
  222. ],
  223. "language": {
  224. "paginate": {
  225. "previous": "Sebelum",
  226. "next": "Selepas"
  227. },
  228. "sLengthMenu": "Tunjukkan _MENU_ entri",
  229. "zeroRecords": "Tiada Data Ditemui",
  230. "infoEmpty": "Tiada Rekod Yang Wujud",
  231. "infoFiltered": "(Ditapis daripada _MAX_ jumlah rekod)",
  232. "info": "Tunjuk _START_ hingga _END_ daripada _TOTAL_ entri",
  233. "sSearch": "Cari:",
  234. }
  235. });
  236. function deleteA(cid,name) {
  237. swal({
  238. title: "Are you sure?",
  239. text: "Delete this Api Key ( " + name + " )",
  240. html: true,
  241. type: "warning",
  242. showCancelButton: true,
  243. confirmButtonClass: "btn-danger",
  244. confirmButtonText: "Yes!",
  245. cancelButtonText: "No!",
  246. closeOnConfirm: false
  247. },
  248. function(isConfirm){
  249. if (!isConfirm) return;
  250. $.ajax({
  251. type: "POST",
  252. url: "{{ url('api/delete-api-key') }}",
  253. data: { id: cid },
  254. success:function(data){
  255. if(data['status'] == "true"){
  256. swal({
  257. title: "Success",
  258. text: data['desc'],
  259. type: "success",
  260. showCancelButton: false,
  261. confirmButtonText: "OK!",
  262. closeOnConfirm: true
  263. },
  264. function(){
  265. table.ajax.url("{{ url('/api/setting/api-key/list') }}").load();
  266. });
  267. }else if(data['status'] == "false"){
  268. swal({
  269. title: "Unsuccessfully",
  270. text: data['desc'],
  271. type: "error",
  272. showCancelButton: false,
  273. confirmButtonText: "OK!",
  274. closeOnConfirm: true
  275. },
  276. function(){
  277. table.ajax.url("{{ url('/api/setting/api-key/list') }}").load();
  278. });
  279. }
  280. },
  281. error: function (xhr, ajaxOptions, thrownError) {
  282. swal("Error deleting!", "Oops Something Error", "error");
  283. }
  284. });
  285. });
  286. };
  287. $(document).ready(function() {
  288. $(".theme-loader").animate({
  289. opacity: "0"
  290. },1000);
  291. setTimeout(function() {
  292. $(".theme-loader").remove();
  293. }, 800);
  294. /*** Tooltip ***/
  295. $('#api').on('draw.dt', function () {
  296. $('[data-toggle="tooltip"]').tooltip();
  297. });
  298. });
  299. </script>
  300. @endsection