Sfoglia il codice sorgente

Training request forms

Samson Mutunga 2 anni fa
parent
commit
1f85b7680a

+ 30 - 0
app/Http/Controllers/PhysiciansController.php

@@ -9,6 +9,7 @@ use Illuminate\Http\Request;
 
 use App\Models\PhysicianTrainingRequest;
 use App\Models\PhysicianContactMessage;
+use App\Models\PhysicianDirectoryListingRequest;
 
 class PhysiciansController extends Controller
 {
@@ -81,6 +82,7 @@ class PhysiciansController extends Controller
       $record->phone = $request->get('phone');
       $record->zip = $request->get('zip');
       $record->training_type = $request->get('training_type');
+      $record->training_type_other = $request->get('training_type_other');
       $record->training_format = $request->get('training_format');
       $record->notes = $request->get('notes');
 
@@ -116,4 +118,32 @@ class PhysiciansController extends Controller
       return redirect()->back()->with('success', 'Your request has been submitted!');
     }
 
+    public function submitPracticeSupportDirectoryListing(Request $request){
+      $request->validate([
+        'name_first' => 'required|string',
+        'name_last' => 'required|string',
+        'title' => 'required|string',
+        'practice_name' => 'required|string',
+        'email' => 'required|email',
+        'phone' => 'required|string',
+        'zip' => 'required|string',
+        'comment' => 'required|string',
+      ]);
+
+      $record = new PhysicianDirectoryListingRequest;
+      $record->iid = $this->makeIID();
+      $record->uid = Uuid::uuid6();
+      $record->name_first = $request->get('name_first');
+      $record->name_last = $request->get('name_last');
+      $record->title = $request->get('title');
+      $record->practice_name = $request->get('practice_name');
+      $record->email = $request->get('email');
+      $record->phone = $request->get('phone');
+      $record->zip = $request->get('zip');
+      $record->comment = $request->get('comment');
+
+      $record->save();
+      return redirect()->back()->with('success', 'Your request has been submitted!');
+    }
+
 }

+ 11 - 0
app/Models/PhysicianDirectoryListingRequest.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Models;
+
+use App\Models\Base\BaseModel;
+use Illuminate\Database\Eloquent\Model;
+
+class PhysicianDirectoryListingRequest extends BaseModel
+{
+    protected $table = 'physician_directory_listing_request';
+}

+ 41 - 0
database/migrations/2022_11_16_083709_create_physician_directory_listing_request_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreatePhysicianDirectoryListingRequestTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('physician_directory_listing_request', function (Blueprint $table) {
+            $table->id();
+            $table->string('uid')->unique();
+            $table->string('iid')->unique();
+            $table->string('name_first');
+            $table->string('name_last');
+            $table->string('title')->nullable();
+            $table->string('practice_name')->nullable();
+            $table->string('email')->nullable();
+            $table->string('phone')->nullable();
+            $table->string('zip')->nullable();
+            $table->text('comment')->nullable();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('physician_directory_listing_request');
+    }
+}

+ 1 - 1
resources/views/app/contact.blade.php

@@ -51,7 +51,7 @@
               @enderror
           </div>
           <div class="col-lg-6 form-group mb-4">
-            <input type="text" class="form-control rounded-0 py-3" name="phone" placeholder="Phone Number" value="{{ old('phone') }}">
+            <input type="text" class="form-control rounded-0 py-3 phone" name="phone" placeholder="Phone Number" value="{{ old('phone') }}">
             @error('phone')
                 <small class="text-warning">{{$message}}</small>
               @enderror

+ 1 - 1
resources/views/app/physicians/contact-us.blade.php

@@ -90,7 +90,7 @@
           </div>
           <div class="form-group mb-4">
             <label>Phone <span class="text-danger">*</span> </label>
-            <input type="tel" class="form-control rounded-0 py-3" required phone name="phone" value="{{ old('phone') }}">
+            <input type="tel" class="form-control rounded-0 py-3 phone" required phone placeholder="(xxx) xxx-xxxx" name="phone" value="{{ old('phone') }}">
             @error('phone')
                 <small class="text-warning">{{$message}}</small>
               @enderror

