ALPHA 3.0.3

This commit is contained in:
TheGamecraft
2018-09-11 14:26:31 -04:00
parent 14cea968d2
commit d1c3d60791
11 changed files with 98 additions and 10 deletions

View File

@@ -445,8 +445,15 @@ class CalendarController extends Controller
$schedule->save(); $schedule->save();
/** Logs and Notification */ /** Logs and Notification */
Log::saveLog("Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->event_date); Log::saveLog("Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->date);
$userToNotify = $schedule->getUserToNotify();
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->date,"/admin/calendar"));
if(\App\Config::where('name','is_schedule_build')->first()->state == 1)
{
\Notification::send($userToNotify, new mail(\Auth::User(),"Ajout d'une activité a l'horaire",\Auth::User()->fullname()." à ajouté l'activité, ".$schedule->event_name." à l'horaire le ".$schedule->date));
}
return redirect('/admin/calendar'); return redirect('/admin/calendar');
} }
@@ -527,5 +534,4 @@ class CalendarController extends Controller
$schedule->delete(); $schedule->delete();
} }
} }

View File

@@ -165,4 +165,12 @@ class UserController extends Controller
$user->delete(); $user->delete();
} }
public function notificationmark($id)
{
$notification = \Auth::User()->unreadNotifications->where('id',$id)->first();
$notification->delete();
return redirect(request('url'));
}
} }

View File

@@ -19,10 +19,11 @@ class Alert extends Notification
* *
* @return void * @return void
*/ */
public function __construct($user,$msg) public function __construct($user,$msg,$url)
{ {
$this->myNotification = $msg; $this->myNotification = $msg;
$this->fromUser = $user; $this->fromUser = $user;
$this->myUrl = $url;
} }
/** /**
@@ -47,6 +48,7 @@ class Alert extends Notification
return [ return [
'from' => $this->fromUser, 'from' => $this->fromUser,
'msg' => $this->myNotification, 'msg' => $this->myNotification,
'url' => $this->myUrl,
]; ];
} }
} }

View File

@@ -54,4 +54,24 @@ class Schedule extends Model
return $dispo_item; return $dispo_item;
} }
public function getUserToNotify($priority = 0)
{
$users = \App\User::all();
if($priority == 0)
{
$userToNotify = collect();
foreach ($users as $user) {
if ($user->getPerm('schedule_notify')) {
$userToNotify->push($user);
}
}
return $userToNotify;
} else if ($priority == 1)
{
return $users;
}
}
} }

View File

@@ -65,13 +65,13 @@ class User extends Authenticatable
$user_perm_value = $this->$perm; $user_perm_value = $this->$perm;
if ($user_perm_value == 1 ) { if ($user_perm_value == 1 ) {
$perm_value = 1; $perm_value = true;
} else if ($job_perm_value== 1) { } else if ($job_perm_value== 1) {
$perm_value = 1; $perm_value = true;
} else if ($rank_perm_value == 1) { } else if ($rank_perm_value == 1) {
$perm_value = 1; $perm_value = true;
} else { } else {
$perm_value = 0; $perm_value = false;
} }
return $perm_value; return $perm_value;

View File

@@ -56,8 +56,8 @@ return [
*/ */
'from' => [ 'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'address' => 'noreply@c-cms.cf',
'name' => env('MAIL_FROM_NAME', 'Example'), 'name' => 'C-CMS',
], ],
/* /*

View File

@@ -16,6 +16,11 @@ class ConfigsTableSeeder extends Seeder
'name' => 'is_schedule_public', 'name' => 'is_schedule_public',
'state' => 0, 'state' => 0,
'data' => 'null' 'data' => 'null'
],
[
'name' => 'is_schedule_build',
'state' => 0,
'data' => 'null'
] ]
]); ]);
} }

View File

@@ -2319,3 +2319,7 @@ header .form-inline {
0% { transform: rotate(0deg); } 0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); } 100% { transform: rotate(360deg); }
} }
.cs-notification:hover {
background-color: #F2F2F2 !important;
color:white;
}

View File

@@ -2,6 +2,38 @@
@section('content') @section('content')
<!--/* ALPHA 3.0.3 */-->
<div class="card-header">
<strong class="card-title"><i class="fa fa-star" aria-hidden="true" style="color: gold"></i> ALPHA 3.0.3<small><span class="badge badge-success float-right mt-1">STABLE</span> <span class="badge badge-warning float-right mt-1">ALPHA</span></small></strong>
</div>
<div class="card-body">
<p class="card-text">
Nouveauté
<ul style="margin-left: 28px;list-style-type: none;">
<li><i class="fa fa-plus" aria-hidden="true" style="color: green"></i> Mise à jour de la section notification.</li>
<li><i class="fa fa-plus" aria-hidden="true" style="color: green"></i> Ajout d'une option pour bloquer les notifications de l'horaire lors de ça construction initiale.</li>
</ul>
</p>
<hr>
<p>
Back End & API
<ul style="margin-left: 28px;list-style-type: none;">
<li><i class="fa fa-plug" aria-hidden="true" style="color: #0174DF"></i> Mise à jours du nom de l'adresse d'envois de Email</li>
<li><i class="fa fa-plug" aria-hidden="true" style="color: #0174DF"></i> Mise à jours de l'adresse d'envois de Email</li>
<li><i class="fa fa-plug" aria-hidden="true" style="color: #0174DF"></i> Ajout de la suppression de notification</li>
<li><i class="fa fa-plug" aria-hidden="true" style="color: #0174DF"></i> Ajout de notification Email et Alert lors de l'ajout d'evenement a l'horaire</li>
</ul>
</p>
<hr>
<p>
Correction de bug
<ul style="margin-left: 28px;list-style-type: none;">
<li><i class="fa fa-bug" aria-hidden="true" style="color: green"></i> Correction de multiple bug</li>
</ul>
</p>
<small><span class="badge badge-primary float-right mt-1">2018-09-11 14:30</span></small>
</div>
<!--/* ALPHA 3.0.2 */--> <!--/* ALPHA 3.0.2 */-->
<div class="card-header"> <div class="card-header">
<strong class="card-title"><i class="fa fa-star" aria-hidden="true" style="color: gold"></i> ALPHA 3.0.2<small><span class="badge badge-success float-right mt-1">STABLE</span> <span class="badge badge-warning float-right mt-1">ALPHA</span></small></strong> <strong class="card-title"><i class="fa fa-star" aria-hidden="true" style="color: gold"></i> ALPHA 3.0.2<small><span class="badge badge-success float-right mt-1">STABLE</span> <span class="badge badge-warning float-right mt-1">ALPHA</span></small></strong>

