This commit is contained in:
Nicolas Bally 2017-09-27 12:50:37 +02:00
parent 1c6c9ff596
commit 3532ed15f6
16 changed files with 60 additions and 54 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ private_medias/
public/public_medias public/public_medias
public/assets public/assets
config/database.yml config/database.yml
pdf

View File

@ -1,7 +1,7 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
class Admin::ProductOrdersController < ApplicationController class Admin::ProductOrdersController < ApplicationController
before_filter :auth_admin before_filter :auth_admin, :except => [:bill, :bl]
layout "admin" layout "admin"
@ -168,7 +168,7 @@ class Admin::ProductOrdersController < ApplicationController
def bl def bl
@product_order = ProductOrder.find(params[:id]) @product_order = ProductOrder.find_by_token(params[:id])
if !@product_order.bl_number? if !@product_order.bl_number?
@product_order.generate_bl_number @product_order.generate_bl_number
end end
@ -216,7 +216,7 @@ class Admin::ProductOrdersController < ApplicationController
@data_to_send = File.open( @final_file).read @data_to_send = File.open( @final_file).read
send_data @data_to_send, :filename =>"bl.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment") send_data @data_to_send, :filename =>"#{@product_order.bl_number}.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")

View File

@ -53,6 +53,7 @@ class Public::ProductOrdersController < ApplicationController
end end
def particulars_save def particulars_save
get_reseaux
@product_order = ProductOrder.find(session[:product_order_id]) @product_order = ProductOrder.find(session[:product_order_id])
@product_order.customer.particular_bill.skip_validation = false @product_order.customer.particular_bill.skip_validation = false
@product_order.customer.particular_bill.skip_email = true @product_order.customer.particular_bill.skip_email = true
@ -97,6 +98,7 @@ class Public::ProductOrdersController < ApplicationController
def select_fdp def select_fdp
get_reseaux
@product_order = ProductOrder.find(session[:product_order_id]) @product_order = ProductOrder.find(session[:product_order_id])
@product_order.force_fdp_validation = true @product_order.force_fdp_validation = true
redirect_to select_fdp_save_public_product_orders_path redirect_to select_fdp_save_public_product_orders_path
@ -105,7 +107,7 @@ class Public::ProductOrdersController < ApplicationController
def select_fdp_save def select_fdp_save
get_reseaux
@product_order = ProductOrder.find(session[:product_order_id]) @product_order = ProductOrder.find(session[:product_order_id])
@product_order.force_fdp_validation = true @product_order.force_fdp_validation = true
@product_order.product_fdp_id = 1 @product_order.product_fdp_id = 1
@ -127,6 +129,7 @@ class Public::ProductOrdersController < ApplicationController
end end
def select_payment def select_payment
get_reseaux
if params[:orderID] if params[:orderID]
flash.now[:error] = "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." flash.now[:error] = "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."
end end
@ -143,6 +146,7 @@ class Public::ProductOrdersController < ApplicationController
def cart_not_empty def cart_not_empty
get_reseaux
@product_order = ProductOrder.find(session[:product_order_id]) @product_order = ProductOrder.find(session[:product_order_id])
if @product_order.product_order_products.count == 0 if @product_order.product_order_products.count == 0
@ -153,7 +157,7 @@ class Public::ProductOrdersController < ApplicationController
def select_payment_save def select_payment_save
get_reseaux
@product_order = ProductOrder.find(session[:product_order_id]) @product_order = ProductOrder.find(session[:product_order_id])
@ -183,6 +187,12 @@ class Public::ProductOrdersController < ApplicationController
@product_order.save @product_order.save
@product_order.after_paid @product_order.after_paid
#@product_order.generate_bl_number
puts @product_order.bl_number
ProductOrdersMails.confirmation_cheque(@product_order).deliver ProductOrdersMails.confirmation_cheque(@product_order).deliver
session[:product_order_id] = nil session[:product_order_id] = nil
redirect_to payment_instructions_public_product_order_path(@product_order.token) redirect_to payment_instructions_public_product_order_path(@product_order.token)
@ -201,6 +211,7 @@ class Public::ProductOrdersController < ApplicationController
def payment_instructions def payment_instructions
get_reseaux
@product_order_ar = ProductOrder.find_by_token(params[:id]) @product_order_ar = ProductOrder.find_by_token(params[:id])
end end

View File

@ -182,7 +182,7 @@ class ProductOrder < ActiveRecord::Base
end end
def after_paid def after_paid
puts "TTTTTT"
self.product_order_products.each do |p| self.product_order_products.each do |p|
p.update_stock_th p.update_stock_th

View File

@ -1,8 +1,9 @@
%strong %strong
=particular.firstname =particular.organisation
%br
=particular.firstname
=particular.name =particular.name
%br %br
=particular.address_2 =particular.address_2

View File

@ -89,7 +89,7 @@
%div{:style => "position:absolute;top:1cm;right:1cm;text-align:right;"} %div{:style => "position:absolute;top:1cm;right:1cm;text-align:right;"}
Bon de commande n° Bon de commande n°
=@product_order.bill_number =@product_order.bl_number
%br %br
=l @product_order.created_at, :format => :date =l @product_order.created_at, :format => :date
@ -103,10 +103,11 @@
%td{:style => "min-width:6cm;"} %td{:style => "min-width:6cm;"}
%h3 Adresse de facturation %h3 Adresse de facturation
%strong %strong=@product_order.particular_bill.organisation
=@product_order.particular_bill.firstname %br
=@product_order.particular_bill.firstname
=@product_order.particular_bill.name =@product_order.particular_bill.name
%br %br
=@product_order.particular_bill.address_2 =@product_order.particular_bill.address_2
@ -124,10 +125,11 @@
%td %td
%h3 Adresse de livraison %h3 Adresse de livraison
%strong %strong=@product_order.particular_bill.organisation
=@product_order.particular_send.firstname %br
=@product_order.particular_send.firstname
=@product_order.particular_send.name =@product_order.particular_send.name
%br %br
=@product_order.particular_send.address_2 =@product_order.particular_send.address_2
@ -175,43 +177,36 @@
= number_to_currency(product_order_product.archived_final_price_ttc_with_qty, locale: :fr) if product_order_product.archived_product = number_to_currency(product_order_product.archived_final_price_ttc_with_qty, locale: :fr) if product_order_product.archived_product
%tr %tr
%td{:colspan => 4, :style => "border:0;"} %td{:colspan => 4, :style => "border:0;"}
%td Total : %td Total HT :
%td= number_to_currency(@product_order.archived_total_articles, locale: :fr) %td= number_to_currency(@product_order.archived_total_ht, 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 %tr
%td{:colspan => 4, :style => "border:0;"} %td{:colspan => 4, :style => "border:0;"}
%td Frais de port : %td TVA :
%td= number_to_currency(@product_order.archived_total_fdp, locale: :fr) %td= number_to_currency(@product_order.archived_total_tva, locale: :fr)
%tr %tr
%td{:colspan => 4, :style => "border:0;"} %td{:colspan => 4, :style => "border:0;"}
%td %td Total TTC :
%strong Total : %td= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
%td
%strong
= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
%p -if false
Mode de paiment : %p
-if @product_order.product_order_payment_type_ok_id == 3 Mode de paiment :
CB -if @product_order.product_order_payment_type_ok_id == 3
-elsif @product_order.product_order_payment_type_ok_id == 1 CB
Chèque -elsif @product_order.product_order_payment_type_ok_id == 1
%br Chèque
%br
<!--- <!---
.fdp .fdp

View File

@ -18,7 +18,7 @@
="oui" if @product_order.paid ="oui" if @product_order.paid
=link_to "Facture", bill_admin_product_order_path(@product_order) =link_to "Facture", bill_admin_product_order_path(@product_order)
=link_to "BL", bl_admin_product_order_path(@product_order) =link_to "BL", bl_admin_product_order_path(@product_order.token)
-if @product_order.paid -if @product_order.paid

View File

@ -48,7 +48,7 @@
%tr %tr
%td{:colspan => 3, :style => "border:0;"} %td{:colspan => 3, :style => "border:0;"}
%td %td
%strong Total HT: %strong Total TTC:
%td %td
%strong %strong
= number_to_currency(@product_order.archived_total_ttc, locale: :fr) = number_to_currency(@product_order.archived_total_ttc, locale: :fr)

View File

@ -5,11 +5,10 @@
%table{:style => "width:100%;"} %table{:style => "width:100%;"}
%tr %tr
%td{:style => "width:20%"}
=f.input :civilite, :label => "Civilité", :as => :select, :collection => [["Mme.", "Mme"], ["M.", "M"]], :include_blank => false %td{:style => "width:50%"}
%td{:style => "width:40%"}
=f.input :firstname, :label => "Prénom" =f.input :firstname, :label => "Prénom"
%td{:style => "width:40%"} %td{:style => "width:50%"}
=f.input :name, :label => "Nom" =f.input :name, :label => "Nom"
=f.input :address_2, :label => "Adresse" =f.input :address_2, :label => "Adresse"

View File

@ -45,7 +45,7 @@
%br %br
%br %br
=link_to "Visitez notre boutique !", boutique_path, :class => "btn btn-primary" =link_to "Visitez notre boutique !", public_reseaux_products_path(:reseaux_id => session[:reseaux_id].to_i), :class => "btn btn-primary"
%br %br

View File

@ -5,8 +5,6 @@
=f.semantic_fields_for :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 .row
.columns.span_6{:style => "padding:10px;"} .columns.span_6{:style => "padding:10px;"}

View File

@ -4,6 +4,7 @@
%p %p
Votre pré-commande a bien été enregistrée Votre pré-commande a bien été enregistrée
%br %br
=link_to "Téléchargez votre bon de commande", bl_admin_product_order_path(@product_order_ar.token)
%br %br
%br %br
=#%p Si vous souhaitez finalement payer cette commande par carte banque vous pouvez la retrouver dans votre compte client. =#%p Si vous souhaitez finalement payer cette commande par carte banque vous pouvez la retrouver dans votre compte client.

View File

@ -27,7 +27,7 @@
%tr %tr
%td{:colspan => 3, :style => "border:0;"} %td{:colspan => 3, :style => "border:0;"}
%td %td
%strong Total HT: %strong Total TTC:
%td.boutique-right %td.boutique-right
%strong %strong
= number_to_currency(@product_order.total_ttc, locale: :fr) = number_to_currency(@product_order.total_ttc, locale: :fr)

View File

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

View File

@ -826,7 +826,7 @@ ActiveRecord::Schema.define(version: 20170927093622) do
t.string "particular_send_id", limit: 255 t.string "particular_send_id", limit: 255
t.string "token", limit: 255 t.string "token", limit: 255
t.boolean "completed_finish", limit: 1, default: false t.boolean "completed_finish", limit: 1, default: false
t.integer "product_order_payment_ok_id", limit: 4 t.integer "product_order_payment_ok", limit: 4
t.integer "product_order_payment_type_ok_id", limit: 4 t.integer "product_order_payment_type_ok_id", limit: 4
t.integer "bill_index", limit: 4 t.integer "bill_index", limit: 4
t.string "bill_number", limit: 255 t.string "bill_number", limit: 255

Binary file not shown.