Scan AUK ready

This commit is contained in:
Александр Бабкин
2022-07-13 08:11:31 +03:00
parent d093a31512
commit 0cd5e9741f
5 changed files with 52 additions and 43 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\AUK;
use App\Models\Project;
use Illuminate\Support\Facades\Log;
class AUKController extends Controller
{
@@ -161,7 +162,7 @@ class AUKController extends Controller
}
}
}
array_push($auks,$tmp_array);
array_push($auks, $tmp_array);
}
}
}
@@ -176,22 +177,28 @@ class AUKController extends Controller
*/
public function load(Request $request)
{
Log::alert("In load");
$project_id = $request->session()->get('project_id');
$request->validate([
'name' => ['required', 'string', 'max:255'],
'number' => ['required', 'integer'],
'parent_id' => ['required', 'integer'],
]);
// $user =
$i = 0;
while ($request->input('auk_name_' . $i) !== null) {
Log::alert("Loading " . $i);
$auk_name = $request->input('auk_name_' . $i);
$auk_path = $request->input('auk_path_' . $i);
$image_dir = $request->input('image_dir_' . $i);
Log::alert("auk_name \"" . $auk_name . "\"");
Log::alert("auk_path \"" . $auk_path . "\"");
Log::alert("image_dir \"" . $image_dir . "\"");
AUK::create([
'project_id' => $project_id,
'name' => $request->name,
'number' => $request->number,
'parent_id' => $request->parent_id,
'auk_name' => $auk_name,
'auk_path' => $auk_path,
'image_dir' => $image_dir,
'parent_id' => null,
]);
$i++;
}
return redirect(route('auks.index'));
}
}

View File

@@ -13,8 +13,9 @@ class AUK extends Model
protected $table = 'auks';
protected $fillable = [
'project_id',
'name',
'number',
'auk_name',
'auk_path',
'image_dir',
'parent_id',
];

View File

@@ -734,15 +734,15 @@ select {
.-mt-px {
margin-top: -1px;
}
.mt-1 {
margin-top: 0.25rem;
}
.-mr-2 {
margin-right: -0.5rem;
}
.mt-3 {
margin-top: 0.75rem;
}
.mt-1 {
margin-top: 0.25rem;
}
.mt-6 {
margin-top: 1.5rem;
}
@@ -800,24 +800,24 @@ select {
.w-5 {
width: 1.25rem;
}
.w-96 {
width: 24rem;
}
.w-8 {
width: 2rem;
}
.w-auto {
width: auto;
}
.w-96 {
width: 24rem;
}
.w-full {
width: 100%;
}
.w-4 {
width: 1rem;
}
.w-6 {
width: 1.5rem;
}
.w-full {
width: 100%;
}
.w-48 {
width: 12rem;
}
@@ -1060,9 +1060,6 @@ select {
.pt-8 {
padding-top: 2rem;
}
.pl-2 {
padding-left: 0.5rem;
}
.pt-2 {
padding-top: 0.5rem;
}
@@ -1072,6 +1069,12 @@ select {
.pb-1 {
padding-bottom: 0.25rem;
}
.pl-2 {
padding-left: 0.5rem;
}
.pb-4 {
padding-bottom: 1rem;
}
.pt-6 {
padding-top: 1.5rem;
}
@@ -1084,9 +1087,6 @@ select {
.pr-4 {
padding-right: 1rem;
}
.pb-4 {
padding-bottom: 1rem;
}
.text-center {
text-align: center;
}
@@ -9099,14 +9099,14 @@ readers do not read off random characters that represent icons */
--tw-bg-opacity: 1;
background-color: rgb(29 78 216 / 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-700:hover {
--tw-bg-opacity: 1;
background-color: rgb(55 65 81 / var(--tw-bg-opacity));
}
.hover\:bg-gray-50:hover {
--tw-bg-opacity: 1;
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
@@ -9127,14 +9127,14 @@ 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-green-700:hover {
--tw-text-opacity: 1;
color: rgb(21 128 61 / var(--tw-text-opacity));
}
.hover\:text-gray-700:hover {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
}
.hover\:text-green-700:hover {
--tw-text-opacity: 1;
color: rgb(21 128 61 / var(--tw-text-opacity));
}
.hover\:text-gray-800:hover {
--tw-text-opacity: 1;
color: rgb(31 41 55 / var(--tw-text-opacity));

View File

@@ -45,12 +45,12 @@
</table>
@if (count($auks))
<form method="POST" action="{{ route('auks.store') }}">
<form method="POST" action="{{ route('auks.load') }}">
@csrf
@for($i = 0; $i < count($auks); $i++)
<input type="hidden" name="auk_name_{{$i}}" value="{{ $auks[$i]['auk_name'] }}">
<input type="hidden" name="auk_path_{{$i}}" value="{{ $auks[$i]['auk_path'] }}">
<input type="hidden" name="image_dir_{{$i}}" value="{{ $auks[$i]['image_dir'] }}">
<input type="hidden" name="auk_name_{{$i}}" id="auk_name_{{$i}}" value="{{ $auks[$i]['auk_name'] }}">
<input type="hidden" name="auk_path_{{$i}}" id="auk_path_{{$i}}" value="{{ $auks[$i]['auk_path'] }}">
<input type="hidden" name="image_dir_{{$i}}" id="image_dir_{{$i}}" value="{{ $auks[$i]['image_dir'] }}">
@endfor
<div class="flex items-center justify-end mt-4">
<button

View File

@@ -42,5 +42,6 @@ Route::get('/mmc/scan', [MMCController::class, 'scan'])->middleware(['auth'])->n
Route::resource('/documents', DocumentController::class)->except('show')->middleware(['auth']);
Route::resource('/auks', AUKController::class)->except('show')->middleware(['auth']);
Route::get('/auks/scan', [AUKController::class, 'scan'])->middleware(['auth'])->name('auks.scan');
Route::post('/auks/load', [AUKController::class, 'load'])->middleware(['auth'])->name('auks.load');
require __DIR__ . '/auth.php';