コード例 #1
0
ファイル: OrdersMenu.php プロジェクト: hisambahaa/DARES
 /**
  * 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);
 }
コード例 #2
0
ファイル: EqualsController.php プロジェクト: hisambahaa/DARES
 public function cancel($order_id)
 {
     $Equal_order = Equal::findOrFail($order_id);
     $Equal_order->state = 'الغاء بناء على طلب الطالب';
     $Equal_order->save();
     //save in history
     $order_history = new Orderhistory();
     $order_history->ref_key = 'order_equals';
     $order_history->ref_value = $order_id;
     $order_history->state = 'الغاء بناء على طلب الطالب';
     $order_history->note = '';
     $order_history->save();
     return redirect()->route('orders.index')->with('success', trans('orders::order.cancel_success'));
 }
コード例 #3
0
ファイル: OrdersController.php プロジェクト: hisambahaa/DARES
 public function create($event_type, $type, SemesterEvent $SemesterEvent)
 {
     $current_semester_id = semester()->id;
     $student_id = student()->id;
     $semesters = Semester::with('year')->get();
     $semester_id = [];
     /////////////////////////////////////delay/////////////////////////////
     if ($event_type == 'delay') {
         // get delay order period
         //dd($semesters);
         $delay_semester_events = $SemesterEvent->where('semester_id', '=', $current_semester_id)->whereHas('event_type', function ($query) {
             $query->where('academycycle_semesterevent_types.category', 'delay');
         })->first();
         // get delay order for student in current semeter if exist and not refuse or cancel
         $delayOrders = new DelayOrders();
         $student_delay_order = $delayOrders->where('semester_id', '=', $current_semester_id)->where('student_id', '=', $student_id)->whereNotIn('state', array('الغاء بناء على طلب الطالب', 'الغاء لعدم الاستكمال', 'رفض'))->first();
         if ($student_delay_order and $type == 0) {
             return redirect()->route('student.orders.list', $event_type);
         } else {
             //check if period available
             if ($type == 0) {
                 foreach ($semesters as $semester) {
                     if ($semester->active == 1) {
                         $semester_id[$semester->id] = $semester->year->name . " --  " . $semester->name;
                     }
                 }
                 return view('orders::delay.create', compact('semester_id'));
             } elseif ($type == '1') {
                 // bring all semester
                 foreach ($semesters as $semester) {
                     $semester_id[$semester->id] = $semester->year->name . " --  " . $semester->name;
                 }
                 return view('orders::delay.create', compact('semester_id'));
             } else {
                 return redirect()->route('orders.index');
             }
         }
         //////////////////////////////////////withdraw/////////////////////////////
     } elseif ($event_type == 'withdraw') {
         // get delay order period
         $withdraw_semester_events = $SemesterEvent->where('semester_id', '=', $current_semester_id)->whereHas('event_type', function ($query) {
             $query->where('academycycle_semesterevent_types.category', 'withdraw');
         })->first();
         // get withdraw order for student in current semeter if exist and not refuse or cancel
         $withdrawOrders = new WithdrawOrders();
         $student_withdraw_order = $withdrawOrders->where('semester_id', '=', $current_semester_id)->where('student_id', '=', $student_id)->whereNotIn('state', array('الغاء بناء على طلب الطالب', 'الغاء لعدم الاستكمال', 'رفض'))->first();
         if ($student_withdraw_order) {
             return redirect()->route('student.orders.list', $event_type);
         } else {
             //check if period available
             if ($type == 0) {
                 foreach ($semesters as $semester) {
                     if ($semester->active == 1) {
                         $semester_id[$semester->id] = $semester->year->name . " --  " . $semester->name;
                     }
                 }
                 return view('orders::withdraw.create', compact('semester_id'));
             } elseif ($type == '1') {
                 //  all semester
                 foreach ($semesters as $semester) {
                     $semester_id[$semester->id] = $semester->year->name . " --  " . $semester->name;
                 }
                 return view('orders::withdraw.create', compact('semester_id'));
             } else {
                 return redirect()->route('orders.index');
             }
         }
         /////////////////////////////////////Equal/////////////////////////////
     } elseif ($event_type == 'equal_subject') {
         // get equal_subject order period
         $equal_subject_semester_events = $SemesterEvent->where('semester_id', '=', $current_semester_id)->whereHas('event_type', function ($query) {
             $query->where('academycycle_semesterevent_types.category', 'equal_subject');
         })->first();
         // get delay order for student in current semeter if exist and not review
         $equalOrders = new EqualOrders();
         $student_equal_subject_order = $equalOrders->where('semester_id', '=', $current_semester_id)->where('student_id', '=', $student_id)->whereNotIn('state', array('الغاء بناء على طلب الطالب', 'الغاء لعدم الاستكمال', 'رفض', 'مكتمل'))->first();
         if ($student_equal_subject_order) {
             return redirect()->route('student.orders.list', $event_type);
         } else {
             //check if period available
             //if($equal_subject_semester_events->start_at <= date("Y-m-d") && $equal_subject_semester_events->finish_at >= date("Y-m-d")){
             $country_list = Country::pluck('name', 'id')->toArray();
             return view('orders::equal.create', compact('country_list'));
             //}else{
             //return redirect()->route('orders.index');
             //}
         }
         ///////////////////////////////////////////excuse/////////////////////////////
     } elseif ($event_type == 'excuse') {
         // same same
         return view('orders::delay.excuse');
     }
 }
コード例 #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     if (Withdraw::count()) {
         // return;
     }
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     Equal::truncate();
     Delay::truncate();
     Withdraw::truncate();
     OrderFile::truncate();
     Orderhistory::truncate();
     // $this->call("OthersTableSeeder");
     $old_reason = ["notunderstand" => "عدم استيعاب أسلوب الدراسة عن بعد", "nointernet" => "عدم توافر إنترنت جيد أو مركز خدمات كمبيوتر قريب من السكن", "nomoney" => "عدم إمكانية تحمل الرسوم الدراسية", "baby" => "الولادة / رعاية مولود جديد", "sick" => "المرض", "familysick" => "مرض أحد الأقارب من الدرجة الأولى (الأب، الأم، الزوج، الأخ، الأخت، الابن، الابنة)", "work" => "السفر لدواعي العمل", "family" => "ظروف عائلية", "personal" => "السفر لأسباب شخصية", "workz" => "ظروف العمل"];
     $old_state = ["UN" => "تقديم", "OC" => "مكتمل", "ONC" => "غير مكتمل", "NCON" => "الغاء لعدم الاستكمال", "AC" => "قبول", "NC" => "رفض"];
     $country = [0 => null, 1 => 147, 2 => 1, 3 => 234, 4 => 226, 5 => 4, 6 => 140, 7 => 125, 8 => 211, 9 => 137, 10 => 206, 11 => 253, 12 => 269, 13 => 197, 14 => 118, 15 => 14, 16 => 182, 17 => 225, 18 => 248, 19 => 106, 20 => 114, 21 => 83, 22 => 121, 23 => 218];
     $old_equal_state = [0 => "متقدم", 1 => "مكتمل", 2 => "غير مكتمل", 3 => "قبول كلى", 4 => "قبول جزئى", 5 => "رفض كلى", 7 => "الغاء"];
     $old_certificat = [1 => "دبلوم", 2 => "بكالوريوس", 3 => "ماجستير", 4 => "دكتوراه", 5 => "لم أكمل متطلبات الحصول على الدرجة العلمية"];
     //get all Withdraw order expected REP state (dublicate order)
     //$orders = DB::connection('old')->table('withdrawls')->where('wd_type',0)->where('wd_status','<>','REP')->get();
     $orders = [];
     foreach ($orders as $order) {
         $new_Withdraw = new Withdraw();
         //$new_Withdraw->id = $order->wd_id;
         $new_Withdraw->student_id = $order->wd_userid;
         $new_Withdraw->reason = in_array($order->wd_reasons, $old_reason) ? $old_reason[$order->wd_reasons] : $order->wd_reasons;
         $new_Withdraw->semester_id = $order->wd_semid > 0 ? $order->wd_semid : NULL;
         $new_Withdraw->state = $old_state[$order->wd_status];
         $new_Withdraw->bank_name = $order->wd_bankname;
         $new_Withdraw->bank_account_name = $order->wd_bankfullname;
         $new_Withdraw->bank_account_number = $order->wd_banknum;
         $new_Withdraw->refund_state = 100;
         $new_Withdraw->created_at = $order->wd_created;
         $new_Withdraw->updated_at = $order->wd_created;
         $new_Withdraw->save();
         $files = DB::connection('old')->table('withdrawls_attachments')->where('wda_wdid', $order->wd_id)->get();
         foreach ($files as $file) {
             $new_file = new OrderFile();
             $new_file->ref_key = 'order_withdraws';
             $new_file->ref_value = $order->wd_id;
             //path = iis/assets/forms/
             //$new_file->file = $file->wda_file;
             $new_file->created_at = $file->wda_created;
             $new_file->updated_at = $file->wda_created;
             $new_file->save();
         }
     }
     $this->command->info('withdraw order transfered!');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //get all Delay order expected REP state (dublicate order)
     $orders = DB::connection('old')->table('withdrawls')->where('wd_type', 1)->where('wd_userid', '!=', 1356)->where('wd_status', '<>', 'REP')->get();
     foreach ($orders as $order) {
         $new_Delay = new Delay();
         //$new_Delay->id = $order->wd_id;
         $new_Delay->student_id = $order->wd_userid;
         $new_Delay->reason = in_array($order->wd_reasons, $old_reason) ? $old_reason[$order->wd_reasons] : $order->wd_reasons;
         $new_Delay->semester_id = $order->wd_semid > 0 ? $order->wd_semid : null;
         $new_Delay->state = $old_state[$order->wd_status];
         $student_info = DB::table('students')->find($order->wd_userid);
         if (!$student_info) {
             echo "This user does not exist " . $order->wd_userid;
         }
         $new_Delay->academystructure_department_id = $student_info->state == 'delayed' ? $student_info->academystructure_department_id : null;
         $new_Delay->refund_state = 100;
         $new_Delay->created_at = $order->wd_created;
         $new_Delay->updated_at = $order->wd_created;
         $new_Delay->save();
         $files = DB::connection('old')->table('withdrawls_attachments')->where('wda_wdid', $order->wd_id)->get();
         foreach ($files as $file) {
             $new_file = new OrderFile();
             $new_file->ref_key = 'order_delays';
             $new_file->ref_value = $order->wd_id;
             //path = iis/assets/forms/
             //$new_file->file = $file->wda_file;
             $new_file->created_at = $file->wda_created;
             $new_file->updated_at = $file->wda_created;
             $new_file->save();
         }
     }
     $this->command->info('delay order transfered!');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //get all Equation order
     $Eorders = DB::connection('old')->table('user_equation')->whereNotIn('ue_userid', [2943, 2947])->get();
     foreach ($Eorders as $Eorder) {
         $new_Equal = new Equal();
         $new_Equal->id = $Eorder->ue_id;
         $new_Equal->student_id = $Eorder->ue_userid;
         $new_Equal->semester_id = null;
         $new_Equal->grade = is_numeric($Eorder->ue_finalestimate) ? $Eorder->ue_finalestimate : '';
         $new_Equal->country_id = $country[$Eorder->ue_cityid];
         $new_Equal->state = $old_equal_state[$Eorder->ue_curstatus];
         $new_Equal->certificate = $old_certificat[$Eorder->ue_edulevel];
         $new_Equal->old_institute = $Eorder->ue_studyedulevel == 'iis' ? 'كلية العلوم الشرعية' : $Eorder->ue_studyeduleveltext;
         $new_Equal->created_at = $Eorder->ue_date;
         $new_Equal->updated_at = $Eorder->ue_date;
         $new_Equal->save();
         //////////////////////////////////File
         $new_file = new OrderFile();
         $new_file->ref_key = 'order_equals';
         $new_file->ref_value = $Eorder->ue_id;
         //path = iis/assets/equationsubject/
         //$new_file->file = $files->ue_file;
         $new_file->created_at = $Eorder->ue_date;
         $new_file->updated_at = $Eorder->ue_date;
         $new_file->save();
     }
     $this->command->info('Equals order transfered!');
     //get all Equation Subject
     $Eqsubjects = DB::connection('old')->table('equation_subjects_new')->whereNotIn('es_ueid', [174, 204])->get();
     $all_eqsubject = [];
     foreach ($Eqsubjects as $Eqsubject) {
         $new_Eqsubject = [];
         $new_Eqsubject['equal_order_id'] = $Eqsubject->es_ueid;
         $new_Eqsubject['subject_name'] = $Eqsubject->es_name;
         $new_Eqsubject['subject_code'] = $Eqsubject->es_code;
         $new_Eqsubject['hours'] = is_numeric($Eqsubject->es_hours) ? $Eqsubject->es_hours : null;
         $new_Eqsubject['degree'] = is_numeric($Eqsubject->es_degree) ? $Eqsubject->es_degree : null;
         $new_Eqsubject['max_degree'] = is_numeric($Eqsubject->es_alldegree) ? $Eqsubject->es_alldegree : null;
         $new_Eqsubject['equal_subject_id'] = $Eqsubject->es_subjects;
         $new_Eqsubject['created_at'] = '2001-01-01';
         $new_Eqsubject['updated_at'] = '2001-01-01';
         $all_eqsubject[] = $new_Eqsubject;
     }
     foreach (array_chunk($all_eqsubject, 10) as $Eqsubject_group) {
         DB::table('order_equal_subjects')->insert($Eqsubject_group);
     }
     $this->command->info('Equal subjects transfered!');
 }