commandes partie publique

This commit is contained in:
Nicolas Bally 2018-05-28 23:54:21 +02:00
parent 698ef3ca31
commit 02075116a3
15 changed files with 918 additions and 1 deletions

View File

@ -20,6 +20,16 @@ class Public::ProductOrdersController < ApplicationController
end
def show
if params[:reseaux_id]
@reseaux_layout = true
@reseaux = current_customer.own_reseauxes.find(params[:reseaux_id])
@reseaux_chief_layout = true
end
@product_order = @reseaux.product_orders.where(:completed_finish => true).find(params[:id])
end
def get_reseaux
if session[:reseaux_id]
@reseaux = current_customer.reseauxes.find(session[:reseaux_id])

View File

@ -0,0 +1,3 @@
%tr
%td
=link_to product_order_document.d_number, admin_product_order_document_path(product_order_document.token)

View File

@ -0,0 +1,185 @@
#main
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
=@product_order_document.label
=@product_order_document.d_number
%br
=l @product_order.created_at, :format => :date #@product_order_document.created_at
- if @product_order.reseaux_id != 19
%div{:style => "height:350px;"}
-else
%div{:style => "height:140px;"}
-if @product_order.reseaux_id != 19
%table.table{:style => "position:absolute;right:1cm;top:220px"}
%tr
%td{:style => "width:5.5cm;border:0"}
%h3 Adresse de facturation
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
%td{:style => "width:5.5cm;border:0"}
%h3 Adresse de livraison
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
%table.table{:style => "width:100%;margin:1cm 0;"}
%tr
-if @product_order.reseaux_id != 19
%th
%th
Description
%th{:style => "text-align:right;width:100px"}
Prix U. HT
%th{:style => "text-align:right;width:80px"}
Qté
%th{:style => "text-align:right;width:100px"}
Prix HT
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
%tr
-if @product_order.reseaux_id != 19
%td{:style => "width:135px;padding:0;vertical-align:middle"}
=image_tag "http://negos.pro"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:130px;" if product_order_product.product.default_image
%td{:style => ""+("border-bottom: 0;padding-bottom:0;"if @product_order.reseaux_id == 19).to_s}
=simple_format product_order_product.archived_product.lang(:fr).bl_title
=# product_order_product.archived_product_size.name if product_order_product.archived_product_size
=# product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
= number_to_currency(product_order_product.archived_product.final_price_ht.to_f, locale: :fr) if product_order_product.archived_product
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
=product_order_product.qty
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
= number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
-if @product_order.reseaux_id == 19
%tr
%td{:colspan => 3, :style => "border-top:0;padding-top:0"}
%table.sub_products{:style => "width:100%;margin-bottom:20px;margin-top:5px;"}
%tr
%th Référence
%th Nom
%th Prix U.
%th Nbr
%th Prix HT
-product_order_product.sub_products.each do |sub_product|
%tr
%td
=sub_product.reference
%td
=sub_product.name
%td
=number_to_currency sub_product.price_ht_with_qte
%td
=sub_product.qte_tot
%td
=number_to_currency sub_product.price_tot_with_qte
%td
%tr
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
-if @product_order.reseaux_id != 19
%p
%br
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
-elsif @product_order.product_order_payment_type_ok_id == 2
Virement
-elsif @product_order.product_order_payment_type_ok_id == 4
Mandat administratif
%br
%br
Franco de port pour le Pays Voironnais
%td Total HT :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
-if @product_order.reseaux_id != 19
%tr
%td TVA :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
%tr
%td Total TTC :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
%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

@ -0,0 +1,185 @@
#main
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
=@product_order_document.label
=@product_order_document.d_number
%br
=l @product_order.created_at, :format => :date #@product_order_document.created_at
- if @product_order.reseaux_id != 19
%div{:style => "height:350px;"}
-else
%div{:style => "height:140px;"}
-if @product_order.reseaux_id != 19
%table.table{:style => "position:absolute;right:1cm;top:220px"}
%tr
%td{:style => "width:5.5cm;border:0"}
%h3 Adresse de facturation
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
%td{:style => "width:5.5cm;border:0"}
%h3 Adresse de livraison
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
%table.table{:style => "width:100%;margin:1cm 0;"}
%tr
-if @product_order.reseaux_id != 19
%th
%th
Description
%th{:style => "text-align:right;width:100px"}
Prix U. HT
%th{:style => "text-align:right;width:80px"}
Qté
%th{:style => "text-align:right;width:100px"}
Prix HT
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
%tr
-if @product_order.reseaux_id != 19
%td{:style => "width:135px;padding:0;vertical-align:middle"}
=image_tag "http://negos.pro"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:130px;" if product_order_product.product.default_image
%td{:style => ""+("border-bottom: 0;padding-bottom:0;"if @product_order.reseaux_id == 19).to_s}
=simple_format product_order_product.archived_product.lang(:fr).bl_title
=# product_order_product.archived_product_size.name if product_order_product.archived_product_size
=# product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
= number_to_currency(product_order_product.archived_product.final_price_ht.to_f, locale: :fr) if product_order_product.archived_product
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
=product_order_product.qty
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
= number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
-if @product_order.reseaux_id == 19
%tr
%td{:colspan => 3, :style => "border-top:0;padding-top:0"}
%table.sub_products{:style => "width:100%;margin-bottom:20px;margin-top:5px;"}
%tr
%th Référence
%th Nom
%th Prix U.
%th Nbr
%th Prix HT
-product_order_product.sub_products.each do |sub_product|
%tr
%td
=sub_product.reference
%td
=sub_product.name
%td
=number_to_currency sub_product.price_ht_with_qte
%td
=sub_product.qte_tot
%td
=number_to_currency sub_product.price_tot_with_qte
%td
%tr
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
-if @product_order.reseaux_id != 19
%p
%br
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
-elsif @product_order.product_order_payment_type_ok_id == 2
Virement
-elsif @product_order.product_order_payment_type_ok_id == 4
Mandat administratif
%br
%br
Franco de port pour le Pays Voironnais
%td Total HT :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
-if @product_order.reseaux_id != 19
%tr
%td TVA :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
%tr
%td Total TTC :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
%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

@ -0,0 +1,109 @@
#main
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
=@product_order_document.label
=@product_order_document.d_number
%br
=l @product_order.created_at, :format => :date #@product_order_document.created_at
%div{:style => "height:350px;"}
%table.table{:style => "position:absolute;right:1cm;top:220px"}
%tr
%td{:style => "width:8cm;border:0"}
%h3 Adresse de facturation
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
-@fournisseur = @product_order_document.product_order_document_type.fournisseur
-fournisseur = @fournisseur
%br
%br
%table.table{:style => "width:100%;margin:1cm 0;"}
%tr
%th Référence
%th Nom
%th Nbr
-if true
%th Prix U. HT
%th Prix HT
-@product_order.sub_products.group(:reference).where(:fournisseur_id => @fournisseur.id).each do |sub_product_group|
%tr
%td= sub_product_group.reference
%td= sub_product_group.name
-sub_products = @product_order.sub_products.where(:reference => sub_product_group.reference)
%td
-i = 0.0
-sub_products.each do |sub_product|
-i += sub_product.qte_tot
=i
-if true
%td
=number_to_currency sub_products[0].price_ht
%td{:style => "text-align:right;"}
=number_to_currency sub_products[0].price_ht * i
%tr
%td{:colspan => 4, :style => "text-align:right;"}
Total HT :
%td{:style => "text-align:right;"}
-i = 0.0
-@product_order.sub_products.where(:fournisseur_id => fournisseur.id).each do |sub_product|
-i += sub_product.price_tot_with_qte
=number_to_currency i
-if @fournisseur.id == 5
%tr
%td{:colspan => 4, :style => "text-align:right;"}
Taux de TVA :
%td{:style => "text-align:right;"}
20%
%tr
%td{:colspan => 4, :style => "text-align:right;"}
TVA :
%td{:style => "text-align:right;"}
=number_to_currency i*0.20
%tr
%td{:colspan => 4, :style => "text-align:right;"}
Total TTC
%td{:style => "text-align:right;"}
=number_to_currency i*1.2

View File

@ -0,0 +1,298 @@
!!!
%html
%head
%meta{:"http-equiv" => "Content-Type", :content=>"text/html; charset=UTF-8"}
%meta{:name=>"viewport", :content=>"width=device-width,initial-scale=1"}
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i" rel="stylesheet">
:scss
body{
font-size:11pt;
padding :0px;
margin:0px;
background-color: transparent;
font-family:"Lato", Arial, Sans-serif;
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;
}
td{
border-bottom:1px solid rgba(0,0,0,0.1);
p{
margin:5px 0;
}
}
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
-if @product_order.reseaux_id == 19 #distributeurs vouisstar
-if @product_order_document.product_order_document_type.fournisseur
=render :partial => "admin/product_order_documents/vsg_fournisseurs"
-else
=render :partial => "admin/product_order_documents/vsg_achats"
-elsif @product_order.reseaux_id == 2 #Vouisstar
=render :partial => "admin/product_order_documents/vs_bl"
-else
=render :partial => "admin/product_order_documents/general"
-if false
#main
%div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
=@product_order_document.label
=@product_order_document.d_number
%br
=l @product_order_document.created_at, :format => :date
-if @product_order.reseaux_id != 19
%div{:style => "height:350px;"}
-else
%div{:style => "height:140px;"}
-if @product_order.reseaux_id != 19
%table.table{:style => "position:absolute;right:1cm;top:220px"}
%tr
%td{:style => "width:5.5cm;border:0"}
%h3 Adresse de facturation
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
%td{:style => "width:5.5cm;border:0"}
%h3 Adresse de livraison
%strong=@product_order.particular_bill.organisation
%br
=@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
%br
%br
=@product_order.particular_bill.tel
%table.table{:style => "width:100%;margin:1cm 0;"}
%tr
-if @product_order.reseaux_id != 19
%th
%th
Description
%th{:style => "text-align:right;width:100px"}
Prix U. HT
%th{:style => "text-align:right;width:80px"}
Qté
%th{:style => "text-align:right;width:100px"}
Prix HT
-@product_order.product_order_products.order(:product_id).each do |product_order_product|
%tr
-if @product_order.reseaux_id != 19
%td{:style => "width:135px;padding:0;vertical-align:middle"}
=image_tag "http://negos.pro"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:130px;" if product_order_product.product.default_image
%td{:style => ""+("border-bottom: 0;padding-bottom:0;"if @product_order.reseaux_id == 19).to_s}
=simple_format product_order_product.archived_product.lang(:fr).bl_title
=# product_order_product.archived_product_size.name if product_order_product.archived_product_size
=# product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
= number_to_currency(product_order_product.archived_product.final_price_ht.to_f, locale: :fr) if product_order_product.archived_product
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
=product_order_product.qty
%td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
= number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
-if @product_order.reseaux_id == 19
%tr
%td{:colspan => 3, :style => "border-top:0;padding-top:0"}
%table.sub_products{:style => "width:100%;margin-bottom:20px;margin-top:5px;"}
%tr
%th Référence
%th Nom
%th Prix U.
%th Nbr
%th Prix HT
-product_order_product.sub_products.each do |sub_product|
%tr
%td
=sub_product.reference
%td
=sub_product.name
%td
=number_to_currency sub_product.price_ht_with_qte
%td
=sub_product.qte_tot
%td
=number_to_currency sub_product.price_tot_with_qte
%td
%tr
%td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
-if @product_order.reseaux_id != 19
%p
%br
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
-elsif @product_order.product_order_payment_type_ok_id == 2
Virement
-elsif @product_order.product_order_payment_type_ok_id == 4
Mandat administratif
%br
%br
Franco de port pour le Pays Voironnais
%td Total HT :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
-if @product_order.reseaux_id != 19
%tr
%td TVA :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
%tr
%td Total TTC :
%td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
%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

@ -0,0 +1,11 @@
= semantic_form_for [:admin,@product_order_payment], :remote => true do |form|
.content
=form.input :paid_at, :label => "Payée le ?", :as => :qi_date_picker
=form.input :amount, :label => "Montant : "
.actions
= form.submit "Sauvegarder", :class => "btn btn-primary"

View File

@ -0,0 +1,20 @@
%tr
%td=product_order_payment.token
%td=l product_order_payment.paid_at if product_order_payment.paid_at?
%td
-if product_order_payment.product_order_payment_type_id == 3
CB
-elsif product_order_payment.product_order_payment_type_id == 1
Chèque
%td=product_order_payment.ogone_payid
%td=product_order_payment.ogone_status
%td=product_order_payment.ogone_ncerror
%td
=product_order_payment.ogone_cardno
%td= number_to_currency product_order_payment.amount if product_order_payment.amount
%td.actions
-if product_order_payment.product_order_payment_type_id == 1
=link_to i(:pencil), edit_admin_product_order_payment_path(product_order_payment), :remote => true

View File

@ -0,0 +1,4 @@
$('#product_orders').html("<%= escape_javascript(render(:partial => "index_block")) %>");
close_pane_hover();

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",550,600);

View File

@ -0,0 +1 @@
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",550,600);

View File

@ -0,0 +1,4 @@
$('#product_order_payments').html("<%= escape_javascript(render(@product_order_payment.product_order.product_order_payments)) %>");
close_pane_hover();
<%= flash_js %>

View File

@ -31,7 +31,8 @@
-if product_order.paid
=link_to product_order.bill_number, bill_admin_product_order_path(product_order), :target => "_blank"
%td
= link_to "Détail", public_reseaux_product_order_path(@reseaux, product_order.id), :class => "btn btn-primary"

View File

@ -15,6 +15,8 @@
%th
Total
%th
%th
=#%th
=# Numéro facture
=#%th

View File

@ -0,0 +1,83 @@
.center.padding
-@recap = true
.qi_header
.right=# link_to 'Ajouter une taille', new_admin_product_size_path, :class => "btn btn-primary", :remote => true
%h1
%span
Détail de la commande
="#"+@product_order.id.to_s
%hr
%h3=@product_order.reseaux.name if @product_order.reseaux
Documents générés
%table
-@product_order.product_order_documents.each do |document|
=render document if document.id
%hr
%br
.qi_row
.qi_pannel.qi_plain
-if false
%p
=link_to "Voir le détail des sous produits", subs_admin_product_order_path(@product_order)
%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
-elsif @product_order.product_order_payment_type_ok_id == 2
Virement
-elsif @product_order.product_order_payment_type_ok_id == 4
Mandat administratif
%table.table
%tr
%td
%h3 Adresse de facturation
=render @product_order.particular_bill if @product_order.particular_bill
%td
%h3 Adresse de livraison
=render @product_order.particular_send if @product_order.particular_send
%table.table
=render @product_order.product_order_products.order(:product_id)
%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
%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
%tr
%td{:colspan => 3, :style => "border:0;"}
%td Frais de port :
%td= number_to_currency(@product_order.archived_total_fdp, locale: :fr)
%tr
%td{:colspan => 3, :style => "border:0;"}
%td
%strong Total :
%td
%strong
= number_to_currency(@product_order.archived_total_ttc, locale: :fr)