AUK ready

This commit is contained in:
Александр Бабкин
2022-07-04 16:04:58 +03:00
parent 621b1fd677
commit 240351d832
15 changed files with 458 additions and 14 deletions

View File

@@ -0,0 +1,16 @@
{{-- <a href="{{ route('auks.show',$auk->id) }}">
<i class="fa fa-eye text-green-500 hover:text-green-700 px-2 text-lg"></i>
</a> --}}
<a href="{{ route('auks.edit', $auk->id) }}">
<i class="fa fa-edit text-blue-500 hover:text-blue-700 px-2 text-lg"></i>
</a>
@if (!count($auk->childs))
<form class="inline-block" action="{{ route('auks.destroy', $auk->id) }}" method="POST"
onsubmit="return confirm('{{ __('Are you sure remove AUK ') . $auk->name . '?' }}');">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<button type="submit">
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
</button>
</form>
@endif

View File

@@ -0,0 +1,75 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ $project->name }}: {{ __('Create AUK') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<div class="w-96 mx-auto">
@if ($errors->any())
<div class="alert alert-danger text-red-500 p-2">
<ul class="list-unstyled alert alert-danger">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" action="{{ route('auks.store') }}">
@csrf
<!-- Document name -->
<div>
<x-label for="name" :value="__('Title')" />
<x-input id="name" class="block mt-1 w-full" type="text" name="name"
:value="old('name')" required autofocus />
</div>
<div>
<x-label for="number" :value="__('Number')" />
<x-input id="number" class="block mt-1 w-full" type="text" name="number"
:value="old('number')" required />
</div>
<div>
<x-label for="parent_id" :value="__('Parent AUK')" />
<x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required>
<option value="0">---</option>
@foreach ($top_auks as $auks)
<option value="{{ $auks->id }}">{{ $auks->name }} ({{ $auks->number }})</option>
@if (count($auks->childs))
@include('auks.optionChild', [
'childs' => $auks->childs,
'level' => 1,
])
@endif
@endforeach
</x-select>
</div>
<div class="flex items-center justify-end mt-4">
<button
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-add pr-2"></i>{{ __('Create AUK') }}
</button>
<div class="pl-2">
<a href="{{ route('auks.index') }}"
class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-cancel pr-2"></i>{{ __('Cancel') }}
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,81 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ $project->name }}: {{ __('Edit AUK') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<div class="w-96 mx-auto">
@if ($errors->any())
<div class="alert alert-danger text-red-500 p-2">
<ul class="list-unstyled alert alert-danger">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" action="{{ route('auks.update',$auk->id) }}">
@csrf
@method('PUT')
<input type="hidden" id="id" name="id" value="{{ $auk->id }}">
<div>
<x-label for="name" value="{{ __('Title') }}" />
<x-input id="name" class="block mt-1 w-full" type="text" name="name"
value="{{ $auk->name }}" required autofocus />
</div>
<div>
<x-label for="number" value="{{ __('Number') }}" />
<x-input id="number" class="block mt-1 w-full" type="text" name="number"
value="{{ $auk->number }}" required />
</div>
<div>
<x-label for="parent_id" value="{{ __('Parent AUK') }}" />
<x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required>
<option value="0">---</option>
@foreach ($top_auks as $top_auk)
@if ($auk->parent_id == $top_auk->id)
<option value="{{ $top_auk->id }}" selected>{{ $top_auk->name }} ({{ $top_auk->number }})</option>
@else
<option value="{{ $top_auk->id }}">{{ $top_auk->name }} ({{ $top_auk->number }})</option>
@endif
@if (count($top_auk->childs))
@include('documents.optionChildSelected', [
'childs' => $top_auk->childs,
'parent_id' => $top_auk->parent_id,
'level' => 1,
])
@endif
@endforeach
</x-select>
</div>
<div class="flex items-center justify-end mt-4">
<button
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-add pr-2"></i>{{ __('Save AUK') }}
</button>
<div class="pl-2">
<a href="{{ route('auks.index') }}"
class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-cancel pr-2"></i>{{ __('Cancel') }}
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,64 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ $project->name }}: {{ __('AUK list') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<a href="{{ route('auks.create') }}">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-add pr-2"></i>{{ __('Create AUK') }}
</button>
</a>
<div align="center" class="pt-4">
<table class="table table-sm border-b border-gray-200">
<tr class="border border-gray-200">
<th class="p-2 border border-gray-200">
{{ __('Title') }}
</th>
<th class="p-2 border border-gray-200">
{{ __('Number') }}
</th>
<th class="p-2 border border-gray-200">
{{ __('Actions') }}
</th>
</tr>
@forelse ($top_auks as $top_auk)
<tr class="border border-gray-200">
<td class="p-2 border border-gray-200">{{ $top_auk->name }}</td>
<td class="p-2 border border-gray-200">{{ $top_auk->number }}</td>
<td class="p-2 border border-gray-200">
<div class="text-center">
@include('auks.actions', ['auk' => $top_auk])
</div>
</td>
</tr>
@if (count($top_auk->childs))
@php
$level = 1;
@endphp
@include('auks.tableChild', [
'childs' => $top_auk->childs,
'level' => $level,
])
@endif
@empty
<tr>
<td colspan="3" class="p-2 border border-gray-200 text-center">No AUKs!</td>
</tr>
@endforelse
</table>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,9 @@
@foreach ($childs as $child)
<option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->name }}</option>
@if (count($child->childs))
@include('documents.optionChild', [
'childs' => $child->childs,
'level' => $level + 1,
])
@endif
@endforeach

