This commit is contained in:
2024-04-24 19:39:33 +10:00
parent 4c9d1667b6
commit 988dbd4edc
20 changed files with 89 additions and 101 deletions

View File

@@ -3,8 +3,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers; use App\Helpers;
use App\Jobs\ProcessMedia;
use App\MediaService\MediaService;
use App\Models\Media; use App\Models\Media;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile; use Illuminate\Http\UploadedFile;

View File

@@ -1,43 +0,0 @@
<?php
namespace App\Jobs;
use App\Models\Media;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;
class ProcessMedia implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* File path
*
* @var String
*/
public $file;
/**
* Create a new job instance.
*
* @param String $file The file path
*/
public function __construct(string $file)
{
$this->file = $file;
}
/**
* Execute the job.
*/
public function handle(): void
{
if(Storage::disk('temp')->exists($this->media->name)) {
}
}
}

View File

@@ -1,6 +1,6 @@
let SM = { let SM = {
alert: (title, text, type = 'info') =>{ alert: (title, text, type = 'info') =>{
data = { const data = {
position: 'top-end', position: 'top-end',
timer: 7000, timer: 7000,
toast: true, toast: true,
@@ -26,7 +26,7 @@ let SM = {
} }
} }
copyContent(); copyContent().then(r => { /* empty */});
}, },
updateBillingAddress: () => { updateBillingAddress: () => {
@@ -70,7 +70,7 @@ let SM = {
window.location.href = response.data.redirect; window.location.href = response.data.redirect;
} }
}) })
.catch((error) => { .catch(() => {
window.location.reload(); window.location.reload();
}); });
} }
@@ -96,7 +96,6 @@ let SM = {
Swal.fire(data); Swal.fire(data);
const showError = (message) => { const showError = (message) => {
failed = true;
Swal.fire({ Swal.fire({
position: 'top', position: 'top',
icon: 'error', icon: 'error',
@@ -104,7 +103,7 @@ let SM = {
html: message, html: message,
showConfirmButton: true, showConfirmButton: true,
confirmButtonColor: '#b91c1c', confirmButtonColor: '#b91c1c',
}).then((result) => { }).then(() => {
if(callback) { if(callback) {
callback({success: false}); callback({success: false});
} }
@@ -132,9 +131,9 @@ let SM = {
formData.append('filesize', file.size); formData.append('filesize', file.size);
if (start === 0) { if (start === 0) {
formData.append('filestart', true); formData.append('filestart', 'true');
} else { } else {
formData.append('fileappend', true); formData.append('fileappend', 'true');
} }
if (title !== '') { if (title !== '') {
@@ -198,7 +197,7 @@ let SM = {
} else { } else {
showError(response.data.message); showError(response.data.message);
} }
}).catch((error) => { }).catch(() => {
showError('An error occurred while uploading the file.'); showError('An error occurred while uploading the file.');
}); });
} }
@@ -207,9 +206,14 @@ let SM = {
}, },
bytesToString: (bytes) => { bytesToString: (bytes) => {
bytes = parseInt(bytes);
if (isNaN(bytes)) {
bytes = 0;
}
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) return '0 Bytes'; if (bytes === 0) return '0 Bytes';
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); const i = Math.floor(Math.log(bytes) / Math.log(1024));
const size = parseFloat((bytes / Math.pow(1024, i)).toFixed(2)); const size = parseFloat((bytes / Math.pow(1024, i)).toFixed(2));
return size + ' ' + sizes[i]; return size + ' ' + sizes[i];
}, },

View File

@@ -30,3 +30,5 @@ php:
#Specify Qodana linter for analysis (Applied in CI/CD pipeline) #Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-php:latest linter: jetbrains/qodana-php:latest
exclude:
- name: HttpUrlsUsage

View File

@@ -29,7 +29,7 @@ export const Box = Node.create({
defining: true, defining: true,
parseHTML() { parseHTML() {
return this.options.types.map((type) => ({ return this.options.types.map((/* type */) => ({
tag: 'div', tag: 'div',
getAttrs: (node) => { getAttrs: (node) => {
// Extract the class attribute and find the type based on the class // Extract the class attribute and find the type based on the class

View File

@@ -64,14 +64,14 @@ document.addEventListener('alpine:init', () => {
Box Box
], ],
content: content, content: content,
onCreate({editor}) { onCreate({/* editor */}) {
_this.updatedAt = Date.now() _this.updatedAt = Date.now()
}, },
onUpdate({editor}) { onUpdate({editor}) {
_this.updatedAt = Date.now() _this.updatedAt = Date.now()
_this.content = editor.getHTML() _this.content = editor.getHTML()
}, },
onSelectionUpdate({editor}) { onSelectionUpdate({/* editor */}) {
_this.updatedAt = Date.now() _this.updatedAt = Date.now()
} }
}) })

View File

@@ -86,6 +86,8 @@ const SMMediaPicker = {
Alpine.store('media').pagination = []; Alpine.store('media').pagination = [];
Alpine.nextTick(() => { Alpine.nextTick(() => {
Alpine.store('media').pagination = response.data.links; Alpine.store('media').pagination = response.data.links;
}).then(r => {
/* empty */
}); });
}) })
.catch(error => { .catch(error => {

View File

@@ -23,7 +23,7 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<div class="flex-1"> <div class="flex-1">
<x-ui.input type="datetime-local" label="Publish Date" name="published_at" value="{{ \App\Helpers::timestampNoSeconds($post->published_at ?? '') }}" onchange="updateStatus(event)" /> <x-ui.input type="datetime-local" label="Publish Date" name="published_at" id="published_at" value="{{ \App\Helpers::timestampNoSeconds($post->published_at ?? '') }}" />
</div> </div>
</div> </div>
</div> </div>
@@ -71,4 +71,11 @@
} }
} }
} }
document.addEventListener('DOMContentLoaded', function() {
const publishedAt = document.getElementById('published_at');
if(publishedAt) {
publishedAt.addEventListener('change', updateStatus);
}
});
</script> </script>

View File

@@ -1,3 +1,5 @@
@props(['user'])
@php @php
$billing_same_home = $user->home_address === $user->billing_address $billing_same_home = $user->home_address === $user->billing_address
&& $user->home_address2 === $user->billing_address2 && $user->home_address2 === $user->billing_address2

View File

@@ -83,13 +83,13 @@
</div> </div>
<div class="flex-1"> <div class="flex-1">
<span x-show="registration==='link'"> <span x-show="registration==='link'">
<x-ui.input label="Registration URL" name="registration_url" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" onchange="document.getElementById('registration_data').value = event.target.value" /> <x-ui.input label="Registration URL" name="registration_url" id="registration_url" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" />
</span> </span>
<span x-show="registration==='email'"> <span x-show="registration==='email'">
<x-ui.input label="Registration Email" name="registration_email" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" onchange="document.getElementById('registration_data').value = event.target.value" /> <x-ui.input label="Registration Email" name="registration_email" id="registration_email" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" />
</span> </span>
<span x-show="registration==='message'"> <span x-show="registration==='message'">
<x-ui.input label="Registration Message" name="registration_message" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" onchange="document.getElementById('registration_data').value = event.target.value" /> <x-ui.input label="Registration Message" name="registration_message" id="registration_message" value="{{ $workshop->registration_data ?? '' }}" error="{{ $errors->first('registration_data') }}" />
</span> </span>
<input type="hidden" name="registration_data" id="registration_data" value="{{ $workshop->registration_data ?? '' }}"> <input type="hidden" name="registration_data" id="registration_data" value="{{ $workshop->registration_data ?? '' }}">
</div> </div>
@@ -145,6 +145,22 @@
} }
} }
document.addEventListener('DOMContentLoaded', function() {
const elementIds = ['registration_url', 'registration_email', 'registration_message'];
const registrationElem = document.getElementById('registration_data');
if(registrationElem) {
elementIds.forEach(id => {
const elem = document.getElementById(id);
if (elem) {
elem.addEventListener('change', function(event) {
registrationElem.value = event.target.value;
});
}
})
}
});
/* Initalize */ /* Initalize */
const elemPublishAt = document.getElementsByName('publish_at')[0]; const elemPublishAt = document.getElementsByName('publish_at')[0];
if(elemPublishAt && elemPublishAt.value === '') { if(elemPublishAt && elemPublishAt.value === '') {
@@ -152,9 +168,4 @@
document.getElementsByName('publish_at')[0].value = SM.toLocalISOString(publishAt); document.getElementsByName('publish_at')[0].value = SM.toLocalISOString(publishAt);
} }
/* Remove seconds from dates if they exist */
// document.getElementsByName('starts_at')[0].value = document.getElementsByName('starts_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1');
// document.getElementsByName('ends_at')[0].value = document.getElementsByName('ends_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1');
// document.getElementsByName('publish_at')[0].value = document.getElementsByName('publish_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1');
// document.getElementsByName('closes_at')[0].value = document.getElementsByName('closes_at')[0].value.replace(/T(\d{2}:\d{2}):\d{2}$/, 'T$1');
</script> </script>

View File

@@ -1,3 +1,3 @@
<div class="{{ twMerge('flex justify-center px-4', ($attributes->get('class') ?? '')) }}"> <div class="{{ twMerge(['flex','justify-center','px-4'], ($attributes->get('class') ?? '')) }}">
<div class="{{ twMerge('max-w-7xl w-full', ($attributes->get('inner-class') ?? '')) }}">{{ $slot }}</div> <div class="{{ twMerge(['max-w-7xl','w-full'], ($attributes->get('inner-class') ?? '')) }}">{{ $slot }}</div>
</div> </div>

View File

@@ -1,16 +1,16 @@
@php @php
$id = Str::slug($slot); $id = \Illuminate\Support\Str::slug($slot);
$uri = url()->current() . '#' . $id; $uri = url()->current() . '#' . $id;
@endphp @endphp
<a <a
id={{ $id }} id={{ $id }}
class="{{ twMerge('inline-block text-lg font-semibold my-3', $class ?? '') }}" class="{{ twMerge(['inline-block','text-lg','font-semibold my-3'], $class ?? '') }}"
x-data="{ show: false, uri: '{{ $uri }}' }" x-data="{ show: false, uri: '{{ $uri }}' }"
@mouseover="show = true" @mouseover="show = true"
@mouseout="show = false" @mouseout="show = false"
@click="SM.copyToClipboard('{{ $uri }}')" @click="SM.copyToClipboard('{{ $uri }}')"
> >
{{ $slot }} {{ $slot }}
<span x-show="show" class="text-primary-color-light pl-2">#</span> <span x-show="show" class="text-primary-color-light pl-2">#</span>
</a> </a>

