suite commandes

This commit is contained in:
Nicolas Bally 2017-09-27 12:06:13 +02:00
parent 8c67c1dade
commit 1c6c9ff596
31 changed files with 775 additions and 101 deletions

View File

@ -167,6 +167,80 @@ class Admin::ProductOrdersController < ApplicationController
end
def bl
@product_order = ProductOrder.find(params[:id])
if !@product_order.bl_number?
@product_order.generate_bl_number
end
if @product_order.bl_number?
@temp_file = "#{Rails.root}/pdf/bl/BL_#{@product_order.id}_temp.pdf"
@final_file = "#{Rails.root}/pdf/bl/BL_#{@product_order.id}.pdf"
view = ActionView::Base.new(Rails.root.join('app/views'))
view.class.include ApplicationHelper
view.class.include Rails.application.routes.url_helpers
pdf = view.render(
:pdf => "#{@product_order.id}",
:template => "admin/product_orders/bl.html.haml",
:locals => {:@product_order => @product_order})
# then save to a file
pdf = WickedPdf.new.pdf_from_string(pdf, :margin => { top: 0, # default 10 (mm)
bottom: 0,
left: 0,
right: 0 })
save_path = @temp_file
File.open(save_path, 'wb') do |file|
file << pdf
end
require 'posix/spawn'
::POSIX::Spawn::Child.new 'pdftk', @temp_file, 'background', Rails.root.join('pdf_stamp', 'bl.pdf').to_s, 'output', @final_file
#pdftk /Users/nico/Desktop/Sanstitre4.pdf background /Users/nico/Dev/negos_app/pdf_stamp/bl.pdf output sortie.pdf
@data_to_send = File.open( @final_file).read
send_data @data_to_send, :filename =>"bl.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
else
render :inline => "Aucun BL disponnible"
end
end
protected
def find_product_orders

View File

