Commit 6f7ec5a0 authored by Brian Wangora's avatar Brian Wangora

Merge remote-tracking branch 'origin/master' into iprsv2_brian

parents 54656846 f8b8790f
<?php
namespace App\Http\Controllers\API;
use App\Http\Controllers\Controller;
use App\Models\Docum;
use App\Models\Human;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request;
class BirthRecord extends Controller
{
public function birth_check(Request $request): \Illuminate\Http\JsonResponse
{
// Validate incoming JSON data
$validatedData = $request->validate([
'entry_num' => 'required|string',
]);
$rid = Docum::where('ser_num', '=', $validatedData['entry_num'])->value('rid_h');
if($rid){
$human = Human::where('rid','=', $rid)->whereColumn('rid', 'pid')
->get(['name', 'surn', 'last_name', 'sex', 'date_birth', 'date_death', 'o_pid']);
if($human->isEmpty()){
return response()->json([
'message' => 'No record found',
], 401);
}else{
return response()->json([
'message' => 'Birth Record Found!',
'data' => $human
], 201);
}
}
}
}
...@@ -69,6 +69,7 @@ class Searchform extends Component ...@@ -69,6 +69,7 @@ class Searchform extends Component
break; break;
case 'Birth' : case 'Birth' :
if(!empty($this->searchBirthEntryNum)){ if(!empty($this->searchBirthEntryNum)){
$this->getBirthHuman(); $this->getBirthHuman();
}else{ }else{
session()->flash('error', 'Birth entry number not provided'); session()->flash('error', 'Birth entry number not provided');
...@@ -216,7 +217,7 @@ class Searchform extends Component ...@@ -216,7 +217,7 @@ class Searchform extends Component
*/ */
private function getBirthHuman(): void private function getBirthHuman(): void
{ {
if(!empty($this->searchBirthEntryNum)){ /* if(!empty($this->searchBirthEntryNum)){
$human = $this->searchIDocums($this->searchBirthEntryNum); $human = $this->searchIDocums($this->searchBirthEntryNum);
$this->search_count=1; $this->search_count=1;
...@@ -228,6 +229,24 @@ class Searchform extends Component ...@@ -228,6 +229,24 @@ class Searchform extends Component
$this->showTableResults(); $this->showTableResults();
}else{ }else{
session()->flash('error', 'Search parameter is missing..'); 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']);
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);
}
} }
} }
...@@ -242,4 +261,5 @@ class Searchform extends Component ...@@ -242,4 +261,5 @@ class Searchform extends Component
$this->search_count,$this->records_found); $this->search_count,$this->records_found);
} }
} }
...@@ -128,7 +128,10 @@ ...@@ -128,7 +128,10 @@
<table role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;"> <table role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;">
<tbody> <tbody>
<tr> <tr>
<td style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; border-radius: 4px; text-align: center; background-color: #0867ec;" valign="top" align="center" bgcolor="#0867ec"> <a href="" target="_blank" style="border: solid 2px #0867ec; border-radius: 4px; box-sizing: border-box; cursor: pointer; display: inline-block; font-size: 16px; font-weight: bold; margin: 0; padding: 12px 24px; text-decoration: none; text-transform: capitalize; background-color: #0867ec; border-color: #0867ec; color: #ffffff;">Customer Portal</a> </td> <td style="font-family: Helvetica, sans-serif; font-size: 16px; vertical-align: top; border-radius: 4px; text-align: center; background-color: #0867ec;" valign="top" align="center" bgcolor="#0867ec">
<a href="http://102.164.61.109/dashboard" target="_blank" style="border: solid 2px #0867ec; border-radius: 4px; box-sizing: border-box; cursor: pointer; display: inline-block; font-size: 16px; font-weight: bold; margin: 0; padding: 12px 24px; text-decoration: none; text-transform: capitalize; background-color: #0867ec; border-color: #0867ec; color: #ffffff;">
Go to : Customer Portal</a>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
<?php <?php
use App\Http\Controllers\API\AuthController; use App\Http\Controllers\API\AuthController;
use App\Http\Controllers\API\BirthRecord;
use App\Http\Controllers\API\Contracts; use App\Http\Controllers\API\Contracts;
use App\Http\Controllers\API\Passport; use App\Http\Controllers\API\Passport;
use App\Http\Controllers\API\PaymentsAPI; use App\Http\Controllers\API\PaymentsAPI;
...@@ -40,10 +41,8 @@ Route::prefix('v1')->group(function () { ...@@ -40,10 +41,8 @@ Route::prefix('v1')->group(function () {
//ID search //ID search
Route::prefix('verify')->group(function () { Route::prefix('verify')->group(function () {
Route::get('id/{id}/serial/{serial}', [SearchIDdocument::class, 'id_check']); Route::get('id/{id}/serial/{serial}', [SearchIDdocument::class, 'id_check']);
});
//passport
Route::prefix('verify')->group(function () {
Route::get('passport/{passport_num}/id/{id_num}', [Passport::class, 'passport_check']); Route::get('passport/{passport_num}/id/{id_num}', [Passport::class, 'passport_check']);
Route::get('birth', [BirthRecord::class, 'birth_check']);
}); });
}); });
......
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