59 lines
1.1 KiB
Ruby
59 lines
1.1 KiB
Ruby
# -*- encoding : utf-8 -*-
|
|
|
|
class Public::PCustomerSheetsController < ApplicationController
|
|
layout "public"
|
|
|
|
|
|
def index
|
|
@p_customer_sheets = current_p_customer.p_customer_sheets.where("state != 'panier' ").all
|
|
|
|
|
|
end
|
|
|
|
def show
|
|
@p_customer_sheet = current_p_customer.p_customer_sheets.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
|
|
@p_customer_sheet = current_p_customer.p_customer_sheets.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
def update
|
|
@p_customer_sheet = current_p_customer.p_customer_sheets.find(params[:id])
|
|
|
|
|
|
|
|
@p_customer_sheet.validate_payment_type = true
|
|
|
|
|
|
if @p_customer_sheet.update_attributes(params.require(:p_customer_sheet).permit!)
|
|
@p_customer_sheet.validate_particulars = true
|
|
@p_customer_sheet.particular_bill.force_validation =true
|
|
@p_customer_sheet.particular_send.force_validation=true
|
|
|
|
if @p_customer_sheet.particular_bill.save and @p_customer_sheet.particular_send.save
|
|
redirect_to public_p_customer_sheets_path
|
|
else
|
|
render action: "edit"
|
|
end
|
|
|
|
|
|
|
|
else
|
|
render action: "edit"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|