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

<section class="calculator">
    <section class="calculator-section1" >
        <div class="container">
           <div class="row">  
                   <div class="col-sm-offset-1 col-sm-2 col-xs-12">
                     <div class="row"> 
                      <ul class="nav nav-pills main-nav  ">
                      <?php 
                       $param=$_GET['active']; 
                      ?>
                        <li <?php if($param==2){echo 'class="active"'; } ?>><a data-toggle="pill" href="#menu1">
                            <img class="icon-calculator img-responsive center-block" src="<?php echo Yii::app()->request->baseUrl?>/images/financial-icon-1.png">
                            <div class="calculator-head">
                            <?php echo Yii::t('calculator','calculation_profits');?>
                            <?php //echo($lang=='en'?'Calculation of earnings share':'احتساب حصة الأرباح')  ?>
                                
                            </div>
                            </a></li>
                        <li <?php if($param==1){echo 'class="active"'; } ?>><a data-toggle="pill" href="#menu2"> 
                        <img class="icon-calculator img-responsive center-block" src="<?php echo Yii::app()->request->baseUrl?>/images/financial-icon-2.png">
                            <div class="calculator-head">
                            <?php echo Yii::t('calculator','calculation_finance');?>
                            <?php //echo ($lang=='en'?'Calculation of finance':'حساب التمويل')  ?>
                                
                            </div>
                        </a></li> 
                      </ul>  
                    </div></div>
                   <div class="col-sm-8 col-xs-12 z-index-1">
                       <div class="row">
                       <div class="tab-content">
                        <div id="menu1" <?php echo ($param==2?'class="tab-pane fade in active"':'class="tab-pane fade"')?>>
                            <!--form-->
                           <form id="myForm" >
                           <div class="sub-nav-tab">
                             <ul class="nav nav-tabs">
                            <li class="active">
                            <a data-toggle="tab" href="#profit">
                            <?php echo Yii::t('calculator','profits');?>
                            <!--حساب الأرباح-->
                            </a>
                            </li>
                            <li>
                            <a data-toggle="tab" href="#profit2">
                            <?php echo Yii::t('calculator','monthly_income_deposit_account');?>
                            <!--حساب وديعة الدخل الشهري-->
                            </a>
                            </li>
                              </ul>
                           </div>
                           <div class="tab-content tab-sub">
                           <div id="profit" class="tab-pane fade in active tab-1-menu-profit">
                          <div class="col-xs-12 menu1-second-part-form ">
                                <div class="row second-option-content">  
                                 <div class="option-content">
                                   <div class="Option-text">
                                   <?php echo Yii::t('calculator','duration');?>:
                                    <!--المدة:-->
                                </div> 
                                    </div> 
                                        <div class="option-content">
                                          <div class="radio center-block">
                                          <label class="container-lable duration">
                                          <input type="radio" id="duration1" name="duration" value="1">
                                           <span class="checkmark"></span> 
                                           <span class="lable-text">
                                           <?php echo Yii::t('calculator','month');?>
                                               <!--شهر -->
                                          </span> 
                                          </label>
                                         </div>  
                                        </div>
                                        <div class="option-content">
                                         <div class="radio center-block">
                                          <label class="container-lable duration">
                                          <input type="radio" id="duration2" name="duration" value="3">
                                           <span class="checkmark"></span> 
                                           <span class="lable-text">
                                           <?php echo Yii::t('calculator','3month');?>
                                               <!--3 أشهر -->
                                          </span> 
                                          </label>
                                        </div>
                                        </div>
                                        <div class="option-content">
                                          <div class="radio center-block">
                                          <label class="container-lable duration">
                                          <input type="radio" id="duration3" name="duration" value="6">
                                           <span class="checkmark"></span> 
                                           <span class="lable-text">
                                           <?php echo Yii::t('calculator','6month');?>
                                               <!--6 أشهر -->
                                          </span> 
                                          </label>
                                        </div>   
                                        </div>
                                        <div class="option-content">
                                            <div class="radio center-block">
                                              <label class="container-lable duration">
                                              <input type="radio" id="duration4" name="duration" value="12">
                                               <span class="checkmark"></span> 
                                               <span class="lable-text">
                                               <?php echo Yii::t('calculator','12month');?>
                                                <!--12 شهراً -->
                                              </span> 
                                              </label>
                                            </div> 
                                        </div>
                                        <div class="option-content">
                                           <div class="radio center-block">
                                          <label class="container-lable duration">
                                          <input type="radio" id="duration5" name="duration" value="24">
                                           <span class="checkmark"></span> 
                                           <span class="lable-text">
                                           <?php echo Yii::t('calculator','24month');?>
                                               <!--24 شهراً-->
                                          </span> 
                                          </label>
                                        </div>  
                                        </div>
                                        </div>
                                    </div> 
                            <div class="col-xs-12 menu1-third-part-form">
                                 
                                  <div class="third-part-content">
                                   <div class="col-sm-4 col-xs-12">
                                    <div class="form-group row">
                                    <label for="amount">
                                    <?php echo Yii::t('calculator','amount');?>
                                    <!--المبلغ-->
                                    </label>
                                    <!-- <input type="number" onkeypress="preventNonNumericalInput(event)"  min="1" name="amount" class="form-control" id="amountmenu1"  > -->
                                    <input  type="number" step="0.01"    name="amount" class="form-control" id="amountmenu1" 
                                      onkeypress="return (event.charCode >= 48 && event.charCode <= 57) ||  
   event.charCode == 46 || event.charCode == 0 ">
                                    </div> 
                                   </div>
                                   <div class="col-sm-4 col-xs-12">
                                     <div class="form-group row">
                                    <label for="currency">
                                    <?php echo Yii::t('calculator','currency');?>
                                    <!--العملة-->
                                    </label>
                                    <select class="form-control" name="currency" id="currencymenu1">
                                        <?php 
                                        $currencies=CalculatorAverageProfitRate::model()->findAll();
                                        $i=1;
				                        foreach($currencies as $currency){
                                        echo '
                                        <option value="'.($lang=='ar'?$currency->calculator_currency:$currency->calculator_currency_en).'">'.($lang=='ar'?$currency->calculator_currency:$currency->calculator_currency_en).'</option>
                                        ';
                                       $i++; }
                                        
                                        ?> 
                                      </select>
                                    </div>   
                                   </div>
                                   <div class="col-sm-4 col-xs-12">
                                        <div class="form-group row">

                                    <label for="amount">
                                    <?php echo Yii::t('calculator','date');?>
                                    <!--تاريخ-->
                                    </label> 
                                   <input type="date" name="date" class="form-control" id="date" required> 
                                        </div> 
                                   </div> 
                                </div>
                               
                            </div>
                            <div class="col-xs-12 menu1-fourth-part-form">
                              <button type="button" id="earningsResult" class="center-block btn-menu1">
                              <?php echo Yii::t('calculator','result');?>
                              <!--احسب الآن-->
                              </button>
                            </div>
                            <div id="results"></div>
                             <div class="col-xs-12 menu1-fifth-part-form"> 
                                     <div class="col-sm-12">
                                     <div class="text-tab-head">
                                     <?php echo Yii::t('calculator','calculationResult');?>
                                         <!--نتيجة الحساب-->
                                     </div>
                                      </div> 
                                   <div class="col-sm-8 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','profit_expected_for');?>
                                     <span  id="total_profit"> 
                                     </span>
                                     <span class="two-percent-padding" id="currency_result"> 
                                       </span>  
                                     </div>
                                       <div id="note">
                                       </div>
                                       <br> 
                                   </div> 
                             </div>
                             </div>
                             <!-------------------------------------------------->
                             <div id="profit2" class="tab-pane fade tab-2-menu-profit"> 
                             <div class="col-xs-12 menu1-first-part-form two-percent-padding">
                             <div class="dark-red-color2">
                             <h3>
                             <?php echo Yii::t('calculator','calculating_the_monthly_deposit');?>
                            <!--آلية حساب وديعة الدخل الشهري-->
                             </h3>
                              </div>
                             </div>
                             <div class="col-xs-12 menu1-third-part-form">
                             <div class="third-part-content">
                                <div class="col-sm-4 col-xs-12">
                                   <div class="form-group row">
                                       <label for="amount">
                                        <?php echo Yii::t('calculator','amount');?>
                                        <!--المبلغ-->
                                       </label>
                                       <!-- <input type="number" onkeypress="preventNonNumericalInput(event)" min="1" name="amount" class="form-control" id="depositAmount">  -->
                                       <input type="number"  step="0.01"  min="250000" name="amount" class="form-control" id="depositAmount"
                                       onkeypress="return (event.charCode >= 48 && event.charCode <= 57) ||  
   event.charCode == 46 || event.charCode == 0 ">
                                   
                                       
                                   </div> 
                                </div> 
                                <div class="col-sm-4 col-xs-12">
                                  <div class="form-group row">
                                    <label for="currency">
                                    <?php echo Yii::t('calculator','duration');?>
                                    <!--المدة-->
                                    </label>
                                    <select class="form-control" name="currency" id="depositDuration">
                                        <option value="0"> </option>
                                        <option value="6"><?php echo Yii::t('calculator','6month');?></option>
                                        <option value="12"><?php echo Yii::t('calculator','12month');?></option>
                                        <option value="24"><?php echo Yii::t('calculator','24month');?></option> 
                                      </select>  
                                  </div>
                                </div>
                                <div class="col-sm-4 col-xs-12">
                                  <div class="form-group row">
                                   <label for="amount">
                                    <?php echo Yii::t('calculator','date');?>
                                    <!--تاريخ-->
                                    </label>
                                    <!--<input type="text" name="amount" class="form-control" id="amountmenu1">-->
                                   <input type="date" name="date" class="form-control" id="depositDate" required> 
                                  </div>
                                 </div>
                             </div> 
                             </div>
                             <div class="col-xs-12 menu1-fourth-part-form">
                               <button class="center-block btn-menu1"type="button" id="depositResult" >
                            <?php echo Yii::t('calculator','result');?>
                             <!--احسب الآن-->
                             </button>
                               </div>  
                             <div class="col-xs-12 menu1-fifth-part-form"> 
                                 <div id="results"></div>
                                 <div class="col-sm-12">
                                 <div class="text-tab-head">
                                     <?php echo Yii::t('calculator','calculationResult');?>
                                         <!--نتيجة الحساب-->
                                     </div>
                                      </div>
                                         <div class="col-sm-7 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','amount_advance_deposit');?>
                                     <!--مبلغ السلفة الشهرية -->
                                     <span class="resault" id="amount_of_the_monthly_advance">
                                         
                                     </span>
                                     </div>
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','date_of_first_desposit');?>
                                     <!--تاريخ أول سلفة للوديعة-->
                                     <span class="resault" id="first_date_advance_deposit">
                                         
                                     </span>
                                     </div>
                                 
                                   </div> 
                               </div> 
                              </div>
                             </div>
                            <!-------------------------------------------------------->
                           </form>
                        </div>
                        <div id="menu2" <?php echo ($param==1?'class="tab-pane fade in active"':'class="tab-pane fade"')?>>
                          <form>
                              <div class="col-xs-12 menu2-first-part-form">
                                   <div class="row">
                                     <div class="col-sm-3 col-xs-0"></div>
                                <div class="col-sm-3 col-xs-6">
                                 <div class="form-group  "> 
                                    <select class="form-control" id="exchange">
                                    
                                        <option value="0" >
                                        <?php echo Yii::t('calculator','transferType');?>
                                        <!--طبيعة التمويل-->
                                        </option>
                                        <?php 
                                        $finances=CalculatorFinance::model()->findAll();
                                        $i=1;
				                        foreach($finances as $finance){
                                        echo '
                                        <option value="'.($lang=='ar'?$finance->finance_type:$finance->finance_type_en).'"      data-max-value="'.$finance->max_duration_months.'">'.($lang=='ar'?$finance->finance_type:$finance->finance_type_en) .'</option>
                                        ';
                                       $i++; }
                                        
                                        ?> 
                                      </select> 
                                    </div> 
                                 </div>
                                 <div class="  col-sm-3 col-xs-6">
                                    <div class="form-group">
                                      <!--مدة التمويل-->
                                        <!--<input type="number" class="form-control" id="amountmenu2" placeholder="<?php //echo Yii::t('calculator','amount');?>">-->
                                        <input type="number" onkeypress="preventNonNumericalInput(event)" min="1" max="30" title="<?php echo($lang=='ar'?'مدة التمويل بالاشهر':'Duration of finance in months'); ?>"  pattern = "[0-9]"  class="form-control" id="time" name="foo"  placeholder="<?php echo ($lang=='ar'?'مدة التمويل بالأشهر':'Duration of finance in months');?>" onchange="checkVal()" required />
                                    
                                    
                                    </div> 
                                 </div>
                                  </div>
                              </div>
                              <div class="col-xs-12 menu2-second-part-form">
                               <div class="form-group">
                               <label class="col-sm-3 col-xs-0"for="time">
                               <?php //echo Yii::t('calculator','durationOfFinance');?>
                               <?php echo Yii::t('calculator','amount');?>
                               <!--المبلغ-->
                               </label>
                               <div class=" col-sm-6 col-xs-12 calculator-amount-div"> 
                               <!-- <input type="number" onkeypress="preventNonNumericalInput(event)"  min="1" class="form-control" id="amountmenu2" placeholder="<?php echo Yii::t('calculator','amount');?>"> -->
                               <input type="number" step="0.01"  min="1" class="form-control" id="amountmenu2" placeholder="<?php echo Yii::t('calculator','amount');?>"
                               onkeypress="return (event.charCode >= 48 && event.charCode <= 57) ||  
   event.charCode == 46 || event.charCode == 0 "
                               
                               >
                              
                              </div>
                              </div>
                              </div>
                               
                            <div class="col-xs-12 menu2-fourth-part-form">
                              <!--<button type="button" onclick="checkVal()" id="financeResult"  class="center-block btn-menu2" >-->
                              <button type="button"  id="financeResult"  class="center-block btn-menu2" >
                              <?php echo Yii::t('calculator','result');?>
                              <!--احسب الآن-->
                              </button>
                            </div>
                            
                             <div class="col-xs-12 menu2-fifth-part-form"> 
                                   <div class="col-sm-12">
                                 <div class="text-tab-head">
                                 <?php echo Yii::t('calculator','calculationResult');?>
                                     <!--نتيجة الحساب-->
                                 </div>
                                  </div>  
                                   <div class="col-sm-5 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','minimumPaid');?>
                                     
                                     <!--الحد الادنى للدفعة الاولى-->
                                     <span class="resault" id="amount_to_be_paid">
                                      
                                     </span>
                                     </div>
                                 
                                   </div>
                                   <div class="col-sm-offset-2 col-sm-5 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','funding_amount');?>
                                        <!--قيمة التمويل-->
                                     <span class="resault" id="funding_amount">
                                         
                                     </span>
                                     </div>
                                 
                                   </div>
                                   <div class="col-sm-5 col-xs-12">
                                     <div class="text-tab-menu2">
                                     <?php echo Yii::t('calculator','maximum_duration_of_funding');?>
                                      
                                        <!--الحد الأعلى لمدة التمويل-->
                                     <span class="resault" id="maximum_duration_of_funding">
                                         
                                     </span>
                                     </div>
                                     </div>
                                    <div class="col-sm-offset-2 col-sm-5 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','profit_ratio');?>
                                        
                                        <!--نسبة الربح-->
                                     <span class="resault" id="profit_ratio">
                                         
                                     </span>
                                     </div>
                                   </div>
                                     <div class="col-sm-5 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','debt_amount');?>
                                        
                                        <!--القسط الشهري-->
                                     <span class="resault" id="debt_amount">
                                         
                                     </span>
                                     </div>
                                   </div>
                                     <div class="col-sm-offset-2 col-sm-5 col-xs-12">
                                     <div class="text-tab">
                                     <?php echo Yii::t('calculator','profit_amount');?>
                                        
                                        <!--قيمة الربح-->
                                     <span class="resault" id="profit_amount">
                                         
                                     </span>
                                     </div>
                                   </div>
                                    <div class="col-sm-5 col-xs-12">
                                        <div id="profit_note" class="five-percent-padding">
                                        </div>
                                   </div>
                             </div>
                          </form>
                        </div>
                       </div>
                       </div>
                   </div>
              
             
              </div>
             
        </div>
    </section>
</section>

<script  type="application/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/site/scriptClaculator"></script>



