Подписать операцию как полную или неполную в Laravel? - PullRequest
0 голосов
/ 02 апреля 2020

Я создаю систему бронирования хирургических операций с использованием Laravel, мне было интересно, каким будет лучший способ go подписать операцию как полную или неполную? На моем bookings.blade. php Я хочу добавить две кнопки «Завершить регистрацию» или «Завершить регистрацию», чтобы перевести пользователя в окно выхода из системы. В этом виде выхода два входа - «выход хирурга», который я хотел бы сделать в качестве хирурга, указанного в бронировании, и «Заключительные примечания» для ввода любых примечаний для завершения или неполного заполнения. После того, как это будет отправлено, мне нужно удалить это бронирование из таблицы заказов и добавить в таблицу Surgery Complete или Surgery Incomplete в зависимости от выбранной опции. Любые предложения о моем лучшем способе go по этому поводу очень приветствуются.

Ниже мой контроллер формы бронирования:

class BookingFormsController extends Controller
{
public function submit(Request $booking){
  $this->validate($booking, [
  'requestID' => 'required',
  'bookingID' => 'required',
  'patientID' => 'required',
  'patientForename' => 'required',
  'patientSurname'=> 'required',
  'patientSex' => 'required',
  'patientDOB' => 'required',
  'surgeryType' => 'required',
  'surgeryDate' => 'required',
  'performingSurgeon' => 'required',
  'TheatreRoomID' => 'required',
  'patientUrgency' => 'required',
  'patientNotes' => 'required',
  'bloodGroup' => 'required'
  ]);

// Create new Request Form
$bookingForm = new bookingForm;
$bookingForm->requestID = $booking->input('requestID');
$bookingForm->bookingID = $booking->input('bookingID');
$bookingForm->patientID = $booking->input('patientID');
$bookingForm->patientForename = $booking->input('patientForename');
$bookingForm->patientSurname = $booking->input('patientSurname');
$bookingForm->patientSex = $booking->input('patientSex');
$bookingForm->patientDOB = $booking->input('patientDOB');
$bookingForm->surgeryType = $booking->input('surgeryType');
$bookingForm->surgeryDate = $booking->input('surgeryDate');
$bookingForm->performingSurgeon = $booking->input('performingSurgeon');
$bookingForm->TheatreRoomID = $booking->input('TheatreRoomID');
$bookingForm->patientUrgency = $booking->input('patientUrgency');
$bookingForm->patientNotes = $booking->input('patientNotes');
$bookingForm->bloodGroup = $booking->input('bloodGroup');

//Save Booking form

$bookingForm->save();

//redirect
return redirect('/')->with('success', 'Booking Submitted');

}
public function getBookings(){
$bookings = BookingForm::all();

return view('bookings')->with('bookings', $bookings);
}

}

BookingForm.blade . php