@ -40,12 +40,12 @@ class Public::ProductOrdersController < ApplicationController
redirect_to new_public_product_order_path(:paid => true)
else
@product_order.customer = current_customer
#@product_order.product_customer.particular_bill.skip_validation = true
#@product_order.product_customer.particular_send.skip_validation = true
@product_order.customer.particular_bill.skip_validation = true
@product_order.customer.particular_send.skip_validation = true
@product_order.save
#@product_order.product_customer.particular_bill.skip_validation = false
@product_order.customer.particular_bill.skip_validation = false
@product_order.product_order_payment_type_ok_id = 3 if !@product_order.product_order_payment_type_ok_id?
end
@ -54,27 +54,27 @@ class Public::ProductOrdersController < ApplicationController
def particulars_save
@product_order = ProductOrder.find(session[:product_order_id])
#@product_order.product_customer.particular_bill.skip_validation = false
#@product_order.product_customer.particular_bill.skip_email = true
@product_order.customer.particular_bill.skip_validation = false
@product_order.customer.particular_bill.skip_email = true
if !@product_order.particular_idem
@product_order.product_customer.particular_send.skip_validation = false
@product_order.product_customer.particular_send.skip_email = true
@product_order.customer.particular_send.skip_validation = false
@product_order.customer.particular_send.skip_email = true
end
if @product_order.update_attributes(params.require(:product_order).permit!)
@product_order.particular_bill = @product_order.product_customer.particular_bill.dup
@product_order.particular_bill = @product_order.customer.particular_bill.dup
@product_order.particular_idem = @product_order.product_customer.particular_idem
@product_order.particular_idem = @product_order.customer.particular_idem
if @product_order.particular_idem
@product_order.particular_send = @product_order.product_customer.particular_bill.dup
@product_order.particular_send = @product_order.customer.particular_bill.dup
else
@product_order.product_customer.particular_send.skip_validation = false
@product_order.product_customer.particular_send.skip_email = true
@product_order.customer.particular_send.skip_validation = false
@product_order.customer.particular_send.skip_email = true
@product_order.particular_send = @product_order.product_customer.particular_send.dup
@product_order.particular_send = @product_order.customer.particular_send.dup
end
@product_order.save
@ -133,7 +133,7 @@ class Public::ProductOrdersController < ApplicationController
@product_order = ProductOrder.find(session[:product_order_id])
@product_order.archive_now
if !@product_order.product_order_payment_type_ok_id?
@product_order.product_order_payment_type_ok_id = 3
@product_order.product_order_payment_type_ok_id = 10
end
@product_order.force_payment = true
@ -170,7 +170,7 @@ class Public::ProductOrdersController < ApplicationController
if @product_order.product_order_payment_type_ok_id == 3
redirect_to paid_by_ogone_public_product_orders_path()
else
if @product_order.product_order_payment_type_ok_id == 1
if @product_order.product_order_payment_type_ok_id == 10
@product_order_payment = ProductOrderPayment.create(:product_order_payment_type_id => @product_order.product_order_payment_type_ok_id)
@product_order.product_order_payments << @product_order_payment
@product_order.product_order_payment_ok = @product_order_payment
@ -277,7 +277,7 @@ class Public::ProductOrdersController < ApplicationController
puts "AAAAAAAAAAAAAA"
options = {
:amount => @product_order.total_ttc.to_i,
:email => @product_order.product_customer.email ,
:email => @product_order.customer.email ,
:first_name => @product_order.particular_bill.firstname,
:last_name => @product_order.particular_bill.name,
:return_url => "http://#{HOSTNAME}"+paid_by_payplug_confirm_public_product_orders_path(:token => @product_order_payment.token),
@ -472,8 +472,8 @@ class Public::ProductOrdersController < ApplicationController
@product_order_payment.save
@product_order.product_order_payment_ok = @product_order_payment if @product_order.paid
@product_order.product_customer.particular_bill.skip_email = true
@product_order.product_customer.particular_send.skip_email = true
@product_order.customer.particular_bill.skip_email = true
@product_order.customer.particular_send.skip_email = true
@product_order.save(:validate => false)
@product_order.after_paid

View File

@ -0,0 +1,28 @@
# -*- encoding : utf-8 -*-
class ProductOrdersMails < ActionMailer::Base
layout 'mail'
default from: "Negos - contact@negos.pro"
def confirmation_cheque(product_order, options = {})
@options = options
@product_order = product_order
@email = @product_order.customer.email
@title = "Merci pour votre commande."
mail(:to => @email, :bcc => "info@nicolasbally.com", :subject => @title)
end
def confirmation_cb(product_order, options = {})
@options = options
@product_order = product_order
@email = @product_order.customer.email
@title = "Merci pour votre commande."
mail(:to => @email, :bcc => "info@nicolasbally.com", :subject => @title)
end
end

View File

@ -1,5 +1,12 @@
class Customer < ActiveRecord::Base
belongs_to :particular_bill, :class_name => "Particular"
accepts_nested_attributes_for :particular_bill
belongs_to :particular_send, :class_name => "Particular"
accepts_nested_attributes_for :particular_send

43
app/models/particular.rb Normal file
View File

@ -0,0 +1,43 @@
class Particular < ActiveRecord::Base
belongs_to :owner, :polymorphic => true
validates :name, :presence => true, :if => :force_validation
validates :firstname, :presence => true, :if => :force_validation
validates :email, :presence => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :if => :force_email_validation
validates :address_2, :presence => true, :if => :force_validation
validates :cp, :presence => true, :if => :force_validation
validates :city, :presence => true, :if => :force_validation
validates :country, :presence => true, :if => :force_validation
validates :tel, :presence => true, :if => :force_validation
validates :organisation, :presence => true, :if => :validate_pro
attr_accessor :validate_email, :skip_email
def validate_pro
true if self.force_validation and self.pro
end
def force_email_validation
true if (self.validate_email or self.force_validation) and !skip_email
end
def force_validation
if self.skip_validation
false
else
true
end
end
def address_longue
address_2.to_s + " " + address_3.to_s
end
def civilite_prodons
if self.civilite == "M"
"MONSIEUR"
elsif self.civilite == "Mme"
"MADAME"
else
""
end
end
end

View File

@ -1,6 +1,5 @@
class ProductOrder < ActiveRecord::Base
belongs_to :customer
has_many :product_order_products
@ -15,9 +14,9 @@ class ProductOrder < ActiveRecord::Base
accepts_nested_attributes_for :particular_send
belongs_to :product_customer
belongs_to :customer
accepts_nested_attributes_for :product_customer
accepts_nested_attributes_for :customer
belongs_to :product_fdp
belongs_to :product_fdp_archived, :class_name => "ProductFdp"
@ -77,6 +76,14 @@ class ProductOrder < ActiveRecord::Base
def total_ttc
total_ht + total_tva
end
def total_tva
total_articles_tva
end
def total_ht
total_articles + total_fdp - vourcher_reduction
end
@ -105,11 +112,34 @@ class ProductOrder < ActiveRecord::Base
def archived_total_ttc
archived_total_ht + archived_total_tva
end
def archived_total_tva
archived_total_articles_tva
end
def archived_total_ht
archived_total_articles + archived_total_fdp - archived_vourcher_reduction
end
def archived_total_articles_tva
total = 0.0
product_order_products.each do |p|
total += p.archived_final_price_ttc_with_qty * (p.tva_archived/100.0)
end
total
end
def archived_total_articles
archived_total = 0.0
product_order_products.each do |p|
@ -161,6 +191,33 @@ class ProductOrder < ActiveRecord::Base
self.generate_bill_number
self.generate_bl_number
end
def generate_bl_number
if !self.bl_number and self.product_order_payment_type_ok_id == 10
self.bl_year = self.updated_at.year
last_number = 0
last_number = ProductOrder.where("bl_number is not null").where(:bl_year => self.bl_year ).order("bl_index DESC").first.bl_index if ProductOrder.where("bl_number is not null").where(:bl_year => self.bl_year ).first
self.bl_index = last_number+1
self.bl_number = self.bl_ap+self.bl_year.to_s+('%05d' % self.bl_index)
self.save(:validate => false)
end
end
def bl_ap
"VS"
end
def after_ship
@ -252,6 +309,19 @@ class ProductOrder < ActiveRecord::Base
total
end
def total_articles_tva
total = 0.0
product_order_products.each do |p|
total += p.final_price_ttc_with_qty * (p.tva/100.0)
end
total
end
def total_fdp(fdp=self.product_fdp)
if fdp
if self.total_ttc_without_fdp < fdp.price_max

View File

@ -10,6 +10,14 @@ class ProductOrderProduct < ActiveRecord::Base
belongs_to :archived_product_size, class_name: "ProductSize"
belongs_to :archived_product_option, class_name: "ProductOption"
def tva
20.0
end
def tva_archived
self.tva
end
def price_ttc_with_qty
qty.to_f * product.price_ttc.to_f
end

View File

@ -0,0 +1,19 @@
-if f.object.particular_type?
%h4=f.object.particular_type
=f.hidden_field :particular_type
=f.hidden_field :skip_validation, :class => "skip_validation"
=f.input :name, :label => "Nom de famille"
=f.input :firstname, :label => "Prénom"
=f.input :pro, :label => "Organisation ?"
=f.input :organisation, :label => "Organisation"
=f.input :address_1, :label => "Adresse 1"
=f.input :address_2, :label => "Adresse 2"
=f.input :address_3, :label => "Adresse 3"
=f.input :address_4, :label => "Adresse 4"
=f.input :address_5, :label => "Adresse 5"
=f.input :cp, :label => "Code postal"
=f.input :city, :label => "Ville"
=f.input :country, :label => "Pays", :priority_countries => ["FR", "CH", "BE"], :include_blank => true
=f.input :email, :label => "Email"
=f.input :tel, :label => "Téléphone"

View File

@ -0,0 +1,17 @@
%strong
=particular.firstname
=particular.name
%br
=particular.address_2
-if particular.address_3?
%br
=particular.address_3
%br
=particular.cp
=particular.city
%br
=particular.country

View File

@ -1,4 +1,4 @@
%tr#product_order_row.product_order_row{:id => product_order.id, :class => ("success" if product_order.shiped)}
%tr#product_order_row.product_order_row{:id => product_order.id, :class => ("success" if product_order)}
%td
=product_order.id
%td

View File

@ -0,0 +1,229 @@
!!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content=>"text/html; charset=UTF-8"}
%meta{:name=>"viewport", :content=>"width=device-width,initial-scale=1"}
:css
body{
font-size:11pt;
padding :0px;
margin:0px;
background-color: transparent;
font-family:"Arial" ;
padding:1cm;
}
#main{
//margin-left:4.2cm;
}
td, th{
//border:1px solid black;
padding:5px;
vertical-align:top;
}
th{
font-weight:normal;
border-bottom:1px solid gray;
text-align:left;
}
table{
border-collapse:collapse;
}
tr{
page-break-inside:avoid;
}
#bottom{
page-break-inside:avoid;
}
.right{
text-align:right;
}
.line p{
margin:0px;
}
.description{
padding-top:2pt;
display:block;
}
.bot_separate{
height:50pt;
}
.upcase{
text-transform:uppercase;
}
h3{
font-size:1em;
margin-bottom:5px;
font-weight:normal;
}
%body
#main
%div{:style => "position:absolute;top:1cm;right:1cm;text-align:right;"}
Bon de commande n°
=@product_order.bill_number
%br
=l @product_order.created_at, :format => :date
%div{:style => "height:300px;"}
%table.table{:style => "position:absolute;right:1cm;top:220px"}
%tr
%td{:style => "min-width:6cm;"}
%h3 Adresse de facturation
%strong
=@product_order.particular_bill.firstname
=@product_order.particular_bill.name
%br
=@product_order.particular_bill.address_2
-if @product_order.particular_bill.address_3?
%br
=@product_order.particular_bill.address_3
%br
=@product_order.particular_bill.cp
=@product_order.particular_bill.city
%br
=@product_order.particular_bill.country
%td
%h3 Adresse de livraison
%strong
=@product_order.particular_send.firstname
=@product_order.particular_send.name
%br
=@product_order.particular_send.address_2
-if @product_order.particular_send.address_3?
%br
=@product_order.particular_send.address_3
%br
=@product_order.particular_send.cp
=@product_order.particular_send.city
%br
=@product_order.particular_send.country
%table.table{:style => "width:100%;margin:1cm 0;"}
%tr
%th
Description
%th
Taille
%th
Option
%th
Qté
%th
Unitaire
%th
Montant
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
%tr
%td
= product_order_product.archived_product.lang(:fr).title
%td
= product_order_product.archived_product_size.name if product_order_product.archived_product_size
%td
= product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option
%td
= number_to_currency(product_order_product.archived_product.final_price_ttc.to_f, locale: :fr) if product_order_product.archived_product
%td
=product_order_product.qty
%td
= number_to_currency(product_order_product.archived_final_price_ttc_with_qty, locale: :fr) if product_order_product.archived_product
%tr
%td{:colspan => 4, :style => "border:0;"}
%td Total :
%td= number_to_currency(@product_order.archived_total_articles, locale: :fr)
-if @product_order.vourcher_code_archived
%tr
%td{:colspan => 4, :style => "border:0;"}
%td
=qit "Code réduction tableau", "Code de réduction "
="("+@product_order.vourcher_code_archived.slug+") :"
%td
="-"
=number_to_currency @product_order.archived_vourcher_reduction, locale: :fr
%tr
%td{:colspan => 4, :style => "border:0;"}
%td Frais de port :
%td= number_to_currency(@product_order.archived_total_fdp, locale: :fr)
%tr
%td{:colspan => 4, :style => "border:0;"}
%td
%strong Total :
%td
%strong
= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
%p
Mode de paiment :
-if @product_order.product_order_payment_type_ok_id == 3
CB
-elsif @product_order.product_order_payment_type_ok_id == 1
Chèque
%br
<!---
.fdp
%table.table
%tr
%td
=@product_order.product_fdp_archived.fdp_description
%td
=number_to_currency @product_order.product_fdp_archived.price
="--->"

