<?php

    $sitename = $this->settings_model->get('sitename');
    $sitename = !empty($sitename) ? $sitename : "Company";
    $amount = isset($transaction->aclbdtamount) ? $transaction->aclbdtamount : 0;
    $amount += isset($transaction->aclgatewayfee) ? $transaction->aclgatewayfee : 0;
    $amount = number_format($amount, 2, '.', '');
    $vError = isset($validation_error) ? $validation_error : array();
    $vPosted = array();
    $referrer = getReferrerHome($transaction->redirecturl, $transaction->usertype);
?>

<!DOCTYPE HTML>
<html>
   <head>
      <title><?php echo $gateway->name . ' | ' . $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('dynamic/css') ?>
    </head>
    <body>
    <style type="text/css">
        .m-t-20 {
            margin-top: 20px;
        }
        .panel-header-primary {
            background-color: #0B5785!important;
            color: #fff!important;
            border-color: #0B5785!important;
        }

        .panel-instruction {
            border: none!important;
        }

        .panel-body-instruction {
            border-left: 1px solid #ddd;
            border-right: 1px solid #ddd;
        }

        .panel-footer-instruction {
            border-left: 1px solid #ddd;
            border-right: 1px solid #ddd;
            border-bottom: 1px solid #ddd;
        }

        .panel-summary {
            background-color: #363636!important;
            color: #fff!important;
            padding: 5px!important;
            border-color: #2b2b2b;
        }

        .panel-header-summary {
            border-bottom: none !important;
            background-color: #363636!important;
            color: #fff!important;
        }

        .panel-header-summary h2 {
            font-size: 22px;
            font-weight: 700;
            margin: 0;
            margin-top: 10px;
            margin-bottom: 10px;
        }

        .panel-body-summary {
            padding: 0!important;
        }
        .list-payment-summary {
            margin-bottom: 0!important;
        }

        .list-payment-summary .list-group-item {
            border: none!important;
            padding: 8px!important;
            -webkit-border-radius: 0!important;
            -moz-border-radius: 0!important;
            border-radius: 0!important;
            box-shadow: 0 1px 0 #222223 inset, 0 2px 0 rgba(255, 255, 255, 0.04) inset;
        }

        .list-payment-summary .list-group-item:not(.tag) {
            background: transparent!important;
        }

        .list-payment-summary .list-group-item.tag{
            background: #616162;
            -webkit-font-smoothing: antialiased;
            color:#fff;
            font-size:75%;
            font-weight: normal;
            padding:10px;
            text-transform:uppercase;
            background-color:#616162;
            background-image:-moz-linear-gradient(top,#686868,#575758);
            background-image:-ms-linear-gradient(top,#686868,#575758);
            background-image:-webkit-gradient(linear,0 0,0 100%,from(#686868),to(#575758));
            background-image:-webkit-linear-gradient(top,#686868,#575758);
            background-image:-o-linear-gradient(top,#686868,#575758);
            background-image:linear-gradient(top,#686868,#575758);
            background-repeat:repeat-x;
            filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#686868',endColorstr='#575758',GradientType=0);
        }

        .list-payment-summary .list-group-item.total {
            font-size:20px;
        }

        .form-group label.error {
            font-size: 12px;
            display: block;
            margin-top: 5px;
            font-weight: normal;
            color: #F44336;
        }

        .has-error .form-control {
            border-color: #fb483a;
        }

        .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;
        }

    </style>
		<?php $this->view('dynamic/header') ?>
		<div class="container">
			<div class="row m-t-20">
                <?php if(isset($mail)) :?>
                <div class="col-sm-12">
                    <?php echo $mail ?>
                </div>
                <?php endif; ?>
				<div class="col-sm-6 col-md-7 col-lg-8">
                    <div class="panel panel-default panel-instruction">
                        <div class="panel-heading panel-header-primary"><?php echo xss_clean($gateway->name) ?> Payment Instructions</div>
                        <div class="panel-body panel-body-instruction">
                            <?php echo $gateway->instruction ?>
                        </div>
                        <?php if(!empty($fields)) : ?>
                        <div class="panel-footer panel-footer-instruction">
                            <?php echo form_open_multipart('payment/'.xss_clean($slug), array() ); ?>
                            <?php foreach ($fields as $fKey => $fParams) : ?>
                            <?php
                                if($fKey!='docupload' && !empty(set_value($fKey))){
                                    $vPosted[$fKey] = set_value($fKey);
                                }
                            ?>
                            <?php if($fKey=='senderac' || $fKey=='trxid') : ?>
                                <div class="form-group<?php echo aclErrorBlock($vError, $fKey, true) ? ' has-error' : '' ?>">
                                    <label for="<?php echo xss_clean($fKey) ?>"><?php echo !empty($fParams['label']) ? xss_clean($fParams['label']) : 'Text Box' ?></label>
                                    <input type="text" class="form-control" value="<?php echo getValue($fKey, $vPosted) ?>" name="<?php echo xss_clean($fKey) ?>" id="<?php echo xss_clean($fKey) ?>" placeholder="Enter<?php echo !empty($fParams['label']) ? ' '.xss_clean($fParams['label']) : ' Text Box' ?>">
                                    <?php echo aclErrorBlock($vError, $fKey) ?>
                                </div>
                            <?php elseif ($fKey=='trxnote') : ?>
                                <div class="form-group<?php echo aclErrorBlock($vError, $fKey, true) ? ' has-error' : '' ?>">
                                    <label for="<?php echo xss_clean($fKey) ?>"><?php echo !empty($fParams['label']) ? xss_clean($fParams['label']) : 'Text Area' ?></label>
                                    <textarea class="form-control" rows="5" name="<?php echo xss_clean($fKey) ?>" id="<?php echo xss_clean($fKey) ?>"><?php echo getValue($fKey, $vPosted) ?></textarea>
                                    <?php echo aclErrorBlock($vError, $fKey) ?>
                                </div>
                            <?php elseif ($fKey=='docupload') : ?>
                                <div class="form-group<?php echo aclErrorBlock($vError, $fKey, true) ? ' has-error' : '' ?>">
                                    <label for="<?php echo xss_clean($fKey) ?>"><?php echo !empty($fParams['label']) ? xss_clean($fParams['label']) : 'File Upload' ?></label>
                                    <div class="input-group">
                                        <label class="input-group-btn">
                                            <span class="btn btn-primary">
                                                <i class="glyphicon glyphicon-folder-open" aria-hidden="true" style="margin-right:10px"></i>Browse <input name="<?php echo xss_clean($fKey) ?>" id="<?php echo xss_clean($fKey) ?>" type="file" accept="image/png,image/jpeg,image/gif,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf" style="display: none;">
                                            </span>
                                        </label>
                                        <input type="text" class="form-control" placeholder="Choose File.." readonly>
                                    </div>
                                    <?php echo aclErrorBlock($vError, $fKey) ?>
                                </div>
                            <?php endif; ?>
                            <?php endforeach; ?>
                                <button type="submit" 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; ?>
                            </form>
                        </div>
                        <?php endif; ?>
                    </div>
			    </div>
                <div class="col-sm-6 col-md-5 col-lg-4">
                    <div class="panel panel-default panel-summary">
                        <div class="panel-heading panel-header-summary text-center"><h2>Payment Summary</h2></div>
                        <div class="panel-body panel-body-summary">
                            <ul class="list-group list-payment-summary">
                                <li class="list-group-item">
                                    INVOICE TO
                                    <span class="pull-right"><?php echo xss_clean($transaction->name) ?></span>
                                </li>
                                <li class="list-group-item">
                                    REFERENCE
                                    <span class="pull-right"><?php echo xss_clean($transaction->aclreference) ?></span>
                                </li>
                                <li class="list-group-item tag">
                                    ORDER DETAILS: #<?php echo xss_clean($transaction->transid) ?>
                                </li>
                                <li class="list-group-item">
                                    INVOICE AMOUNT
                                    <span class="pull-right">BDT <?php echo $amount ?></span>
                                </li>
                                <li class="list-group-item total">
                                    TOTAL
                                    <span class="pull-right">BDT <?php echo $amount ?></span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
		    </div>
        </div>
		<?php $this->view('dynamic/footer') ?>
		<?php $this->view('dynamic/js') ?>
		<script type="text/javascript">
		    jQuery(function($){
		        "user strict";
                $(document).on('change', ':file', function() {
                    if (this.files[0].size <= <?php echo $uplimit*1024 ?>) {
                        var input = $(this),
                            numFiles = input.get(0).files ? input.get(0).files.length : 1,
                            label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
                        input.trigger('fileselect.acl', [numFiles, label]);
                    } else {
                        this.value = '';
                        swal ( "Oops" , "File Size is too big!" , "error" );
                    }
                });
                $(document).ready( function() {
                    $(':file').on('fileselect.acl', function(event, numFiles, label) {
                        var input = $(this).parents('.input-group').find(':text'),
                            log = numFiles > 1 ? numFiles + ' files selected' : label;
                        if( input.length ) {
                            input.val(log);
                        }
                    });
                });
		    });
		</script>
	</body>
</html>

