<?php
	$now = @$this->uri->segment(3);
?>
<div class="panel panel-default">
	<div class="panel-heading">
		<div class="row">
			<div class='col-sm-6'><?php echo $judul;?></div>
			<div class='col-sm-6' align='right'>

			</div>
		</div>
	</div>
	<?php
	if(isset($_GET['s'])){
		switch($_GET['s']){
			case "true" : $c="success"; break;
			case "false": $c="danger"; break;
		}
			echo"
			<br>
			<div class='container' style='width:100%;'><div class='row'><div class='col-md-12'>
			<div class='alert alert-$c' role='alert'>
				<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>
				<span class='sr-only'>Error:</span>
				$_GET[m]
			</div></div></div>
			</div>
			";
	}
	?>	
	<form action="<?=base_url()?>cms/logic/invoiceProses" method="post" data-parsley-validate enctype="multipart/form-data">
		<div class="panel-body"> 
			<?php if(isset($data['id_invoice']) && $data['id_invoice'] != ''): ?>
				<input type="hidden" name="_id" value="<?=$data['id_invoice']?>" />
				<input type="hidden" name="action" value="edit" /> 
			<?php endif; ?> 

			<div class="form-group">
				<div class="row">
					<div class="col-sm-2">
						<label class="control-label">Nama<span class="text-danger">*</span></label>
					</div>
					<div class="col-sm-7"> 
						<input type='text' class='form-control'  name='nama' value='<?=(isset($data['nama']) ? $data['nama'] : '')?>' required>
					</div>
				</div>
			</div>			
			<div class="form-group">
				<div class="row">
					<div class="col-sm-2">
						<label class="control-label">Hp</label>
					</div>
					<div class="col-sm-3"> 
						<input type='text' class='form-control'  name='hp' value='<?=(isset($data['hp']) ? $data['hp'] : '')?>' >
					</div>
				</div>
			</div>			
			<div class="form-group">
				<div class="row">
					<div class="col-sm-2">
						<label class="control-label">Alamat </label>
					</div>
					<div class="col-sm-7"> 
						<input type='text' class='form-control'  name='alamat' value='<?=(isset($data['alamat']) ? $data['alamat'] : '')?>' >
					</div>
				</div>
			</div>			
			<div class="form-group">
				<div class="row">
					<div class="col-sm-2">
						<label class="control-label">Email</label>
					</div>
					<div class="col-sm-3"> 
						<input type='email' class='form-control'  name='email' value='<?=(isset($data['email']) ? $data['email'] : '')?>' >
					</div>
				</div>
			</div>			
			<div class="form-group">
				<div class="row">
					<div class="col-sm-2">
						<label class="control-label">Tanggal<span class="text-danger">*</span></label>
					</div>
					<div class="col-sm-3"> 
						<input type='text' class='form-control datepicker' data-date-format='yyyy-mm-dd'  name='tanggal' value='<?=(isset($data['tanggal']) ? $data['tanggal'] : date("Y-m-d"))?>' >
					</div>
				</div>
			</div>
			<?php if(isset($data['id_invoice']) && $data['id_invoice'] != ''){}else{ ?>
				<div class="form-group">
					<div class="row">
						<div class="col-sm-2">
							<label class="control-label">Tiket </label>
						</div>
						<div class="col-sm-7"> 
							<textarea class='form-control tinymce-editoradv' rows='3' name='deskripsi'  ><?=(isset($data['deskripsi']) ? $data['deskripsi'] : '')?></textarea>
						</div>
					</div>
				</div>			
				<div class="form-group">
					<div class="row">
						<div class="col-sm-2">
							<label class="control-label">Harga </label>
						</div>
						<div class="col-sm-4"> 
							<input type='text' class='form-control number kali' id='harga' name='harga' value='<?=(isset($data['harga']) ? $data['harga'] : '0')?>' required>
						</div>
					</div>
				</div>			
				<div class="form-group">
					<div class="row">
						<div class="col-sm-2">
							<label class="control-label">Qty </label>
						</div>
						<div class="col-sm-3"> 
							<input type='text' class='form-control number kali' id='qty' name='qty' value='<?=(isset($data['qty']) ? $data['qty'] : '1')?>' required>
						</div>
					</div>
				</div>	
				<div class="form-group">
					<div class="row">
						<div class="col-sm-2">
							<label class="control-label">Total </label>
						</div>
						<div class="col-sm-3"> 
							<b id='totala'>0</b>
							<input type='hidden' class='form-control number' id='total'  name='total' value='<?=(isset($data['total']) ? $data['total'] : '0')?>' required>
						</div>
					</div>
				</div>	
			
			<?php }?>
		</div> 
		<div class="panel-footer">
			<button type="submit" onclick=" " class="btn btn-primary"><?php if(isset($data['id_invoice']) && $data['id_invoice'] != ''){ echo "Update";}else{echo "Submit";} ?></button>
			<a href='<?=$url?>invoice' class='btn btn-default'>Back</a> 
		</div>
	</form>
</div>
<style>
#mce_15, #mce_20,#mce_29-body{display:none;}
</style>
<script> 
</script>