WIP doesn't work....

This commit is contained in:
Barnabé 2021-09-24 18:55:00 +02:00
parent fc9a97fe3f
commit 0199f0e520
3 changed files with 14 additions and 12 deletions

View File

@ -149,12 +149,13 @@ class Admin::BuyListsController < ApplicationController
@p_customer_sheet = PCustomerSheet.find(params[:id]) @p_customer_sheet = PCustomerSheet.find(params[:id])
@p_customer = @p_customer_sheet.p_customer @p_customer = @p_customer_sheet.p_customer
@price_line_id = params[:price_line_id]
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!)
if @p_customer_sheet.update(state: params[:state])
@p_customer_sheets = PCustomerSheet.order(:id).all @p_customer_sheets = PCustomerSheet.where(:state => ["AV BPA", "PAS BPA", "BPA"])
return @p_customer_sheet
redirect_to admin_p_customer_sheet_path(@p_customer_sheet) # redirect_to admin_p_customer_sheet_path(@p_customer_sheet)
else else
render action: "edit" render action: "edit"
@ -235,6 +236,4 @@ class Admin::BuyListsController < ApplicationController
end end
end end

View File

@ -236,7 +236,8 @@
%td %td
-@p_customer_sheet = price_line.price_line_block.price_lineable -@p_customer_sheet = price_line.price_line_block.price_lineable
-if true -form = false
-if form
%form %form
=semantic_form_for [:admin, @p_customer_sheet], remote: true, authenticity_token: true do |f| =semantic_form_for [:admin, @p_customer_sheet], remote: true, authenticity_token: true do |f|
=f.inputs class: "form-inline d-flex flex-nowrap" do =f.inputs class: "form-inline d-flex flex-nowrap" do
@ -247,10 +248,12 @@
-if false -if false
=f.actions class: "btn btn-primary ml-1" do =f.actions class: "btn btn-primary ml-1" do
=f.action :submit, label: "#{ic(:check).html_safe}" =f.action :submit, label: "#{ic(:check).html_safe}"
-if false -if !form
=form_with url: update_state_admin_p_customer_sheet_path(@p_customer_sheet), method: :get do |f| %form
=form_with url: admin_buy_list_path(@p_customer_sheet), method: :patch, remote: true, authenticity_token: true, id: "p_customer_sheet_state_#{@p_customer_sheet.id}" do |f|
=hidden_field_tag :price_line_id, price_line.id
=f.select :state, ["AV BPA", "PAS BPA","BPA", "Traitée"] =f.select :state, ["AV BPA", "PAS BPA","BPA", "Traitée"]
=f.submit =f.submit for: "p_customer_sheet_state_#{@p_customer_sheet.id}"
=#state_helper price_line.price_line_block.price_lineable.state =#state_helper price_line.price_line_block.price_lineable.state
%td %td

View File

@ -1,2 +1,2 @@
console.log('coucou') console.log('coucou');
$('#price_line_row_<%= @price_line_id %>').replaceWith("<%= escape_javascript(render(@p_customer_sheet))%>"); $('#price_line_row_<%= @price_line_id %>').replaceWith("<%= escape_javascript(render(@p_customer_sheet))%>");