update
parent
f7fadc89e7
commit
a738b1d63b
|
|
@ -12,13 +12,79 @@ use App\Models\Kuesioner;
|
|||
use App\Models\KuesionerLog;
|
||||
use App\Models\Master\Sekolah;
|
||||
use App\Models\Master\Provinsi;
|
||||
use App\Models\Master\MasterGroup;
|
||||
use App\Models\Master\Kabupaten;
|
||||
use App\Models\SK;
|
||||
use App\Models\User;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
protected $template = 'modules.profile';
|
||||
protected $route = 'modules.profile';
|
||||
|
||||
function profile(){
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
|
||||
$data['breadcrumbs'] = [
|
||||
['name' => 'Dashboard','url' => url('dashboard')],
|
||||
['name' => 'Profile','active' => true],
|
||||
];
|
||||
$data['title'] = 'Profile';
|
||||
$data['route'] = $this->route;
|
||||
$data['keyId'] = encode_id(auth()->user()->id);
|
||||
$data['item'] = User::with('profile')->where('id',auth()->user()->id)->first();
|
||||
$data['group'] = MasterGroup::where('MsGroupId','!=',1)->get();
|
||||
$data['kabupaten'] = Kabupaten::all();
|
||||
return view($this->template.'.profile', $data);
|
||||
}
|
||||
|
||||
function profileStore(Request $request) {
|
||||
try {
|
||||
|
||||
$keyId = decode_id($request->secure_id);
|
||||
|
||||
if(@$keyId){
|
||||
|
||||
Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'status_sekolah' => 'required',
|
||||
'alamat_sekolah' => 'required',
|
||||
'kontak_person' => 'required',
|
||||
'telp' => 'required',
|
||||
'password' => 'nullable|min:8|max:15|regex:/[a-z]/|regex:/[A-Z]/|regex:/[0-9]/|regex:/[@$!%*#?&]/', //min 8 char, maks 15 char, min 1 symbol, min 1 uppercase, min 1 lowercase, 1 number
|
||||
],[
|
||||
'password.min' => 'password Minimal 8 Karakter',
|
||||
'password.max' => 'password Maksimal 15 Karakter',
|
||||
'password.regex' => 'Format Kata Sandi harus mengandung minimal Huruf Besar, Huruf Kecil, Angka, Spesial Karakter',
|
||||
])->validate();
|
||||
|
||||
$profile = Profile::where('npsn',auth()->user()->profile->npsn)->first();
|
||||
$profile->alamat_sekolah = $request->alamat_sekolah;
|
||||
$profile->kontak_person = $request->kontak_person;
|
||||
$profile->telp = $request->telp;
|
||||
$profile->save();
|
||||
|
||||
$user = User::find($keyId);
|
||||
if(@$request->password){
|
||||
$user->password = Hash::make($request->password);
|
||||
}
|
||||
$user->name = $request->name;
|
||||
$user->save();
|
||||
}
|
||||
|
||||
return redirect()->back()->with([
|
||||
'message' => 'Berhasil update data',
|
||||
'type' => 'success',
|
||||
]);
|
||||
|
||||
} catch (Exception $e) {
|
||||
return redirect()->back()->with([
|
||||
'message' => $e->getMessage(),
|
||||
'type' => "error"
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
permission('is_read', $this->route, 'module',true);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<!-- DOC: mobile button appears during mobile width -->
|
||||
<div class="hidden-lg-up">
|
||||
<a href="#" class="header-btn btn press-scale-down" data-action="toggle" data-class="mobile-nav-on">
|
||||
<a href="#" class="btn press-scale-down border-none bg-fusion-50" data-action="toggle" data-class="mobile-nav-on">
|
||||
<i class="ni ni-menu"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -41,15 +41,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a href="#" class="dropdown-item" data-action="app-reset">
|
||||
<span data-i18n="drpdwn.reset_layout">Data Diri</span>
|
||||
</a>
|
||||
<a href="#" class="dropdown-item" data-toggle="modal" data-target=".js-modal-settings">
|
||||
<span data-i18n="drpdwn.settings">Settings</span>
|
||||
<a href="{{ url('profile') }}" class="dropdown-item">
|
||||
<span>Data Diri</span>
|
||||
</a>
|
||||
<div class="dropdown-divider m-0"></div>
|
||||
<a class="dropdown-item fw-500 pt-3 pb-3" href="{{url('logout')}}">
|
||||
<span data-i18n="drpdwn.page-logout">Logout</span>
|
||||
<span>Logout</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="rounded-plus px-2 py-1 bg-success-light text-success">Level {{@levelAdiwiyata(session('npsn'))}}</h6>
|
||||
<h6 class="rounded-plus px-2 py-1 bg-success text-white">Level {{@levelAdiwiyata(session('npsn'))}}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -178,7 +178,7 @@
|
|||
<div class="col-md-12 pr-0 mt-2">
|
||||
<div class="card h-100">
|
||||
<div class="card-header bg-white">
|
||||
<h5 class="fw-500 mb-0">Status Usulan</h5>
|
||||
<h5 class="fw-500 mb-0">Riwayat Usulan</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="">
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
<td style="vertical-align: middle;">{{@$sk->tanggal_penetapan}}</td>
|
||||
<td style="vertical-align: middle;">
|
||||
@if(@$sk)
|
||||
<a download href="'.asset('uploads/'.@$sk->file).'" class="btn btn-sm btn-warning" style="width: 100%;"><i class="fal fa-download"></i> SK Adiwiyata</a>
|
||||
<a download href="{{ asset('uploads/'.@$sk->file) }}" class="btn btn-sm btn-warning" style="width: 100%;"><i class="fal fa-download"></i> SK Adiwiyata</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,192 @@
|
|||
@extends('layouts.master')
|
||||
@section('breadcrumbs')
|
||||
<ol class="breadcrumb page-breadcrumb">
|
||||
@foreach($breadcrumbs as $dataBread)
|
||||
<li class="breadcrumb-item {{@$dataBread['active'] == true ? 'active' : ''}}">
|
||||
@if(@$dataBread['url'])
|
||||
<a href="{{@$dataBread['url']}}">{{$dataBread['name']}}</a>
|
||||
@else
|
||||
{{$dataBread['name']}}
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ol>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fal fa-align-justify"></i> {{$title}}
|
||||
</div>
|
||||
<form action="{{url('profile-store')}}" method="POST" class="">
|
||||
{{csrf_field()}}
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<input type="hidden" name="secure_id" value="{{@$keyId}}">
|
||||
</div>
|
||||
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="fname">NPSN</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input maxlength="8" type="text" disabled value="{{@$item->username ? @$item->username : old('npsn')}}" name="npsn" class="form-control @error('npsn') is-invalid @enderror numberInput" placeholder="Masukan NPSN Sekolah" required>
|
||||
@error('npsn')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
<small class="text-primary"><i>Pastikan NPSN Telah Sesuai</i></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="fname">Nama Sekolah</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="text" value="{{@$item->name ? @$item->name : old('name')}}" name="name" class="form-control @error('name') is-invalid @enderror" placeholder="Masukan Nama Sekolah" required>
|
||||
@error('name')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="fname">Tingkat Sekolah</label>
|
||||
<div class="col-12 pr-1">
|
||||
<select name="tingkat_sekolah" class="form-control @error('tingkat_sekolah') is-invalid @enderror">
|
||||
<option value="" data-select2-id="3">-Pilih Tingkat Sekolah-</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 1 ? 'selected' : ''}} value="1" data-select2-id="11">SD</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 2 ? 'selected' : ''}} value="2" data-select2-id="12">SMP</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 3 ? 'selected' : ''}} value="3" data-select2-id="13">SMA</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 4 ? 'selected' : ''}} value="4" data-select2-id="14">SMK</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 5 ? 'selected' : ''}} value="5" data-select2-id="15">MI</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 6 ? 'selected' : ''}} value="6" data-select2-id="16">MTs</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 7 ? 'selected' : ''}} value="7" data-select2-id="17">MA</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 8 ? 'selected' : ''}} value="8" data-select2-id="18">SD LB</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 9 ? 'selected' : ''}} value="9" data-select2-id="19">SMP LB</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 10 ? 'selected' : ''}} value="10" data-select2-id="20">SMA LM</option>
|
||||
<option {{@$item->profile->ms_tingkat_sekolah_id == 11 ? 'selected' : ''}} value="11" data-select2-id="21">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-12 mb-3">
|
||||
<div class="form-group">
|
||||
<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 @error('status_sekolah') is-invalid @enderror" required>
|
||||
<option value="" data-select2-id="3">-Pilih Status Sekolah-</option>
|
||||
<option {{@$item->profile->status_sekolah == 'Negeri' ? 'selected' : ''}} value="Negeri">Negeri</option>
|
||||
<option {{@$item->profile->status_sekolah == 'Swasta' ? 'selected' : ''}} 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 class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="emailverify">Alamat Sekolah</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="text" value="{{@$item->profile->alamat_sekolah ? @$item->profile->alamat_sekolah : old('alamat_sekolah')}}" name="alamat_sekolah" class="form-control @error('alamat_sekolah') is-invalid @enderror" placeholder="Masukan Alamat Sekolah, Nama Jalan / Dusun / RT-RW" required>
|
||||
@error('alamat_sekolah')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="emailverify">Kontak Person</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="text" value="{{@$item->profile->kontak_person ? @$item->profile->kontak_person : old('kontak_person')}}" name="kontak_person" class="form-control @error('kontak_person') is-invalid @enderror" placeholder="Masukan Kontak Person" required>
|
||||
@error('kontak_person')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="emailverify">Telp/WA</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="text" value="{{@$item->profile->telp ? @$item->profile->telp : old('telp')}}" name="telp" class="form-control @error('telp') is-invalid @enderror numberInput" maxlength="16" placeholder="Masukan Telp/WA" required>
|
||||
@error('telp')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label" for="emailverify">Email</label>
|
||||
<div class="col-12 pr-1">
|
||||
<input type="email" name="email" disabled value="{{@$item->email}}" id="emailverify" class="form-control @error('email') is-invalid @enderror" placeholder="Masukan Email Aktif" required>
|
||||
@error('email')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
<small class="text-primary">* Pastikan email benar dan aktif, akses aplikasi akan dikirim ke email yang didaftarkan.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 mb-3">
|
||||
<div class="form-group">
|
||||
<label class="col-xl-12 form-label">Password Baru</label>
|
||||
<div class="col-12 pr-1">
|
||||
<div class="input-group">
|
||||
<input type="password" id="password" autocomplete="new-password" name="password" class="form-control @error('password') is-invalid @enderror" placeholder="Masukan Password Minimm 8 characters">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-default waves-effect waves-themed" type="button" id="togglePassword"><i class="fal fa-eye"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
@error('password')
|
||||
<span class="invalid-feedback" style="display: block!important;"><strong>{{$message}}</strong></span>
|
||||
@enderror
|
||||
<div class="help-block">
|
||||
Kata Sandi harus mengandung Minimal 8 karakter, maksimal 15 karakter, <br>setidaknya 1 huruf kecil dan huruf besar, angka dan simbol
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<a href="{{url('dashboard')}}" class="btn btn-danger"><i class="fal fa-times"></i> Batal</a>
|
||||
<button type="submit" class="btn btn-success"><i class="fal fa-save"></i> Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@section('page-js')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.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
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -28,6 +28,8 @@ use App\Http\Controllers\Modules\Konten\KegiatanController;
|
|||
|
||||
Route::get('dashboard',[HomeController::class,'dashboard'])->name('dashboard');
|
||||
Route::get('dashboard/gridUsulan',[HomeController::class,'gridUsulan'])->name('gridUsulan');
|
||||
Route::get('profile',[ProfileController::class,'profile'])->name('profile');
|
||||
Route::post('profile-store',[ProfileController::class,'profileStore'])->name('profileStore');
|
||||
Route::get('profile-sekolah',[ProfileController::class,'index'])->name('profile.index');
|
||||
Route::get('profile-sekolah/grid',[ProfileController::class,'grid'])->name('profile.grid');
|
||||
Route::post('profile-sekolah',[ProfileController::class,'store'])->name('profile.store');
|
||||
|
|
|
|||
Loading…
Reference in New Issue