Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/Http/Controllers/Data/PengurusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ class PengurusController extends Controller

/**
* Display a listing of the resource.
*
* @return mixed
*/
public function index(Request $request)
{
Expand Down Expand Up @@ -106,9 +104,9 @@ public function index(Request $request)
->editColumn('status', function ($row) {
if ($row->status == 0) {
return '<span class="label label-danger">Tidak Aktif</span>';
} else {
return '<span class="label label-success">Aktif</span>';
}
return '<span class="label label-success">Aktif</span>';

})
->rawColumns(['foto', 'identitas', 'status'])
->make(true);
Expand Down Expand Up @@ -150,7 +148,7 @@ public function store(PengurusRequest $request): RedirectResponse
$this->handleFileUpload($request, $input, 'foto', 'pengurus', false);

$pengurus = new Pengurus;
$fillableFields = ['nama', 'nik', 'gelar_depan', 'gelar_belakang', 'nip', 'tempat_lahir', 'tanggal_lahir', 'sex', 'pendidikan_id', 'agama_id', 'pangkat', 'no_sk', 'tanggal_sk', 'no_henti', 'tanggal_henti', 'masa_jabatan', 'jabatan_id', 'atasan', 'bagan_tingkat', 'bagan_warna'];
$fillableFields = ['nama', 'nik', 'gelar_depan', 'gelar_belakang', 'nip', 'tempat_lahir', 'tanggal_lahir', 'sex', 'pendidikan_id', 'agama_id', 'pangkat', 'no_sk', 'tanggal_sk', 'no_henti', 'tanggal_henti', 'masa_jabatan', 'jabatan_id', 'atasan', 'bagan_tingkat', 'bagan_warna', 'foto'];

foreach ($fillableFields as $field) {
if (isset($input[$field])) {
Expand Down Expand Up @@ -221,7 +219,7 @@ public function update(PengurusRequest $request, int $id): RedirectResponse
}

public function destroy(Pengurus $penguru): RedirectResponse
{
{
try {
$penguru->delete();
} catch (\Exception $e) {
Expand Down
2 changes: 2 additions & 0 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ Terimakasih [isi disini] yang telah berkontribusi langsung mengembangkan aplikas
#### BUG

1. [#1771](https://github.com/OpenSID/OpenDK/issues/1771) Administrator utama bisa mengubah email hanya untuk akunnya sendiri.
2. [#1770](https://github.com/OpenSID/OpenDK/issues/1770) Perbaiki foto pengurus tidak tersimpan saat tambah data baru.


#### TEKNIS
8 changes: 8 additions & 0 deletions tests/Feature/Controllers/Data/PengurusControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use App\Models\Pengurus;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Spatie\Permission\Middleware\PermissionMiddleware;
use Spatie\Permission\Middleware\RoleMiddleware;

Expand Down Expand Up @@ -115,6 +116,8 @@
});

test('store creates pengurus with file upload', function () {
Storage::fake('local');

$jabatan = Jabatan::factory()->create();
$pendidikan = PendidikanKK::factory()->create();
$agama = Agama::factory()->create();
Expand Down Expand Up @@ -142,6 +145,11 @@
'nama' => 'Jane Doe',
'nik' => '1234567890123457',
]);

$pengurus = Pengurus::where('nik', '1234567890123457')->first();
$foto = $pengurus?->getRawOriginal('foto');
expect($foto)->not->toBeNull()
->and(Storage::disk('local')->exists('public/pengurus/'.$foto))->toBeTrue();
});

test('store fails with duplicate nik', function () {
Expand Down