<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/jquery-ui.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/ui.jqgrid.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/jquery.jqplot.min.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/style-old.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/grid.css" />

	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/jquery-ui.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/ui.jqgrid.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/jquery.jqplot.min.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo CDN_URL; ?>css/expense.css"/>

	<script type="application/javascript">
		var lblEnterName = '<?php echo __("LBL_ENTER_NAME"); ?>';
		var lblNameMustHaveLessThan = '<?php echo __("LBL_THE_NAME_MUST_HAVE_LESS_THAN"); ?>';
		var lblCharacters = '<?php echo __("LBL_CHARACTERS"); ?>';
		var lblParticipantExist = '<?php echo __("LBL_PARTICIPANT_ALREADY_EXIST"); ?>';
		var lblParticipantShouldNotContain = "<?php echo __('LBL_PARTICIPANT_NAME_SHOULD_NOT_CONTAIN'); ?>";
		var lblCreatedBy = "<?php echo __('LBL_CREATED_BY'); ?>";
		var lblOn = "<?php echo __('LBL_ON'); ?>";
		var lblClickToLogin = "<?php echo __('LBL_CLICK_TO_LOGIN'); ?>";
		var lblLoggedInAs = "<?php echo __('LBL_LOGGED_IN_AS'); ?>";
		var lblChangedOn = "<?php echo __('LBL_CHANGED_ON'); ?>";
		var lblPaidBy = "<?php echo __('LBL_PAID_BY'); ?>";
        var lblPreviousExpense = "<?php echo __('LBL_PREVIOUS_EXPENSE'); ?>";
        var lblNewExpense = "<?php echo __('LBL_NEW_EXPENSE'); ?>";
		var lblWhoPaid = "<?php echo __('LBL_WHO_PAID'); ?>";
		var lblHowMuch = "<?php echo __('LBL_HOW_MUCH'); ?>";
		var lblInvoles = "<?php echo __('LBL_INVOLVES'); ?>";
		var lblWhen = "<?php echo __('LBL_WHEN'); ?>";
		var lblWhatReason = "<?php echo __('LBL_WHAT_REASON'); ?>";
		var lblForYou = "<?php echo __('LBL_FOR_YOU'); ?>";
		var lblExpenseList = "<?php echo __('LBL_EXPENSE_LIST'); ?>";
		var lblAddExpense = '<?php echo __("LBL_ADD_EXPENSE"); ?>';
		var lblEditExpense = '<?php echo __("LBL_EDIT_EXPENSE"); ?>';
		var lblDeleteExpense = '<?php echo __("LBL_DELETE_EXPENSE"); ?>';
		var lblFindExpenses = '<?php echo __("LBL_FIND_EXPENSES"); ?>';
		var lblSave = '<?php echo __("LBL_SAVE"); ?>';
		var lblCancel = '<?php echo __("LBL_CANCEL"); ?>';
		var lblSaveContinue = '<?php echo __("LBL_SAVE_CONTINUE"); ?>';
		var lblWantDeleteExpense = '<?php echo __("LBL_WANT_DELETE_EXPENSE"); ?>';
		var lblPleaseEnterNameOfExpense = '<?php echo __("LBL_ENTER_NAME_OF_YOUR_EXPENSE"); ?>';
		var lblExpenseNameLessThanChar = '<?php echo __("LBL_EXPENSE_NAME_LESS_THAN_CHARACTER"); ?>';
		var lblValidAmount = '<?php echo __("LBL_VALID_AMOUNT"); ?>';
		var lblDistributedAmountSame = '<?php echo __("LBL_DISTRIBUTED_AMOUNT_SAME_AS_EXPENSE_AMOUNT"); ?>';
		var lblDateNotValid = '<?php echo __("LBL_DATE_NOT_VALID"); ?>';
		var lblCantDownload = "<?php echo __('LBL_SORRY_CANT_DOWNLOAD'); ?>";
		var lblBalanceOf = "<?php echo __('LBL_BALANCE_OF'); ?>";
		var lblClickTransactionMadeAlready = "<?php echo __('LBL_CLICK_TRANSACTION_MADE_ALREADY'); ?>";
		var lblEnterParticipantName = "<?php echo __('LBL_PLEASE_ENTER_PARTICIPANT_NAME'); ?>";
		var lblExpenseNameLessChar = "<?php echo __('LBL_EXPENSE_NAME_LESS_THAN_CHAR'); ?>";
		var lblParticipantAlreadyExist = "<?php echo __('LBL_PARTICIPANT_EXIST'); ?>";
		var lblName = "<?php echo __('LBL_NAME'); ?>";
		var lblTotalCharge = "<?php echo __('LBL_TOTAL_CHARGE'); ?>";
		var lblTotalPaid = "<?php echo __('LBL_TOTAL_PAID'); ?>";
		var lblBalance = "<?php echo __('LBL_BALANCE'); ?>";
		var lblParticipantList = "<?php echo __('LBL_PARTICIPANT_LIST'); ?>";
		var lblAddParticipant = "<?php echo __('LBL_ADD_PARTICIPANT'); ?>";
		var lblEditParticipant = "<?php echo __('LBL_EDIT_PARTICIPANT'); ?>";
		var lblDeleteParticipant = "<?php echo __('LBL_DELETE_PARTICIPANT'); ?>";
		var lblFindParticipant = "<?php echo __('LBL_FIND_PARTICIPANT'); ?>";
		var lblWantDeleteParticipant = "<?php echo __('LBL_WANT_DELETE_PARTICIPANT'); ?>";
		var lblDataSavingFailed = "<?php echo __('LBL_DATA_SAVING_FAILED'); ?>";
		var lblEmailSent = '<?php echo __("LBL_EMAIL_SENT"); ?>';
		var lblEmailSentFail = '<?php echo __("LBL_EMAIL_SENT_FAIL"); ?>';
		var lblDataSaved = '<?php echo __("LBL_DATA_SAVED_SUCCESSFULLY"); ?>';
		var lblRecordNotFound = '<?php echo __("LBL_RECORD_NOT_FOUND"); ?>';
		var lblExpenseLog = '<?php echo __("LBL_EXPENSE_LOG"); ?>';
		var lblFindLog = '<?php echo __("LBL_FIND_LOG"); ?>';
		var lblExpenseType = '<?php echo __("LBL_EXPENSE_TYPE"); ?>';
		var lblAll = '<?php echo __("LBL_ALL"); ?>';
		var lblMealsAddedOnThisDate = '<?php echo __("LBL_MEALS_ADDED_ON_THIS_DATE"); ?>';
		var lblShouldPayTo = '<?php echo __("LBL_SHOULD_PAY_TO"); ?>';
		var lblMealsForYou = '<?php echo __("LBL_MEALS_FOR_YOU"); ?>';
		var lblOutOf = '<?php echo __("LBL_OUT_OF"); ?>';
		var lblAndCost = '<?php echo __("LBL_AND_COST"); ?>';
		var lblHencePerCost = '<?php echo __("LBL_HENCE_PER_COST"); ?>';
		var lblTotalMeal = '<?php echo __("LBL_TOTAL_MEAL"); ?>';
		var lblMealCharge = '<?php echo __("LBL_MEAL_CHARGE"); ?>';
		var lblDate = '<?php echo __("LBL_DATE"); ?>';
		var lblDay = '<?php echo __("LBL_DAY"); ?>';
		var lblBreakfast = '<?php echo __("LBL_BREAKFAST"); ?>';
		var lblLunch = '<?php echo __("LBL_LUNCH"); ?>';
		var lblDinner = '<?php echo __("LBL_DINNER"); ?>';
		var lblMealList = '<?php echo __("LBL_MEAL_LIST"); ?>';
		var lblAddMealInformation = '<?php echo __("LBL_ADD_MEAL_INFORMATION"); ?>';
		var lblEditMealInformation = '<?php echo __("LBL_EDIT_MEAL_INFORMATION"); ?>';
		var lblFindMealInformation = '<?php echo __("LBL_FIND_MEAL_INFORMATION"); ?>';
		var lblDeleteMealInformation = '<?php echo __("LBL_DELETE_MEAL_INFORMATION"); ?>';
		var lblDeleteMeal = '<?php echo __("LBL_DELETE_MEAL"); ?>';
		var lblWantDeleteMeal = '<?php echo __("LBL_WANT_DELETE_MEAL"); ?>';
		var lblBalanceLink = '<?php echo __("LBL_BALANCE_LINK"); ?>';
		var lblSettledExpenseNotEditable = '<?php echo __("LBL_SETTLED_EXPENSE_NOT_EDITABLE"); ?>';
        var baseUrl = "<?php echo HTTP_SITE_URL; ?>";
        var session_profile_id = "<?php echo $session_profile_id; ?>";
        var session_user_id = "<?php echo $print_uid; ?>";
        var isPermitted = "<?php echo $isPermitted?>";
        var permission_permitted = "<?php echo $permission_permitted ?>";
        var delete_permitted = "<?php echo $delete_permitted ?>";
        var permitted = "<?php echo $permitted ?>";
        var lblExpenseNotPermitted = "<?php echo __("LBL_EXPENSE_NOT_EDIT_PERMISSION"); ?>";
        var OPERATION_TYPE = <?php echo json_encode($operation_type); ?>;
        var permission_list = <?php echo json_encode($permissions); ?>;
        var owner = <?php echo OWNER; ?>;
        var lblPermissionList = "<?php echo __('LBL_PERMISSION_LIST'); ?>";
        var lblAddPermission = "<?php echo __('LBL_ADD_PERMISSION'); ?>";
        var lblEditPermission = "<?php echo __('LBL_EDIT_PERMISSION'); ?>";
        var lblDeletePermission = "<?php echo __('LBL_DELETE_PERMISSION'); ?>";
        var lblEnableRestrictionPermission = "<?php echo __('LBL_ENABLE_RESTRICTION_MESSAGE_PERMISSION'); ?>";
        var lblErrorEditPermission = "<?php echo __('LBL_ERROR_NOT_EDIT_PERMISSION'); ?>";
        var lblDeleteMessagePermission = "<?php echo __('LBL_DELETE_MESSAGE_PERMISSION'); ?>";
        var lblNotDeleteMessagePermission = "<?php echo __('LBL_NOT_DELETE_MESSAGE_PERMISSION'); ?>";
        var lblSelectPermission = "<?php echo __('LBL_SELECT_PERMISSION_MESSAGE'); ?>";
        var lblEmailExistMessage = "<?php echo __('LBL_EMAIL_EXIST_MESSAGE'); ?>";
        var lblRestrictedMessage = "<?php echo __('LBL_RESTRICTED'); ?>";
        var lblOff = "<?php echo __('LBL_OFF'); ?>";
        var lblRestrictedOn = "<?php echo __('LBL_ON_MESSAGE'); ?>";
        var lblRestrictedModeErrorMessage = "<?php echo __('LBL_MODE_ERROR_MESSAGE'); ?>";
        var lblEmail= "<?php echo __('LBL_EMAIL'); ?>";
        var lblPermission= "<?php echo __('LBL_PERMISSION'); ?>";
        var lblOperation= "<?php echo __('LBL_OPERATION'); ?>";
        var lblChangedBy= "<?php echo __('LBL_CHANGED_BY'); ?>";
        var lblPerticipentNotDelete= "<?php echo __('LBL_PARTICIPENT_NOT_DELETE'); ?>";
        var nameLength = "<?php echo PARTICIPENT_NAME_LENGTH?>";
        var participantNameErrorMessage = "<?php echo __("LBL_PARTICIPENT_NAME_ERROR"); ?>";
        var nameErrorMessage = "<?php echo __("YOUR_NAME_NOT_EMPTY_MAX_CHAR"); ?>";
        var lblErrorSavingMessage = "<?php echo __("ERROR_SAVING_DATA"); ?>";
    </script>


