public function userExists($attribute)
 {
     $User = BoxomaticUser::model()->findByAttributes(array('email' => $this->{$attribute}));
     $this->User = $User;
     if (!$User) {
         $this->addError($attribute, 'Could not find user.');
     }
 }
Beispiel #2
0
 public function __construct()
 {
     $this->_user = Yii::app()->user;
     $User = isset($this->_user->id) ? BoxomaticUser::model()->findByPk($this->_user->id) : false;
     $this->Customer = $User;
     if ($User) {
         $this->delivery_day = $User->delivery_day;
     }
     $this->delivery_date_id = $this->_user->getState('boxocart.delivery_date_id', null);
     $this->_location_id = $this->_user->getState('boxocart.location_id', $User ? $User->location_id : null);
     $this->_SupplierProduct = $this->_user->getState('boxocart.SupplierProduct', $this->_SupplierProduct, array());
     $this->_UserBox = $this->_user->getState('boxocart.UserBox', $this->_UserBox, array());
     $this->_SupplierProduct_Before = $this->_user->getState('boxocart.SupplierProduct_Before', $this->_SupplierProduct_Before, array());
     $this->_UserBox_Before = $this->_user->getState('boxocart.UserBox_Before', $this->_UserBox_Before, array());
 }
 /**
  * Welcome message.
  */
 public function actionWelcome()
 {
     $User = BoxomaticUser::model()->findByPk(Yii::app()->user->id);
     $this->render('welcome', array('User' => $User));
 }
Beispiel #4
0
$this->page_heading = 'Customer Payments';
Yii::app()->clientScript->registerScript('initPageSize', <<<EOD
\$('.change-pageSize').live('change', function() {
\t\$.fn.yiiGridView.update('customer-payment-grid',{ data:{ pageSize: \$(this).val() }})
});
EOD
, CClientScript::POS_READY);
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('customer-payment-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n\$('.chosen').chosen();\n");
?>
<div class="form row">
<?php 
$form = $this->beginWidget('application.widgets.SnapActiveForm', array('id' => 'user-payment-form', 'enableAjaxValidation' => false, 'layout' => BsHtml::FORM_LAYOUT_HORIZONTAL));
?>
	<div class="col-lg-9 clearfix">
		<?php 
echo $form->dropDownListControlGroup($model, 'user_id', CHtml::listData(BoxomaticUser::model()->findAll(array('order' => 'first_name, last_name')), 'id', 'full_name_and_balance'), array('class' => 'chosen'));
?>
		<?php 
echo $form->dropDownListControlGroup($model, 'payment_type', SnapUtil::config('boxomatic/paymentTypes'));
?>
		<?php 
echo $form->dateFieldControlGroup($model, 'payment_date');
?>
		<?php 
echo $form->textFieldControlGroup($model, 'payment_value', array('size' => 7, 'maxlength' => 7));
?>
		<?php 
echo $form->textAreaControlGroup($model, 'payment_note');
?>
	</div>
	<?php 
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = BoxomaticUser::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
?>
		<p>&nbsp;</p>
		<?php 
$this->beginWidget('bootstrap.widgets.BsPanel', array('title' => 'Current credit by user', 'titleTag' => 'h2'));
?>
		<table class="table">
			<thead>
				<tr>
					<th>id</th>
					<th>Name</th>
					<th>Balance</th>
				</tr>
			</thead>
			<tbody>
				<?php 
$Custs = BoxomaticUser::model()->findAll();
$total = 0;
foreach ($Custs as $Cust) {
    $bal = (double) CHtml::value($Cust, 'balance');
    $total += $bal;
    ?>
				<?php 
    if ($bal != 0) {
        ?>
				<tr>
					<td><?php 
        echo CHtml::value($Cust, 'id');
        ?>
</td>
					<td><?php 
        echo CHtml::value($Cust, 'full_name');