Beispiel #1
0
 public static function getStatesByCountryDefault($countryId)
 {
     $statesModel = States::find()->select(['id', 'name'])->asArray()->where(['country_id' => $countryId])->all();
     $states = array();
     $states['0'] = 'Select State';
     for ($k = 0; $k < count($statesModel); $k++) {
         $states[$statesModel[$k]['id']] = $statesModel[$k]['name'];
     }
     return $states;
 }
Beispiel #2
0
/* @var $this yii\web\View */
/* @var $model backend\models\UserMain */
$this->title = $model->username;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-main-view">

<?php 
if ($model->status == 10) {
    $status = 'Active';
} else {
    $status = 'In-Active';
}
if ($model->roleId == 2) {
    $role = 'Vendor';
} else {
    if ($model->roleId == 3) {
        $role = 'User';
    } else {
        $role = 'Admin';
    }
}
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['username', 'email:email', ['attribute' => 'status', 'label' => 'Status', 'value' => $status], ['attribute' => 'roleId', 'label' => 'Role', 'value' => $role], 'register.firstName', 'register.lastName', 'register.middleName', 'register.gender', 'register.dob', 'register.mobile', 'register.mobile2', 'register.address1', 'register.address2', ['attribute' => 'country', 'label' => 'Country', 'value' => Countries::getCountryName($model->register->country)], ['attribute' => 'state', 'label' => 'State', 'value' => States::getStateName($model->register->state)], 'register.city', 'register.zip']]);
?>

</div>
Beispiel #3
0
 public static function getStateCode($stateId)
 {
     $statesModel = States::find()->select(['code'])->asArray()->where(['id' => $stateId])->one();
     return $statesModel['code'];
 }
Beispiel #4
0
} else {
    $status = 'In-Active';
}
if ($model->roleId == 2) {
    $role = 'Vendor';
} else {
    if ($model->roleId == 3) {
        $role = 'User';
    } else {
        $role = 'Admin';
    }
}
?>

<?php 
if ($model->vendorregister->storeImage != '') {
    ?>
						 		<?php 
    $imgeurl = str_replace("backend", "frontend", Yii::getAlias('@web')) . '/' . $model->vendorregister->storeImage;
    ?>
						 		
						 		<?php 
}
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'vendor_unique_id', 'label' => 'Store Id', 'value' => $model->vendorregister->vendor_unique_id], 'username', 'email:email', ['attribute' => 'storeName', 'label' => 'Store Name', 'value' => $model->vendorregister->storeName], ['attribute' => 'roleId', 'label' => 'Role', 'value' => $role], 'vendorregister.firstName', 'vendorregister.lastName', 'vendorregister.middleName', 'vendorregister.mobile', 'vendorregister.mobile2', ['attribute' => 'fax', 'label' => 'Fax', 'value' => $model->vendorregister->fax], ['attribute' => 'country', 'label' => 'Country', 'value' => Countries::getCountryName($model->vendorregister->country)], ['attribute' => 'state', 'label' => 'State', 'value' => States::getStateName($model->vendorregister->state)], 'vendorregister.city', 'vendorregister.zip', ['attribute' => 'storeAddress', 'label' => 'Store Address', 'value' => $model->vendorregister->storeAddress], 'vendorregister.address2', ['attribute' => 'storeImage', 'format' => 'html', 'value' => Html::img($model->vendorregister->storeImage ? $imgeurl : '@web/images/events-default.png', ['width' => '250px', 'height' => '250px'])], ['attribute' => 'status', 'label' => 'Status', 'value' => $status]]]);
?>

</div>
Beispiel #5
0
 public function actionSignup()
 {
     $this->layout = "@app/views/layouts/vendor";
     $model = new VendorRegister();
     $userMain = new UserMaster();
     $model->scenario = 'vendor';
     $model->countriesList = Countries::getCountriesUS();
     //$model->statesData = array();
     $model->country = 231;
     $model->statesData = Countries::getStatesByCountryDefault($model->country);
     $model->state = 3975;
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $userSave = $model->signup();
         $model->email = '*****@*****.**';
         $model->username = '******';
         $model->uid = $userSave->id;
         $model->storeImage = UploadedFile::getInstance($model, 'storeImage');
         if ($model->storeImage != '') {
             $imageName = rand(1000, 100000) . $model->storeImage->baseName;
             $model->storeImage->saveAs(Yii::getAlias('@frontend') . '/web/uploads/storeimages/' . $imageName . '.' . $model->storeImage->extension);
             $model->storeImage = 'uploads/storeimages/' . $imageName . '.' . $model->storeImage->extension;
         } else {
             $model->storeImage = '';
         }
         $stateShortName = States::getStateName($model->state);
         $words = explode(" ", $stateShortName);
         $stateName = "";
         /* if(count($words >= 2))
         			{
         				$k=0;
         				
         			foreach ($words as $w) {
         				
         				if($k <= 1)
         				{
         				$stateName .= $w[0];
         				}
         				$k++;
         			}
         			}
         			else 
         			{
         				$stateName = substr($stateShortName,0,2);
         			} */
         $stateName = States::getStateCode($model->state);
         $cityName = substr($model->city, 0, 2);
         $cnt = VendorRegister::find()->where(['state' => $model->state])->count();
         if ($cnt == 0) {
             $userupdatedId = 100;
         } else {
             $userupdatedId = 100 + $cnt;
         }
         $model->vendor_unique_id = strtoupper($stateName . 'gds' . $userupdatedId);
         //print_r($model->vendor_unique_id);exit();
         $model->save();
         Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.');
         //echo "Registration successfully";
         return $this->redirect(['index']);
     } else {
         return $this->render('signup', ['model' => $model]);
     }
 }
Beispiel #6
0
	                                      <td><?php 
echo $model->address2;
?>
</td>
                                     </tr>
                                      <tr>
	                                      <td>City</td>
	                                      <td><?php 
echo $model->city;
?>
</td>
									</tr>
									 <tr>
                                     	 <td>State</td>
                                     	 <td><?php 
echo States::getStateName($model->state);
?>
</td>
                                   </tr>
                                    <tr>
                                      	<td>Country</td>
                                        <td><?php 
echo Countries::getCountryName($model->country);
?>
</td>
                                    </tr>
                                     <tr>
	                                      <td>Zip Code</td>
	                                      <td><?php 
echo $model->zip;
?>