View File

@ -18,6 +18,8 @@
="oui" if @product_order.paid
=link_to "Facture", bill_admin_product_order_path(@product_order)
=link_to "BL", bl_admin_product_order_path(@product_order)
-if @product_order.paid
-if !@product_order.shiped

View File

@ -0,0 +1,14 @@
-if I18n.locale == :fr
%p Bonjour,
%p Nous avons le plaisir de vous informer que votre paiement par carte bancaire a été accepté.
%p Nous vous remercions pour votre commande que nous traiterons dans les meilleurs délais.
%p Vous trouverez ci-dessous le récapitulatif de celle-ci :
=render :partial => "public/product_orders/mail_recap"

View File

@ -0,0 +1,13 @@
-if I18n.locale == :fr
%p Bonjour,
%p Nous vous remercions pour votre pré-commande, celle-ci sera expédiée dès que nous aurons reçu votre règlement.
%p Vous trouverez ci-dessous le récapitulatif de cette commande :
=render :partial => "public/product_orders/mail_recap"

View File

@ -0,0 +1,19 @@
%strong
=particular.organisation
%br
%strong
=particular.firstname
=particular.name
%br
=particular.address_2
-if particular.address_3?
%br
=particular.address_3
%br
=particular.cp
=particular.city
%br
=particular.country

View File

@ -1,17 +1,17 @@
%table{:style => "width:100%;"}
%tr
%td
%h3=qit "Adresse de facturation-mail", "Adresse de facturation"
%h3="Adresse de facturation"
=render :partial => "public/particulars/particular", :object => @product_order.particular_bill if @product_order.particular_bill
%td
%h3=qit "Adresse de livraison-mail", "Adresse de livraison"
%h3="Adresse de livraison"
=render :partial => "public/particulars/particular", :object => @product_order.particular_send if @product_order.particular_send
%br
%table.order_table{:style => "width:100%;"}
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
%tr
%td{:style => "width:120px"}
=image_tag "https://#{HOSTNAME}"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:100%;" if product_order_product.product and product_order_product.product.default_image
=image_tag "http://#{HOSTNAME}"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:100%;" if product_order_product.product and product_order_product.product.default_image
%td{:style => "vertical-align:top;"}
%strong= product_order_product.archived_product.lang(:fr).title
%br
@ -31,31 +31,27 @@
%tr
%td{:colspan => 3, :style => "border:0;"}
%td Total :
%td= number_to_currency(@product_order.archived_total_articles, locale: :fr)
-if @product_order.vourcher_code_archived
%td
%strong Total HT:
%td.boutique-right
%strong
= number_to_currency(@product_order.archived_total_ht, locale: :fr)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td
=qit "Code réduction tableau", "Code de réduction "
="("+@product_order.vourcher_code_archived.slug+") :"
%td
="-"
=number_to_currency @product_order.archived_vourcher_reduction, locale: :fr
%strong TVA:
%td.boutique-right
%strong
= number_to_currency(@product_order.archived_total_tva, locale: :fr)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td=qit "frais de port dans tableau", "Frais de port :"
%td= number_to_currency(@product_order.archived_total_fdp, locale: :fr)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td
%strong Total :
%strong Total HT:
%td
%strong
= number_to_currency(@product_order.archived_total_ttc, locale: :fr)

