Customer Update
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
|
||||
<span class="patch_method"></span>
|
||||
@@ -74,16 +75,26 @@
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["name"] %></span>
|
||||
<% end -%>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["contact_no"] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["email"] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -98,7 +109,10 @@
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</select>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["member_group_id"] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -119,13 +133,13 @@
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_id = $(this).val();
|
||||
|
||||
// if(sale_id != 0){
|
||||
// // var url = "/"+customer_id;
|
||||
// update_sale(customer_id,sale_id);
|
||||
// }else{
|
||||
if(sale_id != 0){
|
||||
// var url = "/"+customer_id;
|
||||
update_sale(customer_id,sale_id);
|
||||
}else{
|
||||
|
||||
// var url = "customers/"+customer_id;
|
||||
// }
|
||||
var url = "customers/"+customer_id;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -161,43 +175,43 @@
|
||||
}
|
||||
})
|
||||
|
||||
// function update_sale(customer_id,sale_id) {
|
||||
// $.confirm({
|
||||
// title: 'Confirm!',
|
||||
// content: 'Are You Sure to assign this customer!',
|
||||
// buttons: {
|
||||
function update_sale(customer_id,sale_id) {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to assign this customer!',
|
||||
buttons: {
|
||||
|
||||
// cancel: function () {
|
||||
cancel: function () {
|
||||
|
||||
// },
|
||||
// confirm: {
|
||||
// text: 'Confirm',
|
||||
// btnClass: 'btn-green',
|
||||
// keys: ['enter', 'shift'],
|
||||
// action: function(){
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: "update_sale/" ,
|
||||
// data: {customer_id:customer_id,sale_id:sale_id},
|
||||
// dataType: "json",
|
||||
// success: function(data) {
|
||||
// if(data.status == true)
|
||||
// {
|
||||
// alert('Customer has assigned');
|
||||
// window.location.href = '/origami'
|
||||
// }else{
|
||||
// alert('Record not found!');
|
||||
// location.reload();
|
||||
// }
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "update_sale/" ,
|
||||
data: {customer_id:customer_id,sale_id:sale_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
alert('Customer has assigned');
|
||||
window.location.href = '/origami'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -78,17 +78,25 @@
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["name"] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["contact_no"] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["email"] %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -103,7 +111,11 @@
|
||||
<option value="<%= member.value %>">
|
||||
<%= member.name %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</select>
|
||||
<% if flash[:errors] && !flash[:errors].empty? then -%>
|
||||
<span style="color:red"><%= flash[:errors]["member_group_id"] %></span>
|
||||
<% end -%>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
Reference in New Issue
Block a user