Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sibiling
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Syaifur
sibiling
Commits
0e86c7c7
Commit
0e86c7c7
authored
Sep 09, 2024
by
FARDA ALAN MA'RUF
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update migrasi data using dummy table
parent
53395f02
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
953 additions
and
102 deletions
+953
-102
ImportDapodikController.php
...Http/Controllers/Admin/Import/ImportDapodikController.php
+3
-3
ImportGuruDapodikController.php
.../Controllers/Admin/Import/ImportGuruDapodikController.php
+25
-2
MigrasiDapodikController.php
...ttp/Controllers/Admin/Import/MigrasiDapodikController.php
+40
-0
ImportDapodikGuru.php
app/Imports/ImportDapodikGuru.php
+4
-4
ImportDataJob.php
app/Jobs/ImportDataJob.php
+33
-0
MigrateDataJob.php
app/Jobs/MigrateDataJob.php
+32
-0
ImportTransaksi.php
app/Libraries/ShouldQueue/ImportTransaksi.php
+283
-3
MigrateTransaksi.php
app/Libraries/ShouldQueue/MigrateTransaksi.php
+324
-0
2024_09_09_184636_create_tr_log_queue_table.php
...igrations/2024_09_09_184636_create_tr_log_queue_table.php
+27
-0
index.blade.php
...rces/views/admin/importdapodik/importGuru/index.blade.php
+91
-45
index.blade.php
...s/views/admin/importdapodik/importStudent/index.blade.php
+88
-45
web_sekolah.php
routes/web_sekolah.php
+3
-0
No files found.
app/Http/Controllers/Admin/Import/ImportDapodikController.php
View file @
0e86c7c7
...
@@ -76,8 +76,8 @@ class ImportDapodikController extends Controller
...
@@ -76,8 +76,8 @@ class ImportDapodikController extends Controller
DB
::
table
(
'dummy_users'
)
->
insert
([
DB
::
table
(
'dummy_users'
)
->
insert
([
'username'
=>
$guru
->
email
,
'username'
=>
$guru
->
email
,
'password'
=>
bcrypt
(
"
sibiling-2024
"
),
'password'
=>
bcrypt
(
"
bkpeduli
"
),
'sandi'
=>
"
sibiling-2024
"
,
// dummy
'sandi'
=>
"
bkpeduli
"
,
// dummy
'status'
=>
1
,
'status'
=>
1
,
'idPSekolah'
=>
1
,
// dummy
'idPSekolah'
=>
1
,
// dummy
'role'
=>
3
,
// konselor
'role'
=>
3
,
// konselor
...
@@ -117,7 +117,7 @@ class ImportDapodikController extends Controller
...
@@ -117,7 +117,7 @@ class ImportDapodikController extends Controller
'import_siswa_ortu'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'import_siswa_ortu'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
];
];
$sekolah
=
DB
::
table
(
'perpus_sekolah'
)
->
where
(
'id'
,
1
)
->
first
();
// dummy
$sekolah
=
DB
::
table
(
'perpus_sekolah'
)
->
where
(
'id'
,
1
)
->
first
();
// dummy
1 diganti id sekolah
$dataPesertaDidik
->
map
(
function
(
$peserta
)
use
(
&
$importResults
,
$sekolah
)
{
$dataPesertaDidik
->
map
(
function
(
$peserta
)
use
(
&
$importResults
,
$sekolah
)
{
...
...
app/Http/Controllers/Admin/Import/ImportGuruDapodikController.php
View file @
0e86c7c7
...
@@ -37,6 +37,29 @@ class ImportGuruDapodikController extends Controller
...
@@ -37,6 +37,29 @@ class ImportGuruDapodikController extends Controller
$this
->
mPerpusSekolah
=
new
SekolahModel
();
$this
->
mPerpusSekolah
=
new
SekolahModel
();
}
}
public
function
datatable
()
{
$data
=
$this
->
mExcelGuru
->
where
(
'idPSekolah'
,
session
()
->
get
(
'idPSekolah'
))
->
get
();
$formattedData
=
$data
->
map
(
function
(
$item
,
$key
)
{
return
[
'DT_RowIndex'
=>
$key
+
1
,
'periode'
=>
$item
->
periode
->
nama_periode
,
'nip'
=>
$item
->
nip
,
'nama'
=>
$item
->
nama
,
'created_at'
=>
$item
->
created_at
->
format
(
'Y-m-d H:i:s'
),
'username'
=>
$item
->
user
->
username
??
'-'
,
'status'
=>
$item
->
status
];
});
return
response
()
->
json
([
'draw'
=>
intval
(
request
()
->
get
(
'draw'
)),
'recordsTotal'
=>
$formattedData
->
count
(),
'recordsFiltered'
=>
$formattedData
->
count
(),
'data'
=>
$formattedData
]);
}
public
function
index
()
public
function
index
()
{
{
$excelGuru
=
$this
->
mExcelGuru
->
where
(
'idPSekolah'
,
session
()
->
get
(
'idPSekolah'
))
->
get
();
$excelGuru
=
$this
->
mExcelGuru
->
where
(
'idPSekolah'
,
session
()
->
get
(
'idPSekolah'
))
->
get
();
...
@@ -82,7 +105,7 @@ class ImportGuruDapodikController extends Controller
...
@@ -82,7 +105,7 @@ class ImportGuruDapodikController extends Controller
$dataJob
[
'idUser'
]
=
session
()
->
get
(
'users_id'
);
$dataJob
[
'idUser'
]
=
session
()
->
get
(
'users_id'
);
$dataJob
[
'idPSekolah'
]
=
session
()
->
get
(
'idPSekolah'
);
$dataJob
[
'idPSekolah'
]
=
session
()
->
get
(
'idPSekolah'
);
$dataJob
[
'idPPeriode'
]
=
session
()
->
get
(
'idPPeriode'
);
$dataJob
[
'idPPeriode'
]
=
session
()
->
get
(
'idPPeriode'
);
ImportDataJob
::
dispatch
(
$dataJob
);
ImportDataJob
::
dispatch
(
$dataJob
);
...
@@ -147,7 +170,7 @@ class ImportGuruDapodikController extends Controller
...
@@ -147,7 +170,7 @@ class ImportGuruDapodikController extends Controller
// 'nama' => $nama,
// 'nama' => $nama,
// 'status' => $status
// 'status' => $status
// ];
// ];
// $guru = $this->mGuru->create($dataGuru);
// $guru = $this->mGuru->create($dataGuru);
// $nipMasuk[] = ['nip' => $nip, 'nama' => $nama, 'reason' => "masuk"];
// $nipMasuk[] = ['nip' => $nip, 'nama' => $nama, 'reason' => "masuk"];
// $bisa++;
// $bisa++;
...
...
app/Http/Controllers/Admin/Import/MigrasiDapodikController.php
0 → 100644
View file @
0e86c7c7
<?php
namespace
App\Http\Controllers\Admin\Import
;
use
App\Http\Controllers\Controller
;
use
App\Jobs\ImportDataJob
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
App\Models\Import\DapodikGuruModel
;
use
App\Models\Import\DapodikSiswaModel
;
use
App\Models\User\UserModel
;
use
App\Models\Stakeholder\GuruModel
;
use
App\Models\Stakeholder\KonselorModel
;
use
App\Models\Perpus\SekolahModel
;
use
Illuminate\Support\Facades\Log
;
class
MigrasiDapodikController
extends
Controller
{
public
function
migrasiGuru
(
Request
$request
)
{
$dataJob
=
[];
$dataJob
[
'jenis'
]
=
'migrasiDapodikGuru'
;
$dataJob
[
'idPSekolah'
]
=
session
()
->
get
(
'idPSekolah'
);
$dataJob
[
'idPPeriode'
]
=
session
()
->
get
(
'idPPeriode'
);
ImportDataJob
::
dispatch
(
$dataJob
);
}
public
function
migrasiSiswa
(
Request
$request
)
{
$dataJob
=
[];
$dataJob
[
'jenis'
]
=
'migrasiDapodikSiswa'
;
$dataJob
[
'idPSekolah'
]
=
session
()
->
get
(
'idPSekolah'
);
$dataJob
[
'idPPeriode'
]
=
session
()
->
get
(
'idPPeriode'
);
ImportDataJob
::
dispatch
(
$dataJob
);
}
}
app/Imports/ImportDapodikGuru.php
View file @
0e86c7c7
...
@@ -36,10 +36,10 @@ class ImportDapodikGuru implements ToCollection, WithHeadingRow
...
@@ -36,10 +36,10 @@ class ImportDapodikGuru implements ToCollection, WithHeadingRow
$row
[
'idUser'
]
=
$this
->
data
[
'idUser'
];
$row
[
'idUser'
]
=
$this
->
data
[
'idUser'
];
$row
[
'idPSekolah'
]
=
$this
->
data
[
'idPSekolah'
];
$row
[
'idPSekolah'
]
=
$this
->
data
[
'idPSekolah'
];
$row
[
'idPPeriode'
]
=
$this
->
data
[
'idPPeriode'
];
$row
[
'idPPeriode'
]
=
$this
->
data
[
'idPPeriode'
];
$row
[
'idPKKode'
]
=
$this
->
data
[
'idPKKode'
];
//
$row['idPKKode'] = $this->data['idPKKode'];
$row
[
'idMStatus'
]
=
$this
->
data
[
'idMStatus'
];
//
$row['idMStatus'] = $this->data['idMStatus'];
$row
[
'idPPKelas'
]
=
$this
->
data
[
'idPPKelas'
];
//
$row['idPPKelas'] = $this->data['idPPKelas'];
$row
[
'idPPStatus'
]
=
$this
->
data
[
'idPPStatus'
];
//
$row['idPPStatus'] = $this->data['idPPStatus'];
ImportDataJob
::
dispatch
(
$row
);
ImportDataJob
::
dispatch
(
$row
);
}
}
...
...
app/Jobs/ImportDataJob.php
View file @
0e86c7c7
...
@@ -11,6 +11,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
...
@@ -11,6 +11,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Queue\SerializesModels
;
use
Illuminate\Queue\SerializesModels
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Maatwebsite\Excel\Facades\Excel
;
class
ImportDataJob
implements
ShouldQueue
class
ImportDataJob
implements
ShouldQueue
...
@@ -32,6 +33,8 @@ class ImportDataJob implements ShouldQueue
...
@@ -32,6 +33,8 @@ class ImportDataJob implements ShouldQueue
*/
*/
public
function
handle
()
:
void
public
function
handle
()
:
void
{
{
Log
::
info
(
"intip data"
,
[
'tes'
=>
$this
->
data
]);
if
(
$this
->
data
[
'jenis'
]
==
'importGuru'
){
if
(
$this
->
data
[
'jenis'
]
==
'importGuru'
){
$function
=
$this
->
data
[
'jenis'
];
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
ImportTransaksi
::
$function
(
$this
->
data
);
...
@@ -51,5 +54,35 @@ class ImportDataJob implements ShouldQueue
...
@@ -51,5 +54,35 @@ class ImportDataJob implements ShouldQueue
$function
=
$this
->
data
[
'jenis'
];
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
ImportTransaksi
::
$function
(
$this
->
data
);
}
}
if
(
$this
->
data
[
'jenis'
]
==
'migrasiSiswa'
){
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
}
if
(
$this
->
data
[
'jenis'
]
==
'migrasiDapodikSiswa'
){
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
}
if
(
$this
->
data
[
'jenis'
]
==
'migrasiDapodikSiswaSplit'
){
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
}
if
(
$this
->
data
[
'jenis'
]
==
'migrasiGuru'
){
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
}
if
(
$this
->
data
[
'jenis'
]
==
'migrasiDapodikGuru'
){
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
}
if
(
$this
->
data
[
'jenis'
]
==
'migrasiDapodikGuruSplit'
){
$function
=
$this
->
data
[
'jenis'
];
ImportTransaksi
::
$function
(
$this
->
data
);
}
}
}
}
}
app/Jobs/MigrateDataJob.php
0 → 100644
View file @
0e86c7c7
<?php
namespace
App\Jobs
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Contracts\Queue\ShouldBeUnique
;
use
Illuminate\Contracts\Queue\ShouldQueue
;
use
Illuminate\Foundation\Bus\Dispatchable
;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Queue\SerializesModels
;
class
MigrateDataJob
implements
ShouldQueue
{
use
Dispatchable
,
InteractsWithQueue
,
Queueable
,
SerializesModels
;
protected
$data
;
/**
* Create a new job instance.
*/
public
function
__construct
(
$data
)
{
$this
->
data
=
$data
;
}
/**
* Execute the job.
*/
public
function
handle
()
:
void
{
}
}
app/Libraries/ShouldQueue/ImportTransaksi.php
View file @
0e86c7c7
...
@@ -4,10 +4,13 @@ namespace App\Libraries\ShouldQueue;
...
@@ -4,10 +4,13 @@ namespace App\Libraries\ShouldQueue;
use
App\Imports\ImportDapodikGuru
;
use
App\Imports\ImportDapodikGuru
;
use
App\Imports\ImportDapodikSiswa
;
use
App\Imports\ImportDapodikSiswa
;
use
App\Jobs\ImportDataJob
;
use
App\Models\Import\DapodikSiswaModel
;
use
App\Models\ImportDapodik\ImportDapodikGuruModel
;
use
App\Models\ImportDapodik\ImportDapodikGuruModel
;
use
App\Models\ImportDapodik\ImportDapodikSiswaModel
;
use
App\Models\ImportDapodik\ImportDapodikSiswaModel
;
use
App\Models\ImportDapodik\ImportExcelGuruModel
;
use
App\Models\ImportDapodik\ImportExcelGuruModel
;
use
App\Models\ImportDapodik\ImportExcelSiswaModel
;
use
App\Models\ImportDapodik\ImportExcelSiswaModel
;
use
App\Models\Perpus\SekolahModel
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Log
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Maatwebsite\Excel\Facades\Excel
;
...
@@ -61,7 +64,7 @@ class ImportTransaksi
...
@@ -61,7 +64,7 @@ class ImportTransaksi
->
first
();
->
first
();
if
(
isset
(
$isStudent
))
{
if
(
isset
(
$isStudent
))
{
$newMsg
=
"Data dengan NISN "
.
$nisn
.
" atau NIPD "
.
$nipd
.
" sudah ada !"
;
$newMsg
=
"Data dengan NISN "
.
$nisn
.
" atau NIPD "
.
$nipd
.
" sudah ada !"
;
$status
=
2
;
$status
=
2
;
}
}
...
@@ -264,9 +267,9 @@ class ImportTransaksi
...
@@ -264,9 +267,9 @@ class ImportTransaksi
if
(
$isNewStudent
)
{
if
(
$isNewStudent
)
{
DB
::
beginTransaction
();
DB
::
beginTransaction
();
try
{
try
{
if
(
$isNewStudent
[
'status'
]
==
2
)
{
if
(
$isNewStudent
[
'status'
]
==
2
)
{
ImportDapodikSiswaModel
::
where
(
'nisn'
,
$data
[
'nisn'
])
->
update
(
$dataArray
);
ImportDapodikSiswaModel
::
where
(
'nisn'
,
$data
[
'nisn'
])
->
update
(
$dataArray
);
}
else
{
}
else
{
ImportDapodikSiswaModel
::
create
(
$dataArray
);
ImportDapodikSiswaModel
::
create
(
$dataArray
);
}
}
DB
::
commit
();
DB
::
commit
();
...
@@ -288,7 +291,284 @@ class ImportTransaksi
...
@@ -288,7 +291,284 @@ class ImportTransaksi
];
];
ImportExcelSiswaModel
::
create
(
$recordImport
);
ImportExcelSiswaModel
::
create
(
$recordImport
);
}
public
static
function
migrasiDapodikGuru
(
$data
)
{
// $dataPesertaDidik = ImportDapodikSiswaModel::where('idPSekolah', $data['idPSekolah'])
// ->where('idPPeriode', $data['idPPeriode'])
// ->get();
$dataGuru
=
ImportDapodikGuruModel
::
where
(
'idPSekolah'
,
$data
[
'idPSekolah'
])
->
where
(
'idPPeriode'
,
$data
[
'idPPeriode'
])
->
get
();
$dataJob
=
[];
$dataJob
[
'jenis'
]
=
'migrasiDapodikGuruSplit'
;
foreach
(
$dataGuru
as
$row
)
{
$dataJob
[
'data'
]
=
$row
;
ImportDataJob
::
dispatch
(
$dataJob
);
}
}
public
static
function
migrasiDapodikGuruSplit
(
$data
)
{
// $existingGuru = GuruModel::where('nip', $guru->nip)->first();
$existingGuru
=
DB
::
table
(
'dummy_sekolah_guru'
)
->
where
(
'nip'
,
$data
[
'data'
]
->
nip
)
->
first
();
if
(
$data
[
'data'
]
->
jenis_ptk
==
'Guru Mapel'
)
{
if
(
!
$existingGuru
)
{
try
{
DB
::
table
(
'dummy_sekolah_guru'
)
->
insert
([
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'idMapel'
=>
99
,
'nip'
=>
$data
[
'data'
]
->
nip
??
'-'
,
'telp'
=>
$data
[
'data'
]
->
hp
??
'-'
,
'email'
=>
$data
[
'data'
]
->
email
??
'-'
,
'status'
=>
1
,
]);
// $importResults['guru_mapel']['berhasil']++;
}
catch
(
\Exception
$e
)
{
// $importResults['guru_mapel']['gagal']++;
}
}
else
{
// $importResults['guru_mapel']['gagal']++;
}
}
elseif
(
$data
[
'data'
]
->
jenis_ptk
==
'Guru BK'
)
{
if
(
!
$existingGuru
)
{
try
{
$guruImport
=
DB
::
table
(
'dummy_sekolah_guru'
)
->
insertGetId
([
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'idMapel'
=>
99
,
'nip'
=>
$data
[
'data'
]
->
nip
??
'-'
,
'telp'
=>
$data
[
'data'
]
->
hp
??
'-'
,
'email'
=>
$data
[
'data'
]
->
email
??
'-'
,
'status'
=>
1
,
]);
$konselorImport
=
DB
::
table
(
'dummy_sekolah_konselor'
)
->
insertGetId
([
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'idSGuru'
=>
$guruImport
,
'status'
=>
1
,
]);
$sekolah
=
SekolahModel
::
where
(
'id'
,
1
)
->
first
();
DB
::
table
(
'dummy_users'
)
->
insert
([
'username'
=>
$data
[
'data'
]
->
email
,
'password'
=>
bcrypt
(
"bkpeduli"
),
'sandi'
=>
"bkpeduli"
,
// dummy
'status'
=>
1
,
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'role'
=>
3
,
// konselor
'idSKonselor'
=>
$konselorImport
,
'idPPeriode'
=>
$sekolah
->
idPPeriode
,
'telp'
=>
$data
[
'data'
]
->
hp
??
'-'
,
]);
// $importResults['guru_bk']['berhasil']++;
}
catch
(
\Exception
$e
)
{
// $importResults['guru_bk']['gagal']++;
}
}
else
{
// $importResults['guru_bk']['gagal']++;
}
}
}
public
static
function
migrasiDapodikSiswa
(
$data
)
{
$dataPesertaDidik
=
ImportDapodikSiswaModel
::
where
(
'idPSekolah'
,
$data
[
'idPSekolah'
])
->
where
(
'idPPeriode'
,
$data
[
'idPPeriode'
])
// ->limit(100)
->
get
();
$dataJob
=
[];
$dataJob
[
'jenis'
]
=
'migrasiDapodikSiswaSplit'
;
foreach
(
$dataPesertaDidik
as
$row
)
{
$dataJob
[
'data'
]
=
$row
;
ImportDataJob
::
dispatch
(
$dataJob
);
}
}
public
static
function
migrasiDapodikSiswaSplit
(
$data
)
{
$sekolah
=
DB
::
table
(
'perpus_sekolah'
)
->
where
(
'id'
,
$data
[
'data'
]
->
idPSekolah
)
->
first
();
// dummy 1 diganti id sekolah
try
{
// Pastikan kolom rombel_saat_ini valid
if
(
!
$data
[
'data'
]
->
rombel_saat_ini
)
{
throw
new
\Exception
(
"Rombel tidak ditemukan"
);
}
list
(
$kelas
,
$jurusan
,
$kodeKelas
)
=
explode
(
'-'
,
$data
[
'data'
]
->
rombel_saat_ini
);
// Pengecekan jurusan
try
{
$jurusanId
=
DB
::
table
(
'dummy_perpus_jurusan'
)
->
where
(
'nama'
,
$jurusan
)
->
value
(
'id'
);
if
(
!
$jurusanId
)
{
$jurusanId
=
DB
::
table
(
'dummy_perpus_jurusan'
)
->
insertGetId
([
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'nama'
=>
$jurusan
,
]);
// $importResults['import_jurusan']['berhasil']++;
}
}
catch
(
\Exception
$e
)
{
echo
json_encode
(
$e
);
die
;
// $importResults['import_jurusan']['gagal']++;
}
// Pengecekan tingkat/kelas
try
{
$kelasId
=
DB
::
table
(
'dummy_perpus_kelas'
)
->
where
(
'nama'
,
$kelas
)
->
value
(
'id'
);
if
(
!
$kelasId
)
{
$kelasId
=
DB
::
table
(
'dummy_perpus_kelas'
)
->
insertGetId
([
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'idPJurusan'
=>
$jurusanId
,
'nama'
=>
$kelas
,
]);
// $importResults['import_tingkat']['berhasil']++;
}
}
catch
(
\Exception
$e
)
{
echo
json_encode
(
$e
);
die
;
// $importResults['import_tingkat']['gagal']++;
}
// Pengecekan kode kelas
try
{
$kelasKodeId
=
DB
::
table
(
'dummy_perpus_kelasKode'
)
->
where
([
[
'nama'
,
'='
,
$kodeKelas
],
[
'idPSekolah'
,
'='
,
$data
[
'data'
]
->
idPSekolah
],
// dummy
[
'idPJurusan'
,
'='
,
$jurusanId
],
[
'idPKelas'
,
'='
,
$kelasId
],
])
->
value
(
'id'
);
if
(
!
$kelasKodeId
)
{
$kelasKodeId
=
DB
::
table
(
'dummy_perpus_kelasKode'
)
->
insertGetId
([
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'idPJurusan'
=>
$jurusanId
,
'idPKelas'
=>
$kelasId
,
'nama'
=>
$kodeKelas
,
]);
// $importResults['import_index']['berhasil']++;
}
}
catch
(
\Exception
$e
)
{
echo
json_encode
(
$e
);
die
;
// $importResults['import_index']['gagal']++;
}
// Cek apakah siswa sudah ada
try
{
$existingSiswa
=
DB
::
table
(
'dummy_siswa'
)
->
where
(
'nisn'
,
$data
[
'data'
]
->
nisn
)
->
first
();
if
(
!
$existingSiswa
)
{
$alamatLengkap
=
$data
[
'data'
]
->
alamat
.
', RT: '
.
(
$data
[
'data'
]
->
rt
??
'-'
)
.
', RW: '
.
(
$data
[
'data'
]
->
rw
??
'-'
)
.
', Dusun: '
.
(
$data
[
'data'
]
->
dusun
??
'-'
)
.
', Kelurahan: '
.
(
$data
[
'data'
]
->
kelurahan
??
'-'
)
.
', Kecamatan: '
.
(
$data
[
'data'
]
->
kecamatan
??
'-'
)
.
', Kode Pos: '
.
(
$data
[
'data'
]
->
kode_pos
??
'-'
);
$idMTempat
=
self
::
getTempatId
(
$data
[
'data'
]
->
jenis_tinggal
);
$idMAgama
=
self
::
getAgamaId
(
$data
[
'data'
]
->
agama
);
$sisArr
=
[
'idPSekolah'
=>
$data
[
'data'
]
->
idPSekolah
,
// dummy
'idPKKode'
=>
$kelasKodeId
,
'idMAgama'
=>
$idMAgama
,
'idPPeriode'
=>
$sekolah
->
idPPeriode
,
'idMStatus'
=>
1
,
'nisn'
=>
$data
[
'data'
]
->
nisn
??
'-'
,
'nama'
=>
$data
[
'data'
]
->
nama
,
'lahir_tanggal'
=>
$data
[
'data'
]
->
tanggal_lahir
,
'lahir_tempat'
=>
$data
[
'data'
]
->
tempat_lahir
,
'idPPKelas'
=>
$kelasId
,
'idPPStatus'
=>
1
,
'idMTempat'
=>
$idMTempat
,
'email'
=>
$data
[
'data'
]
->
email
??
'-'
,
'telp'
=>
$data
[
'data'
]
->
hp
??
$data
[
'data'
]
->
telepon
??
'-'
,
'alamat'
=>
$alamatLengkap
,
];
$siswaId
=
DB
::
table
(
'dummy_siswa'
)
->
insertGetId
(
$sisArr
);
// $importResults['import_siswa']['berhasil']++;
// Insert ke siswa_mutasi
DB
::
table
(
'dummy_siswa_mutasi'
)
->
insert
([
'idSiswa'
=>
$siswaId
,
'idPKKode'
=>
$kelasKodeId
,
'idPPeriode'
=>
$sekolah
->
idPPeriode
,
'idMStatus'
=>
1
,
]);
// $importResults['import_siswa_mutasi']['berhasil']++;
// Insert ke ortu
$idMPekerjaan
=
self
::
getPekerjaanId
(
$data
[
'data'
]
->
pekerjaan_ayah
);
DB
::
table
(
'dummy_ortu'
)
->
insert
([
'idPSekolah'
=>
1
,
'idSiswa'
=>
$siswaId
,
'idMPekerjaan'
=>
$idMPekerjaan
,
'nama'
=>
$data
[
'data'
]
->
nama_ayah
,
'alamat'
=>
$alamatLengkap
,
]);
// $importResults['import_siswa_ortu']['berhasil']++;
}
}
catch
(
\Exception
$e
)
{
// $importResults['import_siswa']['gagal']++;
// $importResults['import_siswa_mutasi']['gagal']++;
// $importResults['import_siswa_ortu']['gagal']++;
}
}
catch
(
\Exception
$e
)
{
// Log error umum untuk satu data['data'] didik
error_log
(
$e
->
getMessage
());
}
}
public
static
function
getTempatId
(
$jenisTinggal
)
{
$tempatMapping
=
[
'Bersama orang tua'
=>
1
,
'Wali'
=>
2
,
'Asrama'
=>
3
,
'Kost'
=>
4
,
];
return
$tempatMapping
[
$jenisTinggal
]
??
1
;
}
public
static
function
getAgamaId
(
$agama
)
{
$agamaMapping
=
[
'Islam'
=>
1
,
'Kristen'
=>
2
,
'Budha'
=>
3
,
'Konghucu'
=>
4
,
'Katolik'
=>
5
,
'Hindu'
=>
6
,
'Lainnya'
=>
0
];
return
$agamaMapping
[
$agama
]
??
0
;
}
public
static
function
getPekerjaanId
(
$pekerjaan
)
{
$pekerjaanMapping
=
[
'Guru'
=>
1
,
'Dosen'
=>
2
,
'PNS/TNI/POLRI'
=>
3
,
'BUMN'
=>
4
,
'Swasta'
=>
5
,
'Wiraswasta'
=>
6
,
];
if
(
!
isset
(
$pekerjaanMapping
[
$pekerjaan
]))
{
$idPekerjaan
=
DB
::
table
(
'master_pekerjaan'
)
->
insertGetId
([
'nama'
=>
$pekerjaan
,
]);
return
$idPekerjaan
;
}
return
$pekerjaanMapping
[
$pekerjaan
];
}
}
}
}
app/Libraries/ShouldQueue/MigrateTransaksi.php
0 → 100644
View file @
0e86c7c7
<?php
namespace
App\Libraries\ShouldQueue
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
use
Maatwebsite\Excel\Facades\Excel
;
use
Illuminate\Http\Request
;
use
App\Models\Import\DapodikGuruModel
;
use
App\Models\Import\DapodikSiswaModel
;
use
App\Models\User\UserModel
;
use
App\Models\Stakeholder\GuruModel
;
use
App\Models\Stakeholder\KonselorModel
;
use
App\Models\Perpus\SekolahModel
;
class
MigrateTransaksi
{
public
static
function
migrasiGuru
()
{
$dataGuruTemp
=
DapodikGuruModel
::
select
([
'nama'
,
'nip'
,
'jenis_ptk'
,
'hp'
,
'email'
,
])
->
get
();
$importResults
=
[
'guru_mapel'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'guru_bk'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
];
$dataGuruTemp
->
map
(
function
(
$guru
)
use
(
&
$importResults
)
{
$existingGuru
=
DB
::
table
(
'dummy_sekolah_guru'
)
->
where
(
'nip'
,
$guru
->
nip
)
->
first
();
if
(
$guru
->
jenis_ptk
==
'Guru Mapel'
)
{
if
(
!
$existingGuru
)
{
$data_arr
=
[
'idPSekolah'
=>
1
,
// dummy
'idMapel'
=>
99
,
'nip'
=>
$guru
->
nip
??
'-'
,
'telp'
=>
$guru
->
hp
??
'-'
,
'email'
=>
$guru
->
email
??
'-'
,
'status'
=>
1
,
];
try
{
DB
::
table
(
'dummy_sekolah_guru'
)
->
insert
([
'idPSekolah'
=>
1
,
// dummy
'idMapel'
=>
99
,
'nip'
=>
$guru
->
nip
??
'-'
,
'telp'
=>
$guru
->
hp
??
'-'
,
'email'
=>
$guru
->
email
??
'-'
,
'status'
=>
1
,
]);
$importResults
[
'guru_mapel'
][
'berhasil'
]
++
;
}
catch
(
\Exception
$e
)
{
$importResults
[
'guru_mapel'
][
'gagal'
]
++
;
}
}
else
{
$importResults
[
'guru_mapel'
][
'gagal'
]
++
;
}
}
elseif
(
$guru
->
jenis_ptk
==
'Guru BK'
)
{
if
(
!
$existingGuru
)
{
try
{
$guruImport
=
DB
::
table
(
'dummy_sekolah_guru'
)
->
insertGetId
([
'idPSekolah'
=>
1
,
// dummy
'idMapel'
=>
99
,
'nip'
=>
$guru
->
nip
??
'-'
,
'telp'
=>
$guru
->
hp
??
'-'
,
'email'
=>
$guru
->
email
??
'-'
,
'status'
=>
1
,
]);
$konselorImport
=
DB
::
table
(
'dummy_sekolah_konselor'
)
->
insertGetId
([
'idPSekolah'
=>
1
,
// dummy
'idSGuru'
=>
$guruImport
,
'status'
=>
1
,
]);
$sekolah
=
SekolahModel
::
where
(
'id'
,
1
)
->
first
();
DB
::
table
(
'dummy_users'
)
->
insert
([
'username'
=>
$guru
->
email
,
'password'
=>
bcrypt
(
"bkpeduli"
),
'sandi'
=>
"bkpeduli"
,
// dummy
'status'
=>
1
,
'idPSekolah'
=>
1
,
// dummy
'role'
=>
3
,
// konselor
'idSKonselor'
=>
$konselorImport
,
'idPPeriode'
=>
$sekolah
->
idPPeriode
,
'telp'
=>
$guru
->
hp
??
'-'
,
]);
$importResults
[
'guru_bk'
][
'berhasil'
]
++
;
}
catch
(
\Exception
$e
)
{
$importResults
[
'guru_bk'
][
'gagal'
]
++
;
}
}
else
{
$importResults
[
'guru_bk'
][
'gagal'
]
++
;
}
}
});
return
response
()
->
json
([
'message'
=>
'Proses import selesai'
,
'hasil'
=>
$importResults
,
]);
}
public
static
function
migrasiDapodikSiswa
()
{
$dataPesertaDidik
=
DapodikSiswaModel
::
select
([
'idPSekolah'
,
'nama'
,
'nisn'
,
'tempat_lahir'
,
'tanggal_lahir'
,
'agama'
,
'alamat'
,
'rt'
,
'rw'
,
'dusun'
,
'kelurahan'
,
'kecamatan'
,
'kode_pos'
,
'jenis_tinggal'
,
'telepon'
,
'hp'
,
'email'
,
'nama_ayah'
,
'pekerjaan_ayah'
,
'rombel_saat_ini'
])
->
get
();
$importResults
=
[
'import_tingkat'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'import_jurusan'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'import_index'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'import_siswa'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'import_siswa_mutasi'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
'import_siswa_ortu'
=>
[
'berhasil'
=>
0
,
'gagal'
=>
0
],
];
$sekolah
=
DB
::
table
(
'perpus_sekolah'
)
->
where
(
'id'
,
1
)
->
first
();
// dummy 1 diganti id sekolah
$dataPesertaDidik
->
map
(
function
(
$peserta
)
use
(
&
$importResults
,
$sekolah
)
{
try
{
// Pastikan kolom rombel_saat_ini valid
if
(
!
$peserta
->
rombel_saat_ini
)
{
throw
new
\Exception
(
"Rombel tidak ditemukan"
);
}
list
(
$kelas
,
$jurusan
,
$kodeKelas
)
=
explode
(
'-'
,
$peserta
->
rombel_saat_ini
);
// Pengecekan jurusan
try
{
$jurusanId
=
DB
::
table
(
'dummy_perpus_jurusan'
)
->
where
(
'nama'
,
$jurusan
)
->
value
(
'id'
);
if
(
!
$jurusanId
)
{
$jurusanId
=
DB
::
table
(
'dummy_perpus_jurusan'
)
->
insertGetId
([
'idPSekolah'
=>
1
,
// dummy
'nama'
=>
$jurusan
,
]);
$importResults
[
'import_jurusan'
][
'berhasil'
]
++
;
}
}
catch
(
\Exception
$e
)
{
echo
json_encode
(
$e
);
die
;
$importResults
[
'import_jurusan'
][
'gagal'
]
++
;
}
// Pengecekan tingkat/kelas
try
{
$kelasId
=
DB
::
table
(
'dummy_perpus_kelas'
)
->
where
(
'nama'
,
$kelas
)
->
value
(
'id'
);
if
(
!
$kelasId
)
{
$kelasId
=
DB
::
table
(
'dummy_perpus_kelas'
)
->
insertGetId
([
'idPSekolah'
=>
1
,
// dummy
'idPJurusan'
=>
$jurusanId
,
'nama'
=>
$kelas
,
]);
$importResults
[
'import_tingkat'
][
'berhasil'
]
++
;
}
}
catch
(
\Exception
$e
)
{
echo
json_encode
(
$e
);
die
;
$importResults
[
'import_tingkat'
][
'gagal'
]
++
;
}
// Pengecekan kode kelas
try
{
$kelasKodeId
=
DB
::
table
(
'dummy_perpus_kelasKode'
)
->
where
([
[
'nama'
,
'='
,
$kodeKelas
],
[
'idPSekolah'
,
'='
,
1
],
// dummy
[
'idPJurusan'
,
'='
,
$jurusanId
],
[
'idPKelas'
,
'='
,
$kelasId
],
])
->
value
(
'id'
);
if
(
!
$kelasKodeId
)
{
$kelasKodeId
=
DB
::
table
(
'dummy_perpus_kelasKode'
)
->
insertGetId
([
'idPSekolah'
=>
1
,
// dummy
'idPJurusan'
=>
$jurusanId
,
'idPKelas'
=>
$kelasId
,
'nama'
=>
$kodeKelas
,
]);
$importResults
[
'import_index'
][
'berhasil'
]
++
;
}
}
catch
(
\Exception
$e
)
{
echo
json_encode
(
$e
);
die
;
$importResults
[
'import_index'
][
'gagal'
]
++
;
}
// Cek apakah siswa sudah ada
try
{
$existingSiswa
=
DB
::
table
(
'dummy_siswa'
)
->
where
(
'nisn'
,
$peserta
->
nisn
)
->
first
();
if
(
!
$existingSiswa
)
{
$alamatLengkap
=
$peserta
->
alamat
.
', RT: '
.
(
$peserta
->
rt
??
'-'
)
.
', RW: '
.
(
$peserta
->
rw
??
'-'
)
.
', Dusun: '
.
(
$peserta
->
dusun
??
'-'
)
.
', Kelurahan: '
.
(
$peserta
->
kelurahan
??
'-'
)
.
', Kecamatan: '
.
(
$peserta
->
kecamatan
??
'-'
)
.
', Kode Pos: '
.
(
$peserta
->
kode_pos
??
'-'
);
$idMTempat
=
$this
->
getTempatId
(
$peserta
->
jenis_tinggal
);
$idMAgama
=
$this
->
getAgamaId
(
$peserta
->
agama
);
$siswaId
=
DB
::
table
(
'dummy_siswa'
)
->
insertGetId
([
'idPSekolah'
=>
1
,
// dummy
'idPKKode'
=>
$kelasKodeId
,
'idMAgama'
=>
$idMAgama
,
'idPPeriode'
=>
$sekolah
->
idPPeriode
,
'idMStatus'
=>
1
,
'nisn'
=>
$peserta
->
nisn
??
'-'
,
'nama'
=>
$peserta
->
nama
,
'lahir_tanggal'
=>
$peserta
->
tanggal_lahir
,
'lahir_tempat'
=>
$peserta
->
tempat_lahir
,
'idPPKelas'
=>
$kelasId
,
'idPPStatus'
=>
1
,
'idMTempat'
=>
$idMTempat
,
'email'
=>
$peserta
->
email
??
'-'
,
'telp'
=>
$peserta
->
hp
??
$peserta
->
telepon
??
'-'
,
'alamat'
=>
$alamatLengkap
,
]);
$importResults
[
'import_siswa'
][
'berhasil'
]
++
;
// Insert ke siswa_mutasi
DB
::
table
(
'dummy_siswa_mutasi'
)
->
insert
([
'idSiswa'
=>
$siswaId
,
'idPKKode'
=>
$kelasKodeId
,
'idPPeriode'
=>
$sekolah
->
idPPeriode
,
'idMStatus'
=>
1
,
]);
$importResults
[
'import_siswa_mutasi'
][
'berhasil'
]
++
;
// Insert ke ortu
$idMPekerjaan
=
$this
->
getPekerjaanId
(
$peserta
->
pekerjaan_ayah
);
DB
::
table
(
'dummy_ortu'
)
->
insert
([
'idPSekolah'
=>
1
,
'idSiswa'
=>
$siswaId
,
'idMPekerjaan'
=>
$idMPekerjaan
,
'nama'
=>
$peserta
->
nama_ayah
,
'alamat'
=>
$alamatLengkap
,
]);
$importResults
[
'import_siswa_ortu'
][
'berhasil'
]
++
;
}
}
catch
(
\Exception
$e
)
{
$importResults
[
'import_siswa'
][
'gagal'
]
++
;
$importResults
[
'import_siswa_mutasi'
][
'gagal'
]
++
;
$importResults
[
'import_siswa_ortu'
][
'gagal'
]
++
;
}
}
catch
(
\Exception
$e
)
{
// Log error umum untuk satu peserta didik
error_log
(
$e
->
getMessage
());
}
});
return
response
()
->
json
(
$importResults
);
}
private
function
getTempatId
(
$jenisTinggal
)
{
$tempatMapping
=
[
'Bersama orang tua'
=>
1
,
'Wali'
=>
2
,
'Asrama'
=>
3
,
'Kost'
=>
4
,
];
return
$tempatMapping
[
$jenisTinggal
]
??
1
;
}
private
function
getAgamaId
(
$agama
)
{
$agamaMapping
=
[
'Islam'
=>
1
,
'Kristen'
=>
2
,
'Budha'
=>
3
,
'Konghucu'
=>
4
,
'Katolik'
=>
5
,
'Hindu'
=>
6
,
'Lainnya'
=>
0
];
return
$agamaMapping
[
$agama
]
??
0
;
}
private
function
getPekerjaanId
(
$pekerjaan
)
{
$pekerjaanMapping
=
[
'Guru'
=>
1
,
'Dosen'
=>
2
,
'PNS/TNI/POLRI'
=>
3
,
'BUMN'
=>
4
,
'Swasta'
=>
5
,
'Wiraswasta'
=>
6
,
];
if
(
!
isset
(
$pekerjaanMapping
[
$pekerjaan
]))
{
$idPekerjaan
=
DB
::
table
(
'master_pekerjaan'
)
->
insertGetId
([
'nama'
=>
$pekerjaan
,
]);
return
$idPekerjaan
;
}
return
$pekerjaanMapping
[
$pekerjaan
];
}
}
database/migrations/2024_09_09_184636_create_tr_log_queue_table.php
0 → 100644
View file @
0e86c7c7
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*/
public
function
up
()
:
void
{
Schema
::
create
(
'tr_log_queue'
,
function
(
Blueprint
$table
)
{
$table
->
id
();
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*/
public
function
down
()
:
void
{
Schema
::
dropIfExists
(
'tr_log_queue'
);
}
};
resources/views/admin/importdapodik/importGuru/index.blade.php
View file @
0e86c7c7
@
extends
(
$admin
)
@
extends
(
$admin
)
@
section
(
'title'
)
@
section
(
'title'
)
{{
$title
}}
{{
$title
}}
@
endsection
@
endsection
@
push
(
'css'
)
@
push
(
'css'
)
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"{{ asset('assets/css/datatables.css') }}"
>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"{{ asset('assets/css/datatables.css') }}"
>
@
endpush
@
endpush
@
section
(
'content'
)
@
section
(
'content'
)
@
component
(
'components.breadcrumb'
)
@
component
(
'components.breadcrumb'
)
@
slot
(
'breadcrumb_title'
)
@
slot
(
'breadcrumb_title'
)
<
h3
>
Halaman
</
h3
>
<
h3
>
Halaman
</
h3
>
@
endslot
@
endslot
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<li class="
breadcrumb
-
item
active
">List</li>
<li class="
breadcrumb
-
item
active
">List</li>
@endcomponent
@endcomponent
<div class="
container
-
fluid
">
<div class="
container
-
fluid
">
<div class="
row
">
<div class="
row
">
<div class="
col
-
sm
-
12
">
<div class="
col
-
sm
-
12
">
...
@@ -38,46 +38,70 @@
...
@@ -38,46 +38,70 @@
<h5 class="
card
-
title
">{{
$page
}}</h5>
<h5 class="
card
-
title
">{{
$page
}}</h5>
</div>
</div>
<div class="
col
-
lg
-
6
">
<div class="
col
-
lg
-
6
">
<a href="
{{
url
(
$url
)
}}
/
create
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Import Guru</a>
<a href="
{{
url
(
$url
)
}}
/
create
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Import
Guru</a>
<button class="
btn
btn
-
sm
btn
-
warning
float
-
end
" type="
button
" data-bs-toggle="
modal
"
data-bs-target="
#exampleModalCenter">Migrasi Data</button>
<
div
class
="
modal
fade
" id="
exampleModalCenter
" tabindex="
-
1
"
aria-labelledby="
exampleModalCenter
" style="
display
:
none
;
" aria-hidden="
true
">
<div class="
modal
-
dialog
modal
-
dialog
-
centered
" role="
document
">
<div class="
modal
-
content
">
<div class="
modal
-
header
">
<h5 class="
modal
-
title
">Modal title</h5>
<button class="
btn
-
close
" type="
button
" data-bs-dismiss="
modal
"
aria-label="
Close
" data-bs-original-title="" title=""></button>
</div>
<div class="
modal
-
body
">
<p>Apakah Anda yakin ingin melakukan migrasi data ?</p>
</div>
<div class="
modal
-
footer
">
<button class="
btn
btn
-
secondary
" type="
button
" data-bs-dismiss="
modal
"
data-bs-original-title="" title="">Batalkan</button>
<button id="
migrasiGuru
" class="
btn
btn
-
primary
" type="
button
"
data-bs-original-title="" title="">Migrasi Data Guru</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="
card
-
body
">
<div class="
card
-
body
">
<div class="
table
-
responsive
">
<div class="
table
-
responsive
">
<table class="
display
" id="
basic
-
1
">
<table class="
display
" id="
basic
-
1
">
<thead>
<thead>
<tr>
<th width="
50
">No.</th>
<th>Periode</th>
<th>NIP</th>
<th>Nama</th>
<th>Waktu Import</th>
<th>Data Admin</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach (
$excelGuru
as
$r
)
<tr>
<tr>
<td>{{
$loop->iteration
}}</td>
<th width="
50
">No.</th>
<td>{{
$r->periode
->nama_periode }}</td>
<th>Periode</th>
<td>{{
$r->nip
}}</td>
<th>NIP</th>
<td>{{
$r->nama
}}</td>
<th>Nama</th>
<td>{{
$r->created_at
}}</td>
<th>Waktu Import</th>
<td>{{
$r->user
->username ?? '-' }}</td>
<th>Data Admin</th>
<td>
<th>Status</th>
@if(
$r->status
== 1)
Tambah
@elseif(
$r->status
== 2)
Edit
@else
Gagal
@endif
</td>
</tr>
</tr>
@endforeach
</thead>
</tbody>
<tbody>
</table>
@foreach (
$excelGuru
as
$r
)
<tr>
<td>{{
$loop->iteration
}}</td>
<td>{{
$r->periode
->nama_periode }}</td>
<td>{{
$r->nip
}}</td>
<td>{{
$r->nama
}}</td>
<td>{{
$r->created_at
}}</td>
<td>{{
$r->user
->username ?? '-' }}</td>
<td>
@if (
$r->status
== 1)
Tambah
@elseif(
$r->status
== 2)
Edit
@else
Gagal
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -90,16 +114,38 @@
...
@@ -90,16 +114,38 @@
<script src="
{{
asset
(
'assets/js/datatable/datatables/datatable.custom.js'
)
}}
"></script>
<script src="
{{
asset
(
'assets/js/datatable/datatables/datatable.custom.js'
)
}}
"></script>
<script>
<script>
$(function() {
$(function() {
$("
#isi-tabel").DataTable(); // tambahin ini ki
$('#migrasiGuru').on('click', function() {
// let idPSekolah = "
{{
session
()
->
get
(
'idPSekolah'
)
}}
";
// let idPPeriode = "
{{
session
()
->
get
(
'idPPeriode'
)
}}
";
let url = "
{{
url
(
$url
)
}}
/
migrate
";
console.log(url);
$.ajax({
url: url,
type: 'POST',
data: {
// idPSekolah: idPSekolah,
// idPPeriode: idPPeriode,
_token: "
{{
csrf_token
()
}}
" // Pastikan CSRF token disertakan untuk keamanan
},
success: function(response) {
// Tindakan yang diambil jika POST berhasil
console.log('Data berhasil dikirim:', response);
alert('Migrasi guru berhasil!');
},
error: function(xhr, status, error) {
// Tindakan yang diambil jika POST gagal
console.error('Terjadi kesalahan:', error);
alert('Terjadi kesalahan dalam migrasi guru.');
}
});
});
// $("
#isi-tabel").DataTable(); // tambahin ini ki
let
baseUrl
=
'{{ url('') }}'
;
// let baseUrl
= '{{ url('') }}';
let
idSekolah
=
"{{ session()->get('idsekolah') }}"
;
//
let idSekolah = "{{ session()->get('idsekolah') }}";
$
(
'#tabel-jquery'
)
.
hide
();
//
$('#tabel-jquery').hide();
});
});
</
script
>
</
script
>
@
endpush
@
endpush
@
endsection
@
endsection
resources/views/admin/importdapodik/importStudent/index.blade.php
View file @
0e86c7c7
@
extends
(
$admin
)
@
extends
(
$admin
)
@
section
(
'title'
)
@
section
(
'title'
)
{{
$title
}}
{{
$title
}}
@
endsection
@
endsection
@
push
(
'css'
)
@
push
(
'css'
)
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"{{ asset('assets/css/datatables.css') }}"
>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"{{ asset('assets/css/datatables.css') }}"
>
@
endpush
@
endpush
@
section
(
'content'
)
@
section
(
'content'
)
@
component
(
'components.breadcrumb'
)
@
component
(
'components.breadcrumb'
)
@
slot
(
'breadcrumb_title'
)
@
slot
(
'breadcrumb_title'
)
<
h3
>
Halaman
</
h3
>
<
h3
>
Halaman
</
h3
>
@
endslot
@
endslot
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<li class="
breadcrumb
-
item
active
">List</li>
<li class="
breadcrumb
-
item
active
">List</li>
@endcomponent
@endcomponent
<div class="
container
-
fluid
">
<div class="
container
-
fluid
">
<div class="
row
">
<div class="
row
">
<div class="
col
-
sm
-
12
">
<div class="
col
-
sm
-
12
">
...
@@ -38,46 +38,71 @@
...
@@ -38,46 +38,71 @@
<h5 class="
card
-
title
">{{
$page
}}</h5>
<h5 class="
card
-
title
">{{
$page
}}</h5>
</div>
</div>
<div class="
col
-
lg
-
6
">
<div class="
col
-
lg
-
6
">
<a href="
{{
url
(
$url
)
}}
/
create
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Import Siswa</a>
<a href="
{{
url
(
$url
)
}}
/
create
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Import
Siswa</a>
<button class="
btn
btn
-
sm
btn
-
warning
float
-
end
" type="
button
" data-bs-toggle="
modal
"
data-bs-target="
#exampleModalCenter">Migrasi Data</button>
<
div
class
="
modal
fade
" id="
exampleModalCenter
" tabindex="
-
1
"
aria-labelledby="
exampleModalCenter
" style="
display
:
none
;
" aria-hidden="
true
">
<div class="
modal
-
dialog
modal
-
dialog
-
centered
" role="
document
">
<div class="
modal
-
content
">
<div class="
modal
-
header
">
<h5 class="
modal
-
title
">Modal title</h5>
<button class="
btn
-
close
" type="
button
" data-bs-dismiss="
modal
"
aria-label="
Close
" data-bs-original-title="" title=""></button>
</div>
<div class="
modal
-
body
">
<p>Apakah Anda yakin ingin melakukan migrasi data ?</p>
</div>
<div class="
modal
-
footer
">
<button class="
btn
btn
-
secondary
" type="
button
" data-bs-dismiss="
modal
"
data-bs-original-title="" title="">Batalkan</button>
<button id="
migrasiSiswa
" class="
btn
btn
-
primary
" type="
button
"
data-bs-original-title="" title="">Migrasi Data Siswa</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="
card
-
body
">
<div class="
card
-
body
">
<div class="
table
-
responsive
">
<div class="
table
-
responsive
">
<table class="
display
" id="
basic
-
1
">
<table class="
display
" id="
basic
-
1
">
<thead>
<thead>
<tr>
<th width="
50
">No.</th>
<th>Periode</th>
<th>NISN</th>
<th>Nama</th>
<th>Waktu Import</th>
<th>Data Admin</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach (
$excelSiswa
as
$r
)
<tr>
<tr>
<td>{{
$loop->iteration
}}</td>
<th width="
50
">No.</th>
<td>{{
$r->periode
->nama_periode }}</td>
<th>Periode</th>
<td>{{
$r->nisn
}}</td>
<th>NISN</th>
<td>{{
$r->nama
}}</td>
<th>Nama</th>
<td>{{
$r->created_at
}}</td>
<th>Waktu Import</th>
<td>{{
$r->user
->username ?? '-' }}</td>
<th>Data Admin</th>
<td>
<th>Status</th>
@if(
$r->status
== 1)
Tambah
@elseif(
$r->status
== 2)
Edit
@else
Gagal
@endif
</td>
</tr>
</tr>
@endforeach
</thead>
</tbody>
<tbody>
</table>
@foreach (
$excelSiswa
as
$r
)
<tr>
<td>{{
$loop->iteration
}}</td>
<td>{{
$r->periode
->nama_periode }}</td>
<td>{{
$r->nisn
}}</td>
<td>{{
$r->nama
}}</td>
<td>{{
$r->created_at
}}</td>
<td>{{
$r->user
->username ?? '-' }}</td>
<td>
@if (
$r->status
== 1)
Tambah
@elseif(
$r->status
== 2)
Edit
@else
Gagal
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -90,16 +115,34 @@
...
@@ -90,16 +115,34 @@
<script src="
{{
asset
(
'assets/js/datatable/datatables/datatable.custom.js'
)
}}
"></script>
<script src="
{{
asset
(
'assets/js/datatable/datatables/datatable.custom.js'
)
}}
"></script>
<script>
<script>
$(function() {
$(function() {
$("
#isi-tabel").DataTable(); // tambahin ini ki
$('#migrasiSiswa').on('click', function() {
// let idPSekolah = "
{{
session
()
->
get
(
'idPSekolah'
)
}}
";
// let idPPeriode = "
{{
session
()
->
get
(
'idPPeriode'
)
}}
";
let url = "
{{
url
(
$url
)
}}
/
migrate
";
console.log(url);
let
baseUrl
=
'{{ url('') }}'
;
$.ajax({
let
idSekolah
=
"{{ session()->get('idsekolah') }}"
;
url: url,
$
(
'#tabel-jquery'
)
.
hide
();
type: 'POST',
data: {
// idPSekolah: idPSekolah,
// idPPeriode: idPPeriode,
_token: "
{{
csrf_token
()
}}
" // Pastikan CSRF token disertakan untuk keamanan
},
success: function(response) {
// Tindakan yang diambil jika POST berhasil
console.log('Data berhasil dikirim:', response);
alert('Migrasi siswa berhasil!');
},
error: function(xhr, status, error) {
// Tindakan yang diambil jika POST gagal
console.error('Terjadi kesalahan:', error);
alert('Terjadi kesalahan dalam migrasi siswa.');
}
});
});
});
});
</script>
</script>
@endpush
@endpush
@endsection
@endsection
routes/web_sekolah.php
View file @
0e86c7c7
...
@@ -80,12 +80,15 @@ Route::prefix('/admin/tahun-ajaran')->group(function () {
...
@@ -80,12 +80,15 @@ Route::prefix('/admin/tahun-ajaran')->group(function () {
Route
::
prefix
(
'/admin/import-dapodik'
)
->
group
(
function
()
{
Route
::
prefix
(
'/admin/import-dapodik'
)
->
group
(
function
()
{
Route
::
get
(
'/guru'
,
'Admin\Import\ImportGuruDapodikController@index'
)
->
name
(
'import-dapodik.guru'
);
Route
::
get
(
'/guru'
,
'Admin\Import\ImportGuruDapodikController@index'
)
->
name
(
'import-dapodik.guru'
);
Route
::
get
(
'/datatable'
,
'Admin\Import\ImportGuruDapodikController@datatable'
)
->
name
(
'import-dapodik.gurutable'
);
Route
::
get
(
'/guru/create'
,
'Admin\Import\ImportGuruDapodikController@create'
);
Route
::
get
(
'/guru/create'
,
'Admin\Import\ImportGuruDapodikController@create'
);
Route
::
post
(
'/guru/store'
,
'Admin\Import\ImportGuruDapodikController@store'
);
Route
::
post
(
'/guru/store'
,
'Admin\Import\ImportGuruDapodikController@store'
);
Route
::
post
(
'/guru/migrate'
,
'Admin\Import\MigrasiDapodikController@migrasiGuru'
);
Route
::
get
(
'/siswa'
,
'Admin\Import\ImportSiswaDapodikController@index'
)
->
name
(
'import-dapodik.siswa'
);
Route
::
get
(
'/siswa'
,
'Admin\Import\ImportSiswaDapodikController@index'
)
->
name
(
'import-dapodik.siswa'
);
Route
::
get
(
'/siswa/create'
,
'Admin\Import\ImportSiswaDapodikController@create'
);
Route
::
get
(
'/siswa/create'
,
'Admin\Import\ImportSiswaDapodikController@create'
);
Route
::
post
(
'/siswa/store'
,
'Admin\Import\ImportSiswaDapodikController@store'
);
Route
::
post
(
'/siswa/store'
,
'Admin\Import\ImportSiswaDapodikController@store'
);
Route
::
post
(
'/siswa/migrate'
,
'Admin\Import\MigrasiDapodikController@migrasiSiswa'
);
// Route::prefix('/siswa')->group(function () {
// Route::prefix('/siswa')->group(function () {
// Route::get('/', 'Admin\Import\ImportSiswaDapodikController@index')->name('siswa');
// Route::get('/', 'Admin\Import\ImportSiswaDapodikController@index')->name('siswa');
...
...
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