diverses modifs mineures
This commit is contained in:
parent
dbcab11c01
commit
e6260010a4
@ -79,8 +79,12 @@ class Admin::MEventsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@m_event = MEvent.new(:m_event_type_title => "Roulage libre")
|
|
||||||
|
if params[:parent_id]
|
||||||
|
@m_event = MEvent.find(params[:parent_id]).dup
|
||||||
|
else
|
||||||
|
@m_event = MEvent.new(:m_event_type_title => "Roulage libre")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@ -120,4 +124,14 @@ class Admin::MEventsController < ApplicationController
|
|||||||
@m_event.destroy
|
@m_event.destroy
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def autocomplete
|
||||||
|
|
||||||
|
@m_events = MEvent.order("start_at").where("start_at <= ? and end_at >= ?", Date.parse(params[:date]), Date.parse(params[:date]))
|
||||||
|
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.json { render json: @m_events.map{|me| {:id => me.id, :member_label => me.member_label}} }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,13 @@ class Admin::MOdrFilesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@m_odr_files = MOdrFile.all
|
@m_odr_files = MOdrFile.joins(:p_customer).all
|
||||||
|
|
||||||
|
|
||||||
|
if params[:search][:name].to_s != ""
|
||||||
|
|
||||||
|
@m_odr_files = @m_odr_files.joins(:particular).where("particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%")
|
||||||
|
end
|
||||||
|
|
||||||
@m_odr_files = sort_by_sorting(@m_odr_files, "id DESC")
|
@m_odr_files = sort_by_sorting(@m_odr_files, "id DESC")
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -11,8 +11,18 @@ class Admin::MOdrPrimesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@m_odr_primes = MOdrPrime.joins(:p_customer).all
|
@m_odr_primes = MOdrPrime.joins(:p_customer).joins(:m_odr_file_roulage).all
|
||||||
|
|
||||||
|
if params[:search][:state].to_s != ""
|
||||||
|
@m_odr_primes = @m_odr_primes.where(:state => params[:search][:state])
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:search][:name].to_s != ""
|
||||||
|
|
||||||
|
@m_odr_primes = @m_odr_primes.joins(:particular).where("particulars.organisation LIKE ? or particulars.name LIKE ? or particulars.firstname LIKE ?", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%", "%#{params[:search][:name]}%")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
@m_odr_primes = sort_by_sorting(@m_odr_primes, "id DESC")
|
@m_odr_primes = sort_by_sorting(@m_odr_primes, "id DESC")
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{
|
format.html{
|
||||||
|
@ -22,7 +22,7 @@ class MEvent < ApplicationRecord
|
|||||||
belongs_to :image_file
|
belongs_to :image_file
|
||||||
|
|
||||||
def member_label
|
def member_label
|
||||||
self.start_at.to_date.to_s+" - "+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s
|
self.start_at.to_date.to_s+" - "+(self.end_at.to_date.to_s+" - " if self.start_at.to_date != self.end_at.to_date).to_s+self.title.to_s+" - "+(self.organisateur.name if self.organisateur).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ class MOdrFile < ApplicationRecord
|
|||||||
belongs_to :m_odr_place
|
belongs_to :m_odr_place
|
||||||
belongs_to :m_event
|
belongs_to :m_event
|
||||||
|
|
||||||
|
has_one :particular, :through => :p_customer
|
||||||
|
|
||||||
has_many :mail_hists
|
has_many :mail_hists
|
||||||
|
|
||||||
has_many :m_odr_file_products, :dependent => :destroy
|
has_many :m_odr_file_products, :dependent => :destroy
|
||||||
@ -104,7 +106,7 @@ class MOdrFile < ApplicationRecord
|
|||||||
acts_as_sorting :fields => {
|
acts_as_sorting :fields => {
|
||||||
:id => {:name => "Id", :reorder => true},
|
:id => {:name => "Id", :reorder => true},
|
||||||
:created_at => {:name => "Date de téléchargement", :reorder => true},
|
:created_at => {:name => "Date de téléchargement", :reorder => true},
|
||||||
:p_customer => {:name => "Utilisateur"},
|
:p_customer => {:name => "Utilisateur", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
||||||
:m_odr_file_type => {:name => "Type de document"},
|
:m_odr_file_type => {:name => "Type de document"},
|
||||||
:admin_ok => {:name => "Décision", :reorder => true},
|
:admin_ok => {:name => "Décision", :reorder => true},
|
||||||
:reject_reason => {:name => "Raison du rejet", :reorder => true},
|
:reject_reason => {:name => "Raison du rejet", :reorder => true},
|
||||||
|
@ -2,6 +2,7 @@ class MOdrPrime < ApplicationRecord
|
|||||||
belongs_to :p_customer
|
belongs_to :p_customer
|
||||||
belongs_to :m_odr_file_roulage
|
belongs_to :m_odr_file_roulage
|
||||||
|
|
||||||
|
has_one :particular, :through => :p_customer
|
||||||
|
|
||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
include ActionView::Helpers::TranslationHelper
|
include ActionView::Helpers::TranslationHelper
|
||||||
@ -15,6 +16,8 @@ class MOdrPrime < ApplicationRecord
|
|||||||
acts_as_sorting :fields => {
|
acts_as_sorting :fields => {
|
||||||
:id => {:name => "Id", :reorder => true},
|
:id => {:name => "Id", :reorder => true},
|
||||||
:p_customer => {:name => "Client", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
:p_customer => {:name => "Client", :reorder => true, :sort_name => "p_customers.cc_show_name"},
|
||||||
|
|
||||||
|
:date_roulage => {:name => "Date de roulage", :reorder => true, :sort_name => "m_odr_file_roulages.date"},
|
||||||
:state => {:name => "Statut", :reorder => true},
|
:state => {:name => "Statut", :reorder => true},
|
||||||
:amount => {:name => "Montant"},
|
:amount => {:name => "Montant"},
|
||||||
:actions => {:name => "Actions", :reorder => true},
|
:actions => {:name => "Actions", :reorder => true},
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
=render :partial => "qi/autocomplete", :locals => {:form => f, :field => :organisateur, :label => "Organisateur :"}
|
=render :partial => "qi/autocomplete", :locals => {:form => f, :field => :organisateur, :label => "Organisateur :"}
|
||||||
|
|
||||||
=# f.input :organisateur, :label => "Organisateur :", :member_label => :member_label, :collection => Organisateur.order("name").all
|
=# f.input :organisateur, :label => "Organisateur :", :member_label => :member_label, :collection => Organisateur.order("name").all
|
||||||
= f.input :start_at, :label => "Date de début :", :as => :date
|
= f.input :start_at, :label => "Date de début :", :as => :date, :input_html => {:id => "start_at_input"}
|
||||||
= f.input :end_at, :label => "Date de fin :" , :as => :date
|
= f.input :end_at, :label => "Date de fin :" , :as => :date, :input_html => {:id => "end_at_input"}
|
||||||
= f.input :title, :label => "Titre :"
|
= f.input :title, :label => "Titre :"
|
||||||
= f.input :link, :label => "Lien réservation :"
|
= f.input :link, :label => "Lien réservation :"
|
||||||
= f.input :description, :label => "Description :" , :input_html => {:class => "redactor_textarea"}
|
= f.input :description, :label => "Description :" , :input_html => {:class => "redactor_textarea"}
|
||||||
@ -27,6 +27,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:coffeescript
|
||||||
|
$("#start_at_input").focusout ->
|
||||||
|
if $("#end_at_input").val() == ""
|
||||||
|
$("#end_at_input").val($(this).val())
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(".redactor_textarea").redactor({
|
$(".redactor_textarea").redactor({
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
-tr[:actions] = capture do
|
-tr[:actions] = capture do
|
||||||
%td.actions
|
%td.actions
|
||||||
|
=link_to i(:copy), new_admin_m_event_path(:parent_id => m_event.id), :remote => true
|
||||||
|
|
||||||
= link_to i(:"trash-o"), [:admin, m_event], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
= link_to i(:"trash-o"), [:admin, m_event], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
|
||||||
= link_to i(:pencil), edit_admin_m_event_path(m_event), :remote => true
|
= link_to i(:pencil), edit_admin_m_event_path(m_event), :remote => true
|
||||||
= link_to i(:eye), admin_m_event_path(m_event), :remote => true
|
= link_to i(:eye), admin_m_event_path(m_event), :remote => true
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
%tr.m_odr_file_roulage_form.field
|
%tr.m_odr_file_roulage_form.field
|
||||||
%td= form.input :date, :label => "date :" , :as => :date
|
%td= form.input :date, :label => "date :" , :as => :date, :input_html => {:id => "roulage_date_input"}
|
||||||
|
|
||||||
-if form.object.date?
|
-if form.object.date?
|
||||||
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.order("start_at").where("start_at <= ? and end_at >= ?", form.object.date, form.object.date).all, :member_label => :member_label, :as => :select
|
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.order("start_at").where("start_at <= ? and end_at >= ?", form.object.date, form.object.date).all, :member_label => :member_label, :as => :select, :input_html => {:id => "select_date_input"}
|
||||||
|
|
||||||
-else
|
-else
|
||||||
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select
|
%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => [], :member_label => :member_label, :as => :select, :input_html => {:id => "select_date_input"}
|
||||||
|
=#%td= form.input :m_event_id, :label => "Journée de roulage :", :as => :date, :collection => MEvent.all, :member_label => :member_label, :as => :select
|
||||||
|
|
||||||
|
|
||||||
%td.actions=link_to_remove_fields ic(:"trash-o"), form
|
%td.actions=link_to_remove_fields ic(:"trash-o"), form
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:coffeescript
|
||||||
|
$('#roulage_date_input').change ->
|
||||||
|
$.getJSON "/admin/m_events/autocomplete.json?date="+$(this).val(), (data) ->
|
||||||
|
|
||||||
|
$("#select_date_input").html('')
|
||||||
|
$.each data, ->
|
||||||
|
$("#select_date_input").append '<option value="' + @id + '">' + @member_label + '</option>'
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
-params[:search] =params[:search] || {}
|
-params[:search] =params[:search] || {}
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td=text_field_tag "search[name]", params[:search][:name],:class => "form-control", :placeholder => "Nom"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_files}
|
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_files}
|
||||||
|
@ -9,6 +9,12 @@
|
|||||||
%td
|
%td
|
||||||
=state_helper(m_odr_prime.state)
|
=state_helper(m_odr_prime.state)
|
||||||
|
|
||||||
|
-tr[:date_roulage] = capture do
|
||||||
|
%td
|
||||||
|
=l m_odr_prime.m_odr_file_roulage.date if m_odr_prime.m_odr_file_roulage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-tr[:actions] = capture do
|
-tr[:actions] = capture do
|
||||||
%td.actions
|
%td.actions
|
||||||
|
@ -10,8 +10,21 @@
|
|||||||
.qi_search_row
|
.qi_search_row
|
||||||
=form_tag "", :method => "get", :onsubmit => "" do
|
=form_tag "", :method => "get", :onsubmit => "" do
|
||||||
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_primes}
|
=render :partial => "qi/qi_ordered_table_search_footer", :locals => {:collection_object => @m_odr_primes}
|
||||||
|
-params[:search] =params[:search] || {}
|
||||||
|
|
||||||
|
%table
|
||||||
|
%tr
|
||||||
|
%td=text_field_tag "search[name]", params[:search][:name],:class => "form-control", :placeholder => "Nom"
|
||||||
|
|
||||||
|
%td
|
||||||
|
Statut :
|
||||||
|
=select_tag "search[state]", options_for_select([["",""]]+MOdrPrime.group(:state).order(:state).all.map{|a| [a.state, a.state]}, params[:search][:state])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @m_odr_primes}
|
||||||
|
|
||||||
|
|
||||||
@ -22,8 +35,8 @@
|
|||||||
-if true
|
-if true
|
||||||
-#MOdrPrime.reset_primes
|
-#MOdrPrime.reset_primes
|
||||||
|
|
||||||
-PCustomer.all.each do |p_customer|
|
-#PCustomer.all.each do |p_customer|
|
||||||
-p_customer.generate_prime
|
-#p_customer.generate_prime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
|
get :autocomplete
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user