Advertisement
punces

generate_voucher.php

Jun 1st, 2017
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.29 KB | None | 0 0
  1. <script>
  2. function once_load() {
  3.  
  4. }
  5.  
  6. function doGenerateVoucher() {
  7.  
  8. konfirmasi = confirm('Apa kamu yakin ingin meng-GENERATE VOUCHER ini?');
  9. if (konfirmasi) {
  10. var namavoucher = $('[name="namavoucher"]').val();
  11. var qty = $('[name="qty"]').val();
  12. var userprofile = $('[name="userprofile"]').val();
  13. var limituptime = $('[name="limituptime"]').val();
  14. var tipepassword = $('[name="tipepassword"]').val();
  15. var password = '';
  16. if (tipepassword == 'mt') {
  17. var password = $('[name="password"]').val();
  18. }
  19. $('#luding').show();
  20. $.ajax({
  21. type: "GET",
  22. url: "<?php echo base_url() . 'voucher/do_generate_voucher'; ?>",
  23. data: "namavoucher=" + namavoucher + "&qty=" + qty + "&userprofile=" + userprofile + "&limituptime=" + limituptime + "&tipepassword=" + tipepassword + "&password=" + password,
  24. success: function(resp) {
  25. $('#luding').hide();
  26. $("#div_generate_voucher").html(resp);
  27. resetForm();
  28. },
  29. error: function(event, textStatus, errorThrown) {
  30. $('#luding').hide();
  31. $('#lbl_msg').html('Terjadi kesalahan pada sistem ajax. Saran: Refresh halaman dan ulangi kembali. (Error Message: ' + textStatus + ' , HTTP Error: ' + errorThrown + ')');
  32. }
  33. });
  34. }
  35. }
  36.  
  37. function togglePasswordType() {
  38. if ($('#tipepassword').val() == 'at') {
  39. $('#password').hide();
  40. }
  41. if ($('#tipepassword').val() == 'sm') {
  42. $('#password').hide();
  43. }
  44. if ($('#tipepassword').val() == 'mt') {
  45. $('#password').show();
  46. }
  47. // } else {
  48. // $('#password').show();
  49. // }
  50. }
  51.  
  52. function resetForm() {
  53. $('#tipepassword').selectpicker('deselectAll');
  54. $('#userprofile').selectpicker('deselectAll');
  55. $('#namavoucher').val('');
  56. $('#password').val('');
  57. $('#qty').val('');
  58. $('#limituptime').val('');
  59. }
  60.  
  61. once_load();</script>
  62. <!--HEADER-->
  63. <div class="header">
  64. <!--TITLE--><center style="margin-bottom:-20px;"><h1><span style="font-family:Arial;font-weight:bold;"><span style="color:#009988;">GENERATE</span> VOUCHER</span></h1></center><!--END TITLE-->
  65. <!--DESCRIPTION--><!-- <center><h2><span style="font-size:11px;color:#008899;">..::: PENGGUNA RTPAPAT.NET :::...</span></h2></center> --><!--END DESCRIPTION-->
  66. </div>
  67. <div class="content">
  68. <form class="form-horizontal" role="form">
  69. <div class="form-group">
  70. <label class="control-label col-sm-2">Nama Voucher</label>
  71. <div class="col-sm-10">
  72. <input type="text" class="form-control" id="namavoucher" name="namavoucher" placeholder="Nama Voucher" autocomplete="off">
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <label class="control-label col-sm-2">Password</label>
  77. <div class="col-sm-10">
  78. <select id="tipepassword" name="tipepassword" class="selectpicker" title="Tipe Password" data-width="100%" required onchange="togglePasswordType()">
  79. <option value="at">Username dan Password "TIDAK SAMA"</option>
  80. <option value="sm">Username dan Password "SAMA"</option>
  81. <option value="mt">Manual</option>
  82. </select>
  83. <input type="text" class="form-control" id="password" name="password" placeholder="Password" style="display:none;margin-top:10px;" autocomplete="off">
  84. </div>
  85. </div>
  86. <div class="form-group">
  87. <label class="control-label col-sm-2">User Profile</label>
  88. <div class="col-sm-10">
  89. <select id="userprofile" name="userprofile" class="form-control selectpicker" data-live-search="true" title="Pilih profil pengguna">
  90. <?php
  91. foreach ($this->mikrostator->get('hotspotuserprofile') as $row) {
  92. $name = $row['name'];
  93. echo '<option value="' . $name . '">' . $name . '</option>';
  94. }
  95. ?>
  96. </select>
  97. </div>
  98. </div>
  99. <div class="form-group">
  100. <label class="control-label col-sm-2">Qty</label>
  101. <div class="col-sm-10">
  102. <input type="text" class="form-control" id="qty" name="qty" placeholder="Qty" autocomplete="off">
  103. </div>
  104. </div>
  105. <div class="form-group">
  106. <label class="control-label col-sm-2">Limit Uptime</label>
  107. <div class="col-sm-10">
  108. <input type="text" class="form-control" id="limituptime" name="limituptime" placeholder="Limit Uptime. Ex: 7d12h59m59s">
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <div class="col-sm-offset-2 col-sm-10">
  113. <button type="button" class="btn btn-danger" onclick="doGenerateVoucher()">PROSES</button>
  114. </div>
  115. </div>
  116. </form>
  117. <div class="table-responsive" id="div_generate_voucher">
  118.  
  119. </div>
  120. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement