public function actionRelistJobCompany()
 {
     //echo "<pre>";print_r($_REQUEST);die;
     $conver = new ConversationMsg();
     $conversation = new MsgDetails();
     $loggedId = Yii::app()->session['loggedId'];
     if (!empty($_REQUEST)) {
         $senderId = $_REQUEST['loggedId'];
         $reciverId = $_REQUEST['customer_id'];
         $booID = $_REQUEST['booking_id'];
         $conver->sender_id = $senderId;
         $conver->sender_type = 'company';
         $conver->reciver_id = $reciverId;
         $conver->booking_id = $booID;
         $conver->reciver_type = 'customer';
         $conver->sender_status = 1;
         $conver->subject = 'Please Review';
         $conver->save(false);
         $insert_idConver = Yii::app()->db->getLastInsertID();
         $conversation->conversation_id = $insert_idConver;
         $conversation->user_type = 'company';
         $conversation->user_id = $loggedId;
         $conversation->booking_id = $booID;
         $conversation->tomsg = $reciverId;
         $conversation->msg = $_REQUEST['MsgDetails']['msg'];
         $conversation->save(false);
         // chnage the job status in company request table
         $rec = ServiceReview::model()->find(array('condition' => 'booking_id=:booking_id', 'params' => array(':booking_id' => $booID)));
         if (!empty($rec)) {
             $rec->status = 0;
             $rec->save(false);
         }
         echo "success";
         die;
     }
 }
Beispiel #2
0
 public function actionDeleteMsg()
 {
     $id = $_REQUEST['id'];
     $rec = MsgDetails::model()->findByPk($id);
     $conversationId = $rec->conversation_id;
     $detail = MsgDetails::model()->findAll(array('condition' => 'conversation_id=:id', 'params' => array(':id' => $conversationId)));
     foreach ($detail as $d) {
         if (count($d) > 1) {
             $rec->delete();
         } else {
             $rec->delete();
             $rec->conversation->delete();
         }
     }
     //$rec->delete();
     echo "success";
     die;
 }
Beispiel #3
0
 public function actionCustomerView($id)
 {
     $rec = CustomerUser::model()->with('bookings')->findByPk($id);
     $msgDetails = MsgDetails::model()->findAll(array('condition' => 'user_id=:user_id AND tomsg=:tomsg', 'group' => 'conversation_id', 'params' => array(':user_id' => $rec['id'], ':tomsg' => 0)));
     foreach ($msgDetails as $conId) {
         //echo $conId->conversation_id;
         $inboxDtal[] = MsgDetails::model()->findAll(array('condition' => 'conversation_id=:conversation_id AND inbox_dlt_status=:status', 'params' => array(':conversation_id' => $conId->conversation_id, ':status' => 0)));
         $companyName = ServiceUser::model()->findAll(array('condition' => 'id=:id', 'params' => array(':id' => $conId->user_id)));
         // echo "<pre>";print_r($companyName);
     }
     //echo "<pre>";print_r($inboxDtal);die;
     // echo "<pre>";print_r($rec['bookings']);die;
     $this->render('customerview', array('detail' => $rec, 'inbox' => $msgDetails, 'inboxDtal' => $inboxDtal));
 }
Beispiel #4
0
 public function actionProviderView($id)
 {
     //$rec=ServiceUser::model()->with('servicePrices','serviceImages','priceAdmins')->findByPk(array('id'=>$id));
     //echo "<pre>";print_r($rec);die;
     /* if(!empty($rec->servicePrices))
             {
                        foreach($rec->servicePrices as $viewProvider)
     			        {
     			            $priceDetail[]=$viewProvider;
     			        } 
             
     			        foreach($priceDetail as $findServiceTypes)
     			        {
     			          $serviceTypes[]=$findServiceTypes->service_type_id;	
     			        }	
     			         
              
     			        $unqService=array_unique($serviceTypes);
     			       
     			        foreach($unqService as $u)
     			        {	
     			           $service=ServiceTypes::model()->findAll(array('condition'=>'id=:id','params'=>array(':id'=>$u))); 
     			        
     			           foreach($service as $Service)
     			            {
     			            	$AllService[]=$Service->service_name;
     			            	//echo "<pre>";print_r($res);
     			            }	
     
     
     			        } 
             
     
             }
              
             if(!empty($priceDetail) && !empty($AllService))
             { 
        		   $this->render('providerview',array('companyDetail'=>$rec,'price'=>$priceDetail,'service'=>$AllService));
     	
             }
             else
             {
                $this->render('providerview',array('companyDetail'=>$rec));
     	    	
             }*/
     $rec = ServiceUser::model()->with('serviceImages', 'priceAdmins')->findByPk(array('id' => $id));
     //echo "<pre>";print_r($rec);die;
     /*foreach($rec->priceAdmins as $value)
       {
           echo "<pre>";print_r($value);
       }	die; */
     //echo "<pre>";print_r($rec);
     // code to show the messaging section
     $msgDetails = MsgDetails::model()->findAll(array('condition' => 'user_id=:user_id AND tomsg=:tomsg', 'group' => 'conversation_id', 'params' => array(':user_id' => $rec['id'], ':tomsg' => 0)));
     foreach ($msgDetails as $conId) {
         //echo $conId->conversation_id;
         $inboxDtal[] = MsgDetails::model()->findAll(array('condition' => 'conversation_id=:conversation_id AND inbox_dlt_status=:status', 'params' => array(':conversation_id' => $conId->conversation_id, ':status' => 0)));
         $companyName = ServiceUser::model()->findAll(array('condition' => 'id=:id', 'params' => array(':id' => $conId->user_id)));
         // echo "<pre>";print_r($companyName);
     }
     $this->render('providerview', array('companyDetail' => $rec, 'inbox' => $msgDetails, 'inboxDtal' => $inboxDtal));
 }