+ 41 - 4
resources/views/app/physicians/practice-support/directory-listing.blade.php

@@ -28,43 +28,80 @@
     <div class="row justify-content-center">
       <div class="col-lg-8">
         <h5 class="header mb-4">Complete the form below</h5>
-        <form class="" action="" method="post">
+        <form class="" action="{{ route('physicians.submit-practice-support-directory-listing-request') }}" method="post">
           @csrf
           <div class="row">
+            <div class="col-12">
+              @if(session('success'))
+                <div class="alert alert-success fade show" role="alert">
+                    {{session('success')}}
+                </div>
+              @endif
+
+              @if($errors->any())
+              <div class="alert alert-danger fade show" role="alert">
+                  There were errors found!
+              </div>
+              @endif
+            </div>
             <div class="col-lg-6 form-group mb-4">
               <label>First Name <span class="text-danger">*</span> </label>
               <input type="text" class="form-control rounded-0 py-3" required name="name_first" value="{{ old('name_first') }}">
+              @error('name_first')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
             <div class="col-lg-6 form-group mb-4">
               <label>Last Name <span class="text-danger">*</span> </label>
               <input type="text" class="form-control rounded-0 py-3" required name="name_last" value="{{ old('name_last') }}">
+              @error('name_last')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
           </div>
           <div class="form-group mb-4">
             <label>Title <span class="text-danger">*</span> </label>
             <input type="text" class="form-control rounded-0 py-3" required name="title" value="{{ old('title') }}">
+            @error('title')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <div class="row">
             <div class="col-lg-5 form-group mb-4">
               <label>Practice Name <span class="text-danger">*</span> </label>
               <input type="text" class="form-control rounded-0 py-3" required name="practice_name" value="{{ old('practice_name') }}">
+              @error('practice_name')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
             <div class="col-lg-3 form-group mb-4">
               <label>Practice Zip Code <span class="text-danger">*</span> </label>
-              <input type="text" class="form-control rounded-0 py-3" required name="practice_zip" value="{{ old('practice_zip') }}">
+              <input type="text" class="form-control rounded-0 py-3" required name="zip" value="{{ old('zip') }}">
+              @error('zip')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
             <div class="col-lg-4 form-group mb-4">
               <label>Practice Phone Number <span class="text-danger">*</span> </label>
-              <input type="tel" class="form-control rounded-0 py-3 phone" required placeholder="(xxx) xxx-xxxx" name="practice_phone" value="{{ old('practice_phone') }}">
+              <input type="tel" class="form-control rounded-0 py-3 phone" required placeholder="(xxx) xxx-xxxx" name="phone" value="{{ old('phone') }}">
+              @error('phone')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
           </div>
           <div class="form-group mb-4">
             <label>Contact Email <span class="text-danger">*</span> </label>
             <input type="email" class="form-control rounded-0 py-3" required name="email" value="{{ old('email') }}">
+            @error('email')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <div class="form-group mb-4">
             <label>Other comments</label>
-            <textarea name="message" class="form-control rounded-0" rows="6">{{ old('message') }}</textarea>
+            <textarea name="comment" class="form-control rounded-0" rows="6">{{ old('comment') }}</textarea>
+            @error('comment')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <button type="submit" class="btn btn-pry w-100 py-3">SUBMIT</button>
         </form>

+ 46 - 5
resources/views/app/physicians/practice-support/training.blade.php

@@ -32,35 +32,65 @@
     <div class="row justify-content-center">
       <div class="col-lg-8">
         <h5 class="header mb-4">Schedule a Session</h5>
-        <form class="" action="" method="post">
+        <form class="" action="{{ route('physicians.submit-training-request') }}" method="post">
           @csrf
           <div class="row">
+            <div class="col-12">
+              @if($errors->any())
+                <div class="alert alert-danger fade show" role="alert">
+                  There were errors found!
+                </div>
+              @endif
+              @if(session('success'))
+                <div class="alert alert-success fade show" role="alert">
+                  {{session('success')}}
+                </div>
+              @endif
+            </div>
             <div class="col-lg-4 form-group mb-4">
               <label>First Name <span class="text-danger">*</span> </label>
               <input type="text" class="form-control rounded-0 py-3" required name="name_first" value="{{ old('name_first') }}">
