This commit is contained in:
Nicolas Bally 2018-12-18 22:55:29 +01:00
parent 4c6cb3096c
commit 4a3a65e4bf
17 changed files with 206 additions and 37 deletions

View 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

View File

@ -37,7 +37,7 @@ class Public::PCustomerAuthsController < ApplicationController
user.save(:validate => false) user.save(:validate => false)
redirect_to public_my_account_path redirect_to public_p_products_path
else else

View File

@ -3,6 +3,7 @@
class Public::PProductsController < ApplicationController class Public::PProductsController < ApplicationController
layout "public" layout "public"
before_filter :auth_p_customer
before_filter :p_customer_validated before_filter :p_customer_validated
def index def index

View File

@ -3,6 +3,8 @@
%li= link_to "Produits", admin_p_products_path %li= link_to "Produits", admin_p_products_path
%li= link_to "Résumé stocks", admin_p_product_stocks_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 produits", admin_p_product_cats_path
%li= link_to "Catégories prix", admin_p_price_cats_path
-if false -if false
%li= link_to "Matières premières", admin_p_brut_products_path %li= link_to "Matières premières", admin_p_brut_products_path

View 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"

View 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

View File

@ -0,0 +1,2 @@
$('#p_price_cats_rows').html("<%= escape_javascript(render(@p_price_cats))%>");
close_pane_hover();

View File

@ -0,0 +1 @@
$('#p_price_cat_<%= @p_price_cat.id %>').remove();

View File

@ -0,0 +1,4 @@
%h1 Modifier un distributeur
= render 'form'

View File

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

View 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

View File

@ -0,0 +1,4 @@
%h1 Ajouter un distributeur
= render 'form'

View File

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

View File

@ -0,0 +1 @@
=debug @customer

View File

@ -0,0 +1,2 @@
$('#p_price_cats_rows').html("<%= escape_javascript(render(@p_price_cats))%>");
close_pane_hover();

View File

@ -8,9 +8,7 @@
Etat Etat
%th %th
Description Description
%th Taille
%th
Couleur
%th %th
Qte Qte
@ -26,7 +24,9 @@
-p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0") -p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
-nbr_lines = p_sheet_line_lines.count -nbr_lines = p_sheet_line_lines.count
-ok = true if sheet_line.shiped -ok = true if sheet_line.shiped
%tr.sheet_line_head
%tr
%td %td
- if sheet_line.shiped - if sheet_line.shiped
@ -36,45 +36,59 @@
%br %br
-if sheet_line.p_product.p_product_cat_id != 6 or sheet_line.externe and @p_customer_sheet -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 =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 %td{:colspan => 1, :style => "text-align:right;"}
=sheet_line.product_name %table.size_table
-if false %tr
%br %th{:style => "text-align:left !important;"}
=debug sheet_line.ship_affects =sheet_line.product_name
%td -sheet_line.p_product.p_sizes.all.each do |psize|
%td %th.p_size_td=psize.name
%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
-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 %tr
%td %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 %td
=number_to_currency sheet_line.price.to_f
%td
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
%td %td
=p_sheet_line_line.p_size.name if p_sheet_line_line.p_size =number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
%td
=p_sheet_line_line.p_color.name if p_sheet_line_line.p_color
%td
=p_sheet_line_line.qte
%td
%td
%td
@ -86,7 +100,7 @@
%tr.sheet_line_head %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 %strong
=total[:label] =total[:label]
%td %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;
}
} }

View File

@ -131,6 +131,7 @@ Rails.application.routes.draw do
end end
end end
resources :p_price_cats
resources :p_ship_bills resources :p_ship_bills
resources :p_stats resources :p_stats
resources :p_payment_types resources :p_payment_types
@ -366,7 +367,7 @@ Rails.application.routes.draw do
get "plan" => "public/home#plan" get "plan" => "public/home#plan"
root "public/my_account#index" root "public/p_products#index"