Set Auto Generate ID to exact 16

This commit is contained in:
Phyo
2017-08-31 10:07:44 +06:30
parent 883f5f575a
commit 012b771435

View File

@@ -10,7 +10,11 @@
<%= render 'form', promotion: @promotion %>
</div>
<script>
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
var r_id = Math.random().toString(36).slice(5);
if(r_id.length > 16){
r_id = r_id.substring(0, 15);
}
$("#promotion_promo_code").val(r_id);
// $( "#fromtime" ).timepicker();
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
</script>