<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>BillRun<?php echo $title ? ' | ' . $title : ''; ?></title>
        <meta name="description" content="BillRun Admin Panel">
        <meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="<?php echo $this->baseUrl; ?>/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon" />
        <style>
            body {
                padding-top: 50px;
                padding-bottom: 20px;
            }
        </style>
		<?php echo $css; ?>
		<script>
						baseUrl = '<?php echo $this->baseUrl; ?>';
						commithash = '<?php echo $this->commit; ?>';
		</script>
		<?php echo $js ?>
    </head>
    <body ng-app="BillrunApp">
        <!--[if lt IE 7]>
            <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
		<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
			<div class="container">
				<div class="navbar-header billrun-logo">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
						<span class="sr-only">Toggle navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="brand" href="<?php echo $this->baseUrl; ?>/admin/">
						<img src="<?php echo $this->baseUrl; ?>/img/billrun-logo-tm.png" alt="BillRun"/>
					</a>
				</div>
				<div ng-include="'views/partials/menu.html'" ng-if='false'></div>
				<?php
				print $this->render('menu.phtml', array('active' => $active));
				?>
			</div>
		</div>

		<?php if (in_array($active, array('lines', 'subscribers', 'subscribers_auto_renew_services', 'balances'))) : ?>
			<div ng-controller='SidePanelController as vm' ng-init='vm.init()' ng-cloak>
				<pageslide ps-side='left' ps-open='vm.showSidePanel' ps-squeeze="true" ps-custom-top='50px' ps-class='left-panel' ps-custom-bottom='10px' ng-class='{opened: vm.showSidePanel, closed: vm.showSidePanel}'>
					<h4>Subscriber Details</h4>
					<div class='row' ng-repeat='(key, val) in vm.subscriber'>
						<div class='col-md-6'><b>{{vm.Utils.getDisplayValue(key, "subscribers")}}</b></div>
						<div class='col-md-6' ng-bind-html="vm.print(val)"></div>
					</div>
				</pageslide>
				<div ng-class='{"toggle-panel-closed": !vm.showSidePanel, "toggle-panel-opened": vm.showSidePanel}' ng-click='vm.togglePanel()'>
					<i class='glyphicon' ng-class='{"glyphicon-chevron-right": !vm.showSidePanel, "glyphicon-chevron-left": vm.showSidePanel}'></i>
				</div>
			</div>
		<?php endif ?>


		<!-- main component -->
		<?php echo $this->component; ?>
		<!-- end of main component -->
		<!-- hackitty hack hack! -->
		<script>
						if ($('h1').length && $('h1').text().match(/(charging|customer|recurring)/gi)) {
							var href = $("#new").attr('href');
							var match = $("h1").text().match(/(charging|customer|recurring)/gi)[0].toLowerCase();
							href += '?type=' + match;
							$('#new').attr('href', href);
							$(".checkbox").find('[data-type="update"]').each(function (e) {
								href = $(this).attr('href');
								href += '?type=' + match;
								$(this).attr('href', href);
							});
						}
						$.get('/admin/getCurrentUsername', function (res) {
							username = res.username;
						});
		</script>
		<!-- end of hackitty hack hack -->

        <div ng-view ng-cloak></div>
        <h3><i class="glyphicon glyphicon-refresh glyphicon-spin" ng-show="spinner > 0"></i></h3>

		<script type="text/javascript">
						if (typeof google !== 'undefined') {
							google.load('visualization', '1', {packages: ["corechart", "annotatedtimeline", "controls"]});
						}
		</script>

    </body>
</html>