SmartCane/laravel_app/resources/views/livewire/projects/mailing-manager.blade.php
Martin Folkerts 84d8bc1d74 wip
2024-01-05 20:31:17 +01:00

115 lines
6.6 KiB
PHP

<div>
<div class="px-4 sm:px-6 lg:px-8">
<div class="mt-8 flow-root">
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="inline-block min-w-full py-2 align-middle mb-10">
<table class="min-w-full divide-y divide-gray-300">
<thead>
<tr>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg:pl-8">
Id
</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg:pl-8">@lang('Subject')</th>
<th scope="col"
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg:pl-8">@lang('Status')</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">#</th>
<th scope="col"
class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">@lang('Attachment')
</th>
<th scope="col" class="relative py-3.5 pl-3 pr-4 sm:pr-0">
<span class="sr-only">Edit</span>
</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($project->mailings as $mail)
<tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6 lg:pl-8">{{ $mail->id }}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{ $mail->subject }}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
<x-badge :status="$mail->status"></x-badge>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{ $mail->recipients()->count() }}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{ $mail->attachments()->pluck('name')->join( ', ') }}</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-0">
<button type="button" wire:click="showMailingDetailsModal({{ $mail->id }})"
class="text-indigo-600 hover:text-indigo-900">Show
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<x-modal wire:model.live="mailingDetailsModal">
<x-form-modal submit="saveProject">
<x-slot name="title">
{{ __('Mailing') }}
</x-slot>
<x-slot name="description">
<x-label for="created_at" value="{{ __('Created') }}"/>
<x-label id="created_at"
value="{{ \Carbon\Carbon::parse($formData['created_at'])->format('Y-m-d H:i') }}"/>
</x-slot>
<x-slot name="form">
<div class="col-span-6">
<x-label for="recipients" value="{{ __('Recipients') }}"/>
@foreach($formData['recipients'] as $key => $recipient)
<div class="col-span-6 sm:col-span-4">
<x-label class="inline-block" for="recipients"
value="{{ $recipient['name'] }}"/>
<x-label class="inline-block" for="recipients"
value="<{{ $recipient['email'] }}>"/>
</div>
@endforeach
</div>
<div class="col-span-6">
<x-label for="subject" value="{{ __('Subject') }}"/>
<x-input id="subject" type="text" class="mt-1 block w-full" disabled
wire:model="formData.subject"/>
</div>
<div class="col-span-6">
<x-label for="message" value="{{ __('Message') }}"/>
<textarea
id="message"
type="text"
class="mt-1 block w-full"
wire:model="formData.message"
disabled
></textarea>
</div>
@empty($formData['attachments'])
<div class="col-span-6">
<x-label for="message" value="{{ __('Attachment') }}"/>
<x-label class="inline-block" for=""
value="{{ __('No attachments where send with this message.') }}"/>
</div>
@else
@foreach($formData['attachments'] as $key => $attachment)
<div class="col-span-6">
<x-label class="inline-block" for="recipients"
value="{{ $attachment['name'] }}"/>
</div>
@endforeach
@endempty
</x-slot>
<x-slot name="actions">
<x-secondary-button class="mr-3"
type="button"
wire:click="closeMailingDetailsModal"
>
{{ __('Close') }}
</x-secondary-button>
</x-slot>
</x-form-modal>
</x-modal>
</div>