</head>

<body>

	<?php

	echo $this->Form->input('expenseData', array('type' => 'hidden', 'id' => 'expenseData', 'value' => $expenseData));
	echo $this->Form->input('justCreated', array('type' => 'hidden', 'id' => 'justCreated', 'value' => $justCreated));
	echo $this->Form->create(null, array('id' => 'loadForm', 'url' => array('controller' => 'Expense', 'action' => 'loadTab')));
	echo $this->Form->end();
    echo $this->Form->create(null, array('id' => 'permissionForm', 'url' => array('controller' => 'GroupSetting', 'action' => 'addPermission')));
    echo $this->Form->end();
	?>




	<?php if ($permissionLevel === NO_PERMIT) { ?>

		<div style="color: red;text-align: center;"><?php echo __("LBL_EXPENSE_NOT_PERMITTED"); ?></div>

	<?php } else { ?>
		<h1 class="tabTitle">
			<div id="expenseTitleDiv"></div>
		</h1>

		<table>
			<tr>
				<td>
					<div id="expenseDescDiv"></div>
				</td>
				<td style="text-align:right">
					<div id="expenseLoginAsDiv" style="text-align:right"></div>
				</td>
			</tr>
		</table>

		<table>
			<tr>
				<td><strong>
						<div id="expenseCreatedByDiv"></div>
					</strong></td>
				<td class="tabRight" style="text-align:right">
					<a style="cursor:pointer" onClick="gotoHome()"> <img title="Visit Home Page" src="<?php echo CDN_URL; ?>images/home-icon.png" alt="" /> <?php echo __("LBL_HOME"); ?> </a>
					|<a style="cursor:pointer" onClick="createGroupExpense()"><?php echo __("LBL_NEW_GROUP_EXPENSECOUNT"); ?></a>
					|<a style="cursor:pointer" onClick="createMessExpense()"><?php echo __("LBL_NEW_MESS_EXPENSECOUNT"); ?></a>
					|<a style="cursor:pointer" onClick="createFamilyExpense()"><?php echo __("LBL_NEW_FAMILY_EXPENSECOUNT"); ?></a>
					<!-- <a style="cursor:pointer"  onClick="dashBoard.printExpense()">| <?php echo __("LBL_PRINT"); ?></a> -->
					<a style="cursor:pointer" onClick="printReport()">| <?php echo __("LBL_PRINT"); ?></a>

				</td>
			</tr>
		</table>
		<div id="participantBox">

			<div class="round">
				<table class="gridTable" style="text-align:left">
					<tr>
						<th>
							<div id="expense_table_title_id"> <?php echo __("LBL_CLICK_NAME_TO_LOGIN"); ?></div>
						</th>
						<th style="width:180px;">
							<a style="cursor:pointer" id="create-participant"><img src="<?php echo CDN_URL; ?>images/add-icon.png" alt="" /> <?php echo __("LBL_ADD_PARTICIPANT"); ?></a>
						</th>
					</tr>
				</table>
			</div>

			<div class="contentDisplay" id="div_participant">

			</div>

		</div>


	<?php } ?>
	<div id="tabs" style="display:none">
		<ul>
			<li><a href="#tabs-1"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/expense_icon.png" align="absmiddle"> <?php echo __("LBL_EXPENSE"); ?></a></li>
			<li><a href="#tabs-1a"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/meal_icon.png" align="absmiddle"> <?php echo __("LBL_MEAL"); ?></a></li>
			<li><a href="#tabs-2"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/balance_icon.png" align="absmiddle"> <?php echo __("LBL_BALANCE"); ?></a></li>
			<li><a href="#tabs-3"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/participant_icon.png" align="absmiddle"> <?php echo __("LBL_PARTICIPANTS"); ?></a></li>
			<li><a href="#tabs-4"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/log_icon.png" align="absmiddle"> <?php echo __("LBL_LOGS"); ?></a></li>
			<li><a href="#tabs-5"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/share_icon.png" align="absmiddle"> <?php echo __("LBL_SHARE"); ?></a></li>
			<li><a href="#tabs-6"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/setting_icon.png" align="absmiddle"> <?php echo __("LBL_SETTINGS"); ?></a></li>
			<li><a href="#tabs-7"> <?php echo __("LBL_REPORTS"); ?></a></li>
            <?php if (RESTRICTION_MODE_HIDE && $is_permission_visible) { ?>
                <li><a href="#tabs-8"><img alt="Expenses" src="<?php echo CDN_URL; ?>images/permission_icon.png"
                                           align="absmiddle"> <?php echo __("LBL_PERMISSION"); ?></a></li>
            <?php } ?>

		</ul>
		<div id="tabs-1">
			<div class="tabContent">
				<style type="text/css">
					.jqplot-yaxis-tick {
						white-space: nowrap;
					}
				</style>

				<table id="grid">
					<tr>
						<td />
					</tr>
				</table>
				<div id="expense_pager"> </div>
			</div>
		</div>


		<div id="tabs-1a">
			<div class="tabContent">

				<style type="text/css">
					.jqplot-yaxis-tick {
						white-space: nowrap;
					}
				</style>

				<table id="meal_grid">
					<tr>
						<td />
					</tr>
				</table>
				<div id="meal_expense_pager"> </div>
			</div>
		</div>

		<div id="tabs-2">
			<div class="tabContent">

				<div id="balanceDivId" class="graph">

					<div class="graphLeft">
						<a id="slideRight" href="#"><img src="<?php echo CDN_URL; ?>images/slide-right-icon.png" alt="" /></a>

						<div id="balance_chart" style=" height:250px;"></div>
						<!-- <div class="graphBtn"><a id="btnDownloadImage"  >Download Graph</a></div> -->

					</div>

					<div class="graphRight">
						<a id="slideLeft" href="#"><img src="<?php echo CDN_URL; ?>images/slide-left-icon.png" alt="" /></a>

						<h2><?php echo __("LBL_HOW_BLANCE"); ?></h2>
						<div class="balanceContent" id="balance_payment_div"></div>
						<div class="blanceLink">
							<img src="<?php echo CDN_URL; ?>images/info-icon.png" alt="" /> <?php echo __("LBL_CLICK_ON_THE"); ?> 'Mark Settle' <?php echo __("LBL_SIGN_IF_TRANSACTION_MADE"); ?>
							<div id="balanceSummaryDivId"></div>
						</div>
					</div>

				</div>


				<div id="balanceDivErrorId"><?php echo __("LBL_PLEASE_ADD_MEALS_CALCULATE_BALANCE"); ?></div>

			</div>


		</div>
		<div id="tabs-3">
			<div class="tabContent">
				<!-- Tab Participant List -->
				<table id="participant_grid">
					<tr>
						<td />
					</tr>
				</table>
				<div id="participant_pager"> </div>
			</div>
		</div>

		<div id="tabs-4">
			<div class="tabContent">
				<?php
				echo $this->Form->create(null, array('id' => 'viewLogForm', 'return' => false, 'url' => array('controller' => 'Expense', 'action' => 'displayLog')));

				?>
				<?php echo $this->Form->hidden('logExpenseId'); ?>

				<table>
					<tr>
						<td> <?php echo $this->Form->input('fromDate', array('readonly' => true, 'lable' => false)); ?></td>
						<td><?php echo $this->Form->input('toDate', array('readonly' => true, 'lable' => false)); ?></td>
						<td><?php echo $this->Form->end('View Log'); ?> <img id="loadImg" style="display:none;margin-bottom:-10px;" src="<?php echo CDN_URL; ?>images/loading.gif" /> </td>
					</tr>
				</table>


				<table id="log_grid">
					<tr>
						<td />
					</tr>
				</table>
				<div id="log_pager"></div>
			</div>
		</div>

		<div id="tabs-5">
			<div class="tabContent">
				<?php
				echo $this->Form->create(null, array('id' => 'sendEmailForm', 'url' => array('controller' => 'Expense', 'action' => 'sendEmail')));
				echo $this->Form->hidden('emailExpenseTitle');
				echo $this->Form->hidden('emailUniqueURL');

				?>

				<div><b><?php echo __("LBL_COPY_TEXT_INTO_EMAIL_SEND_GROUP"); ?></b><br /> </div>
				<div id="divExpenseURL"></div>
				<div id="divExpenseFacebookURL"></div><br />
				<p><?php echo __("LBL_EXPENSECOUNT_TOOL_CREATE_GROUP_MESS_FAMILY_EXPENSE"); ?> </p>
				<table>
					<tr>
						<td> <?php echo __("LBL_OR"); ?> </br /> </br /> <?php echo __("LBL_PUT_EMAIL_ADDRESS"); ?>:<?php echo $this->Form->input('email', array('label' => false, 'email' => '<?php echo __("LBL_EMAIL_MESSAGE")?>', 'length' => '200px', 'required' => 'true', 'style' => 'width:240px; height:20px;'));    ?>
							<br />
							<?php
							if ($isPermitted) {
								echo $this->Form->end('Send');
							} else {

								echo '<input type="button" value="Send" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" onclick="alert(lblExpenseNotPermitted);">';
							}

							?>

							<img id="loadImg2" style="display:none;" src="<?php echo CDN_URL; ?>images/loading.gif" /></p>
						</td>
					</tr>
				</table>
			</div>
		</div>
		<div id="tabs-6">
			<div class="tabContent">
				<b>General Information</b><br />

				<?php
				echo $this->Form->create(null, array('id' => 'updateGroupExpenseForm', 'url' => array('controller' => 'Home', 'action' => 'updateGroupExpense')));
				?>
				<span id="error_title"></span><br />
				<span id="error_currency"></span><br />
				<?php
				echo $this->Form->hidden('expenseid');
				echo $this->Form->hidden('version');

				?>
				<table>
					<tr>
						<td><?php echo __("LBL_TITLE"); ?></td>
						<td><?php echo $this->Form->input('title', array('label' => false, 'title' => 'Please provide title', 'length' => '200px', 'required' => 'false'));    ?></td>
					</tr>

					<tr>
						<td><?php echo __("LBL_CURRENCY"); ?></td>
						<td><?php echo $this->Form->input('currency', array('label' => false)); ?></td>
					</tr>
					<tr>
						<td><?php echo __("LBL_DEFAULT_BREAKFAST"); ?></td>
						<td> <input name="data[Expense][defaultBreakfast]" type=text id="ExpenseDefaultBreakfast" onKeyUp="dashBoard.filterMealInput(this)"></td>
					</tr>
					<tr>
						<td><?php echo __("LBL_DEFAULT_LUNCH"); ?></td>
						<td><input name="data[Expense][defaultLunch]" type=text id="ExpenseDefaultLunch" onKeyUp="dashBoard.filterMealInput(this)"></td>
					</tr>
					<tr>
						<td><?php echo __("LBL_DEFAULT_DINNER"); ?></td>
						<td><input name="data[Expense][defaultDinner]" type=text id="ExpenseDefaultDinner" onKeyUp="dashBoard.filterMealInput(this)"></td>
					</tr>
					<tr>
						<td><?php echo __("LBL_DESCRIPTION"); ?></td>
						<td><?php echo $this->Form->textarea('description', array('rows' => '5', 'cols' => '45')); ?></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td><br />
							<?php
							if ($isPermitted) {
								echo $this->Form->end('Save');
							} else {

								echo '<input type="button" value="Save" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" onclick="alert(lblExpenseNotPermitted);">';
							}
							?>
							<img id="loadImg1" style="display:none;" src="<?php echo CDN_URL; ?>images/loading.gif" />
						</td>
					</tr>

				</table>
			</div>
		</div>

		<div id="tabs-7">
			<div class="tabContent">
				<b><?php echo __("LBL_GENERAL_REPORTS"); ?></b><br /><br /><br />

				<table>
					<tr>
						<td>&#149; <a style="color:#0000CD; background-color:transparent; cursor:pointer" target=blank onClick="dashBoard.printExpense()"> <?php echo __("LBL_EXPENSE_REPORTS"); ?></a> </td>
					</tr>
					<tr>
						<td>&#149; <a style="color:#0000CD; background-color:transparent; cursor:pointer" target=blank onClick="dashBoard.printMeals()"> <?php echo __("LBL_MEAL_SUMMARY_REPORT"); ?></a> </td>
					</tr>
					<tr>
						<td>&#149; <a style="color:#0000CD; background-color:transparent; cursor:pointer" target=blank onClick="dashBoard.printMyMeals()"> <?php echo __("LBL_MY_MEAL_REPORT"); ?></a> </td>
					</tr>
				</table>
			</div>
		</div>

        <?php if (RESTRICTION_MODE_HIDE && $is_permission_visible) { ?>
            <div id="tabs-8">
                <div class="tabContent">
                    <?php if ($permitted) { ?>
                        <div class="switch-container">
                            <label class="switch">
                                <input type="checkbox" id="restrictedMode" onchange="toggleRestrictedMode(this)">
                                <span class="slider"></span>
                            </label>
                            <span id="restrictedLabel"><?php echo __("LBL_RESTRICTED")?>: <?php echo __("LBL_OFF")?></span>
                        </div>
                    <?php } ?>
                    <table id="permission_grid">
                        <tr>
                            <td></td>
                        </tr>
                    </table>
                    <div id="permission_pager"></div>
                </div>
            </div>
        <?php } ?>
	</div>

	<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="<?php echo CDN_URL; ?>js/excanvas.js"></script><![endif]-->


	<script src="<?php echo CDN_URL; ?>js/jquery-1.11.0.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/jquery-ui.js"></script>
	<script src="<?php echo CDN_URL; ?>js/i18n/grid.locale-en.js"></script>
	<script src="<?php echo CDN_URL; ?>js/jquery.jqGrid.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/jquery.jqplot.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/plugins/jqplot.barRenderer.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/plugins/jqplot.pieRenderer.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/plugins/jqplot.categoryAxisRenderer.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/plugins/jqplot.pointLabels.min.js"></script>
	<script src="<?php echo CDN_URL; ?>js/mess_expense.js?v=1.0.5"></script>
	<script src="<?php echo CDN_URL; ?>js/permission.js?v=1.0.3"></script>



	<?php



	echo $this->Form->create(null, array('id' => 'expenseForm', 'url' => array('controller' => 'Expense', 'action' => 'changeGroupExpense')));


	echo $this->Form->end();

	echo $this->Form->create(null, array('id' => 'participantForm', 'url' => array('controller' => 'Expense', 'action' => 'changeParticipant')));


	echo $this->Form->end();

	?>


	<?php
	echo $this->Form->create("Expense", array('target' => 'blank', 'id' => 'printForm', 'url' => array('controller' => 'Expense', 'action' => 'printExpense')));

	echo $this->Form->input('printExpenseList', array('type' => 'hidden', 'id' => 'printExpenseList'));
	echo $this->Form->input('printExpense', array('type' => 'hidden', 'id' => 'printExpense'));
	echo $this->Form->input('printBalance', array('type' => 'hidden', 'id' => 'printBalance'));
	echo $this->Form->input('printNames', array('type' => 'hidden', 'id' => 'printNames'));
	echo $this->Form->input('printOption', array('type' => 'hidden', 'id' => 'printOption'));

	echo $this->Form->end();
	?>


	<script type="application/javascript">
		$(function() {
            $("#tabs").tabs();
			$("#tabs").tabs({
				activate: function(event, ui) {
					var newIndex = ui.newTab.index();
					if (newIndex == 0) {
						//  $("#balance_payment_div").html("");
						dashBoard.setExpenseGridExtension();
					} else if (newIndex == 1) {

						dashBoard.loadMealGrid();
						//dashBoard.setMealGridExtension(); 	        	 
					} else if (newIndex == 2) {
						//  $("#balance_payment_div").html("");
						dashBoard.drawGraph();
					} else if (newIndex == 3) {
						//  $("#balance_payment_div").html("");
						dashBoard.resetParticipantBalance();
						//	dashBoard.resetParticipantMeal(); 	
						dashBoard.displayParticipantList();

						dashBoard.setParticipantGridExtension();
					} else if (newIndex == 4) {

						dashBoard.generateLogList("", 1);

						if ($("#ExpenseFromDate").val() == "" && $("#ExpenseToDate").val() == "") {
							var currentDate = new Date();
							var lastWeek = new Date(currentDate.getTime() - 7 * 24 * 60 * 60 * 1000);
							$("#ExpenseFromDate").datepicker("setDate", lastWeek);
							$("#ExpenseToDate").datepicker("setDate", new Date());
						}


					} else if (newIndex == 5) {
						var expense_url = "<?php echo HTTP_SITE_URL . "/"; ?>" + dashBoard.expense.unique_url;
						$("#divExpenseURL").html('<br/><?php echo __("LBL_THE_MESS_EXPENSE"); ?> "' + dashBoard.expense.title + '" <?php echo __("LBL_ACCESSIBLE_ON_EXPENSECOUNT"); ?> <?php echo __("LBL_THE_URL_IS"); ?>:<br/> <a style="color:#0000CD; background-color:transparent;" target=blank  href="' + expense_url + '"  >' + expense_url + '</a> ');
						$("#divExpenseFacebookURL").html("<br/><?php echo __("LBL_ACCESS_FROM_MOBILE"); ?><br/>");


					} else if (newIndex == 6) {

						$("#ExpenseExpenseid").val(dashBoard.expense.id);
						$("#ExpenseTitle").val(dashBoard.expense.title);
						$("#ExpenseCurrency").val(dashBoard.expense.currency);
						$("#ExpenseDescription").val(dashBoard.expense.description);
						$("#ExpenseDefaultBreakfast").val(dashBoard.defaultBreakfast);
						$("#ExpenseDefaultLunch").val(dashBoard.defaultLunch);
						$("#ExpenseDefaultDinner").val(dashBoard.defaultDinner);
					}
                    else if (newIndex == 8) {
                        if(permitted) {
                            var label = document.getElementById("restrictedLabel");
                            if (userPermission.restrict_mode == 1) {
                                $('#restrictedMode').prop('checked', true);
                                label.textContent = lblRestrictedMessage+": "+lblRestrictedOn;
                            } else {
                                $('#restrictedMode').prop('checked', false);
                                label.textContent = lblRestrictedMessage+": "+lblOff;
                            }
                        }
                        userPermission.displayPermissionList();
                        userPermission.setPermissionGridExtension();
                    }
				}
			});
            $("input[type=submit]").button()
		});

        $("#slideRight").hide();
        //Slider js
        $("#slideLeft").click(function() {
            $('.graphRight').hide(1000);
            $('.graphLeft').animate({
                width: 740
            }, {
                duration: 1000
            });
            $("#slideRight").show();
        });

        $("#slideRight").click(function() {
            $("#slideRight").hide();
            $('.graphLeft').animate({
                width: 298
            }, {
                duration: 1000
            });
            $('.graphRight').show(1000);
        });

        $("#btnDownloadImage").click(function(event) {
            dashBoard.createGraphImage()
        });

        $("#ExpenseFromDate").datepicker({
            changeMonth: true,
            changeYear: true,
            yearRange: "2015:2099",
            dateFormat: "yy-mm-dd"

        });

        $("#ExpenseToDate").datepicker({
            changeMonth: true,
            changeYear: true,
            yearRange: "2015:2099",
            dateFormat: "yy-mm-dd"

        });

        function createGroupExpense() {

            if (top.location != self.location) {
                top.location = "<?php echo HTTP_SITE_URL; ?>/Home/createGroupExpense";
            }

        }

        function createMessExpense() {

            if (top.location != self.location) {
                top.location = "<?php echo HTTP_SITE_URL; ?>/Home/createMessExpense";
            }

        }

        function createFamilyExpense() {

            if (top.location != self.location) {
                top.location = "<?php echo HTTP_SITE_URL; ?>/Home/createFamilyExpense";
            }

        }

        function gotoHome() {

            if (top.location != self.location) {
                top.location = "<?php echo HTTP_SITE_URL; ?>";
            }

        }

        function printGroupExpense() {

            if (top.location != self.location) {
                top.location = "<?php echo HTTP_SITE_URL; ?>/Home/print";
            }

        }

        function printReport() {

            if (top.location != self.location) {
                var targetUrl = "<?php echo HTTP_SITE_URL . '/Expense/printReport/' . $uniqueURL . '/' . $print_uid; ?>";
                window.open(targetUrl, "_blank");
            }

        }

        function toggleRestrictedMode(checkbox) {
            var label = document.getElementById("restrictedLabel");
            var restrict = 0;
            var level_value = lblOff;
            if (checkbox.checked) {
                restrict = 1;
            }
            if(Object.keys(userPermission.permissions).length > 1) {
                $('#restrictedMode').prop('checked', true);
                alert(lblRestrictedModeErrorMessage);
                return false;
            }
            var permissionObj = {
                expense_id: dashBoard.expense.id,
                mode: restrict,
                unique_url: getUniqueUrl()
            }

            $.ajax({
                type: 'POST',
                url: "<?php echo HTTP_SITE_URL . '/GroupSetting/addRestriction'?>",
                data: permissionObj,
                success: function (data, textStatus, xhr) {
                    if(data.restricted_mode === true) {
                        userPermission.restrict_mode = 1;
                        level_value = lblRestrictedOn;
                        $('#restrictedMode').prop('checked', true);
                    }else {
                        userPermission.restrict_mode = 0;
                        $('#restrictedMode').prop('checked', false);
                    }
                    dashBoard.expense.version = parseInt(dashBoard.expense.version) + 1;
                    $("#ExpenseVersion").val(dashBoard.expense.version);
                    label.textContent = lblRestrictedMessage+": " + level_value;
                    alert(data.message);
                },
                error: function (xhr, textStatus, error) {
                    return false;
                }
            });

        }
	</script>

	<script src="<?php echo CDN_URL; ?>js/common.js"></script>

	<div id="dialog-form" title="New Participant" style="display:none">
		<p class="validateTips"></p>
		<form>
			<fieldset>
				<label for="name"><?php echo __("LBL_NAME"); ?></label>
				<input type="text" name="name" id="name" value="" class="text ui-widget-content ui-corner-all">


				<input type="submit" tabindex="-1" style=" top:-1000px">
			</fieldset>
		</form>
	</div>


</body>

</html>