update void and complete sale

This commit is contained in:
Aung Myo
2017-06-16 10:20:20 +06:30
parent f0ea6f3c56
commit 09a96372c8
7 changed files with 93 additions and 100 deletions

View File

@@ -160,67 +160,7 @@
<div class="tab-pane" id="customer" role="tabpanel">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<th width="20%"><h4>Customer Details</h4></th>
<th width="20%"></th>
<td></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Name</th>
<td><%= @customer.name %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Email</th>
<td><%= @customer.email %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Contact no</th>
<td><%= @customer.contact_no %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Company</th>
<td><%= @customer.company rescue '-' %></td>
</tr>
<tr>
<th width="20%"></th>
<th width="20%">Date Of Birth</th>
<td><%= @customer.date_of_birth rescue '-' %> </td>
</tr>
<tr>
<th width="20%"><h4>Membership Details</h4></th>
<td width="20%"></td>
<td></td>
</tr>
<% if @membership == 0 %>
<tr>
<td colspan="2">"There is no membership data"</td>
</tr>
<% else %>
<% @membership.each do |member| %>
<tr>
<td width="20%"></td>
<th width="20%"><%= member["accountable_type"] %></th>
<td><%= member["balance"] %></td>
</tr>
<% end %>
<% end %>
</tr>
</tbody>
</table>
<!-- -->
</div>
</div>
@@ -238,9 +178,9 @@
<i class="fa fa-trash fa-lg"></i> Void Sale
</a>
<!-- <a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success pull-right btn-lg">
<a href="<%= transactions_manual_complete_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-success pull-right btn-lg">
<i class="fa fa-invoice fa-lg"></i> Complete Sale
</a> -->
</a>
</div>
</div>

View File

@@ -1,81 +0,0 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= transactions_sales_path %>">Sale</a>
</li>
<li class="active">
<a href="<%= transactions_sale_path(@sale) %>"><%= @sale %></a>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
<h3>Choose Reason For Void</h3>
<br>
<p class="hidden sale-id"><%= @sale %></p>
<table class="table table-striped">
<% @reason.each do |r| %>
<tr class="customer_tr">
<td></td>
<td>
<input type="radio" style="width:20px;" name="reason" value="<%=r.name%>" class="checkbox_check" >
<!-- <%= check_box_tag "reason", "#{r.name}",:class => 'checkbox_check' rescue '-' %> -->
</td>
<td><%= label_tag "reasons[#{r.id}]", r.name, :style=>'font-weight:bold;font-size:18px;' rescue '-' %></td>
</tr>
<% end %>
</table>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2">
<br><br><br>
<a href="<%= transactions_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"><i class="fa fa-arrow-left fa-lg"></i> Cancel
</a>
<button type="button" style="margin-top: 10px " class="btn btn-danger pull-right btn-lg" id="void" disabled><i class="fa fa-trash fa-lg"></i> Void
</button>
</div>
</div>
<style>
input[type='checkbox'] {
width: 20px;
height: 20px;
}
</style>
<script>
$(function() {
$(document).on('click',".customer_tr",function(){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
$('#void').removeAttr('disabled')
});
$("#void").click(function() {
var reason = $('input[type="radio"]:checked').val();
console.log(reason)
var sale_id = $(this).find(".customer-id").text();
$.ajax({
type: 'POST',
url: 'manual_void_sale',
data: {reason: reason, sale_id: sale_id},
success: function(data){
// window.location.href = "transactions/sales"
}
});
});
});
</script>