<?php

 Yii::app()->setLanguage(isset(Yii::app()->session['lang']) ? Yii::app()->session['lang'] : 'ar'); 
 $lang=Yii::app()->getLanguage();
 

?>

<?php
if($model->hasErrors()){
  echo CHtml::errorSummary($model);
}
?>
 
<section class="suggestions">
    <section class="suggestions-section1">
        <div class="container">
		 <div class="row">
                <div class="col-sm-offset-1 col-sm-10 col-xs-offset-0 col-xs-12">
                 
                </div>
            </div>
           <div class="row">
               <div class="col-sm-offset-0 col-sm-12 col-lg-offset-1 col-lg-10 col-xs-12 col-xs-offset-0">
               <div class="suggestions-text-style">
                <?php 
                if($lang=='ar'){
                echo '
                   رغبة منا في تقديم أعلى مستوى من خدمة الزبائن و سعياً لضمان رضاكم، فإننا نرجو توضيح شكواكم أو مقترحكم بكامل التفاصيل لكي يتم التعامل معها في أسرع وقت و العمل
على إيجاد الحل المناسب. علماً أنه من الممكن ان يقوم القسم المختص بالاتصال بكم لاستكمال المزيد من المعلومات حول الموضوع في حال لزم الأمر.
و يجدر التنويه أن جميع الشكاوى المقدمة إلى بنك البركة سورية تحظى بأعلى درجة من السرية و الخصوصية و ذلك من خلال القسم المختص.
               
               ';
                }else{
                  echo 'In order to provide the highest level of customer service and in order to ensure your satisfaction, we hope to clarify your complaint or your proposal in full details to be dealt with as soon as possible and to find the right solution. Note that it is possible for the department to contact you to complete further information on the subject if necessary. It should be noted that all complaints submitted to Al Baraka Bank of Syria enjoy the highest degree of confidentiality and privacy through the concerned department.';
                }
               ?>
               </div>
               </div>
            </div>
            <div class="row">
                <div class="col-sm-offset-0 col-sm-12 col-lg-offset-1 col-lg-10 col-xs-12 col-xs-offset-0">
                    <div class="row suggestion-container">
                       <!--start form-->
                       
                      <?php $form=$this->beginWidget('booster.widgets.TbActiveForm',array(
                            'id'=>'suggestions-form',
                            'enableAjaxValidation'=>false,
                        )); ?>

                        <div class="col-sm-6 col-xs-12 form-group">
                          <div class="row">
                              <div class="col-sm-4 col-xs-12"> 
                              <div class="row-item">
                                  <label class="lable-style" for="FullName"><?php echo Yii::t('suggestion','name');?> * :</label> 
                              </div>  
                            </div> 
                             <div class="col-sm-8 col-xs-12">
                             <?php echo $form->textField($model,'name',array('required' => true,'oninvalid' => 'this.setCustomValidity("'.($lang=='ar'?'الرجاء ملئ الحقل':'Please fill out this field').'")','oninput'=>"setCustomValidity('')",
                             'title'=>''.($lang=='ar'?'الرجاء ملئ الحقل':'Please fill out this field').'','pattern'=>'[^0-9]*','class'=>'form-control','id'=>'Suggestions_name')) ?>
                              <?php echo $form->error($model,'name'); ?>

                            </div> 
                          </div> 
                            <div class="row">
                                <div class="col-sm-4 col-xs-12">  
                                <div class="row-item">
                              <label class="lable-style" for="typeOfDeal"><?php echo Yii::t('suggestion','type');?> :</label> 
                                    </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                             <?php 
                             if($lang=='ar'){
                             echo $form->dropdownList($model,'type',array(
                                 ''=>'يرجى الاختيار',
                             
                             'غير متعامل'=>'غير متعامل', 
                             'متعامل'=>'متعامل'
                             ),array('options'=>array(''=>array('selected'=>true,'disabled' => true,'hidden'=>true)),'class'=>'form-control','id'=>'Suggestions_type'));
                             }else{
                              echo $form->dropdownList($model,'type',array(
                            ''=>'Please select', 
                            'client'=>'client',
                            'not client'=>'not client',
                             ),array('options'=>array(''=>array('selected'=>true,'disabled' => true,'hidden'=>true)),'class'=>'form-control','id'=>'Suggestions_type'));
                             }
                              ?>
                                <?php echo $form->error($model,'type'); ?>
                            </div> 
                            </div>
                            <div class="row">
                             <div class="col-sm-4 col-xs-12"> 
                             <div class="row-item"> 
                              <label class="lable-style" for="phoneNumbere"><?php echo Yii::t('suggestion','phone');?> :</label> 
                                 </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                              <?php echo $form->textField($model,'phone',array('class'=>'form-control','id'=>'Suggestions_phone')) ?>
                              <?php echo $form->error($model,'phone'); ?>
                            </div> 
                            </div>
                        </div>
                        <div class="col-sm-6 col-xs-12 form-group">
                          <div class="row">
                              <div class="col-sm-4 col-xs-12">  
                              <div class="row-item">
                              <label class="lable-style" for="mobileNumbere"><?php echo Yii::t('suggestion','mobile');?>
                              * : </label> 
                                  </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                             <?php echo $form->textField($model,'mobile',array('required' => true,'title'=>''.($lang=='ar'?'الرجاء ملئ الحقل':'Please fill out this field').'', 
                             'oninvalid' => 'this.setCustomValidity("'.($lang=='en'?'Mobile number is wrong':'رقم الموبايل خطأ').'")'
                             ,'oninput'=>"setCustomValidity('')",
                             'class'=>'form-control','id'=>'Suggestions_mobile','pattern'=>'^(([\+]?\d{1,5}[- ]?)?(\d{10}|\d{9}))$|(\d{14})')) ?>
                              <?php echo $form->error($model,'mobile'); ?>
                             
                            </div> 
                          </div>
                           <div class="row">
                              <div class="col-sm-4 col-xs-12">  
                              <div class="row-item">
                              <label class="lable-style" for="Email"><?php echo Yii::t('suggestion','mail');?>
                                :</label> 
                                  </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                             <?php echo $form->textField($model,'mail',array('class'=>'form-control','id'=>'Suggestions_mail')) ?>
                              <?php echo $form->error($model,'mail'); ?>
                              
                            </div>  
                           </div>
                           <div class="row">
                              <div class="col-sm-4 col-xs-12">
                              <div class="row-item">  
                              <label class="lable-style" for="callingTime"><?php echo Yii::t('suggestion','call_time');?> :</label> 
                                  </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                             <?php 
                             if($lang=='ar'){
                             echo $form->dropdownList($model,'call_time',array(
                             ''=>'يرجى الاختيار', 
                             '9-11 صباحاً'=>'9-11 صباحاً', 
                             '12-2 ظهراً'=>'12-2 ظهراً',
                             '3-5 مساءاً'=>'3-5 مساءاً')
                             ,array('options'=>array(''=>array('selected'=>true,'disabled' => true,'hidden'=>true)),'class'=>'form-control','id'=>'Suggestions_call_time')); 
                             }else{
                               echo $form->dropdownList($model,'call_time',array(
                             ''=>'Please select',
                             '9-11 am'=>'9-11 am', 
                             '12-2 pm'=>'12-2 pm',
                             '3-5 pm'=>'3-5 pm',
                             )
                             ,array('options'=>array(''=>array('selected'=>true,'disabled' => true,'hidden'=>true)),'class'=>'form-control','id'=>'Suggestions_call_time'));
                             }
                             ?>
                          <?php echo $form->error($model,'call_time'); ?>
                            </div>  
                           </div>
                        </div>  
                        <div class="col-sm-12 col-xs-12">
                            <div class="suggestion-head-line"><?php echo Yii::t('suggestion','detail');?>
                                <!--تفاصيل المقترح أو الشكوى -->
                            </div>
                        </div> 
                        <div class="col-sm-6 col-xs-12 form-group">
                            <div class="row">
                           <div class="col-sm-4 col-xs-12">  
                             <div class="row-item">
                              <label class="lable-style" for="NoteDate"><?php echo Yii::t('suggestion','date');?>
                              * : </label> 
                               </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">


                              <input type="date" name="Suggestions[note_date]", 
                              title="<?php echo($lang=='ar'?'الرجاء ملئ الحقل':'Please fill out this field'); ?>", 
                              <?php 
                              if($lang=='ar'){
                                ?>
                              oninvalid ='this.setCustomValidity("الرجاء ملئ الحقل")',
                              <?php }else{?>
                                  oninvalid ='this.setCustomValidity("Please fill out this field")',
                              <?php }   ?>
                             oninput="setCustomValidity('')",
                              class="unstyled form-control" id="NoteDate" required = "required", max="<?php echo date("Y-m-d"); ?>" >  
                            </div> 
                             </div> 
                             <div class="row">
                            <div class="col-sm-4 col-xs-12"> 
                             <div class="row-item"> 
                              <label class="lable-style" for="Place"><?php echo Yii::t('suggestion','place');?>
                              * :</label> 
                                </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                              <?php
                                
                                  if($lang=='ar'){
                                      $branchs=CHtml::listData(Branch::model()->findAll(),'name_ar' ,'name_ar');
                                  }else{
                                    $branchs=CHtml::listData(Branch::model()->findAll(),'name_en' ,'name_en');
                                  }
                                
                                  $tempArr['']=$lang=='ar'?'يرجى الاختيار':'Please select';
                                  $branchs= $tempArr+ $branchs;
                                      echo $form->dropDownList($model,'place',$branchs,array(
                                            'required' => true,
                                            'title'=>''.($lang=='ar'?'يرجى الاختيار':'Please select').'',
                                            'oninvalid' =>''.($lang=='ar'?'this.setCustomValidity("الرجاء ملئ الحقل")':'this.setCustomValidity("Please fill out this field")').'',
                                            'oninput'=>'setCustomValidity("")',
                                            'options'=>array(''=>array('selected'=>true,'disabled' => true,'hidden'=>true)),
                                            'class'=>'form-control',
                                            'id'=>'Suggestions_place'
                                            )
                                        );
                               ?>
                               <?php echo $form->error($model,'place'); ?>
                            </div> 
                             </div>
                             <div class="row">
                                <div class="col-sm-4 col-xs-12">  
                                <div class="row-item">
                              <label class="lable-style" for="messageAddres"><?php echo Yii::t('suggestion','relate');?>
                               :</label> 
                                    </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">


                                 <?php
                                
                                  if($lang=='ar'){
                                      $related=CHtml::listData(Related::model()->findAll(),'id' ,'name_ar');
                                  }else{
                                    $related=CHtml::listData(Related::model()->findAll(),'id' ,'name_en');
                                  }
                                  $tempArrr['']=$lang=='ar'?'يرجى الاختيار':'Please select';
                                  $related= $tempArrr+ $related;
                                      echo $form->dropDownList($model,'relat',$related,array(
                                      'title'=>''.($lang=='ar'?'يرجى الاختيار':'Please select').'',
                                      'options'=>array(''=>array('selected'=>true,'disabled' => true,'hidden'=>true)),
                                      'class'=>'form-control',
                                      'id'=>'Suggestions_relat'
                                      )
                                        );
                               ?>
                               <?php echo $form->error($model,'relat'); ?>


                            </div> 
                            </div>

                            <div class="row" id="other_operation_name">
                                <div class="col-sm-4 col-xs-12">  
                                <div class="row-item">
                              <label class="lable-style" for="messageAddres"><?php echo Yii::t('suggestion','other_operation_name');?>
                               :</label> 
                                    </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                             <?php echo $form->textField($model,'other_operation_name',array(
                                 'title'=>''.($lang=='ar'?'الرجاء ملئ الحقل':'Please fill out this field').'',
                                 'class'=>'form-control',
                                 'id'=>'Suggestions_other_operation_name'
                                 )) ?>
                              <?php echo $form->error($model,'other_operation_name'); ?> 
                             <?php echo $form->error($model,'relat'); ?>
                            </div> 
                            </div>
                     
                        </div>
                         <div class="col-sm-6 col-xs-12 form-group">
                          <div class="row">
                           <div class="col-sm-4 col-xs-12"> 
                             <div class="row-item">
                                 <label class="lable-style" for="message"><?php echo Yii::t('suggestion','message');?>
                                 * :</label> 
                                 </div>
                            </div>
                             <div class="col-sm-8 col-xs-12"> 
                             <?php echo $form->textarea($model,'message',array(
                                 'required' => true,
                                 'title'=>''.($lang=='ar'?'الرجاء ملئ الحقل':'Please fill out this field').'', 
                                 'oninvalid' =>''.($lang=='ar'?'this.setCustomValidity("الرجاء ملئ الحقل")':'this.setCustomValidity("Please fill out this field")').'',
                                 'oninput'=>'setCustomValidity("")',
                                 'class'=>'form-control','id'=>'Suggestions_message','rows' => '4')) ?>
                            <?php echo $form->error($model,'message'); ?>
                            </div> 
                            </div> 
                            <br >
                            <div class="row">
                              <div class="col-sm-4 col-xs-12"> 
                              <div class="row-item">
                              	<label class="lable-style" for="message"><?php echo Yii::t('suggestion','verifyCode');?>
                                  * :</label>                              
                                  </div>
                            </div>
                             <div class="col-sm-8 col-xs-12">
                             <div class="text-center"> 
                                 <div class="recaptcha-container">  
                             <?php
                                  $this->widget('CCaptcha', array('buttonOptions' => array('style' => 'display:block'))); 
                                
                                 echo $form->textField($model,'verifyCode',array(
                                     'required' => true,
                                     'oninvalid' =>''.($lang=='ar'?'this.setCustomValidity("الرجاء ملئ الحقل")':'this.setCustomValidity("Please fill out this field")').'',
                                     'oninput'=>'setCustomValidity("")',
                                     'class'=>'form-control',
                                     'autocomplete'=>'off'
                                     ));
                                 echo CHtml::error($model,'verifyCode'); 
                              ?>
                               </div>
                             </div>
                            </div>   
                            </div>
                        </div> 
                         <div class="col-sm-12 col-xs-12">
                           <input type="submit" name="submit" class="btn center-block" id="suggestion-btn" value=<?php echo($lang=='ar'?'ارسال':'send');?> >
                         </div>  
    
                       <?php $this->endWidget(); ?>
                        
                        <!-- Modal -->
                        <div id="myModal" class="modal fade" role="dialog">
                                <div class="modal-dialog">
                                     <!--Modal content-->
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button"   class="close" data-dismiss="modal">&times;</button> 
                                        </div>
                                        <div class="modal-body" id="getCode">
                                        </div>
                                        <div class="modal-footer">
                                            <button type="button"   class="btn btn-default" data-dismiss="modal"><?php echo($lang=='ar'?'اغلاق':'Close') ?></button>
                                        </div>
                                    </div> 
                                </div> 
                            </div>
                    </div> 
                </div>
            </div>
        </div>
    </section>
