Compare commits

..

10 Commits

21 changed files with 743 additions and 102 deletions

View File

@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Avviso;
class AvvisoController extends Controller
{
//
public function saveAvviso(Request $request)
{
Avviso::newAvviso($request);
return redirect()->back();
}
}

View File

@ -5,8 +5,12 @@ namespace App\Http\Controllers;
use App\Models\Categorie;
use App\Models\Movimenti;
use App\Models\tag;
use App\Models\Task;
use App\Models\Avviso;
// use App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;
use Rap2hpoutre\FastExcel\FastExcel;
class MovimentiController extends Controller
@ -41,11 +45,17 @@ class MovimentiController extends Controller
$entrate=Movimenti::getEntrate(date('Y'));
$uscite=Movimenti::getUscite(date('Y'));
$saldo=Movimenti::getSaldoTot();
$mieiTasks=Task::getTaskAssignedToUser(Auth::id());
// $TasksAssegnati=Task::getTaskAssignedByUser(Auth::id());
$avvisi=Avviso::getAvvisi();
return view('layouts.dashboard',[
'entrate'=>$entrate,
'uscite'=>$uscite,
'saldo'=>$saldo,
'mieitask' => $mieiTasks,
// 'assegnati' => $TasksAssegnati,
'avvisi'=>$avvisi,
]);
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Task;
class TaskController extends Controller
{
//
public function listTask()
{
return Task::all();
// debug
// return get_class_methods($this);
}
public function Task()
{
return view('tasks.list',['tasks'=>$this->listTask()]);
}
public function newTask(Request $data)
{
Task::create([
'titolo'=>$data['titolo'],
'descrizione'=>$data['descrizione'],
'assegnato_a'=>$data['assegnato_a'],
'creato_da'=>$data['creato_da'],
'termine_il'=>$data['termine_il'],
'creato_il'=>$data['creato_il'],
'chiuso_il'=>$data['chiuso_il'],
'stato'=>$data['stato'],
]);
return redirect()->back();
}
}

View File

