コード例 #1
0
 public function actionAssignOp($id)
 {
     $customer = Customer::model()->findByPk($id);
     if (isset($_POST['id'])) {
         $customer->option_id = $_POST['id'];
         if ($customer->save()) {
             $model = CustAppoint::model()->findByAttributes(array('app_id' => 2, 'cus_id' => $id));
             $model->status = 2;
             $model->save();
             $this->redirect(array('site/index'));
         }
     }
     $options = CHtml::listData(Options::model()->findAll(), 'id', 'opt_type');
     $this->render('asnoptions', array('customer' => $customer, 'options' => $options));
 }
コード例 #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id)
 {
     $curUser = Customer::model()->findByPk($id);
     $this->customerData = $curUser;
     if (empty($curUser->id)) {
         throw new CHttpException(403, 'Customer Does\'t exists');
     }
     // saving current customer to session
     Yii::app()->session['last_created_user'] = $curUser->attributes;
     //$curUser->selectedCategories;
     $model = WorkingWell::model()->findByAttributes(array('cus_id' => $id));
     $working_model = new WorkingWellOptions();
     if (!$model) {
         $model = new WorkingWell();
         $working_model = new WorkingWellOptions();
     }
     if (isset($_GET['editpdf'])) {
         setCurCus($id);
         DynamicCall::SetEdit1stPdf(getCurCusId());
         DynamicCall::loadProducts(getCurCusId());
         //            DynamicCall::loadMenu(getCurCusId());
         $cusApp = CustAppoint::model()->findByAttributes(array('cus_id' => getCurCusId(), 'app_id' => 2));
         if ($cusApp) {
             $cusApp->status = 1;
             $cusApp->save();
         }
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['WorkingWell'])) {
         $model->attributes = $_POST['WorkingWell'];
         $model->one = $_POST['WorkingWell']['one'];
         $model->two = $_POST['WorkingWell']['two'];
         $model->three = $_POST['WorkingWell']['three'];
         $model->four = $_POST['WorkingWell']['four'];
         if (Yii::app()->user->isUser()) {
             $model->cus_id = $id;
         }
         if ($model->save()) {
             //                if (Yii::app()->user->isUser()):
             $this->redirect(createUrl('MagicSpool/create', array('id' => $id)));
             //                endif;
             //                $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'working_model' => $working_model));
 }
コード例 #3
0
 public function actionCustomerQuest()
 {
     if (isset($_POST['customer']) && isset($_POST['customer']['ajax'])) {
         $customer_questions = $this->loadModel(getCurCusId());
         $customer_questions['earliest_timedelivery'] = isset($_POST['customer']['earliest_timedelivery']) ? $_POST['customer']['earliest_timedelivery'] : "";
         $customer_questions['more_companies'] = isset($_POST['customer']['more_companies']) ? $_POST['customer']['more_companies'] : "";
         $customer_questions['no_people'] = isset($_POST['customer']['no_people']) ? $_POST['customer']['no_people'] : "";
         $customer_questions['present_carters'] = isset($_POST['customer']['present_carters']) ? $_POST['customer']['present_carters'] : "";
         $customer_questions['company_order'] = isset($_POST['customer']['company_order']) ? $_POST['customer']['company_order'] : "";
         $customer_questions['avg_attend'] = isset($_POST['customer']['avg_attend']) ? $_POST['customer']['avg_attend'] : "";
         if ($customer_questions->save()) {
             $cusApp = CustAppoint::model()->findByAttributes(array('cus_id' => getCurCusId(), 'app_id' => 1));
             $cusApp->status = 1;
             if ($cusApp->save()) {
                 $cusApp = new CustAppoint();
                 $cusApp->app_id = 2;
                 $cusApp->cus_id = getCurCusId();
                 $cusApp->status = 1;
                 $cusApp->save();
             }
         }
         echo json_encode(array('success' => 'true', 'c_id' => getCurCusId()));
         exit;
     }
     $this->render('customer_quest');
 }
コード例 #4
0
 public function actionFeedback($id)
 {
     $this->layout = '//layouts/main_b';
     if (isset($_POST['yt0'])) {
         //            $customer_questions = $this->loadModel(getCurCusId());
         $customer_questions = $this->loadModel($id);
         $customer_questions->unable_to_commit = isset($_POST['email']) ? $_POST['email'] : "";
         //            $customer_questions['email'] = isset($_POST['email']) ? $_POST['email'] : "";
         //            $customer_questions['start_date'] = isset($_POST['startDate']) ? $_POST['startDate'] : "";
         //            $customer_questions['opportunity_given'] = isset($_POST['opportunity_given']) ? $_POST['opportunity_given'] : "";
         //                    mErrors($customer_questions);
         if ($customer_questions->save()) {
             $model = CustAppoint::model()->findByAttributes(array('app_id' => 2, 'cus_id' => $id));
             $model->status = 3;
             $time = time();
             $model->update_time = date("Y-m-d h:i:s", $time);
             $model->save();
         }
         $this->redirect(array('site/index'));
     }
     $customer = Customer::model()->findByPk($id);
     $this->render('customer_feedback', array('customer' => $customer));
 }
コード例 #5
0
 public function actionAdminSolns()
 {
     $cust = Customer::model()->findAll(array('condition' => 'id=:id ', 'params' => array(':id' => getCurCusId())));
     foreach ($cust as $k => $val) {
         $magicSpools = $val->magicSpools;
         $notes = $val->notes;
         $workingWells = $val->workingWells;
         $hotFoods = $val->hotFoods;
         $lunches = $val->lunches;
         $breakfasts = $val->breakfasts;
         $sundries = $val->sundries;
         $indusFoods = $val->indusFoods;
         $sandwiches = $val->sandwiches;
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] == 1) {
         if (count($magicSpools)) {
             //getCurCusId()
             $mspoon = MagicSpoolAns::model()->findByAttributes(array('cus_id' => getCurCusId()));
             if ($mspoon === NULL) {
                 $mspoon = new MagicSpoolAns();
                 $mspoon->cus_id = getCurCusId();
             }
             $mspoon->one = isset($_POST['one']) ? $_POST['one'] : "";
             $mspoon->two = isset($_POST['two']) ? $_POST['two'] : "";
             $mspoon->three = isset($_POST['three']) ? $_POST['three'] : "";
             $mspoon->four = isset($_POST['four']) ? $_POST['four'] : "";
             $mspoon->five = isset($_POST['five']) ? $_POST['five'] : "";
             $mspoon->one_comment = isset($_POST['magicspools']['one']['comment']) ? $_POST['magicspools']['one']['comment'] : "";
             $mspoon->two_comment = isset($_POST['magicspools']['two']['comment']) ? $_POST['magicspools']['two']['comment'] : "";
             $mspoon->three_comment = isset($_POST['magicspools']['three']['comment']) ? $_POST['magicspools']['three']['comment'] : "";
             $mspoon->four_comment = isset($_POST['magicspools']['four']['comment']) ? $_POST['magicspools']['four']['comment'] : "";
             $mspoon->five_comment = isset($_POST['magicspools']['five']['comment']) ? $_POST['magicspools']['five']['comment'] : "";
             $mspoon->one_like = isset($_POST['magicspools']['one']['like']) ? intval($_POST['magicspools']['one']['like']) : "0";
             $mspoon->two_like = isset($_POST['magicspools']['two']['like']) ? intval($_POST['magicspools']['two']['like']) : "0";
             $mspoon->three_like = isset($_POST['magicspools']['three']['like']) ? intval($_POST['magicspools']['three']['like']) : "0";
             $mspoon->four_like = isset($_POST['magicspools']['four']['like']) ? intval($_POST['magicspools']['four']['like']) : "0";
             $mspoon->five_like = isset($_POST['magicspools']['five']['like']) ? intval($_POST['magicspools']['five']['like']) : "0";
             $mspoon->save();
         }
         //
         if (isset($_POST['hotFoods'])) {
             $cusApp = CustAppoint::model()->findByAttributes(array('app_id' => 2, 'cus_id' => getCurCusId()));
             $cusApp->status = 2;
             $cusApp->save();
             $model = HotFood::model()->findByPk($hotFoods[0]->id);
             if ($model !== null) {
                 $model->ans = isset($_POST['hotFoods']['ans']) ? $_POST['hotFoods']['ans'] : "";
                 $model->comment = isset($_POST['hotFoods']['comment']) ? $_POST['hotFoods']['comment'] : "";
                 $model->save();
             }
         }
         if (isset($_POST['sandwiches'])) {
             $model = Sandwiches::model()->findByPk($sandwiches[0]->id);
             if ($model !== null) {
                 $model->ans = isset($_POST['sandwiches']['ans']) ? $_POST['sandwiches']['ans'] : "";
                 $model->comment = isset($_POST['sandwiches']['comment']) ? $_POST['sandwiches']['comment'] : "";
                 $model->save();
             }
         }
         if (isset($_POST['breakfast'])) {
             $model = Breakfast::model()->findByPk($breakfast[0]->id);
             if ($model !== null) {
                 $model->ans = isset($_POST['breakfast']['ans']) ? $_POST['breakfast']['ans'] : "";
                 $model->comment = isset($_POST['breakfast']['comment']) ? $_POST['breakfast']['comment'] : "";
                 $model->save();
             }
         }
         if (isset($_POST['indusFoods'])) {
             $model = IndusFood::model()->findByPk($indusFoods[0]->id);
             if ($model !== null) {
                 $model->ans = isset($_POST['indusFoods']['ans']) ? $_POST['indusFoods']['ans'] : "";
                 $model->comment = isset($_POST['indusFoods']['comment']) ? $_POST['indusFoods']['comment'] : "";
                 $model->save();
             }
         }
         if (isset($_POST['lunch'])) {
             $model = Lunch::model()->findByPk($lunches[0]->id);
             if ($model !== null) {
                 $model->ans = isset($_POST['lunch']['ans']) ? $_POST['lunch']['ans'] : "";
                 $model->comment = isset($_POST['lunch']['comment']) ? $_POST['lunch']['comment'] : "";
                 $model->save();
             }
         }
         if (isset($_POST['sundries'])) {
             $model = Sundries::model()->findByPk($sundries[0]->id);
             if ($model !== null) {
                 $model->ans = isset($_POST['sundries']['ans']) ? $_POST['sundries']['ans'] : "";
                 $model->comment = isset($_POST['sundries']['comment']) ? $_POST['sundries']['comment'] : "";
                 $model->save();
             }
         }
         echo json_encode(array('success' => '1'));
         exit;
     }
     $lunch_note = "";
     $breakfast_note = "";
     $sandwiches_note = "";
     $hotfood_note = "";
     $indusfood_note = "";
     $sundries_note = "";
     foreach ($notes as $value => $kval) {
         //            print_r($kval);
         if ($kval['form'] == 'lunch') {
             $lunch_note = $kval['text'];
         }
         if ($kval['form'] == 'breakfast') {
             $breakfast_note = $kval['text'];
         }
         if ($kval['form'] == 'sandwiches') {
             $sandwiches_note = $kval['text'];
         }
         if ($kval['form'] == 'hotfood') {
             $hotfood_note = $kval['text'];
         }
         if ($kval['form'] == 'indusfood') {
             $indusfood_note = $kval['text'];
         }
         if ($kval['form'] == "sundries") {
             $sundries_note = $kval['text'];
         }
         if ($kval['form'] == 'magicspoon') {
             $mspoon_note = $kval['text'];
         }
     }
     $this->render('adminsolns', array('customer' => $cust, 'magic_spools' => $magicSpools, 'notes' => $notes, 'workingWells' => $workingWells, 'sundries' => $sundries, 'lunches' => $lunches, 'indusFoods' => $indusFoods, 'breakfasts' => $breakfasts, 'sandwiches' => $sandwiches, 'hotFoods' => $hotFoods, 'sundries_note' => $sundries_note, 'lunch_note' => $lunch_note, 'indusfood_note' => $indusfood_note, 'breakfast_note' => $breakfast_note, 'sandwiches_note' => $sandwiches_note, 'hotfood_note' => $hotfood_note));
 }
