Determine if an inbound file is a nodelist
This commit is contained in:
parent
edd41ad187
commit
2790381a30
@ -26,6 +26,7 @@ class FileareaController extends Controller
|
|||||||
'description' => 'required',
|
'description' => 'required',
|
||||||
'active' => 'required|boolean',
|
'active' => 'required|boolean',
|
||||||
'public' => 'required|boolean',
|
'public' => 'required|boolean',
|
||||||
|
'nodelist' => 'nullable|string|max:12'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach (['name','description','active','public','notes','domain_id'] as $key)
|
foreach (['name','description','active','public','notes','domain_id'] as $key)
|
||||||
@ -33,6 +34,12 @@ class FileareaController extends Controller
|
|||||||
|
|
||||||
$o->save();
|
$o->save();
|
||||||
|
|
||||||
|
if ($request->post('nodelist')) {
|
||||||
|
$o->domain->nodelist_filename = $request->post('nodelist');
|
||||||
|
$o->domain->nodelist_filearea_id = $o->id;
|
||||||
|
$o->domain->save();
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->action([self::class,'home']);
|
return redirect()->action([self::class,'home']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,5 +41,8 @@ class TicProcess implements ShouldQueue
|
|||||||
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
|
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
|
||||||
|
|
||||||
unlink($this->file);
|
unlink($this->file);
|
||||||
|
|
||||||
|
if ($to->isNodelist())
|
||||||
|
NodelistImport::dispatch($to->fo);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,6 +44,11 @@ class Domain extends Model
|
|||||||
return $this->hasMany(Filearea::class);
|
return $this->hasMany(Filearea::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function nodelist_filearea()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Filearea::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function zones()
|
public function zones()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Zone::class);
|
return $this->hasMany(Zone::class);
|
||||||
|
37
database/migrations/2022_11_03_115325_nodelist.php
Normal file
37
database/migrations/2022_11_03_115325_nodelist.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('domains', function (Blueprint $table) {
|
||||||
|
$table->string('nodelist_filename')->nullable();
|
||||||
|
|
||||||
|
$table->bigInteger('nodelist_filearea_id')->nullable();
|
||||||
|
$table->foreign('nodelist_filearea_id')->references('id')->on('fileareas');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('domains', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['nodelist_filearea_id']);
|
||||||
|
|
||||||
|
$table->dropColumn(['nodelist_filename','nodelist_filearea_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -41,6 +41,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-4">
|
||||||
|
@if ($o->nodelist_filename)
|
||||||
|
<label for="nodelist_filename" class="form-label">Nodelist Filearea</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text"><i class="bi bi bi-file-earmark-break-fill"></i></span>
|
||||||
|
<input type="text" class="form-control" id="nodelist_filename" placeholder="Nodelist" name="nodelist_filename" value="{{ $o->nodelist_filename }}" readonly>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
No Nodelist filearea
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -69,6 +81,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ($o->nodelist_filename)
|
||||||
|
<div class="col-4">
|
||||||
|
<label for="name" class="form-label">Nodelist File Area</label>
|
||||||
|
<a href="{{ url('ftn/filearea/addedit',$o->nodelist_filearea_id) }}">
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text"><i class="bi bi bi-collection-fill"></i></span>
|
||||||
|
<input type="text" class="form-control @error('nodelist') is-invalid @enderror" id="nodelist" placeholder="Nodelist" name="nodelist" value="{{ $o->nodelist_filearea->name }}" readonly>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<!-- $o=Filearea::class -->
|
||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('htmlheader_title')
|
@section('htmlheader_title')
|
||||||
@ -26,10 +27,10 @@
|
|||||||
</select>
|
</select>
|
||||||
<span class="invalid-feedback" role="alert">
|
<span class="invalid-feedback" role="alert">
|
||||||
@error('domain_id')
|
@error('domain_id')
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
@else
|
@else
|
||||||
A domain is required.
|
A domain is required.
|
||||||
@enderror
|
@enderror
|
||||||
</span>
|
</span>
|
||||||
<span class="input-helper">Add a <a href="{{ url('ftn/domain/addedit') }}">NEW Domain</a></span>
|
<span class="input-helper">Add a <a href="{{ url('ftn/domain/addedit') }}">NEW Domain</a></span>
|
||||||
</div>
|
</div>
|
||||||
@ -42,10 +43,10 @@
|
|||||||
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('admin',$o)disabled @endcannot autofocus>
|
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot('admin',$o)disabled @endcannot autofocus>
|
||||||
<span class="invalid-feedback" role="alert">
|
<span class="invalid-feedback" role="alert">
|
||||||
@error('name')
|
@error('name')
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
@else
|
@else
|
||||||
A name is required.
|
A name is required.
|
||||||
@enderror
|
@enderror
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -78,19 +79,31 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8">
|
<div class="col-7">
|
||||||
<label for="description" class="form-label">Description</label>
|
<label for="description" class="form-label">Description</label>
|
||||||
<div class="input-group has-validation">
|
<div class="input-group has-validation">
|
||||||
<span class="input-group-text"><i class="bi bi-file-text-fill"></i></span>
|
<span class="input-group-text"><i class="bi bi-file-text-fill"></i></span>
|
||||||
<input type="text" class="form-control @error('description') is-invalid @enderror" id="description" placeholder="Description" name="description" value="{{ old('description',$o->description) }}" @cannot('admin',$o)disabled @endcannot>
|
<input type="text" class="form-control @error('description') is-invalid @enderror" id="description" placeholder="Description" name="description" value="{{ old('description',$o->description) }}" @cannot('admin',$o)disabled @endcannot>
|
||||||
<span class="invalid-feedback" role="alert">
|
<span class="invalid-feedback" role="alert">
|
||||||
@error('description')
|
@error('description')
|
||||||
{{ $message }}
|
{{ $message }}
|
||||||
@enderror
|
@enderror
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-5">
|
||||||
|
<label for="nodelist" class="form-label">Nodelist File Name</label>
|
||||||
|
<div class="input-group has-validation">
|
||||||
|
<span class="input-group-text"><i class="bi bi-file-earmark-break-fill"></i></span>
|
||||||
|
<input type="text" class="form-control @error('nodelist') is-invalid @enderror" id="nodelist" placeholder="NODELIST.Z??" name="nodelist" value="{{ old('nodelist',$o->domain->nodelist) }}" @cannot('admin',$o->domain)disabled @endcannot>
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
@error('nodelist')
|
||||||
|
{{ $message }}
|
||||||
|
@enderror
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
Reference in New Issue
Block a user