Exemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $open_delay_order = Delay::whereIn('state', ['تقديم', 'مكتمل', 'غير مكتمل'])->count();
     $open_withdraw_order = Withdraw::whereIn('state', ['تقديم', 'مكتمل', 'غير مكتمل'])->count();
     $open_equal_order = Equal::whereIn('state', ['تقديم', 'مكتمل', 'غير مكتمل'])->count();
     $open_change_dep_order = OrderChangeDepartment::where('state', 0)->count();
     $open_session_excuse_order = ClassroomSessionExcuse::where('status', 'waiting')->count();
     $open_quran_excuse_order = OrderQuranExcuse::where('state', 'تقديم')->count();
     if ($user = Auth::user() and $user->canOne(['view.orders.orders', 'view.orders.withdraw', 'view.orders.delay', 'view.orders.equalsubject', 'view.orders.sessionexcuses', 'view.orders.excusequran', 'view.orders.changeDep'])) {
         $menu = Menu::get('SidebarMenu');
         $submenu = $menu->add(trans('orders::order.orders'), ['route' => 'orders.index'])->prepend('<i class="fa fa-file"></i>');
         if ($user->can('view.orders.withdraw')) {
             $submenu->add(trans('orders::order.withdraworder_list'), ['route' => 'orders.withdraw.list'])->prepend('<i class="fa fa-file"></i>')->append('<span class="badge">' . $open_withdraw_order . '</span>');
         }
         if ($user->can('view.orders.delay')) {
             $submenu->add(trans('orders::order.delayorder_list'), ['route' => 'orders.delay.list'])->prepend('<i class="fa fa-file"></i>')->append('<span class="badge">' . $open_delay_order . '</span>');
         }
         if ($user->can('view.orders.equalsubject')) {
             $submenu->add(trans('orders::order.equalorder_list'), ['route' => 'orders.equal.list'])->prepend('<i class="fa fa-file"></i>')->append('<span class="badge">' . $open_equal_order . '</span>');
         }
         /*
                     if($user->can('view.orders.sessionexcuses')) {
                     $submenu->add(trans('orders::sessionexcuses.header'), ['route'=>'orders.sessionexcuses.index'])->prepend('<i class="fa fa-file"></i>')->append('<span class="badge">'.$open_session_excuse_order.'</span>');
                     }
         */
         if ($user->can('view.orders.excusequran')) {
             $submenu->add(trans('orders::quranexcuses.header'), ['route' => 'orders.quran.excuses.index'])->prepend('<i class="fa fa-file"></i>')->append('<span class="badge">' . $open_quran_excuse_order . '</span>');
         }
         if ($user->can('view.orders.changedep')) {
             $submenu->add(trans('orders::changeDep.header'), ['route' => 'orders.change.department.index'])->prepend('<i class="fa fa-file"></i>')->append('<span class="badge">' . $open_change_dep_order . '</span>');
         }
     }
     return $next($request);
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  * @param  Request $request
  * @return Response
  */
 public function store($order_id, Request $request)
 {
     $order = OrderQuranExcuse::find($order_id);
     $order->state = $request->state;
     $order->note = $request->note;
     $order->save();
     return redirect()->route('orders.quran.excuses.index')->with('success', trans('orders::quranexcuses.update_success'));
 }
Exemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  * @param  Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $order = new OrderQuranExcuse();
     $order->fill($request->only('reason', 'subject_id'));
     $order->student_id = $this->student->id;
     $order->semester_id = $this->semester->id;
     $order->state = 'تقديم';
     $order->save();
     // create order history record
     $history = new Orderhistory();
     $history->ref_key = 'order_quran_excuses';
     $history->ref_value = $order->id;
     $history->state = 'تقديم';
     $history->save();
     if ($request->has('files')) {
         $update_data = ['ref_value' => $order->id, 'ref_key' => 'order_quran_excuses'];
         OrderFile::whereIn('id', array_pluck($request->input('files'), 'id'))->update($update_data);
     }
     $order->load('files');
     return response()->json($order, 200, [], JSON_NUMERIC_CHECK);
 }
Exemplo n.º 4
0
 public function store(Request $request)
 {
     $filter = ['semester_id' => $this->semester->id, 'student_id' => $this->student->id, 'subject_id' => $request->input('subject_id')];
     $recording = QuranRecording::firstOrCreate($filter);
     $extend = QuranTimeExtend::where($filter)->first();
     if ($extend) {
         $extend->decrement('maximum_recordings');
     }
     $videos = empty($recording->videos) ? [] : unserialize($recording->videos);
     if (!empty($recording->quran_video)) {
         array_push($videos, $recording->quran_video);
     }
     $recording->videos = serialize($videos);
     $recording->quran_video = $request->input('quran_video');
     $recording->page = $request->input('page');
     $recording->save();
     $recording->load('grade');
     $recording->decrement('remaining');
     // $recording->remaining = $recording->remaining - 1;
     $recording->excuse = OrderQuranExcuse::where(['semester_id' => semester()->id, 'student_id' => $recording->student_id, 'subject_id' => $recording->subject_id])->first();
     return response()->json($recording, 200, [], JSON_NUMERIC_CHECK);
 }