/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id)
 {
     $this->customerData = Customer::model()->findByPk($id);
     $model = MagicSpool::model()->findByAttributes(array('cus_id' => getCurCusId()));
     $magic_model = new MagicSpoonOptions();
     if (!$model) {
         $model = new MagicSpool();
         $magic_model = new MagicSpoonOptions();
     }
     DynamicCall::GetEdit1stPdf(getCurCusId());
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['MagicSpool'])) {
         $model->attributes = $_POST['MagicSpool'];
         $model->one = $_POST['MagicSpool']['one'];
         $model->two = $_POST['MagicSpool']['two'];
         $model->three = $_POST['MagicSpool']['three'];
         $model->four = $_POST['MagicSpool']['four'];
         if (Yii::app()->user->isUser()) {
             $model->cus_id = $id;
         }
         if ($model->save()) {
             //                if (Yii::app()->user->isUser()):
             $this->redirect(createUrl('site/menu', array('id' => $id)));
             //                endif;
             //                $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'magic_model' => $magic_model));
 }
Example #2
0
 public function model_session_update()
 {
     $table_name = str_replace('_', '', $this->tablename());
     $key = $table_name . getCurCusId();
     $array1 = Yii::app()->session[$key] ? Yii::app()->session[$key] : array();
     $array2[$this->id] = $this;
     $array3 = custom_array_merge(array($array1, $array2));
     Yii::app()->session[$key] = $array3;
 }
 public function actionsaveNotes()
 {
     $noteModel = Notes::model()->findByAttributes(array('form' => $_POST['model'], 'cus_id' => getCurCusId()));
     if (!$noteModel) {
         $noteModel = new Notes();
     }
     if (isset($_POST['notes']) && isset($_POST['model'])) {
         $noteModel->text = $_POST['notes'];
         $noteModel->form = $_POST['model'];
         $noteModel->cus_id = getCurCusId();
         $noteModel->save();
     }
 }
 /**
  * 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));
 }
 public function actionFeedback()
 {
     if (isset($_POST)) {
         //            $customer_questions = $this->loadModel(getCurCusId());
         $customer_questions = $this->loadModel(getCurCusId());
         $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);
         $customer_questions->save();
     }
     $this->render('customer_feedback');
 }
//                    nurl = url + '?menu=' + menu[x];
//                    window.location = nurl;
//                    return false;
//                }
//                if (menu[x] == curmenu) {
//                    cross = true;
//                }
//            }
//            if (cross == true) {
//                window.location = '<?php 
echo createUrl('customer/customerreply', array('id' => getCurCusId()));
?>
';
//            }
            window.location = '<?php 
echo createUrl('customer/customerreply', array('id' => getCurCusId()));
?>
';
        });
    });
    function check(elmt) {
        if ($('#like').is(':checked')) {
            $('#like').prop('checked', false);
            $(elmt).attr('src', '<?php 
echo getSiteUrl() . '/images/like.png';
?>
');
        }
        else {
            $('#like').prop('checked', true);
            $(elmt).attr('src', '<?php 
            </div>
            <div class="col-lg-2">
    <!--            <form action="<?php 
    echo createUrl('customer/feedback', array('id' => getCurCusId()));
    ?>
" method="POST" onsubmit="return false;">-->
                <!--<input type="submit" value="Submit" class="btn btn-primary pull-right btl top20" onclick="return openWin();">-->
                <?php 
    $params['type'] = 'finalPage';
    $this->renderPartial('//decorators/final', $params);
    ?>
                <!--             </form>-->
            </div>
        </div>
    </div>        
<?php 
}
?>
    

<script>
    function openWin() {
        var myWin = window.open('<?php 
echo createUrl('customer/feedback', array('id' => getCurCusId()));
?>
', '1408826148874', 'width=800,height=400,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=20%,top=10');
        myWin.focus();
        return false;
    }
</script>
 public function actionCustomerQuest()
 {
     DynamicCall::GetEdit1stPdf(getCurCusId());
     $customer_questions = $this->loadModel(getCurCusId());
     if (isset($_POST['customer']) && isset($_POST['customer']['ajax'])) {
         $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'] : "";
         $customer_questions['email'] = isset($_POST['customer']['email']) ? $_POST['customer']['email'] : "";
         $customer_questions['linked_in'] = isset($_POST['customer']['linked_in']) ? $_POST['customer']['linked_in'] : "";
         $customer_questions['competitor_id'] = isset($_POST['customer']['competitor_id']) ? $_POST['customer']['competitor_id'] : "";
         if ($customer_questions->save()) {
             $currentCustomerId = getCurCusId();
             if (!Yii::app()->session['edit_1st_pdf']) {
                 $cusApp = CustAppoint::model()->findByAttributes(array('cus_id' => getCurCusId(), 'app_id' => 1));
                 $cusApp->status = 1;
                 $time = time();
                 $cusApp->update_time = date("Y-m-d h:i:s", $time);
                 if ($cusApp->save()) {
                     $cusApp = new CustAppoint();
                     $cusApp->app_id = 2;
                     $cusApp->cus_id = getCurCusId();
                     $cusApp->status = 1;
                     $cusApp->save();
                 }
             }
             unset(Yii::app()->session['sel_prod']);
             $this->UpdateRemote($currentCustomerId);
             //exit;
         }
         echo json_encode(array('success' => 'true'));
         exit;
     }
     $time_range = range(7.3, 19.55, 0.05);
     $dd_time_range = array();
     foreach ($time_range as $range) {
         $decimalPart = (int) substr($range, strrpos($range, '.') + 1);
         if ($decimalPart <= 60) {
             $time = number_format((double) $range, 2, ':', '');
             $dd_time_range[$time] = $time;
         }
     }
     $peopleOnSite = array("0-5" => '0-5', "6-10" => '6-10', "11-20" => '11-20', "21-40" => '21-40', "41-100" => '41-100', "101-150" => '101-150', "151-200" => '151-200', "201-250" => '201-250', "251-300" => '251-300', "300+" => '300+');
     $competitor = JaspersCompetitor::model()->findAll(array("condition" => "competitor_oid = " . getCurCusDet('jaspers_franchise')));
     $email = getCurCusDet('email');
     $this->render('customer_quest', array('customer' => $customer_questions, 'time_range' => $dd_time_range, 'peopleOnSite' => $peopleOnSite, 'competitor' => $competitor, 'email' => $email));
 }
 public function actionServices()
 {
     $id = getCurCusId();
     if (isset($_POST['services']) && $_POST['services'] == 1) {
         if (isset($_POST['likeservices']) && $id) {
             Customer::model()->updateByPk($id, array('services' => CJSON::encode($_POST['likeservices'])));
         }
         $this->redirect(array('customer/Customerreply/' . $id));
         exit;
     }
     $this->customerData = Customer::model()->findByPk($id);
     $services = Services::model()->findAll('enable=:enable', array(':enable' => 1));
     $this->render('services', array('services' => $services, 'id' => $id));
 }
 public function actionAdminSolns1()
 {
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $curUser = Customer::model()->findByPk($id);
         if (empty($curUser->id)) {
             throw new CHttpException(403, 'Customer Does\'t exists');
         }
         Yii::app()->session['last_created_user'] = $curUser->attributes;
     }
     $cust = Customer::model()->findAll(array('condition' => 'id=:id ', 'params' => array(':id' => getCurCusId())));
     $selProd = SelProducts::model()->findAll(array("condition" => "cus_id =" . getCurCusId(), "order" => "product_id asc"));
     $selData = CHtml::listData($selProd, 'id', 'product_id');
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $selData);
     $selproducts = Product::model()->findAll($criteria);
     foreach ($cust as $k => $val) {
         $magicSpools = $val->magicSpools;
         $magicSpoolsAns = $val->magicSpoolsAns;
         $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) {
         $cust[0]->unable_to_commit = $_POST['final_comment'];
         $cust[0]->save();
         if (count($magicSpools)) {
             $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";
             //                p($_POST['magicspools']);
             //                exit;
             $mspoon->save();
         }
         if (isset($_POST['hotFoods'])) {
             if (isset($_POST['hotFoods']['ans'])) {
                 foreach ($_POST['hotFoods']['ans'] as $ans) {
                     //                        p($ans);
                     $model = HotFood::model()->findByPk(intval($ans['pro']));
                     $model->ans = $ans['comment'];
                     $model->menu_name = $ans['menuname'];
                     $model->price_per_head_f = $ans['price_per_head_pound'];
                     $model->whats_included = $ans['whats_included'];
                     if (isset($ans['like'])) {
                         $model->like = $ans['like'];
                     }
                     if (isset($ans['cus_comment'])) {
                         $model->comment = $ans['cus_comment'];
                     }
                     $model->save();
                 }
             }
         }
         if (isset($_POST['sandwiches'])) {
             if (isset($_POST['sandwiches']['ans'])) {
                 foreach ($_POST['sandwiches']['ans'] as $ans) {
                     $model = Sandwiches::model()->findByPk(intval($ans['pro']));
                     $model->ans = $ans['comment'];
                     $model->menu_name = $ans['menuname'];
                     $model->price_per_head_f = $ans['price_per_head_pound'];
                     $model->whats_included = $ans['whats_included'];
                     if (isset($ans['like'])) {
                         $model->like = $ans['like'];
                     }
                     if (isset($ans['cus_comment'])) {
                         $model->comment = $ans['cus_comment'];
                     }
                     $model->save();
                 }
             }
         }
         if (isset($_POST['breakfasts'])) {
             if (isset($_POST['breakfasts']['ans'])) {
                 foreach ($_POST['breakfasts']['ans'] as $ans) {
                     $model = Breakfast::model()->findByPk(intval($ans['pro']));
                     $model->ans = $ans['comment'];
                     $model->menu_name = $ans['menuname'];
                     $model->price_per_head_f = $ans['price_per_head_pound'];
                     $model->whats_included = $ans['whats_included'];
                     if (isset($ans['like'])) {
                         $model->like = $ans['like'];
                     }
                     if (isset($ans['cus_comment'])) {
                         $model->comment = $ans['cus_comment'];
                     }
                     //                        p($model->attributes);
                     $model->save();
                 }
             }
         }
         if (isset($_POST['indusFoods'])) {
             if (isset($_POST['indusFoods']['ans'])) {
                 foreach ($_POST['indusFoods']['ans'] as $ans) {
                     $model = IndusFood::model()->findByPk(intval($ans['pro']));
                     $model->ans = $ans['comment'];
                     $model->menu_name = $ans['menuname'];
                     $model->price_per_head_f = $ans['price_per_head_pound'];
                     $model->whats_included = $ans['whats_included'];
                     if (isset($ans['like'])) {
                         $model->like = $ans['like'];
                     }
                     if (isset($ans['cus_comment'])) {
                         $model->comment = $ans['cus_comment'];
                     }
                     $model->save();
                 }
             }
         }
         if (isset($_POST['lunch'])) {
             if (isset($_POST['lunch']['ans'])) {
                 foreach ($_POST['lunch']['ans'] as $ans) {
                     $model = Lunch::model()->findByPk(intval($ans['pro']));
                     $model->ans = $ans['comment'];
                     $model->menu_name = $ans['menuname'];
                     $model->price_per_head_f = $ans['price_per_head_pound'];
                     $model->whats_included = $ans['whats_included'];
                     if (isset($ans['like'])) {
                         $model->like = $ans['like'];
                     }
                     if (isset($ans['cus_comment'])) {
                         $model->comment = $ans['cus_comment'];
                     }
                     //                        p($model->attributes);
                     $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();
             //                }
             if (isset($_POST['sundries']['ans'])) {
                 foreach ($_POST['sundries']['ans'] as $ans) {
                     $model = Sundries::model()->findByPk(intval($ans['pro']));
                     $model->ans = $ans['comment'];
                     $model->menu_name = $ans['menuname'];
                     $model->price_per_head_f = $ans['price_per_head_pound'];
                     $model->whats_included = $ans['whats_included'];
                     if (isset($ans['like'])) {
                         $model->like = $ans['like'];
                     }
                     if (isset($ans['cus_comment'])) {
                         $model->comment = $ans['cus_comment'];
                     }
                     $model->save();
                 }
             }
         }
         if (isset($_POST['selproduct']['ans'])) {
             foreach ($_POST['selproduct']['ans'] as $ans) {
                 $selProd = SelProducts::model()->findByPk($ans['pro']);
                 if ($selProd) {
                     $selProd->menu_name = $ans['menuname'];
                     $selProd->price_per_head_f = $ans['price_per_head_pound'];
                     $selProd->ans = $ans['comment'];
                     $selProd->whats_included = $ans['whats_included'];
                     $selProd->save();
                 }
             }
         }
         if (isset($_POST['selprod'])) {
             foreach ($_POST['selprod'] as $comment) {
                 $selProd = SelProducts::model()->findByPk(intval($comment['id']));
                 $selProd->comment = $comment['comment'];
                 $selProd->like = $comment['like'];
                 $selProd->save();
             }
         }
         echo json_encode(array('success' => '1'));
         exit;
     }
     $lunch_note = "";
     $breakfast_note = "";
     $sandwiches_note = "";
     $hotfood_note = "";
     $indusfood_note = "";
     $sundries_note = "";
     //        e($notes);
     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_pdf', array('customer' => $cust, 'magic_spools' => $magicSpools, 'magicSpoolsAns' => $magicSpoolsAns, '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, 'selproducts' => $selproducts, 'selproductsComment' => $selProd));
 }
 public static function GetEdit1stPdf($id)
 {
     if (getCurCusId() !== Yii::app()->session['edit_1st_pdf']) {
         unset(Yii::app()->session['edit_1st_pdf']);
     }
 }
                                   // var patt = /[a-z0-9._]+@+[a-z0-9]+[.]+[a-zA-z]/;
                                    var patt = /^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;
                                    var res = patt.test(emailid);
                                    if(!res)    {
                                        alert("Please Enter a Valid Email Id");
                                        return false;
                                    }
                             }
                        }', 'data' => array('customer' => array("ajax" => '1', 'earliest_timedelivery' => 'js:$("#earliest_timedelivery option:selected").val()', 'more_companies' => 'js:getVal("more_companies")', 'no_people' => 'js:$("#no_people option:selected").val()', 'competitor_id' => 'js:$("#competitor_id option:selected").val()', 'company_order' => 'js:getVal("company_order")', 'avg_attend' => 'js:getVal("avg_attend")', 'email' => 'js:getVal("email")', 'facebook' => 'js:getVal("facebook")', 'twitter' => 'js:getVal("twitter")', 'google' => 'js:getVal("google")', 'linked_in' => 'js:getVal("linked_in")')), 'success' => 'function(html){
                        console.log(html); 
                        location.href="' . createUrl('site/thanks') . '";
                        }'), array('class' => 'btn btn-primary btm pull-right'));
if (Yii::app()->session['edit_1st_pdf']) {
    CHtml::ajaxButton('Submit & Preview', array('customer/CustomerQuest'), array('type' => 'POST', 'dataType' => 'json', 'data' => array('customer' => array("ajax" => '1', 'earliest_timedelivery' => 'js:getVal("earliest_timedelivery")', 'more_companies' => 'js:getVal("more_companies")', 'no_people' => 'js:getVal("no_people")', 'present_carters' => 'js:getVal("present_carters")', 'company_order' => 'js:getVal("company_order")', 'avg_attend' => 'js:getVal("avg_attend")', 'email' => 'js:getVal("email")', 'facebook' => 'js:getVal("facebook")', 'twitter' => 'js:getVal("twitter")', 'google' => 'js:getVal("google")', 'linked_in' => 'js:getVal("linked_in")')), 'success' => 'function(html){
                        console.log(html); 
                        location.href="' . createUrl('site/sendpdf1st', array('id' => getCurCusId())) . '";
                        }'), array('class' => 'btn btn-primary bts pull-right right10'));
}
?>
                <script type="text/javascript">
                    function getVal(fld)
                    {
                        var value = $("input:text[name=" + fld + "]").val();
                        return value;

                    }
                </script>
            </div>
        </div>
    </div>
</div>
 public function actionCustomerQuest()
 {
     DynamicCall::GetEdit1stPdf(getCurCusId());
     $customer_questions = $this->loadModel(getCurCusId());
     if (isset($_POST['customer']) && isset($_POST['customer']['ajax'])) {
         $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'] : "";
         $customer_questions['email'] = isset($_POST['customer']['email']) ? $_POST['customer']['email'] : "";
         $customer_questions['linked_in'] = isset($_POST['customer']['linked_in']) ? $_POST['customer']['linked_in'] : "";
         //            p($_REQUEST);
         //            p($customer_questions->attributes);
         if ($customer_questions->save()) {
             if (!Yii::app()->session['edit_1st_pdf']) {
                 $cusApp = CustAppoint::model()->findByAttributes(array('cus_id' => getCurCusId(), 'app_id' => 1));
                 $cusApp->status = 1;
                 $time = time();
                 $cusApp->update_time = date("Y-m-d h:i:s", $time);
                 if ($cusApp->save()) {
                     $cusApp = new CustAppoint();
                     $cusApp->app_id = 2;
                     $cusApp->cus_id = getCurCusId();
                     $cusApp->status = 1;
                     $cusApp->save();
                 }
             }
             unset(Yii::app()->session['sel_prod']);
         }
         echo json_encode(array('success' => 'true'));
         exit;
     }
     $this->render('customer_quest', array('customer' => $customer_questions));
 }
 public function actionOptionsEditView()
 {
     $customer = Customer::model()->findByPk(getCurCusId());
     if (isset($_POST['option'])) {
         $cus = Customer::Model()->findByPk(getCurCusId());
         $cus->option_id = $_POST['option'];
         $cus->save();
         $this->redirect(array('site/index'));
     }
     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");
     }
     $criteria = new CDbCriteria();
     $criteria->compare('franchise', Yii::app()->user->franchise);
     $customers = Customer::model()->findAll($criteria);
     $customerlist = CHtml::listData($customers, 'id', 'name');
     $this->render("optioneditviews", array('model' => $model, 'customers' => $customerlist, 'id' => $customer->option_id));
 }
                        <div class="col-lg-9">
                            <?php 
echo CHtml::textArea("email", "", array("placeholder" => "", "class" => "textbox1", "style" => "height:10px"));
?>
                        </div>
                    </div>        
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12 top30">
                <?php 
// echo CHtml::submitButton('Submit', array('class' => 'button1'));
?>
                <?php 
echo CHtml::ajaxButton($text = 'Submit', $url = createUrl('customer/feedback', array('id' => getCurCusId())), $ajaxOptions = array('type' => 'POST', 'dataType' => 'json', 'success' => 'formSaved()', 'data' => 'js:{
                    email:document.getElementById("email").value,
//                    calldate:document.getElementById("Customer_call_date").value,
//                    opportunity_given:document.getElementById("opportunity_given").value,
                    yt0:1,
                    }'), array('class' => 'btn btn-primary pull-right bts'));
?>

                <?php 
echo CHtml::endForm();
?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
<div class="container-fluid loginback2">
    <div class="container">
        <div class="row top_pad" style="padding-top: 300px ">
            <div class="col-md-8 col-md-offset-2">
                <div class="loginform">
                    <form role="form">
                        <fieldset>
                            <?php 
$url = createUrl('site/CallAdmin', array('id' => getCurCusId()));
if (isset($_GET['tempAdmin']) && $_GET['tempAdmin'] == 1) {
    $url = createUrl('site/CallAdmin', array('id' => getCurCusId(), 'tempAdmin' => 1));
}
?>
                            <div class="form-group">
                                <p style="font-size:24px;text-align:center;color:#71BE44;">Welcome To Your Jaspers</p>
                            </div>
                            <div class="checkbox">
                            </div>
                            <div class="form-group">
                                <a href="<?php 
echo $url;
?>
" class="btn btn-sm btn-success bts pull-right">Start</a>
                                <a href="<?php 
echo createUrl('site/index');
?>
" class="btn btn-sm btn-success bts pull-left">Back</a>                                
                            </div>
                        </fieldset>
                    </form>
                </div>
 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));
 }
Example #18
0
                        </div>
                    </div>-->


                </fieldset>
            </div><!-- form -->
        </div>
        <div class="col-lg-10 col-lg-offset-1">
            <div class="btn_mar pull-right">
                <?php 
echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Submit', array('class' => 'btn btn-primary new btl'));
?>
            </div>
            <div class="pull-left top15">
                <a href="<?php 
echo createUrl('site/menu', array('id' => getCurCusId()));
?>
" class="btn btn-primary btl">Back</a> 
            </div>
            <div class="pull-right note">
                <?php 
//                $params['model'] = 'sandwiches';
//                $this->renderPartial('//layouts/notes', array('params' => $params));
$this->renderPartial('//layouts/notes', array('model' => $model));
?>
                <?php 
$this->endWidget();
?>
            </div>
        </div>
    </div>
Example #19
0
<?php

$sess_lunch = 'lunch' . getCurCusId();
$sess_break = 'breakfast' . getCurCusId();
$sess_hotfd = 'hot_food' . getCurCusId();
$sess_sandw = 'sandwiches' . getCurCusId();
$sess_sundr = 'sundries' . getCurCusId();
$sess_indus = 'indus_food' . getCurCusId();
$js = "\n    var lunch = " . count(Yii::app()->session[$sess_lunch]) . ";\n    var breakfast = " . count(Yii::app()->session[$sess_break]) . ";\n    var hotfood = " . count(Yii::app()->session[$sess_hotfd]) . ";\n    var sandwich = " . count(Yii::app()->session[$sess_sandw]) . ";\n    var sundries = " . count(Yii::app()->session[$sess_sundr]) . ";\n    var indfood = " . count(Yii::app()->session[$sess_indus]) . ";\n    document.getElementById('lunch').innerHTML = lunch;\n    document.getElementById('breakfast').innerHTML = breakfast;\n    document.getElementById('hotfood').innerHTML = hotfood;\n    document.getElementById('sandwich').innerHTML = sandwich;\n    document.getElementById('sundries').innerHTML = sundries;\n    document.getElementById('indfood').innerHTML = indfood;    \n";
Yii::app()->clientScript->registerScript('menu', $js, CClientScript::POS_END);
//Yii::app()->clientScript->registerScriptFile(getThemeUrl() . '/js/menu.js');
?>
<link rel="stylesheet" href="<?php 
echo getThemeUrl();
?>
/css/style6.css">
<div class="container">
    <div class="container-fluid">
        <div class="content_outer">
            <div class="content_inner">
                <div class="content">
                    <h3>What Other Menus / Items do you currently Have?</h3>
                    <table>
                        <tr>
                            <td>Lunch Menus</td>
                            <td><a href="<?php 
echo createUrl('lunch/create');
?>
"><img src="<?php 
echo getThemeUrl() . '/';
?>