text:
<repo_name>muzhawir/utdp-pmi-makassar<file_sep>/resources/views/admin/doctor/show.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pemeriksaan Donatur

        Detail Data

           Kembali

            Nama Lengkap
            <input class="form-control" value="{{ $donatee->donor->fullname }}" readonly>

            Jenis Kelamin
            <input class="form-control" value="{{ ($donatee->donor->gender == 'L' ? 'Laki-Laki' : 'Perempuan') }}"
              readonly>

            Jenis Donor
            <input class="form-control" value="{{ $donatee->masterDonorType->name }}" readonly>

            Metode Pengambilan Darah
            <input class="form-control" value="{{ $donatee->masterBloodTakingMethod->name }}" readonly>

            Golongan Darah
            <input class="form-control" value="{{ $donatee->blood_type }}" readonly>

            Rhesus
            <input class="form-control" value="{{ ($donatee->rhesus == 'N' ? 'Negatif' : 'Positif') }}" readonly>

            Tekanan Darah

              <input class="form-control" value="{{ $donatee->blood_pressure }}" readonly>

mmHG

            Denyut Nadi

              <input class="form-control" value="{{ $donatee->pulse }}" readonly>

BPM

            Berat Badan

              <input class="form-control" value="{{ $donatee->weight }}" readonly>

Kg

            Tinggi Badan

              <input class="form-control" value="{{ $donatee->height }}" readonly>

Cm

            <NAME>

              <input class="form-control" value="{{ $donatee->body_temperature }}" readonly>

℃ (Celcius)

            Keadaan Umum
            <input class="form-control" value="{{ $donatee->general_state }}" readonly>

            Status
            <input class="form-control" value="{{ ($donatee->blood_status == '0' ? 'Ditolak' : 'Diterima') }}" readonly>

            Riwayat Medis
            <textarea class="form-control" readonly>{{ $donatee->medical_history }}</textarea>

            Jenis Kantong
            <input class="form-control" value="{{ (isset($donatee->masterBloodBag->name) ? $donatee->masterBloodBag->name : '') }}" readonly>

            Volume darah yang diambil

              <input class="form-control" value="{{ (isset($donatee->masterBloodVolume->name) ? $donatee->masterBloodVolume->name : '') }}" readonly>

cc

@endsection
<file_sep>/database/seeds/MasterBloodVolumeSeeder.php
<?php

use App\MasterBloodVolume;
use Illuminate\Database\Seeder;

class MasterBloodVolumeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $count = 2;
        factory(MasterBloodVolume::class, $count)->create();
    }
}
<file_sep>/resources/views/admin/aftap_officer/edit.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pengambilan Darah Donatur

        Input / Ubah Data

           Kembali

        <form action="{{ route('aftap-officer.update', $donatee->id) }}" method="POST">
          @csrf
          @method('PATCH')

          <input type="hidden" name="aftapOfficerName" value="{{ Auth::user()->fullname }}" required>

              Nama Pendonor
              <input class="form-control" value="{{ $donatee->donor->fullname }}" readonly>

              Jenis Kelamin
              <input class="form-control" value="{{ ($donatee->donor->gender == 'L' ? 'Laki-Laki' : 'Perempuan') }}" readonly>

              Waktu mulai pengambilan darah
              <input class="form-control timepicker" name="time[start]"
                value="{{ (isset($time->{'start'}) ? $time->{'start'} : '') }}" id="time" type="text" autofocus>

              Waktu selesai pengambilan darah
              <input class="form-control timepicker" name="time[stop]"
                value="{{ (isset($time->{'stop'}) ? $time->{'stop'} : '') }}" id="time" type="text">

              Reaksi Donor

                <select class="form-control select2" id="masterReactionId" name="masterReactionId">
                  @foreach ($masterReactions as $masterReaction)
                  <option value="{{ $masterReaction->id }}" {{ ($masterReaction->id == $selectedMasterReaction->master_reaction_id) ? 'selected' : '' }}>{{ $masterReaction->name }}</option>
                  @endforeach
                </select>

                Berhenti Pada

                  <input class="form-control" name="stoppedAt" id="stoppedAt" min="0" type="number" placeholder="65"
                    value="{{ $donatee->stopped_at }}">

gram/cc

              Nomor Kantong
              <input class="form-control" name="bagNumber" id="bagNumber" type="number" placeholder="1"
                value="{{ $donatee->bag_number }}">

            Status Proses Donor

                      <input type="radio" name="finished" value="0" {{ ($donatee->finished == '0') ? 'checked' : '' }}>

                        Belum Selesai

                      Proses administrasi sampai pengambilan darah donatur belum selesai.

                      <input type="radio" name="finished" value="1" {{ ($donatee->finished == '1') ? 'checked' : '' }}>

                        Selesai

                      Proses administrasi sampai dengan pengambilan darah Donatur
                      telah selesai. Dimohon periksa kembali semua prosedur sebelum
                      memilih tombol selesai!

            <button type="submit" class="btn btn-success btn-wide">
              Input Data
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/resources/views/admin/master_profession/index.blade.php
@extends('layouts.admin.app')

@section('page_style')
<link href="{{ asset('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css">
@endsection

@section('content')

        Master Pekerjaan

           Tambah Data

            Nama Pekerjaan
            Aksi

          @foreach ($masterProfessions as $masterProfession)

            {{ $masterProfession->name }}

              <form action="{{ route('master-profession.destroy', $masterProfession->id)}}" method="POST">
                @csrf
                @method('DELETE')

                    id) }}">
                      Ubah

                    <button class="dropdown-item" type="submit">
                      Hapus
                    </button>

                id) }}" class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Lihat Detail">

              </form>

          @endforeach

@endsection

@section('page_script')

