<?php
    $sitename = $this->settings_model->get('sitename');
    $sitename = !empty($sitename) ? $sitename : "Company";
    $qrcode = $this->settings_model->get('bkashqrcode');
    $qrcode = !empty($qrcode) ? $qrcode : false;
    $request = $this->session->has_userdata('bkashtransaction')?$this->session->userdata('bkashtransaction') : new stdClass();
    $clientName = isset($request->name) ? xss_clean($request->name) : "";
    $merchantNumber = $this->settings_model->get('bkashmerchant');
    $merchantNumber = !empty($merchantNumber) ? $merchantNumber : "";
    $reference = isset($request->aclreference) ? $request->aclreference : "";
    $amount = isset($request->aclbdtamount) ? $request->aclbdtamount : 0;
    $amount += isset($request->aclgatewayfee) ? $request->aclgatewayfee : 0;
    $vError = isset($validation_error) ? $validation_error : '';
    $vSaved = array('bkashpaymethod' => '#mob_ussd', 'bkashtrxid' => '');
    $vPosted = array();
    if(!empty(set_value('bkashpaymethod'))){
        $vPosted['bkashpaymethod'] = set_value('bkashpaymethod');
    }
    if(!empty(set_value('bkashtrxid'))){
        $vPosted['bkashtrxid'] = set_value('bkashtrxid');
    }
    $vDefault = array_merge($vSaved, $vPosted);
    $referrer = getReferrerHome($request->redirecturl, $request->usertype);
?>

