Commit 248c7caa by Triyah Fatmawati

fix get filename dan reset password user

parent 67330ad3
......@@ -23,33 +23,9 @@ public function index() {
->orderBy('id_pengajuan')
->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 = [
'penelaah' => $arrPenelaah,
'penelaah' => $penelaah,
];
return view('saku.index', $data);
......
......@@ -38,7 +38,7 @@ public function store(Request $request){
$user = [
'name' => strip_tags($request->name),
'email' => strip_tags($request->email),
'password' => strip_tags($request->password),
'password' => Hash::make(strip_tags($request->password)),
];
User::query()->create($user);
......@@ -71,13 +71,13 @@ public function update(Request $request, $id){
try{
$id = decrypt($id);
$passwordbaru = bcrypt(strip_tags($request->passwordbaru));
$passwordbaru = Hash::make(strip_tags($request->passwordbaru));
$passwordlama = strip_tags($request->passwordlama);
$oldpassword = User::where('id', $id)->first();
// if (Hash::check($passwordlama, $oldpassword->password)) {
// // Passwords match
if (Hash::check($passwordlama, $oldpassword->password)) {
// Passwords match
$user = [
'name' => strip_tags($request->name),
'email' => strip_tags($request->email),
......@@ -90,11 +90,11 @@ public function update(Request $request, $id){
return Redirect::route('user.index')
->with('success', 'User berhasil diupdate');
// } else {
// // Passwords do not match
// return Redirect::route('user.index')
// ->with('error', 'Password lama tidak valid');
// }
} else {
// Passwords do not match
return Redirect::route('user.index')
->with('error', 'Password lama yang dimasukkan salah');
}
}
catch(Exception $e){
Log::error($e);
......
......@@ -30,7 +30,7 @@
<thead>
<tr>
<th>No</th>
<th>ID Pengajuan</th>
{{-- <th>ID Pengajuan</th> --}}
<th style="text-align: left">File SK</th>
<th style="text-align: left">Nama/NIP</th>
<th style="text-align: left">Judul</th>
......@@ -43,29 +43,43 @@
<tbody>
@php
$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
@foreach($penelaah as $key => $item)
{{-- @php
$pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
@endphp --}}
@php
// $pengajuan = DB::table('tr_pengajuan')->where('id',$item->id_pengajuan)->first();
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>
<td>{{$no}}</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">{{ $item['nama'] }}<br>
<strong>{{ $item['nip'] }}</strong></td>
<td style="text-align: left">{{ $item['judul'] }}</td>
<td style="text-align: left">{{ $item['tahun'] }}</td>
<td style="text-align: left">{{ $item['klasifikasi'] }}</td>
<td>{{ $no }}</td>
{{-- <td>{{ $item->id_pengajuan_epk }}</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>
<strong>{{ $item->nip }}</strong></td>
<td style="text-align: left">{{ $item->judul }}</td>
<td style="text-align: left">{{ $item->tahun }}</td>
<td style="text-align: left">{{ $item->klasifikasi }}</td>
<td style="text-align: left">
@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>
@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>
@endif
</td>
{{-- @php
$kategori = DB::table('ms_kategori')->where('id',$pengajuan->id_kategori)->first();
@endphp --}}
<td style="text-align: left">{{ $item['nama_kategori'] }}</td>
<td style="text-align: left">{{ $item->nama_kategori }}</td>
</tr>
@php
$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