mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 10:49:10 -04:00
ALPHA 3.0.5
This commit is contained in:
@@ -247,25 +247,43 @@ class ECCController extends Controller
|
||||
|
||||
foreach ($items_array as $item_array) {
|
||||
if ($item_array != "") {
|
||||
$items->push(\App\Item::find($item_array));
|
||||
$item_array_ex = explode(":",$item_array);
|
||||
$this_item = \App\Item::find($item_array_ex[0]);
|
||||
$this_item->quantity = $item_array_ex[1];
|
||||
$items->push($this_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view('ecc.booking',['schedule' => $schedule, 'periode' => $periode, 'niveau' => $niveau, 'items' => $items, 'dispo_item' => $schedule->getInventory($periode)]);
|
||||
}
|
||||
|
||||
public function booking_add($id,$periode,$niveau)
|
||||
{
|
||||
$schedule = Schedule::find($id);
|
||||
|
||||
$id_to_modify = "passet";
|
||||
$qt_to_add = 0;
|
||||
$periode_item = 'n'.$niveau.'_p'.$periode.'_item';
|
||||
|
||||
if (isset($schedule->$periode_item)) {
|
||||
$array_items = explode("-",$schedule->$periode_item);
|
||||
array_push($array_items,request('add'));
|
||||
for ($i=0; $i < count($array_items); $i++) {
|
||||
$array_item_id = explode(":",$array_items[$i]);
|
||||
|
||||
if ($array_item_id[0] == request('add')) {
|
||||
$id_to_modify = $i;
|
||||
$qt_to_add = $array_item_id[1];
|
||||
}
|
||||
}
|
||||
if ($id_to_modify === "passet") {
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
} else {
|
||||
$toadd = $qt_to_add+request('qt');
|
||||
$array_items[$id_to_modify] = request('add').":".$toadd;
|
||||
}
|
||||
} else {
|
||||
$array_items = [];
|
||||
array_push($array_items,request('add'));
|
||||
array_push($array_items,request('add').":".request('qt'));
|
||||
}
|
||||
|
||||
$final_items = implode("-",$array_items);
|
||||
@@ -273,7 +291,7 @@ class ECCController extends Controller
|
||||
$schedule->$periode_item = $final_items;
|
||||
|
||||
$schedule->save();
|
||||
|
||||
|
||||
return redirect('/ecc/inventory/'.$id.'/'.$niveau.'/'.$periode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user