Compare commits

...

2 Commits

4 changed files with 61 additions and 109 deletions

View File

@ -9,7 +9,7 @@ use Illuminate\Support\Facades\DB;
class Progetti extends Model
{
use HasFactory;
public static function getProgetti() {
return DB::table('progettis')
->select(
@ -23,9 +23,9 @@ class Progetti extends Model
'budget',
'stato',
'note')
->join('users','progettis.fk_user','=','users.id')->get();
->join('users','progettis.fk_user','=','users.id')->get();
}
public static function getProgettoById($id){
return DB::table('progettis')->
join('users','progettis.fk_user','=','users.id')->
@ -33,7 +33,7 @@ class Progetti extends Model
where('progettis.id','=',$id)->
get();
}
public static function saveProgetto($progetto){
DB::table('progettis')->insert([
'nome'=>$progetto['nome'],
@ -46,12 +46,24 @@ class Progetti extends Model
'stato'=>$progetto['stato'],
'note'=>$progetto['note']
]);
}
public static function delProgetto($progetto_id)
{
DB::table('progettis')->delete($progetto_id);
}
public static function chiudiProgetto($progetto_id)
{
// chiude il progetto e lo rende non cancellabile e non più editabile
// potrà solo essere esportato in PDF
DB::table('progettis')
->where('id','=', $progetto_id)
->update([
'stato'=>'chiuso',
'data_fine'=>date('Y-m-d'),
]);
}
}

128
composer.lock generated
View File

@ -2342,33 +2342,36 @@
},
{
"name": "maennchen/zipstream-php",
"version": "v2.4.0",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "3fa72e4c71a43f9e9118752a5c90e476a8dc9eb3"
"reference": "b46726e666b5d2ad32959ae9492ee1034e798162"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/3fa72e4c71a43f9e9118752a5c90e476a8dc9eb3",
"reference": "3fa72e4c71a43f9e9118752a5c90e476a8dc9eb3",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b46726e666b5d2ad32959ae9492ee1034e798162",
"reference": "b46726e666b5d2ad32959ae9492ee1034e798162",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"myclabs/php-enum": "^1.5",
"php": "^8.0",
"psr/http-message": "^1.0"
"ext-zlib": "*",
"php-64bit": "^8.1"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.9",
"guzzlehttp/guzzle": "^6.5.3 || ^7.2.0",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "^8.5.8 || ^9.4.2",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.0"
},
"suggest": {
"guzzlehttp/psr7": "^2.4",
"psr/http-message": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
@ -2404,7 +2407,7 @@
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/v2.4.0"
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.0.2"
},
"funding": [
{
@ -2416,7 +2419,7 @@
"type": "open_collective"
}
],
"time": "2022-12-08T12:29:14+00:00"
"time": "2023-04-19T19:51:03+00:00"
},
{
"name": "markbaker/complex",
@ -2694,69 +2697,6 @@
],
"time": "2023-02-06T13:44:46+00:00"
},
{
"name": "myclabs/php-enum",
"version": "1.8.4",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483",
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.3 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
},
"classmap": [
"stubs/Stringable.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}
],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.4"
},
"funding": [
{
"url": "https://github.com/mnapoli",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
"type": "tidelift"
}
],
"time": "2022-08-04T09:53:51+00:00"
},
{
"name": "nesbot/carbon",
"version": "2.67.0",
@ -3221,16 +3161,16 @@
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.28.0",
"version": "1.29.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "6e81cf39bbd93ebc3a4e8150444c41e8aa9b769a"
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/6e81cf39bbd93ebc3a4e8150444c41e8aa9b769a",
"reference": "6e81cf39bbd93ebc3a4e8150444c41e8aa9b769a",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"shasum": ""
},
"require": {
@ -3248,7 +3188,7 @@
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
@ -3260,12 +3200,12 @@
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.2.4",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
@ -3320,9 +3260,9 @@
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.28.0"
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0"
},
"time": "2023-02-25T12:24:49+00:00"
"time": "2023-06-14T22:48:31+00:00"
},
{
"name": "phpoption/phpoption",
@ -3606,16 +3546,16 @@
},
{
"name": "psr/http-message",
"version": "1.1",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
@ -3624,7 +3564,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
@ -3639,7 +3579,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
@ -3653,9 +3593,9 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/1.1"
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"time": "2023-04-04T09:50:52+00:00"
"time": "2023-04-04T09:54:51+00:00"
},
{
"name": "psr/log",
@ -10345,5 +10285,5 @@
"php": "^7.3|^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.2.0"
}

View File

@ -86,7 +86,7 @@
<div class="row">
<div class="col-xs-10">
<div class="row p-3">
<button class="btn btn-primary open_modal_addRow">Nuova riga</button>
@if($progetto->stato !='chiuso')<button class="btn btn-primary open_modal_addRow">Nuova riga</button>@endif
</div>
<div class="row">
<table class="table table-striped table-bordered table-hover"
@ -107,11 +107,11 @@
<td>{{ $riga->descrizione }}</td>
<td>{{ $riga->ore }}</td>
<td>{{ $riga->prezzo }}</td>
<td><a
<td>@if($progetto->stato !='chiuso')<a
href="/admin/progetti/delete_row/{{ $riga->id }}/return/{{ $progetto->id }}"
class="btn btn-danger">X</a> &nbsp;
<button class="btn btn-warning btn-detail open_modal"
value="{{$riga->id}}">Edit</button></td>
value="{{$riga->id}}">Edit</button>@endif</td>
</tr>
@else
@ -138,7 +138,7 @@
</div>
<!-- MODAL EDIT Riga-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<form method="POST" action="/admin/progetti/rigaupdate">
<div class="modal-dialog" role="document">
@ -182,8 +182,8 @@
<div class="modal-footer">
<div class="col-xs-12">
<input type="hidden" name="fk_id_progetto" id="id_progetto_u">
<input type="hidden" name="idriga" id="idriga">
<input type="hidden" name="fk_id_progetto" id="id_progetto_u">
<input type="hidden" name="idriga" id="idriga">
<input type="submit" name="Submit" class="form-control" value="Aggiorna">
</div>

View File

@ -42,8 +42,8 @@
<td>{{ $progetto->stato; }}</td>
<td>{{ $progetto->name; }}</td>
<td>{{ $progetto->budget; }}</td>
<td><a href="progetti/delete?id={{ $progetto->progetto }}"
class="btn btn-danger">Cancella</a></td>
<td>@if($progetto->stato != 'chiuso')<a href="progetti/delete?id={{ $progetto->progetto }}"
class="btn btn-danger">Cancella</a>@endif</td>
</tr>
@endforeach
</tbody>