Popup Modifica Tags aggiornato e funzionante
This commit is contained in:
parent
377b41c629
commit
b8fd41357f
@ -25,14 +25,10 @@ class TagController extends Controller
|
|||||||
return view('components.calendar');
|
return view('components.calendar');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateTag(Request $request)
|
public function updateTag($id)
|
||||||
{
|
{
|
||||||
$id=$request['id'];
|
|
||||||
$tags=tag::getById($id);
|
$tags=tag::getById($id);
|
||||||
return view('conti.tags.update',
|
return json_encode($tags);
|
||||||
[
|
|
||||||
'tags'=> $tags,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatePostTag(Request $request)
|
public function updatePostTag(Request $request)
|
||||||
|
@ -1,54 +1,93 @@
|
|||||||
@extends('admin')
|
@extends('admin') @section('content')
|
||||||
@section('content')
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header">Lista dei tag</h1>
|
<h1 class="page-header">Lista dei tag</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Content here -->
|
<!-- Content here -->
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="tag" class="form-label">Tag</label>
|
<label for="tag" class="form-label">Tag</label> <input type="text"
|
||||||
<input type="text" class="form-control" id="tag" name="tag_name">
|
class="form-control" id="tag" name="tag_name">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Inserisci nuovo Tag</button>
|
<button type="submit" class="btn btn-primary">Inserisci nuovo Tag</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-bordered table-hover" id="tags">
|
<table class="table table-striped table-bordered table-hover"
|
||||||
<thead>
|
id="tags">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Tag</th>
|
<tr>
|
||||||
<th>Azione</th>
|
<th>Tag</th>
|
||||||
</tr>
|
<th>Azione</th>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
@foreach($tags as $tag)
|
<tbody>
|
||||||
<tr>
|
@foreach($tags as $tag)
|
||||||
<td><a href="movimenti/filter/tags?tag={{ $tag->id }}">{{ $tag->tag_name; }}</a></td>
|
<tr>
|
||||||
<td>
|
<td><a href="movimenti/filter/tags?tag={{ $tag->id }}">{{
|
||||||
<a class="btn btn-primary" href="/admin/tagmodify?id={{ $tag->id; }}"><i class="fa fa-pencil-square-o fw"></i></a>
|
$tag->tag_name; }}</a></td>
|
||||||
<a class="btn btn-danger" href="/admin/tagdelete?id={{ $tag->id; }}"><i class="fa fa-trash-o fa-fw"></i></a>
|
<td><button class="btn btn-warning btn-detail open_modal" value="{{ $tag->id; }}">Edit</button> <a
|
||||||
</td>
|
class="btn btn-danger" href="/admin/tagdelete?id={{ $tag->id; }}"><i
|
||||||
</tr>
|
class="fa fa-trash-o fa-fw"></i></a> </td>
|
||||||
@endforeach
|
</tr>
|
||||||
</tbody>
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
|
||||||
|
aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Modifica tags</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<form action="tagmodify" method="POST">
|
||||||
|
@csrf
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="tag_name" class="form-label">Tag</label> <input
|
||||||
|
type="text" class="form-control" id="tag_name" size="50"
|
||||||
|
name="tag_name" value="">
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="id" id="tag_id" value="">
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- /.col-lg-12 -->
|
||||||
|
|
||||||
<!-- /.col-lg-12 -->
|
@endsection @section('script')
|
||||||
|
|
||||||
@endsection
|
|
||||||
@section('script')
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#tags').DataTable({
|
$('#tags').DataTable({
|
||||||
responsive: true
|
responsive: true
|
||||||
});
|
});
|
||||||
|
$(document).on('click','.open_modal',function(){
|
||||||
|
var url = "tagmodify";
|
||||||
|
var riga_id= $(this).val();
|
||||||
|
$.getJSON(url + '/' + riga_id, function (data) {
|
||||||
|
//success data
|
||||||
|
console.log(data[0]);
|
||||||
|
console.log(data[0].tag_name);
|
||||||
|
$('#tag_name').val(data[0].tag_name);
|
||||||
|
$('#tag_id').val(data[0].id);
|
||||||
|
$('#myModal').modal('show');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -54,7 +54,7 @@ Route::get('/', [MovimentiController::class,'dashboard']);
|
|||||||
// TAGS
|
// TAGS
|
||||||
Route::get('tags', [TagController::class,'listTags'])->name('tags');
|
Route::get('tags', [TagController::class,'listTags'])->name('tags');
|
||||||
Route::post('tags', [TagController::class,'insTags']);
|
Route::post('tags', [TagController::class,'insTags']);
|
||||||
Route::get('tagmodify', [TagController::class,'updateTag']);
|
Route::get('tagmodify/{id}', [TagController::class,'updateTag']);
|
||||||
Route::post('tagmodify', [TagController::class,'updatePostTag']);
|
Route::post('tagmodify', [TagController::class,'updatePostTag']);
|
||||||
// CONSUMI
|
// CONSUMI
|
||||||
Route::get('letturegas', [ContatoreGasController::class,'listLettureGas'])->name('gas');
|
Route::get('letturegas', [ContatoreGasController::class,'listLettureGas'])->name('gas');
|
||||||
|
Loading…
Reference in New Issue
Block a user