@@ -979,22 +1002,58 @@ $('#add_invoice').on('click',function(){
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/cashier/edit";
});
- $('#void').on('click',function () {
- var sure = confirm("Are you sure want to Void");
- if (sure == true) {
- var sale_id = $('#sale_id').val();
- var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
- $.ajax({
- type: 'POST',
- url: ajax_url,
- success: function () {
- window.location.href = '/origami/';
- }
- })
- } else {
+ // $('#void').on('click',function () {
+ // var sure = confirm("Are you sure want to Void");
+ // if (sure == true) {
+ // var sale_id = $('#sale_id').val();
+ // var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
+ // $.ajax({
+ // type: 'POST',
+ // url: ajax_url,
+ // success: function () {
+ // window.location.href = '/origami/';
+ // }
+ // })
+ // } else {
+ // }
+ // });
+
+ $('#void').on('click', function () {
+ var access_code = localStorage.getItem("access_code");
+ if ($(this).attr('active')=== "true") {
+ 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) {
+ var sale_id = $('#sale_id').val();
+ var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
+ var remark = $("#remark").val();
+
+ $.ajax({
+ type: 'POST',
+ url: ajax_url,
+ data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
+ success: function (result) {
+ // For Server Print - from jade
+ if ($("#server_mode").val() == "cloud") {
+ code2lab.printFile(result.filepath.substr(6), result.printer_url);
+ }
+ window.location.href = '/origami/';
+ }
+ });
+ }
+ });
+ }else{
+ swal("Opps","You are not authorized for void","warning")
}
- });
+ });
$('#commissions').on('click', function () {
var dining_id = "<%= @room.id %>"
@@ -1081,6 +1140,12 @@ $('#add_invoice').on('click',function(){
});
}
+ $(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 = "/origami/check_emp_access_code/" + access_code ;
$.ajax({