add customer type and tax profile in customer
This commit is contained in:
@@ -69,7 +69,9 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
def create
|
||||
# Remove "" default first
|
||||
params[:customer][:tax_profiles].delete_at(0)
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
@@ -95,15 +95,14 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Select Customer Type</label>
|
||||
<select class="selectpicker form-control col-md-12" name="customer[customer_type]" style="height: 40px" >
|
||||
<label>Select Customer Type</label>
|
||||
<select class="selectpicker form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
|
||||
<% Lookup.where("lookup_type = ?", "customer_type" ).each do |ct| %>
|
||||
<option value="<%= ct.value %>">
|
||||
<%= ct.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :tax_profiles, :collection => @taxes, :input_html => { :multiple => true }, :class => "form-control col-md-6 tax_profiles" %>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +129,14 @@ $(document).on('click',".customer_tr",function(){
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
success: function(data) {
|
||||
// Selected for Taxes
|
||||
//var taxes = JSON.stringify(data.tax_profiles);
|
||||
var parse_taxes = JSON.parse(data.tax_profiles);
|
||||
$.each(parse_taxes, function(i, value){
|
||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected");
|
||||
});
|
||||
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_name').val(data.name);
|
||||
$('#customer_company').val(data.company);
|
||||
@@ -138,6 +145,7 @@ $(document).on('click',".customer_tr",function(){
|
||||
$('#customer_salutation').val(data.salutation);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#customer_card_no').val(data.card_no);
|
||||
$('#customer_type').val(data.customer_type);
|
||||
$('#paypar_account_no').val(data.paypar_account_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
|
||||
Reference in New Issue
Block a user