rails_event 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +32 -0
- data/app/controllers/eventual/admin/base_controller.rb +4 -0
- data/app/controllers/eventual/admin/bookings_controller.rb +43 -0
- data/app/controllers/eventual/admin/crowd_members_controller.rb +43 -0
- data/app/controllers/eventual/admin/crowds_controller.rb +58 -0
- data/app/controllers/eventual/admin/event_crowds_controller.rb +71 -0
- data/app/controllers/eventual/admin/event_items_controller.rb +58 -0
- data/app/controllers/eventual/admin/event_participants_controller.rb +101 -0
- data/app/controllers/eventual/admin/event_taxons_controller.rb +55 -0
- data/app/controllers/eventual/admin/events_controller.rb +91 -0
- data/app/controllers/eventual/admin/place_taxons_controller.rb +57 -0
- data/app/controllers/eventual/admin/places_controller.rb +59 -0
- data/app/controllers/eventual/admin/plan_attenders_controller.rb +65 -0
- data/app/controllers/eventual/admin/plan_items_controller.rb +84 -0
- data/app/controllers/eventual/admin/plans_controller.rb +127 -0
- data/app/controllers/eventual/admin/seats_controller.rb +58 -0
- data/app/controllers/eventual/admin/time_items_controller.rb +82 -0
- data/app/controllers/eventual/admin/time_lists_controller.rb +72 -0
- data/app/controllers/eventual/base_controller.rb +4 -0
- data/app/controllers/eventual/me/base_controller.rb +4 -0
- data/app/controllers/eventual/me/plan_items_controller.rb +58 -0
- data/app/controllers/eventual/my/base_controller.rb +4 -0
- data/app/controllers/eventual/my/plan_items_controller.rb +55 -0
- data/app/controllers/eventual/places_controller.rb +27 -0
- data/app/controllers/eventual/time_controller.rb +14 -0
- data/app/models/eventual/application_record.rb +5 -0
- data/app/models/eventual/booking.rb +5 -0
- data/app/models/eventual/crowd.rb +5 -0
- data/app/models/eventual/crowd_member.rb +5 -0
- data/app/models/eventual/event.rb +6 -0
- data/app/models/eventual/event_crowd.rb +5 -0
- data/app/models/eventual/event_grant.rb +5 -0
- data/app/models/eventual/event_item.rb +5 -0
- data/app/models/eventual/event_participant.rb +6 -0
- data/app/models/eventual/event_taxon.rb +5 -0
- data/app/models/eventual/ext/recurrence.rb +86 -0
- data/app/models/eventual/model/agency.rb +18 -0
- data/app/models/eventual/model/booked.rb +10 -0
- data/app/models/eventual/model/booker.rb +15 -0
- data/app/models/eventual/model/booking.rb +37 -0
- data/app/models/eventual/model/crowd.rb +21 -0
- data/app/models/eventual/model/crowd_member.rb +20 -0
- data/app/models/eventual/model/event.rb +48 -0
- data/app/models/eventual/model/event_crowd.rb +54 -0
- data/app/models/eventual/model/event_grant.rb +14 -0
- data/app/models/eventual/model/event_item.rb +30 -0
- data/app/models/eventual/model/event_participant.rb +63 -0
- data/app/models/eventual/model/event_taxon.rb +13 -0
- data/app/models/eventual/model/member.rb +18 -0
- data/app/models/eventual/model/occurrence.rb +62 -0
- data/app/models/eventual/model/place.rb +25 -0
- data/app/models/eventual/model/place_taxon.rb +18 -0
- data/app/models/eventual/model/plan.rb +147 -0
- data/app/models/eventual/model/plan_attender.rb +31 -0
- data/app/models/eventual/model/plan_item.rb +84 -0
- data/app/models/eventual/model/plan_participant/crowd_participant.rb +17 -0
- data/app/models/eventual/model/plan_participant/normal_participant.rb +9 -0
- data/app/models/eventual/model/plan_participant.rb +30 -0
- data/app/models/eventual/model/planned.rb +11 -0
- data/app/models/eventual/model/planning.rb +44 -0
- data/app/models/eventual/model/recurrence.rb +64 -0
- data/app/models/eventual/model/seat.rb +17 -0
- data/app/models/eventual/model/time_item.rb +46 -0
- data/app/models/eventual/model/time_list.rb +57 -0
- data/app/models/eventual/place.rb +5 -0
- data/app/models/eventual/place_taxon.rb +6 -0
- data/app/models/eventual/plan.rb +7 -0
- data/app/models/eventual/plan_attender.rb +5 -0
- data/app/models/eventual/plan_item.rb +6 -0
- data/app/models/eventual/plan_participant.rb +5 -0
- data/app/models/eventual/seat.rb +5 -0
- data/app/models/eventual/time_item.rb +5 -0
- data/app/models/eventual/time_list.rb +5 -0
- data/app/models/eventual.rb +11 -0
- data/app/models/plan_participant/eventual/crowd_participant.rb +5 -0
- data/app/models/plan_participant/eventual/normal_participant.rb +5 -0
- data/app/views/admin/_event_nav.html.erb +14 -0
- data/app/views/admin/_nav_event.html.erb +9 -0
- data/app/views/eventual/admin/base/_nav.html.erb +3 -0
- data/app/views/eventual/admin/bookings/_booking.json.jbuilder +12 -0
- data/app/views/eventual/admin/bookings/_filter.html.erb +6 -0
- data/app/views/eventual/admin/bookings/_form.html.erb +8 -0
- data/app/views/eventual/admin/bookings/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/bookings/_show_table.html.erb +28 -0
- data/app/views/eventual/admin/bookings/index.html.erb +43 -0
- data/app/views/eventual/admin/bookings/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/crowd_members/_filter_form.html.erb +7 -0
- data/app/views/eventual/admin/crowd_members/_form.html.erb +4 -0
- data/app/views/eventual/admin/crowd_members/index.html.erb +34 -0
- data/app/views/eventual/admin/crowds/_crowd.json.jbuilder +8 -0
- data/app/views/eventual/admin/crowds/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/crowds/_filter_form.html.erb +10 -0
- data/app/views/eventual/admin/crowds/_form.html.erb +4 -0
- data/app/views/eventual/admin/crowds/_index_tbody.html.erb +5 -0
- data/app/views/eventual/admin/crowds/_index_thead.html.erb +3 -0
- data/app/views/eventual/admin/crowds/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/crowds/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/crowds/_show_table.html.erb +20 -0
- data/app/views/eventual/admin/crowds/index.html.erb +5 -0
- data/app/views/eventual/admin/crowds/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/event_crowds/_breadcrumb.html.erb +7 -0
- data/app/views/eventual/admin/event_crowds/_crowd_student.html.erb +18 -0
- data/app/views/eventual/admin/event_crowds/_edit_form.html.erb +15 -0
- data/app/views/eventual/admin/event_crowds/_index_tbody.html.erb +19 -0
- data/app/views/eventual/admin/event_crowds/_index_thead.html.erb +10 -0
- data/app/views/eventual/admin/event_crowds/_new_form.html.erb +6 -0
- data/app/views/eventual/admin/event_crowds/_show_table.html.erb +12 -0
- data/app/views/eventual/admin/event_crowds/index.html.erb +2 -0
- data/app/views/eventual/admin/event_items/_breadcrumb.html.erb +7 -0
- data/app/views/eventual/admin/event_items/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/event_items/_event_item.json.jbuilder +12 -0
- data/app/views/eventual/admin/event_items/_filter_form.html.erb +9 -0
- data/app/views/eventual/admin/event_items/_form.html.erb +12 -0
- data/app/views/eventual/admin/event_items/_index_tbody.html.erb +8 -0
- data/app/views/eventual/admin/event_items/_index_thead.html.erb +5 -0
- data/app/views/eventual/admin/event_items/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/event_items/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/event_items/_show_table.html.erb +12 -0
- data/app/views/eventual/admin/event_items/index.html.erb +1 -0
- data/app/views/eventual/admin/event_items/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/event_participants/_breadcrumb.html.erb +7 -0
- data/app/views/eventual/admin/event_participants/_button.html.erb +3 -0
- data/app/views/eventual/admin/event_participants/_filter_form.html.erb +9 -0
- data/app/views/eventual/admin/event_participants/_filter_table.html.erb +11 -0
- data/app/views/eventual/admin/event_participants/_form.html.erb +4 -0
- data/app/views/eventual/admin/event_participants/_index_tbody.html.erb +15 -0
- data/app/views/eventual/admin/event_participants/_index_thead.html.erb +5 -0
- data/app/views/eventual/admin/event_participants/index.html.erb +1 -0
- data/app/views/eventual/admin/event_taxons/_breadcrumb.html.erb +6 -0
- data/app/views/eventual/admin/event_taxons/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/event_taxons/_event_taxon.json.jbuilder +5 -0
- data/app/views/eventual/admin/event_taxons/_filter_form.html.erb +10 -0
- data/app/views/eventual/admin/event_taxons/_form.html.erb +2 -0
- data/app/views/eventual/admin/event_taxons/_index_tbody.html.erb +1 -0
- data/app/views/eventual/admin/event_taxons/_index_thead.html.erb +2 -0
- data/app/views/eventual/admin/event_taxons/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/event_taxons/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/event_taxons/index.html.erb +5 -0
- data/app/views/eventual/admin/event_taxons/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/events/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/events/_event.json.jbuilder +17 -0
- data/app/views/eventual/admin/events/_filter_form.html.erb +9 -0
- data/app/views/eventual/admin/events/_filter_table.html.erb +15 -0
- data/app/views/eventual/admin/events/_form.html.erb +11 -0
- data/app/views/eventual/admin/events/_index_tbody.html.erb +11 -0
- data/app/views/eventual/admin/events/_index_thead.html.erb +10 -0
- data/app/views/eventual/admin/events/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/events/_show/_breadcrumb.html.erb +7 -0
- data/app/views/eventual/admin/events/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/events/create.json.jbuilder +1 -0
- data/app/views/eventual/admin/events/index.html.erb +5 -0
- data/app/views/eventual/admin/events/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/events/repeat_form.js.erb +14 -0
- data/app/views/eventual/admin/events/show.html.erb +16 -0
- data/app/views/eventual/admin/place_taxons/_breadcrumb.html.erb +6 -0
- data/app/views/eventual/admin/place_taxons/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/place_taxons/_filter_form.html.erb +9 -0
- data/app/views/eventual/admin/place_taxons/_form.html.erb +6 -0
- data/app/views/eventual/admin/place_taxons/_index_tbody.html.erb +17 -0
- data/app/views/eventual/admin/place_taxons/_index_thead.html.erb +4 -0
- data/app/views/eventual/admin/place_taxons/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/place_taxons/_show_table.html.erb +12 -0
- data/app/views/eventual/admin/place_taxons/index.html.erb +5 -0
- data/app/views/eventual/admin/places/_breadcrumb.html.erb +5 -0
- data/app/views/eventual/admin/places/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/places/_filter_form.html.erb +10 -0
- data/app/views/eventual/admin/places/_form.html.erb +4 -0
- data/app/views/eventual/admin/places/_index_tbody.html.erb +6 -0
- data/app/views/eventual/admin/places/_index_thead.html.erb +10 -0
- data/app/views/eventual/admin/places/_index_tr.html.erb +19 -0
- data/app/views/eventual/admin/places/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/places/_place.json.jbuilder +6 -0
- data/app/views/eventual/admin/places/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/places/_show_table.html.erb +8 -0
- data/app/views/eventual/admin/places/index.html.erb +5 -0
- data/app/views/eventual/admin/places/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/plan_attenders/_breadcrumb.html.erb +9 -0
- data/app/views/eventual/admin/plan_attenders/_course_student.json.jbuilder +11 -0
- data/app/views/eventual/admin/plan_attenders/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/plan_attenders/_filter.html.erb +6 -0
- data/app/views/eventual/admin/plan_attenders/_form.html.erb +5 -0
- data/app/views/eventual/admin/plan_attenders/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/plan_attenders/_plan_attender.json.jbuilder +9 -0
- data/app/views/eventual/admin/plan_attenders/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/plan_attenders/_show_table.html.erb +16 -0
- data/app/views/eventual/admin/plan_attenders/absent.json.jbuilder +0 -0
- data/app/views/eventual/admin/plan_attenders/attend.json.jbuilder +0 -0
- data/app/views/eventual/admin/plan_attenders/index.html.erb +51 -0
- data/app/views/eventual/admin/plan_attenders/index.json.jbuilder +2 -0
- data/app/views/eventual/admin/plan_attenders/indexs.json.jbuilder +6 -0
- data/app/views/eventual/admin/plan_items/_breadcrumb.html.erb +8 -0
- data/app/views/eventual/admin/plan_items/_edit.html.erb +23 -0
- data/app/views/eventual/admin/plan_items/_filter.html.erb +11 -0
- data/app/views/eventual/admin/plan_items/_menu.html.erb +4 -0
- data/app/views/eventual/admin/plan_items/_plan.html.erb +6 -0
- data/app/views/eventual/admin/plan_items/_plan_item.json.jbuilder +12 -0
- data/app/views/eventual/admin/plan_items/_plan_items.json.jbuilder +13 -0
- data/app/views/eventual/admin/plan_items/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/plan_items/_show_table.html.erb +20 -0
- data/app/views/eventual/admin/plan_items/index.html.erb +72 -0
- data/app/views/eventual/admin/plan_items/index.json.jbuilder +3 -0
- data/app/views/eventual/admin/plan_items/qrcode.js.erb +1 -0
- data/app/views/eventual/admin/plans/_edit_item.html.erb +24 -0
- data/app/views/eventual/admin/plans/_filter.html.erb +8 -0
- data/app/views/eventual/admin/plans/_index.html.erb +31 -0
- data/app/views/eventual/admin/plans/_plan.json.jbuilder +12 -0
- data/app/views/eventual/admin/plans/_select_table.html.erb +30 -0
- data/app/views/eventual/admin/plans/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/plans/_show_item.html.erb +22 -0
- data/app/views/eventual/admin/plans/_show_table.html.erb +20 -0
- data/app/views/eventual/admin/plans/_table.html.erb +34 -0
- data/app/views/eventual/admin/plans/calendar.js.erb +12 -0
- data/app/views/eventual/admin/plans/index.html.erb +3 -0
- data/app/views/eventual/admin/plans/index.js.erb +42 -0
- data/app/views/eventual/admin/plans/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/plans/show.html.erb +3 -0
- data/app/views/eventual/admin/seats/_breadcrumb.html.erb +0 -0
- data/app/views/eventual/admin/seats/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/seats/_filter_form.html.erb +9 -0
- data/app/views/eventual/admin/seats/_form.html.erb +4 -0
- data/app/views/eventual/admin/seats/_index_tbody.html.erb +3 -0
- data/app/views/eventual/admin/seats/_index_thead.html.erb +4 -0
- data/app/views/eventual/admin/seats/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/seats/_show_table.html.erb +12 -0
- data/app/views/eventual/admin/seats/index.html.erb +5 -0
- data/app/views/eventual/admin/time_items/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/time_items/_form.html.erb +3 -0
- data/app/views/eventual/admin/time_items/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/time_items/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/time_items/_show_table.html.erb +12 -0
- data/app/views/eventual/admin/time_items/_time_item.json.jbuilder +3 -0
- data/app/views/eventual/admin/time_items/_time_items_options.html.erb +1 -0
- data/app/views/eventual/admin/time_items/default.json.jbuilder +1 -0
- data/app/views/eventual/admin/time_items/index.json.jbuilder +1 -0
- data/app/views/eventual/admin/time_items/select.js.erb +3 -0
- data/app/views/eventual/admin/time_lists/_edit_form.html.erb +4 -0
- data/app/views/eventual/admin/time_lists/_filter.html.erb +8 -0
- data/app/views/eventual/admin/time_lists/_form.html.erb +4 -0
- data/app/views/eventual/admin/time_lists/_index_tbody.html.erb +14 -0
- data/app/views/eventual/admin/time_lists/_index_thead.html.erb +8 -0
- data/app/views/eventual/admin/time_lists/_index_tr.html.erb +13 -0
- data/app/views/eventual/admin/time_lists/_new_form.html.erb +4 -0
- data/app/views/eventual/admin/time_lists/_show.json.jbuilder +1 -0
- data/app/views/eventual/admin/time_lists/_show_table.html.erb +8 -0
- data/app/views/eventual/admin/time_lists/_time_items.html.erb +27 -0
- data/app/views/eventual/admin/time_lists/_time_list.json.jbuilder +10 -0
- data/app/views/eventual/admin/time_lists/index.html.erb +5 -0
- data/app/views/eventual/admin/time_lists/index.json.jbuilder +1 -0
- data/app/views/eventual/me/plan_items/_plan_item.json.jbuilder +14 -0
- data/app/views/eventual/me/plan_items/index.json.jbuilder +3 -0
- data/app/views/eventual/my/plans/_show_table.html.erb +32 -0
- data/app/views/eventual/my/plans/_table.html.erb +34 -0
- data/app/views/eventual/my/plans/_time_plan.json.jbuilder +8 -0
- data/app/views/eventual/my/plans/calendar.js.erb +12 -0
- data/app/views/eventual/my/plans/edit.html.erb +9 -0
- data/app/views/eventual/my/plans/edit.js.erb +3 -0
- data/app/views/eventual/my/plans/index-ready.js +11 -0
- data/app/views/eventual/my/plans/index.html.erb +26 -0
- data/app/views/eventual/my/plans/index.js +35 -0
- data/app/views/eventual/my/plans/index.json.jbuilder +1 -0
- data/app/views/eventual/my/plans/new.html.erb +9 -0
- data/app/views/eventual/my/plans/show.html.erb +7 -0
- data/app/views/eventual/my/plans/show.js.erb +12 -0
- data/app/views/eventual/my/plans/show.json.jbuilder +1 -0
- data/app/views/eventual/places/_filter_table.html.erb +11 -0
- data/app/views/eventual/places/index.html.erb +35 -0
- data/app/views/eventual/places/show.html.erb +0 -0
- data/app/views/eventual/time/_finish_at.html.erb +1 -0
- data/app/views/eventual/time/_finish_at_once.html.erb +1 -0
- data/app/views/eventual/time/_form.html.erb +15 -0
- data/app/views/eventual/time/_monthly_checkboxes.html.erb +1 -0
- data/app/views/eventual/time/_once_date.html.erb +1 -0
- data/app/views/eventual/time/_start_at.html.erb +1 -0
- data/app/views/eventual/time/_start_at_once.html.erb +1 -0
- data/app/views/eventual/time/_weekly_checkboxes.html.erb +1 -0
- data/app/views/eventual/time/index.css +5 -0
- data/app/views/eventual/time/repeat_form.js.erb +14 -0
- data/app/views/eventual/time/show.css +3 -0
- data/config/locales/en.enum.yml +8 -0
- data/config/locales/zh.attributes.yml +50 -0
- data/config/locales/zh.controller.yml +59 -0
- data/config/locales/zh.enum.yml +12 -0
- data/config/routes.rb +98 -0
- data/lib/rails_event/config.rb +13 -0
- data/lib/rails_event/engine.rb +29 -0
- data/lib/rails_event/version.rb +5 -0
- data/lib/rails_event.rb +4 -0
- metadata +346 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
module Eventual
|
2
|
+
module Model::Planning
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
has_many :plan_participants, as: :planning, dependent: :delete_all
|
7
|
+
accepts_nested_attributes_for :plan_participants
|
8
|
+
|
9
|
+
has_many :crowd_participants, as: :planning
|
10
|
+
has_many :normal_participants, as: :planning
|
11
|
+
end
|
12
|
+
|
13
|
+
def xx
|
14
|
+
crowd_participants.map do |crowd_participant|
|
15
|
+
{
|
16
|
+
id: crowd_participant.id,
|
17
|
+
participant_type: 'Profile',
|
18
|
+
participant_name: crowd_participant.crowd.name,
|
19
|
+
members: crowd_participant.crowd.members.as_json(only: [:id, :name])
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def participant_types
|
25
|
+
normal_participants.includes(:participant).group_by(&:participant_type).map do |participant_type, normal_participants|
|
26
|
+
{
|
27
|
+
participant_type: participant_type,
|
28
|
+
participant_name: PlanParticipant.enum_i18n(:participant_type, participant_type),
|
29
|
+
members: normal_participants.map do |normal_participant|
|
30
|
+
{
|
31
|
+
id: normal_participant.participant_id,
|
32
|
+
name: normal_participant.participant.name
|
33
|
+
}
|
34
|
+
end
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def all_members
|
40
|
+
xx + participant_types
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Eventual
|
2
|
+
module Model::Recurrence
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :repeat_type, :string, default: 'weekly'
|
7
|
+
attribute :repeat_count, :integer, default: 1
|
8
|
+
attribute :repeat_days, :json, default: {}
|
9
|
+
|
10
|
+
enum repeat_type: {
|
11
|
+
weekly: 'weekly',
|
12
|
+
monthly: 'monthly',
|
13
|
+
yearly: 'yearly'
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
def repeat_index(date)
|
18
|
+
case repeat_type
|
19
|
+
when 'weekly'
|
20
|
+
date.days_to_week_start.to_s
|
21
|
+
when 'monthly'
|
22
|
+
(date.day - 1).to_s
|
23
|
+
when 'yearly'
|
24
|
+
date.to_s(:date)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def next_occurring(start: Time.current, finish: start + 7.days)
|
29
|
+
(start.to_date .. finish.to_date).map do |date|
|
30
|
+
span = repeat_index(date)
|
31
|
+
yield(span, date)
|
32
|
+
end.compact
|
33
|
+
end
|
34
|
+
|
35
|
+
def next_days(start: Time.current, finish: start + 7.days)
|
36
|
+
next_occurring(start: start, finish: finish) do |span, date|
|
37
|
+
{
|
38
|
+
date.to_s => repeat_days[span]
|
39
|
+
} if repeat_days.key?(span)
|
40
|
+
end.to_combine_h
|
41
|
+
end
|
42
|
+
|
43
|
+
def next_events(start: Time.current, finish: start + 7.days)
|
44
|
+
next_occurring(start: start, finish: finish) do |span, date|
|
45
|
+
time_items.map do |i|
|
46
|
+
ext = {
|
47
|
+
title: self.plan.title,
|
48
|
+
place: self.plan.place.as_json(only: [:id], methods: [:name])
|
49
|
+
}
|
50
|
+
ext.merge! crowd: self.plan.crowd.as_json(only: [:id, :name]) if self.plan.respond_to?(:crowd)
|
51
|
+
|
52
|
+
{
|
53
|
+
id: i.id,
|
54
|
+
start: i.start_at.change(date.parts).strftime('%FT%T'),
|
55
|
+
end: i.finish_at.change(date.parts).strftime('%FT%T'),
|
56
|
+
title: "#{plan.place.name} #{self.plan.title}",
|
57
|
+
extendedProps: ext
|
58
|
+
} if Array(repeat_days[span]).include?(i.id)
|
59
|
+
end.compact if repeat_days.key?(span)
|
60
|
+
end.flatten
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Eventual
|
2
|
+
module Model::Seat
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :name, :string
|
7
|
+
attribute :min_members, :integer, default: 1
|
8
|
+
attribute :max_members, :integer
|
9
|
+
|
10
|
+
belongs_to :place, counter_cache: true
|
11
|
+
has_many :plans
|
12
|
+
|
13
|
+
validates :name, presence: true
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Eventual
|
2
|
+
module Model::TimeItem
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :position, :integer
|
7
|
+
attribute :start_at, :time
|
8
|
+
attribute :finish_at, :time
|
9
|
+
|
10
|
+
belongs_to :time_list
|
11
|
+
has_one :last_item, -> { order(finish_at: :desc) }, class_name: self.name, foreign_key: :time_list_id, primary_key: :time_list_id
|
12
|
+
|
13
|
+
validate :validate_finish_at
|
14
|
+
|
15
|
+
acts_as_list scope: :time_list_id
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate_finish_at
|
19
|
+
return if finish_at.nil? && start_at.nil?
|
20
|
+
unless finish_at > start_at
|
21
|
+
self.errors.add :finish_at, 'Finish At Should large then Start at time!'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def name
|
26
|
+
"#{start_at.to_s(:time)} ~ #{finish_at.to_s(:time)}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def init_start_at
|
30
|
+
if time_list && last_item
|
31
|
+
last_item.finish_at + time_list.interval_minutes.minutes
|
32
|
+
else
|
33
|
+
Time.current
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def init_finish_at
|
38
|
+
if time_list
|
39
|
+
self.init_start_at + time_list.item_minutes.minutes
|
40
|
+
else
|
41
|
+
self.init_start_at + 45.minutes
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Eventual
|
2
|
+
module Model::TimeList
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
attribute :name, :string
|
7
|
+
attribute :code, :string
|
8
|
+
attribute :kind, :string
|
9
|
+
attribute :item_minutes, :integer, default: 45
|
10
|
+
attribute :interval_minutes, :integer, default: 15
|
11
|
+
attribute :default, :boolean
|
12
|
+
|
13
|
+
belongs_to :organ, optional: true
|
14
|
+
has_many :time_items, -> { order(start_at: :asc) }
|
15
|
+
accepts_nested_attributes_for :time_items, allow_destroy: true
|
16
|
+
|
17
|
+
after_update :set_default, if: -> { default? && saved_change_to_default? }
|
18
|
+
end
|
19
|
+
|
20
|
+
def set_default
|
21
|
+
self.class.where.not(id: self.id).where(organ_id: self.organ_id).update_all(default: false)
|
22
|
+
end
|
23
|
+
|
24
|
+
def slot_duration
|
25
|
+
g = item_minutes.gcd(interval_minutes)
|
26
|
+
(Time.current.beginning_of_day + g.minutes).to_s(:time)
|
27
|
+
end
|
28
|
+
|
29
|
+
def slot_label_interval
|
30
|
+
g = item_minutes + interval_minutes
|
31
|
+
(Time.current.beginning_of_day + g.minutes).to_s(:time)
|
32
|
+
end
|
33
|
+
|
34
|
+
def min_time
|
35
|
+
if time_items.size > 0
|
36
|
+
time_items[0].start_at.to_s(:time)
|
37
|
+
else
|
38
|
+
'08:00'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def max_time
|
43
|
+
if time_items.size > 0
|
44
|
+
time_items[-1].finish_at.to_s(:time)
|
45
|
+
else
|
46
|
+
'18:00'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class_methods do
|
51
|
+
def default
|
52
|
+
self.find_by(default: true)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="<%= active_helper(modules: 'event/admin', active: 'menu ex-accordion is-active', item: 'menu ex-accordion is-active') %>" data-controller="menu">
|
2
|
+
<%= content_tag :div, class: 'menu-list' do %>
|
3
|
+
<%= link_to t('eventual.admin.time_lists.index.title'), { controller: 'eventual/admin/time_lists' }, class: active_helper(controllers: ['time_lists'], active: 'is-active') %>
|
4
|
+
<%= link_to t('eventual.admin.places.index.title'), { controller: 'eventual/admin/places' }, class: active_helper(controllers: ['places', 'place_taxons'], active: 'is-active') %>
|
5
|
+
<%= link_to t('eventual.admin.crowds.index.title'), { controller: 'eventual/admin/crowds' }, class: active_helper(controllers: ['crowds'], active: 'is-active') %>
|
6
|
+
<%= link_to t('eventual.admin.events.index.title'), { controller: 'eventual/admin/events' }, class: active_helper(controllers: ['events'], active: 'is-active') %>
|
7
|
+
<%= link_to t('eventual.admin.plans.index.title'), { controller: 'eventual/admin/plans' }, class: active_helper(controllers: ['plans'], active: 'is-active') -%>
|
8
|
+
<% end %>
|
9
|
+
<a class="menu-label" data-action="menu#toggle">
|
10
|
+
<i class="fas fa-cog"></i>
|
11
|
+
<span><%= t('eventual.admin.title') %></span>
|
12
|
+
<i class="fas dropdown"></i>
|
13
|
+
</a>
|
14
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li><%= link_to t('eventual.admin.events.show.title'), admin_event_path(@event), class: active_helper(id: @event.id) %></li>
|
4
|
+
<li><%= link_to t('eventual.admin.event_items.index.title'), admin_event_event_items_path(@event), class: active_helper(controllers: 'event_items') %></li>
|
5
|
+
<%# link_to 'Exam/Survey', admin_event_papers_path(event_id: @event.id), class: active_helper(controllers: 'event_papers') %>
|
6
|
+
<%# link_to 'Finished Exams', admin_event_exams_path(@event), class: active_helper(controllers: 'exams') %>
|
7
|
+
<li><%= link_to t('eventual.admin.event_participants.index.title'), admin_event_event_participants_path(@event), class: active_helper(controllers: 'event_participants') %></li>
|
8
|
+
</ul>
|
9
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.booking @booking, partial: 'booking', as: :booking
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<table class="table is-hoverable is-fullwidth">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th class="six wide">
|
5
|
+
<%= link_to t('.edit'), edit_booking_time_booking_path(@time_booking), class: 'ui mini blue right floated button' %>
|
6
|
+
</th>
|
7
|
+
<th class="ten wide"></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td class="has-text-right"><%= Booking.human_attribute_name(:time_list_id) %></td>
|
13
|
+
<td><%= @time_booking.time_list_id %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<td class="has-text-right"><%= Booking.human_attribute_name(:time_item_id) %></td>
|
17
|
+
<td><%= @time_booking.time_item_id %></td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td class="has-text-right"><%= Booking.human_attribute_name(:place_id) %></td>
|
21
|
+
<td><%= @time_booking.place_id %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td class="has-text-right"><%= Booking.human_attribute_name(:booking_on) %></td>
|
25
|
+
<td><%= @time_booking.booking_on %></td>
|
26
|
+
</tr>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<div class="ui top attached segment">
|
2
|
+
<%= render 'filter' %>
|
3
|
+
</div>>
|
4
|
+
|
5
|
+
<table class="table is-hoverable is-fullwidth">
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th><%= Eventual::Booking.human_attribute_name(:id) %></th>
|
9
|
+
<th><%= Eventual::Booking.human_attribute_name(:booking_on) %></th>
|
10
|
+
<th><%= Eventual::Booking.human_attribute_name(:time_item_id) %></th>
|
11
|
+
<th><%= Eventual::Booking.human_attribute_name(:place_id) %></th>
|
12
|
+
<th>
|
13
|
+
<%= link_to new_time_booking_path(params[:booked_type], params[:booked_id]), class: 'button is-link is-small' do %>
|
14
|
+
<i class="fas fa-plus"></i><%= t('.new') %>
|
15
|
+
<% end %>
|
16
|
+
</th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
<tbody>
|
20
|
+
<% @time_bookings.each do |time_booking| %>
|
21
|
+
<tr>
|
22
|
+
<td><%= time_booking.id %></td>
|
23
|
+
<td><%= time_booking.booking_on %></td>
|
24
|
+
<td>
|
25
|
+
<span class="ui label"><%= time_booking.time_item.start_at.to_s(:time) %></span>
|
26
|
+
<i class="yellow arrow right icon"></i>
|
27
|
+
<span class="ui label"><%= time_booking.time_item.finish_at.to_s(:time) %></span>
|
28
|
+
</td>
|
29
|
+
<td><%= time_booking.place_id %></td>
|
30
|
+
<td>
|
31
|
+
<%= link_to edit_time_booking_path(params[:booked_type], params[:booked_id], time_booking), aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light' do %>
|
32
|
+
<i class="fas fa-pencil-alt"></i>
|
33
|
+
<% end %>
|
34
|
+
<%= link_to time_booking_path(params[:booked_type], params[:booked_id], time_booking), method: :delete, aria: { label: t('.destroy') }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light' do %>
|
35
|
+
<i class="fas fa-trash-alt"></i>
|
36
|
+
<% end %>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<% end %>
|
40
|
+
</tbody>
|
41
|
+
</table>
|
42
|
+
|
43
|
+
<%= paginate @time_bookings %>
|