added location url option
This commit is contained in:
@@ -19,6 +19,7 @@ class Event extends Model
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'location',
|
||||
'location_url',
|
||||
'address',
|
||||
'start_at',
|
||||
'end_at',
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->string('location_url')->default('');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('events', function (Blueprint $table) {
|
||||
$table->dropColumn('location_url');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -99,11 +99,21 @@
|
||||
name="location-outline" />Location
|
||||
</h4>
|
||||
<p>
|
||||
{{
|
||||
event.location == "online"
|
||||
? "Online event"
|
||||
: event.address
|
||||
}}
|
||||
<template v-if="event.location == 'online'"
|
||||
>Online event</template
|
||||
>
|
||||
<template
|
||||
v-else-if="event.location_url.length == 0"
|
||||
>{{ event.address }}</template
|
||||
>
|
||||
<template v-else
|
||||
><a
|
||||
:href="event.location_url"
|
||||
no-follow
|
||||
target="_blank"
|
||||
>{{ event.address }}</a
|
||||
></template
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="event.ages" class="workshop-ages">
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
@failed-validation="handleFailValidation">
|
||||
<SMRow>
|
||||
<SMColumn><SMInput control="title" /></SMColumn>
|
||||
</SMRow>
|
||||
<SMRow>
|
||||
<SMColumn>
|
||||
<SMInput
|
||||
control="location"
|
||||
@@ -24,11 +22,12 @@
|
||||
physical: 'Physical',
|
||||
}" />
|
||||
</SMColumn>
|
||||
</SMRow>
|
||||
<SMRow v-if="form.controls.location.value !== 'online'">
|
||||
<SMColumn> <SMInput control="address" /></SMColumn>
|
||||
<SMColumn>
|
||||
<SMInput
|
||||
v-if="form.controls.location.value !== 'online'"
|
||||
control="address"
|
||||
/></SMColumn>
|
||||
<SMInput control="location_url" />
|
||||
</SMColumn>
|
||||
</SMRow>
|
||||
<SMRow>
|
||||
<SMColumn>
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user