View File

@@ -17,7 +17,7 @@
<div class="mb-4"> <div class="mb-4">
<div class="flex items-center"> <div class="flex items-center">
<input class="{{ twMerge('bg-white mt-1 h-8 w-8 rounded-lg border border-gray-300 appearance-none focus:outline-none focus:ring-0 focus:border-blue-600 peer border-gray-300 focus:border-indigo-300 focus:ring-indigo-300', $classes ?? '') }}" type="checkbox" {{ $checked ? 'checked' : '' }} id="{{ $name }}" name="{{ $name }}" {{ $attributes }} /> <input class="{{ twMerge(['bg-white','mt-1','h-8','w-8','rounded-lg','border','border-gray-300','appearance-none','focus:outline-none','focus:ring-0','focus:border-blue-600','peer','focus:ring-indigo-300'], $classes ?? '') }}" type="checkbox" {{ $checked ? 'checked' : '' }} id="{{ $name }}" name="{{ $name }}" {{ $attributes }} />
<label for="{{ $name }}" class="text-sm pl-2 pt-1">{{ $label }}</label> <label for="{{ $name }}" class="text-sm pl-2 pt-1">{{ $label }}</label>
</div> </div>
</div> </div>

View File

@@ -6,7 +6,7 @@
$readonly = filter_var($readonly, FILTER_VALIDATE_BOOLEAN); $readonly = filter_var($readonly, FILTER_VALIDATE_BOOLEAN);
@endphp @endphp
<div class="{{ twMerge('mb-4', $attributes->get('class')) }}"> <div class="{{ twMerge(['mb-4'], $attributes->get('class')) }}">
<div class="text-sm pl-1">{{ $label }}</div> <div class="text-sm pl-1">{{ $label }}</div>
<div class="flex flex-col align-middle items-center"> <div class="flex flex-col align-middle items-center">
<i id="{{ $name }}_placeholder" class="fa-regular fa-image text-9xl text-gray-400"></i> <i id="{{ $name }}_placeholder" class="fa-regular fa-image text-9xl text-gray-400"></i>
@@ -25,7 +25,7 @@
@endif @endif
</div> </div>
@if (!$readonly) @if (!$readonly)
<input class="hidden" value="" type="file" name="{{ $name }}" id="{{ $name }}" onchange="updatePreview(event)" /> <input class="hidden" value="" type="file" name="{{ $name }}" id="{{ $name }}" />
@endif @endif
{{-- <input class="hidden" type="text" id="{{ $name }}" name="{{ $name }}"></input>--}} {{-- <input class="hidden" type="text" id="{{ $name }}" name="{{ $name }}"></input>--}}
</div> </div>
@@ -69,6 +69,13 @@
reader.readAsDataURL(file); reader.readAsDataURL(file);
} }
document.addEventListener('DOMContentLoaded', function() {
const fileInput = document.getElementById('{{ $name }}');
if(fileInput) {
fileInput.addEventListener('change', updatePreview);
}
});
if('{{ $fileName }}' !== '' && '{{ $fileSize }}' !== '' && '{{ $fileType }}' !== '' && '{{ $fileUrl }}' !== '') { if('{{ $fileName }}' !== '' && '{{ $fileSize }}' !== '' && '{{ $fileType }}' !== '' && '{{ $fileUrl }}' !== '') {
updateDetails('{{ $fileName }}', '{{ $fileType }}', '{{ $fileSize }}', '{{ $fileUrl }}'); updateDetails('{{ $fileName }}', '{{ $fileType }}', '{{ $fileSize }}', '{{ $fileUrl }}');
} else if('{{ $value }}' !== '') { } else if('{{ $value }}' !== '') {

View File

@@ -8,7 +8,7 @@
@endphp @endphp
@if($value !== '' || $editor === true) @if($value !== '' || $editor === true)
<div x-data class="{{ twMerge('mb-4', $attributes->get('class')) }}" x-show="$store.files.length > 0 || {{ $editor === true ? 'true' : 'false' }}"> <div x-data class="{{ twMerge(['mb-4'], $attributes->get('class')) }}" x-show="$store.files.length > 0 || {{ $editor === true ? 'true' : 'false' }}">
<h3 class="text-xl font-semibold">{{ $label }}</h3> <h3 class="text-xl font-semibold">{{ $label }}</h3>
<ul x-show="$store.files.length > 0" class="flex flex-col bg-white p-4 border border-gray-300 rounded-lg gap-4 mt-2"> <ul x-show="$store.files.length > 0" class="flex flex-col bg-white p-4 border border-gray-300 rounded-lg gap-4 mt-2">
<template x-for="file in $store.files" :key="file.name"> <template x-for="file in $store.files" :key="file.name">

View File

@@ -8,7 +8,7 @@
@endphp @endphp
@if($value !== '' || $editor === true) @if($value !== '' || $editor === true)
<div x-data class="{{ twMerge('mb-4', $attributes->get('class')) }}"> <div x-data class="{{ twMerge(['mb-4'], $attributes->get('class')) }}">
@if($editor === true) @if($editor === true)
<h3 class="text-xl font-semibold">{{ $label }}</h3> <h3 class="text-xl font-semibold">{{ $label }}</h3>
<p class="text-xs italic" x-text="$store.gallery.length + ' Image' + ($store.gallery.length !== 1 ? 's' : '')"></p> <p class="text-xs italic" x-text="$store.gallery.length + ' Image' + ($store.gallery.length !== 1 ? 's' : '')"></p>

View File

@@ -1,6 +1,6 @@
@props(['image']) @props(['image'])
<div class="{{twMerge('relative w-full h-96 flex items-center justify-center bg-cover bg-center rounded-3xl overflow-hidden', $attributes->get('class'))}}"> <div class="{{twMerge(['relative','w-full','h-96','flex','items-center','justify-center','bg-cover','bg-center','rounded-3xl','overflow-hidden'], $attributes->get('class'))}}">
<div class="blur bg-cover bg-center absolute top-0 left-0 w-full h-full opacity-50" style="background-image: url('{{ $image }}?lg')"></div> <div class="blur bg-cover bg-center absolute top-0 left-0 w-full h-full opacity-50" style="background-image: url('{{ $image }}?lg')"></div>
<img src="{{ $image }}?lg" class="h-full z-0" /> <img src="{{ $image }}?lg" class="h-full z-0" />
</div> </div>

View File

@@ -10,31 +10,31 @@
$value = old($name, $value); $value = old($name, $value);
@endphp @endphp
<div class="{{ twMerge('mb-4', $attributes->get('class')) }}"> <div class="{{ twMerge(['mb-4'], $attributes->get('class')) }}">
@if($floating) @if($floating)
<div class="relative"> <div class="relative">
@if($type === 'textarea') @if($type === 'textarea')
<textarea class="{{ twMerge('pt-4', $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }}>{{ $value }}</textarea> <textarea class="{{ twMerge(['pt-4'], $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }}>{{ $value }}</textarea>
@else @else
<input class="{{ twMerge('pt-4', $classes) }}" autocomplete="off" placeholder=" " value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} /> <input class="{{ twMerge(['pt-4'], $classes) }}" autocomplete="off" placeholder=" " value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} />
@endif @endif
<label for="{{ $name }}" class="absolute text-sm text-gray-500 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto start-1">{{ $label }}</label> <label for="{{ $name }}" class="absolute text-sm text-gray-500 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto start-1">{{ $label }}</label>
</div> </div>
@elseif($noLabel) @elseif($noLabel)
<div class="relative"> <div class="relative">
@if($type === 'textarea') @if($type === 'textarea')
<textarea class="{{ twMerge('pt-2.5', $classes) }}" name="{{ $name }}" placeholder="{{ $label }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }}>{{ $value }}</textarea> <textarea class="{{ twMerge(['pt-2.5'], $classes) }}" name="{{ $name }}" placeholder="{{ $label }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }}>{{ $value }}</textarea>
@else @else
<input class="{{ twMerge('pt-2.5', $classes) }}" autocomplete="off" placeholder="{{ $label }}" value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} /> <input class="{{ twMerge(['pt-2.5'], $classes) }}" autocomplete="off" placeholder="{{ $label }}" value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} />
@endif @endif
</div> </div>
@else @else
<div> <div>
<label for="{{ $name }}" class="block text-sm pl-1">{{ $label }}{!! isset($labelNotice) && $labelNotice !== '' ? '<i class="fa-solid fa-triangle-exclamation ml-1 text-gray-500 hover:text-black" data-tooltip="' . $labelNotice . '"></i>' : '' !!}</label> <label for="{{ $name }}" class="block text-sm pl-1">{{ $label }}{!! isset($labelNotice) && $labelNotice !== '' ? '<i class="fa-solid fa-triangle-exclamation ml-1 text-gray-500 hover:text-black" data-tooltip="' . $labelNotice . '"></i>' : '' !!}</label>
@if($type === 'textarea') @if($type === 'textarea')
<textarea class="{{ twMerge('pt-2.5 mt-1 h-96', $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes->whereDoesntStartWith('x-') }}>{{ $value }}</textarea> <textarea class="{{ twMerge(['pt-2.5','mt-1','h-96'], $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes->whereDoesntStartWith('x-') }}>{{ $value }}</textarea>
@else @else
<input class="{{ twMerge('pt-2.5 mt-1', $classes) }}" autocomplete="off" placeholder=" " value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} /> <input class="{{ twMerge(['pt-2.5','mt-1'], $classes) }}" autocomplete="off" placeholder=" " value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} />
@endif @endif
</div> </div>
@endif @endif