</section> 
<script  type="application/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/site/scriptSuggestion"></script>
<script> 

//  $("#other_operation_name").hide();
        // $("#other_operation_name").css("display", "none");
        // $(document).ready(function(){
            
        //     var re=$("#Suggestions_relat").find(":selected").val();
        //     $('#Suggestions_relat').on('change', function() {
        //         var re=this.value ;
        //         if(re==5){
                    
        //           $("#other_operation_name").css("display", "block");
        //           $('#Suggestions_other_operation_name').css("display", "block");
        //           $('#Suggestions_other_operation_name').prop('required',true);

        //         }else{
        //             //  $("#other_operation_name").hide();
        //             $("#other_operation_name").css("display", "none");
        //             $('#Suggestions_other_operation_name').css("display", "none");
        //             $('#Suggestions_other_operation_name').prop('required',false); 
        //         }
        // //   alert( re );
        // });

        //     $("#suggestions-form").submit( function(e){
        //         e.preventDefault();
        //         $.ajax({
        //             type:"POST",
        //             url: "<?php //echo CController::createUrl('suggestion') ?>",
        //             data: $("#suggestions-form").serialize(),
        //             dataType: "json",
        //             success: function(response){
        //                 if(response.status=="sucsess"){
        //                 $(".modal-body").html(response.msg);
        //                 $("#myModal").modal('show');
        //                 $( "button" ).click(function() {
        //                     location.reload();
        //                     });
        //                     // $( "button" ).location.reload();
                            
        //                 }else if(response.status=="error"){
        //                       $(".modal-body").html(response.msg);
        //                 $("#myModal").modal('show');

        //                 }
        //             },
        //             error: function (data) {
        //             console.log('An error occurred.');
        //             console.log(data);
        //             },
        //         });
        //     }); 
        // });
</script>