View File

@@ -30,7 +30,16 @@ foreach (Auth::user()->unreadNotifications as $notification) {
<div class="dropdown-menu" aria-labelledby="notification"> <div class="dropdown-menu" aria-labelledby="notification">
<?php <?php
foreach (Auth::user()->unreadNotifications as $notification) { foreach (Auth::user()->unreadNotifications as $notification) {
echo '<a class="dropdown-item media bg-flat-color-1" href="#"><i class="fa fa-info"></i><p>'.$notification->data['msg'].'</p></a>'; $fa_icon = "fa-info";
$found = strpos($notification->data['msg'],"Ajout");
if ($found !== false) {
$fa_icon = "fa-plus";
}
$found = strpos($notification->data['msg'],"Suppression");
if ($found !== false) {
$fa_icon = "fa-plus";
}
echo '<form method="post" action="/admin/notication/mark/'.$notification->id.'">'.csrf_field().'<button name="url" type="submit" value="'.$notification->data['url'].'" class="dropdown-item media cs-notification" href="#"><i class="fa '.$fa_icon.'"></i><p>'.$notification->data['msg'].'</p></button></form>';
} }
?> ?>
</div> </div>

View File

@@ -71,6 +71,8 @@ Route::middleware(['auth','admin'])->group(function () {
/** Local */ /** Local */
Route::get('/admin/config/local' , 'LocalController@index'); Route::get('/admin/config/local' , 'LocalController@index');
/** Notification */
Route::post('/admin/notication/mark/{id}','UserController@notificationmark');
}); });
/* Other Route */ /* Other Route */