Skip to content

Instantly share code, notes, and snippets.

@Chibuokem
Last active May 20, 2020 05:37
Show Gist options
  • Select an option

  • Save Chibuokem/b2cbad7e0ef7e892bff0a95aaa00d64d to your computer and use it in GitHub Desktop.

Select an option

Save Chibuokem/b2cbad7e0ef7e892bff0a95aaa00d64d to your computer and use it in GitHub Desktop.

Revisions

  1. Chibuokem created this gist May 20, 2020.
    60 changes: 60 additions & 0 deletions review.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,60 @@
    //this part is what happened inside the model where the values where defined
    public function reviewValues()
    {
    //this is to return the review parameters
    //the review value key links the rest of the array values
    $cleanliness = array('Crispy clean' => 3, 'Clean' => 2, 'Dirty' => 1);
    $attitude = array('Excellent' => 3, 'Good' => 2, 'Bad' => 1);
    $wait_time = array('Less than 30 mins' => 3, '30 mins - 1 hour' => 2, 'Beyond' => 1);
    $diagnosis = array('Excellent' => 3, 'Good' => 2, 'Bad' => 1);
    $captions = array('Cleanliness' => 'How clean was the enviroment of the health care provider?', 'Attitude' => 'How where you treated by staff of the health care provider?', 'Wait time' => 'How long did you wait to see a doctor?', 'Diagnosis' => 'How well did you understand what was wrong with you and the treatment plans?');
    $db_keys = array('Cleanliness' => 'cleanliness', 'Attitude' => 'attitude', 'Wait time' => 'wait_time', 'Diagnosis' => 'diagnosis');
    $review_values = array('Cleanliness' => $cleanliness, 'Attitude' => $attitude, 'Wait time' => $wait_time, 'Diagnosis' => $diagnosis);
    return array('captions' => $captions, 'db_keys' => $db_keys, 'review_values' => $review_values);
    }

    on hospital controller
    $params['review_array'] = $this->reviewModel->reviewValues();

    //review section on the hospital view blade goes below
    <div class="col-md-6">
    <form method="POST" id="reviews-form" action="{{route('dashboard.add.review')}}">
    @csrf

    <?php
    foreach ($review_array['review_values'] as $key => $value){
    $caption = $review_array['captions'][$key];
    $db_keys = $review_array['db_keys'][$key];
    ?>

    <div class="form-row">
    <h6>{{$key.' : '. $caption}}</h6>

    <?php
    foreach($value as $option => $option_value){
    ?>
    <div class="form-group" style="margin-right:5px;">
    <div class="form-check">

    <label class="form-check-label">
    <input type="radio" class="form-check-input" name="{{$db_keys}}" value="{{$option_value}}">{{$option}}
    </label>
    </div>
    </div>

    <?php } ?>

    </div>

    <?php }?>



    <input type="hidden" name="hospital_id" value="{{$hospital['id']}}">
    <input type="hidden" name="post_reviews_url" value="{{route('dashboard.add.review')}}">


    <button class="btn btn-primary float-right" id="add-reviews">Add</button>

    </form>
    </div>