Skip to content

Commit

Permalink
penambahan fitur search user dan search pasien
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunnie-pin committed Jul 8, 2023
1 parent 6500796 commit 3a80a2f
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 14 deletions.
14 changes: 13 additions & 1 deletion app/Http/Controllers/ListPasienController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ListPasienController extends Controller
public function index()
{
//
$datapasien = Pasien::all();
$datapasien = Pasien::latest()->simplePaginate(10);

return view('rolesviews.administrasi.listpasien', ['datapasien' => $datapasien]);
}
Expand Down Expand Up @@ -108,4 +108,16 @@ public function destroy($pasien)

return redirect('/list-pasien')->with('success', 'Pasien telah berhasil dihapus');
}

public function search(Request $request)
{
$search = $request->get('search');
$datapasien = Pasien::where('nama', 'like', '%' . $search . '%')
->orWhere('no_identitas', 'like', '%' . $search . '%')
->orWhere('no_telp', 'like', '%' . $search . '%')
->orWhere('bpjs', 'like', '%' . $search . '%')
->orWhere('alamat', 'like', '%' . $search . '%')
->paginate(5);
return view('rolesviews.administrasi.listpasien', ['datapasien' => $datapasien]);
}
}
15 changes: 14 additions & 1 deletion app/Http/Controllers/ListUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ListUserController extends Controller
public function index()
{
//
$dataUser = User::all();
$dataUser = User::latest()->simplePaginate(10);

return view('rolesviews.superadmin.listuser', ['dataUser' => $dataUser]);
}
Expand Down Expand Up @@ -119,4 +119,17 @@ public function destroy($user)
return redirect('/list-user')->with('success', 'User telah berhasil dihapus');

}

public function search(Request $request)
{
$search = $request->get('search');
$dataUser = User::where('email', 'LIKE', "%{$search}%")
->orWhere('nama_lengkap', 'LIKE', "%{$search}%")
->orWhere('username', 'LIKE', "%{$search}%")
->orWhere('no_telp', 'LIKE', "%{$search}%")
->simplePaginate(10);

return view('rolesviews.superadmin.listuser', ['dataUser' => $dataUser]);
}

}
66 changes: 66 additions & 0 deletions app/Http/Controllers/ProfileUserController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;

class ProfileUserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//

}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(User $user)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(User $user)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, User $user)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(User $user)
{
//
}
}
1 change: 1 addition & 0 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
</div>
@endif
<div class="card-body">

<div class="row">
<!-- Sales Card -->
<div class="col-xxl-4 col-md-6 mt-5">
Expand Down
27 changes: 23 additions & 4 deletions resources/views/rolesviews/administrasi/listpasien.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,29 @@
</div>
@endif

<div class="py-3">
<a class="btn btn-success" href="{{ route('create-pasien') }}">
<i class="bi bi-plus">Registrasi Pasien</i>
</a>
<div class="row">

<div class="col py-3">
<a class="btn btn-success" href="{{ route('create-pasien') }}">
<i class="bi bi-plus">Registrasi Pasien</i>
</a>
</div>

<div class="col">
<form class="py-3 " action="{{ route('search-pasien') }}" method="GET">
<div class="row justify-content-end">
<div class="col-md-3">
<input type="text" name="search" class="form-control" required />
</div>
<div class="col-md-3">
<button class="btn btn-primary" type="submit">Search</button>
</div>
</div>
</form>
</div>



<!-- card -->
<div class="row p-3 border border-primary ">
<table id="myTable" class="table table-striped border-primary table-hover table-bordered">
Expand Down Expand Up @@ -120,6 +137,8 @@ class="btn btn-warning">
</tbody>

</table>

{!! $datapasien->render() !!}
</div>

<!-- end card -->
Expand Down
3 changes: 0 additions & 3 deletions resources/views/rolesviews/superadmin/edit/edituser.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<div class="card">
<div class="card-body p-3">



<form class="row g-3" method="post" action="{{ route('list-user.update', ['list_user' => $data->username]) }}">
@csrf
@method('put')
Expand All @@ -33,7 +31,6 @@ class="form-control"
>
</div>


<div class="py-2">
<label for="email" class="form-label">Email</label>
<input type="text" value="{{ $data->email }}"
Expand Down
22 changes: 21 additions & 1 deletion resources/views/rolesviews/superadmin/listuser.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,29 @@
</div>
@endif

<div class="py-3">
<div class="row">
<div class="col py-3">
<a class="btn btn-success" href="{{ route('create-user') }}">
<i class="bi bi-plus">Pendaftaran Petugas</i>
</a>
</div>

<div class="col">
<form class="py-3 " action="{{ route('search-user') }}" method="GET">
<div class="row justify-content-end">
<div class="col-md-3">
<input type="text" name="search" class="form-control" required/>
</div>
<div class="col-md-3">
<button class="btn btn-primary" type="submit">Search</button>
</div>
</div>
</form>
</div>
</div>



<!-- card -->
<div class="row p-3 border border-primary ">

Expand Down Expand Up @@ -95,6 +112,9 @@ class="btn btn-warning">
</tbody>

</table>

{!! $dataUser->render() !!}

</div>

<!-- end card -->
Expand Down
17 changes: 13 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use App\Http\Controllers\PemeriksaanController;
use App\Http\Controllers\ListParameterController;
use App\Http\Controllers\HasilPemeriksaanController;
use App\Http\Controllers\ProfileUserController;
use App\Http\Controllers\RegistrasiPemeriksaanController;
use App\Http\Controllers\ReviewPemeriksaanController;
use App\Http\Controllers\RiwayatPemeriksaanController;
Expand Down Expand Up @@ -53,32 +54,40 @@
'index' => 'list-user',
'create' => 'create-user',
'store' => 'store-user'
])->middleware('superadmin');;
])->middleware('superadmin');

Route::get('/list-user-search', [ListUserController::class, 'search'])->name('search-user')->middleware('superadmin');

Route::resource('/profile', ProfileUserController::class)->names([
'index' => 'profile',
'update' => 'update-profile'
])->except(['create', 'destroy', 'edit', 'store']) ->middleware('auth');

Route::resource('/list-bidang', ListBidangController::class)->names([
'index' => 'list-bidang',
'create' => 'create-bidang',
'store' => 'store-bidang',
])->middleware('superadmin');;
])->middleware('superadmin');

Route::resource('/list-metode', ListMetodeController::class)->names([
'index' => 'list-metode',
'create' => 'create-metode',
'store' => 'store-metode'
])->middleware('superadmin');;
])->middleware('superadmin');

Route::resource('/list-parameter', ListParameterController::class)->names([
'index' => 'list-parameter',
'create' => 'create-parameter',
])->middleware('superadmin');


//Administrasi
Route::resource('/list-pasien', ListPasienController::class)->names([
'index' => 'list-pasien',
'create' => 'create-pasien',
])->middleware('administrasi');

Route::get('/list-pasien-search', [ListPasienController::class, 'search'])->name('search-pasien')->middleware('administrasi');

Route::resource('/hasil-pemeriksaan', HasilPemeriksaanController::class)->names([
'index' => 'hasil-pemeriksaan'
])->middleware('administrasi');
Expand Down

0 comments on commit 3a80a2f

Please sign in to comment.