Commit 248c7caa by Triyah Fatmawati

fix get filename dan reset password user

parent 67330ad3
...@@ -23,33 +23,9 @@ public function index() { ...@@ -23,33 +23,9 @@ public function index() {
->orderBy('id_pengajuan') ->orderBy('id_pengajuan')
->get(); ->get();
if($penelaah){
foreach ($penelaah as $key => $pen) {
$nosurat = explode('/', $pen->no_sk);
$noagenda = $nosurat[0];
$tahun = $nosurat[3];
$arrPenelaah[$key] = [
'id' => $pen->id,
'id_pengajuan' => $pen->id_pengajuan,
'nik' => $pen->nik,
'nama' => $pen->nama,
'nip' => $pen->nip,
'id_pengajuan_epk' => $pen->id_pengajuan_epk,
'judul' => $pen->judul,
'peneliti' => $pen->peneliti,
'nama_kategori' => $pen->nama_kategori,
'klasifikasi' => $pen->klasifikasi,
'file_ec' => $pen->file_ec,
'tahun' => $pen->tahun,
'nosurat' => $noagenda,
'tahunsk' => $tahun,
'namafile' => $this->getFileName($tahun, $noagenda)
];
}
}
$data = [ $data = [
'penelaah' => $arrPenelaah, 'penelaah' => $penelaah,
]; ];
return view('saku.index', $data); return view('saku.index', $data);
......
...@@ -38,7 +38,7 @@ public function store(Request $request){ ...@@ -38,7 +38,7 @@ public function store(Request $request){
$user = [ $user = [
'name' => strip_tags($request->name), 'name' => strip_tags($request->name),
'email' => strip_tags($request->email), 'email' => strip_tags($request->email),
'password' => strip_tags($request->password), 'password' => Hash::make(strip_tags($request->password)),
]; ];
User::query()->create($user); User::query()->create($user);
...@@ -71,13 +71,13 @@ public function update(Request $request, $id){ ...@@ -71,13 +71,13 @@ public function update(Request $request, $id){
try{ try{
$id = decrypt($id); $id = decrypt($id);
$passwordbaru = bcrypt(strip_tags($request->passwordbaru)); $passwordbaru = Hash::make(strip_tags($request->passwordbaru));
$passwordlama = strip_tags($request->passwordlama); $passwordlama = strip_tags($request->passwordlama);
$oldpassword = User::where('id', $id)->first(); $oldpassword = User::where('id', $id)->first();
// if (Hash::check($passwordlama, $oldpassword->password)) { if (Hash::check($passwordlama, $oldpassword->password)) {
// // Passwords match // Passwords match
$user = [ $user = [
'name' => strip_tags($request->name), 'name' => strip_tags($request->name),
'email' => strip_tags($request->email), 'email' => strip_tags($request->email),
...@@ -90,11 +90,11 @@ public function update(Request $request, $id){ ...@@ -90,11 +90,11 @@ public function update(Request $request, $id){
return Redirect::route('user.index') return Redirect::route('user.index')
->with('success', 'User berhasil diupdate'); ->with('success', 'User berhasil diupdate');
// } else { } else {
// // Passwords do not match // Passwords do not match
// return Redirect::route('user.index') return Redirect::route('user.index')
// ->with('error', 'Password lama tidak valid'); ->with('error', 'Password lama yang dimasukkan salah');
// } }
} }
catch(Exception $e){ catch(Exception $e){
Log::error($e); Log::error($e);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<thead> <thead>
<tr> <tr>
<th>No</th> <th>No</th>
<th>ID Pengajuan</th> {{-- <th>ID Pengajuan</th> --}}
<th style="text-align: left">File SK</th> <th style="text-align: left">File SK</th>
<th style="text-align: left">Nama/NIP</th> <th style="text-align: left">Nama/NIP</th>
<th style="text-align: left">Judul</th> <th style="text-align: left">Judul</th>
...@@ -43,29 +43,43 @@ ...@@ -43,29 +43,43 @@
<tbody> <tbody>
@php @php
$no = 1; $no = 1;
$nomorsurat = $penelaah[0]->no_sk;
$no_surat = explode('/', $nomorsurat);
$noagenda = $no_surat[0];
$tahun = $no_surat[3];
$nama_file = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
@endphp @endphp
@foreach($penelaah as $key => $item) @foreach($penelaah as $key => $item)
{{-- @php @php
$pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first(); // $pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
@endphp --}} if($item->no_sk == $nomorsurat){
$namafile = $nama_file;
}
else{
$nosurat = explode('/', $item->no_sk);
$noagenda = $nosurat[0];
$tahun = $nosurat[3];
$namafile = app(App\Http\Controllers\Admin\SakuController::class)->getFileName($tahun, $noagenda);
}
@endphp
<tr> <tr>
<td>{{$no}}</td> <td>{{ $no }}</td>
<td>{{ $item['id_pengajuan_epk'] }}</td> {{-- <td>{{ $item->id_pengajuan_epk }}</td> --}}
<td style="text-align: left"><a href="https://e-office.unesa.ac.id/dokumen/surat_keluar/{{$item['namafile']}}" target="_blank"><img src="{{ url('assets/img/icons/misc/pdf.png') }}" alt="pdf" height="60" class="me-3" /></a></td> <td style="text-align: left"><a href="https://e-office.unesa.ac.id/dokumen/surat_keluar/{{$namafile}}" target="_blank"><img src="{{ url('assets/img/icons/misc/pdf.png') }}" alt="pdf" height="60" class="me-3" /></a></td>
<td style="text-align: left">{{ $item['nama'] }}<br> <td style="text-align: left">{{ $item->nama }}<br>
<strong>{{ $item['nip'] }}</strong></td> <strong>{{ $item->nip }}</strong></td>
<td style="text-align: left">{{ $item['judul'] }}</td> <td style="text-align: left">{{ $item->judul }}</td>
<td style="text-align: left">{{ $item['tahun'] }}</td> <td style="text-align: left">{{ $item->tahun }}</td>
<td style="text-align: left">{{ $item['klasifikasi'] }}</td> <td style="text-align: left">{{ $item->klasifikasi }}</td>
<td style="text-align: left"> <td style="text-align: left">
@if(!empty($item['file_ec'])) @if(!empty($item->file_ec))
<strong><a href="https://sipeka.unesa.ac.id/sipeka/file/{!!$item['file_ec']!!}" target="_blank" class="btn btn-success btn-md">Lihat</a></strong> <strong><a href="https://sipeka.unesa.ac.id/sipeka/file/{!!$item->file_ec!!}" target="_blank" class="btn btn-success btn-md">Lihat</a></strong>
@endif @endif
</td> </td>
{{-- @php {{-- @php
$kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first(); $kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp --}} @endphp --}}
<td style="text-align: left">{{ $item['nama_kategori'] }}</td> <td style="text-align: left">{{ $item->nama_kategori }}</td>
</tr> </tr>
@php @php
$no++; $no++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment