suite
This commit is contained in:
parent
6036a5cbec
commit
512eb7346a
@ -2,7 +2,9 @@
|
||||
|
||||
.content
|
||||
=form.input :reseaux_id, :label => "Réseau :", :collection => Reseaux.where(:parent_id => nil).all, :as => :select, :include_blank => false
|
||||
|
||||
|
||||
=form.input :orderable, :label => "Peut être commandé ?", :as => :boolean
|
||||
|
||||
=#form.input :product_category_id, :label => "Catégorie :", :collection => @categories_select, :as => :select, :include_blank => false
|
||||
|
||||
-if @product.product_category_id
|
||||
|
@ -50,102 +50,102 @@
|
||||
-@porduct_order_product.product_size_id = @product.product_sizes_in_stock(@porduct_order_product.product_option_id).first.id if @product.product_sizes_in_stock(@porduct_order_product.product_option_id).first
|
||||
|
||||
|
||||
|
||||
-if @product.product_stocks.where("stock_th > 0").count > 0
|
||||
= form_for [:public, @porduct_order_product], :remote => true do |f|
|
||||
= f.hidden_field :product_id
|
||||
-if @product.orderable
|
||||
-if @product.product_stocks.where("stock_th > 0").count > 0
|
||||
= form_for [:public, @porduct_order_product], :remote => true do |f|
|
||||
= f.hidden_field :product_id
|
||||
|
||||
.product_options
|
||||
-@product.product_options_in_stock.each do |product_option|
|
||||
.product_options
|
||||
-@product.product_options_in_stock.each do |product_option|
|
||||
|
||||
=link_to product_option.lang(I18n.locale).name, "#", :onclick => "$('#product_option_id').val($(this).data('id'));option_active();update_size_in_stocks($(this).data('sizes-in-stock'));return false;", :data => {:id => product_option.id, :sizes_in_stock => @product.product_sizes_in_stock_id(product_option.id)}, :id => "product_option_link_#{product_option.id}", :class => "product_option_link"
|
||||
=link_to product_option.lang(I18n.locale).name, "#", :onclick => "$('#product_option_id').val($(this).data('id'));option_active();update_size_in_stocks($(this).data('sizes-in-stock'));return false;", :data => {:id => product_option.id, :sizes_in_stock => @product.product_sizes_in_stock_id(product_option.id)}, :id => "product_option_link_#{product_option.id}", :class => "product_option_link"
|
||||
|
||||
|
||||
= f.hidden_field :product_option_id, :id => "product_option_id"
|
||||
= f.hidden_field :product_option_id, :id => "product_option_id"
|
||||
|
||||
|
||||
|
||||
|
||||
#product_sizes.product_sizes
|
||||
-@product.product_sizes_in_stock(:all).each do |product_size|
|
||||
=link_to product_size.name, "#", :onclick => "$('#product_size_id').val($(this).data('id'));size_active();return false;", :data => {:id => product_size.id }, :id => "product_size_link_#{product_size.id}", :class => "product_size_link "+("in_stock" if @product.product_sizes_in_stock_id(@porduct_order_product.product_option_id).include?(product_size.id)).to_s
|
||||
#product_sizes.product_sizes
|
||||
-@product.product_sizes_in_stock(:all).each do |product_size|
|
||||
=link_to product_size.name, "#", :onclick => "$('#product_size_id').val($(this).data('id'));size_active();return false;", :data => {:id => product_size.id }, :id => "product_size_link_#{product_size.id}", :class => "product_size_link "+("in_stock" if @product.product_sizes_in_stock_id(@porduct_order_product.product_option_id).include?(product_size.id)).to_s
|
||||
|
||||
|
||||
|
||||
|
||||
= f.hidden_field :product_size_id, :id => "product_size_id"
|
||||
= f.hidden_field :product_size_id, :id => "product_size_id"
|
||||
|
||||
|
||||
|
||||
= f.submit "Ajouter à la commande", :class => "add_to_cart btn"
|
||||
%br
|
||||
%br
|
||||
%div
|
||||
.clock{:style => "margin:2em;display:inline-block;width:auto;margin:0;margin-left:-5px;"}
|
||||
<script type="text/javascript">
|
||||
=raw "var clock_max = #{nbr_products};"
|
||||
</script>
|
||||
:javascript
|
||||
var countup;
|
||||
= f.submit "Ajouter à la commande", :class => "add_to_cart btn"
|
||||
%br
|
||||
%br
|
||||
%div
|
||||
.clock{:style => "margin:2em;display:inline-block;width:auto;margin:0;margin-left:-5px;"}
|
||||
<script type="text/javascript">
|
||||
=raw "var clock_max = #{nbr_products};"
|
||||
</script>
|
||||
:javascript
|
||||
var countup;
|
||||
|
||||
|
||||
var clock = $('.clock').FlipClock(0, {
|
||||
clockFace: 'Counter',
|
||||
minimumDigits: 1,
|
||||
callbacks:{
|
||||
init:function (){
|
||||
var clock = $('.clock').FlipClock(0, {
|
||||
clockFace: 'Counter',
|
||||
minimumDigits: 1,
|
||||
callbacks:{
|
||||
init:function (){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if(clock_max > 0){
|
||||
countup = setInterval(function() {
|
||||
clock.increment();
|
||||
if(clock.getTime().time >= clock_max) {
|
||||
clock.stop();
|
||||
clearInterval(countup);
|
||||
}
|
||||
}, 0);}
|
||||
%div{:style => "padding:10px 15px;display:inline-block;text-transform:uppercase;font-weight:bold;font-size:25px;line-height:30px;position:relative;top:-10px;padding-left:3px;"}
|
||||
déjà
|
||||
%br
|
||||
commandés
|
||||
%br
|
||||
depuis 2018
|
||||
});
|
||||
if(clock_max > 0){
|
||||
countup = setInterval(function() {
|
||||
clock.increment();
|
||||
if(clock.getTime().time >= clock_max) {
|
||||
clock.stop();
|
||||
clearInterval(countup);
|
||||
}
|
||||
}, 0);}
|
||||
%div{:style => "padding:10px 15px;display:inline-block;text-transform:uppercase;font-weight:bold;font-size:25px;line-height:30px;position:relative;top:-10px;padding-left:3px;"}
|
||||
déjà
|
||||
%br
|
||||
commandés
|
||||
%br
|
||||
depuis 2018
|
||||
|
||||
|
||||
:coffeescript
|
||||
@size_active = ->
|
||||
$(".product_size_link").removeClass("active")
|
||||
$("#product_size_link_"+ $("#product_size_id").val()).addClass("active")
|
||||
:javascript
|
||||
size_active();
|
||||
:coffeescript
|
||||
@size_active = ->
|
||||
$(".product_size_link").removeClass("active")
|
||||
$("#product_size_link_"+ $("#product_size_id").val()).addClass("active")
|
||||
:javascript
|
||||
size_active();
|
||||
|
||||
:coffeescript
|
||||
@option_active = ->
|
||||
$(".product_option_link").removeClass("active")
|
||||
$("#product_option_link_"+ $("#product_option_id").val()).addClass("active")
|
||||
:javascript
|
||||
option_active();
|
||||
:coffeescript
|
||||
@option_active = ->
|
||||
$(".product_option_link").removeClass("active")
|
||||
$("#product_option_link_"+ $("#product_option_id").val()).addClass("active")
|
||||
:javascript
|
||||
option_active();
|
||||
|
||||
:coffeescript
|
||||
@update_size_in_stocks =(ids) ->
|
||||
$(".product_size_link").removeClass("in_stock")
|
||||
$.each ids, (index, value) ->
|
||||
$("#product_size_link_"+ value).addClass("in_stock")
|
||||
$(".in_stock").first().click()
|
||||
:coffeescript
|
||||
@update_size_in_stocks =(ids) ->
|
||||
$(".product_size_link").removeClass("in_stock")
|
||||
$.each ids, (index, value) ->
|
||||
$("#product_size_link_"+ value).addClass("in_stock")
|
||||
$(".in_stock").first().click()
|
||||
|
||||
:javascript
|
||||
//update_size_in_stocks([1,2]);
|
||||
:javascript
|
||||
//update_size_in_stocks([1,2]);
|
||||
|
||||
:scss
|
||||
.product_sizes a{
|
||||
display:none;
|
||||
&.in_stock{
|
||||
display:inline-block;
|
||||
:scss
|
||||
.product_sizes a{
|
||||
display:none;
|
||||
&.in_stock{
|
||||
display:inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-else
|
||||
.no_stock
|
||||
Ce produit n'est plus en stock.
|
||||
-else
|
||||
.no_stock
|
||||
Ce produit n'est plus en stock.
|
@ -4,9 +4,9 @@
|
||||
|
||||
-if current_customer.account_validated?
|
||||
-if @reseaux and @reseaux.needs_enabled
|
||||
=link_to "Besoins spécifiques", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
|
||||
=link_to "Besoins exclusifs", public_needs_path(:type => 1), :class => ("active" if @needs and params[:type].to_i == 1)
|
||||
-if @reseaux and @reseaux.centrale_enabled
|
||||
=link_to "Centrale d'achats", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
|
||||
=link_to "Portail local", public_needs_path(:type => 2), :class => ("active" if @needs and params[:type].to_i == 2)
|
||||
|
||||
-if session[:reseaux_id].to_i > 0
|
||||
-if @reseaux and @reseaux.offres_enabled
|
||||
|
5
db/migrate/20190429095601_add_orderable_to_products.rb
Normal file
5
db/migrate/20190429095601_add_orderable_to_products.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddOrderableToProducts < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :products, :orderable, :boolean, :default => true
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user