Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.98 KB | None | 0 0
  1. @extends('layouts.app')
  2. @section('page_css')
  3. <!-- DataTables -->
  4. <link rel="stylesheet" href="{{ env('CFURL').('/plugins/datatables/dataTables.bootstrap.css')}}">
  5. <link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.1/css/buttons.dataTables.min.css">
  6.  
  7. @endsection
  8.  
  9. @section('htmlheader_title')
  10. Saques
  11. @endsection
  12.  
  13. @section('contentheader_title')
  14. Saques
  15. @endsection
  16.  
  17. @section('breadcrumb')
  18. <li class="active">Saques</li>
  19. @endsection
  20.  
  21. @section('contentheader_description')
  22.  
  23. @endsection
  24.  
  25. @section('main-content')
  26. <!-- Small boxes (Stat box) -->
  27. <!-- Main row -->
  28. <!-- Small boxes (Stat box) -->
  29. <div id='saqueModal' class="modal">
  30. <div class="modal-dialog">
  31. <div class="modal-content">
  32.  
  33. <p>
  34. <form id="updateSaque" method="post" action="{{url('/admin/saque')}}">
  35. <div class="modal-header">
  36. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  37. <h4 class="modal-title">Mudar Status</h4>
  38. </div>
  39. <div class="modal-body">
  40. <div class="form-group">
  41. <label>Mensagem </label>
  42. <textarea class="form-control" required placeholder="mensagem" name="mensagem"></textarea>
  43. <input type="hidden" name="id" id="idHid">
  44. <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
  45. </div>
  46. <div class="form-group">
  47. <label>Status </label>
  48. <select class="form-control" name="status" id="statusChange">
  49. <option value="0">Pendente</option>
  50. <option value="1">Pago</option>
  51. <option value="2">Em analise</option>
  52.  
  53. </select>
  54. </div
  55. <div class="modal-footer">
  56. <div id="resUpdate">
  57. </div>
  58. <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
  59. <button type="submit" id="salvarUpdate" class="btn btn-primary">salvar</button>
  60. </p>
  61. </div>
  62. </form>
  63. </div><!-- /.modal-content -->
  64. </div><!-- /.modal-dialog -->
  65. </div><!-- /.modal -->
  66. <div class="row">
  67. <!-- Left col -->
  68. <section class="col-lg-12">
  69. <div class="box box-primary">
  70. <div class="box-header with-border">
  71. <h3 class="box-title"> Lista de Saques</h3>
  72. </div>
  73. <div class="box-body table-responsive">
  74. <div id="mensagemAjax">
  75.  
  76. </div>
  77. <div class="row">
  78. <div class="col-md-12">
  79. <div class="col-md-2">
  80. <a href="<?= url('admin/saque?status=1') ?>"><button class="btn btn-success" >Pagos</button></a>&nbsp;&nbsp;
  81. </div>
  82. <div class="col-md-2">
  83. <a href="<?= url('admin/saque?status=0') ?>"><button class="btn btn-danger" >Pendentes</button></a>&nbsp;&nbsp;
  84. </div>
  85. <div class="col-md-2">
  86. <a href="<?= url('admin/saque?status=2') ?>"><button class="btn btn-warning" >Em analise</button></a>&nbsp;&nbsp;
  87. </div>
  88. </div>
  89.  
  90.  
  91. </div>
  92. <br>
  93.  
  94.  
  95. <table id="example2" class="table table-bordered">
  96. <thead>
  97. <tr>
  98. <th width="5%">#</th>
  99. <th>Usuário</th>
  100. <th>Mensagem</th>
  101. <th>Data / Hora</th>
  102. <th>Status</th>
  103. <th>Valor</th>
  104. <th>Data de Deposito</th>
  105. <th>Carteira BTC</th>
  106. </tr>
  107. </thead>
  108. <tbody>
  109. @inject('User', 'App\User')
  110.  
  111. <?php
  112.  
  113. function getStatus($id) {
  114. switch ($id) {
  115. case 0:
  116. $res = 'Pendente';
  117. break;
  118. case 1:
  119. $res = 'Pago';
  120. break;
  121.  
  122. case 2:
  123. $res = 'Em analise';
  124. break;
  125. }
  126. return $res;
  127. }
  128. ?>
  129.  
  130. @inject('Saque', 'App\Saque')
  131. <?php
  132. if (is_numeric(@$_GET['status']) and isset($_GET['status'])) {
  133. $stat = $_GET['status'];
  134. $saques = $Saque->where('status', $stat)->orderBy('id')->get();
  135. } else {
  136. $saques = $Saque->orderBy('id')->get();
  137. }
  138. ?>
  139. @foreach($saques as $saque)
  140. <tr>
  141. <td>{{$saque->id}}</td>
  142. <td>{{$saque->userName($saque->user_id)}}</td>
  143. <td>{{$saque->mensagem}}</td>
  144. <td>{{$saque->created_at}}</td>
  145. <td>{{getStatus($saque->status)}}<a onclick="updateStatus({{$saque->id}},'{{getStatus($saque->status)}}')"><br>(Atualizar Status)</a></td>
  146. <td>US$ {{@number_format($saque->valor, 2, ',', '.')}}</td>
  147. <td>{{$saque->data_deposito}}</td>
  148. <td><?= $saque->conta ?></td>
  149. </tr>
  150. @endforeach
  151. </tbody>
  152. </table>
  153. </div>
  154. </div>
  155.  
  156. </section><!-- /.Left col -->
  157.  
  158. {{ method_field('PUT') }}
  159. </div><!-- /.row (main row) -->
  160.  
  161. <!-- Modal -->
  162. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  163. <div class="modal-dialog">
  164. <div class="modal-content">
  165. <div class="modal-header">
  166.  
  167. </div>
  168. <div class="modal-body">
  169.  
  170. </div>
  171. <div class="modal-footer">
  172.  
  173. </div>
  174. </div>
  175. <!-- /.modal-content -->
  176. </div>
  177. <!-- /.modal-dialog -->
  178. </div>
  179. <!-- /.modal -->
  180.  
  181. @endsection
  182.  
  183.  
  184. @section('page_scripts')
  185. <!-- DataTables -->
  186. <script src="{{ asset('/plugins/datatables/jquery.dataTables.min.js')}}"></script>
  187. <script src="{{ asset('/plugins/datatables/dataTables.bootstrap.min.js')}}"></script>
  188. <script src="{{ asset('/plugins/form/jquery.form.min.js') }}"></script>
  189. <script src="{{ env('CFURL').('/plugins/blockUi/jquery.blockUI.js') }}"></script>
  190.  
  191. <!-- DataTables -->
  192. <script src="{{ env('CFURL').('/plugins/datatables/jquery.dataTables.min.js')}}"></script>
  193. <script src="https://cdn.datatables.net/buttons/1.2.1/js/dataTables.buttons.min.js"></script>
  194. <script src="//cdn.datatables.net/buttons/1.2.1/js/buttons.flash.min.js"></script>
  195. <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
  196. <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
  197. <script src="//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
  198. <script src="//cdn.datatables.net/buttons/1.2.1/js/buttons.html5.min.js"></script>
  199. <script src="//cdn.datatables.net/buttons/1.2.1/js/buttons.print.min.js"></script>
  200.  
  201. <script src="{{ env('CFURL').('/plugins/datatables/dataTables.bootstrap.min.js')}}"></script>
  202. <script>
  203. $(function () {
  204.  
  205. $('#example2').DataTable({
  206. "paging": true,
  207. "lengthChange": true,
  208. "searching": true,
  209. "ordering": true,
  210. "info": true,
  211. "autoWidth": true,
  212. "order": [[0, "desc"]],
  213. dom: 'Bfrtip',
  214. buttons: [
  215. 'copy', 'csv', 'excel', 'pdf', 'print'
  216. ],
  217. "language": {
  218. "sEmptyTable": "Nenhum registro encontrado",
  219. "sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
  220. "sInfoEmpty": "Mostrando 0 até 0 de 0 registros",
  221. "sInfoFiltered": "(Filtrados de _MAX_ registros)",
  222. "sInfoPostFix": "",
  223. "sInfoThousands": ".",
  224. "sLengthMenu": "_MENU_ resultados por página",
  225. "sLoadingRecords": "Carregando...",
  226. "sProcessing": "Processando...",
  227. "sZeroRecords": "Nenhum registro encontrado",
  228. "sSearch": "Pesquisar",
  229. "oPaginate": {
  230. "sNext": "Próximo",
  231. "sPrevious": "Anterior",
  232. "sFirst": "Primeiro",
  233. "sLast": "Último"
  234. },
  235. "oAria": {
  236. "sSortAscending": ": Ordenar colunas de forma ascendente",
  237. "sSortDescending": ": Ordenar colunas de forma descendente"
  238. }
  239. }
  240. });
  241. });</script>
  242. <script>
  243. $(function () {
  244.  
  245. function fBlockUi() {
  246. $.blockUI({
  247. message: "<h4>Por favor aguarde...</h4>",
  248. css: {
  249. border: 'none',
  250. padding: '5px',
  251. backgroundColor: '#000',
  252. '-webkit-border-radius': '5px',
  253. '-moz-border-radius': '5px',
  254. opacity: .5,
  255. color: '#fff'
  256. }
  257. });
  258. }
  259.  
  260. $(".delete").click(function () {
  261. fBlockUi();
  262. $.ajax({
  263. url: '{{url(' / admin / pacote')}}' + '/' + $(this).attr('data-id'),
  264. method: 'DELETE',
  265. data: {_token: "<?php echo csrf_token(); ?>"},
  266. type: 'DELETE',
  267. success: function (result) {
  268. $("#mensagemAjax").html(result);
  269. $.unblockUI();
  270. window.setTimeout('location.reload()', 1500); //Reloads after three seconds
  271. }
  272. });
  273. });
  274. $(".openModal").on('click', function () {
  275.  
  276. $('#myModal').removeData('bs.modal');
  277. $('#myModal').modal(
  278. {
  279. remote: $(this).attr('data-href')
  280. }
  281. );
  282. $('#myModal').modal('show');
  283. $('#myModal').on('loaded.bs.modal', function (e) {
  284.  
  285. // bind form using ajaxForm
  286. var form = $('.formAjax').ajaxForm({
  287. // target identifies the element(s) to update with the server response
  288. target: '#mensagemAjax',
  289. beforeSubmit: function () {
  290. fBlockUi();
  291. $('#myModal').modal('hide');
  292. $('input').attr('disabled', true);
  293. },
  294. // success identifies the function to invoke when the server response
  295. // has been received; here we apply a fade-in effect to the new content
  296. success: function () {
  297. $('.formAjax').clearForm();
  298. $('#mensagemAjax').fadeIn('slow');
  299. $.unblockUI();
  300. $('input').attr('disabled', false);
  301. window.setTimeout('location.reload()', 1500); //Reloads after three seconds
  302. }
  303. });
  304. });
  305. });
  306. });
  307. function updateStatus(id, status){
  308.  
  309. $("#saqueModal").modal();
  310. $('#idHid').val(id);
  311. $("#statusChange option")
  312. .each(function() { this.selected = (this.text == status); });
  313. }
  314. $('#updateSaque').submit(function () {
  315. if (confirm("Deseja realmente salvar essas atualizações?")){
  316. var dados = $(this).serialize();
  317. var form = $(this).serializeArray();
  318. var here = $(this); // alert div for show alert message
  319. $.ajax({
  320. 'url': here.attr('action'),
  321. 'type': 'POST',
  322. data: dados, // serialize form data
  323. dataType: "html",
  324. beforeSend: function () {
  325. $('#salvarUpdate').html('Carregando...');
  326. },
  327. 'success': function (dados) {
  328. $('#resUpdate').html(dados);
  329. $('#resUpdate').html(dados);
  330. $('#salvarUpdate').html('Salvar');
  331. }
  332. });
  333. return false;
  334. } else{
  335. return false;
  336. }
  337. });
  338.  
  339. </script>
  340. @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement