WIP
This commit is contained in:
48
resources/views/album/show.blade.php
Normal file
48
resources/views/album/show.blade.php
Normal file
@@ -0,0 +1,48 @@
|
||||
@push('menu')
|
||||
<x-menu-action tooltip="Einstellungen">
|
||||
<svg class="w-5 h-5 mb-1 text-gray-500 dark:text-gray-400 group-hover:text-blue-600 dark:group-hover:text-blue-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12.25V1m0 11.25a2.25 2.25 0 0 0 0 4.5m0-4.5a2.25 2.25 0 0 1 0 4.5M4 19v-2.25m6-13.5V1m0 2.25a2.25 2.25 0 0 0 0 4.5m0-4.5a2.25 2.25 0 0 1 0 4.5M10 19V7.75m6 4.5V1m0 11.25a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM16 19v-2"/>
|
||||
</svg>
|
||||
</x-menu-action>
|
||||
<div class="flex items-center justify-center">
|
||||
<x-drawer-trigger target="image-add" action="open">
|
||||
<button data-tooltip-target="tooltip-new" type="button" class="inline-flex items-center justify-center w-10 h-10 font-medium bg-blue-600 rounded-full hover:bg-blue-700 group focus:ring-4 focus:ring-blue-300 focus:outline-none dark:focus:ring-blue-800">
|
||||
<svg class="w-4 h-4 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 18">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 1v16M1 9h16"/>
|
||||
</svg>
|
||||
<span class="sr-only">Add Images</span>
|
||||
</button>
|
||||
</x-drawer-trigger>
|
||||
</div>
|
||||
<div id="tooltip-new" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
|
||||
Add images
|
||||
<div class="tooltip-arrow" data-popper-arrow></div>
|
||||
</div>
|
||||
@endpush
|
||||
|
||||
<x-layout>
|
||||
<x-hero-search></x-hero-search>
|
||||
<h1 class="mb-4 mx-8 text-4xl font-extrabold leading-none tracking-tight text-gray-900 md:text-5xl lg:text-6xl dark:text-white">
|
||||
{{ $album->name }}
|
||||
</h1>
|
||||
<div class="m-8 flex flex-wrap flex-row gap-4">
|
||||
@foreach ($album->images as $image)
|
||||
<figure class="relative group rounded-lg cursor-pointer h-80 flex-grow overflow-hidden">
|
||||
<img class="max-h-full min-w-full align-bottom object-cover"
|
||||
src="{{ $image->getThumbnail() }}" alt="{{ $album->name }} Bild">
|
||||
<div class="opacity-0 group-hover:opacity-40 absolute inset-0 w-full h-full bg-black flex items-center justify-center transition-opacity">
|
||||
<svg class="w-1/2 h-1/2 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
|
||||
<path stroke="currentColor" stroke-width="2" d="M21 12c0 1.2-4.03 6-9 6s-9-4.8-9-6c0-1.2 4.03-6 9-6s9 4.8 9 6Z"/>
|
||||
<path stroke="currentColor" stroke-width="2" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/>
|
||||
</svg>
|
||||
</div>
|
||||
</figure>
|
||||
@endforeach
|
||||
</div>
|
||||
<x-drawer name="image-add" >
|
||||
<x-slot:title>Neue Bilder zu {{ $album->name }} hinzufügen</x-slot:title>
|
||||
<x-slot:content>
|
||||
<livewire:drawer.album.addImage></livewire:drawer.album.addImage>
|
||||
</x-slot:content>
|
||||
</x-drawer>
|
||||
</x-layout>
|
||||
20
resources/views/components/form/input.blade.php
Normal file
20
resources/views/components/form/input.blade.php
Normal file
@@ -0,0 +1,20 @@
|
||||
@props([
|
||||
'name' => 'undefined',
|
||||
'label' => 'Undefined',
|
||||
'type' => 'text',
|
||||
'placeholder' => '',
|
||||
])
|
||||
|
||||
<div class="mb-5">
|
||||
<label for="{{ $name }}" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ $label }}</label>
|
||||
<input type="{{ $type }}" id="{{ $name }}"
|
||||
@class([
|
||||
'border text-sm rounded-lg block w-full p-2.5',
|
||||
'bg-red-50 border-red-500 text-red-900 placeholder-red-700 focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500' => $errors->has($name),
|
||||
'bg-gray-50 border-gray-300 text-gray-900 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500' => !$errors->has($name),
|
||||
])
|
||||
placeholder="{{ $placeholder }}" {{ $attributes }} />
|
||||
@error($name)
|
||||
<p class="mt-2 text-sm text-red-600 dark:text-red-500"><span class="font-medium">Oops!</span> {{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
123
resources/views/components/form/upload.blade.php
Normal file
123
resources/views/components/form/upload.blade.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<div
|
||||
class="relative xl:min-w-[1000px]"
|
||||
wire:ignore
|
||||
x-cloak
|
||||
x-data="{
|
||||
model: @entangle($attributes->whereStartsWith('wire:model')->first()),
|
||||
isMultiple: {{ $multiple ? 'true' : 'false' }},
|
||||
current: undefined,
|
||||
currentList: [],
|
||||
async URLtoFile(path) {
|
||||
let url = `${window.appUrlStorage}/${path}`;
|
||||
let name = url.split('/').pop();
|
||||
const response = await fetch(url);
|
||||
const data = await response.blob();
|
||||
const metadata = {
|
||||
name: name,
|
||||
size: data.size,
|
||||
type: data.type
|
||||
};
|
||||
let file = new File([data], name, metadata);
|
||||
return {
|
||||
source: file,
|
||||
options: {
|
||||
type: 'local',
|
||||
metadata: {
|
||||
name: name,
|
||||
size: file.size,
|
||||
type: file.type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}"
|
||||
x-init="async () => {
|
||||
let picture = model;
|
||||
let files = [];
|
||||
let exists = [];
|
||||
if (model) {
|
||||
if (isMultiple) {
|
||||
currentList = model.map((picture) => `${window.appUrlStorage}/${picture}`);
|
||||
await Promise.all(model.map(async (picture) => exists.push(await URLtoFile(picture))));
|
||||
} else {
|
||||
if (picture) {
|
||||
exists.push(await URLtoFile(picture));
|
||||
}
|
||||
}
|
||||
}
|
||||
files = exists;
|
||||
let modelName = '{{ $attributes->whereStartsWith('wire:model')->first() }}';
|
||||
|
||||
const pond = FilePond.create($refs.{{ $attributes->get('ref') ?? 'input' }}, { credits: false});
|
||||
|
||||
const uploadWatcher = () => {
|
||||
$store.uploader.setState('{{ $name }}', pond.status);
|
||||
}
|
||||
|
||||
pond.setOptions({
|
||||
allowMultiple: {{ $multiple ? 'true' : 'false' }},
|
||||
server: {
|
||||
process: (fieldName, file, metadata, load, error, progress, abort, transfer, options) => {
|
||||
@this.upload(modelName, file, load, error, progress)
|
||||
},
|
||||
revert: (filename, load) => {
|
||||
@this.removeUpload(modelName, filename, load)
|
||||
},
|
||||
remove: (filename, load) => {
|
||||
@this.removeFile(modelName, filename.name)
|
||||
load();
|
||||
},
|
||||
},
|
||||
allowImagePreview: {{ $preview ? 'true' : 'false' }},
|
||||
styleItemPanelAspectRatio: '0.5625',
|
||||
allowFileTypeValidation: {{ $validate ? 'true' : 'false' }},
|
||||
acceptedFileTypes: {{ $accept ? $accept : 'null' }},
|
||||
allowFileSizeValidation: {{ $validate ? 'true' : 'false' }},
|
||||
maxFileSize: {!! $size ? "'" . $size . "'" : 'null' !!},
|
||||
maxFiles: {{ $number ? $number : 'null' }},
|
||||
required: {{ $required ? 'true' : 'false' }},
|
||||
disabled: {{ $disabled ? 'true' : 'false' }},
|
||||
onaddfilestart: uploadWatcher,
|
||||
onprocessfile: uploadWatcher
|
||||
});
|
||||
pond.addFiles(files);
|
||||
pond.on('addfile', (error, file) => {
|
||||
if (error) {
|
||||
console.log('Oh no');
|
||||
return;
|
||||
}
|
||||
});
|
||||
uploadWatcher();
|
||||
}"
|
||||
>
|
||||
@if ($label)
|
||||
<div class="flex items-center justify-between">
|
||||
<label class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-100"
|
||||
for="{{ $name }}"
|
||||
>
|
||||
{{ $label }}
|
||||
@if ($required)
|
||||
<span class="text-red-500" title="Required">*</span>
|
||||
@endif
|
||||
</label>
|
||||
<div class="text-xs text-gray-400">Size max: {{ $sizeHuman }}</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="flex items-center justify-between text-xs text-gray-400">
|
||||
<div>Formats: {{ $acceptHuman }}</div>
|
||||
<div>
|
||||
{{ $multiple ? 'Multiple' : 'Single' }}
|
||||
@if ($multiple)
|
||||
<span>({{ $number }} files max)</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<input type="file"
|
||||
x-ref="{{ $attributes->get('ref') ?? 'input' }}"
|
||||
/>
|
||||
</div>
|
||||
@error('image')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
21
resources/views/livewire/drawer/album/add-image.blade.php
Normal file
21
resources/views/livewire/drawer/album/add-image.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<form wire:submit="save" class="p-4">
|
||||
<x-form.upload wire:model="media" name="media" label="Medien" multiple />
|
||||
|
||||
<button x-show="$store.uploader.states && $store.uploader.states.media == 3" disabled type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center me-2 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 inline-flex items-center">
|
||||
<svg aria-hidden="true" role="status" class="inline w-4 h-4 me-3 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
|
||||
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
|
||||
</svg>
|
||||
Bitte warten ...
|
||||
</button>
|
||||
<div x-show="$store.uploader.states && $store.uploader.states.media == 2" class="flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
|
||||
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
|
||||
</svg>
|
||||
<span class="sr-only">Info</span>
|
||||
<div>
|
||||
<span class="font-medium">Dateien mit Fehlern vorhanden!</span> Du kannst nicht speichern, bis die Fehler behoben sind.
|
||||
</div>
|
||||
</div>
|
||||
<button x-show="$store.uploader.states && $store.uploader.states.media == 4" type="submit" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Speichern</button>
|
||||
</div>
|
||||
14
resources/views/livewire/drawer/album/create.blade.php
Normal file
14
resources/views/livewire/drawer/album/create.blade.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<div>
|
||||
<form class="p-4" wire:submit="save">
|
||||
<x-form.input name="name" label="Name" wire:model="name" required/>
|
||||
<x-form.input name="capture_date_string" label="Aufnahmedatum" type="date" wire:model="capture_date_string" required />
|
||||
|
||||
<button type="submit"
|
||||
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Abbrechen</button>
|
||||
|
||||
<button type="submit"
|
||||
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Speichern</button>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user