commit a10d6f70fbd84059de7034f65eba34db380b6849 Author: wartana Date: Sun Jan 18 14:22:18 2026 +0800 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e507c0d --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# Archives +*.zip +*.tar.gz +*.rar + +# Logs +*.log + +# System +.DS_Store +Thumbs.db + +# Dependencies (if any in future) +node_modules/ +vendor/ diff --git a/admin/datang/add_datang.php b/admin/datang/add_datang.php new file mode 100644 index 0000000..0b5d410 --- /dev/null +++ b/admin/datang/add_datang.php @@ -0,0 +1,100 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-datang'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/datang/data_datang.php b/admin/datang/data_datang.php new file mode 100644 index 0000000..65d1079 --- /dev/null +++ b/admin/datang/data_datang.php @@ -0,0 +1,74 @@ +
+
+

+ Data Pendatang

+
+ +
+
+
+ + Tambah Data +
+
+ + + + + + + + + + + + + + + query("SELECT d.id_datang, d.nik, d.nama_datang, d.jekel, d.tgl_datang, p.nama from + tb_datang d inner join tb_pdd p on d.pelapor=p.id_pend"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + + + +
NoNIKNamaJekelTanggalPelaporAksi
+ + + + + + + + + + + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/datang/del_datang.php b/admin/datang/del_datang.php new file mode 100644 index 0000000..8412deb --- /dev/null +++ b/admin/datang/del_datang.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-datang'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/datang/edit_datang.php b/admin/datang/edit_datang.php new file mode 100644 index 0000000..2f6ef2a --- /dev/null +++ b/admin/datang/edit_datang.php @@ -0,0 +1,128 @@ + + +
+
+

+ Ubah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+
+ + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-datang'; + } + })"; + }else{ + echo ""; + }} diff --git a/admin/kartu/add_kartu.php b/admin/kartu/add_kartu.php new file mode 100644 index 0000000..7b093bc --- /dev/null +++ b/admin/kartu/add_kartu.php @@ -0,0 +1,100 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-kartu'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/kartu/anggota.php b/admin/kartu/anggota.php new file mode 100644 index 0000000..5d0051f --- /dev/null +++ b/admin/kartu/anggota.php @@ -0,0 +1,165 @@ + + + +
+
+

+ Anggota KK

+
+
+
+ + + + +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + + + + + + + + + + + + query("SELECT p.nik, p.nama, p.jekel, a.hubungan, a.id_anggota + from tb_pdd p inner join tb_anggota a on p.id_pend=a.id_pend where status='Ada' and id_kk=$karkel"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + +
NIKNamaJekelHub KeluargaAksi
+ + + + + + + + + + + +
+
+
+
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=anggota&kode=".$_POST['id_kk']."'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/kartu/data_kartu.php b/admin/kartu/data_kartu.php new file mode 100644 index 0000000..5bc0d70 --- /dev/null +++ b/admin/kartu/data_kartu.php @@ -0,0 +1,74 @@ +
+
+

+ Data KK

+
+ +
+
+ +
+ + + + + + + + + + + + + + query("select * from tb_kk"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + + +
NoNO KKKepala KeluargaAlamatAnggota KKAksi
+ + + + + + + + RT + / RW + . + + + + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/kartu/del_anggota.php b/admin/kartu/del_anggota.php new file mode 100644 index 0000000..367189d --- /dev/null +++ b/admin/kartu/del_anggota.php @@ -0,0 +1,26 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-kartu'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/kartu/del_kartu.php b/admin/kartu/del_kartu.php new file mode 100644 index 0000000..0335786 --- /dev/null +++ b/admin/kartu/del_kartu.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-kartu'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/kartu/edit_kartu.php b/admin/kartu/edit_kartu.php new file mode 100644 index 0000000..07303ce --- /dev/null +++ b/admin/kartu/edit_kartu.php @@ -0,0 +1,127 @@ + + +
+
+

+ Ubah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+
+ + + + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-kartu'; + } + })"; + }else{ + echo ""; + }} diff --git a/admin/lahir/add_lahir.php b/admin/lahir/add_lahir.php new file mode 100644 index 0000000..a1d121d --- /dev/null +++ b/admin/lahir/add_lahir.php @@ -0,0 +1,92 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ + +
+ + +
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-lahir'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/lahir/data_lahir.php b/admin/lahir/data_lahir.php new file mode 100644 index 0000000..cf9b69e --- /dev/null +++ b/admin/lahir/data_lahir.php @@ -0,0 +1,71 @@ +
+
+

+ Data Kelahiran

+
+ +
+
+ +
+ + + + + + + + + + + + + + query("SELECT l.id_lahir, l.nama, l.tgl_lh, l.jekel, k.no_kk, k.kepala from + tb_lahir l inner join tb_kk k on k.id_kk=l.id_kk"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + + +
NoNamaTgl LahirJekelKeluargaAksi
+ + + + + + + + + - + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/lahir/del_lahir.php b/admin/lahir/del_lahir.php new file mode 100644 index 0000000..738636f --- /dev/null +++ b/admin/lahir/del_lahir.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-lahir'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/lahir/edit_lahir.php b/admin/lahir/edit_lahir.php new file mode 100644 index 0000000..e2b8ddc --- /dev/null +++ b/admin/lahir/edit_lahir.php @@ -0,0 +1,118 @@ + + +
+
+

+ Ubah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-lahir'; + } + })"; + }else{ + echo ""; + }} diff --git a/admin/mendu/add_mendu.php b/admin/mendu/add_mendu.php new file mode 100644 index 0000000..0e203a6 --- /dev/null +++ b/admin/mendu/add_mendu.php @@ -0,0 +1,86 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-mendu'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/mendu/data_mendu.php b/admin/mendu/data_mendu.php new file mode 100644 index 0000000..bca0beb --- /dev/null +++ b/admin/mendu/data_mendu.php @@ -0,0 +1,70 @@ +
+
+

+ Data Kematian

+
+ +
+
+ +
+ + + + + + + + + + + + + + query("SELECT p.id_pend, p.nik, p.nama, m.tgl_mendu, m.sebab, m.id_mendu from + tb_mendu m inner join tb_pdd p on p.id_pend=m.id_pdd"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + + +
NoNIKNamaTanggalSebabAksi
+ + + + + + + + + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/mendu/del_mendu.php b/admin/mendu/del_mendu.php new file mode 100644 index 0000000..72f8005 --- /dev/null +++ b/admin/mendu/del_mendu.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-mendu'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/mendu/edit_mendu.php b/admin/mendu/edit_mendu.php new file mode 100644 index 0000000..fb64ca2 --- /dev/null +++ b/admin/mendu/edit_mendu.php @@ -0,0 +1,83 @@ + + +
+
+

+ Ubah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-mendu'; + } + })"; + }else{ + echo ""; + }} diff --git a/admin/pend/add_pend.php b/admin/pend/add_pend.php new file mode 100644 index 0000000..384b815 --- /dev/null +++ b/admin/pend/add_pend.php @@ -0,0 +1,131 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-pend'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/pend/data_pend.php b/admin/pend/data_pend.php new file mode 100644 index 0000000..d422bf3 --- /dev/null +++ b/admin/pend/data_pend.php @@ -0,0 +1,84 @@ +
+
+

+ Data Penduduk

+
+ +
+
+ +
+ + + + + + + + + + + + + + + query("SELECT p.id_pend, p.nik, p.nama, p.jekel, p.desa, p.rt, p.rw, a.id_kk, k.no_kk, k.kepala from + tb_pdd p left join tb_anggota a on p.id_pend=a.id_pend + left join tb_kk k on a.id_kk=k.id_kk where status='Ada'"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + + + + +
NoNIKNamaJKAlamatNo KKAksi
+ + + + + + + + + + RT + / RW + . + + - + + + + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/pend/del_pend.php b/admin/pend/del_pend.php new file mode 100644 index 0000000..eb9f45c --- /dev/null +++ b/admin/pend/del_pend.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-pend'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/pend/edit_pend.php b/admin/pend/edit_pend.php new file mode 100644 index 0000000..150f7e1 --- /dev/null +++ b/admin/pend/edit_pend.php @@ -0,0 +1,171 @@ + + +
+
+

+ Ubah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-pend'; + } + })"; + }else{ + echo ""; + }} diff --git a/admin/pend/view_pend.php b/admin/pend/view_pend.php new file mode 100644 index 0000000..d1880b3 --- /dev/null +++ b/admin/pend/view_pend.php @@ -0,0 +1,97 @@ + + +
+
+

+ Detail Penduduk

+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ NIK + : + +
+ Nama + : + +
+ TTL + : + + / + +
+ Jenis Kelamin + : + +
+ Alamat + : + , RT + / RW + +
+ Agama + : + +
+ Status Kawin + : + +
+ Pekerjaan + : + +
+ +
+
\ No newline at end of file diff --git a/admin/pengguna/add_pengguna.php b/admin/pengguna/add_pengguna.php new file mode 100644 index 0000000..f5f258d --- /dev/null +++ b/admin/pengguna/add_pengguna.php @@ -0,0 +1,76 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-pengguna'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/pengguna/data_pengguna.php b/admin/pengguna/data_pengguna.php new file mode 100644 index 0000000..cfe431b --- /dev/null +++ b/admin/pengguna/data_pengguna.php @@ -0,0 +1,65 @@ +
+
+

+ Data User

+
+ +
+
+ +
+ + + + + + + + + + + + + query("select * from tb_pengguna"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + +
NoNama UserUsernameLevelAksi
+ + + + + + + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/pengguna/del_pengguna.php b/admin/pengguna/del_pengguna.php new file mode 100644 index 0000000..c8cc182 --- /dev/null +++ b/admin/pengguna/del_pengguna.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-pengguna'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/pengguna/edit_pengguna.php b/admin/pengguna/edit_pengguna.php new file mode 100644 index 0000000..bde11f3 --- /dev/null +++ b/admin/pengguna/edit_pengguna.php @@ -0,0 +1,118 @@ + + +
+
+

+ Ubah Data

+
+
+
+ + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ + Lihat Password +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-pengguna'; + } + })"; + }else{ + echo ""; + }} +?> + + \ No newline at end of file diff --git a/admin/pindah/add_pindah.php b/admin/pindah/add_pindah.php new file mode 100644 index 0000000..c9cd9b3 --- /dev/null +++ b/admin/pindah/add_pindah.php @@ -0,0 +1,86 @@ +
+
+

+ Tambah Data

+
+
+
+ +
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Tambah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value){ + window.location = 'index.php?page=data-pindah'; + } + })"; + }else{ + echo ""; + }} + //selesai proses simpan data diff --git a/admin/pindah/data_pindah.php b/admin/pindah/data_pindah.php new file mode 100644 index 0000000..85fe22e --- /dev/null +++ b/admin/pindah/data_pindah.php @@ -0,0 +1,70 @@ +
+
+

+ Data Pindah

+
+ +
+
+ +
+ + + + + + + + + + + + + + query("SELECT p.id_pend, p.nik, p.nama, d.tgl_pindah, d.alasan, d.id_pindah from + tb_pindah d inner join tb_pdd p on p.id_pend=d.id_pdd"); + while ($data= $sql->fetch_assoc()) { + ?> + + + + + + + + + + + + + +
NoNIKNamaTanggalAlasanAksi
+ + + + + + + + + + + + + + + + +
+
+
+ \ No newline at end of file diff --git a/admin/pindah/del_pindah.php b/admin/pindah/del_pindah.php new file mode 100644 index 0000000..2c068dc --- /dev/null +++ b/admin/pindah/del_pindah.php @@ -0,0 +1,24 @@ + + Swal.fire({title: 'Hapus Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => { + if (result.value) { + window.location = 'index.php?page=data-pindah'; + } + })"; + }else{ + echo ""; + } + } + diff --git a/admin/pindah/edit_pindah.php b/admin/pindah/edit_pindah.php new file mode 100644 index 0000000..2a17a5c --- /dev/null +++ b/admin/pindah/edit_pindah.php @@ -0,0 +1,83 @@ + + +
+
+

+ Ubah Data

+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ + + Swal.fire({title: 'Ubah Data Berhasil',text: '',icon: 'success',confirmButtonText: 'OK' + }).then((result) => {if (result.value) + {window.location = 'index.php?page=data-pindah'; + } + })"; + }else{ + echo ""; + }} diff --git a/build/config/postcss.config.js b/build/config/postcss.config.js new file mode 100644 index 0000000..157291f --- /dev/null +++ b/build/config/postcss.config.js @@ -0,0 +1,14 @@ +'use strict' + +module.exports = (ctx) => ({ + map: ctx.file.dirname.includes('examples') ? false : { + inline: false, + annotation: true, + sourcesContent: true + }, + plugins: { + autoprefixer: { + cascade: false + } + } +}) diff --git a/build/config/rollup.config.js b/build/config/rollup.config.js new file mode 100644 index 0000000..1f08394 --- /dev/null +++ b/build/config/rollup.config.js @@ -0,0 +1,29 @@ +import babel from 'rollup-plugin-babel' + +const pkg = require('../../package') +const year = new Date().getFullYear() + +const globals = { + jquery: 'jQuery' +} + +export default { + input : 'build/js/AdminLTE.js', + output : { + banner: `/*! + * AdminLTE v${pkg.version} (${pkg.homepage}) + * Copyright 2014-${year} ${pkg.author} + * Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE) + */`, + file : 'dist/js/adminlte.js', + format: 'umd', + globals, + name : 'adminlte' + }, + plugins: [ + babel({ + exclude: 'node_modules/**', + externalHelpers: true + }) + ] +} diff --git a/build/js/.jscsrc b/build/js/.jscsrc new file mode 100644 index 0000000..a2ec95b --- /dev/null +++ b/build/js/.jscsrc @@ -0,0 +1,44 @@ +{ + "esnext": true, + "verbose": true, + "disallowEmptyBlocks": true, + "disallowKeywords": ["with"], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleLineStrings": true, + "disallowMultipleVarDecl": true, + "disallowQuotedKeysInObjects": "allButReserved", + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "disallowSpaceBeforeBinaryOperators": [","], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "disallowSpacesInsideArrayBrackets": true, + "disallowSpacesInsideParentheses": true, + "disallowTrailingComma": true, + "disallowTrailingWhitespace": true, + "requireCamelCaseOrUpperCaseIdentifiers": true, + "requireCapitalizedConstructors": true, + "requireCommaBeforeLineBreak": true, + "requireDollarBeforejQueryAssignment": true, + "requireDotNotation": true, + "requireLineFeedAtFileEnd": true, + "requirePaddingNewLinesAfterUseStrict": true, + "requirePaddingNewLinesBeforeExport": true, + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], + "requireSpaceAfterLineComment": true, + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], + "requireSpaceBetweenArguments": true, + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true, "beforeOpeningRoundBrace": true, "allExcept": ["shorthand"] }, + "requireSpacesInConditionalExpression": true, + "requireSpacesInForStatement": true, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "requireSpacesInsideObjectBrackets": "allButNested", + "validateAlignedFunctionParameters": true, + "validateIndentation": 2, + "validateLineBreaks": "LF", + "validateNewlineAfterArrayElements": true, + "validateQuoteMarks": "'" +} diff --git a/build/js/AdminLTE.js b/build/js/AdminLTE.js new file mode 100644 index 0000000..3658c13 --- /dev/null +++ b/build/js/AdminLTE.js @@ -0,0 +1,23 @@ +import ControlSidebar from './ControlSidebar' +import Layout from './Layout' +import PushMenu from './PushMenu' +import Treeview from './Treeview' +import DirectChat from './DirectChat' +import TodoList from './TodoList' +import CardWidget from './CardWidget' +import CardRefresh from './CardRefresh' +import Dropdown from './Dropdown' +import Toasts from './Toasts' + +export { + ControlSidebar, + Layout, + PushMenu, + Treeview, + DirectChat, + TodoList, + CardWidget, + CardRefresh, + Dropdown, + Toasts +} diff --git a/build/js/CardRefresh.js b/build/js/CardRefresh.js new file mode 100644 index 0000000..fb27223 --- /dev/null +++ b/build/js/CardRefresh.js @@ -0,0 +1,164 @@ +/** + * -------------------------------------------- + * AdminLTE CardRefresh.js + * License MIT + * -------------------------------------------- + */ + +const CardRefresh = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'CardRefresh' + const DATA_KEY = 'lte.cardrefresh' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Event = { + LOADED: `loaded${EVENT_KEY}`, + OVERLAY_ADDED: `overlay.added${EVENT_KEY}`, + OVERLAY_REMOVED: `overlay.removed${EVENT_KEY}`, + } + + const ClassName = { + CARD: 'card', + } + + const Selector = { + CARD: `.${ClassName.CARD}`, + DATA_REFRESH: '[data-card-widget="card-refresh"]', + } + + const Default = { + source: '', + sourceSelector: '', + params: {}, + trigger: Selector.DATA_REFRESH, + content: '.card-body', + loadInContent: true, + loadOnInit: true, + responseType: '', + overlayTemplate: '
', + onLoadStart: function () { + }, + onLoadDone: function (response) { + return response; + } + } + + class CardRefresh { + constructor(element, settings) { + this._element = element + this._parent = element.parents(Selector.CARD).first() + this._settings = $.extend({}, Default, settings) + this._overlay = $(this._settings.overlayTemplate) + + if (element.hasClass(ClassName.CARD)) { + this._parent = element + } + + if (this._settings.source === '') { + throw new Error('Source url was not defined. Please specify a url in your CardRefresh source option.'); + } + + this._init(); + + if (this._settings.loadOnInit) { + this.load(); + } + } + + load() { + this._addOverlay() + this._settings.onLoadStart.call($(this)) + + $.get(this._settings.source, this._settings.params, function (response) { + if (this._settings.loadInContent) { + if (this._settings.sourceSelector != '') { + response = $(response).find(this._settings.sourceSelector).html() + } + + this._parent.find(this._settings.content).html(response) + } + + this._settings.onLoadDone.call($(this), response) + this._removeOverlay(); + }.bind(this), this._settings.responseType !== '' && this._settings.responseType) + + const loadedEvent = $.Event(Event.LOADED) + $(this._element).trigger(loadedEvent) + } + + _addOverlay() { + this._parent.append(this._overlay) + + const overlayAddedEvent = $.Event(Event.OVERLAY_ADDED) + $(this._element).trigger(overlayAddedEvent) + }; + + _removeOverlay() { + this._parent.find(this._overlay).remove() + + const overlayRemovedEvent = $.Event(Event.OVERLAY_REMOVED) + $(this._element).trigger(overlayRemovedEvent) + }; + + + // Private + + _init(card) { + $(this).find(this._settings.trigger).on('click', () => { + this.load() + }) + } + + // Static + + static _jQueryInterface(config) { + let data = $(this).data(DATA_KEY) + const _options = $.extend({}, Default, $(this).data()) + + if (!data) { + data = new CardRefresh($(this), _options) + $(this).data(DATA_KEY, typeof config === 'string' ? data: config) + } + + if (typeof config === 'string' && config.match(/load/)) { + data[config]() + } else if (typeof config === 'object') { + data._init($(this)) + } + } + } + + /** + * Data API + * ==================================================== + */ + + $(document).on('click', Selector.DATA_REFRESH, function (event) { + if (event) { + event.preventDefault() + } + + CardRefresh._jQueryInterface.call($(this), 'load') + }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = CardRefresh._jQueryInterface + $.fn[NAME].Constructor = CardRefresh + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return CardRefresh._jQueryInterface + } + + return CardRefresh +})(jQuery) + +export default CardRefresh diff --git a/build/js/CardWidget.js b/build/js/CardWidget.js new file mode 100644 index 0000000..7b33683 --- /dev/null +++ b/build/js/CardWidget.js @@ -0,0 +1,251 @@ +/** + * -------------------------------------------- + * AdminLTE CardWidget.js + * License MIT + * -------------------------------------------- + */ + +const CardWidget = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'CardWidget' + const DATA_KEY = 'lte.cardwidget' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Event = { + EXPANDED: `expanded${EVENT_KEY}`, + COLLAPSED: `collapsed${EVENT_KEY}`, + MAXIMIZED: `maximized${EVENT_KEY}`, + MINIMIZED: `minimized${EVENT_KEY}`, + REMOVED: `removed${EVENT_KEY}` + } + + const ClassName = { + CARD: 'card', + COLLAPSED: 'collapsed-card', + WAS_COLLAPSED: 'was-collapsed', + MAXIMIZED: 'maximized-card', + } + + const Selector = { + DATA_REMOVE: '[data-card-widget="remove"]', + DATA_COLLAPSE: '[data-card-widget="collapse"]', + DATA_MAXIMIZE: '[data-card-widget="maximize"]', + CARD: `.${ClassName.CARD}`, + CARD_HEADER: '.card-header', + CARD_BODY: '.card-body', + CARD_FOOTER: '.card-footer', + COLLAPSED: `.${ClassName.COLLAPSED}`, + } + + const Default = { + animationSpeed: 'normal', + collapseTrigger: Selector.DATA_COLLAPSE, + removeTrigger: Selector.DATA_REMOVE, + maximizeTrigger: Selector.DATA_MAXIMIZE, + collapseIcon: 'fa-minus', + expandIcon: 'fa-plus', + maximizeIcon: 'fa-expand', + minimizeIcon: 'fa-compress', + } + + class CardWidget { + constructor(element, settings) { + this._element = element + this._parent = element.parents(Selector.CARD).first() + + if (element.hasClass(ClassName.CARD)) { + this._parent = element + } + + this._settings = $.extend({}, Default, settings) + } + + collapse() { + this._parent.children(`${Selector.CARD_BODY}, ${Selector.CARD_FOOTER}`) + .slideUp(this._settings.animationSpeed, () => { + this._parent.addClass(ClassName.COLLAPSED) + }) + + this._parent.find('> ' + Selector.CARD_HEADER + ' ' + this._settings.collapseTrigger + ' .' + this._settings.collapseIcon) + .addClass(this._settings.expandIcon) + .removeClass(this._settings.collapseIcon) + + const collapsed = $.Event(Event.COLLAPSED) + + this._element.trigger(collapsed, this._parent) + } + + expand() { + this._parent.children(`${Selector.CARD_BODY}, ${Selector.CARD_FOOTER}`) + .slideDown(this._settings.animationSpeed, () => { + this._parent.removeClass(ClassName.COLLAPSED) + }) + + this._parent.find('> ' + Selector.CARD_HEADER + ' ' + this._settings.collapseTrigger + ' .' + this._settings.expandIcon) + .addClass(this._settings.collapseIcon) + .removeClass(this._settings.expandIcon) + + const expanded = $.Event(Event.EXPANDED) + + this._element.trigger(expanded, this._parent) + } + + remove() { + this._parent.slideUp() + + const removed = $.Event(Event.REMOVED) + + this._element.trigger(removed, this._parent) + } + + toggle() { + if (this._parent.hasClass(ClassName.COLLAPSED)) { + this.expand() + return + } + + this.collapse() + } + + maximize() { + this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.maximizeIcon) + .addClass(this._settings.minimizeIcon) + .removeClass(this._settings.maximizeIcon) + this._parent.css({ + 'height': this._parent.height(), + 'width': this._parent.width(), + 'transition': 'all .15s' + }).delay(150).queue(function(){ + $(this).addClass(ClassName.MAXIMIZED) + $('html').addClass(ClassName.MAXIMIZED) + if ($(this).hasClass(ClassName.COLLAPSED)) { + $(this).addClass(ClassName.WAS_COLLAPSED) + } + $(this).dequeue() + }) + + const maximized = $.Event(Event.MAXIMIZED) + + this._element.trigger(maximized, this._parent) + } + + minimize() { + this._parent.find(this._settings.maximizeTrigger + ' .' + this._settings.minimizeIcon) + .addClass(this._settings.maximizeIcon) + .removeClass(this._settings.minimizeIcon) + this._parent.css('cssText', 'height:' + this._parent[0].style.height + ' !important;' + + 'width:' + this._parent[0].style.width + ' !important; transition: all .15s;' + ).delay(10).queue(function(){ + $(this).removeClass(ClassName.MAXIMIZED) + $('html').removeClass(ClassName.MAXIMIZED) + $(this).css({ + 'height': 'inherit', + 'width': 'inherit' + }) + if ($(this).hasClass(ClassName.WAS_COLLAPSED)) { + $(this).removeClass(ClassName.WAS_COLLAPSED) + } + $(this).dequeue() + }) + + const MINIMIZED = $.Event(Event.MINIMIZED) + + this._element.trigger(MINIMIZED, this._parent) + } + + toggleMaximize() { + if (this._parent.hasClass(ClassName.MAXIMIZED)) { + this.minimize() + return + } + + this.maximize() + } + + // Private + + _init(card) { + this._parent = card + + $(this).find(this._settings.collapseTrigger).click(() => { + this.toggle() + }) + + $(this).find(this._settings.maximizeTrigger).click(() => { + this.toggleMaximize() + }) + + $(this).find(this._settings.removeTrigger).click(() => { + this.remove() + }) + } + + // Static + + static _jQueryInterface(config) { + let data = $(this).data(DATA_KEY) + const _options = $.extend({}, Default, $(this).data()) + + if (!data) { + data = new CardWidget($(this), _options) + $(this).data(DATA_KEY, typeof config === 'string' ? data: config) + } + + if (typeof config === 'string' && config.match(/collapse|expand|remove|toggle|maximize|minimize|toggleMaximize/)) { + data[config]() + } else if (typeof config === 'object') { + data._init($(this)) + } + } + } + + /** + * Data API + * ==================================================== + */ + + $(document).on('click', Selector.DATA_COLLAPSE, function (event) { + if (event) { + event.preventDefault() + } + + CardWidget._jQueryInterface.call($(this), 'toggle') + }) + + $(document).on('click', Selector.DATA_REMOVE, function (event) { + if (event) { + event.preventDefault() + } + + CardWidget._jQueryInterface.call($(this), 'remove') + }) + + $(document).on('click', Selector.DATA_MAXIMIZE, function (event) { + if (event) { + event.preventDefault() + } + + CardWidget._jQueryInterface.call($(this), 'toggleMaximize') + }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = CardWidget._jQueryInterface + $.fn[NAME].Constructor = CardWidget + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return CardWidget._jQueryInterface + } + + return CardWidget +})(jQuery) + +export default CardWidget diff --git a/build/js/ControlSidebar.js b/build/js/ControlSidebar.js new file mode 100644 index 0000000..a330885 --- /dev/null +++ b/build/js/ControlSidebar.js @@ -0,0 +1,292 @@ +/** + * -------------------------------------------- + * AdminLTE ControlSidebar.js + * License MIT + * -------------------------------------------- + */ + +const ControlSidebar = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'ControlSidebar' + const DATA_KEY = 'lte.controlsidebar' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + const DATA_API_KEY = '.data-api' + + const Event = { + COLLAPSED: `collapsed${EVENT_KEY}`, + EXPANDED: `expanded${EVENT_KEY}`, + } + + const Selector = { + CONTROL_SIDEBAR: '.control-sidebar', + CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content', + DATA_TOGGLE: '[data-widget="control-sidebar"]', + CONTENT: '.content-wrapper', + HEADER: '.main-header', + FOOTER: '.main-footer', + } + + const ClassName = { + CONTROL_SIDEBAR_ANIMATE: 'control-sidebar-animate', + CONTROL_SIDEBAR_OPEN: 'control-sidebar-open', + CONTROL_SIDEBAR_SLIDE: 'control-sidebar-slide-open', + LAYOUT_FIXED: 'layout-fixed', + NAVBAR_FIXED: 'layout-navbar-fixed', + NAVBAR_SM_FIXED: 'layout-sm-navbar-fixed', + NAVBAR_MD_FIXED: 'layout-md-navbar-fixed', + NAVBAR_LG_FIXED: 'layout-lg-navbar-fixed', + NAVBAR_XL_FIXED: 'layout-xl-navbar-fixed', + FOOTER_FIXED: 'layout-footer-fixed', + FOOTER_SM_FIXED: 'layout-sm-footer-fixed', + FOOTER_MD_FIXED: 'layout-md-footer-fixed', + FOOTER_LG_FIXED: 'layout-lg-footer-fixed', + FOOTER_XL_FIXED: 'layout-xl-footer-fixed', + } + + const Default = { + controlsidebarSlide: true, + scrollbarTheme : 'os-theme-light', + scrollbarAutoHide: 'l', + } + + /** + * Class Definition + * ==================================================== + */ + + class ControlSidebar { + constructor(element, config) { + this._element = element + this._config = config + + this._init() + } + + // Public + + collapse() { + // Show the control sidebar + if (this._config.controlsidebarSlide) { + $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE) + $('body').removeClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function(){ + $(Selector.CONTROL_SIDEBAR).hide() + $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE) + $(this).dequeue() + }) + } else { + $('body').removeClass(ClassName.CONTROL_SIDEBAR_OPEN) + } + + const collapsedEvent = $.Event(Event.COLLAPSED) + $(this._element).trigger(collapsedEvent) + } + + show() { + // Collapse the control sidebar + if (this._config.controlsidebarSlide) { + $('html').addClass(ClassName.CONTROL_SIDEBAR_ANIMATE) + $(Selector.CONTROL_SIDEBAR).show().delay(10).queue(function(){ + $('body').addClass(ClassName.CONTROL_SIDEBAR_SLIDE).delay(300).queue(function(){ + $('html').removeClass(ClassName.CONTROL_SIDEBAR_ANIMATE) + $(this).dequeue() + }) + $(this).dequeue() + }) + } else { + $('body').addClass(ClassName.CONTROL_SIDEBAR_OPEN) + } + + const expandedEvent = $.Event(Event.EXPANDED) + $(this._element).trigger(expandedEvent) + } + + toggle() { + const shouldClose = $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body') + .hasClass(ClassName.CONTROL_SIDEBAR_SLIDE) + if (shouldClose) { + // Close the control sidebar + this.collapse() + } else { + // Open the control sidebar + this.show() + } + } + + // Private + + _init() { + this._fixHeight() + this._fixScrollHeight() + + $(window).resize(() => { + this._fixHeight() + this._fixScrollHeight() + }) + + $(window).scroll(() => { + if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE)) { + this._fixScrollHeight() + } + }) + } + + _fixScrollHeight() { + const heights = { + scroll: $(document).height(), + window: $(window).height(), + header: $(Selector.HEADER).outerHeight(), + footer: $(Selector.FOOTER).outerHeight(), + } + const positions = { + bottom: Math.abs((heights.window + $(window).scrollTop()) - heights.scroll), + top: $(window).scrollTop(), + } + + let navbarFixed = false; + let footerFixed = false; + + if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { + if ( + $('body').hasClass(ClassName.NAVBAR_FIXED) + || $('body').hasClass(ClassName.NAVBAR_SM_FIXED) + || $('body').hasClass(ClassName.NAVBAR_MD_FIXED) + || $('body').hasClass(ClassName.NAVBAR_LG_FIXED) + || $('body').hasClass(ClassName.NAVBAR_XL_FIXED) + ) { + if ($(Selector.HEADER).css("position") === "fixed") { + navbarFixed = true; + } + } + if ( + $('body').hasClass(ClassName.FOOTER_FIXED) + || $('body').hasClass(ClassName.FOOTER_SM_FIXED) + || $('body').hasClass(ClassName.FOOTER_MD_FIXED) + || $('body').hasClass(ClassName.FOOTER_LG_FIXED) + || $('body').hasClass(ClassName.FOOTER_XL_FIXED) + ) { + if ($(Selector.FOOTER).css("position") === "fixed") { + footerFixed = true; + } + } + + if (positions.top === 0 && positions.bottom === 0) { + $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer); + $(Selector.CONTROL_SIDEBAR).css('top', heights.header); + $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header + heights.footer)) + } else if (positions.bottom <= heights.footer) { + if (footerFixed === false) { + $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer - positions.bottom); + $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.footer - positions.bottom)) + } else { + $(Selector.CONTROL_SIDEBAR).css('bottom', heights.footer); + } + } else if (positions.top <= heights.header) { + if (navbarFixed === false) { + $(Selector.CONTROL_SIDEBAR).css('top', heights.header - positions.top); + $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window - (heights.header - positions.top)) + } else { + $(Selector.CONTROL_SIDEBAR).css('top', heights.header); + } + } else { + if (navbarFixed === false) { + $(Selector.CONTROL_SIDEBAR).css('top', 0); + $(Selector.CONTROL_SIDEBAR + ', ' + Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', heights.window) + } else { + $(Selector.CONTROL_SIDEBAR).css('top', heights.header); + } + } + } + } + + _fixHeight() { + const heights = { + window: $(window).height(), + header: $(Selector.HEADER).outerHeight(), + footer: $(Selector.FOOTER).outerHeight(), + } + + if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { + let sidebarHeight = heights.window - heights.header; + + if ( + $('body').hasClass(ClassName.FOOTER_FIXED) + || $('body').hasClass(ClassName.FOOTER_SM_FIXED) + || $('body').hasClass(ClassName.FOOTER_MD_FIXED) + || $('body').hasClass(ClassName.FOOTER_LG_FIXED) + || $('body').hasClass(ClassName.FOOTER_XL_FIXED) + ) { + if ($(Selector.FOOTER).css("position") === "fixed") { + sidebarHeight = heights.window - heights.header - heights.footer; + } + } + + $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).css('height', sidebarHeight) + + if (typeof $.fn.overlayScrollbars !== 'undefined') { + $(Selector.CONTROL_SIDEBAR + ' ' + Selector.CONTROL_SIDEBAR_CONTENT).overlayScrollbars({ + className : this._config.scrollbarTheme, + sizeAutoCapable : true, + scrollbars : { + autoHide: this._config.scrollbarAutoHide, + clickScrolling : true + } + }) + } + } + } + + + // Static + + static _jQueryInterface(operation) { + return this.each(function () { + let data = $(this).data(DATA_KEY) + const _options = $.extend({}, Default, $(this).data()) + + if (!data) { + data = new ControlSidebar(this, _options) + $(this).data(DATA_KEY, data) + } + + if (data[operation] === 'undefined') { + throw new Error(`${operation} is not a function`) + } + + data[operation]() + }) + } + } + + /** + * + * Data Api implementation + * ==================================================== + */ + $(document).on('click', Selector.DATA_TOGGLE, function (event) { + event.preventDefault() + + ControlSidebar._jQueryInterface.call($(this), 'toggle') + }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = ControlSidebar._jQueryInterface + $.fn[NAME].Constructor = ControlSidebar + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return ControlSidebar._jQueryInterface + } + + return ControlSidebar +})(jQuery) + +export default ControlSidebar + diff --git a/build/js/DirectChat.js b/build/js/DirectChat.js new file mode 100644 index 0000000..c211bc7 --- /dev/null +++ b/build/js/DirectChat.js @@ -0,0 +1,92 @@ +/** + * -------------------------------------------- + * AdminLTE DirectChat.js + * License MIT + * -------------------------------------------- + */ + +const DirectChat = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'DirectChat' + const DATA_KEY = 'lte.directchat' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + const DATA_API_KEY = '.data-api' + + const Event = { + TOGGLED: `toggled{EVENT_KEY}` + } + + const Selector = { + DATA_TOGGLE: '[data-widget="chat-pane-toggle"]', + DIRECT_CHAT: '.direct-chat' + }; + + const ClassName = { + DIRECT_CHAT_OPEN: 'direct-chat-contacts-open' + }; + + /** + * Class Definition + * ==================================================== + */ + + class DirectChat { + constructor(element, config) { + this._element = element + } + + toggle() { + $(this._element).parents(Selector.DIRECT_CHAT).first().toggleClass(ClassName.DIRECT_CHAT_OPEN); + + const toggledEvent = $.Event(Event.TOGGLED) + $(this._element).trigger(toggledEvent) + } + + // Static + + static _jQueryInterface(config) { + return this.each(function () { + let data = $(this).data(DATA_KEY) + + if (!data) { + data = new DirectChat($(this)) + $(this).data(DATA_KEY, data) + } + + data[config]() + }) + } + } + + /** + * + * Data Api implementation + * ==================================================== + */ + + $(document).on('click', Selector.DATA_TOGGLE, function (event) { + if (event) event.preventDefault(); + DirectChat._jQueryInterface.call($(this), 'toggle'); + }); + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = DirectChat._jQueryInterface + $.fn[NAME].Constructor = DirectChat + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return DirectChat._jQueryInterface + } + + return DirectChat +})(jQuery) + +export default DirectChat diff --git a/build/js/Dropdown.js b/build/js/Dropdown.js new file mode 100644 index 0000000..2c58cdf --- /dev/null +++ b/build/js/Dropdown.js @@ -0,0 +1,112 @@ +/** + * -------------------------------------------- + * AdminLTE Dropdown.js + * License MIT + * -------------------------------------------- + */ + +const Dropdown = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'Dropdown' + const DATA_KEY = 'lte.dropdown' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Selector = { + DROPDOWN_MENU: 'ul.dropdown-menu', + DROPDOWN_TOGGLE: '[data-toggle="dropdown"]', + } + + const ClassName = { + DROPDOWN_HOVER: '.dropdown-hover' + } + + const Default = { + } + + + /** + * Class Definition + * ==================================================== + */ + + class Dropdown { + constructor(element, config) { + this._config = config + this._element = element + } + + // Public + + toggleSubmenu() { + this._element.siblings().show().toggleClass("show"); + + if (! this._element.next().hasClass('show')) { + this._element.parents('.dropdown-menu').first().find('.show').removeClass("show").hide(); + } + + this._element.parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) { + $('.dropdown-submenu .show').removeClass("show").hide(); + }); + + } + + // Static + + static _jQueryInterface(config) { + return this.each(function () { + let data = $(this).data(DATA_KEY) + const _config = $.extend({}, Default, $(this).data()) + + if (!data) { + data = new Dropdown($(this), _config) + $(this).data(DATA_KEY, data) + } + + if (config === 'toggleSubmenu') { + data[config]() + } + }) + } + } + + /** + * Data API + * ==================================================== + */ + + $(Selector.DROPDOWN_MENU + ' ' + Selector.DROPDOWN_TOGGLE).on("click", function(event) { + event.preventDefault(); + event.stopPropagation(); + + Dropdown._jQueryInterface.call($(this), 'toggleSubmenu') + }); + + // $(Selector.SIDEBAR + ' a').on('focusin', () => { + // $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED); + // }) + + // $(Selector.SIDEBAR + ' a').on('focusout', () => { + // $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED); + // }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = Dropdown._jQueryInterface + $.fn[NAME].Constructor = Dropdown + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return Dropdown._jQueryInterface + } + + return Dropdown +})(jQuery) + +export default Dropdown diff --git a/build/js/Layout.js b/build/js/Layout.js new file mode 100644 index 0000000..1a8cbb3 --- /dev/null +++ b/build/js/Layout.js @@ -0,0 +1,218 @@ +/** + * -------------------------------------------- + * AdminLTE Layout.js + * License MIT + * -------------------------------------------- + */ + +const Layout = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'Layout' + const DATA_KEY = 'lte.layout' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Event = { + SIDEBAR: 'sidebar' + } + + const Selector = { + HEADER : '.main-header', + MAIN_SIDEBAR : '.main-sidebar', + SIDEBAR : '.main-sidebar .sidebar', + CONTENT : '.content-wrapper', + BRAND : '.brand-link', + CONTENT_HEADER : '.content-header', + WRAPPER : '.wrapper', + CONTROL_SIDEBAR: '.control-sidebar', + CONTROL_SIDEBAR_CONTENT: '.control-sidebar-content', + CONTROL_SIDEBAR_BTN: '[data-widget="control-sidebar"]', + LAYOUT_FIXED : '.layout-fixed', + FOOTER : '.main-footer', + PUSHMENU_BTN : '[data-widget="pushmenu"]', + LOGIN_BOX : '.login-box', + REGISTER_BOX : '.register-box' + } + + const ClassName = { + HOLD : 'hold-transition', + SIDEBAR : 'main-sidebar', + CONTENT_FIXED : 'content-fixed', + SIDEBAR_FOCUSED: 'sidebar-focused', + LAYOUT_FIXED : 'layout-fixed', + NAVBAR_FIXED : 'layout-navbar-fixed', + FOOTER_FIXED : 'layout-footer-fixed', + LOGIN_PAGE : 'login-page', + REGISTER_PAGE : 'register-page', + CONTROL_SIDEBAR_SLIDE_OPEN: 'control-sidebar-slide-open', + CONTROL_SIDEBAR_OPEN: 'control-sidebar-open', + } + + const Default = { + scrollbarTheme : 'os-theme-light', + scrollbarAutoHide: 'l' + } + + /** + * Class Definition + * ==================================================== + */ + + class Layout { + constructor(element, config) { + this._config = config + this._element = element + + this._init() + } + + // Public + + fixLayoutHeight(extra = null) { + let control_sidebar = 0 + + if ($('body').hasClass(ClassName.CONTROL_SIDEBAR_SLIDE_OPEN) || $('body').hasClass(ClassName.CONTROL_SIDEBAR_OPEN) || extra == 'control_sidebar') { + control_sidebar = $(Selector.CONTROL_SIDEBAR_CONTENT).height() + } + + const heights = { + window: $(window).height(), + header: $(Selector.HEADER).length !== 0 ? $(Selector.HEADER).outerHeight() : 0, + footer: $(Selector.FOOTER).length !== 0 ? $(Selector.FOOTER).outerHeight() : 0, + sidebar: $(Selector.SIDEBAR).length !== 0 ? $(Selector.SIDEBAR).height() : 0, + control_sidebar: control_sidebar, + } + + const max = this._max(heights) + + if (max == heights.control_sidebar) { + $(Selector.CONTENT).css('min-height', max) + } else if (max == heights.window) { + $(Selector.CONTENT).css('min-height', max - heights.header - heights.footer) + } else { + $(Selector.CONTENT).css('min-height', max - heights.header) + } + + if ($('body').hasClass(ClassName.LAYOUT_FIXED)) { + $(Selector.CONTENT).css('min-height', max - heights.header - heights.footer) + + if (typeof $.fn.overlayScrollbars !== 'undefined') { + $(Selector.SIDEBAR).overlayScrollbars({ + className : this._config.scrollbarTheme, + sizeAutoCapable : true, + scrollbars : { + autoHide: this._config.scrollbarAutoHide, + clickScrolling : true + } + }) + } + } + } + + // Private + + _init() { + // Activate layout height watcher + this.fixLayoutHeight() + $(Selector.SIDEBAR) + .on('collapsed.lte.treeview expanded.lte.treeview', () => { + this.fixLayoutHeight() + }) + + $(Selector.PUSHMENU_BTN) + .on('collapsed.lte.pushmenu shown.lte.pushmenu', () => { + this.fixLayoutHeight() + }) + + $(Selector.CONTROL_SIDEBAR_BTN) + .on('collapsed.lte.controlsidebar', () => { + this.fixLayoutHeight() + }) + .on('expanded.lte.controlsidebar', () => { + this.fixLayoutHeight('control_sidebar') + }) + + $(window).resize(() => { + this.fixLayoutHeight() + }) + + if (!$('body').hasClass(ClassName.LOGIN_PAGE) && !$('body').hasClass(ClassName.REGISTER_PAGE)) { + $('body, html').css('height', 'auto') + } else if ($('body').hasClass(ClassName.LOGIN_PAGE) || $('body').hasClass(ClassName.REGISTER_PAGE)) { + let box_height = $(Selector.LOGIN_BOX + ', ' + Selector.REGISTER_BOX).height() + + $('body').css('min-height', box_height); + } + + $('body.hold-transition').removeClass('hold-transition') + } + + _max(numbers) { + // Calculate the maximum number in a list + let max = 0 + + Object.keys(numbers).forEach((key) => { + if (numbers[key] > max) { + max = numbers[key] + } + }) + + return max + } + + // Static + + static _jQueryInterface(config = '') { + return this.each(function () { + let data = $(this).data(DATA_KEY) + const _options = $.extend({}, Default, $(this).data()) + + if (!data) { + data = new Layout($(this), _options) + $(this).data(DATA_KEY, data) + } + + if (config === 'init' || config === '') { + data['_init']() + } + }) + } + } + + /** + * Data API + * ==================================================== + */ + + $(window).on('load', () => { + Layout._jQueryInterface.call($('body')) + }) + + $(Selector.SIDEBAR + ' a').on('focusin', () => { + $(Selector.MAIN_SIDEBAR).addClass(ClassName.SIDEBAR_FOCUSED); + }) + + $(Selector.SIDEBAR + ' a').on('focusout', () => { + $(Selector.MAIN_SIDEBAR).removeClass(ClassName.SIDEBAR_FOCUSED); + }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = Layout._jQueryInterface + $.fn[NAME].Constructor = Layout + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return Layout._jQueryInterface + } + + return Layout +})(jQuery) + +export default Layout diff --git a/build/js/PushMenu.js b/build/js/PushMenu.js new file mode 100644 index 0000000..3b6d343 --- /dev/null +++ b/build/js/PushMenu.js @@ -0,0 +1,223 @@ +/** + * -------------------------------------------- + * AdminLTE PushMenu.js + * License MIT + * -------------------------------------------- + */ + +const PushMenu = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'PushMenu' + const DATA_KEY = 'lte.pushmenu' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Event = { + COLLAPSED: `collapsed${EVENT_KEY}`, + SHOWN: `shown${EVENT_KEY}` + } + + const Default = { + autoCollapseSize: 992, + enableRemember: false, + noTransitionAfterReload: true + } + + const Selector = { + TOGGLE_BUTTON: '[data-widget="pushmenu"]', + SIDEBAR_MINI: '.sidebar-mini', + SIDEBAR_COLLAPSED: '.sidebar-collapse', + BODY: 'body', + OVERLAY: '#sidebar-overlay', + WRAPPER: '.wrapper' + } + + const ClassName = { + SIDEBAR_OPEN: 'sidebar-open', + COLLAPSED: 'sidebar-collapse', + OPEN: 'sidebar-open' + } + + /** + * Class Definition + * ==================================================== + */ + + class PushMenu { + constructor(element, options) { + this._element = element + this._options = $.extend({}, Default, options) + + if (!$(Selector.OVERLAY).length) { + this._addOverlay() + } + + this._init() + } + + // Public + + expand() { + if (this._options.autoCollapseSize) { + if ($(window).width() <= this._options.autoCollapseSize) { + $(Selector.BODY).addClass(ClassName.OPEN) + } + } + + $(Selector.BODY).removeClass(ClassName.COLLAPSED) + + if(this._options.enableRemember) { + localStorage.setItem(`remember${EVENT_KEY}`, ClassName.OPEN) + } + + const shownEvent = $.Event(Event.SHOWN) + $(this._element).trigger(shownEvent) + } + + collapse() { + if (this._options.autoCollapseSize) { + if ($(window).width() <= this._options.autoCollapseSize) { + $(Selector.BODY).removeClass(ClassName.OPEN) + } + } + + $(Selector.BODY).addClass(ClassName.COLLAPSED) + + if(this._options.enableRemember) { + localStorage.setItem(`remember${EVENT_KEY}`, ClassName.COLLAPSED) + } + + const collapsedEvent = $.Event(Event.COLLAPSED) + $(this._element).trigger(collapsedEvent) + } + + toggle() { + if (!$(Selector.BODY).hasClass(ClassName.COLLAPSED)) { + this.collapse() + } else { + this.expand() + } + } + + autoCollapse(resize = false) { + if (this._options.autoCollapseSize) { + if ($(window).width() <= this._options.autoCollapseSize) { + if (!$(Selector.BODY).hasClass(ClassName.OPEN)) { + this.collapse() + } + } else if (resize == true) { + if ($(Selector.BODY).hasClass(ClassName.OPEN)) { + $(Selector.BODY).removeClass(ClassName.OPEN) + } + } + } + } + + remember() { + if(this._options.enableRemember) { + let toggleState = localStorage.getItem(`remember${EVENT_KEY}`) + if (toggleState == ClassName.COLLAPSED){ + if (this._options.noTransitionAfterReload) { + $("body").addClass('hold-transition').addClass(ClassName.COLLAPSED).delay(50).queue(function() { + $(this).removeClass('hold-transition') + $(this).dequeue() + }) + } else { + $("body").addClass(ClassName.COLLAPSED) + } + } else { + if (this._options.noTransitionAfterReload) { + $("body").addClass('hold-transition').removeClass(ClassName.COLLAPSED).delay(50).queue(function() { + $(this).removeClass('hold-transition') + $(this).dequeue() + }) + } else { + $("body").removeClass(ClassName.COLLAPSED) + } + } + } + } + + // Private + + _init() { + this.remember() + this.autoCollapse() + + $(window).resize(() => { + this.autoCollapse(true) + }) + } + + _addOverlay() { + const overlay = $('
', { + id: 'sidebar-overlay' + }) + + overlay.on('click', () => { + this.collapse() + }) + + $(Selector.WRAPPER).append(overlay) + } + + // Static + + static _jQueryInterface(operation) { + return this.each(function () { + let data = $(this).data(DATA_KEY) + const _options = $.extend({}, Default, $(this).data()) + + if (!data) { + data = new PushMenu(this, _options) + $(this).data(DATA_KEY, data) + } + + if (typeof operation === 'string' && operation.match(/collapse|expand|toggle/)) { + data[operation]() + } + }) + } + } + + /** + * Data API + * ==================================================== + */ + + $(document).on('click', Selector.TOGGLE_BUTTON, (event) => { + event.preventDefault() + + let button = event.currentTarget + + if ($(button).data('widget') !== 'pushmenu') { + button = $(button).closest(Selector.TOGGLE_BUTTON) + } + + PushMenu._jQueryInterface.call($(button), 'toggle') + }) + + $(window).on('load', () => { + PushMenu._jQueryInterface.call($(Selector.TOGGLE_BUTTON)) + }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = PushMenu._jQueryInterface + $.fn[NAME].Constructor = PushMenu + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return PushMenu._jQueryInterface + } + + return PushMenu +})(jQuery) + +export default PushMenu diff --git a/build/js/SiteSearch.js b/build/js/SiteSearch.js new file mode 100644 index 0000000..b3ed9e5 --- /dev/null +++ b/build/js/SiteSearch.js @@ -0,0 +1,127 @@ +/** + * -------------------------------------------- + * AdminLTE SiteSearch.js + * License MIT + * -------------------------------------------- + */ + +const SiteSearch = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'SiteSearch' + const DATA_KEY = 'lte.site-search' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Event = {} + + const Selector = { + TOGGLE_BUTTON : '[data-widget="site-search"]', + SEARCH_BLOCK : '.site-search-block', + SEARCH_BACKDROP: '.site-search-backdrop', + SEARCH_INPUT : '.site-search-block .form-control' + } + + const ClassName = { + OPEN: 'site-search-open' + } + + const Default = { + transitionSpeed: 300 + } + + /** + * Class Definition + * ==================================================== + */ + + class SiteSearch { + + constructor(_element, _options) { + this.element = _element + this.options = $.extend({}, Default, _options) + } + + // Public + + open() { + $(Selector.SEARCH_BLOCK).slideDown(this.options.transitionSpeed) + $(Selector.SEARCH_BACKDROP).show(0) + $(Selector.SEARCH_INPUT).focus() + $(Selector.SEARCH_BLOCK).addClass(ClassName.OPEN) + } + + close() { + $(Selector.SEARCH_BLOCK).slideUp(this.options.transitionSpeed) + $(Selector.SEARCH_BACKDROP).hide(0) + $(Selector.SEARCH_BLOCK).removeClass(ClassName.OPEN) + } + + toggle() { + if ($(Selector.SEARCH_BLOCK).hasClass(ClassName.OPEN)) { + this.close() + } else { + this.open() + } + } + + // Static + + static _jQueryInterface(options) { + return this.each(function () { + let data = $(this).data(DATA_KEY) + + if (!data) { + data = new SiteSearch(this, options) + $(this).data(DATA_KEY, data) + } + + if (!/toggle|close/.test(options)) { + throw Error(`Undefined method ${options}`) + } + + data[options]() + }) + } + } + + /** + * Data API + * ==================================================== + */ + $(document).on('click', Selector.TOGGLE_BUTTON, (event) => { + event.preventDefault() + + let button = $(event.currentTarget) + + if (button.data('widget') !== 'site-search') { + button = button.closest(Selector.TOGGLE_BUTTON) + } + + SiteSearch._jQueryInterface.call(button, 'toggle') + }) + + $(document).on('click', Selector.SEARCH_BACKDROP, (event) => { + const backdrop = $(event.currentTarget) + SiteSearch._jQueryInterface.call(backdrop, 'close') + }) + + /** + * jQuery API + * ==================================================== + */ + + $.fn[NAME] = SiteSearch._jQueryInterface + $.fn[NAME].Constructor = SiteSearch + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT + return SiteSearch._jQueryInterface + } + + return SiteSearch +})(jQuery) + +export default SiteSearch diff --git a/build/js/Toasts.js b/build/js/Toasts.js new file mode 100644 index 0000000..a4cfc25 --- /dev/null +++ b/build/js/Toasts.js @@ -0,0 +1,229 @@ +/** + * -------------------------------------------- + * AdminLTE Toasts.js + * License MIT + * -------------------------------------------- + */ + +const Toasts = (($) => { + /** + * Constants + * ==================================================== + */ + + const NAME = 'Toasts' + const DATA_KEY = 'lte.toasts' + const EVENT_KEY = `.${DATA_KEY}` + const JQUERY_NO_CONFLICT = $.fn[NAME] + + const Event = { + INIT: `init${EVENT_KEY}`, + CREATED: `created${EVENT_KEY}`, + REMOVED: `removed${EVENT_KEY}`, + } + + const Selector = { + BODY: 'toast-body', + CONTAINER_TOP_RIGHT: '#toastsContainerTopRight', + CONTAINER_TOP_LEFT: '#toastsContainerTopLeft', + CONTAINER_BOTTOM_RIGHT: '#toastsContainerBottomRight', + CONTAINER_BOTTOM_LEFT: '#toastsContainerBottomLeft', + } + + const ClassName = { + TOP_RIGHT: 'toasts-top-right', + TOP_LEFT: 'toasts-top-left', + BOTTOM_RIGHT: 'toasts-bottom-right', + BOTTOM_LEFT: 'toasts-bottom-left', + FADE: 'fade', + } + + const Position = { + TOP_RIGHT: 'topRight', + TOP_LEFT: 'topLeft', + BOTTOM_RIGHT: 'bottomRight', + BOTTOM_LEFT: 'bottomLeft', + } + + const Id = { + CONTAINER_TOP_RIGHT: 'toastsContainerTopRight', + CONTAINER_TOP_LEFT: 'toastsContainerTopLeft', + CONTAINER_BOTTOM_RIGHT: 'toastsContainerBottomRight', + CONTAINER_BOTTOM_LEFT: 'toastsContainerBottomLeft', + } + + const Default = { + position: Position.TOP_RIGHT, + fixed: true, + autohide: false, + autoremove: true, + delay: 1000, + fade: true, + icon: null, + image: null, + imageAlt: null, + imageHeight: '25px', + title: null, + subtitle: null, + close: true, + body: null, + class: null, + } + + /** + * Class Definition + * ==================================================== + */ + class Toasts { + constructor(element, config) { + this._config = config + + this._prepareContainer(); + + const initEvent = $.Event(Event.INIT) + $('body').trigger(initEvent) + } + + // Public + + create() { + var toast = $('