From 0de47b31045ab9bfd18e1dd8cd91badea5bbc104 Mon Sep 17 00:00:00 2001 From: James Collins Date: Tue, 9 May 2023 10:58:51 +1000 Subject: [PATCH] added location url option --- app/Models/Event.php | 1 + ...5_09_003156_add_location_url_to_events.php | 32 +++++++++++++++++++ resources/js/helpers/api.types.ts | 1 + resources/js/views/Event.vue | 20 +++++++++--- resources/js/views/dashboard/EventEdit.vue | 14 ++++---- 5 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 database/migrations/2023_05_09_003156_add_location_url_to_events.php diff --git a/app/Models/Event.php b/app/Models/Event.php index 895736a..77d3822 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -19,6 +19,7 @@ class Event extends Model protected $fillable = [ 'title', 'location', + 'location_url', 'address', 'start_at', 'end_at', diff --git a/database/migrations/2023_05_09_003156_add_location_url_to_events.php b/database/migrations/2023_05_09_003156_add_location_url_to_events.php new file mode 100644 index 0000000..b8c5289 --- /dev/null +++ b/database/migrations/2023_05_09_003156_add_location_url_to_events.php @@ -0,0 +1,32 @@ +string('location_url')->default(''); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('events', function (Blueprint $table) { + $table->dropColumn('location_url'); + }); + } +}; diff --git a/resources/js/helpers/api.types.ts b/resources/js/helpers/api.types.ts index b3c0589..90b7ed3 100644 --- a/resources/js/helpers/api.types.ts +++ b/resources/js/helpers/api.types.ts @@ -9,6 +9,7 @@ export interface Event { end_at: string; publish_at: string; location: string; + location_url: string; address: string; status: string; registration_type: string; diff --git a/resources/js/views/Event.vue b/resources/js/views/Event.vue index 9f88696..d2d0053 100644 --- a/resources/js/views/Event.vue +++ b/resources/js/views/Event.vue @@ -99,11 +99,21 @@ name="location-outline" />Location

- {{ - event.location == "online" - ? "Online event" - : event.address - }} + + +

diff --git a/resources/js/views/dashboard/EventEdit.vue b/resources/js/views/dashboard/EventEdit.vue index 7a4d9de..5f89541 100644 --- a/resources/js/views/dashboard/EventEdit.vue +++ b/resources/js/views/dashboard/EventEdit.vue @@ -13,8 +13,6 @@ @failed-validation="handleFailValidation"> - - + + + - + + @@ -217,6 +216,7 @@ let form = reactive( : true; }) ), + location_url: FormControl("", Url()), start_at: FormControl("", And([Required(), DateTime()])), end_at: FormControl( "", @@ -282,6 +282,7 @@ const loadData = async () => { form.controls.title.value = data.event.title; form.controls.location.value = data.event.location; + form.controls.location_url.value = data.event.location_url; form.controls.address.value = data.event.address ? data.event.address : ""; @@ -327,6 +328,7 @@ const handleSubmit = async () => { let data = { title: form.controls.title.value, location: form.controls.location.value, + location_url: form.controls.location_url.value, address: form.controls.address.value, start_at: new SMDate(form.controls.start_at.value, { format: "dmy",