@ -47,6 +47,10 @@ class Utenti extends Controller
return view('users.list',['users'=>$users]);
}
function getUsers(){
return User::getUsers();
}
function listRoles(){
$roles = Role::all();
return $roles;

28
app/Models/Avviso.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Avviso extends Model
{
use HasFactory;
protected $fillable=['avviso','creato_il', 'creato_da', 'urgente'];
public static function newAvviso($data)
{
self::create([
'avviso'=>$data['avviso'],
'creato_da'=>$data['creato_da'],
'creato_il'=>date('Y-m-d'),
'urgente'=>$data['urgente'],
]);
}
public static function getAvvisi()
{
return self::all();
}
}

46
app/Models/Task.php Normal file
View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Task extends Model
{
use HasFactory;
protected $fillable=['titolo','descrizione','creato_da','assegnato_a','creato_il','termine_il','chiuso_il','stato'];
public function getAllTasks()
{
return self::all();
}
//
public static function getTaskAssignedToUser($userid)
{
return self::where('assegnato_a',$userid)->get();
}
//
public static function getTaskAssignedByUser($userid)
{
return self::where('creato_da',$userid)->get();
}
public static function saveTask($collection)
{
self::create(
[
'titolo' => $collection['titolo'],
'descrizione'=>$collection['descrizione'],
'creato_da'=>$collection['creato_da'],
'assegnato_a'=>$collection['assegnato_a'],
'creato_il'=>date('Y-m-d'),
'termine_il'=>$collection['termine_il'],
'stato'=>'Aperto',
]
);
}
}

View File

@ -66,7 +66,7 @@ class User extends Authenticatable
public static function getUserById($id)
{
return DB::table('users')->where('id','=',$id)->get();
return DB::table('users')->where('id','=',$id)->first();
}
public static function getUsers()

View File

@ -10,6 +10,7 @@
"require" : {
"php": "^7.3|^8.0",
"barryvdh/laravel-dompdf": "^2.0",
"creativeorange/gravatar": "^1.0",
"directorytree/ldaprecord": "^2.9",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",

207
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e6ac2be787f145ea140b72b55e302e90",
"content-hash": "acd096c2d0a14521dd551b39dde1ef28",
"packages": [
{
"name": "asm89/stack-cors",
@ -350,6 +350,69 @@
],
"time": "2022-04-01T19:23:25+00:00"
},
{
"name": "creativeorange/gravatar",
"version": "v1.0.23",
"source": {
"type": "git",
"url": "https://github.com/creativeorange/gravatar.git",
"reference": "3a1b227c48091b039b967265ec13c0800c70ac79"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/creativeorange/gravatar/zipball/3a1b227c48091b039b967265ec13c0800c70ac79",
"reference": "3a1b227c48091b039b967265ec13c0800c70ac79",
"shasum": ""
},
"require": {
"illuminate/support": "^5|^6|^7|^8|^9|^10.0",
"php": ">=5.4.0"
},
"require-dev": {
"nunomaduro/larastan": "^0.6.2|^2.4",
"orchestra/testbench": "^5.4|^8.0",
"php": ">=7.2"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Creativeorange\\Gravatar\\GravatarServiceProvider"
],
"aliases": {
"Gravatar": "Creativeorange\\Gravatar\\Facades\\Gravatar"
}
}
},
"autoload": {
"psr-4": {
"Creativeorange\\Gravatar\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaco Tijssen",
"email": "jaco@creativeorange.nl",
"homepage": "https://www.creativeorange.nl",
"role": "Developer"
}
],
"description": "A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.",
"keywords": [
"avatar",
"gravatar",
"laravel"
],
"support": {
"issues": "https://github.com/creativeorange/gravatar/issues",
"source": "https://github.com/creativeorange/gravatar/tree/v1.0.23"
},
"time": "2023-02-06T07:57:20+00:00"
},
{
"name": "dflydev/dot-access-data",
"version": "v3.0.2",
@ -2342,16 +2405,16 @@
},
{
"name": "maennchen/zipstream-php",
"version": "3.0.2",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "b46726e666b5d2ad32959ae9492ee1034e798162"
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b46726e666b5d2ad32959ae9492ee1034e798162",
"reference": "b46726e666b5d2ad32959ae9492ee1034e798162",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"shasum": ""
},
"require": {
@ -2407,7 +2470,7 @@
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.0.2"
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0"
},
"funding": [
{
@ -2419,7 +2482,7 @@
"type": "open_collective"
}
],
"time": "2023-04-19T19:51:03+00:00"
"time": "2023-06-21T14:59:35+00:00"
},
{
"name": "markbaker/complex",
@ -2699,16 +2762,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.67.0",
"version": "2.68.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8"
"reference": "4f991ed2a403c85efbc4f23eb4030063fdbe01da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/c1001b3bc75039b07f38a79db5237c4c529e04c8",
"reference": "c1001b3bc75039b07f38a79db5237c4c529e04c8",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4f991ed2a403c85efbc4f23eb4030063fdbe01da",
"reference": "4f991ed2a403c85efbc4f23eb4030063fdbe01da",
"shasum": ""
},
"require": {
@ -2797,7 +2860,7 @@
"type": "tidelift"
}
],
"time": "2023-05-25T22:09:47+00:00"
"time": "2023-06-20T18:29:04+00:00"
},
{
"name": "nette/schema",
@ -2950,16 +3013,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.15.5",
"version": "v4.16.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e"
"reference": "19526a33fb561ef417e822e85f08a00db4059c17"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e",
"reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17",
"reference": "19526a33fb561ef417e822e85f08a00db4059c17",
"shasum": ""
},
"require": {
@ -3000,9 +3063,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0"
},
"time": "2023-05-19T20:20:00+00:00"
"time": "2023-06-25T14:52:30+00:00"
},
{
"name": "opis/closure",
@ -4765,16 +4828,16 @@
},
{
"name": "spatie/db-dumper",
"version": "3.3.1",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/db-dumper.git",
"reference": "3b9fd47899bf6a59d3452392121c9ce675d55d34"
"reference": "bbd5ae0f331d47e6534eb307e256c11a65c8e24a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/db-dumper/zipball/3b9fd47899bf6a59d3452392121c9ce675d55d34",
"reference": "3b9fd47899bf6a59d3452392121c9ce675d55d34",
"url": "https://api.github.com/repos/spatie/db-dumper/zipball/bbd5ae0f331d47e6534eb307e256c11a65c8e24a",
"reference": "bbd5ae0f331d47e6534eb307e256c11a65c8e24a",
"shasum": ""
},
"require": {
@ -4812,7 +4875,7 @@
"spatie"
],
"support": {
"source": "https://github.com/spatie/db-dumper/tree/3.3.1"
"source": "https://github.com/spatie/db-dumper/tree/3.4.0"
},
"funding": [
{
@ -4824,7 +4887,7 @@
"type": "github"
}
],
"time": "2023-05-02T11:05:31+00:00"
"time": "2023-06-27T08:34:52+00:00"
},
{
"name": "spatie/laravel-backup",
@ -4981,16 +5044,16 @@
},
{
"name": "spatie/laravel-permission",
"version": "5.10.1",
"version": "5.10.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-permission.git",
"reference": "d08b3ffc5870cce4a47a39f22174947b33c191ae"
"reference": "671e46e079cbd4990a98427daaa09f4977b57ca9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/d08b3ffc5870cce4a47a39f22174947b33c191ae",
"reference": "d08b3ffc5870cce4a47a39f22174947b33c191ae",
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/671e46e079cbd4990a98427daaa09f4977b57ca9",
"reference": "671e46e079cbd4990a98427daaa09f4977b57ca9",
"shasum": ""
},
"require": {
@ -5051,7 +5114,7 @@
],
"support": {
"issues": "https://github.com/spatie/laravel-permission/issues",
"source": "https://github.com/spatie/laravel-permission/tree/5.10.1"
"source": "https://github.com/spatie/laravel-permission/tree/5.10.2"
},
"funding": [
{
@ -5059,7 +5122,7 @@
"type": "github"
}
],
"time": "2023-04-12T17:08:32+00:00"
"time": "2023-07-04T13:38:13+00:00"
},
{
"name": "spatie/laravel-signal-aware-command",
@ -5864,16 +5927,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v5.4.24",
"version": "v5.4.25",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "3c59f97f6249ce552a44f01b93bfcbd786a954f5"
"reference": "f66be2706075c5f6325d2fe2b743a57fb5d23f6b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/3c59f97f6249ce552a44f01b93bfcbd786a954f5",
"reference": "3c59f97f6249ce552a44f01b93bfcbd786a954f5",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/f66be2706075c5f6325d2fe2b743a57fb5d23f6b",
"reference": "f66be2706075c5f6325d2fe2b743a57fb5d23f6b",
"shasum": ""
},
"require": {
@ -5920,7 +5983,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v5.4.24"
"source": "https://github.com/symfony/http-foundation/tree/v5.4.25"
},
"funding": [
{
@ -5936,20 +5999,20 @@
"type": "tidelift"
}
],
"time": "2023-05-19T07:21:23+00:00"
"time": "2023-06-22T08:06:06+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v5.4.24",
"version": "v5.4.25",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "f38b722e1557eb3f487d351b48f5a1279b50e9d1"
"reference": "f6c92fe64bbdad7616cb90663c24f6350f3ca464"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/f38b722e1557eb3f487d351b48f5a1279b50e9d1",
"reference": "f38b722e1557eb3f487d351b48f5a1279b50e9d1",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/f6c92fe64bbdad7616cb90663c24f6350f3ca464",
"reference": "f6c92fe64bbdad7616cb90663c24f6350f3ca464",
"shasum": ""
},
"require": {
@ -6032,7 +6095,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v5.4.24"
"source": "https://github.com/symfony/http-kernel/tree/v5.4.25"
},
"funding": [
{
@ -6048,7 +6111,7 @@
"type": "tidelift"
}
],
"time": "2023-05-27T08:06:30+00:00"
"time": "2023-06-26T05:58:08+00:00"
},
{
"name": "symfony/mime",
@ -6936,16 +6999,16 @@
},
{
"name": "symfony/routing",
"version": "v5.4.22",
"version": "v5.4.25",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "c2ac11eb34947999b7c38fb4c835a57306907e6d"
"reference": "56bfc1394f7011303eb2e22724f9b422d3f14649"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/c2ac11eb34947999b7c38fb4c835a57306907e6d",
"reference": "c2ac11eb34947999b7c38fb4c835a57306907e6d",
"url": "https://api.github.com/repos/symfony/routing/zipball/56bfc1394f7011303eb2e22724f9b422d3f14649",
"reference": "56bfc1394f7011303eb2e22724f9b422d3f14649",
"shasum": ""
},
"require": {
@ -7006,7 +7069,7 @@
"url"
],
"support": {
"source": "https://github.com/symfony/routing/tree/v5.4.22"
"source": "https://github.com/symfony/routing/tree/v5.4.25"
},
"funding": [
{
@ -7022,7 +7085,7 @@
"type": "tidelift"
}
],
"time": "2023-03-14T14:59:20+00:00"
"time": "2023-06-05T14:18:47+00:00"
},
{
"name": "symfony/service-contracts",
@ -7367,16 +7430,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v5.4.24",
"version": "v5.4.25",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "8e12706bf9c68a2da633f23bfdc15b4dce5970b3"
"reference": "82269f73c0f0f9859ab9b6900eebacbe54954ede"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/8e12706bf9c68a2da633f23bfdc15b4dce5970b3",
"reference": "8e12706bf9c68a2da633f23bfdc15b4dce5970b3",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/82269f73c0f0f9859ab9b6900eebacbe54954ede",
"reference": "82269f73c0f0f9859ab9b6900eebacbe54954ede",
"shasum": ""
},
"require": {
@ -7435,7 +7498,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v5.4.24"
"source": "https://github.com/symfony/var-dumper/tree/v5.4.25"
},
"funding": [
{
@ -7451,7 +7514,7 @@
"type": "tidelift"
}
],
"time": "2023-05-25T13:05:00+00:00"
"time": "2023-06-20T20:56:26+00:00"
},
{
"name": "tightenco/collect",
@ -8249,16 +8312,16 @@
},
{
"name": "filp/whoops",
"version": "2.15.2",
"version": "2.15.3",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73"
"reference": "c83e88a30524f9360b11f585f71e6b17313b7187"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/aac9304c5ed61bf7b1b7a6064bf9806ab842ce73",
"reference": "aac9304c5ed61bf7b1b7a6064bf9806ab842ce73",
"url": "https://api.github.com/repos/filp/whoops/zipball/c83e88a30524f9360b11f585f71e6b17313b7187",
"reference": "c83e88a30524f9360b11f585f71e6b17313b7187",
"shasum": ""
},
"require": {
@ -8308,7 +8371,7 @@
],
"support": {
"issues": "https://github.com/filp/whoops/issues",
"source": "https://github.com/filp/whoops/tree/2.15.2"
"source": "https://github.com/filp/whoops/tree/2.15.3"
},
"funding": [
{
@ -8316,7 +8379,7 @@
"type": "github"
}
],
"time": "2023-04-12T12:00:00+00:00"
"time": "2023-07-13T12:00:00+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@ -8371,16 +8434,16 @@
},
{
"name": "laravel/sail",
"version": "v1.22.0",
"version": "v1.23.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/sail.git",
"reference": "923e1e112b6a8598664dbb0ee79dd3137f1c9d56"
"reference": "62582606f80466aa81fba40b193b289106902853"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sail/zipball/923e1e112b6a8598664dbb0ee79dd3137f1c9d56",
"reference": "923e1e112b6a8598664dbb0ee79dd3137f1c9d56",
"url": "https://api.github.com/repos/laravel/sail/zipball/62582606f80466aa81fba40b193b289106902853",
"reference": "62582606f80466aa81fba40b193b289106902853",
"shasum": ""
},
"require": {
@ -8432,7 +8495,7 @@
"issues": "https://github.com/laravel/sail/issues",
"source": "https://github.com/laravel/sail"
},
"time": "2023-05-04T14:52:56+00:00"
"time": "2023-06-28T18:31:28+00:00"
},
{
"name": "mockery/mockery",
@ -9089,16 +9152,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.6.9",
"version": "9.6.10",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a9aceaf20a682aeacf28d582654a1670d8826778"
"reference": "a6d351645c3fe5a30f5e86be6577d946af65a328"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a9aceaf20a682aeacf28d582654a1670d8826778",
"reference": "a9aceaf20a682aeacf28d582654a1670d8826778",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6d351645c3fe5a30f5e86be6577d946af65a328",
"reference": "a6d351645c3fe5a30f5e86be6577d946af65a328",
"shasum": ""
},
"require": {
@ -9172,7 +9235,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.9"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.10"
},
"funding": [
{
@ -9188,7 +9251,7 @@
"type": "tidelift"
}
],
"time": "2023-06-11T06:13:56+00:00"
"time": "2023-07-10T04:04:23+00:00"
},
{
"name": "sebastian/cli-parser",
@ -10285,5 +10348,5 @@
"php": "^7.3|^8.0"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.2.0"
}

