SmartCane/laravel_app/resources/views/livewire/projects/tabs/mailings.blade.php

134 lines
6.8 KiB
PHP

<div>
<div class="px-4 sm:px-6 lg:px-8">
<div class="sm:flex sm:flex-col sm:items-center">
<div class="w-full flex justify-between my-4">
<h1 class="text-base font-semibold leading-6 text-gray-900">{{ __('Mailing') }}</h1>
<p class="mt-2 text-sm text-gray-700"></p>
</div>
<div class="mt-4 sm:mt-0 sm:flex sm:justify-between w-full">
<x-search></x-search>
</div>
</div>
<div class="mt-8 ">
<div class="">
<div class="inline-block min-w-full py-2 align-middle mb-10">
<div class="">
<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($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>
</div>
<div class="pt-4 flex justify-between items-center">
<div class="text-gray-700 text-sm">
Results: {{ \Illuminate\Support\Number::format($mailings->total()) }}
</div>
{{ $mailings->links('livewire.pagination') }}
</div>
</div>
</div>
</div>
<x-modal wire:model="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>