<!DOCTYPE HTML>
<html>
   <head>
      <title>bKash | <?php echo $sitename ?></title>
      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
      <?php $this->view('bkash/css') ?>
    </head>
    <body>
		<style type="text/css">
			.cdb-bkash .nav-tabs {
			    border-bottom: 1px solid #e3076e;
			}
			.cdb-bkash .nav-tabs>li>a {
			    font-weight: bold;
			    font-size: 16px;
			    background-color: #e3076e;
			    background-image: linear-gradient(0deg, #e3076e, #db4874);
			    color: #fff;
			}
			.cdb-bkash .nav-tabs>li>a:hover {
			    border-color: transparent;
			}
			.cdb-bkash .nav-tabs>li.active>a {
			    color: #d21b52;
			    cursor: default;
			    background-color: #fff;
			    border: 1px solid #e3076e;
			    border-bottom-color: transparent;
			    background-image:none;
			}
			.cdb-bkash .label-info {
			    background-color: #e3076e;
			}

            .cdb-bkash-qr-code-img {
                background: #000;
                display: inline-block;
                padding: 10px;
                border-radius: 10px;
                margin-left: 20px;
            }

            .cdb-bkash-qr-code-img img.qrcode {
                border-radius: 5px;
            }

            .cdb-bkash-qr-code-img img.cdbd-qr-code {
                border-radius: 5px;
            }

            .cdb-bkash-qr-code-img img.cdb-qr-code {
                border-radius: 5px;
            }

            .cdb-qr-cation {
                font-size: 16pt;
                font-weight: 500;
                color: #fff;
                margin-top: 5px;
                padding: 5px 0px 0px;
                text-align: center;
            }

            .navbar-default {
                background-color: #324252;
                border-bottom: #1a2334;
            }

            .navbar-brand {
                height: auto;
            }

            .acl-footer {
                background: #f3f3f3;
                padding: 15px 30px;
                color: #444;
                border-top: 1px solid #d2d6de;
                margin-top: 20px;
            }


            @media (max-width: 991px) {
                .cdb-bkash-qr-code-img {
                    margin-top: 20px;
                }
            }
            @media (min-width: 992px) {
                .cdb-bkash-qr-code-img {
                    margin-left: 60px;
                }


                .cdb-bkas-app-row .col-sm-12:not(:first-child) {
                    border-left: 1px solid #e5e5e5;
                }

            }
		</style>
		<?php $this->view('bkash/header') ?>
		<div class="container">
			<div class="row">
				<div class="col-xs-12">
					<div class="cdb-bkash">
                        <?php if(!empty($vError)) : ?>
                        <div class="alert alert-danger alert-dismissible fade in" style="margin:20px 0px">
                            <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                            <?php echo xss_clean($vError) ?>
                        </div>
                        <?php endif; ?>
						<div style="margin:20px 0px">Dear <strong><?php echo $clientName ?></strong>,<br>
							You can make payments from your bKash Account to our “Merchant” account usnig “bKash Payment”.
							<ul class="nav nav-tabs" id="cdb_bkash_method" style="margin-top:20px">
							  <li<?php selectMenu(getValue('bkashpaymethod', $vDefault), '#mob_ussd', ' class="active" ')?>><a data-toggle="tab" href="#mob_ussd">Mobile (USSD)</a></li>
							  <li<?php selectMenu(getValue('bkashpaymethod', $vDefault), '#bkash_app', ' class="active" ')?>><a data-toggle="tab" href="#bkash_app">bKash App</a></li>
							</ul>
							<div class="tab-content" style="margin:20px 0px;">
							  <div id="mob_ussd" class="tab-pane fade<?php selectMenu(getValue('bkashpaymethod', $vDefault), '#mob_ussd', ' active in')?>">
							     <p>
							    <ol>
									<li>Go to your bKash Mobile Menu by dialing *247#</li>
									<li>Choose “Payment”</li>
									<li>Enter our Merchant bKash Account Number <span class="label label-info"><?php echo $merchantNumber ?></span></li>
									<li>Enter the invoice total amount <span class="label label-info"><?php echo $amount ?></span> TAKA</li>
									<li>Enter <span class="label label-info"><?php echo $reference ?></span> as reference. </li>
									<li>Counter No not applicable, you can skip it by entering '0'</li>
									<li>Now enter your bKash Mobile Menu PIN to confirm</li>
								</ol>
								</p>
							  </div>
							  <div id="bkash_app" class="tab-pane fade<?php selectMenu(getValue('bkashpaymethod', $vDefault), '#bkash_app', ' active in')?>">
                              <?php if($qrcode) : ?>
                                <div class="row cdb-bkas-app-row">
                                  <div class="col-md-5 col-sm-12">
                                      <ol>
                                          <li>Open your bKash App</li>
                                          <li>Choose “Make Payment”</li>
                                          <li>Enter our Merchant bKash Account Number <span class="label label-info"><?php echo $merchantNumber ?></span></li>
                                          <li>Enter the invoice total amount <span class="label label-info"><?php echo $amount ?></span> TAKA</li>
                                          <li>Enter <span class="label label-info"><?php echo $reference ?></span> as reference. </li>
                                          <li>Now enter your bKash PIN</li>
                                          <li>Tap and hold to make payment</li>
                                      </ol>
                                      Done! You will receive a confirmation message from bKash.
                                  </div>
                                  <div class="col-md-7 col-sm-12">
                                      <div class="cdb-bkash-qr-code-img">
                                          <img class="cdb-qr-code" src="<?php echo base_url('images/'.$qrcode ) ?>" width="200" height="200">
                                          <div class="cdb-qr-cation">
                                              <i class="glyphicon glyphicon-phone" aria-hidden="true"></i> Scan me
                                          </div>
                                      </div>
                                  </div>
                                </div>
                              <?php else: ?>
                                <ol>
                                    <li>Open your bKash App</li>
                                    <li>Choose “Make Payment”</li>
                                    <li>Enter our Merchant bKash Account Number <span class="label label-info"><?php echo $merchantNumber ?></span></li>
                                    <li>Enter the invoice total amount <span class="label label-info"><?php echo $amount ?></span> TAKA</li>
                                    <li>Enter <span class="label label-info"><?php echo $reference ?></span> as reference. </li>
                                    <li>Now enter your bKash PIN</li>
                                    <li>Tap and hold to make payment</li>
                                </ol>
                              Done! You will receive a confirmation message from bKash.
                              <?php endif; ?>
							  </div>
							</div>
                            <div class="row">
                                <div class="col-sm-12 col-md-6">
                                    <?php echo form_open_multipart('payment/bkash', array("style"=>"margin-bottom:20px;") ); ?>
                                        <div class="form-group">
                                            <label for="bkashtrxid" class="control-label">bKash Transaction ID :</label>
                                            <input type="text" class="form-control" id="bkashtrxid" name="bkashtrxid" placeholder="TrxID" value="<?php echo xss_clean(getValue('bkashtrxid', $vDefault)) ?>">
                                            <input type="hidden" name="bkashpaymethod" value="<?php echo getValue('bkashpaymethod', $vDefault) ?>">
                                        </div>
                                        <div class="form-group">
                                            <button type="submit" name="cdbbkashconfirm" class="btn btn-success">Submit</button>
                                            <?php if(!empty($referrer)) : ?>
                                                <a href="<?php echo xss_clean($referrer) ?>" class="btn btn-inverse">Get Back to Home</a>
                                            <?php endif; ?>
                                        </div>
                                    </form>

                                    <ul class="unstyled" style="margin-bottom:20px;">
                                        <li>Our bKash Number: <span class="label label-info"><?php echo $merchantNumber ?></span></li>
                                        <li>Reference: <span class="label label-info"><?php echo $reference ?></span></li>
                                        <li>If you have any question do not hesitate, feel free to <a href="javascript:void(0)" target="_blank">contact with us</a>.</li>
                                    </ul>
                                </div>
						    </div>
					    </div>
				    </div>
			    </div>
		    </div>
        </div>
		<?php $this->view('bkash/footer') ?>
		<?php $this->view('bkash/js') ?>
		<script type="text/javascript">
		    jQuery(function($){
		        "user strict";
		        $(document).ready(function(){
		            $('#cdb_bkash_method a').click(function () {
		               $('input[type="hidden"][name="bkashpaymethod"]').val($(this).attr('href'));
		            });
		        });
		    });
		</script>
	</body>
</html>