View File

@ -161,6 +161,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Creativeorange\Gravatar\GravatarServiceProvider::class,
/*
@ -232,6 +233,7 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'FastExcel' => Rap2hpoutre\FastExcel\Facades\FastExcel::class,
'Gravatar' => Creativeorange\Gravatar\Facade\Gravatar::class,
],

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tasks', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->string('titolo',255);
$table->longText('descrizione')->nullable();
$table->bigInteger('creato_da');
$table->bigInteger('assegnato_a');
$table->date('creato_il');
$table->date('termine_il');
$table->date('chiuso_il');
$table->enum('stato', ['Aperto', 'Chiuso'])->nullable()->default('Aperto');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tasks');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Subtask extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
Schema::create('subtasks', function (Blueprint $table) {
$table->id();
$table->timestamps();
// $table->bigInteger('tasks_id');
$table->foreignId('tasks_id')->onDelete('cascade');
$table->string('titolo',255);
$table->longText('descrizione')->nullable();
$table->bigInteger('creato_da');
$table->bigInteger('assegnato_a');
$table->date('creato_il');
$table->date('termine_il');
$table->date('chiuso_il');
$table->enum('stato', ['Aperto', 'Chiuso'])->nullable()->default('Aperto');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAvvisosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('avvisos', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->longtext('avviso');
$table->date('creato_il')->nullable()->default(date('Y-m-d'));
$table->bigInteger('creato_da');
$table->boolean('urgente')->nullable()->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('avvisos');
}
}

View File

@ -3,4 +3,14 @@ $(document).ready(function() {
$('#categorie').DataTable({
responsive: true
});
// Reload del div
/*
$.ajaxSetup({ cache: false });
setInterval(function() {
$('#mieitask').load('/admin');
}, 8000);
*/
});