+              @error('name_first')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
             <div class="col-lg-4 form-group mb-4">
               <label>Last Name <span class="text-danger">*</span> </label>
               <input type="text" class="form-control rounded-0 py-3" required name="name_last" value="{{ old('name_last') }}">
+              @error('name_last')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
             <div class="col-lg-4 form-group mb-4">
               <label>Practice Name <span class="text-danger">*</span> </label>
               <input type="text" class="form-control rounded-0 py-3" required name="practice_name" value="{{ old('practice_name') }}">
+              @error('practice_name')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
           </div>
           <div class="row">
             <div class="col-lg-6 form-group mb-4">
               <label>Contact Email <span class="text-danger">*</span> </label>
               <input type="email" class="form-control rounded-0 py-3" required name="email" value="{{ old('email') }}">
+              @error('email')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
             <div class="col-lg-6 form-group mb-4">
               <label>Contact Phone Number <span class="text-danger">*</span> </label>
               <input type="tel" class="form-control rounded-0 py-3 phone" required name="phone" placeholder="(xxx) xxx-xxxx" value="{{ old('phone') }}">
+              @error('phone')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
             </div>
           </div>
           <div class="form-group mb-4">
             <label>Zip Code <span class="text-danger">*</span> </label>
             <input type="text" class="form-control rounded-0 py-3" required name="zip" value="{{ old('zip') }}">
+            @error('zip')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <div class="form-group mb-4">
             <label>Training Type <span class="text-danger">*</span> </label>
@@ -70,23 +100,34 @@
               <option value="staff">Staff Training</option>
               <option value="other">Other</option>
             </select>
+            @error('training_type')
+              <small class="text-warning">{{$message}}</small>
+            @enderror
           </div>
           <div class="form-group mb-4 training_type d-none">
             <label>Other <span class="text-danger">*</span> </label>
             <input type="text" class="form-control rounded-0 py-3" required name="training_type_other" value="{{ old('training_type_other') }}">
+            @error('training_type_other')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <div class="form-group mb-4">
             <label>Training Format <span class="text-danger">*</span> </label>
-            <select class="form-control rounded-0 py-3" required name="training_type">
+            <select class="form-control rounded-0 py-3" required name="training_format">
               <option value="">Select</option>
-              <option value="clinical">Clinical Training</option>
-              <option value="staff">Staff Training</option>
-              <option value="other">Other</option>
+              <option value="In-person">In-person</option>
+              <option value="Online">Online</option>
             </select>
+            @error('training_format')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <div class="form-group mb-4">
             <label>Other notes</label>
             <textarea name="message" class="form-control rounded-0" rows="6">{{ old('message') }}</textarea>
+            @error('message')
+                <small class="text-warning">{{$message}}</small>
+              @enderror
           </div>
           <button type="submit" class="btn btn-pry w-100 py-3">SUBMIT</button>
         </form>

+ 1 - 0
routes/web.php

@@ -33,6 +33,7 @@ Route::prefix('/physicians/')->name('physicians.')->group(function () {
     Route::get('/practice-support/training', [PhysiciansController::class, 'practiceSupportTraining'])->name('practice-support-training');
     Route::get('/practice-support/reimbursement-guide', [PhysiciansController::class, 'practiceSupportReimbursement'])->name('practice-support-reimbursement');
     Route::get('/practice-support/directory-listing', [PhysiciansController::class, 'practiceSupportDirectoryListing'])->name('practice-support-directory');
+    Route::post('/practice-support/submit-directory-listing', [PhysiciansController::class, 'submitPracticeSupportDirectoryListing'])->name('submit-practice-support-directory-listing-request');
     Route::get('/order-products', [PhysiciansController::class, 'orderProducts'])->name('order-products');
     Route::get('/order-products/ligators', [PhysiciansController::class, 'orderProductsLigators'])->name('order-products-ligators');
     Route::get('/order-products/marketing-materials', [PhysiciansController::class, 'orderProductsMarketing'])->name('order-products-marketing');