suite
This commit is contained in:
parent
4c6cb3096c
commit
4a3a65e4bf
76
app/controllers/admin/p_price_cats_controller.rb
Normal file
76
app/controllers/admin/p_price_cats_controller.rb
Normal file
@ -0,0 +1,76 @@
|
||||
# -*- encoding : utf-8 -*-
|
||||
|
||||
class Admin::PPriceCatsController < ApplicationController
|
||||
layout "admin"
|
||||
before_filter :auth_admin
|
||||
|
||||
before_filter :admin_space
|
||||
|
||||
def admin_space
|
||||
@admin_space = "ventes"
|
||||
end
|
||||
|
||||
def index
|
||||
@p_price_cats = PPriceCat.order(:name).all
|
||||
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@p_price_cat = PPriceCat.find(params[:id])
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
|
||||
|
||||
@p_price_cat = PPriceCat.new
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def edit
|
||||
|
||||
|
||||
@p_price_cat = PPriceCat.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@p_price_cat = PPriceCat.new(params.require(:p_price_cat).permit!)
|
||||
|
||||
|
||||
if @p_price_cat.save
|
||||
@p_price_cats = PPriceCat.order(:name).all
|
||||
|
||||
else
|
||||
render action: "new"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@p_price_cat = PPriceCat.find(params[:id])
|
||||
|
||||
|
||||
if @p_price_cat.update_attributes(params.require(:p_price_cat).permit!)
|
||||
|
||||
@p_price_cats = PPriceCat.order(:name).all
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@p_price_cat = PPriceCat.find(params[:id])
|
||||
@p_price_cat.destroy
|
||||
|
||||
|
||||
end
|
||||
end
|
@ -37,7 +37,7 @@ class Public::PCustomerAuthsController < ApplicationController
|
||||
user.save(:validate => false)
|
||||
|
||||
|
||||
redirect_to public_my_account_path
|
||||
redirect_to public_p_products_path
|
||||
|
||||
|
||||
else
|
||||
|
@ -3,6 +3,7 @@
|
||||
class Public::PProductsController < ApplicationController
|
||||
layout "public"
|
||||
|
||||
before_filter :auth_p_customer
|
||||
before_filter :p_customer_validated
|
||||
|
||||
def index
|
||||
|
@ -3,6 +3,8 @@
|
||||
%li= link_to "Produits", admin_p_products_path
|
||||
%li= link_to "Résumé stocks", admin_p_product_stocks_path
|
||||
%li= link_to "Catégories produits", admin_p_product_cats_path
|
||||
%li= link_to "Catégories prix", admin_p_price_cats_path
|
||||
|
||||
-if false
|
||||
%li= link_to "Matières premières", admin_p_brut_products_path
|
||||
|
||||
|
9
app/views/admin/p_price_cats/_form.html.haml
Executable file
9
app/views/admin/p_price_cats/_form.html.haml
Executable file
@ -0,0 +1,9 @@
|
||||
=semantic_form_for [:admin, @p_price_cat], :remote => true do |f|
|
||||
|
||||
.content
|
||||
=f.inputs do
|
||||
|
||||
= f.input :name, :label => "Nom :"
|
||||
|
||||
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
||||
|
11
app/views/admin/p_price_cats/_p_price_cat.html.haml
Normal file
11
app/views/admin/p_price_cats/_p_price_cat.html.haml
Normal file
@ -0,0 +1,11 @@
|
||||
%tr#p_price_cat{:id => p_price_cat.id}
|
||||
%td= p_price_cat.name
|
||||
|
||||
|
||||
|
||||
|
||||
%td.actions
|
||||
= link_to i(:"trash-o"), [:admin, p_price_cat], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette catégorie ? ' } , :remote => true
|
||||
= link_to i(:pencil), edit_admin_p_price_cat_path(p_price_cat), :remote => true
|
||||
|
||||
|
2
app/views/admin/p_price_cats/create.js.erb
Normal file
2
app/views/admin/p_price_cats/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#p_price_cats_rows').html("<%= escape_javascript(render(@p_price_cats))%>");
|
||||
close_pane_hover();
|
1
app/views/admin/p_price_cats/destroy.js.erb
Normal file
1
app/views/admin/p_price_cats/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
||||
$('#p_price_cat_<%= @p_price_cat.id %>').remove();
|
4
app/views/admin/p_price_cats/edit.html.haml
Normal file
4
app/views/admin/p_price_cats/edit.html.haml
Normal file
@ -0,0 +1,4 @@
|
||||
%h1 Modifier un distributeur
|
||||
|
||||
= render 'form'
|
||||
|
1
app/views/admin/p_price_cats/edit.js.erb
Normal file
1
app/views/admin/p_price_cats/edit.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
21
app/views/admin/p_price_cats/index.html.haml
Normal file
21
app/views/admin/p_price_cats/index.html.haml
Normal file
@ -0,0 +1,21 @@
|
||||
.qi_header
|
||||
.right= link_to 'Ajouter une catégorie de prix', new_admin_p_price_cat_path(), :class => "btn btn-primary", :remote => true
|
||||
%h1
|
||||
Clients
|
||||
%span
|
||||
Catégories de prix
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding
|
||||
%table.table
|
||||
%tr
|
||||
%th Nom
|
||||
|
||||
%th
|
||||
|
||||
|
||||
%tbody#p_price_cats_rows
|
||||
=render @p_price_cats
|
||||
|
||||
|
4
app/views/admin/p_price_cats/new.html.haml
Normal file
4
app/views/admin/p_price_cats/new.html.haml
Normal file
@ -0,0 +1,4 @@
|
||||
%h1 Ajouter un distributeur
|
||||
|
||||
= render 'form'
|
||||
|
1
app/views/admin/p_price_cats/new.js.erb
Normal file
1
app/views/admin/p_price_cats/new.js.erb
Normal file
@ -0,0 +1 @@
|
||||
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
1
app/views/admin/p_price_cats/show.html.haml
Normal file
1
app/views/admin/p_price_cats/show.html.haml
Normal file
@ -0,0 +1 @@
|
||||
=debug @customer
|
2
app/views/admin/p_price_cats/update.js.erb
Normal file
2
app/views/admin/p_price_cats/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#p_price_cats_rows').html("<%= escape_javascript(render(@p_price_cats))%>");
|
||||
close_pane_hover();
|
@ -8,9 +8,7 @@
|
||||
Etat
|
||||
%th
|
||||
Description
|
||||
%th Taille
|
||||
%th
|
||||
Couleur
|
||||
|
||||
|
||||
%th
|
||||
Qte
|
||||
@ -26,7 +24,9 @@
|
||||
-p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
|
||||
-nbr_lines = p_sheet_line_lines.count
|
||||
-ok = true if sheet_line.shiped
|
||||
%tr.sheet_line_head
|
||||
|
||||
|
||||
%tr
|
||||
%td
|
||||
|
||||
- if sheet_line.shiped
|
||||
@ -36,45 +36,59 @@
|
||||
%br
|
||||
-if sheet_line.p_product.p_product_cat_id != 6 or sheet_line.externe and @p_customer_sheet
|
||||
=link_to "Indiquer comme livré", set_sheet_line_ship_admin_p_customer_sheet_path(@p_customer_sheet, :p_sheet_line_ids => [sheet_line.id]), :remote => true
|
||||
%td
|
||||
%strong
|
||||
=sheet_line.product_name
|
||||
-if false
|
||||
%br
|
||||
=debug sheet_line.ship_affects
|
||||
|
||||
%td{:colspan => 1, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
%tr
|
||||
%th{:style => "text-align:left !important;"}
|
||||
=sheet_line.product_name
|
||||
|
||||
|
||||
%td
|
||||
%td
|
||||
|
||||
%td
|
||||
%strong=sheet_line.qte
|
||||
|
||||
%td
|
||||
%strong=number_to_currency sheet_line.price if sheet_line.price
|
||||
|
||||
%td
|
||||
%strong=number_to_currency sheet_line.price_tot if sheet_line.price_tot
|
||||
|
||||
%td
|
||||
%strong=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
|
||||
-sheet_line.p_product.p_sizes.all.each do |psize|
|
||||
%th.p_size_td=psize.name
|
||||
|
||||
|
||||
-p_sheet_line_lines.each do |p_sheet_line_line|
|
||||
%td{:colspan => 4}
|
||||
-sheet_line.p_product.p_colors.all.each do |pc|
|
||||
-qte_tot = 0.0
|
||||
%tr
|
||||
%td
|
||||
%td{:colspan => 1, :style => "text-align:right;"}
|
||||
%table.size_table
|
||||
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td
|
||||
=pc.name
|
||||
|
||||
-sheet_line.p_product.p_sizes.all.each do |psize|
|
||||
|
||||
%td.p_size_td
|
||||
-psl = p_sheet_line_lines.joins(:p_product_stock).where(:p_product_stocks => {:p_size_id => psize.id, :p_color_id => pc.id} ).first
|
||||
-if psl
|
||||
=psl.qte
|
||||
-qte_tot += psl.qte
|
||||
|
||||
|
||||
%td{}
|
||||
=qte_tot.to_i
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f
|
||||
%td
|
||||
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
|
||||
|
||||
%td
|
||||
=p_sheet_line_line.p_size.name if p_sheet_line_line.p_size
|
||||
%td
|
||||
=p_sheet_line_line.p_color.name if p_sheet_line_line.p_color
|
||||
%td
|
||||
=p_sheet_line_line.qte
|
||||
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
%td
|
||||
%td
|
||||
%td
|
||||
|
||||
|
||||
|
||||
@ -86,7 +100,7 @@
|
||||
|
||||
|
||||
%tr.sheet_line_head
|
||||
%td{:style => "text-align:right;padding-right:10px;", :colspan =>7}
|
||||
%td{:style => "text-align:right;padding-right:10px;", :colspan =>5}
|
||||
%strong
|
||||
=total[:label]
|
||||
%td
|
||||
@ -108,4 +122,22 @@
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.size_table{
|
||||
width:97%;
|
||||
|
||||
text-align:center;
|
||||
margin-right:3%;
|
||||
td,th{
|
||||
text-align:right;
|
||||
border:0;
|
||||
border-right:solid 1px rgba(0,0,0,0.1) !important;
|
||||
padding:0 3px;
|
||||
}
|
||||
.p_size_td{
|
||||
width:60px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
}
|
@ -131,6 +131,7 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :p_price_cats
|
||||
resources :p_ship_bills
|
||||
resources :p_stats
|
||||
resources :p_payment_types
|
||||
@ -366,7 +367,7 @@ Rails.application.routes.draw do
|
||||
get "plan" => "public/home#plan"
|
||||
|
||||
|
||||
root "public/my_account#index"
|
||||
root "public/p_products#index"
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user