Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $permissions = [['name' => 'تعدل طلب', 'slug' => 'edit.registration.registrations', 'module' => 'registration'], ['name' => 'حذف طلب', 'slug' => 'delete.registration.registrations', 'module' => 'registration'], ['name' => 'مشاهدة الطلبات', 'slug' => 'view.registration.registrations', 'module' => 'registration'], ['name' => 'اضافة مرحلة قبول تسجيل', 'slug' => 'create.registration.steps', 'module' => 'registration'], ['name' => 'تعدل مرحلة قبول تسجيل', 'slug' => 'edit.registration.steps', 'module' => 'registration'], ['name' => 'حذف مرحلة قبول تسجيل', 'slug' => 'delete.registration.steps', 'module' => 'registration'], ['name' => 'مشاهدة مراحل التسجيل', 'slug' => 'view.registration.steps', 'module' => 'registration'], ['name' => 'اضافة مستندات', 'slug' => 'create.registration.files', 'module' => 'registration'], ['name' => 'تعدل مستندات', 'slug' => 'edit.registration.files', 'module' => 'registration'], ['name' => 'حذف مستندات', 'slug' => 'delete.registration.files', 'module' => 'registration'], ['name' => 'مشاهدة المستندات', 'slug' => 'view.registration.files', 'module' => 'registration'], ['name' => 'اضافة فترة القبول', 'slug' => 'create.registration.periods', 'module' => 'registration'], ['name' => 'تعدل فترة القبول', 'slug' => 'edit.registration.periods', 'module' => 'registration'], ['name' => 'حذف فترة القبول', 'slug' => 'delete.registration.periods', 'module' => 'registration'], ['name' => 'مشاهدة فترات القبول', 'slug' => 'view.registration.periods', 'module' => 'registration'], ['name' => 'اضافة ملاحظة لمرحلة قبول', 'slug' => 'create.registration.notes', 'module' => 'registration'], ['name' => 'تعدل ملاحظة لمرحلة قبول', 'slug' => 'edit.registration.notes', 'module' => 'registration'], ['name' => 'حذف ملاحظة من مرحلة قبول', 'slug' => 'delete.registration.notes', 'module' => 'registration'], ['name' => 'مشاهدة ملاحظات مراحل القبول', 'slug' => 'view.registration.notes', 'module' => 'registration']];
     $slugs = array_map(function ($ar) {
         return $ar['slug'];
     }, $permissions);
     Permission::whereIn('slug', $slugs)->delete();
     $types = [['title' => 'دبلوم', 'code' => 'D'], ['title' => 'بكالوريوس', 'code' => 'B'], ['title' => 'تكميلي', 'code' => 'C']];
     $period = ['start_at' => date('Y-m-d'), 'finish_at' => date("Y-m-d", strtotime('+1 month', strtotime(date('Y-m-d')))), 'code' => '161', 'academycycle_year_id' => '1'];
     $steps = [['name' => 'تم تقديم طلب', 'verify_email' => 1, 'email_template' => view('registration::steps.templates.verify_email')], ['name' => 'رفع الملفات', 'upload_files' => 1], ['name' => 'الغاء']];
     RegistrationStep::whereNotNull('id')->delete();
     foreach ($steps as $step) {
         RegistrationStep::create($step);
     }
     RegistrationPeriod::whereNotNull('id')->delete();
     RegistrationPeriod::create($period);
     RegistrationType::whereNotNull('id')->delete();
     foreach ($types as $type) {
         RegistrationType::create($type);
     }
     $users = User::all();
     foreach ($permissions as $permission) {
         $perm = Permission::create($permission);
         foreach ($users as $user) {
             $user->attachPermission($perm);
         }
     }
 }
Пример #2
0
 public function index(Request $request)
 {
     $steps = Step::pluck('name', 'id')->toArray();
     $periods = Period::pluck('name', 'id')->toArray();
     $current_period = Period::current()->first();
     $specialties = Specialty::pluck('name', 'id')->toArray();
     $countries = Country::pluck('name', 'id')->toArray();
     $cities = City::pluck('name', 'id')->toArray();
     $type = Type::pluck('title', 'id')->toArray();
     //
     $filter_period = null;
     if (request('period_id')) {
         $filter_period = request('period_id');
     }
     if ($current_period) {
         $filter_period = $current_period->id;
     }
     if (!$current_period && !request('period_id')) {
         $filter_period = Period::orderBy('id', 'desc')->first()->id;
     }
     $registration_count = Registration::orderBy('id', 'desc');
     $registration_gender = Registration::groupBy('gender');
     $registration_type = Registration::groupBy('registration_type_id');
     $registration_specialty = Registration::groupBy('academystructure_specialty_id');
     $registration_country = Registration::groupBy('contact_country_id');
     $registration_city = Registration::groupBy('contact_city_id');
     $registration_step = null;
     if ($filter_period != null) {
         $registration_count->where('registration_period_id', $filter_period);
         $registration_gender->where('registration_period_id', $filter_period);
         $registration_type->where('registration_period_id', $filter_period);
         $registration_specialty->where('registration_period_id', $filter_period);
         $registration_country->where('registration_period_id', $filter_period);
         $registration_city->where('registration_period_id', $filter_period);
     }
     if (request('step_id')) {
         $registration_count->where('registration_step_id', request('step_id'));
         $registration_gender->where('registration_step_id', request('step_id'));
         $registration_type->where('registration_step_id', request('step_id'));
         $registration_specialty->where('registration_step_id', request('step_id'));
         $registration_country->where('registration_step_id', request('step_id'));
         $registration_city->where('registration_step_id', request('step_id'));
     } else {
         $registration_step = Registration::groupBy('registration_step_id');
         if ($filter_period != null) {
             $registration_step->where('registration_period_id', $filter_period);
         }
         $registration_step = $registration_step->select('registration_step_id as step', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     }
     $registration_count = $registration_count->count();
     $registration_gender = $registration_gender->select('gender', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_type = $registration_type->select('registration_type_id', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_specialty = $registration_specialty->select('academystructure_specialty_id as specialty', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_country = $registration_country->select('contact_country_id as country', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_city = $registration_city->select('contact_city_id as city', 'contact_country_id as country', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     return view('registration::reports.index', compact('steps', 'periods', 'current_period', 'specialties', 'countries', 'type', 'cities', 'registration_gender', 'registration_specialty', 'registration_country', 'registration_step', 'registration_count', 'registration_type', 'registration_city'));
 }
Пример #3
0
 public function form(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, Registration $Registration, RegistrationType $type)
 {
     $registration = $Registration->with('degrees', 'contactcountry', 'contactcity', 'contactcity.states', 'birthcountry', 'nationalitycity', 'jobcountry', 'jobcountry.cities')->find(registrar()->id);
     $specialties = $Specialty->pluck('name', 'id')->toArray();
     $registration_types = $type->pluck('title', 'id')->toArray();
     $countries = $CountryModel->all();
     $countries_list = ["" => ""] + $countries->pluck('name', 'id')->toArray();
     $codes_list = ["" => ""] + $countries->pluck('calling_code', 'id')->toArray();
     $stay_types = config('registration.stay_types');
     $social_status = ["" => ""] + config('registration.social_status');
     $social_job_status = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $years_list = ["" => ""] + array_combine(range(date("Y") - 80, date('Y')), range(date("Y") - 80, date('Y')));
     $computer_skills = ["" => "", 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد', 'great' => 'جيد جدا', 'excellent' => 'ممتاز'];
     $social_job_types = ["" => "", 'government' => 'عام', 'private' => 'خاص', 'free' => 'حر'];
     $social_jobs = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $references = ["" => "", 'iiswebsite' => 'موقع كلية العلوم الشرعية', 'iisewebsite' => 'موقع مركز التعليم عن بعد', 'iisfriend' => 'صديق يدرس بالكلية', 'iisefriend' => 'صديق يدرس بمركز التعليم عن بعد', 'other' => 'أخرى'];
     return view('registration::registrar.form', compact('registration', 'specialties', 'registration_types', 'period', 'years_list', 'countries', 'stay_types', 'countries_list', 'references', 'computer_skills', 'codes_list', 'social_job_types', 'social_status', 'social_jobs'));
 }
Пример #4
0
 public function apply(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, RegistrationType $type)
 {
     $period = $PeriodModel->orderBy('id', 'desc')->with('year')->current()->first();
     if (!$period) {
         return redirect()->route('welcome');
     }
     $specialties = $Specialty->lists('name', 'id');
     $registration_types = $type->lists('title', 'id')->toArray();
     $countries = $CountryModel->all();
     $countries_list = ["" => ""] + $countries->lists('name', 'id')->toArray();
     $codes_list = ["" => ""] + $countries->lists('calling_code', 'id')->toArray();
     $stay_types = config('registration.stay_types');
     $social_status = ["" => ""] + config('registration.social_status');
     $social_job_status = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $years_list = ["" => ""] + array_combine(range(date("Y") - 80, date('Y')), range(date("Y") - 80, date('Y')));
     $computer_skills = ["" => "", 'excellent' => 'ممتاز', 'great' => 'جيد جدا', 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد'];
     $social_job_types = ["" => "", 'government' => 'عام', 'private' => 'خاص', 'free' => 'حر'];
     $social_jobs = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $references = ["" => "", 'iiswebsite' => 'موقع كلية العلوم الشرعية', 'iisewebsite' => 'موقع مركز التعليم عن بعد', 'iisfriend' => 'صديق يدرس بالكلية', 'iisefriend' => 'صديق يدرس بمركز التعليم عن بعد', 'other' => 'أخرى'];
     $period = $PeriodModel->orderBy('id', 'desc')->with('year')->where(function ($sql) {
         $sql->where('start_at', '<=', date('Y-m-d'))->where('finish_at', '>=', date('Y-m-d'));
     })->first();
     return view('registration::registrar.apply', compact('years_list', 'specialties', 'registration_types', 'period', 'countries', 'stay_types', 'countries_list', 'references', 'computer_skills', 'codes_list', 'social_job_types', 'social_status', 'social_jobs'));
 }
Пример #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     if (RegistrationStep::count()) {
         return;
     }
     $types = [['title' => 'دبلوم', 'code' => 'D'], ['title' => 'بكالوريوس', 'code' => 'B'], ['title' => 'تكميلي', 'code' => 'C']];
     $period = ['start_at' => date('Y-m-d'), 'finish_at' => date("Y-m-d", strtotime('+1 month', strtotime(date('Y-m-d')))), 'code' => '161', 'academycycle_year_id' => '1'];
     $steps = [['name' => 'تم تقديم طلب', 'verify_email' => 1, 'email_template' => view('registration::steps.templates.verify_email')], ['name' => 'رفع الملفات', 'upload_files' => 1], ['name' => 'الغاء']];
     RegistrationStep::whereNotNull('id')->delete();
     foreach ($steps as $step) {
         RegistrationStep::create($step);
     }
     RegistrationPeriod::whereNotNull('id')->delete();
     RegistrationPeriod::create($period);
     RegistrationType::whereNotNull('id')->delete();
     foreach ($types as $type) {
         RegistrationType::create($type);
     }
 }
Пример #6
0
 public function export(Request $request)
 {
     Excel::create('registrations', function ($excel) {
         $excel->sheet('registrations', function ($sheet) {
             $steps = RegistrationStep::pluck('name', 'id')->toArray();
             $specialties = Specialty::pluck('name', 'id')->toArray();
             $type = RegistrationType::pluck('title', 'id')->toArray();
             $genders = config('registration.genders');
             $countries = Country::pluck('name', 'id')->toArray();
             $cities = City::pluck('name', 'id')->toArray();
             $states = State::pluck('name', 'id')->toArray();
             $years = AcademycycleYear::pluck('name', 'id')->toArray();
             $registration_periods = RegistrationPeriod::pluck('name', 'id')->toArray();
             $registrations = $this->prepQuery(request()->all())->get();
             $sheet->loadView('registration::registrations.export', compact('registration_periods', 'registrations', 'steps', 'countries', 'years', 'specialties', 'type', 'genders', 'cities', 'states'));
         })->download('xlsx');
     });
 }
Пример #7
0
 public function export(Request $request)
 {
     $students = $this->prepQuery($request->all())->get();
     Excel::create('students', function ($excel) use($students) {
         $excel->sheet('stu', function ($sheet) use($students) {
             $type = RegistrationType::pluck('title', 'id')->toArray();
             $sheet->loadView('students::students.export', compact('students', 'type'));
         })->download('xlsx');
     });
 }