@endsection
<file_sep>/database/migrations/2020_02_19_184716_create_donatees_table.php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDonateesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('donatees', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('donor_id');
            $table->unsignedBigInteger('master_donor_type_id')->nullable();
            $table->unsignedBigInteger('master_blood_taking_method_id')->nullable();
            $table->unsignedBigInteger('master_hb_falling_drop_method_id')->nullable();
            $table->unsignedBigInteger('master_blood_volume_id')->nullable();
            $table->unsignedBigInteger('master_blood_bag_id')->nullable();
            $table->unsignedBigInteger('master_reaction_id')->nullable();
            $table->string('hb_officer_name')->nullable();
            $table->string('doctor_name')->nullable();
            $table->string('aftap_officer_name')->nullable();
            $table->unsignedInteger('microcuvette')->nullable();
            $table->enum('blood_type', ['A', 'AB', 'B', 'O'])->nullable();
            $table->enum('rhesus', ['N', 'P'])->nullable()->comment('
                N:Negative,
                P:Positive
            ');
            $table->string('blood_pressure')->nullable();
            $table->unsignedSmallInteger('pulse')->nullable();
            $table->unsignedSmallInteger('weight')->nullable();
            $table->unsignedSmallInteger('height')->nullable();
            $table->unsignedTinyInteger('body_temperature')->nullable();
            $table->text('general_state')->nullable();
            $table->text('medical_history')->nullable();
            $table->enum('blood_status', ['0', '1'])->default('1')->nullable()->comment('
                0:Rejected,
                1:Accepted
            ');
            $table->string('time')->nullable();
            $table->unsignedInteger('stopped_at')->default(0)->nullable();
            $table->unsignedInteger('bag_number')->nullable();
            $table->enum('finished', ['0', '1'])->default('0')->nullable()->comment('
                0:Not Yet,
                1:Finished
            ');
            $table->enum('taken', ['0', '1'])->default('0')->nullable()->comment('
                0:Not Taken,
                1:Taken
            ');
            $table->timestamps();

            $table->foreign('donor_id')->references('id')->on('donors')->onDelete('CASCADE');
            $table->foreign('master_donor_type_id')->references('id')->on('master_donor_types')->onDelete('SET NULL');
            $table->foreign('master_blood_taking_method_id')->references('id')->on('master_blood_taking_methods')->onDelete('SET NULL');
            $table->foreign('master_hb_falling_drop_method_id')->references('id')->on('master_hb_falling_drop_methods')->onDelete('SET NULL');
            $table->foreign('master_blood_volume_id')->references('id')->on('master_blood_volumes')->onDelete('SET NULL');
            $table->foreign('master_blood_bag_id')->references('id')->on('master_blood_bags')->onDelete('SET NULL');
            $table->foreign('master_reaction_id')->references('id')->on('master_reactions')->onDelete('SET NULL');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('donatees');
    }
}
<file_sep>/app/Http/Controllers/MasterReactionController.php
<?php

namespace App\Http\Controllers;

use App\MasterReaction;
use Illuminate\Http\Request;

class MasterReactionController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterReactions = MasterReaction::all();

        return view('admin.master_reaction.index', compact('masterReactions'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_reaction.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        MasterReaction::create($validatedData);

        return redirect('/master-reaction')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterReaction  $masterReaction
     * @return \Illuminate\Http\Response
     */
    public function show(MasterReaction $masterReaction)
    {
        return view('admin.master_reaction.show', compact('masterReaction'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterReaction  $masterReaction
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterReaction $masterReaction)
    {
        return view('admin.master_reaction.edit', compact('masterReaction'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterReaction  $masterReaction
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterReaction $masterReaction)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        $masterReaction->update($validatedData);

        return redirect('/master-reaction')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterReaction  $masterReaction
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterReaction::findOrFail($id);
        $delete->delete();

        return redirect('/master-reaction')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/resources/views/admin/aftap_officer/index.blade.php
@extends('layouts.admin.app')

@section('page_style')
<link href="{{ asset('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css">
@endsection

@section('content')

        Data Pengambilan Darah Donatur

          Nama Lengkap
          Jenis Kelamin
          Metode
Pengambilan
Darah
          HB Metode
Falling Drop
(CuSO4)
          Golongan Darah
          Jenis Kantong
          Volume Darah
Yang Diambil
          Status
          Aksi

        @foreach ($donatees as $donatee)

          {{ $donatee->donor->fullname }}
          {{ ($donatee->donor->gender == 'L' ? 'Laki-Laki' : 'Perempuan') }}
          {{ $donatee->masterBloodTakingMethod->name }}
          {{ $donatee->masterHbFallingDropMethod->name }}
          {{ $donatee->blood_type .' (Rhesus '.($donatee->rhesus == 'N' ? 'Negatif' : 'Positif').')' }}

            @if (isset($donatee->masterBloodBag->name))
            {{ $donatee->masterBloodBag->name }}
            @else
            Data belum diisi oleh dokter.
            @endif

            @if (isset($donatee->masterBloodVolume->name))
            {{ $donatee->masterBloodVolume->name }} cc
            @else
            Data belum diisi oleh dokter.
            @endif

          {{ ($donatee->finished == '0') ? 'Belum Selesai' : 'Selesai' }}

            id) }}" class="btn btn-sm btn-clean btn-icon btn-icon-md"
              title="Input/Ubah">

            id) }}" class="btn btn-sm btn-clean btn-icon btn-icon-md"
              title="Lihat Detail">

        @endforeach

@endsection

@section('page_script')

@endsection
<file_sep>/app/Donatee.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Donatee extends Model
{
    protected $fillable = [
        'donor_id',
        'master_donor_type_id',
        'master_blood_taking_method_id',
        'master_hb_falling_drop_method_id',
        'master_blood_volume_id',
        'master_blood_bag_id',
        'master_reaction_id',
        'hb_officer_name',
        'doctor_name',
        'aftap_officer_name',
        'microcuvette',
        'blood_type',
        'rhesus',
        'blood_pressure',
        'pulse',
        'weight',
        'height',
        'body_temperature',
        'general_state',
        'medical_history',
        'blood_status',
        'time',
        'stopped_at',
        'bag_number',
        'finished',
        'taken'
    ];

    public function donor()
    {
        return $this->belongsTo('App\Donor');
    }

    public function masterDonorType()
    {
        return $this->belongsTo('App\MasterDonorType');
    }

    public function masterBloodBag()
    {
        return $this->belongsTo('App\MasterBloodBag');
    }

    public function masterBloodTakingMethod()
    {
        return $this->belongsTo('App\MasterBloodTakingMethod');
    }

    public function masterBloodVolume()
    {
        return $this->belongsTo('App\MasterBloodVolume');
    }

    public function masterHbFallingDropMethod()
    {
        return $this->belongsTo('App\MasterHbFallingDropMethod');
    }

    public function masterReaction()
    {
        return $this->belongsTo('App\MasterReaction');
    }
}
<file_sep>/database/seeds/MasterReactionSeeder.php
<?php

use App\MasterReaction;
use Illuminate\Database\Seeder;

class MasterReactionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $count = 6;
        factory(MasterReaction::class, $count)->create();
    }
}
<file_sep>/database/factories/DonorFactory.php
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\Donor;
use App\MasterAppreciation;
use App\MasterIdentityCardType;
use App\MasterProfession;
use Faker\Generator as Faker;

$factory->define(Donor::class, function (Faker $faker) {
    return [
        'identity_card_number' => $faker->creditCardNumber,
        'master_identity_card_type_id' => function() {
            return factory(MasterIdentityCardType::class)->create()->id();
        },
        'fullname' => $faker->name,
        'address' => $faker->address,
        'village' => $faker->streetAddress,
        'sub_district' => $faker->streetName,
        'city' => $faker->city,
        'gender' => $faker->randomElement(['L', 'P']),
        'email' => $faker->unique()->safeEmail,
        'phone' => $faker->phoneNumber,
        'master_profession_id' => function() {
            return factory(MasterProfession::class)->create()->id();
        },
        'birth_place' => $faker->city,
        'date_of_birth' => $faker->date,
        'marital_status' => $faker->randomElement(['0', '1']),
        'tribes' => $faker->lastName,
        'reminder' => $faker->randomElement(['0', '1']),
        'master_appreciation_id' => function() {
            return factory(MasterAppreciation::class)->create()->id();
        },
        'certain_need' => $faker->randomElement(['0', '1']),
        'last_on' => $faker->date(),
        'total' => rand(1, 100),
        'medical_history' => $faker->sentence
    ];
});
<file_sep>/app/Setting.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Setting extends Model
{
    protected $fillable = [
        'office_name',
        'office_email',
        'office_website',
        'office_phone',
        'office_fax',
        'office_address',
        'office_village',
        'office_sub_district',
        'office_city',
        'office_province',
        'donor_form_serial',
        'donor_form_revision',
        'donor_form_effective_date',
    ];
}
<file_sep>/app/Http/Controllers/DonorController.php
<?php

namespace App\Http\Controllers;

use App\Donor;
use App\MasterAppreciation;
use App\MasterIdentityCardType;
use App\MasterProfession;
use Illuminate\Http\Request;

class DonorController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $donors = Donor::all();

        return view('admin.donor.index', compact('donors'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $masterIdentityCardTypes = MasterIdentityCardType::select('id', 'name')->get();
        $masterProfessions = MasterProfession::select('id', 'name')->get();
        $masterAppreciations = MasterAppreciation::select('id', 'total')->get();

        return view('admin.donor.create', compact(
            'masterIdentityCardTypes',
            'masterProfessions',
            'masterAppreciations'
        ));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $request->validate([
            'identityCardNumber' => 'required',
            'masterIdentityCardTypeId' => 'required|numeric',
            'fullname' => 'required|max:255',
            'address' => 'required',
            'village' => 'required',
            'subDistrict' => 'required',
            'city' => 'required',
            'gender' => 'required',
            'email' => 'required|email|unique:users',
            'phone' => 'required',
            'masterProfessionId' => 'required|numeric',
            'birthPlace' => 'required',
            'dateOfBirth' => 'required',
            'maritalStatus' => 'required',
            'tribes' => 'required',
            'reminder' => 'required',
            'masterAppreciationId' => 'required|numeric',
            'fasting' => 'required',
            'certainNeed' => 'required',
            'lastOn' => 'required',
            'total' => 'required|numeric',
            'previousDonateHistory' => 'required'
        ]);

        Donor::create([
            'identity_card_number' => $request['identityCardNumber'],
            'master_identity_card_type_id' => $request['masterIdentityCardTypeId'],
            'fullname' => $request['fullname'],
            'address' => $request['address'],
            'village' => $request['village'],
            'sub_district' => $request['subDistrict'],
            'city' => $request['city'],
            'gender' => $request['gender'],
            'email' => $request['email'],
            'phone' => $request['phone'],
            'master_profession_id' => $request['masterProfessionId'],
            'birth_place' => $request['birthPlace'],
            'date_of_birth' => $request['dateOfBirth'],
            'marital_status' => $request['maritalStatus'],
            'tribes' => $request['tribes'],
            'reminder' => $request['reminder'],
            'master_appreciation_id' => $request['masterAppreciationId'],
            'fasting' => $request['fasting'],
            'certain_need' => $request['certainNeed'],
            'last_on' => $request['lastOn'],
            'total' => $request['total'],
            'previous_donate_history' => $request['previousDonateHistory']
        ]);

        return redirect('/donor')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Donor  $donor
     * @return \Illuminate\Http\Response
     */
    public function show(Donor $donor)
    {
        return view('admin.donor.show', compact('donor'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Donor  $donor
     * @return \Illuminate\Http\Response
     */
    public function edit(Donor $donor)
    {
        # Get all data for foreign key
        $masterIdentityCardTypes = MasterIdentityCardType::select('id', 'name')->get();
        $masterProfessions = MasterProfession::select('id', 'name')->get();
        $masterAppreciations = MasterAppreciation::select('id', 'total')->get();

        # Get selected foreign key
        $selectedMasterIdentityCardType = Donor::select('master_identity_card_type_id')
            ->where('master_identity_card_type_id', '=' , $donor->master_identity_card_type_id)->first();

        $selectedMasterProfession = Donor::select('master_profession_id')
            ->where('master_profession_id', '=', $donor->master_profession_id)->first();

        $selectedMasterAppreciation = Donor::select('master_appreciation_id')
            ->where('master_appreciation_id', '=', $donor->master_appreciation_id)->first();

        //dd($selectedMasterAppreciation->master_appreciation_id);

        return view('admin.donor.edit', compact(
            'donor',
            'masterIdentityCardTypes',
            'masterProfessions',
            'masterAppreciations',
            'selectedMasterIdentityCardType',
            'selectedMasterProfession',
            'selectedMasterAppreciation'
        ));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Donor  $donor
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Donor $donor)
    {
        $request->validate([
            'identityCardNumber' => 'required',
            'masterIdentityCardTypeId' => 'required|numeric',
            'fullname' => 'required|max:255',
            'address' => 'required',
            'village' => 'required',
            'subDistrict' => 'required',
            'city' => 'required',
            'gender' => 'required',
            'email' => 'required|email|unique:users',
            'phone' => 'required',
            'masterProfessionId' => 'required|numeric',
            'birthPlace' => 'required',
            'dateOfBirth' => 'required',
            'maritalStatus' => 'required',
            'tribes' => 'required',
            'reminder' => 'required',
            'masterAppreciationId' => 'required|numeric',
            'fasting' => 'required',
            'certainNeed' => 'required',
            'lastOn' => 'required',
            'total' => 'required|numeric',
            'previousDonateHistory' => 'required'
        ]);

        $donor->identity_card_number = $request['identityCardNumber'];
        $donor->master_identity_card_type_id = $request['masterIdentityCardTypeId'];
        $donor->fullname = $request['fullname'];
        $donor->address = $request['address'];
        $donor->village = $request['village'];
        $donor->sub_district = $request['subDistrict'];
        $donor->city = $request['city'];
        $donor->gender = $request['gender'];
        $donor->email = $request['email'];
        $donor->phone = $request['phone'];
        $donor->master_profession_id = $request['masterProfessionId'];
        $donor->birth_place = $request['birthPlace'];
        $donor->date_of_birth = $request['dateOfBirth'];
        $donor->marital_status = $request['maritalStatus'];
        $donor->tribes = $request['tribes'];
        $donor->reminder = $request['reminder'];
        $donor->master_appreciation_id = $request['masterAppreciationId'];
        $donor->fasting = $request['fasting'];
        $donor->certain_need = $request['certainNeed'];
        $donor->last_on = $request['lastOn'];
        $donor->total = $request['total'];
        $donor->previous_donate_history = $request['previousDonateHistory'];

        $donor->save();

        return redirect('/donor')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Donor  $donor
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = Donor::findOrFail($id);
        $delete->delete();

        return redirect('/donor')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/resources/views/admin/master_appreciation/show.blade.php
@extends('layouts.admin.app')

@section('content')

        Master Penghargaan

        Detail Data

           Kembali

        <form action="">

            Total Penghargaan
            <input class="form-control" value="{{ $masterAppreciation->total }}" readonly>

        </form>

@endsection
<file_sep>/app/Http/Controllers/MasterBloodBagController.php
<?php

namespace App\Http\Controllers;

use App\MasterBloodBag;
use Illuminate\Http\Request;

class MasterBloodBagController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterBloodBags = MasterBloodBag::all();

        return view('admin.master_blood_bag.index', compact('masterBloodBags'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_blood_bag.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required',
            'detail' => 'required'
        ]);

        MasterBloodBag::create($validatedData);

        return redirect('/master-blood-bag')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterBloodBag  $masterBloodBag
     * @return \Illuminate\Http\Response
     */
    public function show(MasterBloodBag $masterBloodBag)
    {
        return view('admin.master_blood_bag.show', compact('masterBloodBag'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterBloodBag  $masterBloodBag
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterBloodBag $masterBloodBag)
    {
        return view('admin.master_blood_bag.edit', compact('masterBloodBag'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterBloodBag  $masterBloodBag
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterBloodBag $masterBloodBag)
    {
        $validatedData = $request->validate([
            'name' => 'required',
            'detail' => 'required'
        ]);

        $masterBloodBag->update($validatedData);

        return redirect('/master-blood-bag')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterBloodBag  $masterBloodBag
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterBloodBag::findOrFail($id);
        $delete->delete();

        return redirect('/master-blood-bag')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/database/factories/MasterAppreciationFactory.php
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\MasterAppreciation;

$factory->define(MasterAppreciation::class, function () {
    return [
        'total' => rand(10, 100)
    ];
});
<file_sep>/app/Http/Controllers/MasterProfessionController.php
<?php

namespace App\Http\Controllers;

use App\MasterProfession;
use Illuminate\Http\Request;

class MasterProfessionController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterProfessions = MasterProfession::all();

        return view('admin.master_profession.index', compact('masterProfessions'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_profession.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        MasterProfession::create($validatedData);

        return redirect('/master-profession')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterProfession  $masterProfession
     * @return \Illuminate\Http\Response
     */
    public function show(MasterProfession $masterProfession)
    {
        return view('admin.master_profession.show', compact('masterProfession'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterProfession  $masterProfession
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterProfession $masterProfession)
    {
        return view('admin.master_profession.edit', compact('masterProfession'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterProfession  $masterProfession
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterProfession $masterProfession)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        $masterProfession->update($validatedData);

        return redirect('/master-profession')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterProfession  $masterProfession
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterProfession::findOrFail($id);
        $delete->delete();

        return redirect('/master-profession')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/app/Http/Controllers/AftapOfficerController.php
<?php

namespace App\Http\Controllers;

use App\Donatee;
use App\MasterReaction;
use Illuminate\Http\Request;

class AftapOfficerController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $donatees = Donatee::all();

        return view('admin.aftap_officer.index', compact('donatees'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $donatee = Donatee::findOrFail($id);
        $time = json_decode($donatee->time);

        return view('admin.aftap_officer.show', compact('donatee', 'time'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $donatee = Donatee::findOrFail($id);

        $time = json_decode($donatee->time);

        $masterReactions = MasterReaction::select('id', 'name')->get();

        $selectedMasterReaction = Donatee::select('master_reaction_id')
            ->where('master_reaction_id', '=', $donatee->master_reaction_id)->first();

        return view('admin.aftap_officer.edit', compact(
            'donatee',
            'time',
            'masterReactions',
            'selectedMasterReaction'
        ));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $donatee = Donatee::findOrFail($id);

        $request->validate([
            'aftapOfficerName' => 'required',
            'time' => 'array',
            'masterReactionId' => 'numeric',
            'stoppedAt' => 'string',
            'bagNumber' => 'numeric',
            'finished' => 'string',
        ]);

        $donatee->aftap_officer_name = $request['aftapOfficerName'];
        $donatee->time = $request['time'];
        $donatee->master_reaction_id = $request['masterReactionId'];
        $donatee->stopped_at = $request['stoppedAt'];
        $donatee->bag_number = $request['bagNumber'];
        $donatee->finished = $request['finished'];

        $donatee->save();

        return redirect('/aftap-officer')->with('success', 'Data berhasil diinput/diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
<file_sep>/app/Http/Controllers/MasterIdentityCardTypeController.php
<?php

namespace App\Http\Controllers;

use App\MasterIdentityCardType;
use Illuminate\Http\Request;

class MasterIdentityCardTypeController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterIdentityCardTypes = MasterIdentityCardType::all();

        return view('admin.master_identity_card_type.index', compact('masterIdentityCardTypes'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_identity_card_type.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        MasterIdentityCardType::create($validatedData);

        return redirect('/master-identity-card-type')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterIdentityCardType  $masterIdentityCardType
     * @return \Illuminate\Http\Response
     */
    public function show(MasterIdentityCardType $masterIdentityCardType)
    {
        return view('admin.master_identity_card_type.show', compact('masterIdentityCardType'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterIdentityCardType  $masterIdentityCardType
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterIdentityCardType $masterIdentityCardType)
    {
        return view('admin.master_identity_card_type.edit', compact('masterIdentityCardType'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterIdentityCardType  $masterIdentityCardType
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterIdentityCardType $masterIdentityCardType)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        $masterIdentityCardType->update($validatedData);

        return redirect('/master-identity-card-type')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterIdentityCardType  $masterIdentityCardType
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterIdentityCardType::findOrFail($id);
        $delete->delete();

        return redirect('/master-identity-card-type')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/routes/web.php
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', 'HomepageController@index');

Auth::routes(['register' => false]);

Route::group(['middleware' => ['superAdministrator']], function() {
    Route::resource('user', 'UserController');
});

Route::group(['middleware' => ['administrator']], function() {
    Route::resource('master-appreciation', 'MasterAppreciationController');
    Route::resource('master-identity-card-type', 'MasterIdentityCardTypeController');
    Route::resource('master-profession', 'MasterProfessionController');
    Route::resource('master-blood-taking-method', 'MasterBloodTakingMethodController');
    Route::resource('master-donor-type', 'MasterDonorTypeController');
    Route::resource('master-hb-falling-drop-method', 'MasterHbFallingDropMethodController');
    Route::resource('master-blood-bag', 'MasterBloodBagController');
    Route::resource('master-blood-volume', 'MasterBloodVolumeController');
    Route::resource('master-reaction', 'MasterReactionController');
});

Route::group(['middleware' => ['administrationOfficer']], function() {
    Route::resource('donor', 'DonorController');
    Route::resource('donatee-recapitulation', 'DonateeRecapitulationController');
});

Route::resource('aftap-officer', 'AftapOfficerController')->middleware('aftapOfficer');
Route::resource('dashboard', 'DashboardController')->middleware('auth');
Route::resource('doctor', 'DoctorController')->middleware('doctor');
Route::resource('hb-officer', 'HbOfficerController')->middleware('hbOfficer');

<file_sep>/resources/views/auth/login.blade.php
<!DOCTYPE html>

@include('layouts.admin.header')

                &copy 2020 - KeDai Computerworks

Aplikasi Donor Darah Unit Transfusi Darah PMI Kota Makassar

              <form class="kt-form" method="POST" action="{{ route('login') }}" novalidate="novalidate">
                @csrf

                  <input class="form-control @error('email') is-invalid @enderror" type="email" name="email" id="email" placeholder="Email"
                    autocomplete="off" required>

                    @error('email')

                      {{ $message }}

                    @enderror

                  <input class="form-control @error('password') is-invalid @enderror" type="<PASSWORD>" name="password" id="password" placeholder="<PASSWORD>"
                    autocomplete="off" required>

                  @error('password')

                    {{ $message }}

                  @enderror

                  <button type="submit" class="btn btn-primary btn-elevate kt-login__btn-primary btn-block">Sign
                    In</button>

              </form>

  @include('layouts.admin.script')

<file_sep>/resources/views/layouts/admin/footer.blade.php

      {{ date('Y') }} ©
      UTD PMI Kota Makassar

<file_sep>/app/Http/Controllers/MasterBloodTakingMethodController.php
<?php

namespace App\Http\Controllers;

use App\MasterBloodTakingMethod;
use Illuminate\Http\Request;

class MasterBloodTakingMethodController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterBloodTakingMethods = MasterBloodTakingMethod::all();

        return view('admin.master_blood_taking_method.index', compact('masterBloodTakingMethods'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_blood_taking_method.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        MasterBloodTakingMethod::create($validatedData);

        return redirect('/master-blood-taking-method')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterBloodTakingMethod  $masterBloodTakingMethod
     * @return \Illuminate\Http\Response
     */
    public function show(MasterBloodTakingMethod $masterBloodTakingMethod)
    {
        return view('admin.master_blood_taking_method.show', compact('masterBloodTakingMethod'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterBloodTakingMethod  $masterBloodTakingMethod
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterBloodTakingMethod $masterBloodTakingMethod)
    {
        return view('admin.master_blood_taking_method.edit', compact('masterBloodTakingMethod'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterBloodTakingMethod  $masterBloodTakingMethod
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterBloodTakingMethod $masterBloodTakingMethod)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        $masterBloodTakingMethod->update($validatedData);

        return redirect('/master-blood-taking-method')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterBloodTakingMethod  $masterBloodTakingMethod
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterBloodTakingMethod::findOrFail($id);
        $delete->delete();

        return redirect('/master-blood-taking-method')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/resources/views/admin/aftap_officer/show.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pengambilan Darah Donatur

        Detail Data

           Kembali

            Nama Lengkap
            <input class="form-control" value="{{ $donatee->donor->fullname }}" readonly>

            Jenis Kelamin
            <input class="form-control" value="{{ ($donatee->donor->gender == 'L' ? 'Laki-Laki' : 'Perempuan') }}"
              readonly>

            Jenis Donor
            <input class="form-control" value="{{ $donatee->masterDonorType->name }}" readonly>

            Metode Pengambilan Darah
            <input class="form-control" value="{{ $donatee->masterBloodTakingMethod->name }}" readonly>

            Golongan Darah
            <input class="form-control" value="{{ $donatee->blood_type }}" readonly>

            Rhesus
            <input class="form-control" value="{{ ($donatee->rhesus == 'N' ? 'Negatif' : 'Positif') }}" readonly>

            Tekanan Darah

              <input class="form-control" value="{{ $donatee->blood_pressure }}" readonly>

mmHG

            Denyut Nadi

              <input class="form-control" value="{{ $donatee->pulse }}" readonly>

BPM

            Berat Badan

              <input class="form-control" value="{{ $donatee->weight }}" readonly>

Kg

            Tinggi Badan

              <input class="form-control" value="{{ $donatee->height }}" readonly>

Cm

            <NAME>

              <input class="form-control" value="{{ $donatee->body_temperature }}" readonly>

℃ (Celcius)

            Keadaan Umum
            <input class="form-control" value="{{ $donatee->general_state }}" readonly>

            Status
            <input class="form-control" value="{{ ($donatee->blood_status == '0' ? 'Ditolak' : 'Diterima') }}" readonly>

            Riwayat Medis
            <textarea class="form-control" readonly>{{ $donatee->medical_history }}</textarea>

            Jenis Kantong
            <input class="form-control"
              value="{{ (isset($donatee->masterBloodBag->name) ? $donatee->masterBloodBag->name : '') }}" readonly>

            Volume darah yang diambil

              <input class="form-control"
                value="{{ (isset($donatee->masterBloodVolume->name) ? $donatee->masterBloodVolume->name : '') }}"
                readonly>

cc

            Waktu mulai pengambilan darah
            <input class="form-control timepicker" name="time[start]"
              value="{{ (isset($time->{'start'}) ? $time->{'start'} : '') }}" readonly>

            Waktu selesai pengambilan darah
            <input class="form-control timepicker" name="time[stop]"
              value="{{ (isset($time->{'stop'}) ? $time->{'stop'} : '') }}" readonly>

            Reaksi Donor
            <input id="masterReactionId" class="form-control" value="{{ (isset($donatee->masterReaction->name) ? $donatee->masterReaction->name : '') }}" readonly>

            Nomor Kantong
            <input class="form-control" value="{{ $donatee->bag_number }}" readonly>

            Berhenti Pada

              <input class="form-control" value="{{ $donatee->stopped_at }}">

gram/cc

            Status Proses Donor
            <input class="form-control" value="{{ ($donatee->finished == '0' ? 'Belum Selesai' : 'Selesai') }}" readonly>

@endsection

@section('page_script')

@endsection
<file_sep>/database/seeds/DatabaseSeeder.php
<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        $this->call(UserSeeder::class);
        $this->call(SettingSeeder::class);
        $this->call(MasterAppreciationSeeder::class);
        $this->call(MasterIdentityCardTypeSeeder::class);
        $this->call(MasterProfessionSeeder::class);
        $this->call(MasterDonorTypeSeeder::class);
        $this->call(MasterHbFallingDropMethodSeeder::class);
        $this->call(MasterBloodTakingMethodSeeder::class);
        $this->call(MasterBloodVolumeSeeder::class);
        $this->call(MasterBloodBagSeeder::class);
        $this->call(MasterReactionSeeder::class);
    }
}
<file_sep>/database/factories/SettingFactory.php
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\Setting;
use Faker\Generator as Faker;

$factory->define(Setting::class, function (Faker $faker) {
    return [
        'office_name' => $faker->company,
        'office_email' => $faker->companyEmail,
        'office_website' => $faker->url,
        'office_phone' => $faker->phoneNumber,
        'office_fax' => $faker->phoneNumber,
        'office_address' => $faker->address,
        'office_village' => $faker->city,
        'office_sub_district' => $faker->city,
        'office_city' => $faker->city,
        'office_province' => $faker->state,
        'donor_form_serial' => $faker->sha1,
        'donor_form_revision' => $faker->sha1,
        'donor_form_effective_date' => $faker->dateTime,
    ];
});
<file_sep>/resources/views/admin/hb_officer/show.blade.php
@extends('layouts.admin.app')

@section('content')

        Data HB Donatur

        Detail Data

           Kembali

            Nama Donor

              <input class="form-control" type="text" value="{{ $donatee->donor->fullname }}" readonly>

            Jenis Donor

              <input class="form-control" type="text" value="{{ $donatee->masterDonorType->name }}" readonly>

            Metode Pengambilan Darah
            <input class="form-control" type="text" value="{{ $donatee->masterBloodTakingMethod->name }}" readonly>

            HB Metode Falling Drop (CuSO4)
            <input class="form-control" type="text" value="{{ $donatee->masterHbFallingDropMethod->name }}" readonly>

            Mikrocuvet

              <input class="form-control" type="text" value="{{ $donatee->microcuvette }}" readonly>

gr/dl

            Golongan Darah
            <input class="form-control" type="text" value="{{ $donatee->blood_type }}" readonly>

              Rhesus
              <input class="form-control" type="text" value="{{ ($donatee->rhesus == 'P' ? 'Positif' : 'Negatif') }}" readonly>

@endsection
<file_sep>/resources/views/admin/hb_officer/edit.blade.php
@extends('layouts.admin.app')

@section('content')

        Data HB Donatur

        Ubah Data

           Kembali

        <form action="{{ route('hb-officer.update', $donatee->id) }}" method="POST">
          @csrf
          @method('PATCH')

              Nama Donor

                <select class="form-control select2" id="donorId" name="donorId">
                  @foreach ($donors as $donor)
                  <option value="{{ $donor->id }}" {{ ($donor->id == $selectedDonor->donor_id) ? 'selected' : '' }}>{{ $donor->fullname }}</option>
                  @endforeach
                </select>

              Jenis Donor

                <select class="form-control select2" id="masterDonorTypeId" name="masterDonorTypeId">
                  @foreach ($masterDonorTypes as $masterDonorType)
                  <option value="{{ $masterDonorType->id }}" {{ ($masterDonorType->id == $selectedMasterDonorType->master_donor_type_id) ? 'selected' : '' }}>{{ $masterDonorType->name }}</option>
                  @endforeach
                </select>

              Metode Pengambilan Darah

                <select class="form-control select2" id="masterBloodTakingMethod" name="masterBloodTakingMethod">
                  @foreach ($masterBloodTakingMethods as $masterBloodTakingMethod)
                  <option value="{{ $masterBloodTakingMethod->id }}" {{ ($masterBloodTakingMethod->id == $selectedMasterBloodTakingMethod->master_blood_taking_method_id) ? 'selected' : '' }}>{{ $masterBloodTakingMethod->name }}</option>
                  @endforeach
                </select>

              HB Metode Falling Drop (CuSO4)

                <select class="form-control select2" id="masterHbFallingDropMethod" name="masterHbFallingDropMethod">
                  @foreach ($masterHbFallingDropMethods as $masterHbFallingDropMethod)
                  <option value="{{ $masterHbFallingDropMethod->id }}" {{ ($masterHbFallingDropMethod->id == $selectedMasterHbFallingDropMethod->master_hb_falling_drop_method_id) ? 'selected' : '' }}>{{ $masterHbFallingDropMethod->name }}</option>
                  @endforeach
                </select>

              Mikrocuvet

                <input class="form-control" name="microcuvette" id="microcuvette" min="1" type="number"
                  placeholder="100" value="{{ $donatee->microcuvette }}" required>

gr/dl

              <NAME>

                <select class="form-control select2" id="bloodType" name="bloodType">
                  <option value="A" {{ ($donatee->blood_type == 'A' ? 'selected' : '') }}>A</option>
                  <option value="AB" {{ ($donatee->blood_type == 'AB' ? 'selected' : '') }}>AB</option>
                  <option value="B" {{ ($donatee->blood_type == 'B' ? 'selected' : '') }}>B</option>
                  <option value="O" {{ ($donatee->blood_type == 'O' ? 'selected' : '') }}>O</option>
                </select>

                Rhesus

                    <input type="radio" name="rhesus" value="N" {{ ($donatee->rhesus == 'N' ? 'checked' : '') }}> Negatif

                    <input type="radio" name="rhesus" value="P" {{ ($donatee->rhesus == 'P' ? 'checked' : '') }}> Positif

            <button type="submit" class="btn btn-success btn-wide">
              Ubah Data
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/resources/views/client/index.blade.php
<!DOCTYPE html>

  <link rel="manifest" href="manifest.json">

  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="application-name" content="UTDPmakassar">
  <meta name="apple-mobile-web-app-title" content="UTDPmakassar">
  <meta name="theme-color" content="#1e1e2d">
  <meta name="msapplication-navbutton-color" content="#1e1e2d">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  <meta name="msapplication-starturl" content="/">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link rel="icon" type="image/png" sizes="72x72" href="media/icon-72x72.png">
  <link rel="apple-touch-icon" type="image/png" sizes="72x72" href="media/icon-72x72.png">
  <link rel="icon" type="image/png" sizes="96x96" href="media/icon-96x96.png">
  <link rel="apple-touch-icon" type="image/png" sizes="96x96" href="media/icon-96x96.png">
  <link rel="icon" type="image/png" sizes="128x128" href="media/icon-128x128.png">
  <link rel="apple-touch-icon" type="image/png" sizes="128x128" href="media/icon-128x128.png">
  <link rel="icon" type="image/png" sizes="144x144" href="media/icon-144x144.png">
  <link rel="apple-touch-icon" type="image/png" sizes="144x144" href="media/icon-144x144.png">
  <link rel="icon" type="image/png" sizes="152x152" href="media/icon-152x152.png">
  <link rel="apple-touch-icon" type="image/png" sizes="152x152" href="media/icon-152x152.png">
  <link rel="icon" type="image/png" sizes="192x192" href="media/icon-192x192.png">
  <link rel="apple-touch-icon" type="image/png" sizes="192x192" href="media/icon-192x192.png">
  <link rel="icon" type="image/png" sizes="384x384" href="media/icon-384x384.png">
  <link rel="apple-touch-icon" type="image/png" sizes="384x384" href="media/icon-384x384.png">
  <link rel="icon" type="image/png" sizes="512x512" href="media/icon-512x512.png">
  <link rel="apple-touch-icon" type="image/png" sizes="512x512" href="media/icon-512x512.png">

  <title>Unit Transfusi Darah PMI Kota Makassar</title>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="shortcut icon" href="{{ asset('media/favicon.png') }}" type="image/x-icon">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link href="https://fonts.googleapis.com/css?family=Maven+Pro:400,500,700|Nunito:400,600,700" rel="stylesheet">

  <link id="theme-style" rel="stylesheet" href="{{ asset('css/theme.css') }}">
  <link rel="stylesheet" href="{{ asset('css/nova-theme.css') }}">

          @if (Auth::check())

              Menuju Dashboard

          @else

            Login

          @endif

Unit Transfusi Darah PMI
            Kota Makassar

            Jika Anda butuh kantong darah atau bertanya tentang donasi, silahkan hubungi kami.

                Whatsapp

                Messenger

Informasi Jumlah Darah Saat Ini

              Jenis Darah
              Golongan Darah A
              Golongan Darah AB
              Golongan Darah B
              Golongan Darah O

              S
              {{ $bloodBagSTypeA }}
              {{ $bloodBagSTypeAB }}
              {{ $bloodBagSTypeB }}
              {{ $bloodBagSTypeO }}

              D
              {{ $bloodBagDTypeA }}
              {{ $bloodBagDTypeAB }}
              {{ $bloodBagDTypeB }}
              {{ $bloodBagDTypeO }}

              T
              {{ $bloodBagTTypeA }}
              {{ $bloodBagTTypeAB }}
              {{ $bloodBagTTypeB }}
              {{ $bloodBagTTypeO }}

              P
              {{ $bloodBagPTypeA }}
              {{ $bloodBagPTypeAB }}
              {{ $bloodBagPTypeB }}
              {{ $bloodBagPTypeO }}

              A
              {{ $bloodBagATypeA }}
              {{ $bloodBagATypeAB }}
              {{ $bloodBagATypeB }}
              {{ $bloodBagATypeO }}

              Total
              {{ $BloodTypeATotal }}
              {{ $BloodTypeABTotal }}
              {{ $BloodTypeBTotal }}
              {{ $BloodTypeOTotal }}

Kontak Kami

            Unit Transfusi Darah PMI Kota Makassar

            Jl. Kandea No.8, Baraya

            Kec. Bontoala, Kota Makassar, Sulawesi Selatan 90211

            Telp: 04113621954

            <button class="btn btn-sm btn-dark" id="butInstall" type="button">
              Install PWA
            </button>

        Designed with
         by
        UTD PMI Kota Makassar

<file_sep>/resources/views/admin/donor/edit.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pribadi Donor

        Ubah Data

           Kembali

        <form action="{{ route('donor.update', $donor->id) }}" method="POST">
          @csrf
          @method('PATCH')

              Nomor Kartu Identitas
              <input class="form-control" id="identityCardNumber" name="identityCardNumber" type="text"
                placeholder="1234-5678-9012-4567" value="{{ $donor->identity_card_number }}" required autofocus>

              Jenis Kartu Identitas

                <select class="form-control select2" id="masterIdentityCardTypeId" name="masterIdentityCardTypeId">
                  @foreach ($masterIdentityCardTypes as $masterIdentityCardType)
                  <option value="{{ $masterIdentityCardType->id }}" {{ ($masterIdentityCardType->id == $selectedMasterIdentityCardType->master_identity_card_type_id) ? 'selected' : '' }}>
                    {{ $masterIdentityCardType->name }}
                  </option>
                  @endforeach
                </select>

              Nama Lengkap
              <input class="form-control" id="fullname" name="fullname" type="text" placeholder="<NAME>" value="{{ $donor->fullname }}" required>

              Alamat
              <textarea class="form-control" name="address" id="address" placeholder="Jl. Kandea No.8"
                required>{{ $donor->address }}</textarea>

              Kelurahan
              <input class="form-control" id="village" name="village" type="text" placeholder="Baraya" value="{{ $donor->village }}" required>

              Kecamatan
              <input class="form-control" id="subDistrict" name="subDistrict" type="text" placeholder="Bontoala" value="{{ $donor->sub_district }}"
                required>

              Kota
              <input class="form-control" id="city" name="city" type="text" placeholder="Makassar" value="{{ $donor->city }}" required>

                Jenis Kelamin

                    <input type="radio" name="gender" value="L" {{ ($donor->gender == 'L') ? 'checked' : '' }}> Laki-Laki

                    <input type="radio" name="gender" value="P" {{ ($donor->gender == 'P') ? 'checked' : '' }}> Perempuan

              Email
              <input class="form-control" id="email" name="email" type="email" placeholder="<EMAIL>" value="{{ $donor->email }}" required>

              Nomor Telepon
              <input class="form-control" id="phone" name="phone" type="tel" placeholder="081123456789" value="{{ $donor->phone }}" required>

              Pekerjaan

                <select class="form-control select2" id="masterProfessionId" name="masterProfessionId">
                  @foreach ($masterProfessions as $masterProfession)
                  <option value="{{ $masterProfession->id }}" {{ ($masterProfession->id == $selectedMasterProfession->master_profession_id) ? 'selected' : '' }}>{{ $masterProfession->name }}</option>
                  @endforeach
                </select>

              Tempat Lahir
              <input class="form-control" id="birthPlace" name="birthPlace" type="text" placeholder="Makassar" value="{{ $donor->birth_place }}" required>

              Tanggal Lahir
              <input class="form-control" id="dateOfBirth" name="dateOfBirth" type="date" value="{{ $donor->date_of_birth }}" required>

                Status Nikah

                    <input type="radio" name="maritalStatus" value="0" {{ ($donor->marital_status == '0') ? 'checked' : '' }}> Belum Nikah

                    <input type="radio" name="maritalStatus" value="1" {{ ($donor->marital_status == '1') ? 'checked' : '' }}> Nikah

              Suku Bangsa
              <input class="form-control" id="tribes" name="tribes" type="text" placeholder="Makassar" value="{{ $donor->tribes }}" required>

                Apakah Anda mendapat pengingat donor darah melalui SMS?

                    <input type="radio" name="reminder" value="1" {{ ($donor->reminder == '1') ? 'checked' : '' }}> Iya

                    <input type="radio" name="reminder" value="0" {{ ($donor->reminder == '0') ? 'checked' : '' }}> Tidak

              Penghargaan yang telah diterima

                <select class="form-control select2" id="masterAppreciationId" name="masterAppreciationId">
                  @foreach ($masterAppreciations as $masterAppreciation)
                  <option value="{{ $masterAppreciation->id }}" {{ ($masterAppreciation->id == $selectedMasterAppreciation->master_appreciation_id) ? 'selected' : '' }}>
                    {{ $masterAppreciation->total }}x
                  </option>
                  @endforeach
                </select>

                Bersediakah Saudara donor pada waktu bulan puasa?

                    <input type="radio" name="fasting" value="1" {{ ($donor->fasting == '1') ? 'checked' : '' }}> Iya

                    <input type="radio" name="fasting" value="0" {{ ($donor->fasting == '0') ? 'checked' : '' }}> Tidak

                Bersediakah Saudara donor saat dibutuhkan untuk keperluan tertentu (di luar donor
                  rutin)?

                    <input type="radio" name="certainNeed" value="1" {{ ($donor->certain_need == '1') ? 'checked' : '' }}> Iya

                    <input type="radio" name="certainNeed" value="0" {{ ($donor->certain_need == '0') ? 'checked' : '' }}> Tidak

              Donor terakhir tanggal
              <input class="form-control" id="lastOn" name="lastOn" type="date" value="{{ $donor->last_on }}" required>

              Sekarang donor yang ke
              <input class="form-control" id="total" name="total" type="number" min="1" value="{{ $donor->total }}" required>

              Riwayat donor sebelumnya
              <textarea class="form-control" name="previousDonateHistory" id="previousDonateHistory"
                required>{{ $donor->previous_donate_history }}</textarea>

            <button type="submit" class="btn btn-success btn-wide">
              Ubah Data
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/app/Http/Controllers/DoctorController.php
<?php

namespace App\Http\Controllers;

use App\Donatee;
use App\MasterBloodBag;
use App\MasterBloodVolume;
use Illuminate\Http\Request;

class DoctorController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $donatees = Donatee::where('finished', '=', '0')->get();

        return view('admin.doctor.index', compact('donatees'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $donatee = Donatee::findOrFail($id);

        return view('admin.doctor.show', compact('donatee'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $donatee = Donatee::findOrFail($id);
        $masterBloodBags = MasterBloodBag::select('id', 'name')->get();
        $masterBloodVolumes = MasterBloodVolume::select('id', 'name')->get();

        $selectedMasterBloodBag = Donatee::select('master_blood_bag_id')
            ->where('master_blood_bag_id', '=', $donatee->master_blood_bag_id)->first();

        $selectedMasterBloodVolume = Donatee::select('master_blood_volume_id')
            ->where('master_blood_volume_id', '=', $donatee->master_blood_volume_id)->first();

        return view('admin.doctor.edit', compact(
            'donatee',
            'masterBloodBags',
            'masterBloodVolumes',
            'selectedMasterBloodBag',
            'selectedMasterBloodVolume'
        ));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $donatee = Donatee::findOrFail($id);

        $request->validate([
            'doctorName' => 'required',
            'bloodPressure' => 'string',
            'pulse' => 'numeric',
            'weight' => 'numeric',
            'height' => 'numeric',
            'bodyTemperature' => 'numeric',
            'generalState' => 'string',
            'bloodStatus' => 'string',
            'medicalHistory' => 'string',
            'masterBloodBagId' => 'string',
            'masterBloodVolumeId' => 'string'
        ]);

        $donatee->doctor_name = $request['doctorName'];
        $donatee->blood_pressure = $request['bloodPressure'];
        $donatee->pulse = $request['pulse'];
        $donatee->weight = $request['weight'];
        $donatee->height = $request['height'];
        $donatee->body_temperature = $request['bodyTemperature'];
        $donatee->general_state = $request['generalState'];
        $donatee->blood_status = $request['bloodStatus'];
        $donatee->medical_history = $request['medicalHistory'];
        $donatee->master_blood_bag_id = $request['masterBloodBagId'];
        $donatee->master_blood_volume_id = $request['masterBloodVolumeId'];

        if ($request['bloodStatus'] == '0') {
            $donatee->finished = '1';
        } else {
            $donatee->finished = '0';
        }

        $donatee->save();

        return redirect('/doctor')->with('success', 'Data berhasil diinput/diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
<file_sep>/app/Donor.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Donor extends Model
{
    protected $fillable = [
        'identity_card_number',
        'master_identity_card_type_id',
        'fullname',
        'address',
        'village',
        'sub_district',
        'city',
        'gender',
        'email',
        'phone',
        'master_profession_id',
        'birth_place',
        'date_of_birth',
        'marital_status',
        'tribes',
        'reminder',
        'master_appreciation_id',
        'certain_need',
        'last_on',
        'total',
        'previous_donate_history'
    ];

    public function donatees()
    {
        return $this->hasMany('App\Donatee');
    }

    public function masterAppreciation()
    {
        return $this->belongsTo('App\MasterAppreciation');
    }

    public function masterIdentityCardType()
    {
        return $this->belongsTo('App\MasterIdentityCardType');
    }

    public function masterProfession()
    {
        return $this->belongsTo('App\MasterProfession');
    }
}
<file_sep>/resources/views/admin/donatee_recapitulation/index.blade.php
@extends('layouts.admin.app')

@section('page_style')
<link href="{{ asset('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css">
@endsection

@section('content')

        Data Donasi

            Tanggal Donasi
            Nama Donatur
            Diisi Oleh Petugas HB
            Diisi Oleh Dokter
            Diisi Oleh Petugas Aftap
            Status Donor
            Status Diambil
            Aksi

          @foreach ($donatees as $donatee)

            {{ date('d F Y',strtotime($donatee->created_at)) }}
            {{ $donatee->donor->fullname }}
            {{ $donatee->hb_officer_name }}
            {{ $donatee->doctor_name }}
            {{ $donatee->aftap_officer_name }}
            {{ ($donatee->finished == '0' ? 'Belum Selesai' : 'Selesai') }}
            {{ ($donatee->taken == '0' ? 'Disimpan' : 'Diambil') }}

              <form action="{{ route('donatee-recapitulation.destroy', $donatee->id)}}" method="POST">
                @csrf
                @method('DELETE')

                    id) }}">
                      Ubah

                    <button class="dropdown-item" type="submit" onclick="return confirm('Hapus data ini?')">
                      Hapus
                    </button>

                id) }}"
                  class="btn btn-sm btn-clean btn-icon btn-icon-md" title="Lihat Detail">

              </form>

          @endforeach

@endsection

@section('page_script')

@endsection
<file_sep>/resources/views/admin/doctor/edit.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pemeriksaan Donatur

        Input / Ubah Data

           Kembali

        <form action="{{ route('doctor.update', $donatee->id) }}" method="POST">
          @csrf
          @method('PATCH')

          <input type="hidden" name="doctorName" value="{{ Auth::user()->fullname }}" required>

              Tekanan Darah

                <input class="form-control" name="bloodPressure" id="bloodPressure" type="text" placeholder="80/120"
                  value="{{ $donatee->blood_pressure }}">

mmHG

              Denyut Nadi

                <input class="form-control" name="pulse" id="pulse" min="0" type="number" placeholder="75"
                  value="{{ $donatee->pulse }}">

BPM

              Berat Badan

                <input class="form-control" name="weight" id="weight" min="0" type="number" placeholder="65"
                  value="{{ $donatee->weight }}">

Kg

              Tinggi Badan

                <input class="form-control" name="height" id="height" min="0" type="number" placeholder="180"
                  value="{{ $donatee->height }}">

Cm

              <NAME>

                <input class="form-control" name="bodyTemperature" id="bodyTemperature" min="0" type="number"
                  placeholder="35" value="{{ $donatee->body_temperature }}">

℃ (Celcius)

              Keadaan Umum
              <input class="form-control" id="generalState" name="generalState" type="text" placeholder="Sehat"
                value="{{ $donatee->general_state }}">

                Status

                    <input type="radio" name="bloodStatus" value="0" {{ ($donatee->blood_status == '0' ? 'checked' : '') }}>
                    Ditolak

                    <input type="radio" name="bloodStatus" value="1" {{ ($donatee->blood_status == '1' ? 'checked' : '') }}>
                    Diambil

              Riwayat Medis
              <textarea class="form-control" name="medicalHistory"
                id="medicalHistory">{{ $donatee->medical_history }}</textarea>

              Jenis Kantong

                <select class="form-control select2" id="masterBloodBagId" name="masterBloodBagId">
                  @foreach ($masterBloodBags as $masterBloodBag)
                  <option value="{{ $masterBloodBag->id }}"
                    {{ ($masterBloodBag->id == $selectedMasterBloodBag->master_blood_bag_id) ? 'selected' : '' }}>
                    {{ $masterBloodBag->name }}</option>
                  @endforeach
                </select>

              Volume darah yang akan diambil

                <select class="form-control select2" id="masterBloodVolumeId" name="masterBloodVolumeId">
                  @foreach ($masterBloodVolumes as $masterBloodVolume)
                  <option value="{{ $masterBloodVolume->id }}"
                    {{ ($masterBloodVolume->id == $selectedMasterBloodVolume->master_blood_volume_id) ? 'selected' : '' }}>
                    {{ $masterBloodVolume->name }} cc</option>
                  @endforeach
                </select>

            <button type="submit" class="btn btn-success btn-wide">
              Input Data
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/app/Http/Controllers/DashboardController.php
<?php

namespace App\Http\Controllers;

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

class DashboardController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        # Hitung Jumlah Petugas
        $administrationOfficerCount = User::where('role', '=', 2)->count();
        $hbOfficerCount = User::where('role', '=', 3)->count();
        $doctorCount = User::where('role', '=', 4)->count();
        $aftapOfficerCount = User::where('role', '=', 3)->count();

        /**
         *
         * Grup Hitung Golangan Darah A
         *
         */

        # Hitung Jumlah Golongan Darah A Kantong S
        $bloodBagSTypeA = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'S'],
                ['donatees.blood_type', '=', 'A'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah A Kantong D
        $bloodBagDTypeA = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'D'],
                ['donatees.blood_type', '=', 'A'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah A Kantong T
        $bloodBagTTypeA = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'T'],
                ['donatees.blood_type', '=', 'A'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah A Kantong P
        $bloodBagPTypeA = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'P'],
                ['donatees.blood_type', '=', 'A'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah A Kantong A
        $bloodBagATypeA = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'A'],
                ['donatees.blood_type', '=', 'A'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Total Golongan Darah A Kantong SDTPA
        $BloodTypeATotal = ($bloodBagSTypeA + $bloodBagDTypeA + $bloodBagTTypeA + $bloodBagPTypeA + $bloodBagATypeA);

        /**
         *
         * Grup Hitung Golangan Darah AB
         *
         */

        # Hitung Jumlah Golongan Darah AB Kantong S
        $bloodBagSTypeAB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'S'],
                ['donatees.blood_type', '=', 'AB'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah AB Kantong D
        $bloodBagDTypeAB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'D'],
                ['donatees.blood_type', '=', 'AB'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah AB Kantong T
        $bloodBagTTypeAB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'T'],
                ['donatees.blood_type', '=', 'AB'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah AB Kantong P
        $bloodBagPTypeAB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'P'],
                ['donatees.blood_type', '=', 'AB'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah AB Kantong A
        $bloodBagATypeAB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'A'],
                ['donatees.blood_type', '=', 'AB'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Total Golongan Darah AB Kantong SDTPA
        $BloodTypeABTotal = ($bloodBagSTypeAB + $bloodBagDTypeAB + $bloodBagTTypeAB + $bloodBagPTypeAB + $bloodBagATypeAB);

        /**
         *
         * Grup Hitung Golangan Darah B
         *
         */

        # Hitung Jumlah Golongan Darah B Kantong S
        $bloodBagSTypeB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'S'],
                ['donatees.blood_type', '=', 'B'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah B Kantong D
        $bloodBagDTypeB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'D'],
                ['donatees.blood_type', '=', 'B'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah B Kantong T
        $bloodBagTTypeB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'T'],
                ['donatees.blood_type', '=', 'B'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah B Kantong P
        $bloodBagPTypeB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'P'],
                ['donatees.blood_type', '=', 'B'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah B Kantong A
        $bloodBagATypeB = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'A'],
                ['donatees.blood_type', '=', 'B'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Total Golongan Darah B Kantong SDTPA
        $BloodTypeBTotal = ($bloodBagSTypeB + $bloodBagDTypeB + $bloodBagTTypeB + $bloodBagPTypeB + $bloodBagATypeB);

        /**
         *
         * Grup Hitung Golangan Darah O
         *
         */

        # Hitung Jumlah Golongan Darah O Kantong S
        $bloodBagSTypeO = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'S'],
                ['donatees.blood_type', '=', 'O'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah O Kantong D
        $bloodBagDTypeO = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'D'],
                ['donatees.blood_type', '=', 'O'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah O Kantong T
        $bloodBagTTypeO = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'T'],
                ['donatees.blood_type', '=', 'O'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah O Kantong P
        $bloodBagPTypeO = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'P'],
                ['donatees.blood_type', '=', 'O'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Jumlah Golongan Darah O Kantong A
        $bloodBagATypeO = Donatee::join('master_blood_bags', 'master_blood_bags.id', '=', 'donatees.master_blood_bag_id')
            ->where([
                ['master_blood_bags.name', '=', 'A'],
                ['donatees.blood_type', '=', 'O'],
                ['donatees.blood_status', '=', '1'],
                ['donatees.finished', '=', '1'],
                ['donatees.taken', '=', '0']
            ])->count();

        # Hitung Total Golongan Darah B Kantong SDTPA
        $BloodTypeOTotal = ($bloodBagSTypeO + $bloodBagDTypeO + $bloodBagTTypeO + $bloodBagPTypeO + $bloodBagATypeO);

        return view('admin.dashboard.index', compact(
            'administrationOfficerCount',
            'hbOfficerCount',
            'doctorCount',
            'aftapOfficerCount',

            'bloodBagSTypeA',
            'bloodBagDTypeA',
            'bloodBagTTypeA',
            'bloodBagPTypeA',
            'bloodBagATypeA',
            'BloodTypeATotal',

            'bloodBagSTypeAB',
            'bloodBagDTypeAB',
            'bloodBagTTypeAB',
            'bloodBagPTypeAB',
            'bloodBagATypeAB',
            'BloodTypeABTotal',

            'bloodBagSTypeB',
            'bloodBagDTypeB',
            'bloodBagTTypeB',
            'bloodBagPTypeB',
            'bloodBagATypeB',
            'BloodTypeBTotal',

            'bloodBagSTypeO',
            'bloodBagDTypeO',
            'bloodBagTTypeO',
            'bloodBagPTypeO',
            'bloodBagATypeO',
            'BloodTypeOTotal'
        ));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
<file_sep>/resources/views/admin/donor/create.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pribadi Donor

        Tambah Data

           Kembali

        <form action="{{ route('donor.store') }}" method="POST">
          @csrf

              Nomor Kartu Identitas
              <input class="form-control" id="identityCardNumber" name="identityCardNumber" type="text"
                placeholder="1234-5678-9012-4567" required autofocus>

              Jenis Kartu Identitas

                <select class="form-control select2" id="masterIdentityCardTypeId" name="masterIdentityCardTypeId">
                  @foreach ($masterIdentityCardTypes as $masterIdentityCardType)
                  <option value="{{ $masterIdentityCardType->id }}">
                    {{ $masterIdentityCardType->name }}
                  </option>
                  @endforeach
                </select>

              Nama Lengkap
              <input class="form-control" id="fullname" name="fullname" type="text" placeholder="<NAME>" required>

              Alamat
              <textarea class="form-control" name="address" id="address" placeholder="Jl. Kandea No.8"
                required></textarea>

              Kelurahan
              <input class="form-control" id="village" name="village" type="text" placeholder="Baraya" required>

              Kecamatan
              <input class="form-control" id="subDistrict" name="subDistrict" type="text" placeholder="Bontoala"
                required>

              Kota
              <input class="form-control" id="city" name="city" type="text" placeholder="Makassar" required>

                Jenis Kelamin

                    <input type="radio" name="gender" value="L" checked> Laki-Laki

                    <input type="radio" name="gender" value="P"> Perempuan

              Email
              <input class="form-control" id="email" name="email" type="email" placeholder="<EMAIL>" required>

              Nomor Telepon
              <input class="form-control" id="phone" name="phone" type="tel" placeholder="081123456789" required>

              Pekerjaan

                <select class="form-control select2" id="masterProfessionId" name="masterProfessionId">
                  @foreach ($masterProfessions as $masterProfession)
                  <option value="{{ $masterProfession->id }}">{{ $masterProfession->name }}</option>
                  @endforeach
                </select>

              Tempat Lahir
              <input class="form-control" id="birthPlace" name="birthPlace" type="text" placeholder="Makassar"
                required>

              Tanggal Lahir
              <input class="form-control" id="dateOfBirth" name="dateOfBirth" type="date" required>

                Status Nikah

                    <input type="radio" name="maritalStatus" value="0" checked> Belum Nikah

                    <input type="radio" name="maritalStatus" value="1"> Nikah

              <NAME>
              <input class="form-control" id="tribes" name="tribes" type="text" placeholder="Makassar"
                required>

                Apakah Anda mendapat pengingat donor darah melalui SMS?

                    <input type="radio" name="reminder" value="1" checked> Iya

                    <input type="radio" name="reminder" value="0"> Tidak

              Penghargaan yang telah diterima

                <select class="form-control select2" id="masterAppreciationId" name="masterAppreciationId">
                  @foreach ($masterAppreciations as $masterAppreciation)
                  <option value="{{ $masterAppreciation->id }}">
                    {{ $masterAppreciation->total }}x
                  </option>
                  @endforeach
                </select>

                Bersediakah Saudara donor pada waktu bulan puasa?

                    <input type="radio" name="fasting" value="1" checked> Iya

                    <input type="radio" name="fasting" value="0"> Tidak

                Bersediakah Saudara donor saat dibutuhkan untuk keperluan tertentu (di luar donor
                  rutin)?

                    <input type="radio" name="certainNeed" value="1" checked> Iya

                    <input type="radio" name="certainNeed" value="0"> Tidak

              Donor terakhir tanggal
              <input class="form-control" id="lastOn" name="lastOn" type="date" required>

              Sekarang donor yang ke
              <input class="form-control" id="total" name="total" type="number" min="1" value="1" required>

              Riwayat donor sebelumnya
              <textarea class="form-control" name="previousDonateHistory" id="previousDonateHistory" required></textarea>

            <button type="submit" class="btn btn-success btn-wide">
              Input Data
            </button>
            <button type="reset" class="btn btn-outline-danger btn-wide">
              Atur Ulang
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/resources/views/admin/doctor/index.blade.php
@extends('layouts.admin.app')

@section('page_style')
<link href="{{ asset('plugins/custom/datatables/datatables.bundle.css') }}" rel="stylesheet" type="text/css">
@endsection

@section('content')

        Data Pemeriksaan Donatur

      {{--

       Tambah Data

 --}}

          Nama Lengkap
          Jenis Kelamin
          Jenis Donor
          Metode
Pengambilan Darah
          Golongan Darah
          Rhesus
          Aksi

        @foreach ($donatees as $donatee)

          {{ $donatee->donor->fullname }}
          {{ ($donatee->donor->gender == 'L' ? 'Laki-Laki' : 'Perempuan') }}
          {{ $donatee->masterDonorType->name }}
          {{ $donatee->masterBloodTakingMethod->name }}
          {{ $donatee->blood_type }}
          {{ ($donatee->rhesus == 'N' ? 'Negatif' : 'Positif') }}

            id) }}" class="btn btn-sm btn-clean btn-icon btn-icon-md"
              title="Input/Ubah">

            id) }}" class="btn btn-sm btn-clean btn-icon btn-icon-md"
              title="Lihat Detail">

        @endforeach

@endsection

@section('page_script')

@endsection
<file_sep>/resources/views/admin/dashboard/index.blade.php
@extends('layouts.admin.app')

@section('content')

Petugas Administrasi

{{ $administrationOfficerCount }} Orang

Petugas HB

{{ $hbOfficerCount }} Orang

Petugas AFTAP

{{ $aftapOfficerCount }} Orang

Dokter

{{ $doctorCount }} Orang

            Total Kantong Darah

                Jenis Darah
                Golongan Darah A
                Golongan Darah AB
                Golongan Darah B
                Golongan Darah O

                S
                {{ $bloodBagSTypeA }}
                {{ $bloodBagSTypeAB }}
                {{ $bloodBagSTypeB }}
                {{ $bloodBagSTypeO }}

                D
                {{ $bloodBagDTypeA }}
                {{ $bloodBagDTypeAB }}
                {{ $bloodBagDTypeB }}
                {{ $bloodBagDTypeO }}

                T
                {{ $bloodBagTTypeA }}
                {{ $bloodBagTTypeAB }}
                {{ $bloodBagTTypeB }}
                {{ $bloodBagTTypeO }}

                P
                {{ $bloodBagPTypeA }}
                {{ $bloodBagPTypeAB }}
                {{ $bloodBagPTypeB }}
                {{ $bloodBagPTypeO }}

                A
                {{ $bloodBagATypeA }}
                {{ $bloodBagATypeAB }}
                {{ $bloodBagATypeB }}
                {{ $bloodBagATypeO }}

              Total
              {{ $BloodTypeATotal }}
              {{ $BloodTypeABTotal }}
              {{ $BloodTypeBTotal }}
              {{ $BloodTypeOTotal }}

@endsection
<file_sep>/database/seeds/MasterDonorTypeSeeder.php
<?php

use App\MasterDonorType;
use Illuminate\Database\Seeder;

class MasterDonorTypeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $count = 2;
        factory(MasterDonorType::class, $count)->create();
    }
}
<file_sep>/resources/views/admin/donor/show.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Pribadi Donor

        Detail Data

           Kembali

            Nomor Kartu Identitas
            <input class="form-control" value="{{ $donor->identity_card_number }}" readonly>

            Jenis Kartu Indentitas
            <input class="form-control" value="{{ $donor->masterIdentityCardType->name }}" readonly>

            Nama Lengkap
            <input class="form-control" value="{{ $donor->fullname }}" readonly>

            Alamat
            <textarea class="form-control" readonly>{{ $donor->address }}</textarea>

            Kelurahan
            <input class="form-control" value="{{ $donor->village }}" readonly>

            Kecamatan
            <input class="form-control" value="{{ $donor->sub_district }}" readonly>

            Kota
            <input class="form-control" value="{{ $donor->city }}" readonly>

            Jenis Kelamin
            <input class="form-control" value="{{ ($donor->gender == 'L') ? 'Laki-Laki' : 'Perempuan' }}" readonly>

            Email
            <input class="form-control" value="{{ $donor->email }}" readonly>

            Nomor Telepon
            <input class="form-control" value="{{ $donor->phone }}" readonly>

            Pekerjaan
            <input class="form-control" value="{{ $donor->masterProfession->name }}" readonly>

            Tempat Lahir
            <input class="form-control" value="{{ $donor->birth_place }}" readonly>

            Tanggal Lahir
            <input class="form-control" value="{{ date('d F Y',strtotime($donor->date_of_birth)) }}" readonly>

            Status Nikah
            <input class="form-control" value="{{ ($donor->marital_status == '0') ? 'Belum Nikah' : 'Nikah' }}" readonly>

            Suku Bangsa
            <input class="form-control" value="{{ $donor->tribes }}" readonly>

              Apakah Anda mendapat pengingat donor darah melalui SMS?
              <input class="form-control" value="{{ ($donor->reminder == '0') ? 'Tidak' : 'Iya' }}" readonly>

            Penghargaan yang telah diterima
            <input class="form-control" value="{{ $donor->masterAppreciation->total }}x" readonly>

              Bersediakah Saudara donor pada waktu bulan puasa?
              <input class="form-control" value="{{ ($donor->fasting == '0') ? 'Tidak' : 'Iya' }}" readonly>

              Bersediakah Saudara donor saat dibutuhkan untuk keperluan tertentu (di luar donor
                rutin)?
              <input class="form-control" value="{{ ($donor->certain_need == '0') ? 'Tidak' : 'Iya' }}" readonly>

            Donor terakhir tanggal
            <input class="form-control" value="{{ date('d F Y',strtotime($donor->last_on)) }}" readonly>

            Sekarang donor yang ke
            <input class="form-control" value="{{ $donor->total }}" readonly>

            Riwayat donor sebelumnya
            <textarea class="form-control" readonly>{{ $donor->previous_donate_history }}</textarea>

@endsection
<file_sep>/app/Http/Controllers/HbOfficerController.php
<?php

namespace App\Http\Controllers;

use App\Donatee;
use App\Donor;
use App\MasterBloodTakingMethod;
use App\MasterDonorType;
use App\MasterHbFallingDropMethod;
use Illuminate\Http\Request;

class HbOfficerController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $donatees = Donatee::where('finished', '=', '0')->get();

        return view('admin.hb_officer.index', compact('donatees'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $donors = Donor::select('id', 'fullname')->get();
        $masterDonorTypes = MasterDonorType::select('id', 'name')->get();
        $masterBloodTakingMethods = MasterBloodTakingMethod::select('id', 'name')->get();
        $masterHbFallingDropMethods = MasterHbFallingDropMethod::select('id', 'name')->get();

        return view('admin.hb_officer.create', compact(
            'donors',
            'masterDonorTypes',
            'masterBloodTakingMethods',
            'masterHbFallingDropMethods'
        ));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $request->validate([
            'donorId' => 'required',
            'hbOfficerName' => 'required',
            'masterDonorTypeId' => 'required',
            'masterBloodTakingMethod' => 'required',
            'masterHbFallingDropMethod' => 'required',
            'microcuvette' => 'required',
            'bloodType' => 'required',
            'rhesus' => 'required'
        ]);

        Donatee::create([
            'donor_id' => $request['donorId'],
            'hb_officer_name' => $request['hbOfficerName'],
            'master_donor_type_id' => $request['masterDonorTypeId'],
            'master_blood_taking_method_id' => $request['masterBloodTakingMethod'],
            'master_hb_falling_drop_method_id' => $request['masterHbFallingDropMethod'],
            'microcuvette' => $request['microcuvette'],
            'blood_type' => $request['bloodType'],
            'rhesus' => $request['rhesus']
        ]);

        return redirect('/hb-officer')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $donatee = Donatee::findOrFail($id);

        return view('admin.hb_officer.show', compact('donatee'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $donatee = Donatee::findOrFail($id);
        $donors = Donor::select('id', 'fullname')->get();
        $masterDonorTypes = MasterDonorType::select('id', 'name')->get();
        $masterBloodTakingMethods = MasterBloodTakingMethod::select('id', 'name')->get();
        $masterHbFallingDropMethods = MasterHbFallingDropMethod::select('id', 'name')->get();

        $selectedDonor = Donatee::select('donor_id')
            ->where('donor_id', '=', $donatee->donor_id)->first();

        $selectedMasterDonorType = Donatee::select('master_donor_type_id')
            ->where('master_donor_type_id', '=', $donatee->master_donor_type_id)->first();

        $selectedMasterBloodTakingMethod = Donatee::select('master_blood_taking_method_id')
            ->where('master_blood_taking_method_id', '=', $donatee->master_blood_taking_method_id)->first();

        $selectedMasterHbFallingDropMethod = Donatee::select('master_hb_falling_drop_method_id')
            ->where('master_hb_falling_drop_method_id', '=', $donatee->master_hb_falling_drop_method_id)->first();

        return view('admin.hb_officer.edit', compact(
            'donatee',
            'donors',
            'masterDonorTypes',
            'masterBloodTakingMethods',
            'masterHbFallingDropMethods',
            'selectedDonor',
            'selectedMasterDonorType',
            'selectedMasterBloodTakingMethod',
            'selectedMasterHbFallingDropMethod'
        ));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {

        $donatee = Donatee::findOrFail($id);

        $request->validate([
            'donorId' => 'required',
            'masterDonorTypeId' => 'required',
            'masterBloodTakingMethod' => 'required',
            'masterHbFallingDropMethod' => 'required',
            'microcuvette' => 'required',
            'bloodType' => 'required',
            'rhesus' => 'required'
        ]);

        $donatee->donor_id = $request['donorId'];
        $donatee->master_donor_type_id = $request['masterDonorTypeId'];
        $donatee->master_blood_taking_method_id = $request['masterBloodTakingMethod'];
        $donatee->master_hb_falling_drop_method_id = $request['masterHbFallingDropMethod'];
        $donatee->microcuvette = $request['microcuvette'];
        $donatee->blood_type = $request['bloodType'];
        $donatee->rhesus = $request['rhesus'];

        $donatee->save();

        return redirect('/hb-officer')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = Donatee::findOrFail($id);
        $delete->delete();

        return redirect('/hb-officer')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/resources/views/admin/donatee_recapitulation/edit.blade.php
@extends('layouts.admin.app')

@section('content')

        Data Donasi

        Ubah Data

           Kembali

        <form action="{{ route('donatee-recapitulation.update', $donatee->id) }}" method="POST">
          @csrf
          @method('PATCH')

            Status Diambil
            <select class="form-control select2" id="taken" name="taken">
              <option value="0" {{ ($donatee->taken == $selectedTaken->taken) ? 'selected' : '' }}>Disimpan</option>
              <option value="1" {{ ($donatee->taken == $selectedTaken->taken) ? 'selected' : '' }}>Diambil</option>
            </select>

            <button type="submit" class="btn btn-success btn-wide">
              Ubah Data
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/app/Http/Controllers/MasterBloodVolumeController.php
<?php

namespace App\Http\Controllers;

use App\MasterBloodVolume;
use Illuminate\Http\Request;

class MasterBloodVolumeController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterBloodVolumes = MasterBloodVolume::all();

        return view('admin.master_blood_volume.index', compact('masterBloodVolumes'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_blood_volume.create', compact('masterDonorType'));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        MasterBloodVolume::create($validatedData);

        return redirect('/master-blood-volume')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterBloodVolume  $masterBloodVolume
     * @return \Illuminate\Http\Response
     */
    public function show(MasterBloodVolume $masterBloodVolume)
    {
        return view('admin.master_blood_volume.show', compact('masterBloodVolume'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterBloodVolume  $masterBloodVolume
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterBloodVolume $masterBloodVolume)
    {
        return view('admin.master_blood_volume.edit', compact('masterBloodVolume'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterBloodVolume  $masterBloodVolume
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterBloodVolume $masterBloodVolume)
    {
        $validatedData = $request->validate([
            'name' => 'required'
        ]);

        $masterBloodVolume->update($validatedData);

        return redirect('/master-blood-volume')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterBloodVolume  $masterBloodVolume
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterBloodVolume::findOrFail($id);
        $delete->delete();

        return redirect('/master-blood-volume')->with('success', 'Data berhasil dihapus.');
    }
}
<file_sep>/resources/views/admin/user/show.blade.php
@extends('layouts.admin.app')

@section('content')

        Manajemen User

        Detail Data

           Kembali

            Username
            <input class="form-control" value="{{ $user->name }}" readonly>

            Nama Lengkap
            <input class="form-control" value="{{ $user->fullname }}" readonly>

            Email
            <input class="form-control" value="{{ $user->email }}" readonly>

            Peran
            @if ($user->role == 0)
            <input class="form-control" value="Super Admin" readonly>
            @elseif ($user->role == 1)
            <input class="form-control" value="Admin" readonly>
            @elseif ($user->role == 2)
            <input class="form-control" value="Petugas Administrasi" readonly>
            @elseif ($user->role == 3)
            <input class="form-control" value="Petugas HB" readonly>
            @elseif ($user->role == 4)
            <input class="form-control" value="Dokter" readonly>
            @else
            <input class="form-control" value="Petugas Aftap" readonly>
            @endif

@endsection
<file_sep>/resources/views/layouts/admin/sidebar.blade.php
@php
$userRole = Auth::user()->role;

// Get Role
$administratorRole = ($userRole == 0 || $userRole == 1);
$administrationOfficerRole = ($userRole == 0 || $userRole == 1 || $userRole == 2);
$hbOfficerRole = ($userRole == 0 || $userRole == 1 || $userRole == 3);
$doctorRole = ($userRole == 0 || $userRole == 1 || $userRole == 4);
$aftapOfficerRole = ($userRole == 0 || $userRole == 1 || $userRole == 5);

// Get current request route
$dashboard = request()->is('dashboard');
$donor = request()->is('donor*');
$donateRecapitulation = request()->is('donatee-recapitulation*');
$masterAppreciation = request()->is('master-appreciation*');
$masterIdentityCardType = request()->is('master-identity-card-type*');
$masterProfession = request()->is('master-profession*');

$hbOfficer = request()->is('hb-officer*');
$masterBloodTakingMethod = request()->is('master-blood-taking-method*');
$masterDonorType = request()->is('master-donor-type*');
$masterHbFallingDropMethod = request()->is('master-hb-falling-drop-method*');

$doctor = request()->is('doctor*');
$masterBloodBag = request()->is('master-blood-bag*');
$masterBloodVolume = request()->is('master-blood-volume*');

$aftapOfficer = request()->is('aftap-officer*');
$masterReaction = request()->is('master-reaction*');

// Get group request
$administrationGroup = (
  $donor ||
  $donateRecapitulation ||
  $masterAppreciation ||
  $masterIdentityCardType ||
  $masterProfession
);

$hbOfficerGroup = (
  $hbOfficer ||
  $masterBloodTakingMethod ||
  $masterDonorType ||
  $masterHbFallingDropMethod
);

$doctorGroup = (
  $doctor ||
  $masterBloodBag ||
  $masterBloodVolume
);

$aftapOfficerGroup = (
  $aftapOfficer ||
  $masterReaction
);
@endphp

<button class="kt-aside-close " id="kt_aside_close_btn">

</button>

            Dashboard

Menu

        @if ($administrationOfficerRole)

            Petugas Administrasi

                  Data Pribadi Donatur

                  Data Donasi

          @if ($administratorRole)

                  Master Penghargaan

                  Master Jenis Kartu

                  Master Pekerjaan

          @endif

        @endif

        @if ($hbOfficerRole)

            Petugas HB

                  Data HB Donatur

          @if ($administratorRole)

                  Master Metode Pengambilan Darah

                  Master Jenis Donor

                  Master Metode HB Falling Drop

          @endif

        @endif

        @if ($doctorRole)

            Dokter

                  Data Pemeriksaan Donatur

          @if ($administratorRole)

                  Master Jenis Kantong Darah

                  Master Volume Donor Darah

          @endif

        @endif

        @if ($aftapOfficerRole)

            Petugas AFTAP

                  Data Pengambilan Darah Donatur

          @if ($administratorRole)

                  Master Reaksi Donor

          @endif

        @endif

        @if ($userRole == 0)

Menu Administrator

is('user*') ? 'kt-menu__item--open' : '') }}" aria-haspopup="true" data-ktmenu-submenu-toggle="hover">

            Pengaturan

is('user*') ? 'kt-menu__item--active' : '') }}" aria-haspopup="true">

                  Manajemen User

        @endif

<file_sep>/README.md

## Skripsinya hanafi
<file_sep>/database/migrations/2020_02_12_184602_create_donors_table.php
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDonorsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('donors', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('identity_card_number');
            $table->unsignedBigInteger('master_identity_card_type_id')->nullable();
            $table->string('fullname');
            $table->text('address');
            $table->string('village');
            $table->string('sub_district');
            $table->string('city');
            $table->enum('gender', ['L', 'P'])->comment('
                L:Laki-Laki,
                P:Perempuan
            ');
            $table->string('email')->unique();
            $table->string('phone');
            $table->unsignedBigInteger('master_profession_id')->nullable();
            $table->string('birth_place');
            $table->date('date_of_birth');
            $table->enum('marital_status', ['0', '1'])->comment('
                0:Single,
                1:Married
            ');
            $table->string('tribes');
            $table->enum('reminder', ['0', '1'])->comment('
                Get a reminder? :
                0:No,
                1:Yes
            ');
            $table->unsignedBigInteger('master_appreciation_id')->nullable();
            $table->enum('fasting', ['0', '1'])->comment('
                Willing to donor when the fasting month? :
                0:No,
                1:Yes
            ');
            $table->enum('certain_need', ['0', '1'])->comment('
                Willing to donors when needed ? :
                0:No,
                1:Yes
            ');
            $table->date('last_on');
            $table->unsignedInteger('total');
            $table->text('previous_donate_history');
            $table->timestamps();

            $table->foreign('master_identity_card_type_id')->references('id')->on('master_identity_card_types')->onDelete('SET NULL');
            $table->foreign('master_profession_id')->references('id')->on('master_professions')->onDelete('SET NULL');
            $table->foreign('master_appreciation_id')->references('id')->on('master_appreciations')->onDelete('SET NULL');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('donors');
    }
}
<file_sep>/resources/views/layouts/admin/header.blade.php

  <meta charset="utf-8">
  <title>Don<NAME> UTD PMI Kota Makassar</title>
  <meta name="description" content="Donor Darah UTD PMI Kota Makassar">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">

  <link href="{{ asset('css/pages/login/login-1.css') }}" rel="stylesheet" type="text/css">

  <link href="{{ asset('plugins/global/plugins.bundle.css') }}" rel="stylesheet" type="text/css">
  <link href="{{ asset('css/style.bundle.css') }}" rel="stylesheet" type="text/css">

  <link href="{{ asset('css/skins/header/base/light.css') }}" rel="stylesheet" type="text/css">
  <link href="{{ asset('css/skins/header/menu/light.css') }}" rel="stylesheet" type="text/css">
  <link href="{{ asset('css/skins/brand/dark.css') }}" rel="stylesheet" type="text/css">
  <link href="{{ asset('css/skins/aside/dark.css') }}" rel="stylesheet" type="text/css">

  @yield('page_style')

  <link rel="shortcut icon" href="{{ asset('media/favicon.png') }}">

<file_sep>/resources/views/admin/user/edit.blade.php
@extends('layouts.admin.app')

@section('content')

        Manajemen User

        Ubah Data

           Kembali

        <form action="{{ route('user.update', $user->id) }}" method="POST">
          @csrf
          @method('PATCH')

              Username
              <input class="form-control" id="name" name="name" type="text" placeholder="John" value="{{ $user->name }}"
                required autofocus>

              Nama Lengkap
              <input class="form-control" id="fullname" name="fullname" type="text" placeholder="<NAME>"
                value="{{ $user->fullname }}" required>

              Email
              <input class="form-control" id="email" name="email" type="email" placeholder="<EMAIL>"
                value="{{ $user->email }}" required autofocus>

              Peran

                <select class="form-control select2" id="role" name="role">
                  <option value="1" {{ ($user->role == 1) ? 'selected' : '' }}>
                    Administrator
                  </option>
                  <option value="2" {{ ($user->role == 2) ? 'selected' : '' }}>
                    Petugas Administrasi
                  </option>
                  <option value="3" {{ ($user->role == 3) ? 'selected' : '' }}>
                    Petugas HB
                  </option>
                  <option value="4" {{ ($user->role == 4) ? 'selected' : '' }}>
                    Dokter
                  </option>
                  <option value="5" {{ ($user->role == 5) ? 'selected' : '' }}>
                    Petugas AFTAP
                  </option>
                </select>

              Password
              <input class="form-control" id="password" name="password" type="<PASSWORD>">

              Konfirmasi Password
              <input class="form-control" id="password-confirm" name="password_confirmation" type="password">

            <button type="submit" class="btn btn-success btn-wide">
              Ubah Data
            </button>

        </form>

@endsection

@section('page_script')

@endsection
<file_sep>/app/Http/Controllers/MasterAppreciationController.php
<?php

namespace App\Http\Controllers;

use App\MasterAppreciation;
use Illuminate\Http\Request;

class MasterAppreciationController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $masterAppreciations = MasterAppreciation::all();

        return view('admin.master_appreciation.index', compact('masterAppreciations'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.master_appreciation.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $validatedData = $request->validate([
            'total' => 'required'
        ]);

        MasterAppreciation::create($validatedData);

        return redirect('/master-appreciation')->with('success', 'Data berhasil ditambah.');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\MasterAppreciation  $masterAppreciation
     * @return \Illuminate\Http\Response
     */
    public function show(MasterAppreciation $masterAppreciation)
    {
        return view('admin.master_appreciation.show', compact('masterAppreciation'));
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\MasterAppreciation  $masterAppreciation
     * @return \Illuminate\Http\Response
     */
    public function edit(MasterAppreciation $masterAppreciation)
    {
        return view('admin.master_appreciation.edit', compact('masterAppreciation'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\MasterAppreciation  $masterAppreciation
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, MasterAppreciation $masterAppreciation)
    {
        $validatedData = $request->validate([
            'total' => 'required'
        ]);

        $masterAppreciation->update($validatedData);

        return redirect('/master-appreciation')->with('success', 'Data berhasil diubah.');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\MasterAppreciation  $masterAppreciation
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $delete = MasterAppreciation::findOrFail($id);
        $delete->delete();

        return redirect('/master-appreciation')->with('success', 'Data berhasil dihapus.');
    }
}

languages: Markdown Blade PHP

repo_name: muzhawir/utdp-pmi-makassar