View File

@@ -4,7 +4,7 @@
$hasError = $errors->has($name); $hasError = $errors->has($name);
@endphp @endphp
<div class="{{ twMerge('mb-4', $attributes->get('class')) }}"> <div class="{{ twMerge(['mb-4'], $attributes->get('class')) }}">
<div class="text-sm pl-1">{{ $label }}</div> <div class="text-sm pl-1">{{ $label }}</div>
<div class="flex flex-col align-middle items-center"> <div class="flex flex-col align-middle items-center">
<i id="{{ $name }}_placeholder" class="fa-regular fa-image text-9xl text-gray-400"></i> <i id="{{ $name }}_placeholder" class="fa-regular fa-image text-9xl text-gray-400"></i>
@@ -27,8 +27,6 @@
function updateMedia(name, value) { function updateMedia(name, value) {
document.getElementById(name).value = value; document.getElementById(name).value = value;
SM.mediaDetails(value, (details) => { SM.mediaDetails(value, (details) => {
const extension = details.name.split('.').pop();
document.getElementById(name + '_name').innerText = details.name; document.getElementById(name + '_name').innerText = details.name;
document.getElementById(name + '_size').innerText = SM.bytesToString(details.size); document.getElementById(name + '_size').innerText = SM.bytesToString(details.size);

View File

@@ -5,20 +5,20 @@
$value = old($name, $value); $value = old($name, $value);
@endphp @endphp
<div class="{{ twMerge('mb-4', $attributes->get('class')) }} {{ $attributes->only('x-show') }}"> <div class="{{ twMerge(['mb-4'], $attributes->get('class')) }} {{ $attributes->only('x-show') }}">
@if($floating) @if($floating)
<div class="relative"> <div class="relative">
@if($type === 'textarea') @if($type === 'textarea')
<textarea class="{{ twMerge('pt-4', $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes->except(['x-show','style']) }}>{{ $value }}</textarea> <textarea class="{{ twMerge(['pt-4'], $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes->except(['x-show','style']) }}>{{ $value }}</textarea>
@else @else
<input class="{{ twMerge('pt-4', $classes) }}" autocomplete="off" placeholder=" " value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} /> <input class="{{ twMerge(['pt-4'], $classes) }}" autocomplete="off" placeholder=" " value="{{ $value }}" type="{{ $type }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes }} />
@endif @endif
<label for="{{ $name }}" class="absolute text-sm text-gray-500 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto start-1">{{ $label }}</label> <label for="{{ $name }}" class="absolute text-sm text-gray-500 duration-300 transform -translate-y-4 scale-75 top-2 z-10 origin-[0] bg-white px-2 peer-focus:px-2 peer-focus:text-blue-600 peer-placeholder-shown:scale-100 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:top-1/2 peer-focus:top-2 peer-focus:scale-75 peer-focus:-translate-y-4 rtl:peer-focus:translate-x-1/4 rtl:peer-focus:left-auto start-1">{{ $label }}</label>
</div> </div>
@else @else
<div class="relative"> <div class="relative">
<label for="{{ $name }}" class="block text-sm pl-1">{{ $label }}</label> <label for="{{ $name }}" class="block text-sm pl-1">{{ $label }}</label>
<select class="{{ twMerge('pt-2.5', $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes->except(['x-show','style']) }}> <select class="{{ twMerge(['pt-2.5'], $classes) }}" name="{{ $name }}" {{ $readonly ? 'readonly' : '' }} {{ $attributes->except(['x-show','style']) }}>
{{ $slot }} {{ $slot }}
</select> </select>
<i class="fa-solid fa-caret-down absolute text-gray-700 text-2xl right-3 bottom-1.5"></i> <i class="fa-solid fa-caret-down absolute text-gray-700 text-2xl right-3 bottom-1.5"></i>