Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
simpmw
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alfiro Pratama
simpmw
Commits
9fcd2f74
Commit
9fcd2f74
authored
Mar 17, 2026
by
Alfiro Pratama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync noidentitas operator
parent
12e69c7d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
8 deletions
+65
-8
app/Http/Controllers/Operator/SyncNoidentitasController.php
+22
-4
app/Repositories/Auth/IsdmRepository.php
+37
-2
resources/views/backend/operator/sync_noidentitas/index.blade.php
+6
-2
No files found.
app/Http/Controllers/Operator/SyncNoidentitasController.php
View file @
9fcd2f74
...
...
@@ -60,12 +60,17 @@ class SyncNoidentitasController extends Controller
return
response
()
->
json
([
'success'
=>
false
,
'message'
=>
'User/email tidak ditemukan.'
]);
}
$
nidnOrNuptk
=
$this
->
isdmRepo
->
getNidnOrNuptk
ByEmail
(
$user
->
email
);
if
(
$nidnOrNuptk
===
null
||
$nidnOrNuptk
===
''
)
{
$
data
=
$this
->
isdmRepo
->
getBiodata
ByEmail
(
$user
->
email
);
if
(
!
$data
||
(
$data
[
'nidn_or_nuptk'
]
??
''
)
===
''
)
{
return
response
()
->
json
([
'success'
=>
false
,
'message'
=>
'Data tidak ditemukan di i-sdm untuk email ini.'
]);
}
return
response
()
->
json
([
'success'
=>
true
,
'nidn_or_nuptk'
=>
$nidnOrNuptk
]);
return
response
()
->
json
([
'success'
=>
true
,
'userid'
=>
$data
[
'userid'
]
??
''
,
'nidn'
=>
$data
[
'nidn'
]
??
''
,
'nidn_or_nuptk'
=>
$data
[
'nidn_or_nuptk'
],
]);
}
/**
...
...
@@ -96,7 +101,20 @@ class SyncNoidentitasController extends Controller
$isdm
=
$this
->
isdmRepo
->
getByNidnOrNip
(
$request
->
identifier
);
if
(
empty
(
$isdm
)
||
!
isset
(
$isdm
[
0
]))
{
Alert
::
error
(
'Data tidak ditemukan di i-sdm. Pastikan NIDN atau NUPTK benar.'
);
$isdm
=
$this
->
isdmRepo
->
getByNidnOrNip
(
$request
->
nip
);
if
(
empty
(
$isdm
)
||
!
isset
(
$isdm
[
0
]))
{
$isdm
=
$this
->
isdmRepo
->
getByNidnOrNip
(
$request
->
nidn
);
}
}
if
(
trim
(
$request
->
identifier
)
!==
trim
(
$isdm
[
0
]
->
nuptk
))
{
Alert
::
error
(
'NUPTK yg diinput tidak sesuai dengan NUPTK di i-sdm.'
);
return
redirect
()
->
route
(
'operator.sync-noidentitas.index'
);
}
if
(
empty
(
$isdm
)
||
!
isset
(
$isdm
[
0
]))
{
Alert
::
error
(
'Data tidak ditemukan di i-sdm. Pastikan NIDN atau NUPTK atau NIPbenar.'
);
return
redirect
()
->
route
(
'operator.sync-noidentitas.index'
);
}
...
...
app/Repositories/Auth/IsdmRepository.php
View file @
9fcd2f74
...
...
@@ -36,6 +36,15 @@ class IsdmRepository
return
$isdm
;
}
public
function
nuptk
(
$nuptk
)
{
$client
=
new
GuzzleHttpClient
();
$apiRequest
=
$client
->
request
(
'GET'
,
'https://i-sdm.unesa.ac.id/api/biodataumum/'
.
$nuptk
);
$isdm
=
json_decode
(
$apiRequest
->
getBody
()
->
getContents
());
return
$isdm
;
}
/**
* Get data from i-sdm by NIDN or NIP (untuk NUPTK).
* Coba NIDN dulu, jika gagal coba NIP.
...
...
@@ -68,18 +77,38 @@ class IsdmRepository
return
null
;
}
try
{
$isdm
=
$this
->
nuptk
(
$value
);
if
(
!
empty
(
$isdm
)
&&
isset
(
$isdm
[
0
]))
{
return
$isdm
;
}
}
catch
(
\Exception
$e
)
{
return
null
;
}
return
null
;
}
/**
* Ambil NIDN atau NUPTK berdasarkan email: API SSO userid/{email} → userid → i-sdm biodataumum/{userid}.
* Sama seperti alur login (LoginController + BiodataRepository::isdm).
*
* @param string $email
* @return string|null NIDN atau NUPTK, null jika tidak ditemukan
*/
public
function
getNidnOrNuptkByEmail
(
$email
)
{
$data
=
$this
->
getBiodataByEmail
(
$email
);
return
$data
?
$data
[
'nidn_or_nuptk'
]
:
null
;
}
/**
* Ambil userid (untuk nip), nidn, dan nidn_or_nuptk berdasarkan email: SSO userid/{email} → i-sdm biodataumum/{userid}.
*
* @param string $email
* @return array|null ['userid' => ..., 'nidn' => ..., 'nidn_or_nuptk' => ...] atau null
*/
public
function
getBiodataByEmail
(
$email
)
{
$email
=
trim
(
$email
);
if
(
$email
===
''
)
{
return
null
;
...
...
@@ -106,7 +135,13 @@ class IsdmRepository
$isdm
=
$this
->
nip
(
$userid
);
if
(
!
empty
(
$isdm
)
&&
isset
(
$isdm
[
0
]))
{
$row
=
$isdm
[
0
];
return
$row
->
nidn
??
$row
->
nuptk
??
$row
->
nip
??
null
;
$nidn
=
$row
->
nidn
??
null
;
$nidnOrNuptk
=
$row
->
nidn
??
$row
->
nuptk
??
$row
->
nip
??
null
;
return
[
'userid'
=>
$userid
,
'nidn'
=>
$nidn
,
'nidn_or_nuptk'
=>
$nidnOrNuptk
,
];
}
}
catch
(
\Exception
$e
)
{
return
null
;
...
...
resources/views/backend/operator/sync_noidentitas/index.blade.php
View file @
9fcd2f74
...
...
@@ -54,6 +54,8 @@
@csrf
<input type="
hidden
" name="
biodata_id
" value="
{{
Crypt
::
encrypt
(
$item
->
id
)
}}
" class="
row
-
biodata
-
id
">
<input type="
text
" name="
identifier
" class="
form
-
control
form
-
control
-
sm
row
-
identifier
" placeholder="
Klik
Sync
untuk
ambil
dari
i
-
sdm
" maxlength="
50
" required style="
max
-
width
:
180
px
;
">
<input type="
hidden
" name="
nip
" class="
row
-
nip
" value="">
<input type="
hidden
" name="
nidn
" class="
row
-
nidn
" value="">
<button type="
button
" class="
btn
btn
-
sm
btn
-
outline
-
primary
btn
-
sync
">Sync</button>
<button type="
submit
" class="
btn
btn
-
sm
btn
-
primary
">Update</button>
</form>
...
...
@@ -88,8 +90,10 @@ $(function() {
data: { biodata_id: biodataId },
dataType: 'json',
success: function(res) {
if (res.success && res.nidn_or_nuptk) {
$input
.val(res.nidn_or_nuptk);
if (res.success) {
$input
.val(res.nidn_or_nuptk || '');
$row
.find('.row-nip').val(res.userid || '');
$row
.find('.row-nidn').val(res.nidn || '');
} else {
alert(res.message || 'Data tidak ditemukan di i-sdm.');
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment