suite
This commit is contained in:
parent
4960f5b466
commit
e387518fb5
@ -0,0 +1,5 @@
|
||||
|
||||
@import "bootstrap";
|
||||
|
||||
@import "fontawesome/font-awesome";
|
||||
|
@ -153,7 +153,7 @@ class Admin::PPaymentsController < ApplicationController
|
||||
def new
|
||||
|
||||
|
||||
@p_payment = PPayment.new(:p_payment_type_id => 41)
|
||||
@p_payment = PPayment.new(:p_payment_type_id => 2, :paid => true)
|
||||
|
||||
@p_payment.p_customer = PCustomer.find(params[:p_customer_id]) if params[:p_customer_id]
|
||||
|
||||
@ -227,7 +227,7 @@ class Admin::PPaymentsController < ApplicationController
|
||||
|
||||
|
||||
def update_ogone_infos
|
||||
params.delete(:search)
|
||||
|
||||
@check = OgoneRails::CheckAuth.new( request )
|
||||
|
||||
if @check.valid?
|
||||
|
@ -234,7 +234,9 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
|
||||
@price_document = PriceDocument.find_by_token(params[:id])
|
||||
|
||||
@p_payment = PPayment.create(:p_customer => @price_document.p_customer, :amount => @price_document.tot_amount_ttc, :p_payment_type_id => 1, :paid_at => Time.now)
|
||||
|
||||
if @price_document.to_paid_ttc > 0.0
|
||||
@p_payment = PPayment.create(:price_document_id => @price_document.id, :p_customer => @price_document.p_customer, :amount => @price_document.to_paid_ttc, :p_payment_type_id => 1, :paid_at => Time.now)
|
||||
|
||||
#render :inline => @p_payment.errors.messages
|
||||
if false # @p_payment.paid
|
||||
@ -262,6 +264,9 @@ class Admin::PriceDocumentsController < ApplicationController
|
||||
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
render :layout => "public"
|
||||
|
||||
|
@ -10,12 +10,14 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
|
||||
|
||||
before_action :popups
|
||||
|
||||
before_action :debug_translation
|
||||
|
||||
before_action :get_sorting
|
||||
|
||||
before_action :set_qi_order
|
||||
|
||||
|
||||
def get_sorting( column_default=nil, direction_default="desc")
|
||||
|
||||
|
||||
@ -29,7 +31,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
|
||||
before_action :set_qi_order
|
||||
|
||||
|
||||
def set_qi_order
|
||||
params[:search] = params[:search] || {}
|
||||
@ -122,11 +124,8 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
end
|
||||
def popups
|
||||
|
||||
|
||||
end
|
||||
|
||||
def get_public_layout
|
||||
"public"
|
||||
|
||||
@ -143,9 +142,9 @@ class ApplicationController < ActionController::Base
|
||||
@lang = LangSite.find_by_slug I18n.locale.to_s
|
||||
end
|
||||
|
||||
def default_url_options(options={})
|
||||
{ :lang => I18n.locale } #
|
||||
end
|
||||
#def default_url_options(options={})
|
||||
# { :lang => I18n.locale } #
|
||||
#end
|
||||
|
||||
|
||||
|
||||
|
@ -262,9 +262,15 @@ class PCustomer < ApplicationRecord
|
||||
def show_name
|
||||
if self.particular
|
||||
n = ""
|
||||
n += self.particular.organisation+" " if self.particular.organisation?
|
||||
#n += self.particular.name+" " if self.particular.name?
|
||||
#n += self.particular.firstname+" " if self.particular.firstname?
|
||||
|
||||
if self.particular.organisation?
|
||||
n += self.particular.organisation
|
||||
n += self.particular.com_name+" " if self.particular.com_name?
|
||||
else
|
||||
n += self.particular.civilite+" " if self.particular.civilite?
|
||||
n += self.particular.name+" " if self.particular.name?
|
||||
n += self.particular.firstname+" " if self.particular.firstname?
|
||||
end
|
||||
return n
|
||||
end
|
||||
end
|
||||
|
@ -34,6 +34,8 @@ class PPayment < ApplicationRecord
|
||||
|
||||
}
|
||||
|
||||
belongs_to :price_document
|
||||
|
||||
|
||||
def verify(size=16)
|
||||
if !self.token
|
||||
@ -57,6 +59,11 @@ class PPayment < ApplicationRecord
|
||||
end
|
||||
|
||||
|
||||
after_commit do
|
||||
self.auto_affect
|
||||
end
|
||||
|
||||
|
||||
after_save do
|
||||
self.generate_p_compta_element
|
||||
end
|
||||
@ -79,7 +86,7 @@ class PPayment < ApplicationRecord
|
||||
|
||||
after_initialize do
|
||||
self.p_payment_type_id = 1 if !self.p_payment_type_id?
|
||||
self.paid = true
|
||||
#self.paid = true
|
||||
end
|
||||
|
||||
|
||||
@ -121,6 +128,8 @@ class PPayment < ApplicationRecord
|
||||
p_payment_document.save
|
||||
end
|
||||
|
||||
|
||||
|
||||
#self.p_customer.update_caches if self.p_customer
|
||||
true
|
||||
end
|
||||
@ -149,5 +158,34 @@ class PPayment < ApplicationRecord
|
||||
|
||||
|
||||
|
||||
def auto_affect
|
||||
|
||||
price_document = self.price_document
|
||||
|
||||
if self.paid and price_document and price_document.d_number?
|
||||
|
||||
if self.reste_to_affect > 0.0 and price_document.to_paid_ttc > 0.0
|
||||
|
||||
|
||||
|
||||
if self.reste_to_affect > price_document.to_paid_ttc
|
||||
total_to_affect_now = price_document.to_paid_ttc
|
||||
else
|
||||
total_to_affect_now = self.reste_to_affect
|
||||
end
|
||||
|
||||
total_to_affect_now = total_to_affect_now.to_f
|
||||
|
||||
self.p_payment_documents.create(:price_document => price_document, :amount => total_to_affect_now)
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
@ -34,6 +34,7 @@ class PriceDocument < ApplicationRecord
|
||||
:cc_tot_amount_ht => {:name => "Montant HT", :reorder => true, :format => :currency},
|
||||
:cc_tot_amount_tva => {:name => "Montant TVA", :reorder => true, :format => :currency},
|
||||
:cc_tot_amount_ttc => {:name => "Montant TTC", :reorder => true, :format => :currency},
|
||||
:cc_to_paid_ttc => {:name => "Solde", :reorder => true, :format => :currency},
|
||||
:accounting_zone_id => "Zone",
|
||||
:p_commercial => {:name => "Commercial", :reorder => false},
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
%td{:style => "width:200px;"}
|
||||
= form.input :p_payment_type_id, :label => "Type de paiement :", :include_blank => false, :collection => PPaymentType.order(:name).all, :as => :select, :input_html => {:class => "payment_type_id_select", :readonly => (true if form.object.compta_locked)}
|
||||
|
||||
%td{:style => "width:160px;"}
|
||||
= form.input :paid, :label => "Paiement confirmé ?" ,:input_html => {:readonly => (true if form.object.compta_locked)}
|
||||
|
||||
|
||||
%td{:style => "width:160px;"}
|
||||
= form.input :paid_at, :label => "Date de paiement :" , :as => :date, :input_html => {:readonly => (true if form.object.compta_locked)}
|
||||
|
||||
|
@ -7,7 +7,9 @@
|
||||
-tr[:paid_at] = capture do
|
||||
%td= l(p_payment.paid_at, :format => :date) if p_payment.paid_at
|
||||
-tr[:p_customer] = capture do
|
||||
%td=link_to(p_payment.p_customer.show_name, [:admin, p_payment.p_customer]) if p_payment.p_customer
|
||||
%td
|
||||
|
||||
=link_to(p_payment.p_customer.show_name, [:admin, p_payment.p_customer]) if p_payment.p_customer
|
||||
|
||||
-tr[:payment_type] = capture do
|
||||
%td= p_payment.p_payment_type.name if p_payment.p_payment_type
|
||||
|
@ -47,13 +47,15 @@
|
||||
= link_to i(:pencil), edit_admin_price_document_path(price_document)
|
||||
= link_to i(:"check-circle-o"), generate_number_admin_price_document_path(price_document), data: { confirm: 'Voulez-vous vraiment valider cette facture et générer son numéro ? ' }
|
||||
|
||||
-else
|
||||
= link_to i(:"credit-card"), paid_by_ogone_admin_price_document_path(price_document.token), :remote => false, :target => "_blank" if price_document.to_paid_ttc > 0.0
|
||||
=# link_to i(:eye), admin_price_document_path(price_document), :remote => true
|
||||
|
||||
|
||||
= link_to i(:copy), new_admin_price_document_path(:to_dup => price_document.id)
|
||||
= link_to i(:eye), admin_price_document_path(price_document.id), :remote => false, :target => "_blank"
|
||||
|
||||
= link_to i(:"credit-card"), paid_by_ogone_admin_price_document_path(price_document.token), :remote => false, :target => "_blank"
|
||||
|
||||
|
||||
= link_to i(:download), print_admin_price_document_path(price_document.token), :remote => false, :target => "_blank"
|
||||
|
||||
|
@ -86,6 +86,7 @@
|
||||
%td.search_op
|
||||
%td.search_label
|
||||
Soldé ?
|
||||
|
||||
%td=select_tag :solde, options_for_select([["Non","0"], ["Oui","1"]], params[:solde]), :include_blank => true
|
||||
%td.search_op
|
||||
%td
|
||||
@ -109,7 +110,7 @@
|
||||
|
||||
%table.table.table-stripped.table-hover
|
||||
|
||||
-@price_documents.where(:price_document_type_id => 4).each do |price_document|
|
||||
-@price_documents.where(:price_document_type_id => 1).where("d_number is not NULL").each do |price_document|
|
||||
%tr.price_document_search#price_document_search{:data => {:id => price_document.id}}
|
||||
%td{:style => "width:30px;text-align:center;"}=ic :check if price_document.solded
|
||||
%td{:style => "width:100px"}=l price_document.date, :format => "%y/%m/%Y"
|
||||
|
@ -1,17 +1,31 @@
|
||||
%center
|
||||
%div{:style => "position:fixed;top:0;left:0;right:0;bottom:0;background:url('/fond.jpg') center center fixed;background-size:cover;"}
|
||||
|
||||
%div{:style => "width:90%;max-width:500px;background:rgba(255,255,255,0.95);text-align:center;padding:20px 10px;margin:auto;margin-top:30px;border-radius:5px;box-shadow:0 0 10px rgba(0,0,0,0.5)"}
|
||||
%center=image_tag "/logo-lockaz.png", :style => "width:300px;margin-top:10px;margin-bottom:10px;"
|
||||
=#%p Vous allez être redirigé automatiquement sur le serveur de paiement sécurisé par Ogone. Si ce n'est pas le cas, merci de cliquer sur "payer maintenant"
|
||||
|
||||
-if @p_payment
|
||||
|
||||
%form{:action => CONFIG_OGONE["ecom_url"], :id => "ogone_form"}
|
||||
-form_content = ogone_fields(@ogone_options)
|
||||
%br
|
||||
%br
|
||||
%p
|
||||
Montant :
|
||||
=number_to_currency @price_document.tot_amount_ttc
|
||||
|
||||
-form_content << '<input type="submit" value="Payer maintenant par CB" />'
|
||||
Montant à régler :
|
||||
%strong=number_to_currency @p_payment.amount
|
||||
|
||||
-form_content << '<input type="submit" value="Payer maintenant par CB" class = "btn btn-primary" />'
|
||||
%br
|
||||
=raw form_content
|
||||
%br
|
||||
%br
|
||||
%p Vous allez être redirigé sur le serveur de paiement sécurisé par Ingenico/Ogone en cliquant sur "Payer maintenant"
|
||||
%p Olwen Capital, notre partenaire pour le paiement en ligne apparaitra sur votre relevé de compte
|
||||
|
||||
=raw form_content
|
||||
|
||||
|
||||
-else
|
||||
Il semblerait que votre réglement ait déjà été effectué, vous pouvez-nous contacter si besoin.
|
||||
|
||||
=#:javascript
|
||||
=#$("#ogone_form").submit()
|
||||
|
@ -57,7 +57,7 @@
|
||||
=flash[:alert]
|
||||
|
||||
|
||||
%center=image_tag "/logo-lockaz.png", :style => "width:300px;margin-top:10px;margin-bottom:10px;"
|
||||
|
||||
=yield
|
||||
|
||||
|
||||
|
@ -226,8 +226,11 @@ Rails.application.routes.draw do
|
||||
end
|
||||
collection do
|
||||
get :ogone_ipn
|
||||
end
|
||||
|
||||
get :search_to_affect
|
||||
get :doublons
|
||||
get :multiple
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
BIN
public/fond.jpg
Normal file
BIN
public/fond.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1012 KiB |
Loading…
x
Reference in New Issue
Block a user