<?php
 define("_VALID_PHP", true);
 require_once("../../init.php");
$page = basename($_SERVER["PHP_SELF"]);
$heder = "Prijava kvara";
$mali = " > forma za prijavu";
$korisnik = $user->username;
$lokal = $user->fname;
$prezime = $user->lname;
$koje = $user->name;
//echo $koje;
$ip = $_SERVER['REMOTE_ADDR']; 
$kome = $user->sendto;
$id_user = $user->uid;
$dept = $user->todept;
//echo $id_user;
//echo $dept;
$firma = $user->country;
$upit = 'manager REGEXP "[[:<:]]'.$id_user.'[[:>:]]"';
$upits = 'serviser REGEXP "[[:<:]]'.$id_user.'[[:>:]]"';
//echo $upit;
	
include('../../xcrud/xcrud.php');
Xcrud_config::$jquery_no_conflict = true; // jquery conflicts with SyntaxHighlighter
//odavde idu komnade ka xcrud-u
$xcrud = Xcrud::get_instance();
$xcrud->table('cw_tickets');
$xcrud->table_name('Pregled svih kvarova');
$xcrud->columns('lokal,department,aparat,broj,category,opis,vreme_open,vreme_close,status,ser_resio,ser_punoime');
$xcrud->label(array('department' => 'Odeljenju','aparat' => 'Aparat','broj' => 'Broj','opis' => 'Opis kvara','vreme_open' => 'Prijavljen','vreme_close' => 'Popravljen','category' => 'Kategorija'));
$xcrud->validation_pattern('broj','integer');
$xcrud->order_by('vreme_open','DESC');
$xcrud->highlight('status', '=', 1, '#E56B6A');
$xcrud->highlight('status', '=', 0, '#dff0d8');
$xcrud->highlight('ser_resio', '=', 1, '#45B6AF');
$xcrud->highlight('ser_been', '=', 1, '#FFB848');
$xcrud->change_type('status','select','',array(1=>'Zatvoren',0=>'Otvoren'));
$xcrud->unset_remove();
$xcrud->unset_add();
?>
<!-- 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>
	<div id="alert_green">
	</div>
	<!-- END PAGE HEADER-->
	<!-- BEGIN PAGE CONTENT-->
	<div class="row">
	
	<div class="col-md-12">
	<?php echo $xcrud->render(); ?>

	</div>
</div>
<!-- END PAGE CONTENT-->
<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šna prijava/popravak kvara!!!',  // 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: 7, // auto close after defined seconds
     icon: 'check' // put font awesome icon before the message
	});
    }
});
</script>