コード例 #6
0
 public function checkSndPdf($id, $calldate = null)
 {
     $model = CustAppoint::model()->findByAttributes(array('app_id' => 2, 'cus_id' => $id, 'status' => 2));
     //        e($model->cus);
     $image_title = '';
     if (!isset($model->status)) {
         echo "Not Started";
     } elseif ($model->status == 1) {
         echo "Franchise Update";
     } elseif ($model->status == 2) {
         //            echo getFmtDate($calldate, 'd-m-Y H:i:s') . "<a href=" . createUrl("site/getstarted2nd", array("id" => $id)) . "
         //                title='Call Date:" . getFmtDate($model->cus->call_date, 'd-m-Y H:i', 0, 16) . "  Provisional Date:" . getFmtDate($model->cus->provisional_date, 'd-m-Y H:i', 0, 16) . "'> Not Completed</a>";
     } elseif ($model->status == 3) {
         //            echo "Completed " . $model->update_time;
         $image_title = 'Mail Pdf';
     }
     if (Yii::app()->session['email_sent'] == $id) {
         $image_title = 'Email Sent';
     }
     if ($model) {
         echo CHtml::link(CHtml::image(getSiteUrl() . '/images/download_pdf.png', 'Img', array('style' => 'width:28px; margin:-8px 5px 0 0', 'title' => 'Preview Pdf')), createUrl('site/sendpdf', array('id' => $id)), array('target' => 'blank', 'class' => 'pdf21')) . CHtml::link(CHtml::image(getSiteUrl() . '/images/download_pdf1.png', 'Img', array('style' => 'width:28px; margin:-8px 5px 0 0', 'title' => 'Download Pdf')), createUrl('site/downloadpdf', array('id' => $id)), array('class' => 'pdf2download1'));
     }
 }
