@if($setting['form-method'] =='native')
<div class="card">
	<div class="card-body">
@endif
		<div class="form-ajax-box">
		{!! Form::open(array('url'=>'penggunatma?return='.$return, 'class'=>'form-vertical  sximo-form validated','files' => true , 'parsley-validate'=>'','novalidate'=>' ','id'=> 'penggunatmaFormAjax')) !!}

			<div class="toolbar-nav">	
				<div class="row">	
					
					<div class="col-md-6">
						<a href="javascript://ajax" onclick="ajaxViewClose('#{{ $pageModule }}')" class="tips btn btn-sm btn-danger  " title="{{ __('core.btn_back') }}" ><i class="fa  fa-times"></i></a>
					</div>
					<div class="col-sm-6 text-right">	
						<div class="btn-group">
							<button type="submit" class="btn btn-sm  btn-primary " name="apply"> {{ Lang::get('core.sb_apply') }} </button>
							<button type="submit" class="btn btn-sm btn-success" name="save">  {{ Lang::get('core.sb_save') }} </button>
						</div>	
					</div>	
							
				</div>
			</div>	
				<div class="row">

			
			<div class="col-md-6">
						<fieldset><legend> </legend>
				{!! Form::hidden('id', $row['id']) !!}					
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Group Id    </label>									
										  <select name='group_id' rows='5' id='group_id' class='select2 '   >
											<option value="3" @if($row['group_id'] == 3) selected="selected" @endif >Users</option>
										 	<option value="6" @if($row['group_id'] == 6) selected="selected" @endif >Manajer</option>
											<option value="8" @if($row['group_id'] == 8) selected="selected" @endif >General Manajer</option>
											<option value="12" @if($row['group_id'] == 12) selected="selected" @endif >Afdeling</option>
											<option value="13" @if($row['group_id'] == 13) selected="selected" @endif >Petugas POS</option>
											<option value="15" @if($row['group_id'] == 15) selected="selected" @endif >TMA</option>
											<option value="17" @if($row['group_id'] == 17) selected="selected" @endif >Petugas Selektor</option>
											<option value="19" @if($row['group_id'] == 19) selected="selected" @endif >BOD dan SEVP</option>
										  </select> 						
									  </div> 					
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Username    </label>									
										  <input  type='text' name='username' id='username' value='{{ $row['username'] }}' 
						     class='form-control form-control-sm ' /> 						
									  </div> 					
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Password    </label>									
										  <input  type='password' name='password' id='password' value='' 
						     class='form-control form-control-sm ' /> 						
									  </div> 					
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> First Name    </label>									
										  <input  type='text' name='first_name' id='first_name' value='{{ $row['first_name'] }}' 
						     class='form-control form-control-sm ' /> 						
									  </div> 					
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Last Name    </label>									
										  <input  type='text' name='last_name' id='last_name' value='{{ $row['last_name'] }}' 
						     class='form-control form-control-sm ' /> 						
									  </div> {!! Form::hidden('last_login', $row['last_login']) !!}{!! Form::hidden('createdOn', $row['createdOn']) !!}{!! Form::hidden('updatedOn', $row['updatedOn']) !!}{!! Form::hidden('remember_token', $row['remember_token']) !!}{!! Form::hidden('active', $row['active']) !!}</fieldset></div><div class="col-md-6">
						<fieldset><legend> </legend>
									
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Rayon    </label>									
										  <select name='rayon' rows='5' id='rayon' class='select2 '   ></select> 						
									  </div> 					
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Nik    </label>									
										  <input  type='text' name='nik' id='nik' value='{{ $row['nik'] }}' 
						     class='form-control form-control-sm ' /> 						
									  </div> 
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Kategori    </label>									
											<select name='kategori' class='form-control form-control-sm ' >
												<option value='pos' @if($row['kategori'] == 'pos') selected="selected" @endif > Pos </option>
												<option value='kebun' @if($row['kategori'] == 'kebun') selected="selected" @endif > Kebun </option>
												<option value='kantor kebun' @if($row['kategori'] == 'kantor kebun') selected="selected" @endif > Kantor Kebun </option>
												<option value='ho' @if($row['kategori'] == 'ho') selected="selected" @endif > HO </option>
											</select>
									  </div> 
									  <div class="form-group  " >
										<label for="ipt" class=" control-label "> Lokasi    </label>									
											<select name='lokasi' id='lokasi' class='form-control form-control-sm select2' >
											</select>
									  </div> 
									  
									</fieldset></div>									
				
			<input type="hidden" name="action_task" value="save" />				
						


			

			
		{!! Form::close() !!}
		</div>

@if($setting['form-method'] =='native')

	</div>
</div>
@endif

@include('sximo.module.template.ajax.formjavascript')

<script type="text/javascript">
$(document).ready(function() { 
		
		$("#rayon").jCombo("{!! url('penggunatma/comboselect?filter=master_rayon:kode_rayon:nama_rayon') !!}",
		{  selected_value : '{{ $row["rayon"] }}' });
		
		$("#lokasi").jCombo("{!! url('penggunatma/comboselect?filter=master_pos_keluar:id:nama_pos') !!}",
		{  selected_value : '{{ $row["lokasi"] }}' });
		 
	$(".select2").select2({ width:"100%" , dropdownParent: $('#sximo-modal')});
	 
				
	var form = $('#penggunatmaFormAjax'); 
	form.parsley();
	form.submit(function(){
		
		if(form.parsley().isValid()){			
			var options = { 
				dataType:      'json', 
				beforeSubmit :  function(){
				},
				success: function(data) {
					if(data.status == 'success')
					{
						ajaxViewClose('#{{ $pageModule }}');
						var table = $('#penggunatmaTable').DataTable();
						table.ajax.reload();
						notyMessage(data.message);	
						$('#sximo-modal').modal('hide');	
					} else {
						notyMessageError(data.message);	
						return false;
					}
				}  
			}  
			$(this).ajaxSubmit(options); 
			return false;
						
		} else {
			return false;
		}		
	
	});

});

</script>		 