1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

disable a plan

This commit is contained in:
Sylvain 2017-10-04 18:56:39 +02:00
parent 25eb24e516
commit 26d79e5b12
21 changed files with 179 additions and 102 deletions

View File

@ -477,6 +477,14 @@ Application.Controllers.controller "EditMemberController", ["$scope", "$state",
##
# To use as callback in Array.prototype.filter to get only enabled plans
##
$scope.filterDisabledPlans = (plan) ->
!plan.disabled
### PRIVATE SCOPE ### ### PRIVATE SCOPE ###

View File

@ -175,6 +175,7 @@ Application.Controllers.controller 'EditPlanController', ['$scope', 'groups', 'p
## edited plan data ## edited plan data
$scope.plan = planPromise $scope.plan = planPromise
$scope.plan.type = "Plan" if $scope.plan.type == null $scope.plan.type = "Plan" if $scope.plan.type == null
$scope.plan.disabled = 'true' if $scope.plan.disabled
## API URL where the form will be posted ## API URL where the form will be posted
$scope.actionUrl = "/api/plans/" + $stateParams.id $scope.actionUrl = "/api/plans/" + $stateParams.id

View File

@ -527,6 +527,14 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", '$stat
##
# To use as callback in Array.prototype.filter to get only enabled plans
##
$scope.filterDisabledPlans = (plan) ->
!plan.disabled
### PRIVATE SCOPE ### ### PRIVATE SCOPE ###
## ##

View File

@ -148,6 +148,14 @@ Application.Controllers.controller "PlansIndexController", ["$scope", "$rootScop
##
# To use as callback in Array.prototype.filter to get only enabled plans
##
$scope.filterDisabledPlans = (plan) ->
!plan.disabled
### PRIVATE SCOPE ### ### PRIVATE SCOPE ###
## ##

View File

@ -438,6 +438,14 @@ Application.Controllers.controller "ReserveSpaceController", ["$scope", '$stateP
##
# To use as callback in Array.prototype.filter to get only enabled plans
##
$scope.filterDisabledPlans = (plan) ->
!plan.disabled
### PRIVATE SCOPE ### ### PRIVATE SCOPE ###
## ##

View File

@ -338,6 +338,14 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", '$sta
##
# To use as callback in Array.prototype.filter to get only enabled plans
##
$scope.filterDisabledPlans = (plan) ->
!plan.disabled
### PRIVATE SCOPE ### ### PRIVATE SCOPE ###
## ##

View File

@ -625,3 +625,15 @@ body.container{
overflow: hidden; overflow: hidden;
} }
} }
.disabled-line {
color: $gray;
background-color: $gray-lighter;
& td:first-child:before {
font-family: 'fontawesome' !important;
content: '\f023';
position: absolute;
left: -4px;
}
}

View File

@ -85,7 +85,7 @@
<p translate> <p translate>
{{ 'user_has_no_current_subscription' }} {{ 'user_has_no_current_subscription' }}
</p> </p>
<button class="btn btn-default" ng-click="createSubscriptionModal(user, plans)" translate>{{ 'subscribe_to_a_plan' }}</button> <button class="btn btn-default" ng-click="createSubscriptionModal(user, plans.filter(filterDisabledPlans))" translate>{{ 'subscribe_to_a_plan' }}</button>
</div> </div>
</div> </div>

View File

@ -30,6 +30,21 @@
<ng-include src="'<%= asset_path 'admin/plans/_form.html' %>'"></ng-include> <ng-include src="'<%= asset_path 'admin/plans/_form.html' %>'"></ng-include>
<div class="input-group m-t-md">
<label for="plan[disabled]" class="control-label m-r-md">{{ 'plan_form.disabled' | translate }}</label>
<input bs-switch
ng-model="plan.disabled"
id="plan[disabled]"
type="checkbox"
class="form-control"
switch-on-text="{{ 'yes' | translate }}"
switch-off-text="{{ 'no' | translate }}"
switch-animate="true"
ng-true-value="'true'"
ng-false-value="'false'"/>
<input type="hidden" name="plan[disabled]" value="{{plan.disabled}}"/>
</div>
<h2 class="m-t-xl" translate>{{ 'edit_plan.prices' }}</h2> <h2 class="m-t-xl" translate>{{ 'edit_plan.prices' }}</h2>
<div class="form-group col-md-6 col-lg-offset-6"> <div class="form-group col-md-6 col-lg-offset-6">
<input type="hidden" ng-model="plan.parent" name="plan[parent_id]" ng-value="plan.parent"/> <input type="hidden" ng-model="plan.parent" name="plan[parent_id]" ng-value="plan.parent"/>

View File

@ -20,7 +20,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="plan in plans | orderBy:orderPlans"> <tr ng-repeat="plan in plans | orderBy:orderPlans" ng-class="{'disabled-line' : plan.disabled}">
<td>{{getPlanType(plan.type)}}</td> <td>{{getPlanType(plan.type)}}</td>
<td>{{plan.base_name}}</td> <td>{{plan.base_name}}</td>
<td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td> <td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td>

View File

@ -8,8 +8,8 @@
<!-- ng-class directive center the last item if the list length is odd --> <!-- ng-class directive center the last item if the list length is odd -->
<div class="pricing-panel col-xs-6 col-md-6 col-lg-6 text-center" <div class="pricing-panel col-xs-6 col-md-6 col-lg-6 text-center"
ng-class="{'col-md-12 col-lg-12':(plansGroup.plans.length % 2 == 1 && key == plansGroup.plans.length-1)}" ng-class="{'col-md-12 col-lg-12':(plansGroup.plans.filter(filterDisabledPlans).length % 2 == 1 && key == plansGroup.plans.filter(filterDisabledPlans).length-1)}"
ng-repeat="(key, plan) in plansGroup.plans | orderBy:'interval'"> ng-repeat="(key, plan) in plansGroup.plans.filter(filterDisabledPlans) | orderBy:'interval'">
<h3 class="title">{{ plan.base_name }}</h3> <h3 class="title">{{ plan.base_name }}</h3>

View File

@ -27,8 +27,8 @@
<!-- ng-class directive center the last item if the list length is odd --> <!-- ng-class directive center the last item if the list length is odd -->
<div class="pricing-panel col-xs-12 col-md-6 col-lg-6 text-center" <div class="pricing-panel col-xs-12 col-md-6 col-lg-6 text-center"
ng-class="{'col-md-12 col-lg-12 b-r':(plansGroup.plans.length % 2 == 1 && key == plansGroup.plans.length-1)}" ng-class="{'col-md-12 col-lg-12 b-r':(plansGroup.plans.filter(filterDisabledPlans).length % 2 == 1 && key == plansGroup.plans.filter(filterDisabledPlans).length-1)}"
ng-repeat="(key, plan) in plansGroup.plans | orderBy: '-ui_weight'"> ng-repeat="(key, plan) in plansGroup.plans.filter(filterDisabledPlans) | orderBy: '-ui_weight'">
<h3 class="title">{{ plan.base_name }}</h3> <h3 class="title">{{ plan.base_name }}</h3>

View File

@ -87,8 +87,7 @@
end if @parameters[:plan][:prices_attributes] end if @parameters[:plan][:prices_attributes]
@parameters = @parameters.require(:plan).permit(:base_name, :type, :group_id, :amount, :interval, :interval_count, :is_rolling, @parameters = @parameters.require(:plan).permit(:base_name, :type, :group_id, :amount, :interval, :interval_count, :is_rolling,
:training_credit_nb, :training_credit_nb, :ui_weight, :disabled,
:ui_weight,
plan_file_attributes: [:id, :attachment, :_destroy], plan_file_attributes: [:id, :attachment, :_destroy],
prices_attributes: [:id, :amount] prices_attributes: [:id, :amount]
) )

View File

@ -1,4 +1,4 @@
json.extract! plan, :id, :base_name, :name, :interval, :interval_count, :group_id, :training_credit_nb, :is_rolling, :description, :type, :ui_weight json.extract! plan, :id, :base_name, :name, :interval, :interval_count, :group_id, :training_credit_nb, :is_rolling, :description, :type, :ui_weight, :disabled
json.amount (plan.amount / 100.00) json.amount (plan.amount / 100.00)
json.prices plan.prices, partial: 'api/prices/price', as: :price json.prices plan.prices, partial: 'api/prices/price', as: :price
json.plan_file_attributes do json.plan_file_attributes do

View File

@ -1,5 +1,5 @@
json.array!(@plans) do |plan| json.array!(@plans) do |plan|
json.extract! plan, :id, :base_name, :name, :interval, :interval_count, :group_id, :training_credit_nb, :description, :type, :ui_weight json.extract! plan, :id, :base_name, :name, :interval, :interval_count, :group_id, :training_credit_nb, :description, :type, :ui_weight, :disabled
json.amount (plan.amount / 100.00) json.amount (plan.amount / 100.00)
json.plan_file_url plan.plan_file.attachment_url if plan.plan_file json.plan_file_url plan.plan_file.attachment_url if plan.plan_file
end end

View File

@ -7,5 +7,6 @@ json.array!(@plans) do |plan|
json.interval plan.interval json.interval plan.interval
json.interval_count plan.interval_count json.interval_count plan.interval_count
json.type plan.type json.type plan.type
json.disabled plan.disabled
json.plan_file_url plan.plan_file.attachment_url if plan.plan_file json.plan_file_url plan.plan_file.attachment_url if plan.plan_file
end end

View File

@ -230,6 +230,7 @@ en:
as_part_of_a_partner_subscription_some_notifications_may_be_sent_to_this_user: "As part of a partner subscription, some notifications may be sent to this user." as_part_of_a_partner_subscription_some_notifications_may_be_sent_to_this_user: "As part of a partner subscription, some notifications may be sent to this user."
new_partner: "New partner" new_partner: "New partner"
email_address_is_required: "Email address is required." email_address_is_required: "Email address is required."
disabled: "Disable subscription"
trainings: trainings:
# training edition form # training edition form

View File

@ -230,6 +230,7 @@ fr:
as_part_of_a_partner_subscription_some_notifications_may_be_sent_to_this_user: "Dans le cadre d'un abonnement partenaire, certaines notifications pourront être adressées à cet utilisateur." as_part_of_a_partner_subscription_some_notifications_may_be_sent_to_this_user: "Dans le cadre d'un abonnement partenaire, certaines notifications pourront être adressées à cet utilisateur."
new_partner: "Nouveau partenaire" new_partner: "Nouveau partenaire"
email_address_is_required: "L'adresse e-mail est requise." email_address_is_required: "L'adresse e-mail est requise."
disabled: "Désactiver l'abonnement"
trainings: trainings:
# formulaire d'édition d'une formation # formulaire d'édition d'une formation

View File

@ -230,6 +230,7 @@ pt:
as_part_of_a_partner_subscription_some_notifications_may_be_sent_to_this_user: "Como parte da inscrição do parceiro, algumas notificações podem ser enviadas para este usuário." as_part_of_a_partner_subscription_some_notifications_may_be_sent_to_this_user: "Como parte da inscrição do parceiro, algumas notificações podem ser enviadas para este usuário."
new_partner: "Novo parceiro" new_partner: "Novo parceiro"
email_address_is_required: "Email é obrigatório." email_address_is_required: "Email é obrigatório."
disabled: "Disable subscrição"
trainings: trainings:
# training edition form # training edition form

View File

@ -0,0 +1,5 @@
class AddDisabledToPlan < ActiveRecord::Migration
def change
add_column :plans, :disabled, :boolean
end
end

View File

@ -11,12 +11,12 @@
# #
# 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: 20170906100906) do ActiveRecord::Schema.define(version: 20171004135605) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
enable_extension "unaccent"
enable_extension "pg_trgm" enable_extension "pg_trgm"
enable_extension "unaccent"
create_table "abuses", force: :cascade do |t| create_table "abuses", force: :cascade do |t|
t.integer "signaled_id" t.integer "signaled_id"
@ -32,14 +32,14 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree add_index "abuses", ["signaled_type", "signaled_id"], name: "index_abuses_on_signaled_type_and_signaled_id", using: :btree
create_table "addresses", force: :cascade do |t| create_table "addresses", force: :cascade do |t|
t.string "address" t.string "address", limit: 255
t.string "street_number" t.string "street_number", limit: 255
t.string "route" t.string "route", limit: 255
t.string "locality" t.string "locality", limit: 255
t.string "country" t.string "country", limit: 255
t.string "postal_code" t.string "postal_code", limit: 255
t.integer "placeable_id" t.integer "placeable_id"
t.string "placeable_type" t.string "placeable_type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -55,9 +55,9 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "assets", force: :cascade do |t| create_table "assets", force: :cascade do |t|
t.integer "viewable_id" t.integer "viewable_id"
t.string "viewable_type" t.string "viewable_type", limit: 255
t.string "attachment" t.string "attachment", limit: 255
t.string "type" t.string "type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -74,12 +74,12 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "availabilities", force: :cascade do |t| create_table "availabilities", force: :cascade do |t|
t.datetime "start_at" t.datetime "start_at"
t.datetime "end_at" t.datetime "end_at"
t.string "available_type" t.string "available_type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "nb_total_places" t.integer "nb_total_places"
t.boolean "destroying", default: false t.boolean "destroying", default: false
t.boolean "lock", default: false t.boolean "lock", default: false
end end
create_table "availability_tags", force: :cascade do |t| create_table "availability_tags", force: :cascade do |t|
@ -93,7 +93,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
create_table "categories", force: :cascade do |t| create_table "categories", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "slug" t.string "slug"
@ -102,7 +102,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
create_table "components", force: :cascade do |t| create_table "components", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
end end
create_table "coupons", force: :cascade do |t| create_table "coupons", force: :cascade do |t|
@ -120,7 +120,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "credits", force: :cascade do |t| create_table "credits", force: :cascade do |t|
t.integer "creditable_id" t.integer "creditable_id"
t.string "creditable_type" t.string "creditable_type", limit: 255
t.integer "plan_id" t.integer "plan_id"
t.integer "hours" t.integer "hours"
t.datetime "created_at" t.datetime "created_at"
@ -161,7 +161,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
create_table "events", force: :cascade do |t| create_table "events", force: :cascade do |t|
t.string "title" t.string "title", limit: 255
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -199,10 +199,10 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
create_table "friendly_id_slugs", force: :cascade do |t| create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", null: false t.string "slug", limit: 255, null: false
t.integer "sluggable_id", null: false t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50 t.string "sluggable_type", limit: 50
t.string "scope" t.string "scope", limit: 255
t.datetime "created_at" t.datetime "created_at"
end end
@ -212,17 +212,17 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
create_table "groups", force: :cascade do |t| create_table "groups", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "slug" t.string "slug", limit: 255
end end
add_index "groups", ["slug"], name: "index_groups_on_slug", unique: true, using: :btree add_index "groups", ["slug"], name: "index_groups_on_slug", unique: true, using: :btree
create_table "invoice_items", force: :cascade do |t| create_table "invoice_items", force: :cascade do |t|
t.integer "invoice_id" t.integer "invoice_id"
t.string "stp_invoice_item_id" t.string "stp_invoice_item_id", limit: 255
t.integer "amount" t.integer "amount"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -235,17 +235,17 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "invoices", force: :cascade do |t| create_table "invoices", force: :cascade do |t|
t.integer "invoiced_id" t.integer "invoiced_id"
t.string "invoiced_type" t.string "invoiced_type", limit: 255
t.string "stp_invoice_id" t.string "stp_invoice_id", limit: 255
t.integer "total" t.integer "total"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "user_id" t.integer "user_id"
t.string "reference" t.string "reference", limit: 255
t.string "avoir_mode" t.string "avoir_mode", limit: 255
t.datetime "avoir_date" t.datetime "avoir_date"
t.integer "invoice_id" t.integer "invoice_id"
t.string "type" t.string "type", limit: 255
t.boolean "subscription_to_expire" t.boolean "subscription_to_expire"
t.text "description" t.text "description"
t.integer "wallet_amount" t.integer "wallet_amount"
@ -259,17 +259,17 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
create_table "licences", force: :cascade do |t| create_table "licences", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
t.text "description" t.text "description"
end end
create_table "machines", force: :cascade do |t| create_table "machines", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
t.text "description" t.text "description"
t.text "spec" t.text "spec"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "slug" t.string "slug", limit: 255
end end
add_index "machines", ["slug"], name: "index_machines_on_slug", unique: true, using: :btree add_index "machines", ["slug"], name: "index_machines_on_slug", unique: true, using: :btree
@ -285,14 +285,14 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "notifications", force: :cascade do |t| create_table "notifications", force: :cascade do |t|
t.integer "receiver_id" t.integer "receiver_id"
t.integer "attached_object_id" t.integer "attached_object_id"
t.string "attached_object_type" t.string "attached_object_type", limit: 255
t.integer "notification_type_id" t.integer "notification_type_id"
t.boolean "is_read", default: false t.boolean "is_read", default: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "receiver_type" t.string "receiver_type"
t.boolean "is_send", default: false t.boolean "is_send", default: false
t.jsonb "meta_data", default: {} t.jsonb "meta_data", default: {}
end end
add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree
@ -361,21 +361,22 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
create_table "plans", force: :cascade do |t| create_table "plans", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.integer "amount" t.integer "amount"
t.string "interval" t.string "interval", limit: 255
t.integer "group_id" t.integer "group_id"
t.string "stp_plan_id" t.string "stp_plan_id", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "training_credit_nb", default: 0 t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true t.boolean "is_rolling", default: true
t.text "description" t.text "description"
t.string "type" t.string "type"
t.string "base_name" t.string "base_name"
t.integer "ui_weight", default: 0 t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1 t.integer "interval_count", default: 1
t.string "slug" t.string "slug"
t.boolean "disabled"
end end
add_index "plans", ["group_id"], name: "index_plans_on_group_id", using: :btree add_index "plans", ["group_id"], name: "index_plans_on_group_id", using: :btree
@ -403,11 +404,11 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "profiles", force: :cascade do |t| create_table "profiles", force: :cascade do |t|
t.integer "user_id" t.integer "user_id"
t.string "first_name" t.string "first_name", limit: 255
t.string "last_name" t.string "last_name", limit: 255
t.boolean "gender" t.boolean "gender"
t.date "birthday" t.date "birthday"
t.string "phone" t.string "phone", limit: 255
t.text "interest" t.text "interest"
t.text "software_mastered" t.text "software_mastered"
t.datetime "created_at" t.datetime "created_at"
@ -437,7 +438,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
t.integer "project_id" t.integer "project_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "title" t.string "title", limit: 255
t.integer "step_nb" t.integer "step_nb"
end end
@ -448,27 +449,27 @@ ActiveRecord::Schema.define(version: 20170906100906) do
t.integer "user_id" t.integer "user_id"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "is_valid", default: false t.boolean "is_valid", default: false
t.string "valid_token" t.string "valid_token", limit: 255
end end
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
create_table "projects", force: :cascade do |t| create_table "projects", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.text "description" t.text "description"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "author_id" t.integer "author_id"
t.text "tags" t.text "tags"
t.integer "licence_id" t.integer "licence_id"
t.string "state" t.string "state", limit: 255
t.string "slug" t.string "slug", limit: 255
t.datetime "published_at" t.datetime "published_at"
end end
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
create_table "projects_components", force: :cascade do |t| create_table "projects_components", force: :cascade do |t|
t.integer "project_id" t.integer "project_id"
@ -508,19 +509,19 @@ ActiveRecord::Schema.define(version: 20170906100906) do
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "reservable_id" t.integer "reservable_id"
t.string "reservable_type" t.string "reservable_type", limit: 255
t.string "stp_invoice_id" t.string "stp_invoice_id", limit: 255
t.integer "nb_reserve_places" t.integer "nb_reserve_places"
end end
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
create_table "roles", force: :cascade do |t| create_table "roles", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.integer "resource_id" t.integer "resource_id"
t.string "resource_type" t.string "resource_type", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -594,18 +595,18 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "statistic_fields", force: :cascade do |t| create_table "statistic_fields", force: :cascade do |t|
t.integer "statistic_index_id" t.integer "statistic_index_id"
t.string "key" t.string "key", limit: 255
t.string "label" t.string "label", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "data_type" t.string "data_type", limit: 255
end end
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
create_table "statistic_graphs", force: :cascade do |t| create_table "statistic_graphs", force: :cascade do |t|
t.integer "statistic_index_id" t.integer "statistic_index_id"
t.string "chart_type" t.string "chart_type", limit: 255
t.integer "limit" t.integer "limit"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -614,17 +615,17 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
create_table "statistic_indices", force: :cascade do |t| create_table "statistic_indices", force: :cascade do |t|
t.string "es_type_key" t.string "es_type_key", limit: 255
t.string "label" t.string "label", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "table", default: true t.boolean "table", default: true
t.boolean "ca", default: true t.boolean "ca", default: true
end end
create_table "statistic_sub_types", force: :cascade do |t| create_table "statistic_sub_types", force: :cascade do |t|
t.string "key" t.string "key", limit: 255
t.string "label" t.string "label", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end
@ -641,8 +642,8 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "statistic_types", force: :cascade do |t| create_table "statistic_types", force: :cascade do |t|
t.integer "statistic_index_id" t.integer "statistic_index_id"
t.string "key" t.string "key", limit: 255
t.string "label" t.string "label", limit: 255
t.boolean "graph" t.boolean "graph"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
@ -660,7 +661,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
create_table "subscriptions", force: :cascade do |t| create_table "subscriptions", force: :cascade do |t|
t.integer "plan_id" t.integer "plan_id"
t.integer "user_id" t.integer "user_id"
t.string "stp_subscription_id" t.string "stp_subscription_id", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.datetime "expired_at" t.datetime "expired_at"
@ -679,7 +680,7 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
create_table "themes", force: :cascade do |t| create_table "themes", force: :cascade do |t|
t.string "name", null: false t.string "name", limit: 255, null: false
end end
create_table "tickets", force: :cascade do |t| create_table "tickets", force: :cascade do |t|
@ -694,13 +695,13 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
create_table "trainings", force: :cascade do |t| create_table "trainings", force: :cascade do |t|
t.string "name" t.string "name", limit: 255
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.integer "nb_total_places" t.integer "nb_total_places"
t.string "slug" t.string "slug", limit: 255
t.text "description" t.text "description"
t.boolean "public_page", default: true t.boolean "public_page", default: true
end end
add_index "trainings", ["slug"], name: "index_trainings_on_slug", unique: true, using: :btree add_index "trainings", ["slug"], name: "index_trainings_on_slug", unique: true, using: :btree
@ -755,32 +756,32 @@ ActiveRecord::Schema.define(version: 20170906100906) do
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", default: "", null: false t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token" t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at" t.datetime "reset_password_sent_at"
t.datetime "remember_created_at" t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at" t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at" t.datetime "last_sign_in_at"
t.string "current_sign_in_ip" t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip" t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token" t.string "confirmation_token", limit: 255
t.datetime "confirmed_at" t.datetime "confirmed_at"
t.datetime "confirmation_sent_at" t.datetime "confirmation_sent_at"
t.string "unconfirmed_email" t.string "unconfirmed_email", limit: 255
t.integer "failed_attempts", default: 0, null: false t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token" t.string "unlock_token", limit: 255
t.datetime "locked_at" t.datetime "locked_at"
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.boolean "is_allow_contact", default: true t.boolean "is_allow_contact", default: true
t.integer "group_id" t.integer "group_id"
t.string "stp_customer_id" t.string "stp_customer_id", limit: 255
t.string "username" t.string "username", limit: 255
t.string "slug" t.string "slug", limit: 255
t.boolean "is_active", default: true t.boolean "is_active", default: true
t.boolean "invoicing_disabled", default: false t.boolean "invoicing_disabled", default: false
t.string "provider" t.string "provider"
t.string "uid" t.string "uid"
t.string "auth_token" t.string "auth_token"