SignupManagement.blade.php 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. @extends('admin.master')
  2. @section('content')
  3. <div class="row">
  4. <div class="col-lg-12">
  5. <div class="contentpanel">
  6. <!--<form id="listForm" method="post">-->
  7. <form id='searchForm' action="{{ route('signup.export') }}" method="POST">
  8. @csrf
  9. <!-- 功能按鈕(新增/批量處理等等) -->
  10. <div class="row" style="margin-bottom: 5px;">
  11. <div class="col-lg-12">
  12. <ol class="headermenu">
  13. <li>
  14. <button class="btn btn-darkblue btn-xs" id="export"><strong>匯出</strong></button>
  15. </li>
  16. </ol>
  17. </div>
  18. </div>
  19. <!-- 搜尋段 -->
  20. <div class="panel panel-default">
  21. <div class="panel-heading _panel-heading" data-bs-toggle="collapse" data-bs-target="#search_content">
  22. <h3 class="panel-title m-0">報名資料</h3>
  23. </div>
  24. <div id="search_content" class="collapse show">
  25. <div class="panel-body row">
  26. <!-- 關鍵字 -->
  27. <div class="form-group _form-group col-sm-12 col-md-6 col-xl-3">
  28. <label for="keyword">關鍵字(可搜尋欄位:first name, last name, company name, company email, backup email, phone number)</label>
  29. <input type="text" class="form-control input-sm" id="keyword" name="keyword" maxlength="50">
  30. </div>
  31. <!-- Search -->
  32. <div class="form-group _form-group col-sm-12 col-md-12 col-xl-12">
  33. <a class="btn btn-success btn-sm _fz-12" onclick="javascript: custom_search();">
  34. <div class="_glyphicon _glyphicon-search"></div>
  35. </a>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <hr class="search-hr"/>
  41. <!-- 列表段 -->
  42. <div class="row">
  43. <div class="col-lg-12">
  44. <table id="GridView1" class="table table-striped table-bordered" cellspacing="0"
  45. width="100%">
  46. <thead>
  47. <tr>
  48. <th>序號</th>
  49. <th>first name</th>
  50. <th>last name</th>
  51. <th>company name</th>
  52. <th>country</th>
  53. <th>track no</th>
  54. <th>session(TW only)</th>
  55. <th>lunch(TW only)</th>
  56. <th>報名時間</th>
  57. </tr>
  58. </thead>
  59. </table>
  60. </div>
  61. </div>
  62. </form>
  63. <!-- row -->
  64. </div>
  65. </div>
  66. </div>
  67. @endsection
  68. @section('extjs')
  69. <script>
  70. $(document).ready(function () {
  71. var table = $('#GridView1').dataTable({
  72. "scrollX": true,
  73. "processing": true,
  74. "serverSide": true,
  75. "ajax": "signup/grid",
  76. "paging": true,
  77. "ordering": true,
  78. "info": true,
  79. "order": [[0, "desc"]],
  80. "stateSave": true,
  81. "pagingType": "full",
  82. "bFilter": true,
  83. "aoColumnDefs": [{
  84. 'bSortable': false,
  85. // 'aTargets': [0] //不想參加排序的欄位,可指定多個,逗號分隔
  86. }],
  87. "fnDrawCallback":function( oSettings ) {
  88. table.find('.downloadBtn').on('click',function(){
  89. let urlToDownload = $(this).data('for-download');
  90. let downloadFilename = urlToDownload.split('/');
  91. forceDownload($(this).data('for-download'),downloadFilename[downloadFilename.length-1]);
  92. });
  93. }
  94. });
  95. // 從網址參觸發搜尋
  96. custom_search()
  97. $('#GridView1_filter').hide();
  98. });
  99. //客製化搜尋欄位
  100. function custom_search() {
  101. $('#GridView1').DataTable()
  102. .column(1).search($('#keyword').val())
  103. ;
  104. $('#GridView1').dataTable().fnDraw(true);
  105. }
  106. function forceDownload(url, fileName){
  107. var xhr = new XMLHttpRequest();
  108. xhr.withCredentials = true;
  109. xhr.open("GET", url, true);
  110. xhr.responseType = "blob";
  111. xhr.onload = function(){
  112. var urlCreator = window.URL || window.webkitURL;
  113. var imageUrl = urlCreator.createObjectURL(this.response);
  114. var tag = document.createElement('a');
  115. tag.href = imageUrl;
  116. tag.download = fileName;
  117. document.body.appendChild(tag);
  118. tag.click();
  119. document.body.removeChild(tag);
  120. }
  121. xhr.send();
  122. }
  123. // 匯出報告
  124. $("#export").click(function () {
  125. $('#searchForm').submit();
  126. });
  127. </script>
  128. @endsection