Creato gestione documentale generica
This commit is contained in:
parent
cae02dfebf
commit
0e777445e9
@ -9,10 +9,17 @@ class GenDocController extends Controller
|
||||
{
|
||||
//
|
||||
public function fileForm(Request $request){
|
||||
$documenti = GenDoc::listDocument($request->input('entity'),$request->input('entity_id'));
|
||||
$entity_id=$request->input('entity_id');
|
||||
$entity=$request->input('entity');
|
||||
|
||||
if(!$request->input('entity_id'))
|
||||
{
|
||||
$entity_id=0;
|
||||
}
|
||||
$documenti = GenDoc::listDocument($entity,$entity_id);
|
||||
return view('conti.documenti.gendoc', [
|
||||
'id'=>$request->input('entity_id'),
|
||||
'entity'=>$request->input('entity'),
|
||||
'id'=>$entity_id,
|
||||
'entity'=>$entity,
|
||||
'documenti'=>$documenti,
|
||||
]);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Documenti;
|
||||
|
||||
class GenDoc extends Model
|
||||
{
|
||||
@ -18,20 +19,20 @@ class GenDoc extends Model
|
||||
DB::table('gen_docs')
|
||||
->insert([
|
||||
'entity'=>$data['entity'],
|
||||
'entity_id'=>$data['entity_id'],
|
||||
'entity_id'=>($data['entity_id'] ?? 0 ),
|
||||
'descrizione'=>$data['descrizione'],
|
||||
'filename'=>$filename,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function listDocument($entity,$entity_id)
|
||||
public static function listDocument($entity,$entity_id = 0)
|
||||
{
|
||||
// Ritorna la lista dei documenti in base all'entità e al rispettivo id
|
||||
return DB::table('gen_docs')->where('entity','=',$entity)->where('entity_id','=',$entity_id)->get(); //nuova funzione
|
||||
// return DB::table('documentis')->where('movimenti_id','=', $entity_id)->get();
|
||||
}
|
||||
|
||||
public static function countDocument($entity,$entity_id){
|
||||
public static function countDocument($entity,$entity_id = 0){
|
||||
// Conta i documenti inseriti per la determinata entità e id
|
||||
$quanti=DB::table('gen_docs')
|
||||
->where('entity','=',$entity)
|
||||
@ -40,15 +41,11 @@ class GenDoc extends Model
|
||||
return $quanti;
|
||||
}
|
||||
|
||||
private static function getEntityFolder($entity)
|
||||
private static function getEntityFolder($id)
|
||||
{
|
||||
$entity_resolve=[
|
||||
0=>'Movimenti',
|
||||
1=>'Contratti',
|
||||
2=>'Automobili',
|
||||
3=>'Progetti',
|
||||
4=>'Documenti',
|
||||
];
|
||||
return $entity_resolve[$entity];
|
||||
$entita = Documenti::where('id',$id)->pluck('path');
|
||||
|
||||
return $entita[0];
|
||||
//return $entita->path;
|
||||
}
|
||||
}
|
||||
|
@ -380,8 +380,9 @@ return [
|
||||
[
|
||||
'text' => 'Documenti gen.',
|
||||
'url' => '/admin/documenti',
|
||||
'icon' => 'fas fa-fw fa-newspaper',
|
||||
'icon' => 'fas fa-fw fa-stop',
|
||||
'can' => ['documenti'],
|
||||
'color' => 'red',
|
||||
],
|
||||
[
|
||||
'text' => 'Contratti',
|
||||
|
6
public/js/app/listadoc.js
vendored
Normal file
6
public/js/app/listadoc.js
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
$(document).ready(function() {
|
||||
$('#listadoc').DataTable({
|
||||
"responsive": true,
|
||||
"order": [[0, "desc"]]
|
||||
});
|
||||
});
|
@ -39,8 +39,8 @@
|
||||
Lista dei documenti
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover" id="categorie">
|
||||
<div class="table-responsive" >
|
||||
<table class="table table-striped table-bordered table-hover" id="listadoc">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Descrizione</th>
|
||||
@ -68,6 +68,6 @@
|
||||
<!-- /.col-lg-12 -->
|
||||
|
||||
@endsection
|
||||
@section('script')
|
||||
<script src="/js/app/conti_categorie.js"></script>
|
||||
@section('js')
|
||||
<script src="/js/app/listadoc.js"></script>
|
||||
@endsection
|
||||
|
@ -26,7 +26,7 @@
|
||||
<tbody>
|
||||
@foreach($data as $dato)
|
||||
<tr>
|
||||
<td>{{$dato->descrizione}}</td>
|
||||
<td><a href="/admin/movimenti/docs?entity={{$dato->id}}">{{$dato->descrizione}}</a></td>
|
||||
<td>{{$dato->path}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
Loading…
Reference in New Issue
Block a user