Creato Avvisi e terminato task (manca editing)
This commit is contained in:
parent
48606856c4
commit
b5eb6c383b
10
app/Http/Controllers/AvvisoController.php
Normal file
10
app/Http/Controllers/AvvisoController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AvvisoController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
@ -20,9 +20,19 @@ class TaskController extends Controller
|
||||
return view('tasks.list',['tasks'=>$this->listTask()]);
|
||||
}
|
||||
|
||||
public function newTask()
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
11
app/Models/Avviso.php
Normal file
11
app/Models/Avviso.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Avviso extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
@ -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()
|
||||
|
@ -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",
|
||||
|
67
composer.lock
generated
67
composer.lock
generated
@ -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",
|
||||
@ -10285,5 +10348,5 @@
|
||||
"php": "^7.3|^8.0"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
||||
|
@ -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,
|
||||
|
||||
],
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?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');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('avvisos');
|
||||
}
|
||||
}
|
8
public/js/app/dashboard.js
vendored
8
public/js/app/dashboard.js
vendored
@ -3,4 +3,12 @@ $(document).ready(function() {
|
||||
$('#categorie').DataTable({
|
||||
responsive: true
|
||||
});
|
||||
// Reload del div
|
||||
$.ajaxSetup({ cache: false });
|
||||
setInterval(function() {
|
||||
$('#mieitask').load('/admin');
|
||||
}, 8000);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
33
public/js/app/task.js
vendored
33
public/js/app/task.js
vendored
@ -21,38 +21,35 @@ var strDate = d.getFullYear() + '-' +
|
||||
(day<10 ? '0' : '') + day;
|
||||
|
||||
|
||||
$(document).on('click', '.open_modal_spesa', function() {
|
||||
$(document).on('click', '.open_modal_new', function() {
|
||||
console.log(strDate);
|
||||
$("#categoria").empty();
|
||||
$("#tags").empty();
|
||||
$("#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(' Nuovo movimento in uscita');
|
||||
$('#form').attr('action', '/admin/movimenti/spesa');
|
||||
$.getJSON("/admin/service/catlistSpesa", {}, function(cats) {
|
||||
$.each(cats, function(i, cat) {
|
||||
$("select[name='mov_fk_categoria']").append(
|
||||
new Option(cat.cat_name, cat.id)
|
||||
$('.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)
|
||||
)
|
||||
}
|
||||
);
|
||||
});
|
||||
$.getJSON("/admin/service/taglist", {}, function(tags) {
|
||||
$.each(tags, function(i, tag) {
|
||||
$("select[name='mov_fk_tags']").append(
|
||||
new Option(tag.tag_name, tag.id)
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
$(document).on('click', '.open_modal_entrata', function() {
|
||||
console.log(strDate);
|
||||
$("#categoria").empty();
|
||||
$("#titolo").empty();
|
||||
$("#tags").empty();
|
||||
$('#form').find('input[type="text"], textarea, input[type="number"],option').val("");
|
||||
$('#form').find('input[type="date"]').val(strDate);
|
||||
$('#myModal').modal('show');
|
||||
$('#myModal_new').modal('show');
|
||||
$('.modal-title').text('Nuovo movimento in entrata');
|
||||
$('#form').attr('action', '/admin/movimenti/entrata');
|
||||
$.getJSON("/admin/service/catlistEntrata", {}, function(data) {
|
||||
|
@ -109,12 +109,28 @@
|
||||
<div class="col-lg-6 col-md-8">
|
||||
<div class="chat-panel panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Attività a me assegnate
|
||||
Attività da svolgere
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="panel-body" id="mieitask">
|
||||
<ul class="chat">
|
||||
@foreach($mieitask as $task)
|
||||
<li class="left" clearfix>{{ $task->titolo }}</li>
|
||||
<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>
|
||||
@ -126,12 +142,28 @@
|
||||
<div class="col-lg-6 col-md-8">
|
||||
<div class="chat-panel panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Attività da me assegnate ad altri
|
||||
<i class="fa fa-arrow-circle-right"></i> Avvisi e informazioni
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul class="chat">
|
||||
@foreach($assegnati as $assegnato)
|
||||
<li class="left" clearfix>{{ $assegnato->titolo }}</li>
|
||||
<span class="chat-img pull-left">
|
||||
<!-- rendere immagine dinamica -->
|
||||
<img src="{{ Gravatar::get(App\Models\User::getUserById($assegnato->assegnato_a)->email)}}" width="32" class="img-circle">
|
||||
</span>
|
||||
<div class="chat-body clearfix">
|
||||
<li class="left clearfix">
|
||||
@if($assegnato->stato==='Chiuso')
|
||||
<s>
|
||||
<a href="#{{ $assegnato->id }}"> {{ $assegnato->titolo }}</a>
|
||||
|
||||
{{$assegnato->descrizione}}</s>
|
||||
@else
|
||||
<b><a href="#{{ $assegnato->id }}"> {{ $assegnato->titolo }}</a></b>
|
||||
<h6>{{$assegnato->descrizione}}</h6>
|
||||
@endif
|
||||
</li>
|
||||
</div>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<li class="left" clearfix>
|
||||
<span class="chat-img pull-left">
|
||||
<!-- rendere immagine dinamica -->
|
||||
<img src="/images/default-logo.png" width="32" class="img-circle">
|
||||
<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}}
|
||||
@ -40,7 +40,64 @@
|
||||
</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/tasks.js">
|
||||
<script src="/js/app/task.js"></script>
|
||||
@endsection
|
@ -150,7 +150,8 @@ Route::group(['middleware'=>['permission:progetti']], function(){
|
||||
// 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']);
|
||||
});
|
||||
|
||||
// -- ONLY FOR TEST -- TO BE REMOVED //
|
||||
|
Loading…
Reference in New Issue
Block a user