Merge branch 'crm' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-06-22 09:51:22 +06:30
53 changed files with 1580 additions and 574 deletions

View File

@@ -29,6 +29,7 @@
</tr>
<tr>
<th>Select</th>
<th>Sr.no</th>
<th>Name</th>
<th>Company</th>
<th>Contact no</th>
@@ -37,12 +38,14 @@
</thead>
<tbody>
<% if @crm_customers.count > 0 %>
<% if @crm_customers.count > 0 %>
<% @i = 0 %>
<% @crm_customers.each do |crm_customer| %>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
<td><%= @i += 1 %></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company rescue '-' %></td>
<td><%= crm_customer.contact_no %></td>
@@ -72,32 +75,86 @@
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<label>Salutation :</label><br>
<label>
<input type="radio" value="Mr" name="salutation" class="salutation mr" style="width: 30px">Mr
</label>
<label>
<input type="radio" value="Miss" name="salutation" class="salutation miss" style="width: 30px">Miss
</label>
<label>
<input type="radio" value="Mrs" name="salutation" class="salutation mrs" style="width: 30px">Mrs
</label>
<label>
<input type="radio" value="Mdm" name="salutation" class="salutation mdm" style="width: 30px">Mdm
</label>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :name, :class => "form-control col-md-6 name" %>
<%= f.input :name, :class => "form-control col-md-6 name", :required => true %>
<% flash.each do |name, msg| %>
<span class="help-block"><%= msg['name'] %></span>
<% str="[\"#{msg['name']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<label>Gender :</label><br>
<label>
<input type="radio" value="Male" name="gender" class="gender male" style="width:30px;">Male
</label>
<label>
<input type="radio" value="Female" name="gender" class="gender female" style="width:30px;">Female
</label>
</div>
<div class="form-group">
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
</div>
<div class="form-group">
<%= f.input :company, :class => "form-control col-md-6 company" %>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
<% flash.each do |name, msg| %>
<span class="help-block"><%= msg['contact_no'] %></span>
<% str="[\"#{msg['company']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block"><%= str %></span>
<% end -%>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%>
<% flash.each do |name, msg| %>
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block"><%= str %></span>
<% end -%>
</div>
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
<%= f.input :email, :class => "form-control col-md-6 email" %>
<%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%>
<% flash.each do |name, msg| %>
<span class="help-block"><%= msg['email'] %></span>
<% str="[\"#{msg['contact_no']}\"]"
str.gsub!('["', '')
str.gsub!('"]', '') %>
<span class="help-block"><%= str %></span>
<% end -%>
</div>
<div class="form-group">
<%= f.input :address, :class => "form-control col-md-6 address" %>
</div>
<div class="form-group">
<label>Sr.No</label>
<input type="text" name="" value="<%=@count_customer%>" class="form-control" readonly="true">
</div>
<div class="form-group">
<label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
@@ -127,8 +184,6 @@
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
<script type="text/javascript">
$(function() {
$('.datepicker').datepicker({
@@ -170,6 +225,25 @@
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
$('.membership_authentication_code').val(data.membership_authentication_code);
$('#customer_salution').val(data.salution);
$('#customer_nrc_no').val(data.nrc_no);
if (data.gender == 'Male') {
$('.male').prop( "checked", true )
}else{
$('.female').prop( "checked", true )
}
if (data.salution == 'Mr') {
$('.mr').prop( "checked", true )
} else if(data.salution == 'Miss') {
$('.miss').prop( "checked", true )
}else if(data.salution == 'Mrs'){
$('.mrs').prop( "checked", true )
}else{
$('.mdm').prop( "checked", true )
}
$('#update_customer').removeAttr('disabled').val('');
$('#update_customer').attr('value', 'Update');
$('#submit_customer').attr('disabled','disabled');

View File

@@ -175,7 +175,7 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
<button type="button" id="re-print" class="btn btn-primary btn-block">VOID</button>
<button type="button" id="void" class="btn btn-primary btn-block">VOID</button>
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
</div>
</div>
@@ -206,4 +206,10 @@ $('#pay').on('click',function() {
$('#back').on('click',function(){
window.location.href = '/origami/';
})
$('#re-print').click(function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
return false;
});
</script>