Esempio n. 1
0
 public function processVerifyEmail($step)
 {
     $StepModel = new Step();
     if (request('verify_email')) {
         $StepModel->where('id', '!=', $step->id)->update(['verify_email' => 0]);
         $step->verify_email = 1;
         $step->save();
     }
 }
 /**
  * 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);
         }
     }
 }
 public function index(Registration $Registration)
 {
     $registrations = $Registration->with('step', 'period', 'period.year')->orderBy('id', 'desc');
     $steps = RegistrationStep::lists('name', 'id')->toArray();
     $countries = Country::lists('name', 'id')->toArray();
     $search_fields = ['gender', 'registration_step_id', 'nationality_type', 'contact_country_id', 'social_status', 'social_job'];
     $years = AcademycycleYear::lists('name', 'id')->toArray();
     $genders = config('registration.genders');
     foreach ($search_fields as $field) {
         if (request($field)) {
             $registrations->whereIn($field, request($field));
         }
     }
     if (request('academycycle_year')) {
         $registrations->whereHas('period', function ($query) {
             $query->whereHas('year', function ($query2) {
                 $query2->whereIn('id', request('academycycle_year'));
             });
         });
     }
     if (request('national_id')) {
         $registrations->where('national_id', request('national_id'));
     }
     if (request('contact_email')) {
         $registrations->where('contact_email', request('contact_email'));
     }
     $registrations = $registrations->paginate(50);
     return view('registration::registrations.index', compact('registrations', 'steps', 'countries', 'years'));
 }
 /**
  * Create a new event instance.
  *
  * @param  Registration  $registration
  * @return void
  */
 public function __construct(Registration $registration)
 {
     $this->histories = RegistrationHistory::with('step')->where('registration_id', $registration->id)->get();
     $this->step = RegistrationStep::find($registration->registration_step_id);
     $this->registration = $registration;
     // $this->profile = $profile->pluck('');
 }
Esempio n. 5
0
 public function deleteBulk(Request $req, Note $Note, $step_id)
 {
     $step = Step::findOrFail($step_id);
     if (!$req->has('table_records')) {
         return redirect()->route('cities.index');
     }
     $ids = $req->input('table_records');
     $Note->destroy($ids);
     return redirect()->route('registration.notes.index', $step->id)->with('success', trans('registration::notes.delete_bulk_success'));
 }
Esempio n. 6
0
 public function store(Request $request)
 {
     $equation = RegistrationEquation::findOrNew($request->input('id'));
     $equation->fill($request->only('university', 'level', 'grade'));
     $equation->registration_id = $this->user->id;
     $equation->save();
     /** populate files and delete unused] */
     $files_ids = [];
     foreach ($request->input('files') as $file) {
         if (!empty($file['id'])) {
             $files_ids[] = $file['id'];
         }
     }
     RegistrationEquationFile::whereIn('id', $files_ids)->update(['registration_equation_id' => $equation->id]);
     RegistrationEquationFile::whereNotIn('id', $files_ids)->where('registration_equation_id', $equation->id)->delete();
     /** end populate files  */
     /** populate subjects */
     $old_subject_ids = [];
     foreach ($request->input('subjects') as $subject) {
         if (!empty($subject['id'])) {
             $old_subject_ids[] = $subject['id'];
         }
     }
     RegistrationEquationSubject::whereNotIn('id', $old_subject_ids)->where('registration_equation_id', $equation->id)->delete();
     foreach ($request->input('subjects') as $subject) {
         if (empty($subject['id'])) {
             $subject['status'] = 'waiting';
             $equation->subjects()->create($subject);
         } else {
             RegistrationEquationSubject::where('id', $subject['id'])->update($subject);
         }
     }
     /** ned populate subjects */
     $equation->load('files', 'subjects');
     foreach ($equation->files as $file) {
         $attachments = $file->urlsForAttachment('file');
         foreach ($attachments as $key => $attachment) {
             $attachments[$key] = asset($attachment);
         }
         $file->attachments = $attachments;
     }
     // update step and dispatch it
     $next_step = RegistrationStep::find($this->user->registration_step_id)->children()->where('equation_processing', 1)->first();
     if ($next_step) {
         $this->user->registration_step_id = $next_step->id;
         $this->user->save();
         event(new RegistrationStepChanged($this->user, ['comment' => 'تم تغييرها بشكل تلقائي بعد اضافة الطالب لشهادة']));
     }
     //
     return response()->json(compact('equation'), 200, [], JSON_NUMERIC_CHECK);
 }
Esempio n. 7
0
 public function store(RegisterRequest $request, Registration $registration, RegistrationPeriod $PeriodModel, RegistrationStep $StepModel)
 {
     $input = $request->all();
     $registration->fill($input);
     $step = $StepModel->verifyEmail()->first();
     $period = $PeriodModel->current()->first();
     $username = daress_generate_username();
     $registration->username = $username;
     $registration->registration_period_id = $period->id;
     $registration->registration_step_id = $step->id;
     $registration->passeport_country_id = !empty($input['passeport_country_id']) ? $input['passeport_country_id'] : null;
     if ($registration->save()) {
         /** check for extra degrees an dstore them */
         $this->saveExtraDegrees($input, $registration->id);
         /** end check for extra degrees */
         event(new RegistrationCreated($registration));
         event(new RegistrationUpdated($registration));
         event(new RegistrationStepChanged($registration, ['comment' => 'تفعيل البريد الإلكتروني']));
         return view('registration::registrar.signup_success');
     } else {
         return redirect()->back()->with('error', 'لم يتم تسجيل طلبك ، المرجو التواصل مع الدعم الفني للمزيد من المعلومات');
     }
 }
 /**
  * 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);
     }
 }
 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');
     });
 }
Esempio n. 10
0
 public function pass(Request $request)
 {
     $steps = Step::pluck('name', 'id')->toArray();
     $periods = Period::pluck('name', 'id')->toArray();
     $current_period = Period::current()->first();
     $registration_count = Registration::orderBy('id', 'desc');
     $registration_gender = Registration::groupBy('gender');
     $registration_specialty = Registration::groupBy('academystructure_specialty_id');
     $registration_country = Registration::groupBy('contact_country_id');
     $registration_step = Registration::groupBy('registration_step_id');
     if (request('step_id')) {
         $registration_count->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_gender->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_specialty->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_country->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_step->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
     }
     if (request('period_id')) {
         $registration_count->where('registration_period_id', request('period_id'));
         $registration_gender->where('registration_period_id', request('period_id'));
         $registration_specialty->where('registration_period_id', request('period_id'));
         $registration_country->where('registration_period_id', request('period_id'));
         $registration_step->where('registration_period_id', request('period_id'));
     }
     $registration_count = $registration_count->count();
     $registration_gender = $registration_gender->select('gender', 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_step = $registration_step->select('registration_step_id as step', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $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();
     return view('registration::reports.pass', compact('steps', 'periods', 'current_period', 'specialties', 'countries', 'registration_gender', 'registration_specialty', 'registration_country', 'registration_step', 'registration_count'));
 }
Esempio n. 11
0
 public function registrarPostUpload(Request $request)
 {
     $registrar = Auth::guard('api_registration')->user();
     $file = new RegistrationFile();
     $file->fill($request->only('type', 'file'));
     $file->registration_id = $registrar->id;
     if ($file->save()) {
         $step = RegistrationStep::find($registrar->registration_step_id)->children()->where('files_processing', 1)->first();
         if ($step) {
             $registrar->registration_step_id = $step->id;
             $registrar->save();
             event(new RegistrationUpdated($registrar));
             event(new RegistrationStepChanged($registrar, ['comment' => 'قام برفع ملف']));
         }
     }
     $attachments = $file->urlsForAttachment('file');
     foreach ($attachments as $key => $attachment) {
         $attachments[$key] = asset($attachment);
     }
     $file->attachments = $attachments;
     return response()->json($file, 200, [], JSON_NUMERIC_CHECK);
 }
Esempio n. 12
0
 public function verifyEmail($token, Registration $RegistrationModel)
 {
     if (!($registration = $RegistrationModel->whereVerificationToken($token)->with('files')->first())) {
         return 'رابط التفعيل الذي استخدمته اصبح غير صالح للاستعمال، قم بارسال طلب تفعيل جديد من بوابتك';
     }
     if ($registration->email_verified) {
         return redirect()->to(env('REGSITRAR_EMAIL_EMAIL_VERIFIED_REDIRECT', 'https://el-css.edu.om/registrar'));
     }
     $registration->load('step');
     $extra = ['comment' => 'يرجى تحميل ملفاتك'];
     $nextStep = $registration->step->children()->where('upload_files', 1)->first();
     if ($registration->files->count()) {
         $nextStep = RegistrationStep::where('files_processing', 1)->first();
         $extra = [];
     }
     if ($nextStep && $registration->step->verify_email == 1) {
         $registration->email_verified = 1;
         $registration->registration_step_id = $nextStep->id;
         $registration->save();
         event(new RegistrationEmailVerified($registration));
         // event(new RegistrationUpdated($registration));
         event(new RegistrationStepChanged($registration, $extra));
     }
     return redirect()->to(env('REGSITRAR_EMAIL_EMAIL_VERIFIED_REDIRECT', 'https://el-css.edu.om/registrar'));
 }