public function actionIndex() { // header('Location: http://www.supernovacompanies.com/lending/'); //return $this->render('index'); if (Yii::$app->user->getIsGuest()) { return $this->redirect(Yii::$app->user->loginUrl); } $id_user_role = Yii::$app->user->getIdentity()->id_user_role; $id_user = Yii::$app->user->getIdentity()->id_user; $agree = Yii::$app->user->getIdentity()->agree; $url = '/user/login'; if ($id_user_role == Dict::USER_ROLE_BETTERDEBT) { $url = '/official/index'; } else { if ($id_user_role == Dict::USER_ROLE_INSTITUTION) { $url = '/institution/index'; } else { if ($id_user_role == Dict::USER_ROLE_ADVISOR) { //新增判断是否已读协议 if ($agree == Dict::USER_AGREE_NOT) { $url = '/user/login'; } else { $url = '/advisor/index'; } } else { if ($id_user_role == Dict::USER_ROLE_CLIENT) { if ($agree == Dict::USER_AGREE_NOT) { $url = '/user/login'; } //根据用户id_user查出是否有无数据 $applicant = AppApplicant::find()->where(['id_user' => Yii::$app->user->getIdentity()->id_user])->orderBy(['id_app_applicant' => SORT_DESC])->one(); if (is_null($applicant)) { $url = '/loan/application'; } else { $loan = Loan::find()->where(['id_application' => $applicant->id_application]); if (is_null($loan) && $loan->status == Dict::LOAN_STATUS_ACTIVE) { $url = '/loan/index'; } else { $url = '/loan/application'; } } } else { if ($id_user_role == Dict::USER_ROLE_BANK) { $url = '/bank/index'; } } } } } return $this->redirect([$url]); }
public function actionCheck($id_app_task) { $model = AppTask::findOne($id_app_task); // 判断是否可以 approve $loanModel = Loan::find()->where(['id_application' => $model->id_application])->one(); $loanModel->setScenario('review'); $loan_ctrl = $loanModel->validate(); // check points $checkPoints = AppTaskCheckpoint::find()->where(['id_app_task' => $id_app_task])->all(); return $this->renderAjax('check', ['model' => $model, 'loan_ctrl' => $loan_ctrl, 'checkPoints' => $checkPoints]); }
public function actionIndex($id_app_task) { $model = AppTask::findOne($id_app_task); // loan $loan = Loan::find()->where(['id_application' => $model->id_application])->one(); // application $application = Application::findOne($model->id_application); // applicants $app_applicants = $application->appApplicants; $applicants = []; foreach ($app_applicants as $val) { $applicants[] = $val->first_name; } // advisors $advisors = []; foreach ($model->application->advisors as $advisor) { if (isset($advisor->user)) { $advisors[] = $advisor->user->first_name; } } // 读取所以检查项 $checkPointsData = AppTaskCheckpoint::find()->where(['id_app_task' => $id_app_task])->all(); $checkPoints = []; $check_ctrl = true; foreach ($checkPointsData as $val) { $checkPoints[$val['id_app_task_checkpoint_type']] = $val; } if ($application->have_existing_loan) { $check_ctrl = $checkPoints[4]->status && $checkPoints[5]->status ? true : false; } else { $check_ctrl = $checkPoints[4]->status ? true : false; } if (Yii::$app->request->post()) { $loanModel = Loan::find()->andWhere(['id_application' => $model->id_application])->one(); $loanModel->status = 1; $loanModel->save(); if (AppTask::taskFinish($id_app_task)) { //active log.loan officer finished the task line set-up Active::operationLog($model->id_application, [Yii::$app->user->getIdentity()->first_name, Yii::$app->user->getIdentity()->last_name, 'finished', DictTask::$taskType[DictTask::TYPE_LINE_SETUP]], DictActive::USER_FINISH_TASK, Yii::$app->user->getIdentity()->id); } // 拷贝 form/financial info/LOC Disbursement $app_form = AppForm::find()->andWhere(['id_application' => $model->id_application])->one(); $LoanBankAcount = new LoanBankAcount(); $LoanBankAcount->account_type = 1; $LoanBankAcount->id_loan = $loanModel->id_loan; $LoanBankAcount->bank_name = $app_form->bank_name; $LoanBankAcount->routing_number = $app_form->routing_number; $LoanBankAcount->account_name = $app_form->account_name; $LoanBankAcount->account_number = $app_form->account_number; $LoanBankAcount->save(); // 拷贝 collateral_data 数据 LineAccount::copyData($model->id_application, $loanModel->id_loan); CollateralAccount::copyData($model->id_application, $loanModel->id_loan); //send loan approval email to client and cc to advisor(email($email_type,[$task_type,$id_app_task,$loan])) $res = SendEmail::email(DictEmail::EMAIL_LETTER_ABOUT_LINE, [DictEmail::LETTER_TASK_LOAN_APPROVAL, $id_app_task, $loan]); if ($res) { //active log.system sent an email 'Your Line is Live' to client and advisor //判断是否有两个client参与 $user = SendEmail::findUserByApplication($model->id_application); if (is_null($user['co_applicant'])) { Active::operationLog($model->id_application, [$user['applicant']->first_name, $user['applicant']->last_name, '', $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_LINE_ALIVE_LETTER, 0); } else { Active::operationLog($model->id_application, [$user['applicant']->first_name, $user['applicant']->last_name, ',' . $user['co_applicant']->first_name . ' ' . $user['co_applicant']->last_name, $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_LINE_ALIVE_LETTER, 0); } } //active log.system closed the application Active::operationLog($model->id_application, [], DictActive::SYSTEM_CLOSED_THE_APPLICATION, 0); // collateral_data 拷贝 Line $application = Application::findOne($model->id_application); $application->id_application_status = DictApplication::STATUS_CLOSED; $application->save(false); return $this->redirect(['/application/view', 'id' => $model->id_application]); } return $this->render('index', ['model' => $model, 'application' => $application, 'loan' => $loan, 'applicants' => $applicants, 'advisors' => $advisors, 'checkPoints' => $checkPoints, 'check_ctrl' => $check_ctrl]); }
<?php use yii\helpers\Html; use common\models\Application; use common\models\AppOwnerTask; use common\models\Loan; $identity = Yii::$app->user->getIdentity(); $loan = Loan::find()->andWhere(['id_application' => $model->id_application])->one(); $percent = $model->percent; $locIsMaximum = $model->loc_max == 1 && ($model->loc == null || $model->loc == 0); $locToolTip = $locIsMaximum ? 'Maximum amount based on collateral value' : ''; $locValueLabel = $locIsMaximum ? 'Maximum' : ($model->loc != null && $model->loc != 0 ? number_format($model->loc) : '---,---,---'); ?> <div class="row pt60 ovh clearfix"> <div class="col-md-4 por"> <i class="ico-01 ico-bell"></i> <div class="pl70 Notic_text_auto_font_size" style="height:68px;display: table-cell;vertical-align: middle;"> <?php if ($identity->id_user_role == Dict::USER_ROLE_BETTERDEBT) { ?> <p class="fs14 mb0" style="font-weight: 100;">Welcome to Supernova Lending, <?php echo $identity->first_name; ?> !</p> <?php } else { if ($identity->id_user_role == Dict::USER_ROLE_ADVISOR) { ?> <p class="fs14 mb0" style="font-weight: 100;">Welcome to Supernova Lending, <?php echo $identity->first_name;
<?php use yii\helpers\Url; use yii\widgets\Breadcrumbs; use common\models\Loan; use common\models\AppApplicant; use common\models\Application; use common\models\Client; $id_application = 0; //根据用户id查出是否有无数据 $applicant = AppApplicant::find()->where(['id_user' => Yii::$app->user->getIdentity()->id])->orderBy(['id_app_applicant' => SORT_DESC])->one(); $application = null; $loan = null; if (!is_null($applicant)) { $application = Application::findOne($applicant->id_application); $loan = Loan::find()->where(['id_application' => $applicant->id_application])->one(); } //根据id_user查找出client(用于profile方法的传值)$id_client $client = Client::find()->andWhere(['id_user' => Yii::$app->user->getIdentity()->id_user])->one(); ?> <nav class="navbar navbar-default navbar-fixed-top nav-ma"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand h60" href="#"><img src="<?php echo Url::to(['@web/images/BetterDebt_logo.svg']);
public function actionLogin($email = '', $come = '') { $this->enableCsrfValidation = false; $this->layout = '//home/yii'; $model = new LoginForm(); if ($model->load(Yii::$app->request->post()) && !$model->login($this->loginDuration)) { $a = ['errors' => $model['errors'], 'code' => 0]; exit(json_encode($a)); } if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && $model->login($this->loginDuration)) { $id_user_role = Yii::$app->user->getIdentity()->id_user_role; $id_user = Yii::$app->user->getIdentity()->id_user; $agree = Yii::$app->user->getIdentity()->agree; $url = ''; if ($id_user_role == Dict::USER_ROLE_BETTERDEBT) { $url = '/official/index'; } else { if ($id_user_role == Dict::USER_ROLE_INSTITUTION) { $url = '/institution/index'; } else { if ($id_user_role == Dict::USER_ROLE_ADVISOR) { //新增判断是否已读协议 if ($agree == Dict::USER_AGREE_NOT) { exit($this->_agree($id_user, $id_user_role)); } else { $url = '/advisor/index'; } } else { if ($id_user_role == Dict::USER_ROLE_CLIENT) { if ($agree == Dict::USER_AGREE_NOT) { exit($this->_agree($id_user, $id_user_role)); } //根据用户id_user查出是否有无数据 $applicant = AppApplicant::find()->where(['id_user' => $id_user])->orderBy(['id_app_applicant' => SORT_DESC])->one(); if (is_null($applicant)) { $url = '/loan/application'; } else { $loan = Loan::find()->where(['id_application' => $applicant->id_application])->one(); if (isset($loan) && $loan->status == Dict::LOAN_STATUS_ACTIVE) { $url = '/loan/index'; } else { $url = '/loan/application'; } } } else { if ($id_user_role == Dict::USER_ROLE_BANK) { $url = '/bank/index'; } } } } } if ($come) { $return = ['code' => 2, 'url' => $come]; exit(json_encode($return)); //return $this->redirect([$come]); } else { $return = ['code' => 2, 'url' => $url]; exit(json_encode($return)); //return $this->redirect([$url]); } } return $this->render('login', ['model' => $model, 'email' => $email]); }
public function actionList() { $searchModel = new LoanSearch(); if ($this->user->id_user_role == Dict::USER_ROLE_ADVISOR) { $advisor = Advisor::find()->andWhere(['id_user' => $this->user->id])->one(); //find related groups $id_groups = AdvisorGroup::find()->andWhere(['id_advisor' => $advisor['id_advisor']])->all(); $ids = []; foreach ($id_groups as $value) { $ids[] = $value['id_group']; } $applications = Application::find()->andWhere(['in', 'id_group', $ids])->all(); $id_applications = []; foreach ($applications as $value) { $id_applications[] = $value['id_application']; } $query = Loan::find()->andWhere(['in', 'id_application', $id_applications])->andWhere(['status' => 1]); //->orderBy(['id_loan' => SORT_DESC]); $dataProvider = $searchModel->search(Yii::$app->request->get(), $query); } else { if ($this->user->id_user_role == Dict::USER_ROLE_BETTERDEBT) { $query = Loan::find()->andWhere(['status' => 1]); //->orderBy(['id_loan' => SORT_DESC]); $dataProvider = $searchModel->search(Yii::$app->request->get(), $query); // $query->orderBy(['id_loan' => SORT_DESC]); // $dataProvider = new ActiveDataProvider([ // 'query' => $query, // ]); } } return $this->render('list', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }