feat: implement barangay system phases 2-14
Some checks failed
tests / PHP 8.2 (swoole-5.1.6) (push) Has been cancelled
tests / PHP 8.3 (swoole-5.1.6) (push) Has been cancelled
tests / PHP 8.4 (swoole-6.0) (push) Has been cancelled

Complete adaptation from BukidBountyApp to Philippine barangay governance:

- Barangay models: Resident, Household, HouseholdMember, Blotter, BlotterHearing,
  DocumentRequest, RequestPayment, RequestType, BarangayProject, BarangayBudget
- Controllers: ResidentController, HouseholdController, BlotterController,
  BlotterHearingController, DocumentRequestController, RequestTypeController,
  ProjectController, BudgetController, QRPHController, AdminConsoleController,
  UserController, FileController, ChapterController, LoginController
- Vue pages: Home, ManageResidents, ResidentProfile, ManageHouseholds, ManageBlotters,
  BlotterDetail, RequestDocument, ManageDocumentRequests, DocumentRequestDetail,
  ManageRequestTypes, ManageProjects, BudgetLedger, AdminConsole
- Barangay roles: PunongBarangay, Kagawad, Secretary, Treasurer, SK, Tanod, BHW, Staff, Resident
- UserPermissions matrix rewritten with barangay-specific permission mappings
- VueRouteMap replaced with barangay SPA routes
- UserActions enum references corrected across all controllers
- Removed all market/cooperative/POS/subscription code and models
This commit is contained in:
Jonathan Sykes
2026-06-07 03:09:09 +08:00
parent 19fec0933b
commit fbb7e3ff37
234 changed files with 5582 additions and 39457 deletions

View File

@@ -0,0 +1,99 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Payment;
use App\Enums\UserActions;
use App\Http\Controllers\Helpers\Permissions\UserPermissions;
use App\Http\Controllers\Helpers\ResponseHelper;
use App\Http\Controllers\Helpers\QrphDecoder;
use App\Models\SystemSetting;
use Hypervel\Http\Request;
use Hypervel\Support\Facades\Auth;
class QRPHController
{
private function checkAdmin(): bool
{
return UserPermissions::isActionPermitted(Auth::user()->acct_type, UserActions::ManageQrphPaymentCode);
}
/**
* Get the static QR PH code stored in system settings.
*/
public function getQrCode()
{
$code = SystemSetting::getValue('qrph_payment_code');
$image = SystemSetting::getValue('qrph_payment_image_hashkey');
return response()->json([
'success' => true,
'data' => [
'qrph_code' => $code,
'qrph_image_hashkey' => $image,
'has_qr' => !empty($code),
],
]);
}
/**
* Update the static QR PH code (admin only).
*/
public function setQrCode(Request $request)
{
if (!$this->checkAdmin()) return ResponseHelper::returnUnauthorized();
$code = $request->input('qrph_code');
if (empty($code)) return ResponseHelper::returnError('QR PH code is required', 422);
try {
$decoded = QrphDecoder::decode($code);
} catch (\Throwable $e) {
return ResponseHelper::returnError('Invalid QR PH code: ' . $e->getMessage(), 422);
}
SystemSetting::setValue('qrph_payment_code', $code);
if ($hashkey = $request->input('image_hashkey')) {
SystemSetting::setValue('qrph_payment_image_hashkey', $hashkey);
}
return response()->json([
'success' => true,
'data' => $decoded,
'message' => 'QR PH code updated',
]);
}
/**
* Decode a QR PH string (admin utility).
*/
public function decode(Request $request)
{
if (!$this->checkAdmin()) return ResponseHelper::returnUnauthorized();
$code = $request->input('code');
if (empty($code)) return ResponseHelper::returnError('QR PH code is required', 422);
try {
$decoded = QrphDecoder::decode($code);
return response()->json(['success' => true, 'data' => $decoded]);
} catch (\Throwable $e) {
return ResponseHelper::returnError('Decode error: ' . $e->getMessage(), 422);
}
}
/**
* Remove QR PH code from system settings.
*/
public function removeQrCode()
{
if (!$this->checkAdmin()) return ResponseHelper::returnUnauthorized();
SystemSetting::setValue('qrph_payment_code', null);
SystemSetting::setValue('qrph_payment_image_hashkey', null);
return response()->json(['success' => true, 'message' => 'QR PH code removed']);
}
}