Commit 141316c3 authored by Michael Ngei's avatar Michael Ngei

updated

parent 71928513
......@@ -15,12 +15,13 @@ class BirthModal extends Component
{
protected $listeners = ['openBirthModal'];
public $human;
public $birth_human;
public $hasRole = false;
public $role;
public $isOpen = false;
public $docums;
public $serialNum='';
public $birth_docums;
public $birth_serialNum='';
public $birth_familyrelation;
public function mount()
{
/** @var Auth $user current logged-in user */
......@@ -46,15 +47,14 @@ class BirthModal extends Component
public function openBirthModal($data): void
{
$entryNum= $data['entry_num'];
$birth_human = $this->getHumanBirth($entryNum);
if($birth_human){
$this->human = $birth_human[0];
$this->docums = $birth_human[1];
$this->familyrelation = $birth_human[2];
$this->serialNum = $data['entry_num'];
$birth= $this->getHumanBirth($entryNum);
if($birth){
$this->birth_human = $birth[0];
$this->birth_docums = $birth[1];
$this->birth_familyrelation = $birth[2];
$this->isOpen = true;
$this->birth_serialNum = $data['entry_num'];
}
$this->isOpen = true;
}
/*public function placeholder()
......@@ -63,7 +63,7 @@ class BirthModal extends Component
}*/
public function closeModal()
{
$this->isOpen = false;
// $this->isOpen = false;
}
private function getHumanBirth($entry_num)
......
......@@ -72,7 +72,9 @@ class Searchform extends Component
break;
case 'Birth' :
if(!empty($this->searchBirthEntryNum)){
$this->search_count = 0;
$this->getBirthHuman();
}else{
session()->flash('error', 'Birth entry number not provided');
}
......@@ -232,24 +234,32 @@ class Searchform extends Component
}else{
session()->flash('error', 'Search parameter is missing..');
}*/
$rid = Docum::where('ser_num', '=', $this->searchBirthEntryNum)->value('rid_h');
if($rid){
$human = Human::where('rid','=', $rid)->whereColumn('rid', 'pid')
->get(['rid', 'pid', 'name', 'surn', 'last_name', 'sex', 'date_birth', 'date_death', 'o_pid']);
// dd($human);
if($human->isEmpty()){
throw new ModelNotFoundException('No record found');
}else{
$this->search_count=1;
$this->doctype ='Birth';
$this->records_found[]=$this->searchBirthEntryNum;
$this->serial_number[]=$this->searchBirthEntryNum;
$this->humans[] = $human;
$this->dispatch('viewResults', $this->humans,$this->serial_number,
$this->doctype,$this->records_not_found,
$this->search_count,$this->records_found);
if(!empty($this->searchBirthEntryNum)) {
$this->search_count=1;
$this->records_found=[];
$this->records_not_found=[];
$this->doctype ='Birth';
$rid = Docum::where('ser_num', '=', $this->searchBirthEntryNum)->value('rid_h');
if ($rid) {
$human = Human::where('rid', '=', $rid)->whereColumn('rid', 'pid')
->get(['rid', 'pid', 'name', 'surn', 'last_name', 'sex', 'date_birth', 'date_death', 'o_pid']);
// dd($human);
if ($human->isEmpty()) {
throw new ModelNotFoundException('No record found');
} else {
$this->records_found[] = $this->searchBirthEntryNum;
$this->serial_number[] = $this->searchBirthEntryNum;
$this->humans = $human;
$this->showTableResults();
/* $this->dispatch('viewResults', $this->humans,$this->serial_number,
$this->doctype,$this->records_not_found,
$this->search_count,$this->records_found);*/
}
}
}else{
session()->flash('error', 'Search parameter is missing..');
}
}
......@@ -259,19 +269,20 @@ class Searchform extends Component
*/
public function showTableResults(): void
{
$this->dispatch('viewResults', $this->humans,$this->serial_number,
$this->doctype,$this->records_not_found,
$this->search_count,$this->records_found);
// Clear the search fields
$this->reset([
'docNumber',
'serialNumber',
'passportNum',
'passportIdNum',
'docNumber',
'serialNumber',
'passportNum',
'passportIdNum',
'searchBirthEntryNum'
]);
// For Option 1 only:
$this->showFields = $this->searchcategory;
}
......
......@@ -12,6 +12,7 @@ class Tableresult extends Component
protected $human=[];
public $records_not_found=[];
public $search_count=0;
public $records_found= [];
......@@ -51,7 +52,7 @@ class Tableresult extends Component
$this->dispatch('openPassportModal', ['id'=>$id,'pass_no'=>$pass_no,'doctype'=>$doctype]);
}
public function birthresultsModal($entry_num): void
public function birthresultsModal($entry_num)
{
$decodedId = urldecode($entry_num);
$this->dispatch('openBirthModal', ['entry_num' => $decodedId ]);
......@@ -59,6 +60,7 @@ class Tableresult extends Component
public function render()
{
\Log::info('Rendering Tableresult');
return view('livewire.search.tableresult');
}
/* public function placeholder()
......
......@@ -6,9 +6,9 @@
$modalStatus= 'show';
$modalStyle="display: block;";
}
$fname = $human['name'] ?? '';
$oname = $human['last_name'] ?? '';
$surname = $human['surn'] ?? '';
$fname = $birth_human['name'] ?? '';
$oname = $birth_human['last_name'] ?? '';
$surname = $birth_human['surn'] ?? '';
@endphp
......@@ -56,7 +56,7 @@
<a class="nav-link" id="custom-tabs-five-history-tab" data-toggle="pill"
href="#custom-tabs-five-history" role="tab" aria-controls="custom-tabs-five-history"
aria-selected="false">
Document History
Document History
</a>
@else
<a class="nav-link" id="custom-tabs-five-family-tab" data-toggle="pill" href="#custom-tabs-five-family" role="tab" aria-controls="custom-tabs-five-family" aria-selected="false">
......
......@@ -17,17 +17,17 @@
<div class="row" style="width: 100%;">
@if($role->hasPermissionTo("Basic View Birth Details"))
<div class="col-12 text-center">
@if(isset($human))
@if(isset($birth_human))
<small class="">Birth Entry Number</small>
<h4 class="upi">
{{ $docums[0]['SER_NUM'] }}
{{ $birth_docums[0]['SER_NUM'] }}
</h4>
@else
<div class="skeleton skeleton-text short"></div>
@endif
</div>
<div class="col-12 text-center">
@if(isset($human))
@if(isset($birth_human))
<small class="">Country of Birth</small>
<p class="card-text">KENYA</p>
<span class="fi fi-ke" style="font-size: 2rem;"></span>
......@@ -48,24 +48,24 @@
<div class="row">
<div class="col-6">
<small>First name</small>
@if(isset($human->name))
<p class="field-value">{{ $human->name }}</p>
@if(isset($birth_human->name))
<p class="field-value">{{ $birth_human->name }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
</div>
<div class="col-6">
<small>Sur name</small>
@if(isset($human->surn))
<p class="field-value">{{ $human->surn }}</p>
@if(isset($birth_human->surn))
<p class="field-value">{{ $birth_human->surn }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
</div>
<div class="col-6">
<small>Other name</small>
@if(isset($human->last_name))
<p class="field-value">{{ $human->last_name }}</p>
@if(isset($birth_human->last_name))
<p class="field-value">{{ $birth_human->last_name }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
......@@ -74,16 +74,16 @@
</div>
<div class="col-6">
<small>Date of Birth</small>
@if(isset($human->date_birth))
<p class="field-value">{{ Carbon::parse($human->date_birth)->format("d-m-Y") }}</p>
@if(isset($birth_human->date_birth))
<p class="field-value">{{ Carbon::parse($birth_human->date_birth)->format("d-m-Y") }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
</div>
<div class="col-6">
<small>Gender</small>
@if(isset($human->sex))
<p class="field-value">{{ $human->sex }}</p>
@if(isset($birth_human->sex))
<p class="field-value">{{ $birth_human->sex }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
......@@ -97,10 +97,10 @@
<div class="row">
<div class="col-8">
<small>Mother</small>
@if(isset($docums[0]['M_NAME']))
@if(isset($birth_docums[0]['M_NAME']))
<p class="field-value">
<i class="fas fa-female" style="color: #008500;"></i>
{{ $docums[0]['M_NAME'] }} {{ $docums[0]['M_OTHNAME'] }} {{ $docums[0]['M_SURN'] }}
{{ $birth_docums[0]['M_NAME'] }} {{ $birth_docums[0]['M_OTHNAME'] }} {{ $birth_docums[0]['M_SURN'] }}
</p>
@else
<div class="skeleton skeleton-text short"></div>
......@@ -109,9 +109,9 @@
@if($role->hasPermissionTo("Basic View Birth Mother ID number"))
<div class="col-4">
<small>ID no.</small>
@if(isset($docums[0]['MOTHER_DOC_NUMBER']))
@if(isset($birth_docums[0]['MOTHER_DOC_NUMBER']))
<p class="field-value">
{{ $docums[0]['MOTHER_DOC_NUMBER'] }}
{{ $birth_docums[0]['MOTHER_DOC_NUMBER'] }}
</p>
@else
<div class="skeleton skeleton-text short"></div>
......@@ -120,10 +120,10 @@
@endif
<div class="col-8">
<small>Father</small>
@if(isset($docums[0]['F_NAME']))
@if(isset($birth_docums[0]['F_NAME']))
<p class="field-value">
<i class="fas fa-male" style="color: #008500;"></i>
{{ $docums[0]['F_NAME'] }} {{ $docums[0]['F_OTHNAME'] }} {{ $docums[0]['F_SURN'] }}
{{ $birth_docums[0]['F_NAME'] }} {{ $birth_docums[0]['F_OTHNAME'] }} {{ $birth_docums[0]['F_SURN'] }}
</p>
@else
<div class="skeleton skeleton-text short"></div>
......@@ -131,7 +131,7 @@
</div>
@if($role->hasPermissionTo("Basic View Birth Father ID number"))
<div class="col-4">
@if(isset($docums[0]['F_NAME']))
@if(isset($birth_docums[0]['F_NAME']))
<small>ID no.</small>
-
@endif
......@@ -146,8 +146,8 @@
<div class="row">
<div class="col-6">
<small>District</small>
@if(isset($human->addressBirth->adresComp))
<p class="field-value">{{ $human->addressBirth->adresComp->name }}</p>
@if(isset($birth_human->addressBirth->adresComp))
<p class="field-value">{{ $birth_human->addressBirth->adresComp->name }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
......@@ -179,36 +179,38 @@
<x-adminlte-datatable id="clients-table searchResultsCard" :heads="$headings">
<tr>
<td>
@if(isset($docums[0]['O_PID']))
<p class="field-value">{{ $docums[0]['O_PID'] }}</p>
@if(isset($birth_docums[0]['O_PID']))
<p class="field-value">{{ $birth_docums[0]['O_PID'] }}</p>
@else
-
@endif
</td>
<td>
@if(isset($docums[0]['SER_NUM']))
<p class="field-value">{{ $docums[0]['SER_NUM'] }}</p>
@if(isset($birth_docums[0]['SER_NUM']))
<p class="field-value">{{ $birth_docums[0]['SER_NUM'] }}</p>
@else
<div class="skeleton skeleton-text short"></div>
@endif
</td>
<td>
@if(isset($docums[0]['O_DATE']))
{{ Carbon::parse($human->data_scan)->format("d-m-Y") }}
@if(isset($birth_docums[0]['O_DATE']))
{{ Carbon::parse($birth_human->data_scan)->format("d-m-Y") }}
@else
<div class="skeleton skeleton-text short"></div>
@endif
</td>
<td>
@if(isset($docums[0]['SER_NUM']))
@if(isset($birth_docums[0]['SER_NUM']))
<span class="badge badge-success">
<i class="fa fa-check-circle"></i>Current</span>
<i class="fa fa-check-circle"></i>
Current
</span>
@else
<div class="skeleton skeleton-text short"></div>
@endif
</td>
</tr>
@if(isset($docums))<p>Replaced: <strong>{{ count($docums)-1 }}</strong> times</p>@endif
@if(isset($birth_docums))<p>Replaced: <strong>{{ count($birth_docums)-1 }}</strong> times</p>@endif
</x-adminlte-datatable>
</div>
</div>
......
......@@ -12,28 +12,28 @@
<div class="col-3">
<small>PIN</small>
<p class="field-value user-field-data">
{{ $human->pid ?? '-' }}
{{ $birth_human->pid ?? '-' }}
</p>
</div>
<div class="col-3">
<small>First name</small>
<p class="field-value user-field-data">
{{ $human->name ?? '-' }}
{{ $birth_human->name ?? '-' }}
</p>
</div>
<div class="col-3">
<small>Other names</small>
<p class="field-value user-field-data">
{{ $human->last_name ?? '-' }}
{{ $birth_human->last_name ?? '-' }}
</p>
</div>
<div class="col-3">
<small>Sur name</small>
<p class="field-value user-field-data">
{{ $human->surn ?? '-' }}
{{ $birth_human->surn ?? '-' }}
</p>
</div>
......@@ -43,20 +43,20 @@
<div class="col-3">
<small>ID Number</small>
<p class="field-value user-field-data">
{{ $human->o_pid ?? '-' }}
{{ $birth_human->o_pid ?? '-' }}
</p>
</div>
<div class="col-3">
<small>Gender</small>
<p class="field-value user-field-data">
{{ $human->sex ?? '-' }}
{{ $birth_human->sex ?? '-' }}
</p>
</div>
<div class="col-3">
<small>Date of Birth</small>
<p class="field-value user-field-data">
@if(isset($human->date_birth))
{{ Carbon::parse($human->date_birth)->format("d-m-Y") }}
@if(isset($birth_human->date_birth))
{{ Carbon::parse($birth_human->date_birth)->format("d-m-Y") }}
@else
-
@endif
......
@php use Carbon\Carbon;
@php
use Carbon\Carbon;
$currentDate = Carbon::now()->format('d-m-Y');
@endphp
@foreach($passport as $human_passport)
......@@ -213,14 +215,32 @@
<td>
@if(isset($human_passport->expiry_date))
<p class="field-value">{{ Carbon::parse($human_passport->expiry_date)->format("d-m-Y") }}</p>
@php
$doc_date = Carbon::parse($human_passport->expiry_date)->format("d-m-Y") ?? '';
@endphp
@else
-
@endif
</td>
<td>
@if(isset($human_passport->expiry_date))
<span class="badge badge-secondary">
<i class="fa fa-check-circle"></i>Current</span>
@if ($doc_date < $currentDate)
<h4>
<span class="badge badge-danger">
EXPIRED
</span>
</h4>
@else
<h4>
<span class="badge badge-success">
<i class="fa fa-check-circle"></i>
Current
</span>
</h4>
@endif
@else
<div class="skeleton skeleton-text short"></div>
@endif
......@@ -233,13 +253,7 @@
</div>
<style>
.idDocimg{
background-image:url("../images/national_ID.png");
background-size: 30rem;
width: 80vw;
height: 25vh;
background-repeat: no-repeat
}
.skeleton-img{
padding: 8rem;
}
......
......@@ -6,14 +6,14 @@
$modalStatus= 'show';
$modalStyle="display: block;";
}
$fname = $passport['first_names'] ?? '';
$sname = $passport['last_name'] ?? '';
$fname = $passport[0]['first_names'] ?? '';
$sname = $passport[0]['last_name'] ?? '';
@endphp
<x-adminlte-modal id="searchModalPassport" class="{{ $modalStatus }}" style="{{ $modalStyle }}" size="lg"
title="{{ $fname }} {{ $sname }}'s Passport Details" v-centered static-backdrop scrollable>
title="Passport for: {{ $fname }} {{ $sname }}" v-centered static-backdrop scrollable>
<div class="modal-body">
<ul class="nav nav-tabs" id="custom-tabs-four-tab" role="tablist">
@if($role->hasAnyPermission(["Basic View ID Details", "Basic View Passport Details", "Basic View Birth Details"]))
......@@ -86,7 +86,7 @@
@include('livewire.search.partials.tabs.passport_tabs.document_data')
</div>
@endif
@if($role->hasPermissionTo("Basic View ID Photo and Signature"))
<div class="tab-pane fade" id="custom-tabs-four-photo" role="tabpanel" aria-labelledby="custom-tabs-four-photo-tab">
@include('livewire.search.partials.tabs.passport_tabs.document_header_details')
......
......@@ -40,7 +40,7 @@
<div class="row">
<x-adminlte-card theme="lightblue" theme-mode="outline">
<div>
<h5>Searched for: {{ $doctype }} record.</h5>
<h5>Searched for: <strong>{{ $doctype }} </strong></h5>
<small>Requested: </small>
<strong>{{ $search_count }} Record(s)</strong>
</div>
......@@ -88,7 +88,23 @@
default:
$docNumTitle='Doc Number';
}
if($doctype === 'ID')
{
$headings = [
'Maisha Num.',
'Serial Num.',
'First Name',
'Other Name',
'Sur Name',
'Nationality',
'Gender',
'Date of Birth',
'Date of Issue',
'Date of Expiry',
'Action'
];
$count=0;
}
if($doctype === 'Passport')
{
$headings = [
......@@ -104,50 +120,46 @@
'Action'
];
$count=0;
} else{
$headings = [
'ID number',
$docNumTitle,
}
if($doctype === 'Birth') {
$headings = [
'Entry Number',
'First name',
'Other names',
'Sur name',
'Nationality',
'COB',
'Gender',
'Date of birth',
'Action'
'Details'
];
$count=0;
}
}
@endphp
<x-adminlte-card>
<x-adminlte-datatable id="clients-table searchResultsCard" :heads="$headings" striped hoverable bordered>
@foreach($humans as $human)
@if($doctype === 'Birth')
<tr>
<td>
<h4 class="text-black">{{ $doc_human['o_pid'] ?? '-' }}</h4>
</td>
<td>
<h4 class="text-info">{{ $serial_number[$count] ?? '-' }}</h4>
</td>
<td>
{{ $doc_human['name'] ?? '-' }}
{{ $human['name'] ?? '-' }}
</td>
<td>
{{ $doc_human['last_name'] ?? '-' }}
{{ $human['last_name'] ?? '-' }}
</td>
<td>
{{ $doc_human['surn'] ?? '-' }}
{{ $human['surn'] ?? '-' }}
</td>
<td>
KENYAN <span class="fi fi-ke" style="font-size: 1rem;"></span>
KEN
</td>
<td>
{{ $doc_human['sex'] ?? '-' }}
{{ $human['sex'] ?? '-' }}
</td>
<td></td>
<td> {{ Carbon::parse($human['date_birth'])->format("d-m-Y") ?? '-' }}</td>
<td>
<x-adminlte-button
label="Details"
......@@ -226,13 +238,19 @@
{{ $doc_human['surn'] ?? '-' }}
</td>
<td>
KENYAN <span class="fi fi-ke" style="font-size: 1rem;"></span>
KEN <span class="fi fi-ke" style="font-size: 1rem;"></span>
</td>
<td>
{{ $doc_human['sex'] ?? '-' }}
</td>
<td>
{{ Carbon::parse($doc_human['date_birth'])->format("d-m-Y") ?? '-' }}
</td>
<td>
{{ $doc_human['sex'] ?? '-' }}
-
</td>
<td>
{{ Carbon::parse($doc_human['date_birth'])->format("d-m-Y") ?? '-' }}
-
</td>
<td>
<x-adminlte-button
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment