Agginto funzionalità di popup mosale per modifica riga progetto
TODO: Post del form ancora non funzionante.
This commit is contained in:
parent
8c1245bfaf
commit
e232f571a3
@ -17,4 +17,12 @@ class RigaProgettoController extends Controller
|
|||||||
// Ritorna alla pagina dei dettagli del progetto
|
// Ritorna alla pagina dei dettagli del progetto
|
||||||
return redirect('/admin/progetti/detail/?id='.$id_progetto);
|
return redirect('/admin/progetti/detail/?id='.$id_progetto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function editRiga($id)
|
||||||
|
{
|
||||||
|
// modifica della riga inserita
|
||||||
|
//return redirect('/admin/progetti/editDetail');
|
||||||
|
$data=RigaProgetto::getRigaById($id);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,4 +35,9 @@ class RigaProgetto extends Model
|
|||||||
{
|
{
|
||||||
return DB::table('riga_progettos')->select(DB::raw('SUM(prezzo) as costo'))->where('fk_id_progetto','=',$id)->get();
|
return DB::table('riga_progettos')->select(DB::raw('SUM(prezzo) as costo'))->where('fk_id_progetto','=',$id)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getRigaById($id)
|
||||||
|
{
|
||||||
|
return DB::table('riga_progettos')->where('id','=',$id)->get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
66
resources/views/progetti/demomodal.blade.php
Normal file
66
resources/views/progetti/demomodal.blade.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bootstrap Modal Example in Laravel - Websolutionstuff</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<br>
|
||||||
|
<h3>Bootstrap Modal Example in Laravel - Websolutionstuff</h3>
|
||||||
|
<form method="post" action="#">
|
||||||
|
<br><br>
|
||||||
|
<table class="table-bordered table-striped" width="50%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">No.</th>
|
||||||
|
<th class="text-center">Name</th>
|
||||||
|
<th class="text-center"> Example</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">1</td>
|
||||||
|
<td class="text-center">Admin</td>
|
||||||
|
<td class="text-center"><button type="button" class="btn btn-primary m-2" data-toggle="modal" data-target="#demoModal">Click Here</button> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">2</td>
|
||||||
|
<td class="text-center">Test</td>
|
||||||
|
<td class="text-center"><button type="button" class="btn btn-primary m-2" data-toggle="modal" data-target="#demoModal">Click Here</button> </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
<!-- Modal Example Start-->
|
||||||
|
<div class="modal fade" id="demoModal" tabindex="-1" role="dialog" aria-labelledby="demoModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="demoModalLabel">Modal Example -
|
||||||
|
Websolutionstuff</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
Welcome, Websolutionstuff !!
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary">Save
|
||||||
|
changes</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Modal Example End-->
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -159,7 +159,8 @@
|
|||||||
<td>{{ $riga->descrizione }}</td>
|
<td>{{ $riga->descrizione }}</td>
|
||||||
<td>{{ $riga->ore }}</td>
|
<td>{{ $riga->ore }}</td>
|
||||||
<td>{{ $riga->prezzo }}</td>
|
<td>{{ $riga->prezzo }}</td>
|
||||||
<td><a href="delete_row/{{ $riga->id }}/return/{{ $progetto->id }}" class="btn btn-danger">X</a></td>
|
<td><a href="delete_row/{{ $riga->id }}/return/{{ $progetto->id }}" class="btn btn-danger">X</a><button class="btn btn-warning btn-detail open_modal" value="{{$riga->id}}">Edit</button></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@else
|
@else
|
||||||
<tr>
|
<tr>
|
||||||
@ -170,18 +171,69 @@
|
|||||||
</tr>
|
</tr>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
<tr>
|
|
||||||
<td colspan="2"><strong>Totale</strong></td>
|
|
||||||
<td></td>
|
|
||||||
<td><strong>{{ $totale->costo}} €</strong></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2"><strong>Totale</strong></td>
|
||||||
|
<td></td>
|
||||||
|
<td><strong>{{ $totale->costo}} €</strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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="panel-heading" id="form">Modifica Riga</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<form method="POST" action="">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
@csrf
|
||||||
|
<div class="col-xs-2">
|
||||||
|
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<label for="tdata" class="form-label">data:</label>
|
||||||
|
<input type="date" name="data" class="form-control" id="data_u" value="">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<label for="desc" class="form-label">descrizione:</label>
|
||||||
|
<input type="text" name="descrizione" class="form-control" id="desc_u" value="">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<label for="ore" class="form-label">ore lavoro:</label>
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<input type="text" name="ore" class="form-control" id="ore_u" >
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<label for="prezzo" class="form-label">prezzo:</label>
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<input type="text" name="prezzo" class="form-control" id="prezzo_u" >
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-1">
|
||||||
|
<input type="hidden" name="fk_id_progetto" >
|
||||||
|
<input type="submit" name="Submit" class="form-control">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- /.col-lg-12 -->
|
<!-- /.col-lg-12 -->
|
||||||
|
|
||||||
@endsection @section('script')
|
@endsection @section('script')
|
||||||
@ -198,6 +250,21 @@
|
|||||||
$("#dettaglio").click(function(){
|
$("#dettaglio").click(function(){
|
||||||
$('[hidable]').toggle();
|
$('[hidable]').toggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click','.open_modal',function(){
|
||||||
|
var url = "detail/edit";
|
||||||
|
var riga_id= $(this).val();
|
||||||
|
$.get(url + '/' + riga_id, function (data) {
|
||||||
|
//success data
|
||||||
|
console.log(data);
|
||||||
|
console.log(data[0].descrizione);
|
||||||
|
$('#data_u').val(data[0].data);
|
||||||
|
$('#desc_u').val(data[0].descrizione);
|
||||||
|
$('#ore_u').val(data[0].ore);
|
||||||
|
$('#prezzo_u').val(data[0].prezzo);
|
||||||
|
$('#myModal').modal('show');
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
45
resources/views/progetti/editriga.blade.php
Normal file
45
resources/views/progetti/editriga.blade.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
@extends('progetti.dettaglio')
|
||||||
|
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="panel-heading" id="form">Modifica Riga</div>
|
||||||
|
@
|
||||||
|
<div class="panel-body">
|
||||||
|
<form method="POST" action="">
|
||||||
|
<div class="row">
|
||||||
|
@csrf
|
||||||
|
<div class="col-xs-2">
|
||||||
|
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<label for="tdata" class="form-label">data:</label> <input
|
||||||
|
type="date" name="data" class="form-control" id="data"
|
||||||
|
value="{{ $dato->data }}">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<label for="desc" class="form-label">descrizione:</label>
|
||||||
|
<input type="text" name="descrizione" class="form-control" id="desc" value="{{ $dato->descrizione }}">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<label for="ore" class="form-label">ore lavoro:</label>
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<input type="text" name="ore" class="form-control" id="ore" value="{{ $dato->ore }}">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<label for="prezzo" class="form-label">prezzo:</label>
|
||||||
|
<!-- Form per task con jquery e aggiunta righe automatica -->
|
||||||
|
<input type="text" name="prezzo" class="form-control" id="prezzo" value="{{ $dato->prezzo }}">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-1">
|
||||||
|
<input type="hidden" name="fk_id_progetto" value="{{ $dato->fk_id_progetto }}">
|
||||||
|
<input type="submit" name="Submit" class="form-control">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -114,6 +114,7 @@ Route::get('/', [MovimentiController::class,'dashboard']);
|
|||||||
Route::get('progetti/delete_row/{id_row}/return/{id_prog}',[RigaProgettoController::class, 'deleterow']);
|
Route::get('progetti/delete_row/{id_row}/return/{id_prog}',[RigaProgettoController::class, 'deleterow']);
|
||||||
Route::get('progetti/detail', [ProgettiController::class, 'dettaglioProgetto'])->name('detail');
|
Route::get('progetti/detail', [ProgettiController::class, 'dettaglioProgetto'])->name('detail');
|
||||||
Route::post('progetti/detail', [ProgettiController::class, 'inserisciTask']);
|
Route::post('progetti/detail', [ProgettiController::class, 'inserisciTask']);
|
||||||
|
Route::get('progetti/detail/edit/{id}', [RigaProgettoController::class, 'editRiga'])->name('detailedit');
|
||||||
|
|
||||||
/// TEST routes
|
/// TEST routes
|
||||||
Route::get('fullcalendar', [FullCalenderController::class, 'index']);
|
Route::get('fullcalendar', [FullCalenderController::class, 'index']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user