<?php
$page = basename($_SERVER["PHP_SELF"]);
$heder = "Odeljenja";
$mali = " > podaci o odeljenjima";
include('../../xcrud/xcrud.php');
Xcrud_config::$jquery_no_conflict = true; // jquery conflicts with SyntaxHighlighter
//odavde idu komnade ka xcrud-u
$xcrud1 = Xcrud::get_instance();
$xcrud1->table('department');
$xcrud1->table_name('Odeljenja');
$xcrud1->relation('staff_id','users','id',array('fname','lname','userlevel'),'users.userlevel > 1','','true');
$xcrud1->relation('slot_id','slot','slot_id','name','','','true');
$xcrud1->columns('name,staff_id,slot_id');
$xcrud1->fields('name,staff_id');
$xcrud1->label('name','Odeljenje');
$xcrud1->label('staff_id','Serviser');
$xcrud1->label('slot_id','Aparati');
$xcrud1->unset_search();



?>

<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
<?php echo $heder;?><small><?php echo $mali;?></small>
</h3>
<div class="page-bar">
	<ul class="page-breadcrumb">
		<li>
			<i class="fa fa-home"></i>
			<a href="index.php">Home</a>
			<i class="fa fa-angle-right"></i>
		</li>
		<li>
			<a href="#"><?php echo $heder;?></a>
		</li>
	</ul>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
	<div class="col-md-12">
	

	<?php echo $xcrud1->render(); ?>
	<div class="note note-success">
			<h4 class="block">Objašnjenje</h4>
			<p>
				 Na ovoj strani dodajete odeljenja u sistem.
			</p>
			<p>
				Kada kreirate odeljenje, dodajte mu odgovarajućeg servisera, kome će biti slani mailovi o prijavama i izmenama statusa kvara.
			</p>
	</div>
	</div>
</div>
<script type="text/javascript">
jQuery(document).on("xcrudafterrequest",function(event,container){
    if(Xcrud.current_task == 'save')
    {
     Metronic.alert({
     place: 'append', // append or prepent in container 
     type: 'success',  // bootstrap state classes
     message: 'Uspešno kreirano odeljenje ili update podatka!',  // alert's message
     close: true, // make alert closable
     reset: true, // close all previouse alerts first
     focus: true, // auto scroll to the alert after shown
     closeInSeconds: 5, // auto close after defined seconds
     icon: 'check' // put font awesome icon before the message
	});
    }
});
</script>
<!-- END PAGE CONTENT-->


