Document create continue
This commit is contained in:
@@ -18,7 +18,7 @@ class DocumentController extends Controller
|
||||
{
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$project = Project::find($project_id);
|
||||
$documents = Document::find($project_id);
|
||||
$documents = Document::where('project_id',$project_id)->get();
|
||||
return view('documents.list', ['project' => $project, 'documents' => $documents]);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class DocumentController extends Controller
|
||||
{
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$project = Project::find($project_id);
|
||||
$documents = Document::find($project_id);
|
||||
$documents = Document::where('project_id',$project_id)->get();
|
||||
return view('documents.create', ['project' => $project, 'documents' => $documents]);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,20 @@ class DocumentController extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$project_id = $request->session()->get('project_id');
|
||||
$request->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'parent_id' => ['required', 'integer'],
|
||||
]);
|
||||
|
||||
// $user =
|
||||
Document::create([
|
||||
'project_id' => $project_id,
|
||||
'name' => $request->name,
|
||||
'parent_id' => $request->parent_id,
|
||||
]);
|
||||
|
||||
return redirect(route('documents.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -697,6 +697,9 @@ select {
|
||||
.z-50 {
|
||||
z-index: 50;
|
||||
}
|
||||
.m-2 {
|
||||
margin: 0.5rem;
|
||||
}
|
||||
.mx-auto {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
@@ -713,6 +716,9 @@ select {
|
||||
.mt-4 {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.ml-4 {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.ml-1 {
|
||||
margin-left: 0.25rem;
|
||||
}
|
||||
@@ -725,9 +731,6 @@ select {
|
||||
.ml-2 {
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.ml-4 {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
.mt-8 {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
@@ -743,12 +746,12 @@ select {
|
||||
.mt-3 {
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
.mb-4 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.mt-6 {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.mb-4 {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
}
|
||||
@@ -797,9 +800,6 @@ select {
|
||||
.w-5 {
|
||||
width: 1.25rem;
|
||||
}
|
||||
.w-96 {
|
||||
width: 24rem;
|
||||
}
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -821,15 +821,15 @@ select {
|
||||
.w-20 {
|
||||
width: 5rem;
|
||||
}
|
||||
.w-96 {
|
||||
width: 24rem;
|
||||
}
|
||||
.max-w-7xl {
|
||||
max-width: 80rem;
|
||||
}
|
||||
.max-w-6xl {
|
||||
max-width: 72rem;
|
||||
}
|
||||
.max-w-xl {
|
||||
max-width: 36rem;
|
||||
}
|
||||
.flex-1 {
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
@@ -907,15 +907,15 @@ select {
|
||||
.rounded-md {
|
||||
border-radius: 0.375rem;
|
||||
}
|
||||
.rounded-full {
|
||||
border-radius: 9999px;
|
||||
}
|
||||
.rounded-lg {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
.rounded-full {
|
||||
border-radius: 9999px;
|
||||
}
|
||||
.rounded-l-md {
|
||||
border-top-left-radius: 0.375rem;
|
||||
border-bottom-left-radius: 0.375rem;
|
||||
@@ -939,9 +939,6 @@ select {
|
||||
.border-l-4 {
|
||||
border-left-width: 4px;
|
||||
}
|
||||
.border-r {
|
||||
border-right-width: 1px;
|
||||
}
|
||||
.border-gray-300 {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
||||
@@ -961,10 +958,6 @@ select {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(129 140 248 / var(--tw-border-opacity));
|
||||
}
|
||||
.border-gray-400 {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(156 163 175 / var(--tw-border-opacity));
|
||||
}
|
||||
.bg-white {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
||||
@@ -973,14 +966,6 @@ select {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-blue-500 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-gray-500 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-gray-800 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
|
||||
@@ -989,6 +974,14 @@ select {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(238 242 255 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-blue-500 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.bg-gray-500 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
|
||||
}
|
||||
.fill-current {
|
||||
fill: currentColor;
|
||||
}
|
||||
@@ -1034,24 +1027,18 @@ select {
|
||||
padding-left: 0.25rem;
|
||||
padding-right: 0.25rem;
|
||||
}
|
||||
.pr-2 {
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.pl-2 {
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
.pt-8 {
|
||||
padding-top: 2rem;
|
||||
}
|
||||
.pt-4 {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
.pt-2 {
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
.pb-3 {
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
.pt-4 {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
.pb-1 {
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
@@ -1067,6 +1054,12 @@ select {
|
||||
.pr-4 {
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.pr-2 {
|
||||
padding-right: 0.5rem;
|
||||
}
|
||||
.pl-2 {
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
@@ -1117,9 +1110,6 @@ select {
|
||||
.tracking-widest {
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.tracking-wider {
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.text-gray-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
@@ -1132,14 +1122,6 @@ select {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-red-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(239 68 68 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-white {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-gray-200 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(229 231 235 / var(--tw-text-opacity));
|
||||
@@ -1160,6 +1142,10 @@ select {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-red-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(239 68 68 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-green-500 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(34 197 94 / var(--tw-text-opacity));
|
||||
@@ -1172,6 +1158,10 @@ select {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(22 163 74 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-white {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||
}
|
||||
.text-red-600 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(220 38 38 / var(--tw-text-opacity));
|
||||
@@ -9072,22 +9062,22 @@ readers do not read off random characters that represent icons */
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(209 213 219 / var(--tw-border-opacity));
|
||||
}
|
||||
.hover\:bg-blue-700:hover {
|
||||
.hover\:bg-gray-100:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-gray-700:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-gray-100:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-gray-50:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:bg-blue-700:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(29 78 216 / var(--tw-bg-opacity));
|
||||
}
|
||||
.hover\:text-gray-500:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(107 114 128 / var(--tw-text-opacity));
|
||||
@@ -9096,6 +9086,18 @@ readers do not read off random characters that represent icons */
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(156 163 175 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-700:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(55 65 81 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-800:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-900:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-green-700:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(21 128 61 / var(--tw-text-opacity));
|
||||
@@ -9108,18 +9110,6 @@ readers do not read off random characters that represent icons */
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(185 28 28 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-700:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(55 65 81 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-900:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
.hover\:text-gray-800:hover {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||
}
|
||||
.focus\:z-10:focus {
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
@@ -27,29 +27,34 @@
|
||||
<div>
|
||||
<x-label for="username" :value="__('User name')" />
|
||||
|
||||
<x-input id="username" class="block mt-1 w-full" type="text" name="username" value="{{ $user->username }}" required autofocus />
|
||||
<x-input id="username" class="block mt-1 w-full" type="text" name="username"
|
||||
value="{{ $user->username }}" required autofocus />
|
||||
</div>
|
||||
|
||||
<!-- Name -->
|
||||
<div>
|
||||
<x-label for="name" :value="__('Name')" />
|
||||
|
||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $user->name }}" required />
|
||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name"
|
||||
value="{{ $user->name }}" required />
|
||||
</div>
|
||||
|
||||
<!-- Email Address -->
|
||||
<div class="mt-4">
|
||||
<x-label for="email" :value="__('Email')" />
|
||||
|
||||
<x-input id="email" class="block mt-1 w-full" type="email" name="email" value="{{ $user->email }}" required />
|
||||
<x-input id="email" class="block mt-1 w-full" type="email" name="email"
|
||||
value="{{ $user->email }}" required />
|
||||
</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">
|
||||
<button
|
||||
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
|
||||
<i class="fa fa-save pr-2"></i>{{ __('Save') }}
|
||||
</button>
|
||||
<div class="pl-2">
|
||||
<a href="{{ route('users.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
|
||||
<a href="{{ route('users.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>
|
||||
|
||||
5
resources/views/components/select.blade.php
Normal file
5
resources/views/components/select.blade.php
Normal file
@@ -0,0 +1,5 @@
|
||||
@props(['disabled' => false])
|
||||
|
||||
<select {{ $disabled ? 'disabled' : '' }} {!! $attributes->merge(['class' => 'rounded-md shadow-sm border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50']) !!}>
|
||||
{{ $slot }}
|
||||
</select>
|
||||
@@ -31,13 +31,12 @@
|
||||
<div>
|
||||
<x-label for="parent_id" :value="__('Parent document')" />
|
||||
|
||||
{{-- <x-select>
|
||||
<option>1</option>
|
||||
</x-select> --}}
|
||||
<select id="parent_id" class="block mt-1 w-full" type="select" name="parent_id" :value="old('parent_id')" required>
|
||||
<option>1</option>
|
||||
<option>1</option>
|
||||
</select>
|
||||
<x-select id="parent_id" class="block mt-1 w-full" name="parent_id" required>
|
||||
<option value="0">---</option>
|
||||
@foreach($documents as $document)
|
||||
<option value="{{ $document->id }}">{{ $document->name}}</option>
|
||||
@endforeach
|
||||
</x-select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -15,30 +15,22 @@
|
||||
</button>
|
||||
</a>
|
||||
|
||||
{{-- <div align="center" class="pt-4">
|
||||
<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">
|
||||
{{ __('Comment')}}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('MMC Path')}}
|
||||
</th>
|
||||
<th class="p-2 border border-gray-200">
|
||||
{{ __('Actions')}}
|
||||
</th>
|
||||
</tr>
|
||||
@forelse ( $projects as $project)
|
||||
@forelse ( $documents as $document)
|
||||
<tr class="border border-gray-200">
|
||||
<td class="p-2 border border-gray-200">{{ $project->name }}</td>
|
||||
<td class="p-2 border border-gray-200">{{ $project->description }}</td>
|
||||
<td class="p-2 border border-gray-200">{{ $project->mmc_path }}</td>
|
||||
<td class="p-2 border border-gray-200">{{ $document->name }}</td>
|
||||
<td class="p-2 border border-gray-200">
|
||||
<div class="text-center">
|
||||
<a href="{{ route('projects.show',$project->id) }}">
|
||||
{{-- <a href="{{ route('projects.show',$project->id) }}">
|
||||
<i class="fa fa-eye text-green-500 hover:text-green-700 px-2 text-lg"></i>
|
||||
</a>
|
||||
<a href="{{ route('projects.edit',$project->id) }}">
|
||||
@@ -50,17 +42,17 @@
|
||||
<button type="submit">
|
||||
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
|
||||
</button>
|
||||
</form>
|
||||
</form> --}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4" class="p-2 border border-gray-200 text-center">No Projects!</td>
|
||||
<td colspan="2" class="p-2 border border-gray-200 text-center">No Documents!</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</table>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user