<?php use yii\helpers\Html;use yii\bootstrap\ActiveForm;use yii\bootstrap\Modal;use yii\helpers\Url;$this->title='Sign In';$theAppId=Yii::$app->params['theAppId'];$curl=curl_init();curl_setopt_array($curl,array(CURLOPT_URL=>"https://cloud.interactive.co.id/mybilling/api/appLogin",CURLOPT_RETURNTRANSFER=>true,CURLOPT_POSTFIELDS=>"theAppId=$theAppId"));$response=json_decode(curl_exec($curl));curl_close($curl);?><div class="login-logo"><?=Html::img('@web/images/logo-my-connection.png',['class'=>'login-logo-img','alt'=>'InterActive MyConnection'])?></div><?php if($errorCode==1045){?><div class="login-box login-error text-center"> Please check your database connection. </div><?php }elseif(empty($response->orderstatus)){?><div class="login-box login-error text-center"> Please activate your account at InterActive MyBilling. </div><?php }elseif(!empty($response->orderstatus)){$session=Yii::$app->session;$session['activeUntil']=$response->nextduedate;$activeUntil=$session['activeUntil'];$today=date('Y-m-d H:i:s');if($today>$activeUntil){?><div class="login-box login-error text-center"> Your license was expired at <?=$activeUntil?>. Please renew your license at InterActive MyBilling. </div><?php }else{$fieldOptions1=[ 'options'=>['class'=>'form-group'],'inputTemplate'=>"{input}" ];$fieldOptions2=[ 'options'=>['class'=>'form-group has-feedback'],'inputTemplate'=>"{input}<i class='material-icons form-control-feedback'>visibility</i>" ];?><div class="login-box"><div class="login-box-header text-center"> Menjalankan <b>Sistem Accounting</b> Retail Anda jauh <b>Lebih Mudah</b>. </div><div class="login-box-separator"></div><div class="login-box-message text-center">Login to access InterActive MyConnection</div><?php $form=ActiveForm::begin(['id'=>'login-form','enableClientValidation'=>false]);?><?=$form ->field($model,'username',$fieldOptions1)->label(false)->textInput(['placeholder'=>$model->getAttributeLabel('username')])?> <?=$form ->field($model,'password',$fieldOptions2)->label(false)->passwordInput(['placeholder'=>$model->getAttributeLabel('password')])?><?=$form->field($model,'rememberMe')->checkbox(['template'=>'
                    <div class="form-group">
                        <label class="control-label">
                            {label}
                            {input}
                            <i class="material-icons">check_box</i>
                        </label>
                    </div>
                '])?> <?=Html::submitButton('LOGIN',['class'=>'btn btn-primary btn-block','name'=>'login-button'])?><?php ActiveForm::end();?></div><?php Modal::begin([ 'header'=>'<h2>DB Connection</h2>','footer'=>'<button class="btn btn-danger btn-close btn-cancel">Cancel</button> <button class="btn btn-primary btn-close btn-ok">OK</button>','toggleButton'=>[ 'label'=>'Show','class'=>'btn btn-primary','style'=>'opacity:0',],]);?><div class="form-group"><label for="dbhost">Host</label><input class="form-control" type="text" name="dbhost" id="dbhost" placeholder="Host"></div><div class="form-group"><label for="dbname">DB Name</label><input class="form-control" type="text" name="dbname" id="dbname" placeholder="DB Name"></div><div class="form-group"><label for="dbusername">Username</label><input class="form-control" type="text" name="dbusername" id="dbusername" placeholder="Username"></div><div class="form-group"><label for="dbpassword">Password</label><input class="form-control" type="password" name="dbpassword" id="dbpassword" placeholder="Password"></div><?php Modal::end();?><script type="text/javascript">/*<![CDATA[*/$(".btn-close").click(function(){$(".modal").modal("hide")});$(".btn-ok").click(function(){var a=$("input#dbhost").val();var d=$("input#dbname").val();var b=$("input#dbusername").val();var c=$("input#dbpassword").val();$.ajax({url:"<?=Url::to(['site/set-db']);?>",method:"POST",data:{dbhost:a,dbname:d,dbusername:b,dbpassword:c},success:function(e){location.reload()}})});/*]]>*/</script> <?php }}else{?><div class="login-box login-error text-center"> Please activate your account at InterActive MyBilling. </div><?php }?><footer class="main-footer text-center login-footer"><div class="main-footer-developed">Developed by</div><div class="main-footer-logo"><?=Html::img('@web/images/logo.png',['alt'=>'InterActive'])?></div><div>&copy; <?=date('Y')?>, All rights reserved.</div></footer>