287 lines
13 KiB
PHP
287 lines
13 KiB
PHP
@extends('layouts.app_operasi')
|
|
|
|
@section('content')
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
|
|
<nav aria-label="breadcrumb">
|
|
<ol class="breadcrumb pb-3">
|
|
<li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
|
|
<li class="breadcrumb-item active" aria-current="page">Kakitangan</li>
|
|
</ol>
|
|
</nav>
|
|
|
|
<div class="card-body text-center">
|
|
<form action="{{ route('kakitangan.baru') }}" method="post" onsubmit="return verifyregister()">
|
|
@csrf
|
|
<div class='row form-group'>
|
|
<div class='col-md-6'>
|
|
<div class='form-group row col-md-12'>
|
|
<div class='col-md-5'>
|
|
<b>Nama</b>
|
|
</div>
|
|
<div class='col-md-7'>
|
|
<input type="text" name='nama' id='nama' value="" class='form-control'>
|
|
</div>
|
|
</div>
|
|
<div class='form-group row col-md-12'>
|
|
<div class='col-md-5'>
|
|
<b>Email</b>
|
|
</div>
|
|
<div class='col-md-7'>
|
|
<input type="text" name='email' id='email' value="" class='form-control'>
|
|
</div>
|
|
</div>
|
|
<div class='form-group row col-md-12'>
|
|
<div class='col-md-5'>
|
|
<b>Cawangan</b>
|
|
</div>
|
|
<div class='col-md-7'>
|
|
@php
|
|
$cawangan_all = Http::get($api_url . '/api/cawangan')->json();
|
|
@endphp
|
|
<select class="form-control" name="cawangan" data-placeholder="Pilih Cawangan" id="cawangan">
|
|
<option disabled selected value> -- Pilih Cawangan -- </option>
|
|
<option value="operasi">Operasi</option>
|
|
@foreach($cawangan_all as $cawangan)
|
|
<option value="{{ $cawangan['kodcaw'] }}">{{ $cawangan['details_caw'] }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='col-md-6'>
|
|
<div class='form-group row col-md-12'>
|
|
<div class='col-md-5'>
|
|
<b>No KP</b>
|
|
</div>
|
|
<div class='col-md-7'>
|
|
<input type="text" name='nokp' id='nokp' value="" class='form-control'>
|
|
</div>
|
|
</div>
|
|
<div class='form-group row col-md-12'>
|
|
<div class='col-md-5'>
|
|
<b>No Telefon</b>
|
|
</div>
|
|
<div class='col-md-7'>
|
|
<input type="text" name='telefon' id='telefon' value="" class='form-control'>
|
|
</div>
|
|
</div>
|
|
<div class='form-group row col-md-12'>
|
|
<div class='col-md-5'>
|
|
<b>Jawatan</b>
|
|
</div>
|
|
<div class='col-md-7'>
|
|
<select class="form-control" name="role" data-placeholder="Pilih Jawatan" id="role">
|
|
<option disabled selected> -- Pilih Jawatan -- </option>
|
|
@foreach($role as $roles)
|
|
<option value="{{ $roles['role_code'] }}">{{ $roles['keterangan'] }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class='row justify-content-end'>
|
|
<div class='col-md-12'>
|
|
<input type="submit" class='btn btn-info float-right mr-5' value='Daftar'>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
<div class="card-header">{{ __('Senarai Kakitangan') }}</div>
|
|
<div class="card-body text-center">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<table id="rekod_kakitangan" class="table table-striped table-hover">
|
|
<thead class="thead-dark">
|
|
<tr>
|
|
<th>Bil</th>
|
|
<th>Nama Staff</th>
|
|
<th>Jawatan</th>
|
|
<th>Cawangan</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($kakitangan as $index=>$staff)
|
|
<tr>
|
|
<td>{{ $loop->iteration }}</td>
|
|
<td>{{ $staff->name }}</td>
|
|
<td>{{ strtoupper($staff->roles) }}</td>
|
|
<td>
|
|
@if($staff->cawangan == 'operasi')
|
|
{{ ucwords($staff->cawangan) }}
|
|
@else
|
|
@php
|
|
$cawangan_staff = Http::get(config('api.url') . '/api/cawangan/'. $staff->cawangan)->json();
|
|
echo ucwords($cawangan_staff['details_caw']);
|
|
@endphp
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<a href="{{ route('kakitangan.tukartaraf',['id'=>$staff->id]) }}" class="btn btn-warning" title="Tukar Taraf"><i class="material-icons">edit</i></a>
|
|
<a href="{{ route('kakitangan.tukarcawangan',['id'=>$staff->id]) }}" class="btn btn-info" title="Tukar Cawangan"><i class="material-icons">work</i></a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
|
|
var tablerekod = $('#rekod_kakitangan').DataTable();
|
|
|
|
function verifyregister(){
|
|
var cawangan = $('#cawangan').val();
|
|
var role = $('#role').val();
|
|
var nama = $('#nama').val();
|
|
var email = $('#email').val();
|
|
var nokp = $('#nokp').val();
|
|
var telefon = $('#telefon').val();
|
|
if (cawangan == null){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Pilih Cawangan Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}
|
|
if (role == null){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Pilih Jawatan Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}
|
|
if(cawangan == 'operasi'){
|
|
if(role != 'operasi'){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Jawatan Tidak Sah'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}
|
|
}else{
|
|
if(role == 'operasi'){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Jawatan Tidak Sah'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}
|
|
}
|
|
if(nama == ''){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Masukan Nama Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(nokp == ''){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Masukan No KP Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(isNaN(nokp) == true){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Masukan Hanya Nombor Pada No KP Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(nokp.length != 12){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Periksa No KP Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) == false){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Periksa Email Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(telefon == ''){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Masukan No Telefon Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(isNaN(telefon) == true){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Masukan Hanya Nombor Pada No Telefon Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(telefon.length <= 9 || telefon.length >= 12){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Periksa No Telefon Kakitangan'
|
|
});
|
|
event.preventDefault();
|
|
return false;
|
|
}else{
|
|
if(cawangan == null){
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Amaran!',
|
|
text: 'Sila Pilih Cawangan Kakitangan'
|
|
});
|
|
}else{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
@endsection
|