check and fixed SQA feedback

This commit is contained in:
phyusin
2018-03-09 09:49:19 +06:30
parent fcc076a19e
commit 7dd0f71894
13 changed files with 162 additions and 58 deletions

View File

@@ -153,6 +153,14 @@
<% if current_user.role != "waiter" || @status != "sale"%>
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
<%end%>
<!-- <% if @status != "order"%>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% end %>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<% if @status != "order"%>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<% end %> -->
<% if current_user.role != "waiter" && @status != "order"%>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<%end%>
@@ -163,6 +171,7 @@
</div>
</div>
<script>
var cashier_type = "quick_service";
$(document).ready(function(){
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
@@ -203,5 +212,61 @@ $(document).ready(function(){
}
});
});
// bind survey to order or sale
$("#survey").on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys";
});
// bind customer to order or sale
$("#customer").on('click', function () {
var sale = $('#sale_id').val();
if (sale.includes("SAL")) {
var sale_id = sale;
} else {
var sale_id = $('#save_order_id').val();
}
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers/pending";
});
// Add Other Charges
$('#other-charges').click(function () {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').val();
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges';
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
});
// Discount for Payment
$('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
} else {
var sale_id = $('#save_order_id').val();
}
if (sale_id != "") {
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount';
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
swal("Oops","You are not authorized for Discount","warning")
}
return false;
});
});
</script>