feat: complete GSB construction ERP implementation with dual-mode MR, capitalization cap engine, single PM rule, and system sign-off documentation

This commit is contained in:
GSB Construction Engineering
2026-08-25 17:08:03 +08:00
parent 778f27e0a5
commit d4e2b468ff
114 changed files with 3923 additions and 10031 deletions

View File

@@ -75,6 +75,7 @@ class UserController extends Controller
'admin',
'Project Manager',
'Main Contractor Admin',
'Contractor Project Manager',
'Construction Supervisor',
'Site Technical',
];
@@ -85,14 +86,16 @@ class UserController extends Controller
'admin',
'Project Manager',
'Main Contractor Admin',
'Contractor Project Manager',
'Construction Supervisor',
'Site Technical',
];
}
// Contractor Admins can add fellow Contractor Admins and Site Operations roles
// Contractor Admins can add fellow Contractor Admins, Contractor PMs, and Site Operations roles
return [
'Main Contractor Admin',
'Contractor Project Manager',
'Construction Supervisor',
'Site Technical',
];
@@ -105,7 +108,7 @@ class UserController extends Controller
// Auto-generate the next employee code (EMP-XXXX)
$last = EmployeeProfile::where('employee_code', 'like', 'EMP-%')
->orderByRaw("CAST(SUBSTR(employee_code, 5) AS INTEGER) DESC")
->orderByRaw("CAST(SUBSTR(employee_code, 5) AS UNSIGNED) DESC")
->value('employee_code');
$nextNumber = $last ? ((int) substr($last, 4)) + 1 : 1;
@@ -445,12 +448,12 @@ class UserController extends Controller
continue;
}
$allowedRoles = ['Super Admin', 'admin', 'Main Contractor Admin', 'Project Manager', 'Site Technical', 'Construction Supervisor'];
$allowedRoles = ['Super Admin', 'admin', 'Main Contractor Admin', 'Contractor Project Manager', 'Project Manager', 'Site Technical', 'Construction Supervisor'];
$resolvedRole = in_array($role, $allowedRoles) ? $role : 'Site Technical';
// Map the Spatie role to the base user_type
$userType = $resolvedRole;
if (in_array($resolvedRole, ['Main Contractor Admin', 'Project Manager', 'Site Technical', 'Construction Supervisor'])) {
if (in_array($resolvedRole, ['Main Contractor Admin', 'Contractor Project Manager', 'Project Manager', 'Site Technical', 'Construction Supervisor'])) {
$userType = 'contractor';
}
@@ -539,7 +542,7 @@ class UserController extends Controller
if (in_array($validated['user_type'], ['admin', 'employee', 'contractor'])) {
// Server-side strict generation & lock for employee_code
$last = EmployeeProfile::where('employee_code', 'like', 'EMP-%')
->orderByRaw("CAST(SUBSTR(employee_code, 5) AS INTEGER) DESC")
->orderByRaw("CAST(SUBSTR(employee_code, 5) AS UNSIGNED) DESC")
->value('employee_code');
$nextNumber = $last ? ((int) substr($last, 4)) + 1 : 1;