<?php

$ist_books=dbRows("date,days_limit,id,book_id","istiarah","returnd  = 0");

$ist_timeover=array();
foreach ($ist_books as $key=>$ist){
	
	$days_left=time_chack($ist['date'],intval($ist['days_limit']));
	

		if( !$days_left ){
			
			$ist_timeover[]=ist_book($ist['id'],$ist['book_id']);
			
		}
		
}

$stt=stt();

   $days_left_to_backup=time_chack($stt['backup_last_time'],$stt['backup_notify_evry_days']);
   

?>

<?php if(count($ist_timeover)>0): ?>
<div class="uk-alert-warning" uk-alert style="border-right: 8px solid #FF5722;">
   
    <p  style="color: #ff5722;"> <?=sprintf(lang('ist_timeover_notify_msg'),'<span class="uk-badge">'.count($ist_timeover).'</span>')?>
	<a  class="uk-button uk-button-small uk-button-default" href="<?=site_url("front/#/istiara")?>"> <?=lang('ist_timeover_list')?></a>
	<a class="uk-button uk-button-small uk-button-default" href="<?=site_url("admin/Istiarat/creat_word/")?>"> <?=lang('notify_file_for_mustairin')?> </a>
	</p>
</div>
<?php endif ; ?>
<?php if(is_right('backup_db')): ?>
<?php if($days_left_to_backup<=0 and $stt['backup_notify']!=0): ?>
<div class="uk-alert-warning" uk-alert style="border-right: 8px solid #FF5722;">
   
    <p style="color: #ff5722;"><?=sprintf(lang('backup_notify_msg'),$stt['backup_last_time'])?> 
	
	
	<a class="uk-button uk-button-small uk-button-default" href="<?=site_url("admin/backup/")?>"> <?=lang('creat_backup_copy')?> </a>
	</p>
</div>
<?php endif ; ?>
<?php endif ; ?>
<div class="uk-grid uk-grid-divider uk-grid-medium uk-child-width-1-2 uk-child-width-1-4@l uk-child-width-1-5@xl" data-uk-grid>

						<div>
							<span class="uk-text-small"><span data-uk-icon="icon:copy" class="uk-margin-small-left uk-text-primary"></span><?=lang('total_books')?></span>
							<h1 class="uk-heading-primary uk-margin-remove  uk-text-primary"><?=dbNum('id','books')?></h1>
							<div class="uk-text-small">
								
							</div>
						</div>
						<div>
							
							<span class="uk-text-small"><span data-uk-icon="icon:user" class="uk-margin-small-left uk-text-primary"></span><?=lang('total_muallifeen_and_muhaqqiqin')?></span>
							<h1 class="uk-heading-primary uk-margin-remove uk-text-primary"><?=dbNum('id','muallifeen')?></h1>
							
							
						</div>
						<div>
							
							<span class="uk-text-small"><span data-uk-icon="icon:album" class="uk-margin-small-left uk-text-primary"></span><?=lang('total_ist')?></span>
							<h1 class="uk-heading-primary uk-margin-remove uk-text-primary"><?=dbNum('id','istiarah')?></h1>
							
							
						</div>
						
		<div>
							
							<span class="uk-text-small"><span data-uk-icon="icon:users" class="uk-margin-small-left uk-text-primary"></span><?=lang('total_members')?></span>
							<h1 class="uk-heading-primary uk-margin-remove uk-text-primary"><?=dbNum('id','members')?></h1>
							
							
						</div>
						
					</div>
					<hr>
					<div class="uk-grid uk-grid-medium uk-grid-match" data-uk-grid>
						
						<!-- panel -->
						<div class="uk-width-1-2@s uk-width-1-3@l uk-width-1-4@xl">
							<div class="uk-card uk-card-default uk-card-small uk-card-hover">
								<div class="uk-card-header">
									
										<h4 class="uk-margin-remove-bottom"><?=$stt['mktb_name']?></h4>
										
									
								</div>
								<div class="uk-card-body">
									
									<center><img style='max-width:250px; max-height:250px' src="<?=soft_image(stt("mktb_logo"),'logos/logo_sqr.png')?>"></center>
									<ul class="uk-list uk-list-divider">
					<li ><b><?=lang('version')?> </b>: <?=VERSION?></li>
					<li><b> <?=lang('app_type')?></b>: <?=is(APP_TYPE=='f',lang('free')." <a href='".SHIRA_URL."' target='_blank' class='uk-button uk-button-small uk-button-default'>".lang('talab_shira')."</a>",lang('madfoo'))?> </li>
				
				</ul>	
								</div>
							</div>
						</div>
						<!-- /panel -->
<!-- panel -->
						<div class="uk-width-2-3@l uk-width-1-2@xl">
							<div class="uk-card uk-card-default uk-card-small uk-card-hover">
								<div class="uk-card-header">
									<h4 class="uk-margin-remove-bottom"><?=lang('timeover_istiarat')?> </h4>
								</div>
								<div class="uk-card-body">
								<?php if(count($ist_timeover)>0): ?>
								<div class="uk-overflow-auto">
<table class="uk-table uk-table-hover uk-table-divider uk-table-middle uk-table-small">
		<thead>
			<tr>
				<th><?=lang('book_id')?></th>
				<th><?=lang('book_name')?></th>
				<th><?=lang('mujallad')?></th>
				<th><?=lang('mustair')?></th>
				<th><?=lang('ist_date')?> </th>
			</tr>
		</thead>
		<tbody>
				<?php foreach ($ist_timeover as $it): ?>
			<tr>
				<td><?=$it['book_id']?></td>
				<td><?=$it['book_title']?></td>
				<td><?=$it['mujallad']?></td>
				<td><?=$it['member_name']?></td>
				<td><?=$it['date']?></a></td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
</div>
		<?php else: ?>	
<div class="uk-alert-info" uk-alert>
  <p><?=lang('list_empty')?></p>
</div>
		<?php endif; ?>						
								
								
									</div>
							</div>
						</div>
						<!-- /panel -->						
					</div>
					