@extends('layouts.app')
@section('content')
<h1>Booking Form</h1>
{!! Form::open(['url' => 'bookingform/submit']) !!}

    <div class="form-group">
    {{Form::label('bookingID', 'Booking ID')}}
    {{Form::number('bookingID', 'Booking ID', ['class' => 'form-control',])}}
    </div>

    <div class="form-group">
    {{Form::label('requestID', 'Request ID')}}
    {{Form::number('requestID', $patientDetail->requestID, ['class' => 'form-control',])}}
    </div>

    <div class="form-group">
    {{Form::label('requestDate', 'Request Date')}}
    {{Form::date('requestDate', $patientDetail->requestDate, ['class' => 'form-control'])}}
    </div>

    <div class="form-group">
    {{Form::label('patientID', 'Patient ID')}}
    {{Form::number('patientID', $patientDetail->patientID, ['class' => 'form-control'])}}
    </div>

    <div class="form-group">
    {{Form::label('patientForename', 'Patient Forename')}}
    {{Form::text('patientForename', $patientDetail->patientForename, ['class' => 'form-control'])}}
    </div>

    <div class="form-group">
    {{Form::label('patientSurname', 'Patient Surname')}}
    {{Form::text('patientSurname', $patientDetail->patientSurname, ['class' => 'form-control',])}}
    </div>

    <div class="form-group">
    {{Form::label('patientSex', 'Patient Sex')}}
    {{Form::text('patientSex', $patientDetail->patientSex, ['class' => 'form-control', 'placeholder' => ''])}}
    </div>

    <div class="form-group">
    {{Form::label('patientDOB', 'Patient DOB')}}
    {{Form::date('patientDOB', $patientDetail->patientDOB, ['class' => 'form-control','placeholder' => ''])}}
    </div>

    <div class="form-group">
    {{Form::label('patientUrgency', 'Patient Urgency')}}
    {{Form::text('patientUrgency', $patientDetail->patientUrgency, ['class' => 'form-control','placeholder' => ''])}}
    </div>

    <div class="form-group">
    {{Form::label('TheatreRoomID', 'Theatre Room ID')}}
    {{Form::number('TheatreRoomID', 'Theatre Room ID', ['class' => 'form-control',])}}
    </div>

    <div class="form-group">
    {{Form::label('bloodGroup', 'Blood Group')}}
    {{Form::text('bloodGroup', $patientDetail->bloodGroup,  ['class' => 'form-control', 'placeholder' => ''])}}
    </div>

    <div class="form-group">
    {{Form::label('surgeryType', 'Surgery Type')}}
    {{Form::text('surgeryType', $patientDetail->surgeryType, ['class' => 'form-control','placeholder' => ''])}}
    </div>

    <div class="form-group">
      {{Form::label('surgeryDate', 'Surgery Date')}}
      {{Form::date('surgeryDate')}}
    </div>

    <div class="form-group">
      {{Form::label('performingSurgeon', 'Peforming Surgeon')}}
      {{Form::select('performingSurgeon', ['Sharon Glenny' => 'Sharon Glenny', 'Wendy clarke' => 'Wendy Clarke'], null, ['class' => 'form-control','placeholder' => ''])}}
    </div>



    <div class="form-group">
      {{Form::label('patientNotes', 'Patient Notes')}}
      {{Form::textarea('patientNotes', '', ['class' => 'form-control', 'placeholder' => 'Enter any other neccessary patient details'])}}
    </div>

<div class="btn-group">
  <a href="javascript:history.back()" class="btn btn-danger">Back</a>
  {{Form::submit('Submit Booking', ['class'=> 'btn btn-primary'])}}
</div>
{!! Form::close() !!}
@endsection

Bookings.blade. php

@extends('layouts.app')
  @section('content')
 <h1>Bookings</h1>
 <div>
   <a href="/" class="btn btn-danger">Back</a>
 </div>
 @if(count($bookings) > 0)
  @foreach($bookings as $bookingForm)
   <table class="table">
    <thead class="thead-dark">
    <tr>

     <th scope="col"></th>
     <th scope="col">Booking ID</th>
  <th scope="col">Request ID</th>
  <th scope="col">Patient ID</th>
  <th scope="col">Patient Forename</th>
  <th scope="col">Patient Surname</th>
  <th scope="col">Patient Sex</th>
  <th scope="col">Patient DOB</th>
  <th scope="col">Surgery Type</th>
  <th scope="col">Surgery Date</th>
  <th scope="col">Performing Surgeon</th>
  <th scope="col">Theatre Room ID</th>
  <th scope="col">Patient Urgeny</th>
  <th scope="col">Patient Notes</th>
  <th scope="col">Blood Group</th>

</tr>
<td>
 </thead>
 <tbody>
<tr>
  <th scope="row"></th>
  <td>{{$bookingForm->bookingID}}</td>
  <td>{{$bookingForm->requestID}}</td>
  <td>{{$bookingForm->patientID}}</td>
  <td>{{$bookingForm->patientForename}}</td>
  <td>{{$bookingForm->patientSurname}}</td>
  <td>{{$bookingForm->patientSex}}</td>
  <td>{{$bookingForm->patientDOB}}</td>
  <td>{{$bookingForm->surgeryType}}</td>
  <td>{{$bookingForm->surgeryDate}}</td>
  <td>{{$bookingForm->performingSurgeon}}</td>
  <td>{{$bookingForm->TheatreRoomID}}</td>
  <td>{{$bookingForm->patientUrgency}}</td>
  <td>{{$bookingForm->patientNotes}}</td>
  <td>{{$bookingForm->bloodGroup}}</</td>
</tr>
</tbody>
 </table>
 @endforeach
 @endif

 <div class="btn-group">
   <a href="/waitinglist" class="btn btn-primary">Book Surgery</a>
    <a href="/" class="btn btn-danger">Back</a>
 </div>
 @endsection


@section('sidebar')
@parent
 <p>This is appended to the Sidebar</p>
@endsection
...