forked from mahdahar/crm-summit
Merge pull request 'fix: menampilkan daftar sertifikat spv ke spv terkait dan manager' (#6) from mikael-zakaria/crm-summit:fix/spv-certificate into main
Reviewed-on: mahdahar/crm-summit#6 Reviewed-by: mahdahar <89adham@gmail.com>
This commit is contained in:
commit
6956b3235c
@ -48,7 +48,10 @@ class SidebarCertificateCell extends Cell {
|
|||||||
SUM(CASE WHEN certificates.cert_type = 'IC' THEN 1 ELSE 0 END) as totalIc
|
SUM(CASE WHEN certificates.cert_type = 'IC' THEN 1 ELSE 0 END) as totalIc
|
||||||
")
|
")
|
||||||
->join('users', 'users.userid = certificates.user_id', 'left')
|
->join('users', 'users.userid = certificates.user_id', 'left')
|
||||||
->where('users.reportto', $userId)
|
->groupStart() // Mulai kurung buka (
|
||||||
|
->where('users.reportto', $userId)
|
||||||
|
->orWhere('certificates.user_id', $userId)
|
||||||
|
->groupEnd() // Tutup kurung )
|
||||||
->where('certificates.status', 'unvalidated')
|
->where('certificates.status', 'unvalidated')
|
||||||
->Where('certificates.spv_validation_at', null)
|
->Where('certificates.spv_validation_at', null)
|
||||||
->where('certificates.deleted_at', null)
|
->where('certificates.deleted_at', null)
|
||||||
|
|||||||
@ -49,6 +49,7 @@ class Certificates extends BaseController {
|
|||||||
if (in_array($userPosId, [1, 3, 5])) { // Manager & IT: Tidak perlu filter tambahan (lihat semua)
|
if (in_array($userPosId, [1, 3, 5])) { // Manager & IT: Tidak perlu filter tambahan (lihat semua)
|
||||||
} else if ($userPosId == 2) { // SPV: Melihat data user yang "reportto"-nya adalah ID supervisor ini
|
} else if ($userPosId == 2) { // SPV: Melihat data user yang "reportto"-nya adalah ID supervisor ini
|
||||||
$builder->where('users.reportto', $userId);
|
$builder->where('users.reportto', $userId);
|
||||||
|
$builder->Orwhere('certificates.user_id', $userId);
|
||||||
} else if ($userPosId == 4) { // TSOIVD: Hanya melihat data milik sendiri
|
} else if ($userPosId == 4) { // TSOIVD: Hanya melihat data milik sendiri
|
||||||
$builder->where('certificates.user_id', $userId);
|
$builder->where('certificates.user_id', $userId);
|
||||||
} else {// Role lain: Tidak diberi akses
|
} else {// Role lain: Tidak diberi akses
|
||||||
@ -214,6 +215,7 @@ class Certificates extends BaseController {
|
|||||||
if (in_array($userPosId, [1, 3, 5])) { // Manager & IT: Tidak perlu filter tambahan (lihat semua)
|
if (in_array($userPosId, [1, 3, 5])) { // Manager & IT: Tidak perlu filter tambahan (lihat semua)
|
||||||
} else if ($userPosId == 2) { // SPV: Melihat data user yang "reportto"-nya adalah ID supervisor ini
|
} else if ($userPosId == 2) { // SPV: Melihat data user yang "reportto"-nya adalah ID supervisor ini
|
||||||
$builder->where('users.reportto', $userId);
|
$builder->where('users.reportto', $userId);
|
||||||
|
$builder->Orwhere('certificates.user_id', $userId);
|
||||||
} else if ($userPosId == 4) { // TSOIVD: Hanya melihat data milik sendiri
|
} else if ($userPosId == 4) { // TSOIVD: Hanya melihat data milik sendiri
|
||||||
$builder->where('certificates.user_id', $userId);
|
$builder->where('certificates.user_id', $userId);
|
||||||
} else {// Role lain: Tidak diberi akses
|
} else {// Role lain: Tidak diberi akses
|
||||||
@ -383,6 +385,7 @@ class Certificates extends BaseController {
|
|||||||
if (in_array($userPosId, [1, 3, 5])) { // Manager & IT: Tidak perlu filter tambahan (lihat semua)
|
if (in_array($userPosId, [1, 3, 5])) { // Manager & IT: Tidak perlu filter tambahan (lihat semua)
|
||||||
} else if ($userPosId == 2) { // SPV: Melihat data user yang "reportto"-nya adalah ID supervisor ini
|
} else if ($userPosId == 2) { // SPV: Melihat data user yang "reportto"-nya adalah ID supervisor ini
|
||||||
$builder->where('users.reportto', $userId);
|
$builder->where('users.reportto', $userId);
|
||||||
|
$builder->Orwhere('certificates.user_id', $userId);
|
||||||
} else if ($userPosId == 4) { // TSOIVD: Hanya melihat data milik sendiri
|
} else if ($userPosId == 4) { // TSOIVD: Hanya melihat data milik sendiri
|
||||||
$builder->where('certificates.user_id', $userId);
|
$builder->where('certificates.user_id', $userId);
|
||||||
} else {// Role lain: Tidak diberi akses
|
} else {// Role lain: Tidak diberi akses
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user