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
704d1f4d
Commit
704d1f4d
authored
Sep 06, 2024
by
FARDA ALAN MA'RUF
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update sekolah dapodik
parent
e9fa211c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
423 additions
and
0 deletions
+423
-0
ImportGuruDapodikController.php
.../Controllers/Admin/Import/ImportGuruDapodikController.php
+151
-0
ImportSiswaDapodikController.php
...Controllers/Admin/Import/ImportSiswaDapodikController.php
+0
-0
create.blade.php
...ces/views/admin/importdapodik/importGuru/create.blade.php
+70
-0
index.blade.php
...rces/views/admin/importdapodik/importGuru/index.blade.php
+95
-0
preview.blade.php
...es/views/admin/importdapodik/importGuru/preview.blade.php
+95
-0
sidebar_sekolah.blade.php
.../layouts/admin/partials/sidebar/sidebar_sekolah.blade.php
+6
-0
web_sekolah.php
routes/web_sekolah.php
+6
-0
No files found.
app/Http/Controllers/Admin/Import/ImportGuruDapodikController.php
0 → 100644
View file @
704d1f4d
<?php
namespace
App\Http\Controllers\Admin\Import
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Http\Request
;
// use App\Imports\LulusanImport;
// use App\Exports\LulusanExport;
use
Maatwebsite\Excel\Facades\Excel
;
// Panggil Nama file Model yang mau dipake
use
App\Models\Import\ImportexcelGuruModel
;
use
App\Models\ImportDapodik\ImportDapodikGuruModel
;
use
App\Models\Perpus\KelasKodeModel
;
use
App\Models\Master\PeriodeModel
;
use
App\Models\Stakeholder\GuruModel
;
use
App\Models\Perpus\SekolahModel
;
class
ImportGuruDapodikController
extends
Controller
{
private
$views
=
'admin/importdapodik/importGuru'
;
private
$url
=
'admin/import-dapodik/guru'
;
private
$title
=
'Halaman Import Guru'
;
public
function
__construct
()
{
// createLogActivity();
$this
->
mDapodikGuru
=
new
ImportDapodikGuruModel
();
$this
->
mExcelGuru
=
new
ImportexcelGuruModel
();
$this
->
mGuru
=
new
GuruModel
();
$this
->
mPeriode
=
new
PeriodeModel
();
$this
->
mPerpusSekolah
=
new
SekolahModel
();
}
public
function
index
()
{
$excelGuru
=
$this
->
mExcelGuru
->
where
(
'idPSekolah'
,
session
()
->
get
(
'idPSekolah'
))
->
get
();
$data
=
[
'title'
=>
$this
->
title
,
'url'
=>
$this
->
url
,
'page'
=>
'Data Import Guru'
,
'excelGuru'
=>
$excelGuru
,
];
return
view
(
$this
->
views
.
"/index"
,
$data
);
}
public
function
create
()
{
$data
=
[
'title'
=>
$this
->
title
,
'url'
=>
$this
->
url
,
'page'
=>
'Import Excel Guru'
,
];
return
view
(
$this
->
views
.
"/create"
,
$data
);
}
public
function
store
(
Request
$request
)
{
// validasi
$validateData
=
$request
->
validate
([
'file_excel'
=>
'required|mimes:csv,xls,xlsx'
],
[
'file_excel.required'
=>
'Pilih file terlebih dahulu'
,
'file_excel.mimes'
=>
'Format data harus csv, xls atau xlsx'
,
]);
// Library Import Excel
$file
=
$validateData
[
'file_excel'
];
$collection
=
Excel
::
toCollection
(
collect
([]),
$file
);
// ke convert collection
$seenNips
=
[];
$bisa
=
0
;
$ada
=
0
;
$nipMasuk
=
[];
$nipGagal
=
[];
foreach
(
$collection
[
0
]
as
$row
)
{
// skip header
$i
=
0
;
if
(
$i
<>
1
)
{
if
(
$row
[
0
]
==
'nip'
)
continue
;
$nip
=
(
string
)
$row
[
0
];
$cekGuru
=
$this
->
mGuru
->
where
(
'nip'
,
$nip
)
->
first
();
if
(
isset
(
$cekGuru
))
{
$ada
++
;
continue
;
}
if
(
!
is_numeric
(
$nip
)
||
$nip
==
null
||
$row
[
1
]
==
null
||
strlen
(
$nip
)
<
10
)
{
$ada
++
;
$nipGagal
[]
=
[
'nip'
=>
$nip
,
'nama'
=>
$row
[
1
],
'reason'
=>
"Bukan numeric, data kosong atau nip kurang dari 10"
];
continue
;
}
if
(
isset
(
$seenNips
[
$nip
]))
{
$ada
++
;
$nipGagal
[]
=
[
'nip'
=>
$nip
,
'nama'
=>
$row
[
1
],
'reason'
=>
"NIP sudah terdaftar"
];
continue
;
// Jika NIP sudah ada, lewati iterasi ini
}
$seenNips
[
$nip
]
=
true
;
// tandai kalo sudah ada
// ambil dari excel
$idPSekolah
=
session
()
->
get
(
'idPSekolah'
);
$status
=
1
;
$nip
=
$nip
;
$nama
=
$row
[
1
];
$dataGuru
=
[
'idPSekolah'
=>
$idPSekolah
,
'nip'
=>
$nip
,
'nama'
=>
$nama
,
'status'
=>
$status
];
$guru
=
$this
->
mGuru
->
create
(
$dataGuru
);
$nipMasuk
[]
=
[
'nip'
=>
$nip
,
'nama'
=>
$nama
,
'reason'
=>
"masuk"
];
$bisa
++
;
}
$i
++
;
$recordImport
=
[
'idUser'
=>
session
()
->
get
(
'users_id'
),
'idPSekolah'
=>
session
()
->
get
(
'idPSekolah'
),
'idPPeriode'
=>
session
()
->
get
(
'idPPeriode'
),
'nip'
=>
$nip
,
'nama'
=>
$nama
];
$this
->
mExcelGuru
->
create
(
$recordImport
);
}
$pesan
=
'Data Guru di Kelas berhasil di import. masuk: '
.
$bisa
.
', gagal: '
.
$ada
.
' (karena sudah ada guru tsb / data ada yang kosong / nip dibawah 10 karakter / nip duplikasi / nip bukan angka)'
;
return
redirect
(
"
$this->url
"
)
->
with
(
'sukses'
,
$pesan
);
}
}
app/Http/Controllers/Admin/Import/ImportSiswaDapodikController.php
0 → 100644
View file @
704d1f4d
resources/views/admin/importdapodik/importGuru/create.blade.php
0 → 100644
View file @
704d1f4d
@
extends
(
$admin
)
@
section
(
'title'
)
{{
$title
}}
@
endsection
@
push
(
'css'
)
@
endpush
@
section
(
'content'
)
@
component
(
'components.breadcrumb'
)
@
slot
(
'breadcrumb_title'
)
<
h3
>
Halaman
</
h3
>
@
endslot
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<li class="
breadcrumb
-
item
active
">List</li>
@endcomponent
<div class="
container
-
fluid
">
<div class="
row
">
<div class="
col
-
sm
-
12
">
<div class="
card
">
<div class="
card
-
header
">
<div class="
row
">
<div class="
col
-
lg
-
6
">
<h5 class="
card
-
title
">{{
$page
}}</h5>
</div>
<div class="
col
-
lg
-
6
">
<a href="
{{
url
(
'excel-template/format_input_guru.xlsx'
)
}}
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Download Template</a>
</div>
</div>
</div>
</div>
</div>
<div class="
col
-
sm
-
12
">
<div class="
card
">
<div class="
card
-
body
">
<div class="
row
g
-
2
">
<form action="
{{
url
(
$url
)
}}
/
store
" method="
POST
" enctype="
multipart
/
form
-
data
">
@csrf
<div class="
mb
-
3
row
">
<label class="
col
-
sm
-
3
col
-
form
-
label
" for="
exampleFormControlTextarea4
">Import Excel</label>
<div class="
col
-
sm
-
9
">
<input class="
form
-
control
" name="
file_excel
" type="
file
" accept="
.
csv
,
.
xls
,
.
xlsx
">
</div>
</div>
<div>
<div class="
text
-
end
btn
-
mb
">
<input type="
submit
" value="
Migrasi
" class="
btn
btn
-
primary
">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
@endpush
@endsection
resources/views/admin/importdapodik/importGuru/index.blade.php
0 → 100644
View file @
704d1f4d
@
extends
(
$admin
)
@
section
(
'title'
)
{{
$title
}}
@
endsection
@
push
(
'css'
)
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"{{ asset('assets/css/datatables.css') }}"
>
@
endpush
@
section
(
'content'
)
@
component
(
'components.breadcrumb'
)
@
slot
(
'breadcrumb_title'
)
<
h3
>
Halaman
</
h3
>
@
endslot
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<li class="
breadcrumb
-
item
active
">List</li>
@endcomponent
<div class="
container
-
fluid
">
<div class="
row
">
<div class="
col
-
sm
-
12
">
{{-- Diberikan alert --}}
@if (session()->has('sukses'))
<div class="
alert
alert
-
success
" role="
alert
">
{{ session('sukses') }}
</div>
@elseif (session()->has('gagal'))
<div class="
alert
alert
-
danger
" role="
alert
">
{{ session('gagal') }}
</div>
@endif
<div class="
card
">
<div class="
card
-
header
p
-
3
">
<div class="
row
">
<div class="
col
-
lg
-
6
">
<h5 class="
card
-
title
">{{
$page
}}</h5>
</div>
<div class="
col
-
lg
-
6
">
<a href="
{{
url
(
$url
)
}}
/
create
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Import Guru</a>
</div>
</div>
</div>
<div class="
card
-
body
">
<div class="
table
-
responsive
">
<table class="
display
" id="
basic
-
1
">
<thead>
<tr>
<th width="
50
">No.</th>
<th>Periode</th>
<th>Waktu Import</th>
<th>Data Admin</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach (
$excelGuru
as
$r
)
<tr>
<td>{{
$loop->iteration
}}</td>
<td>{{
$r->periode
->nama_periode }}</td>
<td>{{
$r->created_at
}}</td>
<td>{{
$r->user
->username ?? '-' }}</td>
<td>
<a href="
{{
url
(
$url
)
}}
/
preview
" class="
btn
btn
-
sm
btn
">Lihat Data</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="
{{
asset
(
'assets/js/datatable/datatables/jquery.dataTables.min.js'
)
}}
"></script>
<script src="
{{
asset
(
'assets/js/datatable/datatables/datatable.custom.js'
)
}}
"></script>
<script>
$(function() {
$("
#isi-tabel").DataTable(); // tambahin ini ki
let
baseUrl
=
'{{ url('') }}'
;
let
idSekolah
=
"{{ session()->get('idsekolah') }}"
;
$
(
'#tabel-jquery'
)
.
hide
();
});
</
script
>
@
endpush
@
endsection
resources/views/admin/importdapodik/importGuru/preview.blade.php
0 → 100644
View file @
704d1f4d
@
extends
(
$admin
)
@
section
(
'title'
)
{{
$title
}}
@
endsection
@
push
(
'css'
)
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"{{ asset('assets/css/datatables.css') }}"
>
@
endpush
@
section
(
'content'
)
@
component
(
'components.breadcrumb'
)
@
slot
(
'breadcrumb_title'
)
<
h3
>
Halaman
</
h3
>
@
endslot
<
li
class
="
breadcrumb
-
item
">Halaman</li>
<li class="
breadcrumb
-
item
active
">List</li>
@endcomponent
<div class="
container
-
fluid
">
<div class="
row
">
<div class="
col
-
sm
-
12
">
{{-- Diberikan alert --}}
@if (session()->has('sukses'))
<div class="
alert
alert
-
success
" role="
alert
">
{{ session('sukses') }}
</div>
@elseif (session()->has('gagal'))
<div class="
alert
alert
-
danger
" role="
alert
">
{{ session('gagal') }}
</div>
@endif
<div class="
card
">
<div class="
card
-
header
p
-
3
">
<div class="
row
">
<div class="
col
-
lg
-
6
">
<h5 class="
card
-
title
">{{
$page
}}</h5>
</div>
<div class="
col
-
lg
-
6
">
<a href="
{{
url
(
$url
)
}}
" class="
btn
btn
-
sm
btn
-
primary
float
-
end
">Kembali</a>
</div>
</div>
</div>
<div class="
card
-
body
">
<div class="
table
-
responsive
">
<table class="
display
" id="
basic
-
1
">
<thead>
<tr>
<th width="
50
">No.</th>
<th>Periode</th>
<th>Waktu Import</th>
<th>Data Admin</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach (
$excelGuru
as
$r
)
<tr>
<td>{{
$loop->iteration
}}</td>
<td>{{
$r->periode
->nama_periode }}</td>
<td>{{
$r->created_at
}}</td>
<td>{{
$r->user
->username ?? '-' }}</td>
<td>
<a href="
{{
url
(
$url
)
}}
/
preview
" class="
btn
btn
-
sm
btn
">Lihat Data</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script src="
{{
asset
(
'assets/js/datatable/datatables/jquery.dataTables.min.js'
)
}}
"></script>
<script src="
{{
asset
(
'assets/js/datatable/datatables/datatable.custom.js'
)
}}
"></script>
<script>
$(function() {
$("
#isi-tabel").DataTable(); // tambahin ini ki
let
baseUrl
=
'{{ url('') }}'
;
let
idSekolah
=
"{{ session()->get('idsekolah') }}"
;
$
(
'#tabel-jquery'
)
.
hide
();
});
</
script
>
@
endpush
@
endsection
resources/views/layouts/admin/partials/sidebar/sidebar_sekolah.blade.php
View file @
704d1f4d
...
@@ -56,6 +56,12 @@
...
@@ -56,6 +56,12 @@
<li><a
href=
"{{ route('tahun-ajaran.update.siswa') }}"
class=
"{{ routeActive('tahun-ajaran.update.siswa') }}"
>
Update Data TA Siswa
</a></li>
<li><a
href=
"{{ route('tahun-ajaran.update.siswa') }}"
class=
"{{ routeActive('tahun-ajaran.update.siswa') }}"
>
Update Data TA Siswa
</a></li>
</ul>
</ul>
</li>
</li>
<li
class=
"dropdown"
>
<a
class=
"nav-link menu-title {{ prefixActive('/admin/import-dapodik') }}"
href=
"javascript:void(0)"
><i
data-feather=
"master"
></i><span>
Import Dapodik
</span></a>
<ul
class=
"nav-submenu menu-content"
style=
"display: {{ prefixBlock('/admin/import-dapodik') }}"
>
<li><a
href=
"{{ route('import-dapodik.guru') }}"
class=
"{{ routeActive('import-dapodik.guru') }}"
>
Import Guru
</a></li>
</ul>
</li>
<li
class=
"dropdown"
>
<li
class=
"dropdown"
>
<a
class=
"nav-link menu-title {{ prefixActive('/admin/import') }}"
href=
"javascript:void(0)"
><i
data-feather=
"master"
></i><span>
Import
</span></a>
<a
class=
"nav-link menu-title {{ prefixActive('/admin/import') }}"
href=
"javascript:void(0)"
><i
data-feather=
"master"
></i><span>
Import
</span></a>
<ul
class=
"nav-submenu menu-content"
style=
"display: {{ prefixBlock('/admin/import') }}"
>
<ul
class=
"nav-submenu menu-content"
style=
"display: {{ prefixBlock('/admin/import') }}"
>
...
...
routes/web_sekolah.php
View file @
704d1f4d
...
@@ -78,6 +78,12 @@ Route::prefix('/admin/tahun-ajaran')->group(function () {
...
@@ -78,6 +78,12 @@ Route::prefix('/admin/tahun-ajaran')->group(function () {
Route
::
get
(
'/siswa/{dataId?}'
,
'Admin\Periode\PeriodeSiswaKelasController@show'
);
Route
::
get
(
'/siswa/{dataId?}'
,
'Admin\Periode\PeriodeSiswaKelasController@show'
);
});
});
Route
::
prefix
(
'/admin/import-dapodik'
)
->
group
(
function
()
{
Route
::
get
(
'/guru'
,
'Admin\Import\ImportGuruDapodikController@index'
)
->
name
(
'import-dapodik.guru'
);
Route
::
get
(
'/guru/create'
,
'Admin\Import\ImportGuruDapodikController@create'
);
Route
::
post
(
'/guru/store'
,
'Admin\Import\ImportGuruDapodikController@store'
);
});
Route
::
prefix
(
'/admin/import'
)
->
group
(
function
()
{
Route
::
prefix
(
'/admin/import'
)
->
group
(
function
()
{
...
...
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