View File

@ -6,11 +6,11 @@
%table{:style => "width:100%;"}
%tr
%td{:style => "width:20%"}
=f.input :civilite, :label => qit("don-particular-civilite","Civilité"), :as => :select, :collection => [[qit("don-particular-civilite-mme","Mme."), "Mme"], [qit("don-particular-civilite-m","M."), "M"]], :include_blank => false
=f.input :civilite, :label => "Civilité", :as => :select, :collection => [["Mme.", "Mme"], ["M.", "M"]], :include_blank => false
%td{:style => "width:40%"}
=f.input :firstname, :label => qit("don-particular-firstname","Prénom")
=f.input :firstname, :label => "Prénom"
%td{:style => "width:40%"}
=f.input :name, :label => qit("don-particular-name","Nom")
=f.input :name, :label => "Nom"
=f.input :address_2, :label => "Adresse"
=f.input :address_3, :label => "Adresse suite"

View File

@ -1,14 +1,16 @@
#my_cart
%h1 Coordonnées
= semantic_form_for [:public,@product_order], :url => particulars_save_public_product_orders_path(), :html => { :method => :post, :onchange =>"cb_infos();"}do |f|
=f.semantic_fields_for :product_customer do |f|
=f.semantic_fields_for :customer do |f|
=debug @product_order.customer.particular_bill_id
=debug @product_order.customer.particular_send_id
.row
.columns.span_6{:style => "padding:10px;"}
%h3= qit "Adresse de facturation titre", "Adresse de facturation"
%h3= "Adresse de facturation"
%p
&nbsp;
=f.semantic_fields_for :particular_bill do |f|
@ -19,13 +21,13 @@
-@particular_idem = f.object.particular_idem
-@particular_idem = @product_order.particular_idem
.columns.span_6{:style => "padding:10px;"}
%h3=qit "Adresse de livraison titre", "Adresse de livraison"
%p=f.input :particular_idem, :label => qit("phrase-adresse-identique","Adresse de livraison identique à l'adresse de facturation ?"), :input_html => {:onchange => "particular_idem()", :id => "particular_idem_checkbox"}
%h3"Adresse de livraison"
%p=f.input :particular_idem, :label => "Adresse de livraison identique à l'adresse de facturation ?", :input_html => {:onchange => "particular_idem()", :id => "particular_idem_checkbox"}, :as => :boolean
#particular_send

View File

@ -1,18 +1,8 @@
.center
%h1=qit "Titre dans instruction commande par chèque", "Merci pour votre commande !"
%h1="Merci pour votre commande !"
%p
Pour finaliser celle-ci, merci de nous envoyer votre réglement par chèque d'un montant de
= number_to_currency(@product_order_ar.total_ttc, locale: :fr)
à l'ordre de One Voice à l'adresse suivante :
%br
%strong One Voice
%br
38 rue Saint Cornély
%br
56340 Carnac
%br
France
Votre pré-commande a bien été enregistrée
%br
%br
%br

View File

@ -1,38 +1,33 @@
#my_cart
.order_recap
%h1=qit "titre page validation de commande", "Validation de votre commande"
%h1= "Validation de votre commande"
%br
-@recap = true
%table.table
=render @product_order.product_order_products.order(:product_id)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td Total :
%td.boutique-right= number_to_currency(@product_order.total_articles, locale: :fr)
-if @product_order.vourcher_code
%tr
%td{:colspan => 3, :style => "border:0;"}
%td
=qit "Code réduction tableau", "Code de réduction "
="("+@product_order.vourcher_code.slug+") :"
%strong Total HT:
%td.boutique-right
="-"
=number_to_currency @product_order.vourcher_reduction, locale: :fr
%tr
%td{:colspan => 3, :style => "border:0;"}
%td=qit "frais de port dans tableau", "Frais de port :"
%td.boutique-right= number_to_currency(@product_order.total_fdp, locale: :fr)
%strong
= number_to_currency(@product_order.total_ht, locale: :fr)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td
%strong Total :
%strong TVA:
%td.boutique-right
%strong
= number_to_currency(@product_order.total_tva, locale: :fr)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td
%strong Total HT:
%td.boutique-right
%strong
= number_to_currency(@product_order.total_ttc, locale: :fr)
@ -41,6 +36,7 @@
.clear
@ -49,27 +45,27 @@
=f.hidden_field :force_payment
%h3=qit "paiement titre", "Paiement"
%h3 Paiement
-if params[:paid_fail]
%p=qit "texte erreur de paiement", "Votre tentative de paiement par carte bancaire a échouée, ou vous avez annulé votre paiement, merci de bien vouloir essayer de nouveau ou changer de mode de paiement."
%p= "Votre tentative de paiement par carte bancaire a échouée, ou vous avez annulé votre paiement, merci de bien vouloir essayer de nouveau ou changer de mode de paiement."
%br
=f.input :product_order_payment_type_ok_id, :label => false, :collection => [["Chèque",1],["Carte bancaire",3]], :as => :radio, :include_blank => false
=f.input :product_order_payment_type_ok_id, :label => false, :collection => [["Pré-commande",10]], :as => :radio, :include_blank => false
.cb_infos
=qit "texte redirection paiement sécurisé", "Vous serez redirigé vers la page de paiement sécurisé."
= "Vous serez redirigé vers la page de paiement sécurisé."
%br
=f.input :cgv, :label => qit("phrase jaccepte les cgv","J'accepte les conditions générales de vente.")
=f.input :cgv, :label => "J'accepte les conditions générales de vente."
.actions
%center
=f.submit qit("Valider ma commande bouton", "Valider ma commande"), :class => "btn btn-primary order_button"
=f.submit "Valider ma commande", :class => "btn btn-primary order_button"
%br
%br

View File

@ -3,4 +3,4 @@
%h1 Produits exclusifs réservés à ce réseau
.boutique_body.products
=render Product.all
=render Product.where(:archived => false).all

View File

@ -313,6 +313,8 @@ Rails.application.routes.draw do
get :ship
get :bill
get :bl
end
end

View File

@ -0,0 +1,29 @@
class CreateParticulars < ActiveRecord::Migration
def change
create_table :particulars do |t|
t.boolean :pro
t.string :organisation
t.string :name
t.string :firstname
t.string :address_1
t.string :address_2
t.string :address_3
t.string :address_4
t.string :address_5
t.string :cp
t.string :city
t.string :country
t.string :tel
t.string :email
t.string :tel2
t.string :tel3
t.string :fax
t.string :owner_type
t.integer :owner_id
t.string :particular_type
t.boolean :skip_validation
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,5 @@
class AddCiviliteToParticulars < ActiveRecord::Migration
def change
add_column :particulars, :civilite, :string
end
end

View File

@ -0,0 +1,19 @@
class AddOgoneToProductOrderPayments < ActiveRecord::Migration
def change
add_column :product_order_payments, :ogone_payid, :string
add_column :product_order_payments, :ogone_pm, :string
add_column :product_order_payments, :ogone_status, :string
add_column :product_order_payments, :ogone_acceptance, :string
add_column :product_order_payments, :ogone_cardno, :string
add_column :product_order_payments, :ogone_ed, :string
add_column :product_order_payments, :ogone_cn, :string
add_column :product_order_payments, :ogone_trxdate, :string
add_column :product_order_payments, :ogone_ncerror, :string
add_column :product_order_payments, :ogone_brand, :string
add_column :product_order_payments, :ogone_subbrand, :string
add_column :product_order_payments, :ogone_eci, :string
add_column :product_order_payments, :ogone_ip, :string
add_column :product_order_payments, :ogone_alias, :string
add_column :product_order_payments, :ogone_cb_expiration, :date
end
end

View File

@ -0,0 +1,37 @@
class AddParticularToCustomers < ActiveRecord::Migration
def self.up
add_column :customers, :particular_idem, :boolean
add_column :customers, :particular_send_id, :integer
add_column :customers, :particular_bill_id, :integer
Customer.all.each do |customer|
customer.particular_bill = Particular.new
customer.particular_bill.skip_validation = true
customer.particular_bill.organisation = customer.organisation
customer.particular_bill.name = customer.name
customer.particular_bill.firstname = customer.firstname
customer.particular_bill.address_2 = customer.address
customer.particular_bill.address_3 = customer.address2
customer.particular_bill.cp = customer.cp
customer.particular_bill.city = customer.city
customer.particular_bill.country = customer.country
customer.particular_bill.tel = customer.phone
customer.particular_bill.email = customer.email
customer.particular_send = Particular.new
customer.particular_send.skip_validation = true
customer.particular_idem = true
customer.save
end
end
def self.down
remove_column :customers, :particular_idem
remove_column :customers, :particular_send_id
remove_column :customers, :particular_bill_id
end
end

View File

@ -0,0 +1,7 @@
class AddBlToProductOrders < ActiveRecord::Migration
def change
add_column :product_orders, :bl_number, :string
add_column :product_orders, :bl_index, :integer
add_column :product_orders, :bl_year, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170912164519) do
ActiveRecord::Schema.define(version: 20170927093622) do
create_table "accepted_offers", force: :cascade do |t|
t.datetime "created_at", null: false
@ -259,6 +259,9 @@ ActiveRecord::Schema.define(version: 20170912164519) do
t.boolean "referent", limit: 1, default: false
t.boolean "chef_reseau", limit: 1, default: false
t.string "reseaux_token", limit: 255
t.boolean "particular_idem", limit: 1
t.integer "particular_send_id", limit: 4
t.integer "particular_bill_id", limit: 4
end
create_table "data_files", force: :cascade do |t|
@ -599,6 +602,33 @@ ActiveRecord::Schema.define(version: 20170912164519) do
t.datetime "updated_at"
end
create_table "particulars", force: :cascade do |t|
t.boolean "pro", limit: 1
t.string "organisation", limit: 255
t.string "name", limit: 255
t.string "firstname", limit: 255
t.string "address_1", limit: 255
t.string "address_2", limit: 255
t.string "address_3", limit: 255
t.string "address_4", limit: 255
t.string "address_5", limit: 255
t.string "cp", limit: 255
t.string "city", limit: 255
t.string "country", limit: 255
t.string "tel", limit: 255
t.string "email", limit: 255
t.string "tel2", limit: 255
t.string "tel3", limit: 255
t.string "fax", limit: 255
t.string "owner_type", limit: 255
t.integer "owner_id", limit: 4
t.string "particular_type", limit: 255
t.boolean "skip_validation", limit: 1
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "civilite", limit: 255
end
create_table "portlets", force: :cascade do |t|
t.integer "block_id", limit: 4
t.integer "content_id", limit: 4
@ -754,6 +784,21 @@ ActiveRecord::Schema.define(version: 20170912164519) do
t.string "token", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "ogone_payid", limit: 255
t.string "ogone_pm", limit: 255
t.string "ogone_status", limit: 255
t.string "ogone_acceptance", limit: 255
t.string "ogone_cardno", limit: 255
t.string "ogone_ed", limit: 255
t.string "ogone_cn", limit: 255
t.string "ogone_trxdate", limit: 255
t.string "ogone_ncerror", limit: 255
t.string "ogone_brand", limit: 255
t.string "ogone_subbrand", limit: 255
t.string "ogone_eci", limit: 255
t.string "ogone_ip", limit: 255
t.string "ogone_alias", limit: 255
t.date "ogone_cb_expiration"
end
create_table "product_order_products", force: :cascade do |t|
@ -781,7 +826,7 @@ ActiveRecord::Schema.define(version: 20170912164519) do
t.string "particular_send_id", limit: 255
t.string "token", limit: 255
t.boolean "completed_finish", limit: 1, default: false
t.integer "product_order_payment_ok", limit: 4
t.integer "product_order_payment_ok_id", limit: 4
t.integer "product_order_payment_type_ok_id", limit: 4
t.integer "bill_index", limit: 4
t.string "bill_number", limit: 255
@ -795,6 +840,9 @@ ActiveRecord::Schema.define(version: 20170912164519) do
t.integer "product_fdp_archived_id", limit: 4
t.boolean "cgv", limit: 1
t.integer "customer_id", limit: 4
t.string "bl_number", limit: 255
t.integer "bl_index", limit: 4
t.integer "bl_year", limit: 4
end
create_table "product_product_sizes", force: :cascade do |t|

0
pdf/bl/BL_13.pdf Normal file
View File

BIN
pdf/bl/BL_13_temp.pdf Normal file

Binary file not shown.

BIN
pdf_stamp/bl.pdf Normal file

Binary file not shown.