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();
/** 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');
}
@@ -527,5 +534,4 @@ class CalendarController extends Controller
$schedule->delete();
}
}

View File

@@ -165,4 +165,12 @@ class UserController extends Controller
$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
*/
public function __construct($user,$msg)
public function __construct($user,$msg,$url)
{
$this->myNotification = $msg;
$this->fromUser = $user;
$this->myUrl = $url;
}
/**
@@ -47,6 +48,7 @@ class Alert extends Notification
return [
'from' => $this->fromUser,
'msg' => $this->myNotification,
'url' => $this->myUrl,
];
}
}

View File

@@ -54,4 +54,24 @@ class Schedule extends Model
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;
if ($user_perm_value == 1 ) {
$perm_value = 1;
$perm_value = true;
} else if ($job_perm_value== 1) {
$perm_value = 1;
$perm_value = true;
} else if ($rank_perm_value == 1) {
$perm_value = 1;
$perm_value = true;
} else {
$perm_value = 0;
$perm_value = false;
}
return $perm_value;

View File

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

View File

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

View File

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

View File

@@ -2,6 +2,38 @@
@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 */-->
<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>

View File

@@ -30,7 +30,16 @@ foreach (Auth::user()->unreadNotifications as $notification) {
<div class="dropdown-menu" aria-labelledby="notification">
<?php
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>

View File

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