mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
update bindle form
This commit is contained in:
@@ -29,11 +29,14 @@ class LibraryItemForm extends Component
|
|||||||
|
|
||||||
public bool $lecturer = false;
|
public bool $lecturer = false;
|
||||||
|
|
||||||
|
public bool $isBindle = false;
|
||||||
|
|
||||||
public ?string $fromUrl = '';
|
public ?string $fromUrl = '';
|
||||||
|
|
||||||
protected $queryString = [
|
protected $queryString = [
|
||||||
'fromUrl' => ['except' => ''],
|
'fromUrl' => ['except' => ''],
|
||||||
'lecturer' => ['except' => false],
|
'lecturer' => ['except' => false],
|
||||||
|
'isBindle' => ['except' => false],
|
||||||
];
|
];
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
@@ -57,7 +60,13 @@ class LibraryItemForm extends Component
|
|||||||
&& $this->libraryItem->type !== LibraryItemType::DownloadableFile(), ['url']
|
&& $this->libraryItem->type !== LibraryItemType::DownloadableFile(), ['url']
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
'libraryItem.subtitle' => 'required',
|
'libraryItem.subtitle' =>
|
||||||
|
[
|
||||||
|
Rule::when(
|
||||||
|
$this->libraryItem->type !== 'bindle',
|
||||||
|
'required',
|
||||||
|
)
|
||||||
|
],
|
||||||
'libraryItem.excerpt' =>
|
'libraryItem.excerpt' =>
|
||||||
[
|
[
|
||||||
Rule::when(
|
Rule::when(
|
||||||
@@ -95,7 +104,7 @@ class LibraryItemForm extends Component
|
|||||||
$this->libraryItem = new LibraryItem([
|
$this->libraryItem = new LibraryItem([
|
||||||
'approved' => true,
|
'approved' => true,
|
||||||
'read_time' => 1,
|
'read_time' => 1,
|
||||||
'value' => '',
|
'value' => ''
|
||||||
]);
|
]);
|
||||||
if ($this->lecturer) {
|
if ($this->lecturer) {
|
||||||
$this->library = Library::query()
|
$this->library = Library::query()
|
||||||
@@ -114,6 +123,13 @@ class LibraryItemForm extends Component
|
|||||||
if (!$this->fromUrl) {
|
if (!$this->fromUrl) {
|
||||||
$this->fromUrl = url()->previous();
|
$this->fromUrl = url()->previous();
|
||||||
}
|
}
|
||||||
|
if ($this->isBindle) {
|
||||||
|
$this->library = 21;
|
||||||
|
$this->libraryItem->lecturer_id = 125;
|
||||||
|
$this->libraryItem->type = 'bindle';
|
||||||
|
$this->libraryItem->language_code = 'de';
|
||||||
|
$this->selectedTags = ['Bindle'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="py-6">
|
<div class="py-6">
|
||||||
@if(auth()->id() == config('portal.bonus.fiat-tracker-user-id'))
|
@if(auth()->id() == config('portal.bonus.fiat-tracker-user-id'))
|
||||||
<x-button icon="plus"
|
<x-button icon="plus"
|
||||||
:href="route('library.libraryItem.form', ['country' => 'de'])">
|
:href="route('library.libraryItem.form', ['country' => 'de', 'isBindle' => true])">
|
||||||
{{ __('Neues Bindle hochladen') }}
|
{{ __('Neues Bindle hochladen') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -133,38 +133,43 @@
|
|||||||
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror
|
@error('image') <span class="text-red-500">{{ $message }}</span> @enderror
|
||||||
</x-input.group>
|
</x-input.group>
|
||||||
|
|
||||||
<x-input.group :for="md5('libraryItem.main_image_caption')" :label="__('Main image caption')">
|
@if(!$isBindle)
|
||||||
<x-input autocomplete="off" wire:model.debounce="libraryItem.main_image_caption"
|
<x-input.group :for="md5('libraryItem.main_image_caption')"
|
||||||
:placeholder="__('Main image caption')"
|
:label="__('Main image caption')">
|
||||||
:cornerHint="__('Ex: Photo by Timothy Vollmer/ CC BY')"/>
|
<x-input autocomplete="off" wire:model.debounce="libraryItem.main_image_caption"
|
||||||
</x-input.group>
|
:placeholder="__('Main image caption')"
|
||||||
|
:cornerHint="__('Ex: Photo by Timothy Vollmer/ CC BY')"/>
|
||||||
|
</x-input.group>
|
||||||
|
@endif
|
||||||
|
|
||||||
<x-input.group :for="md5('libraryItem.name')" :label="__('Title')">
|
<x-input.group :for="md5('libraryItem.name')" :label="__('Title')">
|
||||||
<x-input autocomplete="off" wire:model.debounce="libraryItem.name"
|
<x-input autocomplete="off" wire:model.debounce="libraryItem.name"
|
||||||
:placeholder="__('Title')"/>
|
:placeholder="__('Title')"/>
|
||||||
</x-input.group>
|
</x-input.group>
|
||||||
|
|
||||||
<x-input.group :for="md5('libraryItem.subtitle')" :label="__('Subtitle')">
|
@if(!$isBindle)
|
||||||
<x-input autocomplete="off" wire:model.debounce="libraryItem.subtitle"
|
<x-input.group :for="md5('libraryItem.subtitle')" :label="__('Subtitle')">
|
||||||
:placeholder="__('Subtitle')"/>
|
<x-input autocomplete="off" wire:model.debounce="libraryItem.subtitle"
|
||||||
</x-input.group>
|
:placeholder="__('Subtitle')"/>
|
||||||
|
</x-input.group>
|
||||||
|
|
||||||
<x-input.group :for="md5('libraryItem.excerpt')" :label="__('Excerpt')">
|
<x-input.group :for="md5('libraryItem.excerpt')" :label="__('Excerpt')">
|
||||||
<x-textarea autocomplete="off" wire:model.debounce="libraryItem.excerpt"
|
<x-textarea autocomplete="off" wire:model.debounce="libraryItem.excerpt"
|
||||||
:placeholder="__('Excerpt')"/>
|
:placeholder="__('Excerpt')"/>
|
||||||
</x-input.group>
|
</x-input.group>
|
||||||
|
|
||||||
<x-input.group :for="md5('libraryItem.language_code')" :label="__('Language Code')">
|
<x-input.group :for="md5('libraryItem.language_code')" :label="__('Language Code')">
|
||||||
<x-select
|
<x-select
|
||||||
placeholder="{{ __('Choose language') }}"
|
placeholder="{{ __('Choose language') }}"
|
||||||
wire:model="libraryItem.language_code"
|
wire:model="libraryItem.language_code"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:searchable="true"
|
:searchable="true"
|
||||||
:async-data="route('api.languages.index')"
|
:async-data="route('api.languages.index')"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="language"
|
option-value="language"
|
||||||
/>
|
/>
|
||||||
</x-input.group>
|
</x-input.group>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if($libraryItem->type === App\Enums\LibraryItemType::MarkdownArticleExtern())
|
@if($libraryItem->type === App\Enums\LibraryItemType::MarkdownArticleExtern())
|
||||||
<x-input.group :for="md5('libraryItem.value')" :label="__('Article as Markdown')">
|
<x-input.group :for="md5('libraryItem.value')" :label="__('Article as Markdown')">
|
||||||
@@ -186,10 +191,13 @@
|
|||||||
</x-input.group>
|
</x-input.group>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<x-input.group :for="md5('libraryItem.read_time')" :label="__('Time to read')">
|
@if(!$isBindle)
|
||||||
<x-inputs.number min="1" autocomplete="off" wire:model.debounce="libraryItem.read_time"
|
<x-input.group :for="md5('libraryItem.read_time')" :label="__('Time to read')">
|
||||||
:placeholder="__('Time to read')" :hint="__('How many minutes to read?')"/>
|
<x-inputs.number min="1" autocomplete="off" wire:model.debounce="libraryItem.read_time"
|
||||||
</x-input.group>
|
:placeholder="__('Time to read')"
|
||||||
|
:hint="__('How many minutes to read?')"/>
|
||||||
|
</x-input.group>
|
||||||
|
@endif
|
||||||
|
|
||||||
<x-input.group :for="md5('meetupEvent.link')" label="">
|
<x-input.group :for="md5('meetupEvent.link')" label="">
|
||||||
<x-button primary wire:click="save">
|
<x-button primary wire:click="save">
|
||||||
|
|||||||
Reference in New Issue
Block a user