Skip to content

Commit

Permalink
Bug Fixing pendaftaran calon murid
Browse files Browse the repository at this point in the history
  • Loading branch information
andes2912 committed May 18, 2022
1 parent 0b163fb commit 50712bf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 21 deletions.
10 changes: 6 additions & 4 deletions Modules/PPDB/Http/Controllers/DataMuridController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
use Illuminate\Http\Request;
use Validator;
use Illuminate\Routing\Controller;
use DB;
use Session;

use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\DB;
class DataMuridController extends Controller
{
/**
Expand Down Expand Up @@ -51,7 +50,10 @@ public function store(Request $request)
public function show($id)
{
$murid = User::with('muridDetail','dataOrtu','berkas')->where('role','Guest')->find($id);
// return $murid;
if (!$murid->muridDetail->agama || !$murid->dataOrtu->nama_ayah || !$murid->berkas->kartu_keluarga) {
Session::flash('error','Calon Siswa Belum Input Biodata Diri !');
return redirect('/ppdb/data-murid');
}
return view('ppdb::backend.dataMurid.show',compact('murid'));

}
Expand Down
23 changes: 15 additions & 8 deletions Modules/PPDB/Http/Controllers/PendaftaranController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
use Modules\PPDB\Http\Requests\{berkasMuridRequest, DataMuridRequest,DataOrtuRequest};
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use DB;
use Illuminate\Support\Facades\DB;
use Modules\PPDB\Entities\BerkasMurid;
use Modules\PPDB\Entities\DataOrangTua;
use Session;
use Illuminate\Support\Facades\Session;

class PendaftaranController extends Controller
{
Expand Down Expand Up @@ -113,7 +113,7 @@ public function updateOrtu(DataOrtuRequest $request, $id)

DB::commit();
Session::flash('success','Success, Data Berhasil dikirim !');
return redirect('/home');
return redirect('/ppdb/form-berkas');
} catch (ErrorException $e) {
DB::rollback();
throw new ErrorException($e->getMessage());
Expand Down Expand Up @@ -173,12 +173,18 @@ public function berkasStore(berkasMuridRequest $request,$id)
$tujuan_upload = 'public/images/berkas_murid';
$imagerapor->storeAs($tujuan_upload,$rapor);

if ($request->foto) {
$imagefoto = $request->file('foto');
$foto = time()."_".$imagefoto->getClientOriginalName();
$imagefoto = $request->file('foto');
$foto = time()."_".$imagefoto->getClientOriginalName();
// isi dengan nama folder tempat kemana file diupload
$tujuan_upload = 'public/images/berkas_murid';
$imagefoto->storeAs($tujuan_upload,$foto);

if ($request->ijazah) {
$imageijazah = $request->file('ijazah');
$ijazah = time()."_".$imageijazah->getClientOriginalName();
// isi dengan nama folder tempat kemana file diupload
$tujuan_upload = 'public/images/berkas_murid';
$imagefoto->storeAs($tujuan_upload,$foto);
$imageijazah->storeAs($tujuan_upload,$ijazah);
}

$berkas = BerkasMurid::find($id);
Expand All @@ -188,7 +194,8 @@ public function berkasStore(berkasMuridRequest $request,$id)
$berkas->surat_sehat = $suratsehat;
$berkas->surat_tidak_buta_warna = $surattidakbutawarna;
$berkas->rapor = $rapor;
$berkas->foto = $foto ?? NULL;
$berkas->foto = $foto;
$berkas->ijazah = $ijazah ?? null;
$berkas->save();

DB::commit();
Expand Down
4 changes: 2 additions & 2 deletions Modules/PPDB/Http/Requests/BerkasMuridRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function messages()
'foto.required' => 'Foto tidak boleh kosong.',
'foto.mimes' => 'Foto hanya mendukung .jpg .jpeg .png atau pdf.',
'foto.max' => 'Ukuran file tidak boleh lebih dari 2MB.',


'ijazah.mimes' => 'File Ijazah hanya mendukung .jpg .jpeg .png atau pdf.',
'ijazah.max' => 'Ukuran file tidak boleh lebih dari 2MB.',
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<div class="content-body">
<div class="row">
<div class="col-12">
<div class="alert alert-danger {{$murid->berkas->kartu_keluarga != NULL ? 'hidden' : ''}}" role="alert">
<div class="alert-body">
<strong>Info:</strong> Data Calon Murid Belum Lengkap !
</div>
</div>
<div class="card">
<div class="card-body">
<form action=" {{route('data-murid.update',$murid->id)}} " method="post" enctype="multipart/form-data">
Expand Down Expand Up @@ -350,7 +355,7 @@

</div>
</div>
<button class="btn btn-primary" type="submit">Terima Murid</button>
<button class="btn btn-primary" type="submit" {{$murid->berkas->kartu_keluarga == NULL ? 'disabled' : ''}} >Terima Murid</button>
<a href="{{route('data-murid.index')}}" class="btn btn-warning">Batal</a>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="col-6">
<div class="form-group">
<label for="basicInput">Nama Ayah</label>
<input type="text" class="form-control @error('nama_ayah') is-invalid @enderror" name="nama_ayah" value=" {{old('nama_ayah')}} " placeholder="Nama Ayah" />
<input type="text" class="form-control @error('nama_ayah') is-invalid @enderror" name="nama_ayah" value=" {{old('nama_ayah')}} " placeholder="Nama Ayah" />
@error('nama_ayah')
<div class="invalid-feedback">
<strong>{{ $message }}</strong>
Expand All @@ -41,7 +41,7 @@
<div class="col-6">
<div class="form-group">
<label for="basicInput">No Telp Ayah</label>
<input type="text" class="form-control @error('telp_ayah') is-invalid @enderror" name="telp_ayah" value=" {{old('telp_ayah')}} " placeholder="telp Ayah" />
<input type="text" class="form-control @error('telp_ayah') is-invalid @enderror" name="telp_ayah" value=" {{old('telp_ayah')}} " placeholder="telp Ayah" />
@error('telp_ayah')
<div class="invalid-feedback">
<strong>{{ $message }}</strong>
Expand All @@ -57,7 +57,7 @@
<option value="SD" {{old('pendidikan_ayah') == 'SD' ? 'selected' : ''}} >SD</option>
<option value="SMP" {{old('pendidikan_ayah') == 'SMP' ? 'selected' : ''}}>SMP</option>
<option value="SMA/SMK" {{old('pendidikan_ayah') == 'SMA/SMK' ? 'selected' : ''}}>SMA/SMK</option>
<option value="SI" {{old('pendidikan_ayah') == 'S1' ? 'selected' : ''}}>SI</option>
<option value="S1" {{old('pendidikan_ayah') == 'S1' ? 'selected' : ''}}>S1</option>
<option value="S2" {{old('pendidikan_ayah') == 'S2' ? 'selected' : ''}}>S2</option>
<option value="S3" {{old('pendidikan_ayah') == 'S3' ? 'selected' : ''}}>S3</option>
</select>
Expand Down Expand Up @@ -104,7 +104,7 @@
<div class="col-6">
<div class="form-group">
<label for="basicInput">Nama Ibu</label>
<input type="text" class="form-control @error('nama_ibu') is-invalid @enderror" name="nama_ibu" value=" {{old('nama_ibu')}} " placeholder="Nama Ibu" />
<input type="text" class="form-control @error('nama_ibu') is-invalid @enderror" name="nama_ibu" value=" {{old('nama_ibu')}} " placeholder="Nama Ibu" />
@error('nama_ibu')
<div class="invalid-feedback">
<strong>{{ $message }}</strong>
Expand All @@ -115,7 +115,7 @@
<div class="col-6">
<div class="form-group">
<label for="basicInput">No Telp Ibu</label>
<input type="text" class="form-control @error('telp_ibu') is-invalid @enderror" name="telp_ibu" value=" {{old('telp_ibu')}} " placeholder="telp Ibu" />
<input type="text" class="form-control @error('telp_ibu') is-invalid @enderror" name="telp_ibu" value=" {{old('telp_ibu')}} " placeholder="telp Ibu" />
@error('telp_ibu')
<div class="invalid-feedback">
<strong>{{ $message }}</strong>
Expand All @@ -131,7 +131,7 @@
<option value="SD" {{old('pendidikan_ibu') == 'SD' ? 'selected' : ''}} >SD</option>
<option value="SMP" {{old('pendidikan_ibu') == 'SMP' ? 'selected' : ''}}>SMP</option>
<option value="SMA/SMK" {{old('pendidikan_ibu') == 'SMA/SMK' ? 'selected' : ''}}>SMA/SMK</option>
<option value="SI" {{old('pendidikan_ibu') == 'S1' ? 'selected' : ''}}>SI</option>
<option value="S1" {{old('pendidikan_ibu') == 'S1' ? 'selected' : ''}}>S1</option>
<option value="S2" {{old('pendidikan_ibu') == 'S2' ? 'selected' : ''}}>S2</option>
<option value="S3" {{old('pendidikan_ibu') == 'S3' ? 'selected' : ''}}>S3</option>
</select>
Expand Down

0 comments on commit 50712bf

Please sign in to comment.