| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- @extends('layouts.app')
- @section('content')
- <div class="px-3">
- <div class="col-xxl-6 offset-xxl-2">
- <form action="{{ route('user.store') }}" method="post">
- @csrf
- @if($user)
- <input type="hidden" name="id" value="{{ $user->id }}">
- @endif
- <ul class="nav nav-tabs mb-3" role="tablist">
- <li class="nav-item" role="presentation">
- <button class="nav-link active" id="main-tab" data-bs-toggle="tab" data-bs-target="#main-pane" type="button" role="tab">Основное</button>
- </li>
- <li class="nav-item" role="presentation">
- <button class="nav-link" id="notifications-tab" data-bs-toggle="tab" data-bs-target="#notifications-pane" type="button" role="tab">Уведомления</button>
- </li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane fade show active" id="main-pane" role="tabpanel" aria-labelledby="main-tab">
- @include('partials.input', ['name' => 'email',
- 'type' => 'text',
- 'title' => 'Логин/email',
- 'required' => true,
- 'value' => $user->email ?? '',
- 'disabled' => ($user && $user->email_verified_at),
- ])
- @include('partials.input', ['name' => 'notification_email',
- 'type' => 'email',
- 'title' => 'Email для уведомлений',
- 'value' => old('notification_email', $user->notification_email ?? '')])
- @include('partials.input', ['name' => 'name', 'title' => 'Имя', 'required' => true, 'value' => $user->name ?? ''])
- @include('partials.input', ['name' => 'phone', 'title' => 'Телефон', 'value' => $user->phone ?? ''])
- @include('partials.input', ['name' => 'password', 'type' => 'password', 'title' => 'Пароль'])
- @include('partials.select', ['name' => 'role', 'title' => 'Роль', 'options' => getRoles(), 'value' => $user->role ?? \App\Models\Role::MANAGER])
- @include('partials.input', ['name' => 'color', 'title' => 'Цвет', 'value' => $user->color ?? '#FFFFFF', 'type' => 'color'])
- @if($user)
- @include('partials.input', ['name' => 'token_fcm', 'title' => 'FCM Token', 'value' => $user->token_fcm ?? '', 'disabled' => true])
- @endif
- </div>
- <div class="tab-pane fade" id="notifications-pane" role="tabpanel" aria-labelledby="notifications-tab">
- @php($settings = $notificationSettings ?? [])
- @include('partials.notification-settings-table', [
- 'channels' => $notificationChannels,
- 'disabledChannels' => $disabledChannels ?? [],
- 'sections' => [
- ['title' => 'Площадки', 'settingsKey' => 'orders', 'options' => $orderStatusOptions, 'colors' => $orderStatusColors, 'settings' => $settings['order_settings'] ?? []],
- ['title' => 'Рекламации', 'settingsKey' => 'reclamations', 'options' => $reclamationStatusOptions, 'colors' => $reclamationStatusColors, 'settings' => $settings['reclamation_settings'] ?? []],
- ['title' => 'График монтажей', 'settingsKey' => 'schedule', 'options' => $scheduleSourceOptions, 'colors' => [], 'settings' => $settings['schedule_settings'] ?? []],
- ],
- ])
- </div>
- </div>
- @if($user && !is_null($user->deleted_at))
- <div class="col-12 text-center">
- <div class="text-danger">ПОЛЬЗОВАТЕЛЬ УДАЛЁН!!!</div>
- <a href="#" class="btn btn-sm btn-warning undelete">Восстановить</a>
- </div>
- @else
- @include('partials.submit', ['delete' => ['form_id' => 'delete-user']])
- @if($user && auth()->id() !== $user->id)
- <div class="text-center mt-2">
- <a href="#" class="btn btn-sm btn-outline-primary impersonate-user">Impersonate</a>
- </div>
- @endif
- @endif
- </form>
- @if($user)
- <form action="{{ route('user.undelete', $user->id) }}" method="post" class="d-none" id="undelete-user">
- @csrf
- </form>
- <form action="{{ route('user.destroy', $user->id) }}" method="post" class="d-none" id="delete-user">
- @method('DELETE')
- @csrf
- </form>
- <form action="{{ route('user.impersonate', $user->id) }}" method="post" class="d-none" id="impersonate-user">
- @csrf
- </form>
- @endif
- </div>
- </div>
- @endsection
- @push('scripts')
- <script type="module">
- $('.undelete').on('click', function (){
- customConfirm('Восстановить пользователя?', function () {
- $('#undelete-user').submit();
- });
- });
- $('.impersonate-user').on('click', function (){
- customConfirm('Войти от имени этого пользователя?', function () {
- $('#impersonate-user').submit();
- });
- });
- </script>
- @endpush
|