suite
This commit is contained in:
parent
29b3d883f3
commit
492e15481a
74
app/controllers/admin/m_odr_product_cats_controller.rb
Normal file
74
app/controllers/admin/m_odr_product_cats_controller.rb
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
|
||||||
|
class Admin::MOdrProductCatsController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
before_action :auth_admin
|
||||||
|
|
||||||
|
before_action :admin_space
|
||||||
|
|
||||||
|
def admin_space
|
||||||
|
@admin_space = "default"
|
||||||
|
end
|
||||||
|
|
||||||
|
def index
|
||||||
|
@m_odr_product_cats = MOdrProductCat.all
|
||||||
|
|
||||||
|
@m_odr_product_cats = sort_by_sorting(@m_odr_product_cats, "created_at DESC")
|
||||||
|
|
||||||
|
|
||||||
|
params[:search][:per_page] = params[:search][:per_page] || 50
|
||||||
|
per_page = params[:search][:per_page]
|
||||||
|
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||||
|
@m_odr_product_cats = @m_odr_product_cats.page(page).per(per_page)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@m_odr_product_cat = MOdrProductCat.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@m_odr_product_cat = MOdrProductCat.new
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@m_odr_product_cat = MOdrProductCat.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@m_odr_product_cat = MOdrProductCat.new(params.require(:m_odr_product_cat).permit!)
|
||||||
|
|
||||||
|
if @m_odr_product_cat.save
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "new"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def update
|
||||||
|
@m_odr_product_cat = MOdrProductCat.find(params[:id])
|
||||||
|
|
||||||
|
|
||||||
|
if @m_odr_product_cat.update_attributes(params.require(:m_odr_product_cat).permit!)
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "edit"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@m_odr_product_cat = MOdrProductCat.find(params[:id])
|
||||||
|
@m_odr_product_cat.destroy
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
3
app/models/m_odr_product_cat.rb
Normal file
3
app/models/m_odr_product_cat.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
class MOdrProductCat < ApplicationRecord
|
||||||
|
belongs_to :m_odr
|
||||||
|
end
|
7
app/views/admin/m_odr_product_cats/_form.html.haml
Normal file
7
app/views/admin/m_odr_product_cats/_form.html.haml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.m_odr_product_cat_form.field
|
||||||
|
|
||||||
|
= form.input :name, :label => "Nom :"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=link_to_remove_fields ic(:"trash-o"), form
|
@ -0,0 +1,13 @@
|
|||||||
|
%tr#m_odr_product_cat_row{:id => m_odr_product_cat.id}
|
||||||
|
-tr = {}
|
||||||
|
|
||||||
|
-tr[:actions] = capture do
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:"trash-o"), [:admin, m_odr_product_cat], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||||
|
= link_to i(:pencil), edit_admin_m_odr_product_cat_path(m_odr_product_cat), :remote => true
|
||||||
|
= link_to i(:eye), admin_m_odr_product_cat_path(m_odr_product_cat), :remote => true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => m_odr_product_cat}
|
2
app/views/admin/m_odr_product_cats/create.js.erb
Normal file
2
app/views/admin/m_odr_product_cats/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#m_odr_product_cats_rows').prepend("<%= escape_javascript(render(@m_odr_product_cat))%>");
|
||||||
|
close_pane_hover();
|
1
app/views/admin/m_odr_product_cats/destroy.js.erb
Normal file
1
app/views/admin/m_odr_product_cats/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#m_odr_product_cat_<%= @m_odr_product_cat.id %>').remove();
|
1
app/views/admin/m_odr_product_cats/edit.js.erb
Normal file
1
app/views/admin/m_odr_product_cats/edit.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
20
app/views/admin/m_odr_product_cats/index.html.haml
Normal file
20
app/views/admin/m_odr_product_cats/index.html.haml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
.qi_header
|
||||||
|
.right= link_to 'Ajouter ', new_admin_m_odr_product_cat_path(), :class => "btn btn-primary", :remote => true
|
||||||
|
%h1
|
||||||
|
|
||||||
|
%span
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_search_row
|
||||||
|
=form_tag "", :method => "get", :onsubmit => "" do
|
||||||
|
-params[:search] =params[:search] || {}
|
||||||
|
%table
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_product_cats}
|
||||||
|
|
||||||
|
|
||||||
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_product_cats}
|
1
app/views/admin/m_odr_product_cats/new.js.erb
Normal file
1
app/views/admin/m_odr_product_cats/new.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/m_odr_product_cats/show.html.haml
Normal file
10
app/views/admin/m_odr_product_cats/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.qi_header
|
||||||
|
%h1
|
||||||
|
|
||||||
|
%span
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
=debug @m_odr_product_cat
|
2
app/views/admin/m_odr_product_cats/update.js.erb
Normal file
2
app/views/admin/m_odr_product_cats/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#m_odr_product_cat_row_<%= @m_odr_product_cat.id %>').replaceWith("<%= escape_javascript(render(@m_odr_product_cat))%>");
|
||||||
|
close_pane_hover();
|
@ -141,7 +141,7 @@
|
|||||||
|
|
||||||
-if @m_odr_rep.state == "Refusée"
|
-if @m_odr_rep.state == "Refusée"
|
||||||
.red Offre refusée :
|
.red Offre refusée :
|
||||||
-[["achat-hors-delais", "Achat hors délais"],["facture-illisible", "Facture illisible"],["pneus-non-porteurs-de-l-offre", "Pneus invalides"]].each do |key|
|
-[["achat-hors-delais", "Achat hors délais"],["facture-illisible", "Facture illisible"],["pneus-non-porteurs-de-l-offre", "Pneus invalides"],["dossier-deja-enregistre", "Dossier déjà enregistré"]].each do |key|
|
||||||
%br
|
%br
|
||||||
=link_to " Envoyer un mail de notification : #{key[1]}", send_mail_admin_m_odr_rep_path(@m_odr_rep, :slug => key[0]), :remote => false
|
=link_to " Envoyer un mail de notification : #{key[1]}", send_mail_admin_m_odr_rep_path(@m_odr_rep, :slug => key[0]), :remote => false
|
||||||
|
|
||||||
|
@ -55,7 +55,41 @@
|
|||||||
|
|
||||||
= f.input :thank_text, :label => "Texte remerciement"
|
= f.input :thank_text, :label => "Texte remerciement"
|
||||||
|
|
||||||
=render :partial => "admin/shared/social_form", :locals => {:f => f}
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
%h3 Données récupérées :
|
||||||
|
|
||||||
|
= f.input :address_process, :label => "Adresse postale ?"
|
||||||
|
= f.input :address_needed, :label => "Obligatoire ?"
|
||||||
|
= f.input :rib_process, :label => "RIB ?"
|
||||||
|
= f.input :rib_needed, :label => " Obligatoire ?"
|
||||||
|
= f.input :email_process, :label => "Email ?"
|
||||||
|
= f.input :email_needed, :label => "Obligatoire ?"
|
||||||
|
= f.input :tel_process, :label => "Tel ?"
|
||||||
|
= f.input :tel_needed, :label => "Obligatoire ?"
|
||||||
|
= f.input :confirm_case_needed, :label => "Case de confirmation obligatoire ?"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
= f.input :placeholder, :label => "Afficher les libellés ?"
|
||||||
|
= f.input :name_label, :label => "Label nom :"
|
||||||
|
= f.input :firstname_label, :label => "Label prénom :"
|
||||||
|
= f.input :confirm_case_label, :label => "Label case de confirmation :"
|
||||||
|
= f.input :product_cat_label, :label => "Label catégorie produit :"
|
||||||
|
= f.input :product_label, :label => "Label produit :"
|
||||||
|
= f.input :qte_label, :label => "Label quantité :"
|
||||||
|
= f.input :place_label, :label => "Label lieu de vente :"
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
=render :partial => "admin/shared/social_form", :locals => {:f => f}
|
||||||
|
|
||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding
|
||||||
@ -87,6 +121,18 @@
|
|||||||
|
|
||||||
%p= link_to_add_fields ic(:plus)+" Ajouter ue marque", f, :m_odr_brands
|
%p= link_to_add_fields ic(:plus)+" Ajouter ue marque", f, :m_odr_brands
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
Catégories produits :
|
||||||
|
%hr
|
||||||
|
|
||||||
|
.m_odr_product_cats_form
|
||||||
|
=f.semantic_fields_for :m_odr_product_cats do |form|
|
||||||
|
=render :partial => "admin/m_odr_product_cats/form", :locals => {:form => form}
|
||||||
|
|
||||||
|
%p= link_to_add_fields ic(:plus)+" Ajouter une catégorie", f, :m_odr_product_cats
|
||||||
|
|
||||||
|
|
||||||
.qi_row
|
.qi_row
|
||||||
.qi_pannel.qi_plain.padding
|
.qi_pannel.qi_plain.padding
|
||||||
Produits concernés :
|
Produits concernés :
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
=link_to admin_file_tunels_path do
|
=link_to admin_file_tunels_path do
|
||||||
.cat#big_cat_tournees
|
.cat#big_cat_tournees
|
||||||
=ic :"lock"
|
=ic :"lock"
|
||||||
Tunels fichier sécurisés
|
Tunnels fichier sécurisés
|
||||||
|
|
||||||
|
|
||||||
-if false
|
-if false
|
||||||
|
10
db/migrate/20200307102313_create_m_odr_product_cats.rb
Normal file
10
db/migrate/20200307102313_create_m_odr_product_cats.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CreateMOdrProductCats < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
create_table :m_odr_product_cats do |t|
|
||||||
|
t.references :m_odr, foreign_key: true
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddMOdrProductCatToMOdrRep < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_reference :m_odr_reps, :m_odr_product_cat, foreign_key: true
|
||||||
|
end
|
||||||
|
end
|
17
db/migrate/20200307104157_add_prefs_to_m_odrs.rb
Normal file
17
db/migrate/20200307104157_add_prefs_to_m_odrs.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
class AddPrefsToMOdrs < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :m_odrs, :name_label, :string
|
||||||
|
add_column :m_odrs, :firstname_label, :string
|
||||||
|
add_column :m_odrs, :placeholder, :boolean, :default => false
|
||||||
|
add_column :m_odrs, :email_process, :boolean, :default => true
|
||||||
|
add_column :m_odrs, :tel_process, :boolean, :default => true
|
||||||
|
add_column :m_odrs, :rib_needed, :boolean, :default => true
|
||||||
|
add_column :m_odrs, :address_needed, :boolean, :default => true
|
||||||
|
add_column :m_odrs, :confirm_case_needed, :boolean, :default => false
|
||||||
|
add_column :m_odrs, :confirm_case_label, :string, :default => false
|
||||||
|
add_column :m_odrs, :product_cat_label, :string
|
||||||
|
add_column :m_odrs, :product_label, :string
|
||||||
|
add_column :m_odrs, :qte_label, :string
|
||||||
|
add_column :m_odrs, :place_label, :string
|
||||||
|
end
|
||||||
|
end
|
9
test/fixtures/m_odr_product_cats.yml
vendored
Normal file
9
test/fixtures/m_odr_product_cats.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
m_odr: one
|
||||||
|
name: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
m_odr: two
|
||||||
|
name: MyString
|
7
test/models/m_odr_product_cat_test.rb
Normal file
7
test/models/m_odr_product_cat_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class MOdrProductCatTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user