From 0cdc43d547e95b679eb7b3dcdfd35995ddf73d3f Mon Sep 17 00:00:00 2001 From: aslan Date: Wed, 14 Feb 2024 10:20:40 +0300 Subject: [PATCH] refactoring User resource --- .../views/admin/documents/create.blade.php | 39 +++++-------- resources/views/admin/users/create.blade.php | 54 ++++++++++++++++++ resources/views/admin/users/edit.blade.php | 55 +++++++++++++++++++ resources/views/admin/users/index.blade.php | 41 ++++++++++++++ .../views/layouts/admin_layout.blade.php | 4 +- resources/views/users/create.blade.php | 53 ------------------ resources/views/users/edit.blade.php | 54 ------------------ resources/views/users/index.blade.php | 37 ------------- 8 files changed, 167 insertions(+), 170 deletions(-) create mode 100644 resources/views/admin/users/create.blade.php create mode 100644 resources/views/admin/users/edit.blade.php create mode 100644 resources/views/admin/users/index.blade.php delete mode 100644 resources/views/users/create.blade.php delete mode 100644 resources/views/users/edit.blade.php delete mode 100644 resources/views/users/index.blade.php diff --git a/resources/views/admin/documents/create.blade.php b/resources/views/admin/documents/create.blade.php index 653f31e..3728c7f 100644 --- a/resources/views/admin/documents/create.blade.php +++ b/resources/views/admin/documents/create.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.admin-layout') +@extends('layouts.admin_layout') @section('content') @auth()
@@ -27,6 +27,17 @@ {{ $errors->first('name') }} @endif
+
+ {{ Form::label('description', 'Описание') }} +
+
+ {{ Form::text('description', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('description') }} + @endif +
{{ Form::label('position', 'Позиция') }}
@@ -39,14 +50,14 @@ @endif
- {{ Form::label('idReceptionScreen', 'Пункт экрана приема') }} + {{ Form::label('admission_id', 'Пункт экрана приема') }}
- {{ Form::select('idReceptionScreen', $receptionScreens, null, ['class' => 'form-select']) }} + {{ Form::select('admission_id', $admissions, null, ['class' => 'form-select']) }}
@if ($errors->any()) - {{ $errors->first('idReceptionScreen') }} + {{ $errors->first('admission_id') }} @endif
@@ -54,26 +65,6 @@
{{Form::close()}} -{{-- @if($idReceptionScreen !== null)--}} -{{--
--}} -{{--

Файлы пункта Экрана Приема: {{ $receptionScreens[$idReceptionScreen] }}

--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- @foreach($files as $file)--}} -{{-- --}} -{{-- --}} -{{-- --}} -{{-- @endforeach--}} -{{-- --}} -{{--
ПозицияНазвание
{{ $file->position }}{{ $file->name }}
--}} -{{--
--}} -{{-- @endif--}} @endauth @endsection diff --git a/resources/views/admin/users/create.blade.php b/resources/views/admin/users/create.blade.php new file mode 100644 index 0000000..8273079 --- /dev/null +++ b/resources/views/admin/users/create.blade.php @@ -0,0 +1,54 @@ +@extends('layouts.admin_layout') +@section('content') + @auth() + @can('create', Auth::user()) +
+

Создать администратора

+ + {{ Form::open(['url' => route('users.store'), 'method' => 'POST', 'class' => '']) }} +
+
+ {{ Form::label('name', 'Логин') }} +
+
+ {{ Form::text('name', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('name') }} + @endif +
+ +
+ {{ Form::label('email', 'электронная почта') }} +
+
+ {{ Form::text('email', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('email') }} + @endif +
+ +
+ {{ Form::label('password', 'Пароль') }} +
+
+ {{ Form::text('password', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('password') }} + @endif +
+ +
+ {{ Form::submit('создать', ['class' => 'btn btn-primary']) }} +
+
+ {{ Form::close() }} +
+ @endcan + @endauth +@endsection diff --git a/resources/views/admin/users/edit.blade.php b/resources/views/admin/users/edit.blade.php new file mode 100644 index 0000000..c62db92 --- /dev/null +++ b/resources/views/admin/users/edit.blade.php @@ -0,0 +1,55 @@ +@extends('layouts.admin_layout') +@section('content') + @auth() + @can('update', Auth::user()) +
+

Изменить Администратора

+
+
+ {{ Form::open(['url' => route('users.update', $user), 'method' => 'PATCH', 'class' => '']) }} +
+
+ {{ Form::label('name', 'Логин') }} +
+
+ {{ Form::text('name', $user->name, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('name') }} + @endif +
+ +
+ {{ Form::label('email', 'электронная почта') }} +
+
+ {{ Form::text('email', $user->email, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('email') }} + @endif +
+ +
+ {{ Form::label('password', 'Пароль') }} +
+
+ {{ Form::text('password', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('password') }} + @endif +
+ +
+ {{ Form::submit('изменить', ['class' => 'btn btn-primary']) }} +
+
+ {{ Form::close() }} +
+ @endcan + @endauth +@endsection diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php new file mode 100644 index 0000000..dd1e8df --- /dev/null +++ b/resources/views/admin/users/index.blade.php @@ -0,0 +1,41 @@ +@extends('layouts.admin_layout') +@section('content') + @auth() + @can('viewAny', Auth::user()) +
+

список Администраторов

+
+ Создать администратора +
+
+ + + + + + + + + + + @foreach($users as $user) + + + + + + + @endforeach + +
idnameemailдействия
{{ $user->id }}{{ $user->name }}{{ $user->email }}редактировать + + удалить + +
+
+
+
+ @endcan + @endauth +@endsection diff --git a/resources/views/layouts/admin_layout.blade.php b/resources/views/layouts/admin_layout.blade.php index d784213..767677f 100644 --- a/resources/views/layouts/admin_layout.blade.php +++ b/resources/views/layouts/admin_layout.blade.php @@ -45,10 +45,10 @@