Files
sx-fc/app/views/origami/shifts/show.html.erb
2017-10-23 11:38:10 +06:30

50 lines
1.6 KiB
Plaintext
Executable File

<div class="container-fluid">
<div class='row clearfix'>
<div class='col-md-10'>
<h1>Close Cashier</h1>
<br>
<table class='table table-striped'>
<tr>
<td>Shift Started At</td>
<td><%= @shift.shift_started_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></td>
</tr>
<tr>
<td>Cashier Name</td>
<td><%= @shift.employee.name rescue ''%></td>
</tr>
</table>
<hr>
<div class='row clearfix '>
<div class='col-md-5'>
<span style='font-size:20px;'><b>Closing Balance</b></span>
</div>
<div class='col-md-6'>
<span style='font-size:20px;'><b><input type='text' class="form-control" id='closing_balance_amount' value=''></b></span>
</div>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn bg-default btn-block" id='back'> Back </button>
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> Close Cashier </button>
</div>
</div>
</div>
<script>
$('#close_cashier').on('click',function(){
var amount = $('#closing_balance_amount').val();
var shift_id = "<%= @shift.id rescue ""%>"
$.ajax({type: "POST",
url: "<%= origami_close_shift_path %>",
data: "closing_balance="+ amount + "&shift_id="+ shift_id,
success:function(result){
console.log(result)
window.location.href = '/';
}
});
})
$('#back').on('click',function(){
window.location.href = '/origami';
})
</script>