View File

@ -117,10 +117,14 @@ $(document).on('click', '.open_modal_modifica', function() {
});
/*$.getJSON("/admin/service/taglist", {}, function(data) {
/*
$.getJSON("/admin/service/taglist", {}, function(data) {
$.each(data, function(i, item) {
$("select[name='mov_fk_tags']").append(
new Option(item.tag_name, item.id)
)
});
});*/
});
*/

127
public/js/app/task.js vendored Normal file
View File

@ -0,0 +1,127 @@
$(document).ready(function() {
$('#listatask').DataTable({
"responsive": true,
columnDefs: [
{
target: 0,
render: DataTable.render.date(),
}
],
"order": [[0, "desc"]]
});
});
var d = new Date();
var month = d.getMonth()+1;
var day = d.getDate();
var strDate = d.getFullYear() + '-' +
(month<10 ? '0' : '') + month + '-' +
(day<10 ? '0' : '') + day;
$(document).on('click', '.open_modal_new', function() {
console.log(strDate);
$("#titolo").empty();
$("#descrizione").empty();
$('#form').find('input[type="text"], textarea, input[type="number"],input[type="date"],option').val("");
$('#form').find('input[type="date"]').val(strDate);
$('#myModal').modal('show');
$('.modal-title').text(' Nuova attività');
$('#form').attr('action', '/admin/task/new');
$.getJSON("/admin/service/getUsers", {}, function(users) {
$.each(users, function(i, users) {
$("select[name='assegnato_a']").append(
new Option(users.name, users.id)
)
}
);
});
});
/*
$(document).on('click', '.open_modal_entrata', function() {
console.log(strDate);
$("#titolo").empty();
$("#tags").empty();
$('#form').find('input[type="text"], textarea, input[type="number"],option').val("");
$('#form').find('input[type="date"]').val(strDate);
$('#myModal_new').modal('show');
$('.modal-title').text('Nuovo movimento in entrata');
$('#form').attr('action', '/admin/movimenti/entrata');
$.getJSON("/admin/service/catlistEntrata", {}, function(data) {
$.each(data, function(i, item) {
$("select[name='mov_fk_categoria']").append(
new Option(item.cat_name, item.id)
)
}
);
});
$.getJSON("/admin/service/taglist", {}, function(data) {
$.each(data, function(i, item) {
$("select[name='mov_fk_tags']").append(
new Option(item.tag_name, item.id)
)
});
});
});
$(document).on('click', '.open_modal_modifica', function() {
var url = "/admin/movimenti/modify";
var riga_id = $(this).val();
$("#categoria").empty();
$("#tags").empty();
$.getJSON(url + '/' + riga_id, function(data) {
// success data
console.log(data[0]);
$.getJSON("/admin/service/taglist", {}, function(tags) {
$.each(tags, function(i, tag) {
$("select[name='mov_fk_tags']").append(
new Option(tag.tag_name, tag.id)
)
$('#tags')
.find('option:contains(' + data[0].tag_name + ')')
.prop('selected', true)
.trigger('change');
});
});
$.getJSON("/admin/service/catlist", {}, function(cats) {
$.each(cats, function(i, cat) {
$("select[name='mov_fk_categoria']").append(
new Option(cat.cat_name, cat.id)
)
$('#categoria')
.find('option:contains(' + data[0].cat_name + ')')
.prop('selected', true)
.trigger('change');
}
);
});
$('.modal-title').text('Modifica movimento');
$('#data').val(data[0].mov_data);
$('#descrizione').val(data[0].mov_descrizione);
$('#importo').val(data[0].mov_importo);
$('#myModal').modal('show');
// $('.panel-heading').text('Modifica movimento');
$('#form').attr('action', '/admin/movimenti/modify');
$('#form').append('<input type="hidden" name="id" value="' + riga_id + '">');
});
});
/*
$.getJSON("/admin/service/taglist", {}, function(data) {
$.each(data, function(i, item) {
$("select[name='mov_fk_tags']").append(
new Option(item.tag_name, item.id)
)
});
});
*/

View File

@ -51,7 +51,11 @@
Progetti <span class="fa arrow"></span></a></li>
@endcan
@can('tasks')
<li><a href="{{ route('tasks'); }}"><i class="fa fa-list fa-fw"></i>
Attività <span class="fa arrow"></span></a></li>
@endcan
@can('amministrazione')
<li><a href="#"><i class="fa fa-gears fa-fw"></i>Amministrazione<span
class="fa arrow"></span></a>

View File

@ -8,7 +8,7 @@
<div class="row">
@hasanyrole('user|admin')
<!-- WIDGET Bilancio -->
<div class="col-lg-4 col-md-8">
<div class="col-lg-3 col-md-8">
<div class="panel panel-success">
<div class="panel-heading">
<div class="row">
@ -31,7 +31,7 @@
</div>
</div>
<!-- WIDGET Bilancio -->
<div class="col-lg-4 col-md-8">
<div class="col-lg-3 col-md-8">
<div class="panel panel-danger">
<div class="panel-heading">
<div class="row">
@ -55,7 +55,7 @@
</div>
<!-- WIDGET -->
<div class="col-lg-4 col-md-8">
<div class="col-lg-3 col-md-8">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
@ -77,7 +77,7 @@
</a>
</div>
</div>
<div class="col-lg-4 col-md-8">
<div class="col-lg-3 col-md-8">
<div class="panel panel-yellow">
<div class="panel-heading">
<div class="row">
@ -100,9 +100,82 @@
</div>
</div>
@endhasanyrole
</div>
@can('tasks')
<!-- Se ha i permessi task -->
<div class="row">
<div class="col-lg-6 col-md-8">
<div class="chat-panel panel panel-default">
<div class="panel-heading">
Attività da svolgere
</div>
<div class="panel-body" id="mieitask">
<ul class="chat">
@foreach($mieitask as $task)
<span class="chat-img pull-left">
<!-- rendere immagine dinamica -->
<img src="{{ Gravatar::get(App\Models\User::getUserById($task->assegnato_a)->email)}}" width="32" class="img-circle">
</span>
<div class="chat-body clearfix">
<li class="left clearfix">
@if($task->stato==='Chiuso')
<s>
<a href="#{{ $task->id }}"> {{ $task->titolo }}</a>
</s><br>
<h6>{{$task->descrizione}}</h6>
@else
<b><a href="#{{ $task->id }}"> {{ $task->titolo }}</a></b><br>
<h6>{{$task->descrizione}}</h6>
@endif
</li>
</div>
@endforeach
</ul>
</div>
<div class="panel-footer">
</div>
</div>
</div>
<div class="col-lg-6 col-md-8">
<div class="chat-panel panel panel-default">
<div class="panel-heading">
<i class="fa fa-arrow-circle-right"></i> Avvisi e informazioni
</div>
<div class="panel-body">
<ul class="chat">
@foreach($avvisi as $avviso)
<span class="chat-img pull-left">
<!-- rendere immagine dinamica -->
<img src="{{ Gravatar::get(App\Models\User::getUserById($avviso->creato_da)->email)}}" width="32" class="img-circle">
</span>
<div class="chat-body clearfix">
<li class="left clearfix">
<a href="#{{ $avviso->id }}"><i>{{date_format(date_create($avviso->creato_il),'d/m/Y')}}</i> - {{ $avviso->avviso }}</a>
</li>
</div>
@endforeach
</ul>
</div>
<div class="panel-footer">
<form action="{{ Route('newAvviso') }}" method="POST">
@csrf
<label for="avviso" class="form-label">Nuovo Avviso:</label>
<textarea class="form-control" name="avviso"></textarea>
<input type="hidden" name="creato_da" value="{{ Auth::user()->id }}">
<input type="submit" name="submit" class="button btn-primary">
</form>
</div>
</div>
</div>
</div>
@endcan
@endsection
@section('script')
<script src="/js/app/dashboard.js"></script>
@endsection

