<?=getHead($data)?>
<?=getHeader($data)?>
	<!-- Page container -->
	<div class="page-container">
		<!-- Page content -->
		<div class="page-content">
			<?=getSidebar($data)?>

			<!-- Main content -->
			<div class="content-wrapper">
				<!-- Page header -->
				<?php
				$data[ 'title_class' ] = $data[ 'basic' ][ 'grup' ][ 'val' ];
				?>
				<?=getPageHeader($data,$data['basic']['ad']['val'])?>
				<!-- /page header -->

				<!-- Content area -->
				<div class="content">
					<!-- Select2 selects -->
					<?=getAlerts()?>
					<?php if($data['basic']){ ?>
					<!-- Tabs with solid background -->
					<div class="row">
						<div class="col-md-12">
							<div class="panel panel-flat">
								<div class="panel-body">
									<div class="tabbable">
										<ul class="nav nav-tabs nav-tabs-solid">
											<li class="active">
												<a href="#solid-tab1" data-toggle="tab">
													<?=t_('Öğrenci Bilgileri')?>
												</a>
											</li>
											<li class="">
												<a href="#solid-tab2" data-toggle="tab">
													<?=t_('Öğrenci Hesap Hareketleri')?>
												</a>
											</li>
											<li class="">
												<a href="#solid-tab3" data-toggle="tab">
													<?=t_('Öğrenci Geçmişi')?>
												</a>
											</li>
											<li class="">
												<a href="#solid-tab4" data-toggle="tab">
													<?=t_('Öğrenci Yoklama')?>
												</a>
											</li>
											<li class="">
												<a href="#solid-tab5" data-toggle="tab">
													<?=t_('Log Kaydı')?>
												</a>
											</li>
										</ul>
										<div class="tab-content">

											<div class="tab-pane active" id="solid-tab1">
												<form class="form-horizontal form-validate-jquery ajaxform" f="saveBasic" c="callBack" action="#" role="form" method="post" enctype="multipart/form-data">
													<fieldset class="content-group">
														<?php
														foreach ( $data[ 'basic' ] as $key => $element ) {
															if ( $data[ 'basic' ][ 'state' ][ 'val' ] == 2 && $key == 'state' )$element[ 'type' ] = 'hidden';

															getFormElement( $element, 'basic' );
														}
														?>
													</fieldset>
													<div class="form-group">
														<?=formToken($data['module'])?>
														<?php if($data['basic']['state']['val']==1){ ?>
														<button type="button" class="btn btn-warning gecmis pull-left" data-value="2">
															<?=t_('Ara Ver')?><i class="icon-arrow-right14 position-right"></i>
														</button>
														<?php } elseif($data['basic']['state']['val']==2) { ?>
														<button type="button" class="btn btn-success gecmis pull-left" data-value="1">
															<?=t_('Yeniden Başlat')?><i class="icon-arrow-right14 position-right"></i>
														</button>
														<?php } ?>
														<button type="submit" class="btn btn-primary submit pull-right">
															<?=t_('Save')?><i class="icon-arrow-right14 position-right"></i>
														</button>
													</div>
												</form>
												<script>
													$( '#sinif' ).change( function () {
														var sinif = $( this ).val();

														if ( sinif == '0' ) {
															$( '#hoca' ).parents( '.form-group' ).show();
															$( '#hoca' ).removeAttr( 'disabled' );
														} else {
															$( '#hoca' ).val( 0 ).change();
															$( '#hoca' ).attr( 'disabled', 'disabled' );
														}
													} )
													$( '#sinif' ).change();
													$( '.ucret_hesapla' ).change( function () {
														makePopup( 'Hesaplama', 'Ücret Yeniden Hesaplansın mı?', 'javascript:hesapla();' );
													} );

													function hesapla() {
														var id = $( '#basic_id' ).val();
														var ucret = $( '#kurs_ucreti' ).val();
														var indirim = $( '#indirim_kategori' ).val();
														$.ajax( {
															url: site_url + "ajax/ucret_hesapla?id=" + id + "&ucret=" + ucret + "&indirim=" + indirim,
															success: function ( data ) {
																$( "#basic_net_ucret" ).val( data );
																close_popup();
															}
														} );
													}
													$( '#grupta-kimler-var' ).click( function () {
														var id = $( '#ogrenci_grubu' ).val();
														$.ajax( {
															url: site_url + "ajax/grupta_kimler_var?id=" + id,
															cache: false,
															success: function ( data ) {
																makePopup( 'Grup Üyeleri', data );
															}
														} );
													} );
													$( 'button.gecmis' ).click( function () {
														$( '#panel-gecmis' ).fadeToggle( 500 );
														$( '#gecmis_durum' ).val( $( this ).attr( 'data-value' ) );
													} );
												</script>
												<div id="panel-gecmis" class="row" style="display:none;">
													<div class="col-md-12">
														<div class="panel panel-flat">
															<div class="panel-body">
																<form class="form-horizontal form-validate-jquery" f="saveBasic" c="callBack" action="<?=getSubUrl('ogrenciler/gecmis?id='.theBasicId($data),1)?>" role="form" method="post" enctype="multipart/form-data">

																	<fieldset class="content-group">
																		<?php
																		foreach ( $data[ 'gecmis' ] as $key => $element ) {
																			getFormElement( $element, 'gecmis' );
																		}
																		?>
																	</fieldset>
																	<div class="form-group">
																		<button type="submit" class="btn btn-success submit pull-right">
																			<?=t_('Save')?><i class="icon-arrow-right14 position-right"></i>
																		</button>
																	</div>

																</form>
															</div>
														</div>
													</div>
												</div>
											</div>
											<div class="tab-pane" id="solid-tab2">
												<?php if(theBasicId($data)==0){?> Öncelikle kaydı tamamlayınız...
												<?php } else { ?>
<div class="table-responsive">
									<table>
										
										<tbody>
											<tr>	
												<td><span class="text-muted">Alacak</span></td>
												<td>:</td>
												<td><h6 class="text-semibold"><?=$data['toplam_alacak']?></h6></td>
											</tr>
											<tr>	
												<td><span class="text-muted">Tahsilat</span></td>
												<td>:</td>												
												<td><h6 class="text-semibold"><?=$data['toplam_tahsilat']?></h6></td>
											</tr>
											<tr>	
												<td><span class="text-muted">Sonuç</span></td>
												<td>:</td>												
												<td><h6 class="text-semibold"><?=($data['toplam_alacak']-$data['toplam_tahsilat'])?></h6></td>
											</tr>
											
										</tbody>
									</table>
								</div>												
												
												<div id="panel-hesap" class="row">
													<div class="col-md-12">
														<div class="panel panel-flat">
															<div class="panel-body">
																<form class="form-horizontal form-validate-jquery" action="<?=getSubUrl('ogrenciler/odeme?id='.theBasicId($data),1)?>" role="form" method="post" enctype="multipart/form-data">

																	<fieldset class="content-group">
																		<?php
																		foreach ( $data[ 'hesaplar' ] as $key => $element ) {
																			if ( $key == 'tip' )$element[ 'type' ] = 'hidden';
																			getFormElement( $element, 'hesaplar' );
																		}
																		?>
																	</fieldset>
																	<div class="form-group text-right">
																		<button type="submit" class="btn btn-success submit" name="hesaplar[tip]" value="T">
																			<?=t_('Tahsilat Yap')?><i class="icon-arrow-right14 position-right"></i>
																		</button>&nbsp;
																		<button type="submit" class="btn btn-warning submit" name="hesaplar[tip]" value="A">
																			<?=t_('Alacak Ekle')?><i class="icon-arrow-right14 position-right"></i>
																		</button>
																	</div>

																</form>
															</div>
														</div>
													</div>
												</div>
												<?=make_table(theBasicId($data), $data['module'], $data['hesaplistesi'], 'id;tarih;tur;tip;tutar;aciklama','Öğrenci Hesap Çizelgesi','tip')?>
												<?php } /*End  if(theBasicId($data)==0)*/?>
											</div>
											<div class="tab-pane" id="solid-tab3">
												<?php if(theBasicId($data)==0){?> Öncelikle kaydı tamamlayınız...
												<?php } else { ?>
												<?=make_table(theBasicId($data), $data['module'], $data['gecmisler'], 'id;tarih;aciklama;durum','Öğrenci Devam Tablosu')?>
												<?php } /*End  if(theBasicId($data)==0)*/?>
											</div>
											<div class="tab-pane" id="solid-tab4">
												Yoklama kaydı bulunamadı
											</div>
											<div class="tab-pane" id="solid-tab5">
												Log kaydı bulunamadı
											</div>

										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- /tabs with solid background -->
					<?php
					} else {
						echo t_( 'Record not found' );
					}
					?>
					<!-- /select2 selects -->
					<style>
						.row-A {
							color: #F00;
						}
						.row-T {
							 color: #4CAF50;;
						}
					</style>
					<?=getFooter()?>
				</div>
				<!-- /content area -->
			</div>
			<!-- /main content -->
		</div>
		<!-- /page content -->
	</div>
	<!-- /page container -->