mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Merge branch '3.2.1' of https://gitlab.com/TheGamecraft/c-cms into 3.2.2
This commit is contained in:
@@ -42,7 +42,16 @@ class BookingController extends Controller
|
||||
*/
|
||||
public function create($type,$id)
|
||||
{
|
||||
return view('admin.booking.create',['items' => \App\Item::training(),'event_type' => $type,'event_id' => $id]);
|
||||
$event = null;
|
||||
if($type == 'course')
|
||||
{
|
||||
$event = \App\Course::find($id)->event;
|
||||
}
|
||||
else if ($type == 'event')
|
||||
{
|
||||
$event = \App\Event::find($id);
|
||||
}
|
||||
return view('admin.booking.create',['items' => \App\Item::training(),'event_type' => $type,'event_id' => $id,'event' => $event]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,13 +145,31 @@ class BookingController extends Controller
|
||||
$b->delete();
|
||||
}
|
||||
|
||||
public function modalItem($id)
|
||||
public function modalItem($id,$event_type,$event_id)
|
||||
{
|
||||
return view('admin.booking.modal.create',['item' => \App\Item::find($id)]);
|
||||
$event = null;
|
||||
if ($event_type == 'course')
|
||||
{
|
||||
$event = \App\Course::find($event_id)->event;
|
||||
}
|
||||
else
|
||||
{
|
||||
$event = \App\Event::find($event_id);
|
||||
}
|
||||
return view('admin.booking.modal.create',['item' => \App\Item::find($id),'event' => $event]);
|
||||
}
|
||||
|
||||
public function modalItemEdit($id)
|
||||
public function modalItemEdit($id,$event_type,$event_id)
|
||||
{
|
||||
return view('admin.booking.modal.edit',['booking' => \App\Booking::find($id)]);
|
||||
$event = null;
|
||||
if ($event_type == 'course')
|
||||
{
|
||||
$event = \App\Course::find($event_id)->event;
|
||||
}
|
||||
else
|
||||
{
|
||||
$event = \App\Event::find($event_id);
|
||||
}
|
||||
return view('admin.booking.modal.edit',['booking' => \App\Booking::find($id),'event' => $event]);
|
||||
}
|
||||
}
|
||||
|
||||
45
app/Item.php
45
app/Item.php
@@ -51,15 +51,52 @@ class Item extends Model
|
||||
{
|
||||
return $this->quantity - $this->booked();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->quantity - $this->booked($begin,$end);
|
||||
}
|
||||
}
|
||||
|
||||
public function booked()
|
||||
public function booked($begin_time = null,$end_time = null)
|
||||
{
|
||||
$nbBooked = 0;
|
||||
|
||||
foreach ($this->bookings() as $b)
|
||||
foreach ($this->bookings as $b)
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
if ($begin_time != null && $end_time != null)
|
||||
{
|
||||
$b_begin_time = null;
|
||||
$b_end_time = null;
|
||||
if ($b->bookable_type == 'App\Course')
|
||||
{
|
||||
$b_begin_time = $b->bookable->event->date_begin;
|
||||
$b_end_time = $b->bookable->event->date_end;
|
||||
}
|
||||
else
|
||||
{
|
||||
$b_begin_time = $b->bookable->date_begin;
|
||||
$b_end_time = $b->bookable->date_end;
|
||||
}
|
||||
if (date('U',strtotime($b_begin_time)) <= date('U',strtotime($begin_time)) && date('U',strtotime($b_end_time)) <= date('U',strtotime($end_time)) && date('U',strtotime($b_end_time)) >= date('U',strtotime($begin_time)))
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
}
|
||||
elseif (date('U',strtotime($b_begin_time)) <= date('U',strtotime($begin_time)) && date('U',strtotime($b_end_time)) >= date('U',strtotime($end_time)))
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
}
|
||||
elseif (date('U',strtotime($b_begin_time)) >= date('U',strtotime($begin_time)) && date('U',strtotime($b_begin_time)) <= date('U',strtotime($end_time)) && date('U',strtotime($b_end_time)) >= date('U',strtotime($end_time)))
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
}
|
||||
elseif (date('U',strtotime($b_begin_time)) >= date('U',strtotime($begin_time)) && date('U',strtotime($b_begin_time)) <= date('U',strtotime($end_time)))
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbBooked = $nbBooked + $b->amount;
|
||||
}
|
||||
}
|
||||
|
||||
return $nbBooked;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<td>{{$item->name}}</td>
|
||||
<td>{{$item->category()->name}}</td>
|
||||
<td>{!! $item->desc !!}</td>
|
||||
<td>{{$item->available()}}</td>
|
||||
<td>{{$item->available($event->date_begin,$event->date_end)}}</td>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-block" onclick='openModal("{{$item->id}}")'>Réserver</button>
|
||||
</td>
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
function openModal(id)
|
||||
{
|
||||
$.get("/api/booking/modal/item/" + id + "?api_token="+api_token, function (data) {
|
||||
$.get("/api/booking/modal/item/" + id + "/{{$event_type}}/{{$event_id}}?api_token="+api_token, function (data) {
|
||||
$("#modal-content").html(data);
|
||||
});
|
||||
$('#createModal').modal('toggle')
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
|
||||
function openModal(id)
|
||||
{
|
||||
$.get("/api/booking/modal/edit/item/" + id + "?api_token="+api_token, function (data) {
|
||||
$.get("/api/booking/modal/edit/item/" + id + "/{{$event_type}}/{{$event_id}}?api_token="+api_token, function (data) {
|
||||
$("#modal-content").html(data);
|
||||
});
|
||||
$('#editModal').modal('toggle')
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>Quantité</label>
|
||||
<input class="form-control" name="amount" type="number" min="1" required value="1" max="{{$item->available()}}">
|
||||
<input class="form-control" name="amount" type="number" min="1" required value="1" max="{{$item->available($event->date_begin,$event->date_end)}}">
|
||||
<small class="form-text text-muted">Quantité d'item a réserver</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>Quantité</label>
|
||||
<input class="form-control" name="amount" type="number" min="1" required value="{{$booking->amount}}" max="{{$booking->item->available()}}">
|
||||
<input class="form-control" name="amount" type="number" min="1" required value="{{$booking->amount}}" max="{{$booking->item->available($event->date_begin,$event->date_end)}}">
|
||||
<small class="form-text text-muted">Quantité d'item a réserver</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,99 @@
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<h3 class="card-title">3.2.2</h3>
|
||||
<p class="category">2019-09-11</p>
|
||||
</div>
|
||||
<div class="col-sm-6 text-right">
|
||||
<span class="badge badge-pill badge-success">STABLE</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<p>
|
||||
Nouveauté
|
||||
<ul class="list-group list-group-flush ml-3">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="text-success" style="font-size: 1.3rem;width: 1.5rem">
|
||||
<i class="fas fa-coffee"></i>
|
||||
</div>
|
||||
<div class="col m-auto text-left">
|
||||
Réactivation des réservations
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="text-success" style="font-size: 1.3rem;width: 1.5rem">
|
||||
<i class="fas fa-coffee"></i>
|
||||
</div>
|
||||
<div class="col m-auto text-left">
|
||||
Refonte du code responsable de la gestion de l'inventaire
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="text-success" style="font-size: 1.3rem;width: 1.5rem">
|
||||
<i class="fas fa-coffee"></i>
|
||||
</div>
|
||||
<div class="col m-auto text-left">
|
||||
Modernisation de la base de données des réservations
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="text-success" style="font-size: 1.3rem;width: 1.5rem">
|
||||
<i class="fas fa-plus"></i>
|
||||
</div>
|
||||
<div class="col m-auto text-left">
|
||||
Ajout de la possibilité d'imprimer une activité depuis l'horaire
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="text-success" style="font-size: 1.3rem;width: 1.5rem">
|
||||
<i class="fas fa-plus"></i>
|
||||
</div>
|
||||
<div class="col m-auto text-left">
|
||||
Ajout de la possibilité de réserver du matériel depuis l'horaire
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<p>
|
||||
Bug
|
||||
<ul class="list-group list-group-flush ml-3">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="text-success" style="font-size: 1.3rem;width: 1.5rem">
|
||||
<i class="fas fa-bug"></i>
|
||||
</div>
|
||||
<div class="col m-auto text-left">
|
||||
Correction de <a href="https://op.exvps.ca/versions/8">4 bugs</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
|
||||
@@ -31,8 +31,8 @@ Route::middleware('auth:api')->group(function () {
|
||||
Route::post('/schedule/event/delete/{id}','ScheduleController@delete');
|
||||
|
||||
/** Booking */
|
||||
Route::get('/booking/modal/item/{id}','BookingController@modalItem');
|
||||
Route::get('/booking/modal/edit/item/{id}','BookingController@modalItemEdit');
|
||||
Route::get('/booking/modal/item/{id}/{event_type}/{event_id}','BookingController@modalItem');
|
||||
Route::get('/booking/modal/edit/item/{id}/{event_type}/{event_id}','BookingController@modalItemEdit');
|
||||
Route::post('/booking/delete','BookingController@destroy');
|
||||
/** Picture */
|
||||
Route::post('/picture/delete/{id}','PictureController@destroy');
|
||||
|
||||
Reference in New Issue
Block a user