View File

@ -0,0 +1,104 @@
@extends('admin')
@section('content')
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Lista Attività</h1>
</div>
</div>
<div class="container">
<!-- Content here -->
<div class="row">
<div class="col-xs-12">
<button class="btn btn-primary open_modal_new"><i
class="fa fa-pencil-square-o fw"></i>Nuova Attività</button>
</div>
</div>
<div class ="row">
<div class="col">
<div class="panel">
<div class="panel-header">
Tutte le Attività
</div>
<div class="panel-body">
<ul class="chat">
@foreach($tasks as $task)
<li class="left" clearfix>
<span class="chat-img pull-left">
<!-- rendere immagine dinamica -->
<img src="{{ Gravatar::get(App\Models\User::getUserById($task->assegnato_a)->email )}}" width="32" class="img-circle">
</span>
<div class="chat-body clearfix">
{{ $task->titolo}}
</div>
</li>
@endforeach
</ul>
</div>
<div class="panel-footer">
</div>
</div>
</div>
</div>
</div>
<!-- HIDDEN -->
<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="modal-header">
<h4 class="modal-title">Nuova Attività</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-10">
<!-- FORM INSERIMENTO NUOVA CATEGORIA -->
<form action="" method="POST" id="form">
@csrf
<label for="titolo" class="form-label">Titolo:</label>
<input type="text" class="form-control" id="titolo"
name="titolo" size="50">
</div>
</div>
<div class="row">
<div class="col-md-10">
<label for="descrizione" class="form-label">Descrizione:</label>
<textarea class="form-control" name="descrizione" id="descrizione"></textarea>
</div>
</div>
<div class="row">
<div class="col-md-5">
<label for="assegnato_a" class="form-label">Assegna a:</label>
<!-- SELECT USER -->
<select name="assegnato_a" id="assegnato_a" class="form-control">
</select>
</div>
<div class="col-md-5">
<!-- Data termine datetimepicker -->
<label for="termine_il" class="form-label">Termine:</label>
<input type="date" name="termine_il" class="form-control" value="{{ date('Y-m-d'); }}" id="termine_il">
</div>
</div>
</div>
<div class="modal-footer">
<input type="hidden" name="creato_da" value="{{ Auth::user()->id }}">
<input type="hidden" name="stato" value="Aperto">
<input type="hidden" name="creato_il" value="{{ date('Y-m-d'); }}">
<input type="hidden" name="chiuso_il" value="{{ date('Y-m-d'); }}">
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<!-- FINE FORM INSERIMENTO NUOVA CATEGORIA -->
</div>
</div>
</div>
</div>
@endsection
@section('script')
<script src="/js/app/task.js"></script>
@endsection

