suite
This commit is contained in:
parent
f525442d8a
commit
0bb1993bdd
@ -231,11 +231,14 @@ $(window).on 'beforeunload', ->
|
|||||||
$(document).ready ->
|
$(document).ready ->
|
||||||
adjust_trunk()
|
adjust_trunk()
|
||||||
|
|
||||||
$(document).on 'click', 'input.datepicker', ->
|
$(document).on 'focus', 'input.datepicker', ->
|
||||||
$(this).datetimepicker(
|
if !$(this).hasClass("dtpok")
|
||||||
language: 'fr'
|
$(this).datetimepicker(
|
||||||
pickTime: false
|
language: 'fr'
|
||||||
).focus();
|
pickTime: false
|
||||||
|
);
|
||||||
|
|
||||||
|
$(this).addClass "dtpok"
|
||||||
|
|
||||||
$(document).on 'click', 'input.datetimepicker', ->
|
$(document).on 'click', 'input.datetimepicker', ->
|
||||||
$(this).datetimepicker(
|
$(this).datetimepicker(
|
||||||
|
79
app/controllers/admin/i_hebergements_controller.rb
Normal file
79
app/controllers/admin/i_hebergements_controller.rb
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# -*- encoding : utf-8 -*-
|
||||||
|
|
||||||
|
class Admin::IHebergementsController < ApplicationController
|
||||||
|
layout "admin"
|
||||||
|
before_filter :auth_admin
|
||||||
|
|
||||||
|
before_filter :admin_space
|
||||||
|
|
||||||
|
def admin_space
|
||||||
|
@admin_space = "sites"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def index
|
||||||
|
@i_hebergements = IHebergement.order("p_customer_id ASC").all
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@i_hebergement = IHebergement.find(params[:id])
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
|
||||||
|
|
||||||
|
@i_hebergement = IHebergement.new
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def edit
|
||||||
|
|
||||||
|
|
||||||
|
@i_hebergement = IHebergement.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@i_hebergement = IHebergement.new(params.require(:i_hebergement).permit!)
|
||||||
|
|
||||||
|
|
||||||
|
if @i_hebergement.save
|
||||||
|
@i_hebergements = IHebergement.order("p_customer_id ASC").all
|
||||||
|
|
||||||
|
else
|
||||||
|
render action: "new"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def update
|
||||||
|
@i_hebergement = IHebergement.find(params[:id])
|
||||||
|
|
||||||
|
|
||||||
|
if @i_hebergement.update_attributes(params.require(:i_hebergement).permit!)
|
||||||
|
|
||||||
|
@i_hebergements = IHebergement.order("p_customer_id ASC").all
|
||||||
|
else
|
||||||
|
render action: "edit"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@i_hebergement = IHebergement.find(params[:id])
|
||||||
|
@i_hebergement.destroy
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
@ -7,7 +7,7 @@ class Admin::IWebsitesController < ApplicationController
|
|||||||
before_filter :admin_space
|
before_filter :admin_space
|
||||||
|
|
||||||
def admin_space
|
def admin_space
|
||||||
@admin_space = "stocks"
|
@admin_space = "sites"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
26
app/inputs/date_input.rb
Normal file
26
app/inputs/date_input.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
class DateInput < Formtastic::Inputs::TextInput
|
||||||
|
include FormtasticBootstrap::Inputs::Base
|
||||||
|
|
||||||
|
|
||||||
|
def to_html
|
||||||
|
r = rand(1000000000000000000000000000)
|
||||||
|
bootstrap_wrapping do
|
||||||
|
builder.text_field(method.to_s, input_html_options.merge!(:class => "datepicker form-control"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def to_htmldffgddfg
|
||||||
|
r = rand(1000000000000000000000000000)
|
||||||
|
|
||||||
|
|
||||||
|
input_wrapping do
|
||||||
|
label_html +
|
||||||
|
template.content_tag(:fieldset, template.text_field_tag("cible_name", (object.cible ? object.cible.cible_name : "aucuns élément séléctionné"), :id =>"name_#{r}" ) +
|
||||||
|
self.manager_select_cible_link(method, options, r) + builder.hidden_field(method.to_s+"_id", input_html_options.merge!(:id => "input_id_"+r.to_s)) +
|
||||||
|
builder.hidden_field(method.to_s+"_type", input_html_options.merge!(:id => "input_type_"+r.to_s)) )
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,12 +0,0 @@
|
|||||||
|
|
||||||
class QiDatePickerInput < Formtastic::Inputs::TextInput
|
|
||||||
include FormtasticBootstrap::Inputs::Base
|
|
||||||
|
|
||||||
def to_html
|
|
||||||
r = rand(1000000000000000000000000000)
|
|
||||||
bootstrap_wrapping do
|
|
||||||
builder.text_field(method.to_s, input_html_options.merge!(:class => "datepicker form-control"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
7
app/models/i_hebergement.rb
Normal file
7
app/models/i_hebergement.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
class IHebergement < ActiveRecord::Base
|
||||||
|
has_many :i_hebergement_i_websites
|
||||||
|
has_many :i_websites, :through => :i_hebergement_i_websites
|
||||||
|
|
||||||
|
belongs_to :p_customer
|
||||||
|
|
||||||
|
end
|
5
app/models/i_hebergement_i_website.rb
Normal file
5
app/models/i_hebergement_i_website.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class IHebergementIWebsite < ActiveRecord::Base
|
||||||
|
belongs_to :i_hebergement
|
||||||
|
belongs_to :i_website
|
||||||
|
|
||||||
|
end
|
@ -1,4 +1,8 @@
|
|||||||
class IWebsite < ActiveRecord::Base
|
class IWebsite < ActiveRecord::Base
|
||||||
belongs_to :p_customer
|
belongs_to :p_customer
|
||||||
|
|
||||||
|
def show_name
|
||||||
|
self.name.to_s+(" - "+self.url.to_s if self.url?).to_s+(" - "+self.prov_url.to_s if self.prov_url?).to_s
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
2
app/views/admin/admin_spaces/_sites.html.haml
Normal file
2
app/views/admin/admin_spaces/_sites.html.haml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
%li= link_to "Sites", admin_i_websites_path
|
||||||
|
%li= link_to "Hébergements", admin_i_hebergements_path
|
@ -1,3 +0,0 @@
|
|||||||
%li= link_to "Tournées", admin_p_ship_tours_path
|
|
||||||
%li= link_to "Camions", admin_p_trucks_path
|
|
||||||
%li= link_to "Chauffeurs", admin_p_drivers_path
|
|
29
app/views/admin/i_hebergements/_form.html.haml
Executable file
29
app/views/admin/i_hebergements/_form.html.haml
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
=semantic_form_for [:admin, @i_hebergement], :remote => true, :html => {:autocomplete => "off"} do |f|
|
||||||
|
|
||||||
|
.content
|
||||||
|
=f.inputs do
|
||||||
|
= f.input :p_customer_id, :label => "Clients :", :collection => PCustomer.all, :as => :select, :include_blank => false, :member_label => :show_name
|
||||||
|
= f.input :name, :label => "Nom :"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :start_at, :label => "Début :", :as => :date
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :bill_to, :label => "Facturé jusqu'à :" , :as => :date
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :price_ht, :label => "Prix HT :"
|
||||||
|
|
||||||
|
|
||||||
|
= f.input :i_websites, :label => "Sites concernés :", :collection => IWebsite.all, :member_label => "show_name", :as => :check_boxes
|
||||||
|
|
||||||
|
|
||||||
|
=# f.input :status, :label => "Nom :"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.actions=f.submit "sauvegarder", :class => "btn btn-primary"
|
20
app/views/admin/i_hebergements/_i_hebergement.html.haml
Normal file
20
app/views/admin/i_hebergements/_i_hebergement.html.haml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
%tr#i_hebergement{:id => i_hebergement.id}
|
||||||
|
|
||||||
|
%td= i_hebergement.p_customer.show_name if i_hebergement.p_customer
|
||||||
|
%td= i_hebergement.name
|
||||||
|
|
||||||
|
%td=l i_hebergement.start_at
|
||||||
|
|
||||||
|
%td
|
||||||
|
- i_hebergement.i_websites.each do |i_website|
|
||||||
|
=i_website.name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%td.actions
|
||||||
|
= link_to i(:"trash-o"), [:admin, i_hebergement], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer ce projet ? ' } , :remote => true
|
||||||
|
= link_to i(:pencil), edit_admin_i_hebergement_path(i_hebergement), :remote => true
|
||||||
|
|
2
app/views/admin/i_hebergements/create.js.erb
Normal file
2
app/views/admin/i_hebergements/create.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#i_hebergements_rows').html("<%= escape_javascript(render(@i_hebergements))%>");
|
||||||
|
close_pane_hover();
|
1
app/views/admin/i_hebergements/destroy.js.erb
Normal file
1
app/views/admin/i_hebergements/destroy.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
$('#i_hebergement_<%= @i_hebergement.id %>').remove();
|
4
app/views/admin/i_hebergements/edit.html.haml
Normal file
4
app/views/admin/i_hebergements/edit.html.haml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
%h1 Modifier un distributeur
|
||||||
|
|
||||||
|
= render 'form'
|
||||||
|
|
1
app/views/admin/i_hebergements/edit.js.erb
Normal file
1
app/views/admin/i_hebergements/edit.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
32
app/views/admin/i_hebergements/import.html.haml
Normal file
32
app/views/admin/i_hebergements/import.html.haml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
-@import= true
|
||||||
|
|
||||||
|
-i = 0
|
||||||
|
-@csv.each do |csv|
|
||||||
|
-i += 1
|
||||||
|
|
||||||
|
=csv["code"]
|
||||||
|
-if csv["code"].to_s != ""
|
||||||
|
sfsd
|
||||||
|
-PFournisseur.create(:code => csv["code"],:name => csv["nom"],:address1 => csv["adresse 1"],:address2 => csv["adresse 2"],:cp => csv["code postal"],:city => csv["city"],:country => csv["country"],:email => csv["email"],:tel => csv["tel"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.qi_header
|
||||||
|
%h2 Importation
|
||||||
|
|
||||||
|
-if false
|
||||||
|
=semantic_form_for [:admin, @j_contrat], :url => import_save_admin_j_lines_path(), :html => {:method => :post}, :remote => false do |f|
|
||||||
|
|
||||||
|
=hidden_field_tag :id, @j_contrat.id
|
||||||
|
|
||||||
|
.j_lines_form
|
||||||
|
=f.semantic_fields_for :j_lines do |form|
|
||||||
|
=render :partial => "admin/j_lines/inline_form", :locals => {:f => form}
|
||||||
|
|
||||||
|
%center
|
||||||
|
=f.submit "Importer", :class => "btn btn-primary"
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
|
||||||
|
|
24
app/views/admin/i_hebergements/index.html.haml
Normal file
24
app/views/admin/i_hebergements/index.html.haml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
.qi_header
|
||||||
|
.right= link_to 'Ajouter un hébergement', new_admin_i_hebergement_path(), :class => "btn btn-primary", :remote => true
|
||||||
|
%h1
|
||||||
|
Hébergement
|
||||||
|
|
||||||
|
|
||||||
|
.qi_row
|
||||||
|
.qi_pannel.qi_plain.padding
|
||||||
|
%table.table
|
||||||
|
%tr
|
||||||
|
%th Client
|
||||||
|
|
||||||
|
|
||||||
|
%th Nom
|
||||||
|
%th Url provisoire
|
||||||
|
%th Url
|
||||||
|
%th Status
|
||||||
|
%th
|
||||||
|
|
||||||
|
|
||||||
|
%tbody#i_hebergements_rows
|
||||||
|
=render @i_hebergements
|
||||||
|
|
||||||
|
|
4
app/views/admin/i_hebergements/new.html.haml
Normal file
4
app/views/admin/i_hebergements/new.html.haml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
%h1 Ajouter un distributeur
|
||||||
|
|
||||||
|
= render 'form'
|
||||||
|
|
1
app/views/admin/i_hebergements/new.js.erb
Normal file
1
app/views/admin/i_hebergements/new.js.erb
Normal file
@ -0,0 +1 @@
|
|||||||
|
show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",700,900);
|
10
app/views/admin/i_hebergements/show.html.haml
Normal file
10
app/views/admin/i_hebergements/show.html.haml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
%h1=@i_hebergement.name
|
||||||
|
|
||||||
|
%h2 Marques
|
||||||
|
=link_to "ajouter une marque", new_admin_label_marque_path(:i_hebergement_id => @i_hebergement.id), :class => "btn btn-primary"
|
||||||
|
%table.table
|
||||||
|
=render @i_hebergement.label_marques.order(:name)
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%br
|
2
app/views/admin/i_hebergements/update.js.erb
Normal file
2
app/views/admin/i_hebergements/update.js.erb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$('#i_hebergements_rows').html("<%= escape_javascript(render(@i_hebergements))%>");
|
||||||
|
close_pane_hover();
|
@ -111,6 +111,7 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
|
resources :i_hebergements
|
||||||
resources :i_websites
|
resources :i_websites
|
||||||
resources :p_ship_bills
|
resources :p_ship_bills
|
||||||
resources :p_stats
|
resources :p_stats
|
||||||
|
17
db/migrate/20181110151820_create_i_hebergements.rb
Normal file
17
db/migrate/20181110151820_create_i_hebergements.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
class CreateIHebergements < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :i_hebergements do |t|
|
||||||
|
t.string :name
|
||||||
|
t.date :start_at
|
||||||
|
t.date :last_bill_at
|
||||||
|
t.date :bill_to
|
||||||
|
t.decimal :price_ht
|
||||||
|
t.integer :frequence
|
||||||
|
t.date :end_at
|
||||||
|
t.references :p_customer
|
||||||
|
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
10
db/migrate/20181110152121_create_i_hebergement_i_websites.rb
Normal file
10
db/migrate/20181110152121_create_i_hebergement_i_websites.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
class CreateIHebergementIWebsites < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :i_hebergement_i_websites do |t|
|
||||||
|
t.integer :i_hebergement_id
|
||||||
|
t.integer :i_website_id
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
22
db/schema.rb
22
db/schema.rb
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20181108201122) do
|
ActiveRecord::Schema.define(version: 20181110152121) do
|
||||||
|
|
||||||
create_table "admin_admin_roles", force: :cascade do |t|
|
create_table "admin_admin_roles", force: :cascade do |t|
|
||||||
t.integer "admin_id", limit: 4
|
t.integer "admin_id", limit: 4
|
||||||
@ -411,6 +411,26 @@ ActiveRecord::Schema.define(version: 20181108201122) do
|
|||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "i_hebergement_i_websites", force: :cascade do |t|
|
||||||
|
t.integer "i_hebergement_id", limit: 4
|
||||||
|
t.integer "i_website_id", limit: 4
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "i_hebergements", force: :cascade do |t|
|
||||||
|
t.string "name", limit: 255
|
||||||
|
t.date "start_at"
|
||||||
|
t.date "last_bill_at"
|
||||||
|
t.date "bill_to"
|
||||||
|
t.decimal "price_ht", precision: 10
|
||||||
|
t.integer "frequence", limit: 4
|
||||||
|
t.date "end_at"
|
||||||
|
t.integer "p_customer_id", limit: 4
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "i_websites", force: :cascade do |t|
|
create_table "i_websites", force: :cascade do |t|
|
||||||
t.string "name", limit: 255
|
t.string "name", limit: 255
|
||||||
t.string "url", limit: 255
|
t.string "url", limit: 255
|
||||||
|
9
test/fixtures/i_hebergement_i_websites.yml
vendored
Normal file
9
test/fixtures/i_hebergement_i_websites.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
i_hebergement_id: 1
|
||||||
|
i_website_id.integer: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
i_hebergement_id: 1
|
||||||
|
i_website_id.integer: MyString
|
19
test/fixtures/i_hebergements.yml
vendored
Normal file
19
test/fixtures/i_hebergements.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
start_at: 2018-11-10
|
||||||
|
last_bill_at: 2018-11-10
|
||||||
|
bill_to: 2018-11-10
|
||||||
|
price_ht: 9.99
|
||||||
|
frequence: 1
|
||||||
|
end_at: 2018-11-10
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
|
start_at: 2018-11-10
|
||||||
|
last_bill_at: 2018-11-10
|
||||||
|
bill_to: 2018-11-10
|
||||||
|
price_ht: 9.99
|
||||||
|
frequence: 1
|
||||||
|
end_at: 2018-11-10
|
7
test/models/i_hebergement_i_website_test.rb
Normal file
7
test/models/i_hebergement_i_website_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class IHebergementIWebsiteTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
7
test/models/i_hebergement_test.rb
Normal file
7
test/models/i_hebergement_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class IHebergementTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user