diff --git a/Plugin.php b/Plugin.php
index de42150..b802d7e 100644
--- a/Plugin.php
+++ b/Plugin.php
@@ -86,6 +86,22 @@ class Plugin extends PluginBase
'icon' => 'icon-leaf',
'permissions' => ['zoomyboy.event.*'],
'order' => 500,
+ 'sideMenu' => [
+ 'event' => [
+ 'label' => 'Veranstaltungen',
+ 'url' => Backend::url('zoomyboy/event/event'),
+ 'icon' => 'icon-leaf',
+ 'permissions' => ['zoomyboy.event.*'],
+ 'order' => 500,
+ ],
+ 'participant' => [
+ 'label' => 'Teilnehmer',
+ 'url' => Backend::url('zoomyboy/event/participant'),
+ 'icon' => 'icon-leaf',
+ 'permissions' => ['zoomyboy.event.*'],
+ 'order' => 500,
+ ],
+ ],
],
];
}
diff --git a/assets/eventregistration.js b/assets/eventregistration.js
index 9cb375a..706bdb8 100644
--- a/assets/eventregistration.js
+++ b/assets/eventregistration.js
@@ -13,6 +13,7 @@ export default function (toasted) {
return {
data: {
+ event_id: null,
firstname: '',
lastname: '',
address: '',
@@ -30,6 +31,7 @@ export default function (toasted) {
phone: '',
misc: '',
foto: false,
+ parent: false,
vorteam: null,
},
meta: {
@@ -52,14 +54,14 @@ export default function (toasted) {
{"id": "Divers", "name": "Divers"},
],
groups: [
- {"id": "Gallier", "name": "Gallier"},
- {"id": "Gandalf", "name": "Gandalf"},
- {"id": "Gravenrode", "name": "Gravenrode"},
- {"id": "Lennep", "name": "Lennep"},
- {"id": "Silva", "name": "Silva"},
- {"id": "Sugambrer", "name": "Sugambrer"},
- {"id": "Tenkterer", "name": "Tenkterer"},
- {"id": "von Berg", "name": "von Berg"},
+ {"id": "Gallier", "name": "Gallier (Wuppertal)"},
+ {"id": "Gandalf", "name": "Gandalf (SG-Mangenberg)"},
+ {"id": "Gravenrode", "name": "Gravenrode (SG-Gräfrath)"},
+ {"id": "Lennep", "name": "Lennep (RS-Lennep)"},
+ {"id": "Silva", "name": "Silva (SG-Wald)"},
+ {"id": "Sugambrer", "name": "Sugambrer (SG-Höhscheid)"},
+ {"id": "Tenkterer", "name": "Tenkterer (SG-Löhdorf)"},
+ {"id": "von Berg", "name": "von Berg (SG-Ohligs)"},
],
agegroups: [
{"id": "Biber", "name": "Biber"},
@@ -81,13 +83,16 @@ export default function (toasted) {
{"id": "Nein", "name": "Nein"},
],
foodPreferences: [
- {"id": "Fleisch", "name": "Fleisch"},
- {"id": "Vegan", "name": "Vegan"},
- {"id": "Glutenfrei", "name": "Glutenfrei"},
- {"id": "Laktosefrei", "name": "Laktosefrei"},
+ {"id": "Fleisch", "name": "Ich esse Fleisch"},
+ {"id": "Vegan", "name": "Ich ernähre mich vegan"},
+ {"id": "Glutenfrei", "name": "Ich vertrage kein Gluten"},
+ {"id": "Laktosefrei", "name": "Ich vertrage keine Laktose"},
]
},
methods: {
+ uuu(event) {
+ console.log(event);
+ },
hasAddress() {
return this.data.location && this.data.address && this.data.zip;
},
@@ -132,6 +137,7 @@ export default function (toasted) {
}
if (response.status === 201) {
_self.meta.finished = true;
+ _self.scrollForm(_self.$refs.form);
}
});
},
diff --git a/components/EventForm.php b/components/EventForm.php
index 221e96f..f36f3e3 100644
--- a/components/EventForm.php
+++ b/components/EventForm.php
@@ -8,10 +8,13 @@ use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Mail;
use Input;
use Winter\Storm\Support\Facades\Validator;
+use Zoomyboy\Event\Models\Event;
use Zoomyboy\Event\Models\Participant;
class EventForm extends ComponentBase
{
+ public Event $event;
+
public function componentDetails()
{
return [
@@ -22,11 +25,27 @@ class EventForm extends ComponentBase
public function defineProperties()
{
- return [];
+ return [
+ 'event_id' => [
+ 'label' => 'ID',
+ ],
+ ];
+ }
+
+ private function customInit(int $eventId)
+ {
+ $this->event = Event::findOrFail($eventId);
+ }
+
+ public function onRender()
+ {
+ $this->customInit($this->property('event_id'));
}
public function onSubmit(): JsonResponse
{
+ $this->customInit(Input::get('event_id'));
+
$rules = [
'activity' => 'required|max:255',
'gender' => 'required|max:255',
@@ -45,6 +64,7 @@ class EventForm extends ComponentBase
'food_preferences' => 'array',
'misc' => '',
'foto' => '',
+ 'parent' => 'boolean|accepted',
];
if ('Orga' === Input::get('activity')) {
@@ -53,6 +73,7 @@ class EventForm extends ComponentBase
$validator = Validator::make(Input::all(), $rules, [
'vorteam.in' => 'Bitte gebe an, ob du am Vorteam teilnehmen willst.',
+ 'parent.accepted' => 'Bitte gebe an, dass du volljährig bzw. ein Elternteil bist.',
], Lang::get('zoomyboy.event::validation.attributes'));
if ($validator->fails()) {
@@ -61,11 +82,12 @@ class EventForm extends ComponentBase
$participant = Participant::create(array_merge($validator->validated(), [
'vorteam' => 'Ja' === Input::get('vorteam'),
+ 'event_id' => $this->event->id,
]));
- // Mail::send('zoomyboy.event::mail.confirm', ['data' => $participant, 'until' => '1.9.2023', 'iban' => 'XXX', 'birthday' => $participant->birthday->format('d.m.Y')], function ($message) use ($participant) {
- // $message->to($participant->email, $participant->firstname.' '.$participant->lastname);
- // $message->subject('Deine Anmeldung fürs Bezirkslager');
- // });
+ Mail::send('zoomyboy.event::mail.confirm', ['data' => $participant, 'until' => '1.9.2023', 'iban' => 'XXX', 'birthday' => $participant->birthday->format('d.m.Y')], function ($message) use ($participant) {
+ $message->to($participant->email, $participant->firstname.' '.$participant->lastname);
+ $message->subject('Deine Anmeldung fürs Bezirkslager');
+ });
return response()->json([], 201);
}
diff --git a/components/eventform/default.htm b/components/eventform/default.htm
index e9d4f24..13f5c25 100644
--- a/components/eventform/default.htm
+++ b/components/eventform/default.htm
@@ -4,9 +4,11 @@
{% macro field(context, name, label, required, type) %}
-
+
{{label}} {% if required %} * {% endif %}
@@ -16,7 +18,7 @@
{{label}} {% if required %} * {% endif %}
@@ -30,7 +32,7 @@
{{label}} {% if required %} * {% endif %}
@@ -60,7 +62,7 @@
- {{label}}
+ {{label}} {% if required %} * {% endif %}
@@ -71,7 +73,7 @@
class="text-gray-600 flex text-sm"
>{{label}} {% if required %} * {% endif %}
-
+
@@ -86,7 +88,10 @@
{% import _self as form %}
@@ -191,6 +203,7 @@
{{ form.textarea(_context, 'misc', 'Sonstige Anmerkungen', false) }}
{{ form.yesno(_context, 'foto', 'Ich akzeptiere, dass vor Ort Foto-und Videoaufnahmen von mir gemacht werden dürfen.', false) }}
+ {{ form.yesno(_context, 'parent', 'Ich bin über 18 Jahre alt oder für die genannte Person erziehungsberechtigt.', true) }}
{% partial __SELF__.alias ~ '::navigation' last="1" %}
@@ -199,9 +212,9 @@
diff --git a/controllers/event/config_form.yaml b/controllers/event/config_form.yaml
new file mode 100644
index 0000000..286c3a5
--- /dev/null
+++ b/controllers/event/config_form.yaml
@@ -0,0 +1,31 @@
+# ===================================
+# Form Behavior Config
+# ===================================
+
+# Record name
+name: 'zoomyboy.event::lang.models.event.label'
+
+# Model Form Field configuration
+form: $/zoomyboy/event/models/event/fields.yaml
+
+# Model Class name
+modelClass: Zoomyboy\Event\Models\Event
+
+# Default redirect location
+defaultRedirect: zoomyboy/event/event
+
+# Create page
+create:
+ title: backend::lang.form.create_title
+ redirect: zoomyboy/event/event/update/:id
+ redirectClose: zoomyboy/event/event
+
+# Update page
+update:
+ title: backend::lang.form.update_title
+ redirect: zoomyboy/event/event
+ redirectClose: zoomyboy/event/event
+
+# Preview page
+preview:
+ title: backend::lang.form.preview_title
diff --git a/controllers/event/config_list.yaml b/controllers/event/config_list.yaml
new file mode 100644
index 0000000..a470767
--- /dev/null
+++ b/controllers/event/config_list.yaml
@@ -0,0 +1,50 @@
+# ===================================
+# List Behavior Config
+# ===================================
+
+# Model List Column configuration
+list: $/zoomyboy/event/models/event/columns.yaml
+
+# Model Class name
+modelClass: Zoomyboy\Event\Models\Event
+
+# List Title
+title: 'zoomyboy.event::lang.models.event.label_plural'
+
+# Link URL for each record
+recordUrl: zoomyboy/event/event/update/:id
+
+# Message to display if the list is empty
+noRecordsMessage: backend::lang.list.no_records
+
+# Records to display per page
+recordsPerPage: 20
+
+# Options to provide the user when selecting how many records to display per page
+perPageOptions: [20, 40, 80, 100, 120]
+
+# Display page numbers with pagination, disable to improve performance
+showPageNumbers: true
+
+# Displays the list column set up button
+showSetup: true
+
+# Displays the sorting link on each column
+showSorting: true
+
+# Default sorting column
+# defaultSort:
+# column: created_at
+# direction: desc
+
+# Display checkboxes next to each record
+showCheckboxes: true
+
+# Toolbar widget configuration
+toolbar:
+ # Partial for toolbar buttons
+ buttons: list_toolbar
+
+ # Search widget configuration
+ search:
+ prompt: backend::lang.list.search_prompt
diff --git a/controllers/event/create.php b/controllers/event/create.php
new file mode 100644
index 0000000..76291b5
--- /dev/null
+++ b/controllers/event/create.php
@@ -0,0 +1,48 @@
+
+
+
+
+fatalError): ?>
+
+ = Form::open(['class' => 'layout']) ?>
+
+
+ = $this->formRender() ?>
+
+
+
+
+ = Form::close() ?>
+
+
+
+
= e($this->fatalError) ?>
+
= e(trans('backend::lang.form.return_to_list')); ?>
+
+
diff --git a/controllers/event/index.php b/controllers/event/index.php
new file mode 100644
index 0000000..ea43a36
--- /dev/null
+++ b/controllers/event/index.php
@@ -0,0 +1 @@
+= $this->listRender() ?>
diff --git a/controllers/event/preview.php b/controllers/event/preview.php
new file mode 100644
index 0000000..b858413
--- /dev/null
+++ b/controllers/event/preview.php
@@ -0,0 +1,19 @@
+
+
+
+
+fatalError): ?>
+
+
+ = $this->formRenderPreview() ?>
+
+
+
+
+
= e($this->fatalError) ?>
+
= e(trans('backend::lang.form.return_to_list')); ?>
+
+
diff --git a/controllers/event/update.php b/controllers/event/update.php
new file mode 100644
index 0000000..e498990
--- /dev/null
+++ b/controllers/event/update.php
@@ -0,0 +1,56 @@
+
+
+ Event
+ = e($this->pageTitle) ?>
+
+
+
+fatalError): ?>
+
+ = Form::open(['class' => 'layout']) ?>
+
+
+ = $this->formRender() ?>
+
+
+
+
+ = Form::close() ?>
+
+
+
+
= e($this->fatalError) ?>
+
= e(trans('backend::lang.form.return_to_list')); ?>
+
+
diff --git a/lang/de/lang.php b/lang/de/lang.php
new file mode 100644
index 0000000..597d558
--- /dev/null
+++ b/lang/de/lang.php
@@ -0,0 +1,15 @@
+ [
+ 'general' => [
+ 'id' => 'ID',
+ 'created_at' => 'Created At',
+ 'updated_at' => 'Updated At',
+ ],
+ 'event' => [
+ 'label' => 'Event',
+ 'label_plural' => 'Events',
+ ],
+ ],
+];
diff --git a/models/Event.php b/models/Event.php
new file mode 100644
index 0000000..2240eb5
--- /dev/null
+++ b/models/Event.php
@@ -0,0 +1,84 @@
+ 'name'];
+
+ /**
+ * @var array Guarded fields
+ */
+ protected $guarded = ['*'];
+
+ /**
+ * @var array Fillable fields
+ */
+ protected $fillable = [];
+
+ /**
+ * @var array Validation rules for attributes
+ */
+ public $rules = [];
+
+ /**
+ * @var array Attributes to be cast to native types
+ */
+ protected $casts = [];
+
+ /**
+ * @var array Attributes to be cast to JSON
+ */
+ protected $jsonable = [];
+
+ /**
+ * @var array Attributes to be appended to the API representation of the model (ex. toArray())
+ */
+ protected $appends = [];
+
+ /**
+ * @var array Attributes to be removed from the API representation of the model (ex. toArray())
+ */
+ protected $hidden = [];
+
+ /**
+ * @var array Attributes to be cast to Argon (Carbon) instances
+ */
+ protected $dates = [
+ 'created_at',
+ 'updated_at',
+ ];
+
+ /**
+ * @var array Relations
+ */
+ public $hasOne = [];
+ public $hasMany = [];
+ public $hasOneThrough = [];
+ public $hasManyThrough = [];
+ public $belongsTo = [];
+ public $belongsToMany = [];
+ public $morphTo = [];
+ public $morphOne = [];
+ public $morphMany = [];
+ public $attachOne = [];
+ public $attachMany = [];
+
+ public static function getOptions(): array
+ {
+ return static::pluck('name', 'id')->toArray();
+ }
+}
diff --git a/models/Participant.php b/models/Participant.php
index 6158bce..536955a 100644
--- a/models/Participant.php
+++ b/models/Participant.php
@@ -67,7 +67,9 @@ class Participant extends Model
public $hasMany = [];
public $hasOneThrough = [];
public $hasManyThrough = [];
- public $belongsTo = [];
+ public $belongsTo = [
+ 'event' => [Event::class],
+ ];
public $belongsToMany = [];
public $morphTo = [];
public $morphOne = [];
diff --git a/models/event/columns.yaml b/models/event/columns.yaml
new file mode 100644
index 0000000..bd66d03
--- /dev/null
+++ b/models/event/columns.yaml
@@ -0,0 +1,8 @@
+# ===================================
+# List Column Definitions
+# ===================================
+
+columns:
+ name:
+ label: Name
+ searchable: true
diff --git a/models/event/fields.yaml b/models/event/fields.yaml
new file mode 100644
index 0000000..32b0870
--- /dev/null
+++ b/models/event/fields.yaml
@@ -0,0 +1,7 @@
+# ===================================
+# Form Field Definitions
+# ===================================
+
+fields:
+ name:
+ label: Name
diff --git a/models/participant/columns.yaml b/models/participant/columns.yaml
index 3aca0e7..f557c16 100644
--- a/models/participant/columns.yaml
+++ b/models/participant/columns.yaml
@@ -18,3 +18,7 @@ columns:
activity:
label: Funktion
+ event:
+ relation: event
+ label: Veranstaltung
+ valueFrom: name
diff --git a/models/participant/fields.yaml b/models/participant/fields.yaml
index c611f31..4117fa4 100644
--- a/models/participant/fields.yaml
+++ b/models/participant/fields.yaml
@@ -3,6 +3,7 @@
# ===================================
fields:
- id:
- label: ID
- disabled: true
+ firstname:
+ label: Vorname
+ lastname:
+ label: Nachname
diff --git a/updates/create_events_table.php b/updates/create_events_table.php
new file mode 100644
index 0000000..1f2baf0
--- /dev/null
+++ b/updates/create_events_table.php
@@ -0,0 +1,33 @@
+id();
+ $table->string('name');
+ $table->string('slug');
+ $table->timestamps();
+ });
+
+ Schema::table('zoomyboy_event_participants', function (Blueprint $table) {
+ $table->foreignId('event_id')->constrained('zoomyboy_event_events');
+ });
+ }
+
+ public function down()
+ {
+ Schema::dropIfExists('zoomyboy_event_events');
+
+ Schema::create('zoomyboy_event_participants', function (Blueprint $table) {
+ $table->dropColumn('event_id');
+ });
+ }
+}
diff --git a/updates/create_participants_table.php b/updates/create_participants_table.php
index d9d6567..ae0e6f1 100644
--- a/updates/create_participants_table.php
+++ b/updates/create_participants_table.php
@@ -11,8 +11,7 @@ class CreateParticipantsTable extends Migration
public function up()
{
Schema::create('zoomyboy_event_participants', function (Blueprint $table) {
- $table->engine = 'InnoDB';
- $table->increments('id');
+ $table->id();
$table->string('gender');
$table->string('firstname');
$table->string('lastname');
@@ -23,6 +22,7 @@ class CreateParticipantsTable extends Migration
$table->string('agegroup_leader');
$table->boolean('vorteam')->default(false);
$table->boolean('foto');
+ $table->boolean('parent');
$table->string('emergency_phone');
$table->string('address');
$table->string('zip');
diff --git a/updates/version.yaml b/updates/version.yaml
index 904ee01..a2d9743 100644
--- a/updates/version.yaml
+++ b/updates/version.yaml
@@ -1,3 +1,7 @@
1.0.1: First version of event
1.0.2:
+ - part
- create_participants_table.php
+1.0.3:
+ - event
+ - create_events_table.php