Continue MMC
This commit is contained in:
@@ -147,26 +147,29 @@ class AUKController extends Controller
|
|||||||
$auks = array();
|
$auks = array();
|
||||||
$MMC_PATH = $project->mmc_path;
|
$MMC_PATH = $project->mmc_path;
|
||||||
|
|
||||||
$mmc_dir = scandir($MMC_PATH);
|
if(is_dir($MMC_PATH))
|
||||||
|
{
|
||||||
|
$mmc_dir = scandir($MMC_PATH);
|
||||||
|
|
||||||
foreach ($mmc_dir as $entry) {
|
foreach ($mmc_dir as $entry) {
|
||||||
$course_path = $MMC_PATH . '/' . $entry;
|
$course_path = $MMC_PATH . '/' . $entry;
|
||||||
if (is_dir($course_path)) {
|
if (is_dir($course_path)) {
|
||||||
if (intval($entry) > 0 && intval($entry) < 99) {
|
if (intval($entry) > 0 && intval($entry) < 99) {
|
||||||
$tmp_array = array();
|
$tmp_array = array();
|
||||||
$tmp_array['auk_name'] = "АУК " . $entry;
|
$tmp_array['auk_name'] = "АУК " . $entry;
|
||||||
$tmp_array['auk_path'] = $entry;
|
$tmp_array['auk_path'] = $entry;
|
||||||
$tmp_array['image_dir'] = "";
|
$tmp_array['image_dir'] = "";
|
||||||
$mmc_course_dir = scandir($course_path);
|
$mmc_course_dir = scandir($course_path);
|
||||||
foreach ($mmc_course_dir as $course_entry) {
|
foreach ($mmc_course_dir as $course_entry) {
|
||||||
if (strcasecmp($course_entry, 'images') == 0) {
|
if (strcasecmp($course_entry, 'images') == 0) {
|
||||||
$course_image_path = $course_path . '/' . $course_entry;
|
$course_image_path = $course_path . '/' . $course_entry;
|
||||||
if (is_dir($course_image_path)) {
|
if (is_dir($course_image_path)) {
|
||||||
$tmp_array['image_dir'] = $course_entry;
|
$tmp_array['image_dir'] = $course_entry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
array_push($auks, $tmp_array);
|
||||||
}
|
}
|
||||||
array_push($auks, $tmp_array);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,7 +202,7 @@ class AUKController extends Controller
|
|||||||
'auk_name' => $auk_name,
|
'auk_name' => $auk_name,
|
||||||
'auk_path' => $auk_path,
|
'auk_path' => $auk_path,
|
||||||
'image_dir' => $image_dir,
|
'image_dir' => $image_dir,
|
||||||
'parent_id' => null,
|
'parent_id' => 0,
|
||||||
]);
|
]);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
|
use App\Models\AUK;
|
||||||
|
use App\Models\Document;
|
||||||
|
|
||||||
|
|
||||||
class MMCController extends Controller
|
class MMCController extends Controller
|
||||||
{
|
{
|
||||||
@@ -17,7 +20,12 @@ class MMCController extends Controller
|
|||||||
{
|
{
|
||||||
$project_id = $request->session()->get('project_id');
|
$project_id = $request->session()->get('project_id');
|
||||||
$project = Project::find($project_id);
|
$project = Project::find($project_id);
|
||||||
return view('mmc.list', ['project' => $project]);
|
$top_auks = $project->auks()->where('parent_id', 0)->get()->sortBy('auk_name');
|
||||||
|
if(count($top_auks))
|
||||||
|
{
|
||||||
|
$mmc = $top_auks[0]->mmcs;
|
||||||
|
}
|
||||||
|
return view('mmc.list', ['project' => $project, 'top_auks' => $top_auks]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,5 +23,11 @@ class AUK extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany('App\Models\AUK','parent_id','id');
|
return $this->hasMany('App\Models\AUK','parent_id','id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function mmcs()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(MMC::class,'auk_mmc','auk_id','mmc_id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,10 @@ class MMC extends Model
|
|||||||
'size',
|
'size',
|
||||||
'mtime',
|
'mtime',
|
||||||
'atime',
|
'atime',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function auks()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(AUK::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateAukMmcTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('auk_mmc', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('auk_id')->unsigned()->references('id')->on('auks');
|
||||||
|
$table->integer('mmc_id')->unsigned()->references('id')->on('mmcs');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('auk_mmc');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ class ProjectTableSeeder extends Seeder
|
|||||||
DB::table('projects')->insert([
|
DB::table('projects')->insert([
|
||||||
'name' => 'Ил-76МД90А',
|
'name' => 'Ил-76МД90А',
|
||||||
'description' => 'АОС Ил-76МД90А',
|
'description' => 'АОС Ил-76МД90А',
|
||||||
'mmc_path' => '/Docs/Project/643 Россия/IL-76MD-90А_ru/2_MMC',
|
'mmc_path' => '/home/shurick/tmp/mmc',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
@empty
|
@empty
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" class="p-2 border border-gray-200 text-center">No Documents!
|
<td colspan="3" class="p-2 border border-gray-200 text-center">No AUKs!
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
<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="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||||
<div class="p-6 bg-white border-b border-gray-200">
|
<div class="p-6 bg-white border-b border-gray-200">
|
||||||
<div class="flex flex-row">
|
{{-- <div class="flex flex-row">
|
||||||
<div class="basis-1/2">
|
<div class="basis-1/2">
|
||||||
<a href="{{ route('mmc.create') }}">
|
<a href="{{ route('mmc.create') }}">
|
||||||
<button
|
<button
|
||||||
@@ -32,11 +32,67 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div align="center" class="pt-4">
|
<div align="center" class="pt-4"> --}}
|
||||||
TODO: MMC table
|
{{-- <div class="w-96 mx-auto">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<x-label for="auk_id" :value="__('Select AUK')" />
|
||||||
|
|
||||||
|
<x-select id="auk_id" class="block mt-1 w-full" name="auk_id" required>
|
||||||
|
@foreach ($top_auks as $auks)
|
||||||
|
<option value="{{ $auks->id }}">{{ $auks->auk_name }}
|
||||||
|
({{ $auks->auk_path }})
|
||||||
|
</option>
|
||||||
|
@if (count($auks->childs))
|
||||||
|
@include('mmc.optionChild', [
|
||||||
|
'childs' => $auks->childs,
|
||||||
|
'level' => 1,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</x-select>
|
||||||
|
</div>
|
||||||
|
</div> --}}
|
||||||
|
<div align="center">
|
||||||
|
<h3>Выберите АУК:</h3>
|
||||||
<table class="table table-sm border-b border-gray-200">
|
<table class="table table-sm border-b border-gray-200">
|
||||||
|
<tr class="p-2 border border-gray-200 text-center">
|
||||||
|
<th class="p-2 border border-gray-200 text-center">AUK Title</th>
|
||||||
|
<th class="p-2 border border-gray-200 text-center">MMC</th>
|
||||||
|
</tr>
|
||||||
|
@forelse ($top_auks as $top_auk)
|
||||||
|
<tr class="p-2 border border-gray-200 text-center">
|
||||||
|
<td>{{ $top_auk->auk_name }}</td>
|
||||||
|
<td>
|
||||||
|
<table>
|
||||||
|
{{-- @forelse ($top_auk->mmcs as $mmc)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $mmc->filename }}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td>No MMC</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@endforelse --}}
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@if (count($top_auk->childs))
|
||||||
|
@include('mmc.tableAukChild', [
|
||||||
|
'childs' => $top_auk->childs,
|
||||||
|
'level' => 1,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
@empty
|
||||||
|
<tr class="p-2 border border-gray-200 text-center">
|
||||||
|
<td colspan="2">No AUK</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{{-- </div> --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
10
resources/views/mmc/optionChild.blade.php
Normal file
10
resources/views/mmc/optionChild.blade.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
@foreach ($childs as $child)
|
||||||
|
<option value="{{ $child->id }}">{{ str_pad('', $level, '-') . ' ' . $child->auk_name }}
|
||||||
|
({{ $child->auk_path }})</option>
|
||||||
|
@if (count($child->childs))
|
||||||
|
@include('mmc.optionChild', [
|
||||||
|
'childs' => $child->childs,
|
||||||
|
'level' => $level + 1,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
13
resources/views/mmc/tableAukChild.blade.php
Normal file
13
resources/views/mmc/tableAukChild.blade.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
@foreach ($childs as $child)
|
||||||
|
<tr class="p-2 border border-gray-200 text-center">
|
||||||
|
<td>
|
||||||
|
{{ str_pad('', $level, '-') . ' ' . $child->auk_name }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@if (count($child->childs))
|
||||||
|
@include('mmc.tableAukChild', [
|
||||||
|
'childs' => $top_auk->childs,
|
||||||
|
'level' => $level + 1,
|
||||||
|
])
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
Reference in New Issue
Block a user