예제 #1
2
파일: _form.php 프로젝트: rodespsan/LMEC
echo $form->labelEx($model, 'model_id');
?>
		<?php 
echo $form->dropDownList($model, 'model_id', CHtml::listData(Modelo::model()->findAll(array('condition' => 'active=1', 'order' => 'name')), 'id', 'name'), array('prompt' => 'Seleccionar'));
?>
		<?php 
echo $form->error($model, 'model_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'service_type_id');
?>
		<?php 
echo $form->dropDownList($model, 'service_type_id', CHtml::listData(ServiceType::model()->findAll(array('condition' => 'active=1', 'order' => 'name')), 'id', 'name'), array('prompt' => 'Seleccionar', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('order/servicesFromServiceType'), 'data' => array('Order[service_type_id]' => 'js:this.value'), 'success' => 'js:function(dataType){
						jsonObject = JSON.parse(dataType);
						
						$("#Order_service").children().remove();
						$("#Order_service").append( new Option("Seleccionar", 0));
						
						for(i=0; i< jsonObject.services_options.length; i++){
							$("#Order_service").append( new Option(
								jsonObject.services_options[i].name,
								jsonObject.services_options[i].id
							));
						}
					}', 'error' => 'js:function(dataType){
						$("#Order_service").children().remove();
						$("#Order_service").append( new Option("Seleccionar"));
					}')));
예제 #2
1
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Service();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Service'])) {
         $model->attributes = $_POST['Service'];
         if ($model->save()) {
             if (!empty($_POST['yt1'])) {
                 Yii::app()->user->setFlash('service-created', "¡El servicio <b><i>&quot;{$model->name}&quot;</i></b> fue creado exitosamente!");
                 $this->redirect(array('create'));
             } else {
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     if (ServiceType::model()->count('active = 1') > 0) {
         $this->render('create', array('model' => $model));
     } else {
         throw new CHttpException('', 'Primero debe ' . CHtml::link('crear un Tipo de Servicio', array('servicetype/create')) . '.');
     }
 }
예제 #3
1
파일: _form.php 프로젝트: rodespsan/LMEC
echo $form->labelEx($model, 'name');
?>
		<?php 
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 200));
?>
		<?php 
echo $form->error($model, 'name');
?>
	</div>
	
	<div class="row">
		<?php 
echo $form->labelEx($model, 'service_type_id');
?>
		<?php 
echo $form->radioButtonList($model, 'service_type_id', CHtml::listData(ServiceType::model()->findAll('active = 1'), 'id', 'name'), array('separator' => '  ', 'labelOptions' => array('style' => 'display:inline')));
?>
		<?php 
//echo $form->radioButtonList($model,'service_type_id',CHtml::listData(Brand::model()->findAll('active = 1'),'id','name'), array('empty'=>'Seleccionar Marca'));
?>
		<?php 
echo $form->error($model, 'service_type_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'description');
?>
		<?php 
echo $form->textField($model, 'description', array('size' => 60, 'maxlength' => 500));
예제 #4
1
파일: Service.php 프로젝트: rodespsan/LMEC
 public static function getServiceType($serviceTypeId)
 {
     $serviceType = ServiceType::model()->findByPk($serviceTypeId);
     return $serviceType->name;
 }
예제 #5
0
파일: _form.php 프로젝트: rodespsan/LMEC
echo $form->labelEx($model, 'code');
?>
		<?php 
echo $form->textField($model, 'code');
?>
		<?php 
echo $form->error($model, 'code');
?>
	</div>
	
	<div class="row">
		<?php 
echo $form->labelEx($model, 'service_type_id');
?>
		<?php 
echo $form->dropDownList($model, 'service_type_id', CHtml::listData(ServiceType::model()->findAll(array('condition' => 'active = 1', 'order' => 'name')), 'id', 'name'), array('empty' => 'Seleccionar Tipo de Servicio'));
?>
		<?php 
echo $form->error($model, 'service_type_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'name');
?>
		<?php 
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 500));
?>
		<?php 
echo $form->error($model, 'name');
예제 #6
0
 /**
  * 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 = ServiceType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #7
0
파일: Service.php 프로젝트: hson91/posnail
 public function getType()
 {
     return ServiceType::model()->find('pk_s_id = :pk_s_id', array(':pk_s_id' => $this->s_service_type_id));
 }
예제 #8
0
 public function actionServicesFromServiceType()
 {
     if (isset($_POST['Order']['service_type_id'])) {
         $serviceType = ServiceType::model()->findByPk($_POST['Order']['service_type_id']);
         $services = Service::model()->findAll(array('condition' => 'service_type_id = :service_type_id', 'order' => 'name', 'params' => array(':service_type_id' => $_POST['Order']['service_type_id'])));
         $this->renderPartial('servicesFromServiceType', array('serviceTyper' => $serviceType, 'services' => $services));
     }
 }