From 232aef54e659df220ecc44a96c2dd4bea4313516 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Mon, 13 Apr 2020 21:39:09 +0200 Subject: [PATCH] suite --- app/assets/javascripts/public.js.coffee | 33 +++- app/assets/stylesheets/admin.scss | 19 ++ app/controllers/admin/qi_helps_controller.rb | 22 +++ app/models/m_odr_rep.rb | 49 +++++ app/views/admin/m_odr_files/_form.html.haml | 3 +- app/views/admin/m_odr_remises/show.html.haml | 20 +- app/views/admin/m_odr_reps/_form.html.haml | 5 +- .../admin/m_odr_reps/_left_column.html.haml | 11 ++ app/views/admin/m_odrs/_form.html.haml | 8 +- app/views/layouts/admin.html.haml | 25 +++ app/views/public/m_odrs/show.html.haml | 8 +- app/views/qi/_autocomplete.html.haml | 9 + app/views/qi/_qi_ordered_table.html.haml | 110 ++++++++++- app/views/qi/_qi_ordered_table.html.haml.old | 177 ++++++++++++++++++ .../qi/_qi_ordered_table_head.html.haml.old | 35 ++++ .../qi/_qi_ordered_table_object.html.haml | 28 ++- config/routes.rb | 3 + .../20200413164418_add_new_infos_to_m_odrs.rb | 7 + ...200413164941_add_buy_date_to_m_odr_reps.rb | 5 + db/schema.rb | 17 +- 20 files changed, 569 insertions(+), 25 deletions(-) create mode 100644 app/controllers/admin/qi_helps_controller.rb create mode 100644 app/views/qi/_autocomplete.html.haml create mode 100644 app/views/qi/_qi_ordered_table.html.haml.old create mode 100644 app/views/qi/_qi_ordered_table_head.html.haml.old create mode 100644 db/migrate/20200413164418_add_new_infos_to_m_odrs.rb create mode 100644 db/migrate/20200413164941_add_buy_date_to_m_odr_reps.rb diff --git a/app/assets/javascripts/public.js.coffee b/app/assets/javascripts/public.js.coffee index 5e61d3b..bf795c3 100644 --- a/app/assets/javascripts/public.js.coffee +++ b/app/assets/javascripts/public.js.coffee @@ -3,6 +3,10 @@ #= require jquery_ujs +#= require vendor/jquery-ui + +#= require bootstrap + #= require ./vendor/jquery.flexslider #= require ./vendor/markerclusterer @@ -17,10 +21,37 @@ #= require vendor/flipclock.js #= require vendor/jquery.cookiebar.js - #=require ./popover top = 20 + +$(document).ready -> + + $(document).on 'click', 'input.datepicker', -> + $(this).datetimepicker( + language: 'fr' + pickTime: false + ).focus(); + + $(document).on 'click', 'input.datetimepicker', -> + $(this).datetimepicker( + use24hours: true + format: 'DD/MM/YYYY HH:mm' + minuteStepping:15 + language: 'fr' + ).focus(); + + + $(document).on 'click', 'input.timepicker', -> + $(this).datetimepicker( + use24hours: true + format: 'DD/MM/YYYY hh:mm' + minuteStepping:15 + pickDate: false + language: 'fr' + ).focus(); + + @scroll_ajust = () -> var_scroll = $(window).scrollTop() diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 6abb457..677e444 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -1710,4 +1710,23 @@ td.numeraire{ box-sizing:border-box; } +} +.qi_side_padding{ + margin:0 20px; +} + +.qi_seg_header{ + margin:0 20px; + margin-bottom:-5px; + + h1,h2,h3{ + margin:0; + } + +} + +.right_actions{ + + float:right; + text-align:right; } \ No newline at end of file diff --git a/app/controllers/admin/qi_helps_controller.rb b/app/controllers/admin/qi_helps_controller.rb new file mode 100644 index 0000000..33a345f --- /dev/null +++ b/app/controllers/admin/qi_helps_controller.rb @@ -0,0 +1,22 @@ +# -*- encoding : utf-8 -*- + +class Admin::QiHelpsController < ApplicationController + + before_action :auth_admin + + layout "admin" + + + def update + if params[:enabled] + session[:qi_helps] = true + else + session[:qi_helps] = false + end + + redirect_back(fallback_location: "/admin") + + end + + +end diff --git a/app/models/m_odr_rep.rb b/app/models/m_odr_rep.rb index c7686e0..723b518 100644 --- a/app/models/m_odr_rep.rb +++ b/app/models/m_odr_rep.rb @@ -37,6 +37,8 @@ class MOdrRep < ApplicationRecord belongs_to :m_odr_tracker + + def reduc_code_needed? if self.m_odr.reduc_code_needed true @@ -105,6 +107,53 @@ file_admin_ok remise particular_civilite particular_name particular_firstname pa before_validation do + if self.m_odr.buy_date_needed + if !self.buy_at + errors.add(:buy_at, "doit être remplie") + + else + r = true + + if self.m_odr_product and self.m_odr_product.m_odr_brand and self.m_odr_product.m_odr_brand.start_at + start_at = self.m_odr_product.m_odr_brand.start_at + + else + start_at = self.m_odr.start_at + end + + if self.m_odr_product and self.m_odr_product.m_odr_brand and self.m_odr_product.m_odr_brand.end_at + end_at = self.m_odr_product.m_odr_brand.end_at + + else + end_at = self.m_odr.end_at + end + + if self.buy_at < start_at + r = false + errors.add(:buy_at, "est avant le début de l'opération") + end + + if self.buy_at > end_at + r = false + errors.add(:buy_at, "est après la fin de l'opération") + end + + + if !r + errors.add(:buy_at, "n'est pas valide") + + + else + + end + + + + end + + end + + if self.m_odr.reduc_code_needed and self.m_odr.m_odr_coupons.count > 0 and !self.m_odr.m_odr_coupons.where("name LIKE ?", self.reduc_code).first errors.add(:reduc_code, "n'existe pas") diff --git a/app/views/admin/m_odr_files/_form.html.haml b/app/views/admin/m_odr_files/_form.html.haml index c408b9f..e0461b5 100644 --- a/app/views/admin/m_odr_files/_form.html.haml +++ b/app/views/admin/m_odr_files/_form.html.haml @@ -1,5 +1,6 @@ =semantic_form_for [:admin, @m_odr_file], :remote => true do |f| - + -if current_admin.id == 1 + =debug f.object.errors.messages .content =f.inputs do = f.input :admin_ok, :label => "Décision :", :collection => [["Validé",true], ["Refusé", false]], :as => :select diff --git a/app/views/admin/m_odr_remises/show.html.haml b/app/views/admin/m_odr_remises/show.html.haml index 17bc5b7..0321b71 100644 --- a/app/views/admin/m_odr_remises/show.html.haml +++ b/app/views/admin/m_odr_remises/show.html.haml @@ -4,18 +4,26 @@ %span Détails de la remise - -.right=link_to ic(:download)+" Export XML", export_sepa_admin_m_odr_remise_path(@m_odr_remise), :class => "btn btn-primary" --if !@m_odr_remise.confirmed - =link_to ic(:envelope)+" Confirmer maintenant TOUS les virements", confirm_admin_m_odr_remise_path(@m_odr_remise) , :class => "btn btn-success" - à indiquer une fois que la banque à valider le fichier XML et exectué les virements +%br +.qi_side_padding + .right_actions + -if !@m_odr_remise.confirmed + =link_to ic(:envelope)+" Confirmer maintenant TOUS les virements", confirm_admin_m_odr_remise_path(@m_odr_remise) , :class => "btn btn-success" + .qi_help + à indiquer une fois que la banque à valider le fichier XML et exectué les virements + + + =link_to ic(:download)+" Export XML", export_sepa_admin_m_odr_remise_path(@m_odr_remise), :class => "btn btn-primary" + .clear .clear -Virements + +.qi_seg_header + %h3 Virements : .qi_row diff --git a/app/views/admin/m_odr_reps/_form.html.haml b/app/views/admin/m_odr_reps/_form.html.haml index 35e292d..c66e2ad 100644 --- a/app/views/admin/m_odr_reps/_form.html.haml +++ b/app/views/admin/m_odr_reps/_form.html.haml @@ -8,7 +8,10 @@ =# f.input :token, :label => "token :" =# f.input :m_odr, :label => "m_odr :" =# f.input :rgpd, :label => "rgpd :" - + + -if @m_odr_rep.m_odr.buy_date_process + =f.input :buy_at, :label => "Date d'achat :", :as => :date + =f.input :m_odr_product_id, :label => "Pneu :", :as => :select, :collection => f.object.m_odr.m_odr_products.order("m_odr_brand_id ASC, m_odr_products.name"), :member_label => :member_label, :include_blank => true diff --git a/app/views/admin/m_odr_reps/_left_column.html.haml b/app/views/admin/m_odr_reps/_left_column.html.haml index 0d9cb7c..15e49e0 100644 --- a/app/views/admin/m_odr_reps/_left_column.html.haml +++ b/app/views/admin/m_odr_reps/_left_column.html.haml @@ -14,6 +14,17 @@ %td Quantité %td =@m_odr_rep.qte + + %tr + %td Date d'achat + %td + =l @m_odr_rep.buy_at if @m_odr_rep.buy_at + + + + + + %table.table.table-striped.table-hover.table-bordered diff --git a/app/views/admin/m_odrs/_form.html.haml b/app/views/admin/m_odrs/_form.html.haml index 2e750db..e7d2b1a 100644 --- a/app/views/admin/m_odrs/_form.html.haml +++ b/app/views/admin/m_odrs/_form.html.haml @@ -11,7 +11,7 @@ = f.input :description, :label => "Description :" , :as => :text = f.input :landing_text, :label => "Texte lancement :" - + .row.qi_cancel_margins .col-sm-4 = f.input :start_at, :label => "Date de début :" , :as => :date @@ -45,6 +45,8 @@ = f.input :thank_title, :label => "Titre remerciement" = f.input :thank_text, :label => "Texte remerciement" + + = f.input :buy_infos, :label => "Texte info supplémentaire achats" .qi_row @@ -59,6 +61,10 @@ = f.input :email_needed, :label => "Obligatoire ?" = f.input :tel_process, :label => "Tel ?" = f.input :tel_needed, :label => "Obligatoire ?" + + = f.input :buy_date_process, :label => "Date achat ?" + = f.input :buy_date_needed, :label => "Obligatoire ?" + = f.input :reduc_code_process, :label => "Code de réduction ?" = f.input :reduc_code_needed, :label => "Obligatoire ?" diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index f7341aa..ca187cf 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -124,6 +124,31 @@ %ul.nav.navbar-nav.navbar-right + %li.qi_help_remove{:style => ("display:none" if !session[:qi_helps] )} + + =link_to ic(:"question-circle"), admin_qi_helps_path(), :onclick => '$(".qi_help").hide();$(".qi_help_add").show();$(".qi_help_remove").hide();', :remote => true + + + %li.qi_help_add{:style => ("display:none" if session[:qi_helps] )} + =link_to ic(:"question-circle-o"), admin_qi_helps_path(:enabled => true), :onclick => '$(".qi_help").show();$(".qi_help_add").hide();$(".qi_help_remove").show();', :remote => true + + + + -if session[:qi_helps] + :scss + .qi_help{ + display:inherit; + + } + -else + :scss + .qi_help{ + display:none; + + } + + + %li.dropdown %a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"} =current_admin.firstname diff --git a/app/views/public/m_odrs/show.html.haml b/app/views/public/m_odrs/show.html.haml index da27f1f..f1319ab 100644 --- a/app/views/public/m_odrs/show.html.haml +++ b/app/views/public/m_odrs/show.html.haml @@ -125,7 +125,10 @@ .form_pannel %h3 Votre achat - + -if @m_odr_rep.m_odr.buy_date_process + =f.input :buy_at, :label => "Date d'achat :", :as => :date + + -if f.object.m_odr.m_odr_product_cats.count > 0 =f.inputs do =f.input :m_odr_product_cat_id, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Types :")), :as => :select, :collection => f.object.m_odr.m_odr_product_cats.order("id ASC"), :member_label => :name, :include_blank => true, :prompt => (@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Nombre de pneus") @@ -151,6 +154,9 @@ -if @m_odr_rep.m_odr.confirm_case_needed =f.input :rgpd, :label => (@m_odr_rep.m_odr.confirm_case_label? ? @m_odr_rep.m_odr.confirm_case_label : "J'accepte les conditions générales") + + -if @m_odr_rep.m_odr.buy_infos? + .buy_infos{:style => "text-align:center"}=simple_format @m_odr_rep.m_odr.buy_infos %br %center=f.submit "Envoyer", :class => "btn btn-primary btn-lg" %br diff --git a/app/views/qi/_autocomplete.html.haml b/app/views/qi/_autocomplete.html.haml new file mode 100644 index 0000000..d180a6c --- /dev/null +++ b/app/views/qi/_autocomplete.html.haml @@ -0,0 +1,9 @@ +%div{:class => ("error has-error" if form.object.errors["#{field}_id".to_sym].size > 0 )} + %label=label + %input.p_fournisseur_autocomplete_input.form-control{:type => "text", :value => ("#{eval("form.object.#{field}.member_label")}" if eval("form.object.#{field}"))} + + + = form.hidden_field "#{field}_id".to_sym, :class => "#{field}_id" + =#=debug "#{form.object_name}[p_fournisseur_id]" + :javascript + qi_autocomplete('#{field}'); \ No newline at end of file diff --git a/app/views/qi/_qi_ordered_table.html.haml b/app/views/qi/_qi_ordered_table.html.haml index fcaa704..94f33ed 100644 --- a/app/views/qi/_qi_ordered_table.html.haml +++ b/app/views/qi/_qi_ordered_table.html.haml @@ -31,7 +31,6 @@ - %span.qi_ordered_table_column{:onclick => "$(this).next('.qi_ordered_table_sort_select_wrapper').toggle();"} =ic :columns @@ -63,7 +62,7 @@ -else =value %hr{:style => "margin:3px 0;"} - -if false + -if true Colonnes fixes : =select_tag "qi_sort_string[nbr_colonnes]", options_for_select([0,1,2,3], qi_ordered_table_nbr_col) @@ -85,9 +84,7 @@ } } - .freezeTable{ - overflow:auto; - } + .qi_ordered_table_sort_select_wrapper{ background:rgba(white, 0.98); box-shadow:0 0 10px rgba(0,0,0,0.2); @@ -137,7 +134,11 @@ .qi_pannel.padding.new_table_container - + .table-slider + .inner +
+ +
.table-area .table-area-inner @@ -172,8 +173,101 @@ .qi_pagination = paginate qi_ordered_table_collection #, :remote => true --if !@no_freezee + +:scss + + .freezeTable{ + overflow:auto; + } + + .table-slider{ + position:fixed; + bottom:0; + width:200px; + right:0; + z-index:2; + background:rgba(black,0.3); + padding:10px 20px; + padding-left:20px; + + border-radius:40px 0 0 0; + opacity:0.4; + &:hover{ + opacity:1; + background:rgba(black,0.7); + box-shadow:0 0 5px rgba(black,0.2); + } + } + + + + + +-if qi_ordered_table_nbr_col == 0.to_s + :javascript + resize(); + $('.freezeTable').freezeTable({fixedNavbar:'#qi_header_wrapper', freezeColumn: false}); + +-else :javascript resize(); $('.freezeTable').freezeTable({columnNum:#{qi_ordered_table_nbr_col},fixedNavbar:'#qi_header_wrapper'}); - \ No newline at end of file + + + + +:coffeescript + #mousemove + + + + lastScrollLeft = 0 + $(".freezeTable").scroll -> + #alert("t") + documentScrollLeft = $(this).scrollLeft() + + if (lastScrollLeft != documentScrollLeft) + + lastScrollLeft = documentScrollLeft + + size = ($(this).find(".table").outerWidth() - $(this).outerWidth()) + + value = ( $(this).scrollLeft() / size)*100 + + + $(this).closest(".new_table_container").find(".range").val(value) + + + + + + + $(".freezeTable").each -> + freeze = $(this) + + + + $("document").on "scroll", -> + if ($(this).scrollTop() < freeze.offset[0] + freeze.outerHeight()) + freeze.closest(".new_table_container").find(".table-slider").show() + + else + freeze.closest(".new_table_container").find(".table-slider").hide() + + + $(".range").on 'input change mousemove', -> + + freeze = $(this).closest(".new_table_container").find(".freezeTable") + + size = (freeze.find(".table").outerWidth() - freeze.outerWidth()) + + value = size*($(this).val() / 100) + + freeze.scrollLeft(value); + + + + + +=#1 + diff --git a/app/views/qi/_qi_ordered_table.html.haml.old b/app/views/qi/_qi_ordered_table.html.haml.old new file mode 100644 index 0000000..6105a21 --- /dev/null +++ b/app/views/qi/_qi_ordered_table.html.haml.old @@ -0,0 +1,177 @@ +-qi_ordered_table_name = qi_ordered_table_collection.klass.to_s.tableize + +-qi_ordered_table_model = qi_ordered_table_collection.klass + + + +=render :partial => "qi/qi_ordered_table_head", :locals => {:qi_ordered_table_name => qi_ordered_table_name, :qi_ordered_table_model => qi_ordered_table_model} + + +-@qi_table_orders = @qi_table_orders || {} + +-if current_admin + + -if ap = current_admin.admin_preferences.where(:key => "sort_table_"+qi_ordered_table_name).first + -qi_ordered_table_personalised = ap.value + + + -if ap = current_admin.admin_preferences.where(:key => "sort_table_"+qi_ordered_table_name+"_nbr_col").first + -qi_ordered_table_nbr_col = ap.value + -else + -qi_ordered_table_nbr_col = 1 + + + +-else + -qi_ordered_table_personalised = session[:qi_sort_string][qi_ordered_table_name] + + -qi_ordered_table_nbr_col = session[:qi_sort_string][qi_ordered_table_name+"_nbr_col"] || 1 + + + + + + +%span.qi_ordered_table_column{:onclick => "$(this).next('.qi_ordered_table_sort_select_wrapper').toggle();"} + =ic :columns + + +.qi_ordered_table_sort_select_wrapper{:style => "display:none;"} + =form_tag request.url, :method => "get", :onsubmit => "", :remote => false do + + + =hidden_field_tag "qi_sort_string[class]",qi_ordered_table_name + + =hidden_field_tag "qi_sort_string[list]", "", :class => "qi_sort_string" + .qi_ordered_table_sort_select + + -my_keys = [] + -@qi_table_orders[qi_ordered_table_name.to_sym].each do |key, value| + .qi_order_item{:"data-ref" => "#{key}", :class => "active", :onclick => "$(this).toggleClass('active');"} + -if value.instance_of? Hash + =value[:name] + -else + =value + -my_keys << key + + + -qi_ordered_table_collection.klass.qi_table_order.each do |key, value| + -if !my_keys.include?(key) + .qi_order_item{:"data-ref" => "#{key}", :onclick => "$(this).toggleClass('active');"} + -if value.instance_of? Hash + =value[:name] + -else + =value + %hr{:style => "margin:3px 0;"} + -if false + Colonnes fixes : + =select_tag "qi_sort_string[nbr_colonnes]", options_for_select([0,1,2,3], qi_ordered_table_nbr_col) + + + =link_to "Mettre à jour", "#", :class => "btn btn-primary update_table_order_link" + + +:scss + .qi_ordered_table_column{ + position:absolute; + color:rgba(0,0,0,0.2); + font-size:1.2em; + padding-top:3px; + padding-left:10px; + cursor:pointer; + + &:hover{ + color:rgba(0,0,0,0.6); + } + + } + + .qi_ordered_table_sort_select_wrapper{ + background:rgba(white, 0.98); + box-shadow:0 0 10px rgba(0,0,0,0.2); + width:auto; + position:absolute; + margin-left:15px; + margin-top:25px; + z-index:5; + padding:5px 10px; + .qi_order_item{ + padding:2px 0; + cursor:pointer; + + } + .active{ + font-weight:bold; + } + } + +:coffeescript + $(".update_table_order_link").click -> + r = [] + $(this).closest('.qi_ordered_table_sort_select_wrapper').find(".qi_order_item").each -> + if $(this).hasClass("active") + r.push $(this).data("ref") + + + $(this).closest("form").find(".qi_sort_string").val(r.join(',')) + $.ajax + type: "GET", + url: "/", + data: $(this).closest("form").serialize(), + success: -> + location.reload() + + + + + + + + $( ".qi_ordered_table_sort_select" ).sortable + axis: "y" + + + + + +.qi_pannel.padding.new_table_container + + .table-area + .table-area-inner + + + .freezeTable + %table.table.table-striped.table-hover.table-bordered.data_table + %thead.header + %tr + -@qi_table_orders[qi_ordered_table_name.to_sym].each do |key, value| + -if value.instance_of? Hash + -if value[:reorder] + -sort_name = value[:sort_name] ? value[:sort_name] : key + + %th=raw sort_link sort_name.to_s, value[:name] + -else + %th=raw value[:name] + + -else + %th=raw value + + + =#sort_link "code", "Code" + + + -if false + %th + + + %tbody{:id => "#{qi_ordered_table_name}_rows"} + =render qi_ordered_table_collection + + + .qi_pagination + = paginate qi_ordered_table_collection #, :remote => true + +:javascript + resize(); + $('.freezeTable').freezeTable({columnNum:#{qi_ordered_table_nbr_col},fixedNavbar:'#qi_header_wrapper'}); + \ No newline at end of file diff --git a/app/views/qi/_qi_ordered_table_head.html.haml.old b/app/views/qi/_qi_ordered_table_head.html.haml.old new file mode 100644 index 0000000..80da8d8 --- /dev/null +++ b/app/views/qi/_qi_ordered_table_head.html.haml.old @@ -0,0 +1,35 @@ + + +-@qi_table_orders = @qi_table_orders || {} + +-if current_admin + + -if ap = current_admin.admin_preferences.where(:key => "sort_table_"+qi_ordered_table_name).first + -qi_ordered_table_personalised = ap.value + + + -if ap = current_admin.admin_preferences.where(:key => "sort_table_"+qi_ordered_table_name+"_nbr_col").first + -qi_ordered_table_nbr_col = ap.value + -else + -qi_ordered_table_nbr_col = 1 + + + +-else + -qi_ordered_table_personalised = session[:qi_sort_string][qi_ordered_table_name] + + -qi_ordered_table_nbr_col = session[:qi_sort_string][qi_ordered_table_name+"_nbr_col"] || 1 + + + + +-if qi_ordered_table_personalised.to_s != "" + -@qi_table_orders[qi_ordered_table_name.to_sym] = {} + + -qi_ordered_table_personalised.split(",").each do |k| + -if qi_ordered_table_model.qi_table_order[k.to_sym] + + -@qi_table_orders[qi_ordered_table_name.to_sym][k.to_sym] = qi_ordered_table_model.qi_table_order[k.to_sym] + +-else + -@qi_table_orders[qi_ordered_table_name.to_sym] = qi_ordered_table_model.qi_table_order diff --git a/app/views/qi/_qi_ordered_table_object.html.haml b/app/views/qi/_qi_ordered_table_object.html.haml index 71ec7e4..15e39b6 100644 --- a/app/views/qi/_qi_ordered_table_object.html.haml +++ b/app/views/qi/_qi_ordered_table_object.html.haml @@ -11,11 +11,31 @@ -@qi_table_orders[qi_ordered_table_name.to_sym].each do |key,value| -if tr[:"#{key}"] =raw tr[:"#{key}"] - -elsif object.respond_to?(key.to_s) - %td - =#eval("#{qi_ordered_table_name.singularize}.send('#{key}')") - =object.send(key.to_s) + + -elsif object.respond_to?("tr_"+key.to_s) or object.respond_to?(key.to_s) + -if object.respond_to?("tr_"+key.to_s) + -v =object.send("tr_"+key.to_s) + + -elsif object.respond_to?(key.to_s) + -v = object.send(key.to_s) + + + -if value.instance_of? Hash and value[:format] + + -if value[:format] == :date + %td=l v, :format => :short_date + -elsif value[:format] == :boolean + %td="Oui" if v + + -elsif value[:format] == :currency + %td.numeraire=number_to_currency v + + -else + %td= v + -else + %td=v + -else %td Err : diff --git a/config/routes.rb b/config/routes.rb index 88cd83d..61e547f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,8 @@ Rails.application.routes.draw do + get "qi_help" => "admin/qi_helps#update", :as => :admin_qi_helps + + namespace :admin do resources :m_odr_product_cats do member do diff --git a/db/migrate/20200413164418_add_new_infos_to_m_odrs.rb b/db/migrate/20200413164418_add_new_infos_to_m_odrs.rb new file mode 100644 index 0000000..5cd88dd --- /dev/null +++ b/db/migrate/20200413164418_add_new_infos_to_m_odrs.rb @@ -0,0 +1,7 @@ +class AddNewInfosToMOdrs < ActiveRecord::Migration[6.0] + def change + add_column :m_odrs, :buy_date_process, :boolean + add_column :m_odrs, :buy_date_needed, :boolean + add_column :m_odrs, :buy_infos, :text + end +end diff --git a/db/migrate/20200413164941_add_buy_date_to_m_odr_reps.rb b/db/migrate/20200413164941_add_buy_date_to_m_odr_reps.rb new file mode 100644 index 0000000..a761fe9 --- /dev/null +++ b/db/migrate/20200413164941_add_buy_date_to_m_odr_reps.rb @@ -0,0 +1,5 @@ +class AddBuyDateToMOdrReps < ActiveRecord::Migration[6.0] + def change + add_column :m_odr_reps, :buy_at, :date + end +end diff --git a/db/schema.rb b/db/schema.rb index 06615c6..c15a149 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_04_01_115523) do +ActiveRecord::Schema.define(version: 2020_04_13_164941) do create_table "accounting_zones", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| t.string "name" @@ -29,7 +29,7 @@ ActiveRecord::Schema.define(version: 2020_04_01_115523) do t.index ["admin_role_id"], name: "index_admin_admin_roles_on_admin_role_id" end - create_table "admin_p_customers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + create_table "admin_p_customers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC", force: :cascade do |t| t.bigint "admin_id" t.bigint "p_customer_id" t.datetime "created_at", precision: 6, null: false @@ -596,6 +596,14 @@ ActiveRecord::Schema.define(version: 2020_04_01_115523) do t.index ["m_odr_id"], name: "index_m_odr_brands_on_m_odr_id" end + create_table "m_odr_coupons", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t| + t.string "name" + t.bigint "m_odr_id" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["m_odr_id"], name: "index_m_odr_coupons_on_m_odr_id" + end + create_table "m_odr_file_types", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC", force: :cascade do |t| t.string "name" t.boolean "need_file" @@ -772,6 +780,7 @@ ActiveRecord::Schema.define(version: 2020_04_01_115523) do t.boolean "ac_admin_ok_to_send", default: false t.bigint "m_odr_product_cat_id" t.string "reduc_code" + t.date "buy_at" t.index ["m_odr_id"], name: "index_m_odr_reps_on_m_odr_id" t.index ["m_odr_place_id"], name: "index_m_odr_reps_on_m_odr_place_id" t.index ["m_odr_product_cat_id"], name: "index_m_odr_reps_on_m_odr_product_cat_id" @@ -886,6 +895,9 @@ ActiveRecord::Schema.define(version: 2020_04_01_115523) do t.boolean "reduc_code_process", default: false t.boolean "reduc_code_needed", default: false t.integer "reduc_code_lenght" + t.boolean "buy_date_process" + t.boolean "buy_date_needed" + t.text "buy_infos" t.index ["p_customer_id"], name: "index_m_odrs_on_p_customer_id" end @@ -2582,6 +2594,7 @@ ActiveRecord::Schema.define(version: 2020_04_01_115523) do add_foreign_key "i_tasks", "admins" add_foreign_key "i_tasks", "i_task_projects" add_foreign_key "m_odr_brands", "m_odrs" + add_foreign_key "m_odr_coupons", "m_odrs" add_foreign_key "m_odr_file_types", "m_odrs" add_foreign_key "m_odr_files", "m_odr_reps" add_foreign_key "m_odr_places", "m_odrs"