Snapshot of main at 9f39a6e1e (2026-11-02)

This commit is contained in:
Ronald Huynen committed 2026-11-02 10:41:47 +01:00
commit 6ccf1792d7
2580 files changed
+1040202

No files matched your search

@@ -0,0 +1,215 @@
<div>
<x-jetstream.button
wire:click.prevent="openModal()"
class="bg-theme-brand hover:bg-opacity-80">
{{ __('New Call') }}
</x-jetstream.button>
{{-- No credits modal --}}
<x-jetstream.dialog-modal wire:model.live="showNoCreditsModal" wire:key="showCallNoCreditsModal" closeButton="true">
<x-slot name="title">
{{ trans_with_platform('Post a @PLATFORM_NAME@ call') }}
</x-slot>
<x-slot name="content">
@if ($spendableBalance !== null)
<div class="mb-4 text-sm text-theme-secondary">
{{ __('Current balance total') }}: <span class="font-semibold text-theme-primary">{{ tbFormat($spendableBalance) }}</span>
</div>
@endif
@livewire('static-post', ['type' => 'SiteContents\\Call\\NotAllowed', 'limit' => 1, 'hideAuthor' => true, 'fallbackText' => trans_with_platform('You need @PLATFORM_CURRENCY_NAME_PLURAL@ to post a call.')])
</x-slot>
<x-slot name="footer">
<x-jetstream.button wire:click="$set('showNoCreditsModal', false)">
{{ __('OK') }}
</x-jetstream.button>
</x-slot>
</x-jetstream.dialog-modal>
@if ($showModal)
<x-jetstream.dialog-modal wire:model="showModal" wire:key="showCallModal" closeButton="true">
<x-slot name="title">
{{ trans_with_platform('Post a @PLATFORM_NAME@ call') }}
</x-slot>
<x-slot name="content">
<div class="space-y-6">
{{-- Tag picker (dedicated component) --}}
<livewire:calls.call-skill-input wire:key="call-skill-input" />
@error('tagId')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
{{-- Content --}}
@php $contentMax = timebank_config('calls.content_max_input', 200); @endphp
<div wire:key="call-content"
x-data="{ remaining: {{ $contentMax - mb_strlen($content) }} }"
x-init="$nextTick(() => { const ta = $el.querySelector('textarea'); if (ta) { ta.addEventListener('input', () => { remaining = {{ $contentMax }} - ta.value.length; }); } })">
<label class="block text-sm text-theme-primary mb-2">
{{ __('Description') }}
<span class="text-theme-secondary text-xs ml-1" x-text="remaining + ' {{ __('characters left') }}'"></span>
</label>
<x-textarea
placeholder="{{ __('Describe your request in more detail...') }}"
rows="4"
maxlength="{{ $contentMax }}"
class="!text-base"
wire:model.blur="content" />
@error('content')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
{{-- Description translations (only if the selected tag has other-language translations) --}}
@if(!empty($this->remainingTagLocales) || !empty($translationContents))
<div wire:key="call-translations" class="space-y-4">
@foreach($translationContents as $locale => $text)
<div wire:key="call-translation-{{ $locale }}">
<div class="flex items-center justify-between mb-2">
<label class="block text-sm text-theme-primary">
{{ __('Description in :language', ['language' => __('messages.' . $locale)]) }}
</label>
<button type="button" wire:click="removeTranslation('{{ $locale }}')" class="text-xs text-red-600 hover:underline">
{{ __('Remove') }}
</button>
</div>
<x-textarea
rows="4"
maxlength="{{ $contentMax }}"
class="!text-base"
wire:model="translationContents.{{ $locale }}" />
@error('translationContents.' . $locale)
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
@endforeach
@if(!empty($this->remainingTagLocales))
<div>
<label class="block text-sm text-theme-primary mb-1">{{ __('Add translation') }}</label>
<p class="text-xs text-theme-secondary mb-2">
{{ __('Only languages the selected activity tag has been translated into can be selected.') }}
</p>
<div class="flex items-center space-x-2">
<x-select :clearable="false" :searchable="false" class="!w-48"
placeholder="{{ __('Select a language') }}"
wire:model="newTranslationLocale">
@foreach($this->remainingTagLocales as $locale)
<x-select.option label="{{ __('messages.' . $locale) }}" value="{{ $locale }}" />
@endforeach
</x-select>
<x-jetstream.secondary-button wire:click="addTranslation()">
{{ __('Add') }}
</x-jetstream.secondary-button>
</div>
</div>
@endif
</div>
@endif
{{-- Location --}}
<div wire:key="call-location">
<label class="block text-sm text-theme-primary mb-2">{{ __('Exchange location') }}</label>
<livewire:locations.locations-dropdown
:hide-label="true"
:country="$country"
:city="$city"
:division="$division"
:district="$district"
wire:key="call-location-dropdown-{{ $country }}-{{ $city }}" />
@error('country')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
{{-- Expiry date --}}
<div wire:key="call-till">
<label class="block text-sm text-theme-primary mb-2">{{ __('Expires on') }}</label>
@php
$tillMinDate = now()->addDay()->format('Y-m-d');
$activeProfileType = session('activeProfileType');
$tillMaxDays = ($activeProfileType && $activeProfileType !== \App\Models\User::class)
? timebank_config('calls.till_max_days_non_user')
: timebank_config('calls.till_max_days');
$tillMaxDate = $tillMaxDays !== null ? now()->addDays($tillMaxDays)->format('Y-m-d') : null;
@endphp
<div wire:ignore>
<x-flatpickr
dateFormat="Y-m-d"
altFormat="d-m-Y"
:minDate="$tillMinDate"
:maxDate="$tillMaxDate"
placeholder="{{ __('Select a date') }}"
wire:model.defer="till"
:config="['altInputClass' => 'w-full mt-1 block border border-theme-border focus:border-theme-accent focus:ring-1 focus:ring-theme-accent rounded-md shadow-sm px-3 py-2 text-sm bg-white']"
class="mt-1 block w-full border-theme-border focus:border-theme-accent focus:ring-1 focus:ring-theme-accent rounded-md shadow-sm" />
</div>
@error('till')
<p class="mt-1 text-sm text-red-600">{{ $message }}</p>
@enderror
</div>
{{-- Visibility --}}
<div wire:key="call-public">
<x-checkbox
id="call-is-public"
label="{{ __('Public, visible for search engines and sharable on social media') }}"
wire:model.live="isPublic" />
@if ($isPublic)
<p class="mt-2 text-sm text-red-600">
{{ str_replace(':username', $profileName, __('This exposes your username (:username), your profile photo and your profile and work locations!')) }}
</p>
@endif
</div>
</div>
</x-slot>
<x-slot name="footer">
<div wire:loading wire:target="save">
<x-mini-button flat primary rounded spinner />
</div>
<x-jetstream.secondary-button
class="ml-3 w-32 justify-center"
wire:click="$set('showModal', false)"
wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jetstream.secondary-button>
<x-jetstream.button
class="ml-3 w-32 justify-center"
wire:click.prevent="save()"
wire:loading.attr="disabled">
{{ __('Publish') }}
</x-jetstream.button>
</x-slot>
</x-jetstream.dialog-modal>
@endif
</div>
<script>
function initCallFlatpickr() {
const tillInput = document.querySelector('[wire\\:model\\.defer="till"]');
if (tillInput && !tillInput._flatpickr) {
if (window.LaravelFlatpickr) {
window.LaravelFlatpickr.initializeFlatpickr(tillInput);
}
}
}
document.addEventListener('DOMContentLoaded', function() {
setTimeout(initCallFlatpickr, 100);
Livewire.hook('morph.updated', () => {
setTimeout(initCallFlatpickr, 200);
setTimeout(initCallFlatpickr, 500);
});
Livewire.on('showModal', () => {
setTimeout(initCallFlatpickr, 300);
setTimeout(initCallFlatpickr, 600);
});
});
</script>