void
This commit is contained in:
@@ -389,53 +389,22 @@
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
||||
<!-- <i class="material-icons">reply</i> -->
|
||||
Refresh
|
||||
</button>
|
||||
<!-- -->
|
||||
<% if current_login_employee.role == "cashier" %>
|
||||
<% if @other_payment <= 0 && @sale_payment.nil? %>
|
||||
<% if @sale_payment.nil? %>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<% if @other_payment <= 0 %>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<% if @sale_payment.nil? %>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% if @other_payment <= 0 %>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @other_payment <= 0 && @sale_payment.nil?%>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||
<%end %>
|
||||
<%end %>
|
||||
<% if @sale_payment.nil? %>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<% if @other_payment <= 0 %>
|
||||
<%if @sale_data.total_discount == 0 %>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
|
||||
<hr>
|
||||
<% if current_login_employee.role == "cashier" %>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<% end %>
|
||||
|
||||
<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>
|
||||
<!-- Waiter Buttons -->
|
||||
<% if @sale_payment.nil? %>
|
||||
<hr>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<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 %>
|
||||
</div>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
@@ -1313,55 +1282,6 @@ $(document).ready(function(){
|
||||
var sale_id = $("#sale_id").text() || 0;
|
||||
update_sale("", customer_id, customer_name, sale_id);
|
||||
});
|
||||
|
||||
$(document).on('click', '.access_modal', function(event){
|
||||
type = $(this).data("type");
|
||||
$(".ok").attr("data-action",type)
|
||||
$('#AccessCodeModal').modal('show');
|
||||
});
|
||||
|
||||
function check_emp_access_code(access_code,type) {
|
||||
var url = "/foodcourt/check_emp_access_code/" + access_code ;
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: {},
|
||||
success: function (result) {
|
||||
// console.log(result)
|
||||
if (result.status == true) {
|
||||
createAccessCode(code);
|
||||
if (type == "edit") {
|
||||
var dining_id = $('#dining').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
if (dining_id) {
|
||||
window.location.href = '/foodcourt/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}else{
|
||||
window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}
|
||||
}else if(type == "void"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$('#voidModal').modal('show');
|
||||
// overall_void();
|
||||
}else if(type == "waste") {
|
||||
// $('#AccessCodeModal').modal('hide');
|
||||
// $('#focModal').modal('show');
|
||||
waste_and_spoilage("waste")
|
||||
}else if(type == "spoile") {
|
||||
// $('#AccessCodeModal').modal('hide');
|
||||
// $('#voidModal').modal('show');
|
||||
waste_and_spoilage("spoile")
|
||||
}else if(type == "foc"){
|
||||
$('#AccessCodeModal').modal('hide');
|
||||
$('#focModal').modal('show');
|
||||
// overall_foc();
|
||||
}
|
||||
}else{
|
||||
swal("Oops",result.message,"warning");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#foc').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
var remark = $("#foc_remark").val();
|
||||
@@ -1417,50 +1337,6 @@ $(document).ready(function(){
|
||||
});
|
||||
});
|
||||
|
||||
$('#void').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, void it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$('.confirm').prop("disabled",true);
|
||||
var sale_id = $('#sale_id').text();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/foodcourt/sale/" + sale_id +'/'+cashier_type+ '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||
success: function (result) {result
|
||||
customer_display_view(null,"reload");
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
var flag = localStorage.getItem("trans_flag");
|
||||
if((flag!=null) && (flag != "true")){
|
||||
window.location.href = '/transactions/sales/'+sale_id;
|
||||
}else{
|
||||
if (cashier_type=="cashier") {
|
||||
window.location.href = '/foodcourt';
|
||||
}else{
|
||||
window.location.href = '/foodcourt/'+cashier_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function waste_and_spoilage(remark) {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
var sale_id = $('#sale_id').text();
|
||||
@@ -1784,4 +1660,39 @@ $(document).ready(function(){
|
||||
}
|
||||
},100);
|
||||
});
|
||||
$('#void').on('click', function () {
|
||||
alert("in void");
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, void it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
$('.confirm').prop("disabled",true);
|
||||
var sale_id = $('#sale_id').text();
|
||||
var remark = $("#remark").val();
|
||||
var ajax_url = "/foodcourt/sale/" + sale_id +'/food_court/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||
success: function (result) {result
|
||||
customer_display_view(null,"reload");
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
if(typeof code2lab != 'undefined'){
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
}
|
||||
window.location.href = '/foodcourt/food_court';
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user