tax profiles
This commit is contained in:
@@ -9,14 +9,15 @@
|
||||
|
||||
<div class="form-inputs p-l-15">
|
||||
<%= f.input :group_type, :collection => Lookup.collection_of("tax_profiles"),:input_html=>{:class=>"col-md-10"},:required=>true %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :name, :input_html=>{:onchange=>"checkDuplicate(this.value);"} %>
|
||||
<span id="tax_profile_nameErr" style="color:red;"></span>
|
||||
<%= f.input :rate %>
|
||||
<%= f.input :inclusive %>
|
||||
<%= f.input :order_by %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions p-l-15">
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect btn_submit' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -46,5 +47,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function checkDuplicate(obj){
|
||||
// $("#tax_profile_nameErr").html("");
|
||||
var name = '<%= @name %>';
|
||||
var tax_profiles = JSON.parse('<%= @tax_profiles.to_json.html_safe %>');
|
||||
var group_type = $("#tax_profile_group_type").val();
|
||||
if(tax_profiles!=undefined && tax_profiles!=null && tax_profiles!=""){
|
||||
$.each(tax_profiles,function(key,value){
|
||||
if(value.group_type == group_type){
|
||||
if(name.trim().toLowerCase()!=value.name.trim().toLowerCase()){
|
||||
if(value.name.trim().toLowerCase() == obj.trim().toLowerCase()){
|
||||
$("#tax_profile_name").val("");
|
||||
$("#tax_profile_nameErr").html("duplicate group type and name");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
<tbody>
|
||||
<% @settings_tax_profiles.each do |settings_tax_profile| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= settings_tax_profile.group_type %>
|
||||
</td>
|
||||
<td><%= settings_tax_profile.group_type %></td>
|
||||
<td><%= settings_tax_profile.name %></td>
|
||||
<td><%= settings_tax_profile.rate %></td>
|
||||
<td><%= settings_tax_profile.inclusive %></td>
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><%= t("en.tax_profile") %></h4>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><strong><%= t("views.right_panel.detail.group_type") %>:</strong></td>
|
||||
<td><%= @settings_tax_profile.group_type %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong><%= t("views.right_panel.detail.name") %>:</strong></td>
|
||||
<td><%= @settings_tax_profile.name %></td>
|
||||
|
||||
Reference in New Issue
Block a user