View File

@@ -0,0 +1,14 @@
@foreach ($childs as $child)
@if ($parent_id == $child->id)
<option value="{{ $child->id }}" selected>{{ str_pad('', $level, '-') . ' ' . $child->name }}</option>
@else
<option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->name }}</option>
@endif
@if (count($child->childs))
@include('auks.optionChildSelected', [
'childs' => $child->childs,
'parent_id' => $auk->parent_id,
'level' => $level + 1,
])
@endif
@endforeach

View File

@@ -0,0 +1,51 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Show project') }}
</h2>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<div class="w-96 mx-auto">
<div>
<x-label for="name" :value="__('Title')" />
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $project->name }}" readonly />
</div>
<!-- Description -->
<div class="mt-4">
<x-label for="description" :value="__('Description')" />
<x-input id="description" class="block mt-1 w-full" type="text" name="description" value="{{ $project->description }}" readonly />
</div>
<!-- MMC Path -->
<div class="mt-4">
<x-label for="mmc_path" :value="__('MMC Path')" />
<x-input id="mmc_path" class="block mt-1 w-full" type="text" name="mmc_path" value="{{ $project->mmc_path }}" readonly />
</div>
<div class="flex items-center justify-end mt-4">
<div class="pl-2">
<a href="{{ route('projects.edit',$project->id) }}" class="btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-edit pr-2"></i>{{__('Edit project')}}
</a>
</div>
<div class="pl-2">
<a href="{{ route('projects.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,19 @@
@foreach ($childs as $child)
<tr>
<td class="p-2 border border-gray-200">
{{ str_pad('', $level, '-') . ' ' . $child->name }}
</td>
<td class="p-2 border border-gray-200">
{{ $child->number }}
</td>
<td class="p-2 border border-gray-200">
@include('auks.actions', ['auk' => $child])
</td>
</tr>
@if (count($child->childs))
@include('auks.tableChild', [
'childs' => $child->childs,
'level' => $level + 1,
])
@endif
@endforeach

View File

@@ -1,7 +1,7 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ $project->name }}: {{ __('Create document') }}
{{ $project->name }}: {{ __('Edit document') }}
</h2>
</x-slot>

View File

@@ -40,7 +40,7 @@
</x-nav-link>
</div>
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
<x-nav-link :href="route('auk.index')" :active="request()->routeIs('auk.index')|request()->routeIs('auk.create')|request()->routeIs('auk.show')|request()->routeIs('auk.edit')">
<x-nav-link :href="route('auks.index')" :active="request()->routeIs('auks.index')|request()->routeIs('auks.create')|request()->routeIs('auks.show')|request()->routeIs('auks.edit')">
{{ __('AUK') }}
</x-nav-link>
</div>