View File

@ -15,6 +15,8 @@ use App\Http\Controllers\AutoController;
use App\Http\Controllers\AnagraficaController;
use App\Http\Controllers\Utenti;
use App\Http\Controllers\ProgettiController;
use App\Http\Controllers\TaskController;
use App\Http\Controllers\AvvisoController;
use App\Mail\myTestEmail;
/*
@ -123,7 +125,6 @@ Route::group(['middleware'=>['permission:amministrazione']], function(){
Route::post('users/new',[Utenti::class,'createUser']);
Route::get('users/roles',[Utenti::class,'listRoles']);
Route::get('users/delete/{id}',[Utenti::class,'deleteUser']);
//});
Route::get('users/givepermission',[Utenti::class,'givePermissionToUser']);
Route::post('users/givepermission',[Utenti::class,'assignPermission']);
Route::get('users/giverole',[Utenti::class,'giveRoleToUser']);
@ -147,35 +148,24 @@ Route::group(['middleware'=>['permission:progetti']], function(){
Route::get('progetti/print',[ProgettiController::class,'stampaPDFProgetto']);
});
/// RIVISTA
Route::group(['middleware'=>['permission:rivista']], function(){
Route::get('rivista',[RivistaController::class,'rivistaHome'])->name('rivista');
Route::get('rivista/pubblica',[RivistaController::class,'rivistaDigCarica']);
Route::post('rivista/pubblica',[RivistaController::class,'rivistaDigPubblica']);
Route::get('rivista/abbonati',[RivistaController::class,'rivistaAbbonati']);
Route::get('rivista/abbonamenti',[RivistaController::class,'rivistaAbbonamenti']);
Route::get('rivista/abbonamenti/rinnovo',[RivistaController::class,'rivistaAbbonamentiRinnovo']);
Route::get('rivista/abbonamenti/nuovo',[RivistaController::class,'rivistaAbbonamentiNuovo']);
Route::get('rivista/abbonamenti/scadenza',[RivistaController::class,'rivistaAbbonamentiScadono']);
Route::get('rivista/new',[RivistaController::class,'rivistaNuova']);
Route::get('rivista/archivio',[RivistaController::class,'rivistaArchivio']);
// TASKS
Route::group(['middleware'=>['permission:tasks']], function(){
Route::get('tasks', [TaskController::class, 'Task'])->name('tasks');
Route::post('task/new',[TaskController::class, 'newTask']);
Route::get('service/getUsers', [Utenti::class,'getUsers']);
});
/// ASSOCIAZIONE
Route::group(['middleware'=>['permission:associazione']], function(){
Route::get('associazione',[AssociazioneController::class,'assocHome'])->name('associazione');
});
/// GRUPPI
Route::group(['middleware'=>['permission:gruppi']], function(){
Route::get('gruppi',[GruppiController::class,'gruppiHome'])->name('gruppi');
Route::group(['middleware'=>['permission:avvisi']], function(){
Route::post('avvisi/new',[AvvisoController::class,'saveAvviso'])->name('newAvviso');
});
// -- ONLY FOR TEST -- TO BE REMOVED //
/// TEST ROUTES
Route::get('test/fullcalendar', [FullCalenderController::class, 'index']);
Route::post('test/fullcalendar', [FullCalenderController::class, 'ajax']);
Route::get('test/condominio',[CondominioController::class,'testPdf']);
Route::get('test/err403',[CondominioController::class,'err403']);
Route::get('test/err403',[CondominioController::class,'err403'])->name('errore-403');
Route::get('test/user_role',[CondominioController::class,'user_role']);
Route::get('test/userclass',[Utenti::class,'userClass']);

View File

@ -20,6 +20,9 @@ use App\Http\Controllers\MovimentiController;
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::group(['middleware'=>['permission:conti']], function(){
Route::get('categories', [CategorieController::class,'apiList']);
Route::get('tags', [TagController::class,'apiList']);
Route::get('movements', [MovimentiController::class,'apiList']);
});