コード例 #7
0
 public function adminOp($id)
 {
     $model = CustAppoint::model()->findByAttributes(array('app_id' => 2, 'cus_id' => $id));
     if ($model) {
         if ($model->status == 1) {
             echo "<a href=" . createUrl("site/getStarted2nd", array("id" => $id, 'tempAdmin' => 1)) . ">Admin</a>";
         } elseif ($model->status == 2) {
             echo "Completed " . getFmtDate($model->update_time, 'd-m-Y H:i:s');
         } else {
             echo "Not Started";
         }
     } else {
         echo "Not Started";
     }
 }
コード例 #8
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 $id the ID of the model to be loaded
  * @return CustAppoint the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = CustAppoint::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #9
0
 public function actionOptionsView()
 {
     $customer = Customer::model()->findByPk(getCurCusId());
     if (isset($_POST['option'])) {
         $cus = Customer::Model()->findByPk(getCurCusId());
         $cus->option_id = $_POST['option'];
         $cus->save();
         $model = CustAppoint::model()->findByAttributes(array('app_id' => 2, 'cus_id' => getCurCusId()));
         $model->status = 2;
         $time = time();
         $model->update_time = date("Y-m-d h:i:s", $time);
         $model->save();
         $user = User::model()->findByPk(Yii::app()->user->uid);
         if ($user->role_id == 2) {
             Yii::app()->user->setState('role', 2);
         }
         $this->redirect(array('site/index'));
     }
     if (isset($_POST['CustomOptionsId'])) {
         $model = new CustomOptionsId();
         $model->name = $_POST['CustomOptionsId']['name'];
         $model->user_id = Yii::app()->user->uid;
         $model->save();
         foreach ($_POST['CustomOptions'] as $key => $value) {
             $model1 = new CustomOptions();
             $model1->attributes = $value;
             $model1->order_id = $model->id;
             //                e($value,0);
             //                mErrors($model1,0);
             $model1->save();
         }
         //            e($_POST);
     }
     if (isset($_GET['options_num'])) {
         $value = intval(isset($_GET['options_num']) ? $_GET['options_num'] : "0");
         $model = Options::model()->findByPk($value);
         if ($model === NULL || empty($model)) {
             $model = array('offer_msg' => "Sorry, Selected offer is not available");
         }
     } else {
         $model = array('offer_msg' => "Please choose Offers");
     }
     $customoption = CustomOptionsId::model()->findAll(array("condition" => "user_id = " . yii::app()->user->uid));
     $options = Options::model()->findAll();
     $criteria = new CDbCriteria();
     $criteria->compare('franchise', Yii::app()->user->franchise);
     $customers = Customer::model()->findAll($criteria);
     $customerlist = CHtml::listData($customers, 'id', 'name');
     $view = 'optionviews';
     if (isset($_REQUEST['custom'])) {
         $view = 'optionviewscustom';
     }
     //        e($view);
     //        e($model);
     $this->render($view, array('model' => $model, 'customers' => $customerlist, 'options' => CJSON::encode($options), 'customoptions' => CJSON::encode($customoption)));
 }