This commit is contained in:
Nicolas Bally 2016-04-28 22:41:58 +02:00
parent 489b53d885
commit d52c017848
67 changed files with 1911 additions and 64 deletions

View File

@ -32,7 +32,7 @@ body{
font-size:15px;
color:#333333;
background:white;
padding-top:60px;
@ -66,9 +66,11 @@ body{
}
.category-container{
background:center center no-repeat;
background-size:100%;
background-size:cover;
display:block;
min-height:500px;
min-height:200px;
img{
width:100%;
}
@ -78,7 +80,7 @@ body{
.category-title{
color:white;
font-size: 80px;
font-size: 1.5em;
display:block;
text-align:center;
width:100%;
@ -94,6 +96,7 @@ body{
#footer{
display:block;
height:390px;
margin-top:100px;
background: url("/images/footer_background.jpg") center center;
background-size:cover !important;
background-size:100%;
@ -164,7 +167,7 @@ body{
background-size:100%;
background-size:cover;
min-height:400px;
img{
width:100%;
}
@ -363,12 +366,15 @@ img{
.center{
margin:auto;
max-width:900px;
max-width:1100px;
}
.product_show{
#product_description{
max-width:700px;
}
.col_images{
float:left;
box-sizing:border-box;

View File

@ -0,0 +1,102 @@
class Public::AccountRibsController < ApplicationController
layout "public"
before_filter :auth_product_customer
def index
@account_rib = current_product_customer.account_ribs.all
end
def show
@account_rib = AccountRib.find(params[:id])
session[:mail_prev] = public_account_rib_path(@account_rib)
end
def new
@no_search = true
@account_rib = current_product_customer.account_ribs.new(:country => "France")
end
def edit
@account_rib = current_account_rib_account.account_rib.find(params[:id])
end
def create
@account_rib = current_product_customer.account_ribs.new(params.require(:account_rib).permit!)
if @account_rib.save
redirect_to public_account_ribs_path
else
render :action => "new"
end
end
def update
@account_rib = current_product_customer.account_ribs.find(params[:id])
respond_to do |format|
if @account_rib.update_attributes(params.require(:account_rib).permit!)
format.html {
redirect_to public_my_account_path
}
format.js
else
format.html { render :action => "edit" }
format.js { "" }
end
end
end
def destroy
@account_rib = current_account_rib_account.account_rib.find(params[:id])
@account_rib.enabled = nil
@account_rib.save
redirect_to public_my_account_path, :notice => "Votre account_rib a bien été désactivée"
end
end

View File

@ -0,0 +1,22 @@
class Public::CommissionsController < ApplicationController
layout "public"
def index
@no_search = true
per_page = (params[:per_page] and params[:per_page] != "") ? params[:per_page] : 20
page = (params[:page] and params[:page] != "") ? params[:page] : 1
@commissions = current_product_customer.commissions.order("created_at DESC").page(page).per(per_page)
end
end

View File

@ -0,0 +1,58 @@
class Public::MyAccountController < ApplicationController
layout "public"
before_filter :auth_product_customer
def index
end
def edit_infos
@no_search = true
end
def my_annonces
@no_search = true
end
def binary
@no_search = true
if params[:parrain_id] and current_product_customer.binary_child_ids.include?(params[:parrain_id].to_i)
@parrain = ProductCustomer.find(params[:parrain_id])
else
@parrain = current_product_customer
end
end
def filleuls
@no_search = true
@filleuls = current_product_customer.children
session[:mail_prev] = public_filleuls_path
end
def reconfirm
@no_search = true
ProductCustomerMailer.confirm(current_product_customer).deliver
redirect_to public_my_account_path, :notice => "Le mail vous a été renvoyé"
end
def favoris
per_page = (params[:per_page] and params[:per_page] != "") ? params[:per_page] : 10
page = (params[:page] and params[:page] != "") ? params[:page] : 1
@annonces = current_product_customer.annonce_favs.valid_to_show
@annonces = @annonces.page(page).per(per_page).all
end
end

View File

@ -19,6 +19,13 @@ class Public::ProductCustomersAuthsController < ApplicationController
end
@product_customer = ProductCustomer.new()
if cookies[:mlm_token] and @parent = ProductCustomer.find_parrain(cookies[:mlm_token])
@product_customer.parent_code = @parent.mlm_token.upcase
elsif params[:p] and @parent = ProductCustomer.find_parrain(params[:p])
@product_customer.parent_code = @parent.mlm_token.upcase
end
end

View File

@ -1,7 +1,7 @@
class Public::ProductCustomersController < ApplicationController
layout "public"
before_filter :auth_product_customer, :except => [:new, :create, :confirm, :find_parrain]
before_filter :auth_product_customer, :except => [:new, :create, :confirm, :find_parrain, :parrainage]
def index
@ -27,10 +27,18 @@ class Public::ProductCustomersController < ApplicationController
params[:for_annonce] = nil
end
params[:for_mail] =nil if params[:for_mail] == ""
@product_customer = ProductCustomer.new()
if cookies[:mlm_token] and @parent = ProductCustomer.find_parrain(cookies[:mlm_token])
@product_customer.parent_code = @parent.mlm_token.upcase
elsif params[:p] and @parent = ProductCustomer.find_parrain(params[:p])
@product_customer.parent_code = @parent.mlm_token.upcase
end
if cookies[:mlm_token] and @parent = ProductCustomer.find_parrain(cookies[:mlm_token])
@product_customer.parent_code = @parent.mlm_token.upcase

View File

@ -0,0 +1,156 @@
class Public::VirementsController < ApplicationController
layout "public"
before_filter :auth_product_customer
def index
@virements = current_product_customer.virements.all
end
def show
@virement = current_product_customer.virements.find_by_token(params[:id])
@temp_file = "#{Rails.root}/pdf/virements/#{@virement.token}_temp.pdf"
@final_file = "#{Rails.root}/pdf/virements/#{@virement.token}.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 => "#{@virement.token}",
:template => "public/virements/show.html.haml",
:locals => {:@virement => @virement, :current_product_customer => current_product_customer})
# 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', 'orders.pdf').to_s, 'output', @final_file
#pdftk /Users/nico/Dev/sideplace_app.old/pdf/order_bills/SP20150700003.pdf background fond.pdf output sortie.pdf
@data_to_send = File.open( @final_file).read
send_data @data_to_send, :filename =>"note-commission.pdf" , :type => 'application/pdf',:disposition => (params[:inline] ? 'inline' : "attachment")
end
def new
@no_search = true
@devise = Devise.first
@virement = current_product_customer.virements.new(:amount_ht => current_product_customer.max_virement, :devise => @devise)
end
def edit
@virement = current_virement_account.virements.find(params[:id])
end
def create
@virement = current_product_customer.virements.new(params.require(:virement).permit!)
if @virement.valid?
if params[:confirm]
token = @virement.generate_token
@commission = current_product_customer.commissions.new(:commission_type_id => 4, :amount => ((@virement.amount_ht+5)*(-1)), :devise => @virement.devise)
@virement.commission = @commission
if @virement.save
redirect_to public_commissions_path
else
render :inline => "test"
end
else
render :action => "confirm"
end
else
render :action => "new"
end
end
def update
@virement = current_product_customer.virements.find(params[:id])
respond_to do |format|
if @virement.update_attributes(params.require(:virement).permit!)
format.html {
redirect_to public_my_account_path
}
format.js
else
format.html { render :action => "edit" }
format.js { "" }
end
end
end
def destroy
@virement = current_virement_account.virements.find(params[:id])
@virement.enabled = nil
@virement.save
redirect_to public_my_account_path, :notice => "Votre virement a bien été désactivée"
end
end

19
app/models/account_rib.rb Normal file
View File

@ -0,0 +1,19 @@
class AccountRib < ActiveRecord::Base
belongs_to :product_customer
mount_uploader :scan_file, RibUploader
validates :bank_name, :presence => true
validates :bank_city, :presence => true
validates :country, :presence => true
validates :name, :presence => true
validates :address, :presence => true
validates :tva_number, :presence => true, :if => :tva?
validates :cp, :presence => true
validates :city, :presence => true
validates :iban, :presence => true
validates :bic, :presence => true
end

18
app/models/commission.rb Normal file
View File

@ -0,0 +1,18 @@
class Commission < ActiveRecord::Base
belongs_to :product_customer
has_one :order_solde, :class_name => "Order"
belongs_to :product_order
belongs_to :count_part_com
has_one :virement
has_one :hipay_virement
belongs_to :devise
after_create do
if self.commission_type_id == 1 or self.commission_type_id == 2 or self.commission_type_id == 3
ProductCustomerMailer.new_commission(self).deliver
end
end
end

14
app/models/devise.rb Normal file
View File

@ -0,0 +1,14 @@
class Devise < ActiveRecord::Base
def self.convert(amount, devise_from, devise_to)
result = (amount.to_f/devise_from.rate)*devise_to.rate
return result.round(2)
#Devise.convert(10, Devise.find_by_code("EUR"), Devise.find_by_code("USD"))
#Devise.convert(10, Devise.find_by_code("USD"), Devise.find_by_code("EUR"))
#Devise.convert(10, Devise.find_by_code("CHF"), Devise.find_by_code("EUR"))
end
end

View File

@ -115,7 +115,7 @@ class Product < ActiveRecord::Base
def tva
0.0
0.2
end
def price_ttc

View File

@ -1,9 +1,12 @@
class ProductCustomer < ActiveRecord::Base
acts_as_tree
has_secure_password
validates :email, :presence => true, :uniqueness => true, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
validates_presence_of :password, :on => :create
has_many :product_orders
has_many :commissions
has_many :account_ribs
belongs_to :particular_bill, :class_name => "Particular"
@ -86,5 +89,126 @@ class ProductCustomer < ActiveRecord::Base
end
def mlm_detail_ids
i = 0
parents_id = [self.id]
mlm_children_ids = []
mlm_children_id_by_levels = []
while i != 14 do
i += 1
parents_id = ProductCustomer.where(:parent_id => parents_id).select(:id).map{ |v| v.id}
mlm_children_id_by_levels[i] = parents_id
mlm_children_ids.concat parents_id
end
{
:mlm_children_id_by_levels => mlm_children_id_by_levels,
:mlm_children_ids => mlm_children_ids
}
end
def mlm_children_id_by_levels
self.mlm_detail_ids[:mlm_children_id_by_levels]
end
def mlm_children_ids
self.mlm_detail_ids[:mlm_children_ids]
end
def solde_commissions(devise_id=1)
self.commissions.where(:devise_id => devise_id).sum(:amount)
end
def max_virement(devise_id=1)
self.solde_commissions(1).floor - 5.0
end
def mlm_small_percents
[0,10,6,4,0,0,0,0,0,0,0,0]
end
def callif_now
{:percents => self.mlm_small_percents}
end
def mlm_nbr_niveaux
if self.callif_now
3
else
0
end
end
COUNTRY = [
"Suisse",
"France",
"Allemagne",
"Autriche",
"Belgique",
"Espagne",
"Estonie",
"Finlande",
"Grèce",
"Irlande",
"Italie",
"Luxembourg",
"Malte",
"Pays-Bas",
"Portugal",
"Slovaquie",
"Slovénie",
"Croatie",
"Bulgarie",
"Danemark",
"Hongrie",
"Lettonie",
"Lituanie",
"Pologne",
"République Tchèque",
"Roumanie",
"Royaume Uni",
"Suède",
"Islande",
"Norvège",
"Liechtenstein",
"Monaco",
"Guadeloupe",
"Guyane",
"Martinique",
"La Réunion",
"Mayotte",
"Polynésie française",
"Saint-Barthélemy",
#"Saint-Martin",
#"Saint-Pierre-et-Miquelon",
"Wallis-et-Futuna",
"Nouvelle-Calédonie"
]
end

View File

@ -29,16 +29,29 @@ class ProductOrder < ActiveRecord::Base
attr_accessor :force_fdp_validation, :force_payment, :force_cgv_validation
def total_ttc
total_articles + total_fdp - vourcher_reduction
total_articles_ttc + total_fdp - vourcher_reduction_ttc
end
def total_ttc_without_fdp
total_articles - vourcher_reduction
total_articles_ttc - vourcher_reduction_ttc
end
def vourcher_reduction
def total_ht_without_fdp
total_articles_ht - vourcher_reduction_ht
end
def vourcher_reduction_ttc
if self.vourcher_code and 1==1
(total_articles * (self.vourcher_code.percent / 100 )).round(2)
(total_articles_ttc * (self.vourcher_code.percent / 100 )).round(2)
else
0.0
end
end
def vourcher_reduction_ht
if self.vourcher_code and 1==1
(total_articles_ht * (self.vourcher_code.percent / 100 )).round(2)
else
0.0
@ -46,9 +59,9 @@ class ProductOrder < ActiveRecord::Base
end
def archived_vourcher_reduction
def archived_vourcher_reduction_ttc
if self.vourcher_code_archived and 1==1
(total_articles * (self.vourcher_code_archived.percent / 100 )).round(2)
(total_articles_ttc * (self.vourcher_code_archived.percent / 100 )).round(2)
else
0.0
@ -58,11 +71,11 @@ class ProductOrder < ActiveRecord::Base
def archived_total_ttc
archived_total_articles + archived_total_fdp - archived_vourcher_reduction
archived_total_articles_ttc + archived_total_fdp - archived_vourcher_reduction_ttc
end
def archived_total_articles
def archived_total_articles_ttc
archived_total = 0.0
product_order_products.each do |p|
archived_total += p.archived_final_price_ttc_with_qty
@ -72,7 +85,7 @@ class ProductOrder < ActiveRecord::Base
def archived_total_fdp(fdp=self.product_fdp_archived)
if fdp
if self.archived_total_articles < fdp.price_max
if self.archived_total_articles_ttc < fdp.price_max
fdp.price
else
0.0
@ -160,7 +173,7 @@ class ProductOrder < ActiveRecord::Base
end
def total_articles
def total_articles_ttc
total = 0.0
product_order_products.each do |p|
total += p.final_price_ttc_with_qty
@ -168,6 +181,15 @@ class ProductOrder < ActiveRecord::Base
total
end
def total_articles_ht
total = 0.0
product_order_products.each do |p|
total += p.final_price_ht_with_qty
end
total
end
def total_fdp(fdp=self.product_fdp)
if fdp
if self.total_ttc_without_fdp < fdp.price_max
@ -195,6 +217,34 @@ class ProductOrder < ActiveRecord::Base
end
def commission_mlm_now
if self.product_customer.parent
i = 0
parent_to_commission = self.product_customer.parent
while parent_to_commission and i <= 12
i += 1
if parent_to_commission.mlm_nbr_niveaux >= i
com_percent = (parent_to_commission.callif_now[:percents][i].to_f/100)
com = (com_percent*self.total_ht_without_fdp.to_f()).round(2)
puts "Commission à #{parent_to_commission.pseudo}: génération #{i}, #{com_percent}%, #{com}"
parent_to_commission.commissions.create(:product_order => self, :commission_type_id => 10, :amount => com, :percent => com_percent, :generation => i, :devise_id => 1)
end
parent_to_commission = parent_to_commission.parent
end
end
end
protected
def verify(size=16)

View File

@ -18,6 +18,10 @@ class ProductOrderProduct < ActiveRecord::Base
qty.to_f * product.final_price_ttc.to_f
end
def final_price_ht_with_qty
qty.to_f * product.final_price_ht.to_f
end
def archived_price_ttc_with_qty

63
app/models/virement.rb Normal file
View File

@ -0,0 +1,63 @@
class Virement < ActiveRecord::Base
belongs_to :devise
validates :amount_ht, :presence => true
belongs_to :product_customer
belongs_to :virement_remise
belongs_to :commission
belongs_to :account_rib
scope :execute_between, lambda { |start, stop|
execute_after(start).execute_before(stop)
}
scope :execute_after, lambda { |date|
joins(:virement_remise).where("(virement_remises.created_at >= ?)", date )
}
scope :execute_before, lambda { |date|
where("(virement_remises.created_at <= ?)", date )
}
def generate_token
self.token = loop do
token = SecureRandom.hex(6)
break token unless Virement.exists?(token: token)
end
self.token
end
def name_for_edi
value = self.account_rib.name.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '').to_s
# Remove single quotes from input
value.gsub!(/[']+/, '')
# Replace any non-word character (\W) with a space
value.gsub!(/\W+/, ' ')
# Remove any whitespace before and after the string
value.strip!
return value
end
before_validation do
if self.product_customer.virements.where("sended is null").count >= 1
errors.add(:amount_ht, "Vous ne pouvez pas avoir plus d'un virements en attente d'execution.")
end
if !self.product_customer.account_ribs.where(:id => self.account_rib.id, :validated => true).first or !self.account_rib.validated
errors.add(:account_rib, 'Compte sélectionné invalide')
end
if self.amount_ht.to_f < 5 or self.amount_ht.to_f > self.product_customer.max_virement
errors.add(:amount_ht, "Le montant doit être compris entre 5 € et #{self.product_customer.max_virement.to_i}")
end
end
end

View File

@ -0,0 +1,20 @@
class VirementRemise < ActiveRecord::Base
has_many :virements
def init
self.amount = self.virements.sum(:amount_ttc)
self.token = loop do
token = SecureRandom.hex(6)
break token unless VirementRemise.exists?(token: token)
end
self.save
end
end

View File

@ -0,0 +1,62 @@
# -*- encoding : utf-8 -*-
class RibUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# storage :s3
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"#{Rails.root}/private_medias/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def url
#"/download_data_files/#{model.token}"
end
def extension_white_list
%w(jpg jpeg png pdf)
end
# Provide a default URL as a default if there hasn't been a file uploaded:
def default_url
"/images/fallback/" + [version_name, "default.png"].compact.join('_')
end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process :scale => [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files:
# def filename
# "something.jpg" if original_filename
# end
def filename
File.basename(original_filename, File.extname(original_filename)).to_s.to_slug + File.extname(original_filename).to_s if original_filename
end
end

View File

@ -20,7 +20,7 @@
%td
=number_to_currency product_order.archived_total_articles
=number_to_currency product_order.archived_total_articles_ttc
%td
=number_to_currency product_order.archived_total_fdp

View File

@ -32,7 +32,7 @@
%tr
%td{:colspan => 5, :style => "border:0;"}
%td Total :
%td= number_to_currency(@product_order.archived_total_articles, locale: :fr)
%td= number_to_currency(@product_order.archived_total_articles_ttc, locale: :fr)
-if @product_order.vourcher_code_archived
%tr
@ -42,7 +42,7 @@
="("+@product_order.vourcher_code_archived.slug+") :"
%td
="-"
=number_to_currency @product_order.archived_vourcher_reduction, locale: :fr
=number_to_currency @product_order.archived_vourcher_reduction_ttc, locale: :fr
%tr
%td{:colspan => 5, :style => "border:0;"}

View File

@ -50,7 +50,7 @@
=current_product_customer.email
#header{:style => "background-image:url('#{@image_bandeau}');"}
#header{:style => "background-image:url('#{@image_bandeau}');"+("min-height:400px;"if @image_bandeau).to_s}
@ -68,6 +68,8 @@
.top_right
%span#cart_infos
=render :partial => "public/shared/cart"
&nbsp;&nbsp;&nbsp;
=link_to i(:user), "/public/my_account/index"
-if flash[:error] or flash[:notice] or flash[:alert]
@ -147,11 +149,13 @@
});
#content
=yield
=yield
=yield :bandeau
-if @menu_item and @menu_item.id == 1
=render :partial => "public/product_categories/bandeau",:collection => ProductCategory.where(parent_id: nil).order(:position), :as => :product_category
.center.padding.row
=render :partial => "public/product_categories/bandeau",:collection => ProductCategory.where(parent_id: nil).order(:position), :as => :product_category

View File

@ -15,7 +15,7 @@
%strong
Vitascreen
%br
+33 6 52 66 90 82
%br
=link_to "contact@styandus.com", "mailto:contact@styandus.com"
@ -36,7 +36,7 @@
%strong
Vitascreen
%br
+33 6 52 66 90 82
%br
=link_to "contact@styandus.com", "mailto:contact@styandus.com"

View File

@ -12,12 +12,7 @@
Vous pouvez envoyer un chèque d'un montant de
= number_to_currency(@product_order.total_ttc, locale: :fr)
à l'ordre de StyAndUs à l'adresse suivante :
%br
Galerie La Forestière
%br
1 rue de la Forestière
%br
33970 CAP FERRET
%p Vous trouverez ci-dessous le récapitulatif de cette commande :
@ -28,7 +23,7 @@
%strong
Vitascreen
%br
+33 6 52 66 90 82
%br
=link_to "contact@styandus.com", "mailto:contact@styandus.com"
@ -46,13 +41,7 @@
Vous pouvez envoyer un chèque d'un montant de
= number_to_currency(@product_order.total_ttc, locale: :fr)
à l'ordre de StyAndUs à l'adresse suivante :
%br
Galerie La Forestière
%br
1 rue de la Forestière
%br
33970 CAP FERRET
%p Vous trouverez ci-dessous le récapitulatif de cette commande :
@ -62,7 +51,7 @@
%strong
Vitascreen
%br
+33 6 52 66 90 82
%br
=link_to "contact@styandus.com", "mailto:contact@styandus.com"

View File

@ -0,0 +1,26 @@
= semantic_form_for [:public, @account_rib] do |f|
.alert.alert-info
%p
=qit "intro-saisie-rib" do
Merci de saisir votre RIB dans le formulaire suivant, en recopiant les informations telles que présentées sur votre RIB
=f.inputs do
= f.input :bank_name, :label => qit("label-nom-banque","Nom de la banque :"), :placeholder => "ex : CA Centre Est"
= f.input :bank_city, :label => qit("label-ville-banque","Ville de la banque :"), :placeholder => "ex : GRENOBLE"
= f.input :name, :label => qit("label-intitule-compte","Intitulé du compte :"), :placeholder => "ex : SARL DUPONT où M SERGE DUPONT"
= f.input :address, :label => qit("label-titulaire-compte", "Adresse du titulaire du compte: "), :placeholder => "ex : 13 rue de les Lilas"
= f.input :address2, :label => qit("label-complement-adresse","Complément d'adresse :"), :placeholder => ""
= f.input :cp, :label => qit("label-code-postal","Code postal :"), :placeholder => ""
= f.input :city, :label => "Ville", :placeholder => ""
= f.input :country, :label => qit("label-pays-compte","Pays du compte"), :as => :select, :include_blank => false, :collection => ProductCustomer::COUNTRY.sort
= f.input :iban, :label => qit("label-iban","IBAN (sans espaces)"), :placeholder => "ex : FR7644444444444444444444444"
= f.input :bic, :label => qit("label-bic","Code BIC / swift"), :placeholder => "ex : AGRIFRPP878"
=f.input :tva, :label => qit("label-tva-case-a-cocher","Vous êtes un professionnel soumis à la TVA ?")
=f.input :tva_number, :label => qit("label-tva-number","Numéro de TVA intracom. :")
=f.input :scan_file, :label => qit("label-rib-file","Fichier du rib lisible (scanné ou version numérique au format pdf, jpg où png) :")
=f.submit qit("save", "Sauvegarder"), :class => "btn btn-primary"
%br
%br

View File

@ -0,0 +1,38 @@
=render :partial => "public/my_account/menu"
.center
.padding
%h1=qit("title-bank-account","Comptes bancaires")
=link_to qit("add-bank-account","ajouter un compte bancaire"), new_public_account_rib_path, :class => "btn btn-primary"
%table.table{:style => "text-align:left"}
%tr
%th=qit("th-bank-account-alias","Intitulé du compte")
%th=qit("th-country", "Pays")
%th=qit("th-bank", "Banque")
%th=qit("th-iban","Iban")
%th=qit("th-tva","Tva")
%th=qit("th-statut","Statut")
%th
-@account_rib.each do |account_rib|
%tr
%td=account_rib.name
%td=account_rib.country
%td=account_rib.bank_name
%td=account_rib.iban
%td
-if account_rib.tva?
=account_rib.tva_number
%td
-if account_rib.validated?
=qit("bank-account-validate","Validé")
-else
=qit("bank-account-validate-progress","En cours de validation")
%td
-if account_rib.scan_file?
Fichier reçu :
=account_rib.scan_file.file.filename

View File

@ -0,0 +1,8 @@
=render :partial => "public/my_account/menu"
.center
%h1=qit("add-rib","Ajouter un RIB")
=render :partial => "form"

View File

@ -0,0 +1,51 @@
%tr
%td{:style => "width:120px"}
= l commission.created_at, :format => "%d %b %Y"
%td
-if commission.product_order
=commission.product_order.product_customer.pseudo
%td
-if commission.commission_type_id == 1
Commission directe
-elsif commission.commission_type_id == 2
=i :sitemap
Commission binaire
-elsif commission.commission_type_id == 3
Commission de participation
-elsif commission.commission_type_id == 4
Virement vers votre compte
=commission.virement.account_rib.iban+", "
référence du virement :
=commission.virement.token.upcase
%br
=link_to "Détail PDF", public_virement_path(commission.virement.token) if commission.virement.sended
-elsif commission.commission_type_id == 14
Virement vers votre compte hipay
=commission.hipay_virement.hipay_email+", "
référence du virement :
=commission.hipay_virement.token.upcase
%br
=link_to "Détail PDF", public_hipay_virement_path(commission.hipay_virement.token) if commission.hipay_virement.sended
-elsif commission.commission_type_id == 5
Utilisation du solde pour commande de crédits
%td
-if (commission.commission_type_id == 4 and !commission.virement.sended)
=i :"clock-o"
-elsif (commission.commission_type_id == 14 and !commission.hipay_virement.sended)
=i :"clock-o"
-elsif commission.commission_type_id == 5 and !commission.order_solde.paid
=link_to paid_public_order_path(commission.order_solde) do
=i :"clock-o"
finaliser ma commande en payant le solde par CB
%td{:style => "text-align:right;min-width:100px;", :class => (commission.amount < 0 ? "red" : "green")}
=commission.amount < 0 ? "" : "+ "
=number_to_currency commission.amount

View File

@ -0,0 +1,65 @@
=render :partial => "public/my_account/menu"
.center.padding
%h1 Commissions
.row
.col-md-4
.white
%h4
Soldes
-if current_product_customer.commissions.sum(:amount) >= 2.00
disponibles :
-else
disponible :
%h4{:style => "margin-bottom:0;"}
%table.table
-Devise.where(:orderable => true).all.each do |devise|
%tr
%td
=devise.name
%td
=number_to_currency current_product_customer.solde_commissions(devise.id), :unit => devise.icon
-if current_product_customer.commissions.sum(:amount) >= 10 and current_product_customer.virements.where("sended is null").count < 1
%p=link_to "Demander un retrait de commissions par virement SEPA (€)", new_public_virement_path
%p=link_to "Demander un retrait de commissions par Hipay", new_public_hipay_virement_path
.white
%h4 Comptes SEPA
-if current_product_customer.account_ribs.where(:validated => true).count > 0
%table.table
-current_product_customer.account_ribs.each do |account_rib|
%tr
%td
=account_rib.bank_name
="-"
=account_rib.iban[0..1]
XXXX
=account_rib.iban[-5..-1]
-elsif current_product_customer.account_ribs.count > 0
%p Votre rib est en cours de validation par notre équipe, nous vous contacterons si nous avons besoin de plus d'informations.
-else
%p Pour pouvoir demander un virement de commission vous devez d'abord enregistrer un RIB.
%p
=link_to "Gérer mes comptes bancaires", public_account_ribs_path
%p
Lorsque vous avez des commissions vous pouvez les utiliser pour acheter d'autres coffrets de crédits ou demander un virement sur un compte bancaire domicilié dans les pays éligibles.
.col-md-8
.white
%h4 Historique des commissions
%table.table#commissions=render @commissions
#pagination
= paginate @commissions

View File

@ -0,0 +1,16 @@
= f.input :address, :label => "Adresse"
= f.input :address2, :label => "Adresse (suite)"
= f.input :cp, :label => "Code postal"
= f.input :city, :label => "Ville"
-if @product_customer.id and ProductCustomer.find(@product_customer.id).country?
%strong Pays :
=@product_customer.country
%br
(pour modifier votre pays merci de contacter le support : support@sideplace.com)
-else
-f.object.country = "France" if !f.object.country? and f.object.force_address?
=# f.input :country, :label => "Pays", :as => :select, :include_blank => (@product_customer.force_address? ? false : true), :collection => ProductCustomer::COUNTRY_ORDER.sort
= f.input :country, :label => "Pays", :locale => 'fr', :priority_countries => ["FR", "CH", "BE", "US", "GB", "CA"], :include_blank => (@product_customer.force_address? ? false : true)

View File

@ -0,0 +1,5 @@
-@product_customer = @product_customer || current_product_customer
- @product_customer.binary_preferences = 0 if !@product_customer.binary_preferences
= semantic_form_for [:public, @product_customer], :remote => true do |f|
=f.input :binary_preferences, :collection => [["Automatique : branche la plus faible", 0], ["Branche gauche", 1], ["Branche droite", 2]] , :label => "Sélection de la branche binaire pour les nouveaux affiliés :", :as => :radio, :include_blank => false
=f.submit "Sauvegarder", :class => "btn btn-primary"

View File

@ -0,0 +1,16 @@
%nav#my_account_menu.navbar.navbar-inverse
.container-fluid
.navbar-header{:class => ("active" if params[:controller] == "public/my_account" and params[:action] == "index")}
= link_to i(:user)+raw("&nbsp; Mon compte"), public_my_account_path, :class => "navbar-brand"
%ul.nav.navbar-nav
%li{:class => ("active" if params[:controller] == "public/my_account" and params[:action] == "edit_infos")}= link_to " Profil", public_edit_infos_path
%li{:class => ("active" if params[:controller] == "public/my_account" and params[:action] == "filleuls")}= link_to "Affiliés", public_filleuls_path
%li{:class => ("active" if (params[:controller] == "public/commissions" and params[:action] == "index") or params[:controller] == "public/account_ribs")}= link_to "Commissions / virements", public_commissions_path

View File

@ -0,0 +1,3 @@
.alert.alert-info
%strong Note concernant les pays
=render :partial => "public/my_account/text_pays"

View File

@ -0,0 +1,13 @@
.center.solde_credits
%p
=image_tag "/credit.png"
A ce jour vous avez
=current_product_customer.solde_credits(Date.today)
-if current_product_customer.solde_credits(Date.today) > 1
crédits
-else
crédit
%br
%br
=link_to "acheter des crédits", public_credit_products_path, :class => "btn btn-primary btn-lg"

View File

@ -0,0 +1,51 @@
%p Tout le monde peut déposer des annonces localisées dans quasiment tous les pays du monde.
%p Les clients du monde entier peuvent acheter des crédits d'annonces pour mettre en valeur celles-ci.
%p Tous nos clients peuvent utiliser les commissions touchées via le programme d'affiliation pour acheter d'autres crédits.
%p Actuellement les clients ayant un compte dans ces pays peuvent recevoir leurs commissions par virement SEPA :
%p
=ProductCustomer::COUNTRY.sort.join(" - ")
%hr
-countries = []
-HipayCountry.where(:enabled => true).all.each do |hc|
-c = ISO3166::Country.new hc.code_pays
-countries << c.translations["fr"].to_s+" (#{hc.code_pays})" if c.translations["fr"]
%p
Les clients de ces pays
="(#{countries.size})"
peuvent recevoir leur commissions sur leur compte
=link_to "Hipay Wallet*", "https://www.hipaywallet.com", :target => "_blank"
(en le créant gratuitement si ils n'en ont pas déjà un)
=":"
%p
.row-fluid{:style => "text-align:left;"}
.col-md-4
-count = 0
-countries.sort.each do |c|
-count += 1
=c
%br
-if count == 55 or count == 110
=raw("</div><div class='col-md-4'>")
.clear
%br
%p Si vous souhaitez participer au programme d'affiliation et toucher des commissions sur votre compte bancaire mais que celui-ci n'est pas dans un des pays de la liste, contactez-nous et nous étudierons la situation pour trouver une solution si possible.
%p D'autres pays seront très prochainement ajoutés à la liste des pays supportés automatiquement.
%hr
%p
*Hipay Wallet est un portefeuille éléctronique, une fois vos commissions reçu sur ce portefeuille vous pourrez les utiliser sur les sites acceptant les paiements par Hipay Wallet ou retirer votre argent sur votre compte bancaire, pour plus d'information sur la société veuillez suivre ce lien :
=link_to "https://www.hipaywallet.com/info/about-us", "https://www.hipaywallet.com/info/about-us", :target => "_blank"

View File

@ -0,0 +1,51 @@
=render :partial => "public/my_account/menu"
.center{:style => "position:relative"}
%h1 Réseau binaire
%p Vous touchez désormais des commissions sur tous vos affiliés directs et indirects sur 10 générations, il n'y a plus de notions de branche forte où branche faible. Vous touchez donc des commissions sur chacune des ventes de ces affiliés, en instantané.
%p Vous pouvez accéder à la liste de vos affiliés directs et indirectes par la page "mes affiliés"
-if 1 == 2
%p
-if current_product_customer.binary_active_count == 0
Il n'y a pas encored'inscrits faisant parti de vos affiliés directs dans votre binaire
-elsif current_product_customer.binary_active_count == 1
Il y a actuellement
un inscrit faisant parti de vos affiliés directs dans votre binaire
-else
Il y a actuellement
=current_product_customer.binary_active_count
inscrits faisant parti de vos affiliés directs dans votre binaire
%p
=render :partial => "public/my_account/binary_form"
.left_binary
=current_product_customer.left_binary_points
points
-if left = ProductCustomer.where(:binary_parent_id => current_product_customer.id, :binary_side => 1).first
%br
=left.binary_child_ids.size + 1
=left.binary_child_ids.size > 0 ? "affiliés" : "affilié"
.right_binary
=current_product_customer.right_binary_points
points
-if right = ProductCustomer.where(:binary_parent_id => current_product_customer.id, :binary_side => 2).first
%br
=right.binary_child_ids.size + 1
=right.binary_child_ids.size > 0 ? "affiliés" : "affilié"
-@binary_table = ProductCustomer.get_tree(@parrain)
-@nbr_levels = 4
=render :partial => "public/product_customers/index_binary"

View File

@ -0,0 +1,44 @@
=render :partial => "public/my_account/menu"
.center.padding
%h1 Modifier mon profil
-@product_customer = @product_customer || current_product_customer
= semantic_form_for [:public, @product_customer] do |f|
=f.inputs do
= f.input :email, :label => "Email"
.row
.col-md-6
%h3= qit "Adresse de facturation titre", "Adresse de facturation"
%p
&nbsp;
=f.semantic_fields_for :particular_bill do |f|
=render :partial => "public/product_orders/particular_form", :locals => {:f => f}
-@particular_idem = f.object.particular_idem
.col-md-6
%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"}
#particular_send
=f.semantic_fields_for :particular_send do |f|
=render :partial => "public/product_orders/particular_form", :locals => {:f => f}
=f.submit "Sauvegarder", :class => "btn btn-primary"
%br

View File

@ -0,0 +1,11 @@
.center.search_results.padding
%h1 Mes annonces favorites
-if @annonces.count > 0
=render :partial => "public/annonces/index"
-else
%p
Pour ajouter une annonce dans vos favoris, vous avez juste à cliquer sur la petite étoile en haut à droite de l'image des annonces que vous préférez.

View File

@ -0,0 +1,96 @@
=render :partial => "public/my_account/menu"
.center.padding
%h1 Mes affiliés
-i = 0
-if current_product_customer.mlm_children_id_by_levels[1].size > 0
.white
%table.table.table-striped
%tr
%th
Génération
%th
Nombre d'affiliés
-while i != 10 do
-i += 1
-if current_product_customer.mlm_children_id_by_levels[i].size > 0
%tr
%td
=i
%td
=current_product_customer.mlm_children_id_by_levels[i].size
-else
.white
%p
Vous n'avez pas encore d'affiliés, n'hésitez pas à donner votre lien de recommandation à vos amis !
%p
Votre code de recommandation :
%span{:style => "font-size:1.2em;"}
=current_product_customer.mlm_token.upcase
%p
Votre lien de recommandation :
=link_to mlm_token_url(current_product_customer.mlm_token), mlm_token_url(current_product_customer.mlm_token)
%p
Lorsque que quelqu'un s'inscrit avec votre lien de recommandation nous lui offrons 10 crédits gratuits et nous vous en offrons 5, utilisables pour mettre en valeur vos annonces.
-i = 0
- parents_id = current_product_customer.id
%table.table.table-striped
-while i != 10 do
-i += 1
-filleuls = ProductCustomer.where(:parent_id => parents_id)
-parents_id = filleuls.select(:id).map{ |v| v.id}
-if filleuls.count > 0
%h3
Génération
=i
%table.table
%tr
%th Nom
%th Nombre de commandes
%th Affiliés
%th Code de recommandation
-filleuls.each do |filleul|
%tr.filleul
%td{:style => "vertical-align:middle;"}= filleul.pseudo
%td{:style => "vertical-align:middle;"}
-if filleul.product_orders.where(:paid => true).count > 0
=filleul.product_orders.where(:paid => true).count
%td{:style => "vertical-align:middle;"}
=filleul.children.count
%td
=link_to filleul.mlm_token.upcase, mlm_token_url(filleul.mlm_token)# if filleul.not_blocked

View File

@ -0,0 +1,101 @@
=render :partial => "public/my_account/menu"
.center.padding
-if false
.alert.alert-warning
%h1 Vous devez valider votre adresse mail.
%p Vous avez du recevoir un message pour valider votre adresse mail. Tant que vous n'aurez pas cliquer sur le lien présent sur ce mail votre compte ne sera pas activé.
%p
Le mail a été envoyé à l'adresse :
%strong= current_product_customer.email
=link_to "renvoyer le mail de confirmation", public_reconfirm_email_path, :class => "btn btn-primary"
.padding
-if false and !current_product_customer.uid?
.facebook_connexion.blue_background{:style => "padding:2em 0;padding-top:3.5em;background:rgba(51,141,232,1);color:white;margin-bottom:1em;"}
%p{:style => "text-align:center;"}
Vous avez un compte facebook ? Liez votre compte Vitascreen en deux clics ! Vous pourrez ensuite vous connecter directement par Facebook.
%p{:style => "text-align:center;"}
=link_to i(:facebook) + raw("&nbsp; Lier mon compte Facebook") , "/auth/facebook" , style: "background-color:#3b5998;color:white;", class: "btn btn-lg"
%p{:style => "text-align:center;font-size:0.9em;color:white;"}
Vitascreen ne publiera rien sur votre compte Facebook.
%br
Les autres utilisateurs Vitascreen ne verront pas votre compte Facebook sans votre accord.
-if params[:fb_alert]
.alert.alert-danger{:style => "margin:auto;max-width:800px;"}
=flash[:alert]
.product_customer_dashboard.center.padding
.row
-if current_product_customer.parent
.col-md-3
.panel.panel-default
.panel-heading
Votre recommandeur :
.panel-body
=link_to public_product_customer_path(current_product_customer.parent) do
.binary_account{:class => ""}
= current_product_customer.parent.pseudo
.col-md-3
.panel.panel-default
.panel-heading
Mes commissions
.panel-body
Le solde de vos commissions :
%table.table
-Devise.where(:orderable => true).all.each do |devise|
%tr
%td
=devise.name
%td
=number_to_currency current_product_customer.solde_commissions(devise.id), :unit => devise.icon
.col-md-6
.panel.panel-default
.panel-heading
Recommander le site
.panel-body
%p
Votre code de recommandation :
%span{:style => "font-size:1.2em;"}
=current_product_customer.mlm_token.upcase
%p
Votre lien de recommandation :
=link_to mlm_token_url(current_product_customer.mlm_token), mlm_token_url(current_product_customer.mlm_token)
%p
Lorsque que quelqu'un s'inscrit avec votre lien de recommandation nous lui offrons 10 crédits gratuits et nous vous en offrons 5, utilisables pour mettre en valeur vos annonces.

View File

@ -0,0 +1,2 @@
%h1 Public::MyAccountController#my_annonces
%p Find me in app/views/public/my_account_controller/my_annonces.html.haml

View File

@ -1,5 +1,6 @@
=link_to public_product_category_path(:id => product_category.id, :slug => product_category.lang(I18n.locale).slug) do
.category-container
=image_tag product_category.image_file.file.url if product_category.image_file
.category-title
= product_category.lang(I18n.locale).name
.col-md-4
.category-container{:style => "background-image:url('#{(product_category.image_file.file.url if product_category.image_file)}');"}
.category-title
= product_category.lang(I18n.locale).name

View File

@ -1,6 +1,5 @@
.center{:style => "text-align:center"}
#new_product_customer_form_container
%h1= qit "Pas encore de compte ?", "Pas encore de compte ?"
= semantic_form_for [:public, @product_customer] do |f|

View File

@ -32,7 +32,7 @@
%tr
%td{:colspan => 5, :style => "border:0;"}
%td Total :
%td= number_to_currency(@product_order.archived_total_articles, locale: :fr)
%td= number_to_currency(@product_order.archived_total_articles_ttc, locale: :fr)
-if @product_order.vourcher_code_archived
@ -43,7 +43,7 @@
="("+@product_order.vourcher_code_archived.slug+") :"
%td
="-"
=number_to_currency @product_order.archived_vourcher_reduction, locale: :fr
=number_to_currency @product_order.archived_vourcher_reduction_ttc, locale: :fr

View File

@ -7,15 +7,15 @@
-if @product_order.vourcher_code
%div.pull-right
= "Total articles : " + number_to_currency(@product_order.total_articles, locale: :fr)
= "Total articles : " + number_to_currency(@product_order.total_articles_ttc, locale: :fr)
.clear
%div.pull-right
=qit "Code réduction tableau", "Code de réduction "
="("+@product_order.vourcher_code.slug+") :"
=number_to_currency @product_order.vourcher_reduction
=number_to_currency @product_order.vourcher_reduction_ttc
.clear
%div.pull-right
= "Total : " + number_to_currency((@product_order.total_articles-@product_order.vourcher_reduction) , locale: :fr)
= "Total : " + number_to_currency((@product_order.total_articles_ttc-@product_order.vourcher_reduction_ttc) , locale: :fr)
.clear
%center

View File

@ -5,12 +5,7 @@
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 StyAndUs à l'adresse suivante :
%br
Galerie La Forestière
%br
1 rue de la Forestière
%br
33970 CAP FERRET
%p Si vous souhaitez finalement payer cette commande par carte banque vous pouvez la retrouver dans votre compte client.

View File

@ -10,7 +10,7 @@
%tr
%td{:colspan => 5, :style => "border:0;"}
%td Total :
%td= number_to_currency(@product_order.total_articles, locale: :fr)
%td= number_to_currency(@product_order.total_articles_ttc, locale: :fr)
-if @product_order.vourcher_code
%tr
@ -20,7 +20,7 @@
="("+@product_order.vourcher_code.slug+") :"
%td
="-"
=number_to_currency @product_order.vourcher_reduction, locale: :fr
=number_to_currency @product_order.vourcher_reduction_ttc, locale: :fr

View File

@ -1,4 +1,4 @@
.product_show
.center.product_show
.row
.col_images

View File

@ -0,0 +1,19 @@
=semantic_form_for [:public, @virement] do |f|
= f.inputs do
=f.hidden_field :devise_id
=f.input :account_rib, :label => "Compte bénéficiaire", :as => :select, :include_blank => false, :collection => f.object.product_customer.account_ribs.where(:validated => true), :member_label => :iban
%p Veuillez indiquer ci dessous le montant du virement demandé (hors frais)
%p
Votre solde de commissions est de
=number_to_currency current_product_customer.solde_commissions(1)
vous pouvez donc demander un virement de
=number_to_currency current_product_customer.max_virement(1)
(Actuellement 5€ de frais par virements)
=f.input :amount_ht, :label => "Montant :"
=f.submit "Sauvegarder", :class => "btn btn-primary"

View File

@ -0,0 +1,26 @@
=render :partial => "public/my_account/menu"
.center
%h1 Demander un virement de commission
%p
Vous avez demander un virement de
=number_to_currency @virement.amount_ht, :unit => @virement.devise.icon
vers le compte
=@virement.account_rib.iban
="."
%p
En incluant les frais de virement de 5€,
=number_to_currency (@virement.amount_ht + 5.0), :unit => @virement.devise.icon
seront déduit de votre solde de commissions.
%p Votre compte sera crédité sous 1 à 3 jours ouvré suivant la banque de votre compte.
=semantic_form_for [:public, @virement] do |f|
=f.hidden_field :account_rib_id
=f.hidden_field :amount_ht
=f.hidden_field :devise_id
=hidden_field_tag :confirm, true
=f.submit "Confirmer ma demande", :class => "btn btn-primary"

View File

@ -0,0 +1,40 @@
=render :partial => "public/my_account/menu"
.center.padding
.padding
%h1 Comptes bancaires
=link_to "Demander un virement de commissions", new_public_virement_path, :class => "btn btn-primary"
%table.table{:style => "text-align:left"}
%tr
%th Intitulé du compte
%th Pays
%th Banque
%th
Iban
%th
Tva
%th Statut
%th
-@virements.each do |virement|
%tr
%td=virement.name
%td=virement.country
%td=virement.bank_name
%td=virement.iban
%td
-if virement.tva?
=virement.tva_number
%td
-if virement.validated?
Validé
-else
En cours de validation
%td
-if virement.scan_file?
Fichier reçu :
=virement.scan_file.file.filename

View File

@ -0,0 +1,22 @@
=render :partial => "public/my_account/menu"
.center.padding
%h3 Demander un virement de commission
.white
-if current_product_customer.account_ribs.where(:validated => true).count > 0
=render :partial => "form"
-elsif current_product_customer.account_ribs.count > 0
%p
Vous devez attendre que nous ayons validé votre RIB pour pouvoir effectuer une demande de virement. Une fois saisis les RIBs sont généralement validés dans les 48h.
Vous pouvez suivre l'état sur cette page :
%p
=link_to "Gérer mes comptes bancaires", public_account_ribs_path
-else
%p
Vous devez enregistrer un RIB pour pouvoir demander un virement de vos commissions. Une fois saisi le RIB sera généralement activé dans les 48h. Vous pouvez enregistrer vos RIBs à sur cette page :
%p
=link_to "Gérer mes comptes bancaires", public_account_ribs_path

View File

@ -0,0 +1,145 @@
!!!
%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" ;
}
#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:right;
}
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;
}
%body
#main
%div{:style => "height:2cm;"}
#document_info{:style => "position:absolute;top:2cm;left:12cm;"}
=#"Facture n°#{current_product_customer.bill_number}"
%br
="Le #{l(@virement.created_at, :format => :date)}"
#recipient_address{:style => "position:absolute;top:5cm;left:12cm;"}
-if current_product_customer.organisation?
=current_product_customer.organisation
-else
=current_product_customer.firstname
=current_product_customer.name
%br
=current_product_customer.address
%br
-if current_product_customer.address2?
=current_product_customer.address2
%br
=current_product_customer.cp
=current_product_customer.city
%br
=current_product_customer.country
#header{:style => ""}
%div{:style => "margin-top:8cm;margin-left:1cm;margin-right:1cm;margin-bottom:0cm;position:relative;"}
%p
%strong Note de virement de commission
%p
Référence du virement :
%strong= @virement.token.upcase
%p
Date de la demande de virement :
%strong= @virement.created_at
%p
Référence compte destinataire :
%strong= @virement.account_rib.iban
%p
Montant du virement :
%strong=number_to_currency @virement.amount_ttc
-tva = true if @virement.tva.to_f > 0
-if tva
%p
dont
=number_to_currency @virement.tva
de TVA
(
Votre numéro de TVA :
=@virement.account_rib.tva_number
)
#footer{:style => "margin:1cm 1cm;margin-top:5cm"}
%p Important : Nous vous rappelons que vous devez déclarer les commissions que nous vous versons dans vos revenus ou dans les recettes de votre structure. En cas de doute sur la manière de déclarer vos commissions n'hésitez pas à vous rapprocher d'une personne compétente comme un expert comptable par exemple.

View File

@ -13,8 +13,11 @@ Rails.application.routes.draw do
get "sitemap.:f" => "public/sitemap#sitemap"
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
get 'p/:mlm_token' => "public/product_customers#parrainage", :as => :mlm_token
get "cat/:id/:slug.:format" => "public/product_categories#show", :as => :public_product_category, :format => "html"
get "produit/:id/:slug.:format" => "public/products#show", :as => :public_product, :format => "html"
get "" => 'public/menu_items#show'
@ -88,6 +91,23 @@ Rails.application.routes.draw do
end
namespace :public do
get 'my_account/favoris', :as => "favs"
get 'my_account/filleuls', :as => "filleuls"
get 'my_account/binary', :as => "binary"
get 'my_account/index', :as => "my_account"
get 'my_account/edit_infos', :as => "edit_infos"
get 'my_account/my_annonces', :as => "my_annonces"
get 'my_account/reconfirm', :as => "reconfirm_email"
resources :virements
resources :commissions
resources :account_ribs
resources :press_releases
resources :label_produits do
collection do

View File

@ -0,0 +1,15 @@
class CreateCommissions < ActiveRecord::Migration
def change
create_table :commissions do |t|
t.references :product_customer, index: true
t.decimal :amount, precision: 10, scale: 2
t.boolean :canceled
t.datetime :canceled_at
t.integer :commission_type_id
t.integer :product_order_id
t.timestamps null: false
end
add_foreign_key :commissions, :product_customers
end
end

View File

@ -0,0 +1,7 @@
class AddRbtToCommissions < ActiveRecord::Migration
def change
add_column :commissions, :canceled_id, :integer
add_column :commissions, :binary_point_id, :integer
end
end

View File

@ -0,0 +1,28 @@
class CreateAccountRibs < ActiveRecord::Migration
def change
create_table :account_ribs do |t|
t.references :product_customer, index: true
t.string :bank_name
t.string :bank_city
t.string :country
t.string :name
t.string :address
t.string :address2
t.string :cp
t.string :city
t.string :iban
t.string :bic
t.string :tva_number
t.boolean :tva
t.boolean :enabled
t.boolean :validated
t.datetime :validated_at
t.boolean :archived
t.datetime :archived_at
t.string :scan_file
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,5 @@
class AddCountPartComIdToCommissions < ActiveRecord::Migration
def change
end
end

View File

@ -0,0 +1,14 @@
class CreateVirementRemises < ActiveRecord::Migration
def change
create_table :virement_remises do |t|
t.string :token
t.decimal :amount, :precision => 10, :scale => 2
t.integer :virement_type_id
t.boolean :sended
t.boolean :confirmed
t.string :note
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,24 @@
class CreateVirements < ActiveRecord::Migration
def change
create_table :virements do |t|
t.string :token
t.integer :virement_type_id
t.boolean :sended
t.boolean :confirmed
t.boolean :done
t.string :note
t.references :product_customer, index: true
t.references :virement_remise, index: true
t.decimal :amount_ht, :precision => 10, :scale => 2
t.decimal :amount_ttc, :precision => 10, :scale => 2
t.decimal :tva, :precision => 10, :scale => 2
t.decimal :frais
t.decimal :solde
t.references :commission, index: true
t.references :account_rib, index: true
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,12 @@
class CreateDevises < ActiveRecord::Migration
def change
create_table :devises do |t|
t.string :name
t.string :icon
t.string :code
t.decimal :rate, :precision => 10, :scale => 2
t.string :text_format
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,6 @@
class AddPercentToCommissions < ActiveRecord::Migration
def change
add_column :commissions, :percent, :decimal, :precision => 10, :scale => 2
add_column :commissions, :generation, :integer
end
end

View File

@ -0,0 +1,5 @@
class AddOrderableToDevises < ActiveRecord::Migration
def change
add_column :devises, :orderable, :boolean
end
end

View File

@ -0,0 +1,8 @@
class AddDeviseToVirements < ActiveRecord::Migration
def change
add_reference :virements, :devise, index: true
add_foreign_key :virements, :devises
Virement.all.update_all(:devise_id => 1)
end
end

View File

@ -0,0 +1,8 @@
class AddDeviseToVirementRemises < ActiveRecord::Migration
def change
add_reference :virement_remises, :devise, index: true
add_foreign_key :virement_remises, :devises
VirementRemise.all.update_all(:devise_id => 1)
end
end

View File

@ -0,0 +1,8 @@
class AddDeviseToCommissions < ActiveRecord::Migration
def change
add_reference :commissions, :devise, index: true
add_foreign_key :commissions, :devises
Commission.all.update_all(:devise_id => 1)
end
end

View File

@ -0,0 +1,6 @@
class AddFacebookFieldsToUsers < ActiveRecord::Migration
def change
add_column :product_customers, :provider, :string
add_column :product_customers, :uid, :string
end
end

View File

@ -0,0 +1,5 @@
class AddFacebookTokenToUsers < ActiveRecord::Migration
def change
add_column :product_customers, :facebook_token, :string
end
end

View File

@ -13,6 +13,32 @@
ActiveRecord::Schema.define(version: 20160428093204) do
create_table "account_ribs", force: :cascade do |t|
t.integer "product_customer_id", limit: 4
t.string "bank_name", limit: 255
t.string "bank_city", limit: 255
t.string "country", limit: 255
t.string "name", limit: 255
t.string "address", limit: 255
t.string "address2", limit: 255
t.string "cp", limit: 255
t.string "city", limit: 255
t.string "iban", limit: 255
t.string "bic", limit: 255
t.string "tva_number", limit: 255
t.boolean "tva", limit: 1
t.boolean "enabled", limit: 1
t.boolean "validated", limit: 1
t.datetime "validated_at"
t.boolean "archived", limit: 1
t.datetime "archived_at"
t.string "scan_file", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "account_ribs", ["product_customer_id"], name: "index_account_ribs_on_product_customer_id", using: :btree
create_table "admins", force: :cascade do |t|
t.string "name", limit: 255
t.string "firstname", limit: 255
@ -166,6 +192,27 @@ ActiveRecord::Schema.define(version: 20160428093204) do
t.boolean "newsletter", limit: 1
end
create_table "commissions", force: :cascade do |t|
t.integer "product_customer_id", limit: 4
t.decimal "amount", precision: 10, scale: 2
t.boolean "canceled", limit: 1
t.datetime "canceled_at"
t.integer "commission_type_id", limit: 4
t.integer "order_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "canceled_id", limit: 4
t.integer "binary_point_id", limit: 4
t.integer "count_part_com_id", limit: 4
t.decimal "percent", precision: 10, scale: 2
t.integer "generation", limit: 4
t.integer "devise_id", limit: 4
end
add_index "commissions", ["count_part_com_id"], name: "index_commissions_on_count_part_com_id", using: :btree
add_index "commissions", ["devise_id"], name: "index_commissions_on_devise_id", using: :btree
add_index "commissions", ["product_customer_id"], name: "index_commissions_on_product_customer_id", using: :btree
create_table "data_file_categories", force: :cascade do |t|
t.string "name", limit: 255
t.string "slug", limit: 255
@ -192,6 +239,17 @@ ActiveRecord::Schema.define(version: 20160428093204) do
add_index "data_files", ["image_file_id"], name: "index_data_files_on_image_file_id", using: :btree
create_table "devises", force: :cascade do |t|
t.string "name", limit: 255
t.string "icon", limit: 255
t.string "code", limit: 255
t.decimal "rate", precision: 10, scale: 2
t.string "text_format", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "orderable", limit: 1
end
create_table "download_contents", force: :cascade do |t|
t.string "title", limit: 255
t.string "style", limit: 255
@ -578,6 +636,9 @@ ActiveRecord::Schema.define(version: 20160428093204) do
t.string "mlm_token", limit: 255
t.boolean "parent_at_create", limit: 1
t.string "parent_code", limit: 255
t.string "provider", limit: 255
t.string "uid", limit: 255
t.string "facebook_token", limit: 255
end
create_table "product_fdps", force: :cascade do |t|
@ -927,6 +988,47 @@ ActiveRecord::Schema.define(version: 20160428093204) do
t.datetime "updated_at"
end
create_table "virement_remises", force: :cascade do |t|
t.string "token", limit: 255
t.decimal "amount", precision: 10, scale: 2
t.integer "virement_type_id", limit: 4
t.boolean "sended", limit: 1
t.boolean "confirmed", limit: 1
t.string "note", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "devise_id", limit: 4
end
add_index "virement_remises", ["devise_id"], name: "index_virement_remises_on_devise_id", using: :btree
create_table "virements", force: :cascade do |t|
t.string "token", limit: 255
t.integer "virement_type_id", limit: 4
t.boolean "sended", limit: 1
t.boolean "confirmed", limit: 1
t.boolean "done", limit: 1
t.string "note", limit: 255
t.integer "product_customer_id", limit: 4
t.integer "virement_remise_id", limit: 4
t.decimal "amount_ht", precision: 10, scale: 2
t.decimal "amount_ttc", precision: 10, scale: 2
t.decimal "tva", precision: 10, scale: 2
t.decimal "frais", precision: 10
t.decimal "solde", precision: 10
t.integer "commission_id", limit: 4
t.integer "account_rib_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "devise_id", limit: 4
end
add_index "virements", ["account_rib_id"], name: "index_virements_on_account_rib_id", using: :btree
add_index "virements", ["commission_id"], name: "index_virements_on_commission_id", using: :btree
add_index "virements", ["devise_id"], name: "index_virements_on_devise_id", using: :btree
add_index "virements", ["product_customer_id"], name: "index_virements_on_product_customer_id", using: :btree
add_index "virements", ["virement_remise_id"], name: "index_virements_on_virement_remise_id", using: :btree
create_table "vourcher_codes", force: :cascade do |t|
t.boolean "archived", limit: 1, default: false
t.string "slug", limit: 255
@ -940,6 +1042,8 @@ ActiveRecord::Schema.define(version: 20160428093204) do
add_foreign_key "articles", "article_authors"
add_foreign_key "block_contents", "image_files"
add_foreign_key "commissions", "devises"
add_foreign_key "commissions", "product_customers"
add_foreign_key "data_files", "image_files"
add_foreign_key "home_slider_slides", "home_sliders"
add_foreign_key "lang_pages", "lang_sites"
@ -959,4 +1063,6 @@ ActiveRecord::Schema.define(version: 20160428093204) do
add_foreign_key "products", "product_categories"
add_foreign_key "products", "product_collections"
add_foreign_key "video_files", "image_files"
add_foreign_key "virement_remises", "devises"
add_foreign_key "virements", "devises"
end