update register
parent
c0397f4971
commit
7660e6a01d
|
|
@ -26,6 +26,7 @@ class CustomRegisterController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
// dd($request->all());
|
// dd($request->all());
|
||||||
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
Validator::make($request->all(), [
|
Validator::make($request->all(), [
|
||||||
'email' => 'required|unique:users|email',
|
'email' => 'required|unique:users|email',
|
||||||
|
|
@ -60,10 +61,37 @@ class CustomRegisterController extends Controller
|
||||||
|
|
||||||
$sekolah = Sekolah::where('npsn',$request->npsn)->first();
|
$sekolah = Sekolah::where('npsn',$request->npsn)->first();
|
||||||
if(!@$sekolah){
|
if(!@$sekolah){
|
||||||
return redirect('register')->with([
|
|
||||||
'message' => 'Maaf data sekolah tidak ditemukan, periksa kembali NPSN anda',
|
$user = new User;
|
||||||
'type' => "error"
|
$user->email = $request->email;
|
||||||
]);
|
$user->username = $request->npsn;
|
||||||
|
$user->password = Hash::make($request->password);
|
||||||
|
$user->name = $request->name;
|
||||||
|
$user->ms_group_id = 2;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
Auth::attempt(['username' => $request->npsn, 'password' => $request->password]);
|
||||||
|
|
||||||
|
$session = [
|
||||||
|
'username' => $request->username,
|
||||||
|
'name' => $user->name,
|
||||||
|
'email' => $user->email,
|
||||||
|
'sekolah_id' => @$user->profile->sekolah->MsSekolahId,
|
||||||
|
'npsn' => @$request->npsn,
|
||||||
|
'tingkat_sekolah' => @$user->profile->tingkat->name,
|
||||||
|
'status_sekolah' => @$user->profile->status_sekolah,
|
||||||
|
'alamat_sekolah' => @$request->alamat_sekolah,
|
||||||
|
'kontak_person' => @$request->kontak_person,
|
||||||
|
'telp' => @$request->telp,
|
||||||
|
'currYear' => date('Y'),
|
||||||
|
'group_id' => @$user->ms_group_id,
|
||||||
|
'kabupaten_id' => @$user->ms_kabupaten_id,
|
||||||
|
'group_alias' => @$user->group->alias,
|
||||||
|
'group_name' => @$user->group->name,
|
||||||
|
];
|
||||||
|
session($session);
|
||||||
|
DB::commit();
|
||||||
|
return redirect('profile-sekolah/lengkapi/'.encode_id($request->npsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new User;
|
$user = new User;
|
||||||
|
|
@ -93,13 +121,45 @@ class CustomRegisterController extends Controller
|
||||||
$group->ms_group_id = 2; //sekolah
|
$group->ms_group_id = 2; //sekolah
|
||||||
$group->save();
|
$group->save();
|
||||||
|
|
||||||
return redirect('/login')->with([
|
|
||||||
'message' => 'Berhasil membuat akun baru, silahkan login',
|
Auth::attempt(['username' => $request->npsn, 'password' => $request->password]);
|
||||||
'type' => 'success',
|
|
||||||
|
$session = [
|
||||||
|
'username' => $user->username,
|
||||||
|
'name' => $user->name,
|
||||||
|
'email' => $user->email,
|
||||||
|
'sekolah_id' => @$user->profile->sekolah->MsSekolahId,
|
||||||
|
'npsn' => @$user->profile->npsn,
|
||||||
|
'tingkat_sekolah' => @$user->profile->tingkat->name,
|
||||||
|
'status_sekolah' => @$user->profile->status_sekolah,
|
||||||
|
'alamat_sekolah' => @$user->profile->alamat_sekolah,
|
||||||
|
'kontak_person' => @$user->profile->kontak_person,
|
||||||
|
'telp' => @$user->profile->telp,
|
||||||
|
'currYear' => date('Y'),
|
||||||
|
'group_id' => @$user->ms_group_id,
|
||||||
|
'kabupaten_id' => @$user->ms_kabupaten_id,
|
||||||
|
'group_alias' => @$user->group->alias,
|
||||||
|
'group_name' => @$user->group->name,
|
||||||
|
];
|
||||||
|
session($session);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return redirect('dashboard')->with([
|
||||||
|
'message' => trans('Selamat datang kembali'),
|
||||||
|
'type' => "success"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// return redirect('/login')->with([
|
||||||
|
// 'message' => 'Berhasil membuat akun baru, silahkan login',
|
||||||
|
// 'type' => 'success',
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
return redirect('register')->with([
|
return redirect('register')->with([
|
||||||
'message' => $e->getMessage(),
|
'message' => $e->getMessage(),
|
||||||
'type' => "error"
|
'type' => "error"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,81 @@ class ProfileController extends Controller
|
||||||
protected $template = 'modules.profile';
|
protected $template = 'modules.profile';
|
||||||
protected $route = 'modules.profile';
|
protected $route = 'modules.profile';
|
||||||
|
|
||||||
|
function lengkapi($npsn) {
|
||||||
|
permission('is_read', $this->route, 'module',true);
|
||||||
|
|
||||||
|
$keyId = decode_id($npsn);
|
||||||
|
|
||||||
|
$data['breadcrumbs'] = [
|
||||||
|
['name' => 'Dashboard','url' => url('dashboard')],
|
||||||
|
['name' => 'Profile','active' => true],
|
||||||
|
];
|
||||||
|
$data['title'] = 'Profile';
|
||||||
|
$data['route'] = $this->route;
|
||||||
|
$data['provinsi'] = Provinsi::where('kode_wilayah','010000')->get();
|
||||||
|
$data['user'] = User::where('username',$keyId)->first();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return view($this->template.'.lengkapi',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateLengkapi(Request $request) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
Validator::make($request->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'status_sekolah' => 'required',
|
||||||
|
'alamat_sekolah' => 'required',
|
||||||
|
'npsn' => 'required',
|
||||||
|
'tingkat_sekolah' => 'required',
|
||||||
|
"provinsi" => "required",
|
||||||
|
"kabupaten" => "required",
|
||||||
|
"kecamatan" => "required",
|
||||||
|
])->validate();
|
||||||
|
|
||||||
|
$sekolah = new Sekolah;
|
||||||
|
$sekolah->ms_provinsi_id = decode_id($request->provinsi);
|
||||||
|
$sekolah->ms_kabupaten_id = decode_id($request->kabupaten);
|
||||||
|
$sekolah->ms_kecamatan_id = decode_id($request->kecamatan);
|
||||||
|
$sekolah->ms_tingkat_sekolah_id = $request->tingkat_sekolah;
|
||||||
|
$sekolah->status = $request->status_sekolah;
|
||||||
|
$sekolah->nama_sekolah = $request->name;
|
||||||
|
$sekolah->npsn = $request->npsn;
|
||||||
|
$sekolah->alamat_sekolah = $request->alamat_sekolah;
|
||||||
|
$sekolah->save();
|
||||||
|
|
||||||
|
//profile
|
||||||
|
|
||||||
|
$profile = new Profile;
|
||||||
|
$profile->npsn = $request->npsn;
|
||||||
|
$profile->ms_tingkat_sekolah_id = $request->tingkat_sekolah;
|
||||||
|
$profile->status_sekolah = $request->status_sekolah;
|
||||||
|
$profile->alamat_sekolah = $request->alamat_sekolah;
|
||||||
|
$profile->ms_provinsi_id = decode_id($request->provinsi);
|
||||||
|
$profile->ms_kabupaten_id = decode_id($request->kabupaten);
|
||||||
|
$profile->ms_kecamatan_id = decode_id($request->kecamatan);
|
||||||
|
$profile->ms_sekolah_id = $sekolah->MsSekolahId;
|
||||||
|
$profile->kontak_person = session('kontak_person');
|
||||||
|
$profile->telp = session('telp');
|
||||||
|
$profile->user_id = auth()->user()->id;
|
||||||
|
$profile->save();
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
return redirect('dashboard');
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
return redirect()->back()->with([
|
||||||
|
'message' => $e->getMessage(),
|
||||||
|
'type' => "error"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function profile(){
|
function profile(){
|
||||||
|
|
||||||
permission('is_read', $this->route, 'module',true);
|
permission('is_read', $this->route, 'module',true);
|
||||||
|
|
||||||
$data['breadcrumbs'] = [
|
$data['breadcrumbs'] = [
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Auth;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class Profile
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
$user = User::with(['profile'])->where('id',auth()->user()->id)->first();
|
||||||
|
if(!@$user->profile){
|
||||||
|
return redirect('profile-sekolah/lengkapi/'.encode_id($user->username));
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>
|
<title>
|
||||||
Login - Sekolah Adiwiyata
|
Login - SIDIA Jakarta
|
||||||
</title>
|
</title>
|
||||||
<meta name="description" content="Login">
|
<meta name="description" content="Login">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>
|
<title>
|
||||||
Register - Sekolah Adiwiyata
|
Register - SIDIA Jakarta
|
||||||
</title>
|
</title>
|
||||||
<meta name="description" content="Login">
|
<meta name="description" content="Login">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
|
@ -310,7 +310,9 @@
|
||||||
$.each(data, function(index, data){
|
$.each(data, function(index, data){
|
||||||
$('#result').append('<li data-npsn="'+data.npsn+'">' + data.nama_sekolah + '</li>');
|
$('#result').append('<li data-npsn="'+data.npsn+'">' + data.nama_sekolah + '</li>');
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
$('.nama_sekolah').removeAttr('readonly');
|
||||||
$('#result').hide();
|
$('#result').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -325,6 +327,7 @@
|
||||||
var npsn = $(this).attr('data-npsn');
|
var npsn = $(this).attr('data-npsn');
|
||||||
|
|
||||||
$('.npsn').val(npsn);
|
$('.npsn').val(npsn);
|
||||||
|
$('.nama_sekolah').attr('readonly',true);
|
||||||
$('.nama_sekolah').val($(this).text());
|
$('.nama_sekolah').val($(this).text());
|
||||||
$('#result').hide();
|
$('#result').hide();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Lengkapi Profile - SIDIA Jakarta</title>
|
||||||
|
<meta name="description" content="Login">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no, minimal-ui">
|
||||||
|
<!-- Call App Mode on ios devices -->
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
|
<!-- Remove Tap Highlight on Windows Phone IE -->
|
||||||
|
<meta name="msapplication-tap-highlight" content="no">
|
||||||
|
<!-- base css -->
|
||||||
|
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/vendors.bundle.css')}}">
|
||||||
|
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/app.bundle.css')}}">
|
||||||
|
<!-- Place favicon.ico in the root directory -->
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="{{asset('assets/logo-dinas.ico')}}">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="{{asset('assets/logo-dinas.ico')}}">
|
||||||
|
<link rel="mask-icon" href="{{asset('assets/logo-dinas.ico')}}" color="#5bbad5">
|
||||||
|
<!-- Optional: page related CSS-->
|
||||||
|
<link rel="stylesheet" media="screen, print" href="{{asset('assets/css/fa-brands.css')}}">
|
||||||
|
<link rel="stylesheet" href="{{asset('assets/css/formplugins/select2/select2.bundle.css')}}">
|
||||||
|
@yield('css')
|
||||||
|
</head>
|
||||||
|
<body class="bg-login">
|
||||||
|
@yield('content')
|
||||||
|
@yield('js')
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>
|
<title>
|
||||||
{{$title}} - Sekolah Adiwiyata
|
{{$title}} - SIDIA Jakarta
|
||||||
</title>
|
</title>
|
||||||
<meta name="description" content="Marketing Dashboard">
|
<meta name="description" content="Marketing Dashboard">
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,425 @@
|
||||||
|
@extends('layouts.blank')
|
||||||
|
@section('css')
|
||||||
|
<style>
|
||||||
|
.bg-login{
|
||||||
|
background-image: url("{{asset('assets/bg-login.png')}}");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endsection
|
||||||
|
@section('content')
|
||||||
|
<div class="d-flex align-items-center justify-content-center min-vh-100">
|
||||||
|
<div class="container py-4 py-lg-5 px-4 px-sm-0">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||||
|
<div class="card pr-4 rounded-plus bg-faded" style="border:none;">
|
||||||
|
@include('include.alert')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12 p-4 d-flex flex-column justify-content-center align-items-center gap-3">
|
||||||
|
<div class="d-flex flex-column gap-3 align-items-center justify-content-center mb-5">
|
||||||
|
<div>
|
||||||
|
<img src="{{asset('assets/logo-dinas.ico')}}" width="50">
|
||||||
|
<img src="{{asset('assets/dinaspendidikan.png')}}" width="75">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h5 class="fw-700">Form Kelengkapan Data Profile Sekolah</h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="col-12 row mx-auto mt-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<h5><b><x-lucide-info width="20"/> Info:</b></h5>
|
||||||
|
<ul>
|
||||||
|
<li>Pastikan <b>NPSN</b> yang diisi benar</li>
|
||||||
|
<li>Pastikan kembali untuk Wilayah,Provinsi,Kecamatan,Kabupaten sesuai dengan data sekolah</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<h5><b><x-lucide-user width="20"/> Data User Pendaftar:</b></h5>
|
||||||
|
<ul>
|
||||||
|
<li>Nama Lengkap : <b> {{session('kontak_person')}}</b></li>
|
||||||
|
<li>Telp : <b> {{session('telp')}}</b></li>
|
||||||
|
<li>Email : <b> {{$user->email}}</b></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form method="POST" action="{{route($route.'.updateLengkapi')}}">
|
||||||
|
{{csrf_field()}}
|
||||||
|
<div class="row">
|
||||||
|
<div id="loading-spinner" style="display: none; text-align: center;">
|
||||||
|
<img src="{{ asset('assets/spinner.gif') }}" alt="Loading..." width="20">
|
||||||
|
</div>
|
||||||
|
<div class="col-12 row mx-auto mt-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Nama Sekolah</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<input type="text" value="{{$user->name ? $user->name : old('name')}}" name="name" class="form-control nama_sekolah @error('name') is-invalid @enderror" placeholder="Masukan Nama Sekolah">
|
||||||
|
@error('name')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">NPSN</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<input maxlength="8" autocomplete="off" type="text" value="{{ $user->username ? $user->username : old('npsn')}}" name="npsn" class="form-control @error('npsn') is-invalid @enderror numberInput npsn" placeholder="Masukan NPSN">
|
||||||
|
<ul id="result"></ul>
|
||||||
|
@error('npsn')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 row mx-auto mt-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label">Tingkat Sekolah</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<select name="tingkat_sekolah" class="form-control tingkat_sekolah select2 @error('tingkat_sekolah') is-invalid @enderror">
|
||||||
|
<option value="">-Pilih Tingkat Sekolah-</option>
|
||||||
|
<option value="1">SD</option>
|
||||||
|
<option value="2">SMP</option>
|
||||||
|
<option value="3">SMA</option>
|
||||||
|
<option value="4">SMK</option>
|
||||||
|
<option value="5">MI</option>
|
||||||
|
<option value="6">MTs</option>
|
||||||
|
<option value="7">MA</option>
|
||||||
|
<option value="8">SD LB</option>
|
||||||
|
<option value="9">SMP LB</option>
|
||||||
|
<option value="10">SMA LM</option>
|
||||||
|
<option value="11">SLB Khusus</option>
|
||||||
|
</select>
|
||||||
|
@error('tingkat_sekolah')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Status Sekolah</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<select name="status_sekolah" class="form-control select2 @error('status_sekolah') is-invalid @enderror">
|
||||||
|
<option value="" data-select2-id="3">-Pilih Status Sekolah-</option>
|
||||||
|
<option value="Negeri">Negeri</option>
|
||||||
|
<option value="Swasta">Swasta</option>
|
||||||
|
</select>
|
||||||
|
@error('status_sekolah')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 row mx-auto mt-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Provinsi</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<select name="provinsi" class="form-control select2 @error('provinsi') provinsi is-invalid @enderror" id="provinsi">
|
||||||
|
<option value="0">- PILIH PROVINSI -</option>
|
||||||
|
@foreach($provinsi as $datProv)
|
||||||
|
<option value="{{encode_id($datProv->MsProvinsiId)}}">{{$datProv->name}}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@error('provinsi')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Kabupaten</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<select name="kabupaten" class="form-control select2 @error('kabupaten') kabupaten is-invalid @enderror" id="kabupaten" required>
|
||||||
|
<option value="0">- PILIH KABUPATEN/KOTA -</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 row mx-auto mt-3">
|
||||||
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Kecamatan</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<select name="kecamatan" class="form-control select2 @error('kecamatan') kecamatan is-invalid @enderror" id="kecamatan" required>
|
||||||
|
<option value="0">- PILIH KECAMATAN -</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-xl-12 form-label" for="fname">Alamat Sekolah</label>
|
||||||
|
<div class="col-12 pr-1">
|
||||||
|
<textarea cols="10" rows="5" name="alamat_sekolah" class="form-control @error('alamat_sekolah') is-invalid @enderror" placeholder="Masukan Alamat Sekolah, Nama Jalan / Dusun / RT-RW" required>{{session('alamat_sekolah')}}</textarea>
|
||||||
|
@error('alamat_sekolah')
|
||||||
|
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-12 mt-3">
|
||||||
|
<div class="row no-gutters">
|
||||||
|
<div class="col-md-12 ml-auto text-right">
|
||||||
|
<button id="js-login-btn" type="submit" class="btn btn-block btn-primary btn-lg mt-3">Simpan Data Sekolah</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p class="text-muted mt-auto text-center mb-0 pt-3">
|
||||||
|
{{date('Y')}} © Dinas Lingkungan Hidup DKI Jakarta
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
@section('js')
|
||||||
|
<script src="{{asset('assets/js/vendors.bundle.js')}}"></script>
|
||||||
|
<script src="{{asset('assets/js/app.bundle.js')}}"></script>
|
||||||
|
<script src="{{asset('assets/js/formplugins/select2/select2.bundle.js')}}"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.select2').select2();
|
||||||
|
$('.numberInput').on('input', function() {
|
||||||
|
this.value = this.value.replace(/[^0-9]/g, ''); // Hanya angka 0-9
|
||||||
|
});
|
||||||
|
$('#togglePassword').on('click', function() {
|
||||||
|
let passwordField = $('#password');
|
||||||
|
let icon = $(this).find('i');
|
||||||
|
|
||||||
|
// Cek apakah input saat ini bertipe password
|
||||||
|
if (passwordField.attr('type') === 'password') {
|
||||||
|
passwordField.attr('type', 'text'); // Ubah ke teks
|
||||||
|
icon.removeClass('fa-eye').addClass('fa-eye-slash'); // Ganti ikon
|
||||||
|
} else {
|
||||||
|
passwordField.attr('type', 'password'); // Ubah ke password
|
||||||
|
icon.removeClass('fa-eye-slash').addClass('fa-eye'); // Kembalikan ikon
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.npsn').on('keyup', function(){
|
||||||
|
var query = $(this).val();
|
||||||
|
var tingkat_sekolah = $('.tingkat_sekolah').find(':selected').val();
|
||||||
|
if(query.length > 0) {
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ url('sekolahNpsn') }}",
|
||||||
|
type: "POST",
|
||||||
|
xhrFields: {
|
||||||
|
withCredentials: true
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
query: query,
|
||||||
|
_token: '{{csrf_token()}}',
|
||||||
|
tingkat_sekolah:tingkat_sekolah
|
||||||
|
},
|
||||||
|
success: function(data) {
|
||||||
|
$('#result').html('');
|
||||||
|
if(data.length > 0) {
|
||||||
|
$('#result').show();
|
||||||
|
$.each(data, function(index, data){
|
||||||
|
$('#result').append('<li data-npsn="'+data.npsn+'">' + data.nama_sekolah + '</li>');
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('.nama_sekolah').removeAttr('readonly');
|
||||||
|
$('#result').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('#result').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Saat klik pada hasil pencarian, isi input dan sembunyikan daftar
|
||||||
|
$(document).on('click', '#result li', function(){
|
||||||
|
var npsn = $(this).attr('data-npsn');
|
||||||
|
|
||||||
|
$('.npsn').val(npsn);
|
||||||
|
$('.nama_sekolah').attr('readonly',true);
|
||||||
|
$('.nama_sekolah').val($(this).text());
|
||||||
|
$('#result').hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Klik di luar input atau hasil pencarian untuk menyembunyikan daftar
|
||||||
|
$(document).on('click', function(e) {
|
||||||
|
if (!$(e.target).closest('.npsn, #result').length) {
|
||||||
|
$('#result').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#js-login-btn").click(function(event)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Fetch form to apply custom Bootstrap validation
|
||||||
|
var form = $("#js-login")
|
||||||
|
|
||||||
|
if (form[0].checkValidity() === false)
|
||||||
|
{
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
}
|
||||||
|
|
||||||
|
form.addClass('was-validated');
|
||||||
|
// Perform ajax submit here...
|
||||||
|
});
|
||||||
|
|
||||||
|
function clear(elementId) {
|
||||||
|
$('#' + elementId).empty();
|
||||||
|
$('#' + elementId).select2();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#sekolah').on('select2:select', function(e) {
|
||||||
|
let npsn = $(this).find(':selected').attr('data-npsn');
|
||||||
|
$('.npsn').val(npsn);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('select').on("select2:selecting", function(e) {
|
||||||
|
var selectorOrigin = this.id;
|
||||||
|
var id = e.params.args.data.id;
|
||||||
|
|
||||||
|
|
||||||
|
if(selectorOrigin=='provinsi'){
|
||||||
|
$('#loading-spinner').show();
|
||||||
|
clear('kabupaten');
|
||||||
|
selector = 'kabupaten';
|
||||||
|
url_to = 'kabupaten';
|
||||||
|
getSelect(id, selector, url_to);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selectorOrigin=='kabupaten'){
|
||||||
|
$('#loading-spinner').show();
|
||||||
|
clear('kecamatan');
|
||||||
|
selector = 'kecamatan';
|
||||||
|
url_to = 'kecamatan';
|
||||||
|
getSelect(id, selector, url_to);
|
||||||
|
}
|
||||||
|
if(selectorOrigin=='kecamatan'){
|
||||||
|
$('#loading-spinner').show();
|
||||||
|
clear('sekolah');
|
||||||
|
selector = 'sekolah';
|
||||||
|
url_to = 'sekolah';
|
||||||
|
getSelect(id, selector, url_to);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function getSelect(id, selectTo, urlTo, selected = "") {
|
||||||
|
id = id;
|
||||||
|
var base_url = "{{url('/')}}";
|
||||||
|
//alert(id);
|
||||||
|
destino = "#" + selectTo;
|
||||||
|
valor = $('#' + id).find(":selected").val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: base_url + "/get/" + urlTo,
|
||||||
|
data: {
|
||||||
|
_token: '{{csrf_token()}}',
|
||||||
|
id: id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.done(function(msg) {
|
||||||
|
obj = msg.data;
|
||||||
|
|
||||||
|
if (obj.length > 0) {
|
||||||
|
//Clear the current options
|
||||||
|
$(destino).empty();
|
||||||
|
|
||||||
|
if(selectTo=='kabupaten'){
|
||||||
|
$(destino).append('<option value="">-PILIH KABUPATEN/KOTA-</option>').select2("val", "0");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$.each(obj, function(index) {
|
||||||
|
value = obj[index].id;
|
||||||
|
text = obj[index].name;
|
||||||
|
$(destino).append('<option value=' + value + '>' + text + '</option>');
|
||||||
|
});
|
||||||
|
console.log(selected)
|
||||||
|
if (selected) {
|
||||||
|
$(destino).val(selected).trigger('change');
|
||||||
|
selected = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selectTo=='kecamatan'){
|
||||||
|
$(destino).append('<option value="">-PILIH KECAMATAN-</option>').select2("val", "0");
|
||||||
|
|
||||||
|
$.each(obj, function(index) {
|
||||||
|
value = obj[index].id;
|
||||||
|
text = obj[index].name;
|
||||||
|
$(destino).append('<option value=' + value + '>' + text + '</option>');
|
||||||
|
});
|
||||||
|
console.log(selected)
|
||||||
|
if (selected) {
|
||||||
|
$(destino).val(selected).trigger('change');
|
||||||
|
selected = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selectTo=='sekolah'){
|
||||||
|
$(destino).append('<option value="">-PILIH SEKOLAH-</option>').select2("val", "0");
|
||||||
|
|
||||||
|
$.each(obj, function(index) {
|
||||||
|
value = obj[index].id;
|
||||||
|
text = obj[index].name;
|
||||||
|
npsn = obj[index].npsn;
|
||||||
|
$(destino).append('<option data-npsn="'+npsn+'" value=' + value + '>' + text + '</option>');
|
||||||
|
});
|
||||||
|
console.log(selected)
|
||||||
|
if (selected) {
|
||||||
|
$(destino).val(selected).trigger('change');
|
||||||
|
selected = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(selectTo=='provinsi'){
|
||||||
|
$(destino).empty().append('<option value="0">-PILIH PROVINSI-</option>').select2("val", "0");
|
||||||
|
}
|
||||||
|
if(selectTo=='kabupaten'){
|
||||||
|
$(destino).empty().append('<option value="0">-PILIH KABUPATEN/KOTA-</option>').select2("val", "0");
|
||||||
|
}
|
||||||
|
if(selectTo=='kecamatan'){
|
||||||
|
$(destino).empty().append('<option value="0">-PILIH KECAMATAN-</option>').select2("val", "0");
|
||||||
|
}
|
||||||
|
if(selectTo=='sekolah'){
|
||||||
|
$(destino).empty().append('<option value="0">-PILIH SEKOLAH-</option>').select2("val", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$('#loading-spinner').hide();
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use App\Http\Middleware\Session;
|
use App\Http\Middleware\Session;
|
||||||
|
use App\Http\Middleware\Profile;
|
||||||
use App\Http\Controllers\Auth\CustomLoginController;
|
use App\Http\Controllers\Auth\CustomLoginController;
|
||||||
use App\Http\Controllers\Auth\CustomRegisterController;
|
use App\Http\Controllers\Auth\CustomRegisterController;
|
||||||
|
use App\Http\Controllers\ProfileController;
|
||||||
use App\Http\Controllers\HomeController;
|
use App\Http\Controllers\HomeController;
|
||||||
use App\Http\Controllers\AjaxController;
|
use App\Http\Controllers\AjaxController;
|
||||||
use App\Http\Controllers\FrontController;
|
use App\Http\Controllers\FrontController;
|
||||||
|
|
@ -32,13 +34,16 @@ Route::post('uploadTempImage', [AjaxController::class, 'uploadTempImage'])->name
|
||||||
Route::get('hash/{hash}', function ($hash) {
|
Route::get('hash/{hash}', function ($hash) {
|
||||||
return Hash::make($hash);
|
return Hash::make($hash);
|
||||||
});
|
});
|
||||||
Route::middleware(Session::class)->name('modules.')->group(function () {
|
Route::middleware([Session::class,Profile::class])->name('modules.')->group(function () {
|
||||||
|
|
||||||
include_route_files(__DIR__ . '/modules');
|
include_route_files(__DIR__ . '/modules');
|
||||||
|
|
||||||
Route::get('logout',[CustomLoginController::class,'logout'])->name('logout');
|
Route::get('logout',[CustomLoginController::class,'logout'])->name('logout');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::middleware([Session::class])->name('modules.')->group(function () {
|
||||||
|
Route::get('profile-sekolah/lengkapi/{npsn}',[ProfileController::class,'lengkapi'])->name('profile.lengkapi');
|
||||||
|
Route::post('profile-sekolah/lengkapi',[ProfileController::class,'updateLengkapi'])->name('profile.updateLengkapi');
|
||||||
|
});
|
||||||
|
|
||||||
Route::get('/',[FrontController::class,'index'])->name('index');
|
Route::get('/',[FrontController::class,'index'])->name('index');
|
||||||
Route::get('/sekolah',[FrontController::class,'sekolah'])->name('sekolah');
|
Route::get('/sekolah',[FrontController::class,'sekolah'])->name('sekolah');
|
||||||
Route::get('/kegiatan',[FrontController::class,'kegiatan'])->name('kegiatan');
|
Route::get('/kegiatan',[FrontController::class,'kegiatan'])->name('kegiatan');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue