소스 검색

added pro crud

Josh Kamau 5 년 전
부모
커밋
ee9252c65b

+ 15 - 0
app/Http/Controllers/ProController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use Illuminate\Http\Request;
+use App\Models\Pro;
 
 class ProController extends Controller
 {
@@ -10,4 +11,18 @@ class ProController extends Controller
     public function dashboard(){
         return view('pro.dashboard');
     }
+
+    public function index(){
+        $pros = Pro::all();
+        return view('pro.index', compact('pros'));
+    }
+
+    public function create(){
+        return view('pro.create');
+    }
+
+    public function show($uid, Request $request){
+        $pro = Pro::where('uid', $uid)->first();
+        return view('pro.show', compact('pro'));
+    }
 }

+ 1 - 1
app/Http/Middleware/EncryptCookies.php

@@ -12,6 +12,6 @@ class EncryptCookies extends Middleware
      * @var array
      */
     protected $except = [
-        //
+        "sessionKey"
     ];
 }

+ 13 - 0
app/Models/Pro.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Pro extends Model
+{
+
+    protected $table = "pro";
+
+    //
+}

+ 24 - 0
resources/views/layouts/pro.blade.php

@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+
+    <link rel="stylesheet" href="{{asset('css/toastr.min.css')}}">
+
+    <script src="{{asset('js/jquery-3.2.1.min.js')}}"></script>
+    <script src="{{asset('js/jquery-ui.min.js')}}"></script>
+    <script src="{{asset('js/jquery.form.js')}}"></script>
+    <script src="{{asset('js/toastr.min.js')}}"></script>
+
+    <title>Document</title>
+</head>
+
+<body>
+    @yield('content')
+    <script src="{{asset('js/moe.js')}}"></script>
+</body>
+
+</html>

+ 63 - 0
resources/views/pro/create.blade.php

@@ -0,0 +1,63 @@
+@extends('layouts.pro')
+@section('content')
+<h1>Create pro</h1>
+<div moe>
+    <form url="/api/pro/create" redir="/pros/show/" method="POST">
+        <div class="form-group">
+            <label class="control-label">cellNumber</label>
+            <input type=cellNumber"text" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">emailAddress</label>
+            <input name="emailAddress" type="email" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">nameDisplay</label>
+            <input type="text" name="name.nameDisplay" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">namePrefix</label>
+            <input type="text" name="name.namePrefix" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">nameFirst</label>
+            <input type="text" name="name.nameFirst" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">nameMiddle</label>
+            <input type="text" name="name.nameMiddle" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">nameLast</label>
+            <input type="text" name="name.nameLast" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">nameSuffix</label>
+            <input type="text" name="name.nameSuffix" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">nameCredential</label>
+            <input type="text" name="name.nameCredential" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">isHcp</label>
+            <input name="isHcp" type="checkbox" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">hcpNpi</label>
+            <input name="hcpNpi" type="text" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">previousProfessionCategory</label>
+            <input name="previousProfessionCategory" type="text" class="form-control">
+        </div>
+        <div class="form-group">
+            <label class="control-label">currentProfessionCategory</label>
+            <input name="currentProfessionCategory" type="text" class="form-control">
+        </div>
+        <div class="form-group">
+            <button submit>Submit</button>
+        </div>
+    </form>
+</div>
+@endsection

+ 21 - 34
resources/views/pro/dashboard.blade.php

@@ -1,37 +1,24 @@
-<!DOCTYPE html>
-<html lang="en">
+@extends('layouts.pro')
 
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+@section('content')
+@if(Session::get('message'))
+<div class="alert-alert-info">{{Session::get('message')}}</div>
+@endif
+<h1>Pro dashboard</h1>
+<a href="{{route('pro-logout')}}">Log out</a>
 
-    <link rel="stylesheet" href="{{asset('css/toastr.min.css')}}">
+<ul>
+    <li>
+        <a href="{{route('pro-index')}}">Pros</a>
+    </li>
+</ul>
 
-    <script src="{{asset('js/jquery-3.2.1.min.js')}}"></script>
-    <script src="{{asset('js/jquery-ui.min.js')}}"></script>
-    <script src="{{asset('js/jquery.form.js')}}"></script>
-    <script src="{{asset('js/toastr.min.js')}}"></script>
-   
-    <title>Document</title>
-</head>
-
-<body>
-    @if(Session::get('message'))
-    <div class="alert-alert-info">{{Session::get('message')}}</div>
-    @endif
-    <h1>Pro dashboard</h1>
-    <a href="{{route('pro-logout')}}">Log out</a>
-
-    <div moe>
-        <a start show href="">create pro</a>
-        <form url="/api/dev/createSystemAdmin" style="display:none">
-            <h1>Form to create pro</h1>
-            <button submit>submit</button>
-        </form>
-    </div>
-
-    <script src="{{asset('js/moe.js')}}"></script>
-</body>
-
-</html>
+<div moe>
+    <a start show href="">create pro</a>
+    <form url="/api/dev/createSystemAdmin" style="display:none">
+        <h1>Form to create pro</h1>
+        <button submit>submit</button>
+        <button cancel>Cancel</button>
+    </form>
+</div>
+@endsection

+ 187 - 0
resources/views/pro/index.blade.php

@@ -0,0 +1,187 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+</head>
+
+<body>
+    <a href="{{route('pro-create')}}">Add new</a>
+    <table>
+        <thead>
+            <tr>
+                <th>id</th>
+                <th>balance</th>
+                <th>cell_number</th>
+                <th>cell_number_confirmation_token</th>
+                <th>cell_number_confirmed_at</th>
+                <th>current_profession_category</th>
+                <th>driver_license_expiration_date</th>
+                <th>driver_license_file_path</th>
+                <th>driver_license_issue_date</th>
+                <th>driver_license_state</th>
+                <th>email_address</th>
+                <th>email_address_confirmation_token</th>
+                <th>email_address_confirmed_at</th>
+                <th>enrolled_hcp_category</th>
+                <th>enrolled_hcp_npi</th>
+                <th>enrolled_hcp_subcategory</th>
+                <th>hcp_category</th>
+                <th>hcp_npi</th>
+                <th>hcp_subcategory</th>
+                <th>home_address_city</th>
+                <th>home_address_country</th>
+                <th>home_address_lat</th>
+                <th>home_address_line1</th>
+                <th>home_address_line2</th>
+                <th>home_address_long</th>
+                <th>home_address_state</th>
+                <th>home_address_zip</th>
+                <th>home_phone_number</th>
+                <th>is_cell_number_confirmation_pending</th>
+                <th>is_cell_number_confirmed</th>
+                <th>is_email_address_confirmation_pending</th>
+                <th>is_email_address_confirmed</th>
+                <th>is_enrolled_as_hcp</th>
+                <th>is_enrolled_as_mcp</th>
+                <th>is_hcp</th>
+                <th>mailing_address_city</th>
+                <th>mailing_address_country</th>
+                <th>mailing_address_lat</th>
+                <th>mailing_address_line1</th>
+                <th>mailing_address_line2</th>
+                <th>mailing_address_long</th>
+                <th>mailing_address_state</th>
+                <th>mailing_address_zip</th>
+                <th>name_credential</th>
+                <th>name_display</th>
+                <th>name_first</th>
+                <th>name_last</th>
+                <th>name_middle</th>
+                <th>name_prefix</th>
+                <th>name_suffix</th>
+                <th>payment_processing_detail</th>
+                <th>phone_numbers_memo</th>
+                <th>previous_profession_category</th>
+                <th>pro_type</th>
+                <th>profile_picture_base64</th>
+                <th>ssn</th>
+                <th>supporter_memo</th>
+                <th>supporter_phone_number</th>
+                <th>w9detail</th>
+                <th>work_phone_number</th>
+                <th>created_at</th>
+                <th>uid</th>
+                <th>created_by_session_id</th>
+                <th>is_two_step_sms_auth_completed</th>
+                <th>is_two_step_sms_auth_pending</th>
+                <th>two_step_sms_auth_completed_at</th>
+                <th>two_step_sms_auth_token</th>
+                <th>two_step_sms_auth_token_sent_at</th>
+                <th>is_sms_auth_pending</th>
+                <th>sms_auth_completed</th>
+                <th>sms_auth_completed_at</th>
+                <th>sms_auth_token</th>
+                <th>sms_auth_token_sent_at</th>
+                <th>deactivated_at</th>
+                <th>deactivation_memo</th>
+                <th>reactivated_at</th>
+                <th>reactivation_memo</th>
+                <th>deactivated_by_id</th>
+                <th>reactivated_by_id</th>
+                <th>is_active</th>
+            </tr>
+        </thead>
+        <tbody>
+            @foreach($pros as $pro)
+            <tr>
+                <td>{{$pro->id}}</td>
+                <td>{{$pro->balance}}</td>
+                <td>{{$pro->cell_number}}</td>
+                <td>{{$pro->cell_number_confirmation_token}}</td>
+                <td>{{$pro->cell_number_confirmed_at}}</td>
+                <td>{{$pro->current_profession_category}}</td>
+                <td>{{$pro->driver_license_expiration_date}}</td>
+                <td>{{$pro->driver_license_file_path}}</td>
+                <td>{{$pro->driver_license_issue_date}}</td>
+                <td>{{$pro->driver_license_state}}</td>
+                <td>{{$pro->email_address}}</td>
+                <td>{{$pro->email_address_confirmation_token}}</td>
+                <td>{{$pro->email_address_confirmed_at}}</td>
+                <td>{{$pro->enrolled_hcp_category}}</td>
+                <td>{{$pro->enrolled_hcp_npi}}</td>
+                <td>{{$pro->enrolled_hcp_subcategory}}</td>
+                <td>{{$pro->hcp_category}}</td>
+                <td>{{$pro->hcp_npi}}</td>
+                <td>{{$pro->hcp_subcategory}}</td>
+                <td>{{$pro->home_address_city}}</td>
+                <td>{{$pro->home_address_country}}</td>
+                <td>{{$pro->home_address_lat}}</td>
+                <td>{{$pro->home_address_line1}}</td>
+                <td>{{$pro->home_address_line2}}</td>
+                <td>{{$pro->home_address_long}}</td>
+                <td>{{$pro->home_address_state}}</td>
+                <td>{{$pro->home_address_zip}}</td>
+                <td>{{$pro->home_phone_number}}</td>
+                <td>{{$pro->is_cell_number_confirmation_pending}}</td>
+                <td>{{$pro->is_cell_number_confirmed}}</td>
+                <td>{{$pro->is_email_address_confirmation_pending}}</td>
+                <td>{{$pro->is_email_address_confirmed}}</td>
+                <td>{{$pro->is_enrolled_as_hcp}}</td>
+                <td>{{$pro->is_enrolled_as_mcp}}</td>
+                <td>{{$pro->is_hcp}}</td>
+                <td>{{$pro->mailing_address_city}}</td>
+                <td>{{$pro->mailing_address_country}}</td>
+                <td>{{$pro->mailing_address_lat}}</td>
+                <td>{{$pro->mailing_address_line1}}</td>
+                <td>{{$pro->mailing_address_line2}}</td>
+                <td>{{$pro->mailing_address_long}}</td>
+                <td>{{$pro->mailing_address_state}}</td>
+                <td>{{$pro->mailing_address_zip}}</td>
+                <td>{{$pro->name_credential}}</td>
+                <td>{{$pro->name_display}}</td>
+                <td>{{$pro->name_first}}</td>
+                <td>{{$pro->name_last}}</td>
+                <td>{{$pro->name_middle}}</td>
+                <td>{{$pro->name_prefix}}</td>
+                <td>{{$pro->name_suffix}}</td>
+                <td>{{$pro->payment_processing_detail}}</td>
+                <td>{{$pro->phone_numbers_memo}}</td>
+                <td>{{$pro->previous_profession_category}}</td>
+                <td>{{$pro->pro_type}}</td>
+                <td>{{$pro->profile_picture_base64}}</td>
+                <td>{{$pro->ssn}}</td>
+                <td>{{$pro->supporter_memo}}</td>
+                <td>{{$pro->supporter_phone_number}}</td>
+                <td>{{$pro->w9detail}}</td>
+                <td>{{$pro->work_phone_number}}</td>
+                <td>{{$pro->created_at}}</td>
+                <td>{{$pro->uid}}</td>
+                <td>{{$pro->created_by_session_id}}</td>
+                <td>{{$pro->is_two_step_sms_auth_completed}}</td>
+                <td>{{$pro->is_two_step_sms_auth_pending}}</td>
+                <td>{{$pro->two_step_sms_auth_completed_at}}</td>
+                <td>{{$pro->two_step_sms_auth_token}}</td>
+                <td>{{$pro->two_step_sms_auth_token_sent_at}}</td>
+                <td>{{$pro->is_sms_auth_pending}}</td>
+                <td>{{$pro->sms_auth_completed}}</td>
+                <td>{{$pro->sms_auth_completed_at}}</td>
+                <td>{{$pro->sms_auth_token}}</td>
+                <td>{{$pro->sms_auth_token_sent_at}}</td>
+                <td>{{$pro->deactivated_at}}</td>
+                <td>{{$pro->deactivation_memo}}</td>
+                <td>{{$pro->reactivated_at}}</td>
+                <td>{{$pro->reactivation_memo}}</td>
+                <td>{{$pro->deactivated_by_id}}</td>
+                <td>{{$pro->reactivated_by_id}}</td>
+                <td>{{$pro->is_active}}</td>
+            </tr>
+            @endforeach
+        </tbody>
+    </table>
+</body>
+
+</html>

+ 87 - 0
resources/views/pro/show.blade.php

@@ -0,0 +1,87 @@
+@extends('layouts.pro')
+@section('content')
+<h1>Pro details</h1>
+<div>
+    id: {{$pro->id}}</br>
+    balance: {{$pro->balance}}</br>
+    cell_number: {{$pro->cell_number}}</br>
+    cell_number_confirmation_token: {{$pro->cell_number_confirmation_token}}</br>
+    cell_number_confirmed_at: {{$pro->cell_number_confirmed_at}}</br>
+    current_profession_category: {{$pro->current_profession_category}}</br>
+    driver_license_expiration_date: {{$pro->driver_license_expiration_date}}</br>
+    driver_license_file_path: {{$pro->driver_license_file_path}}</br>
+    driver_license_issue_date: {{$pro->driver_license_issue_date}}</br>
+    driver_license_state: {{$pro->driver_license_state}}</br>
+    email_address: {{$pro->email_address}}</br>
+    email_address_confirmation_token: {{$pro->email_address_confirmation_token}}</br>
+    email_address_confirmed_at: {{$pro->email_address_confirmed_at}}</br>
+    enrolled_hcp_category: {{$pro->enrolled_hcp_category}}</br>
+    enrolled_hcp_npi: {{$pro->enrolled_hcp_npi}}</br>
+    enrolled_hcp_subcategory: {{$pro->enrolled_hcp_subcategory}}</br>
+    hcp_category: {{$pro->hcp_category}}</br>
+    hcp_npi: {{$pro->hcp_npi}}</br>
+    hcp_subcategory: {{$pro->hcp_subcategory}}</br>
+    home_address_city: {{$pro->home_address_city}}</br>
+    home_address_country: {{$pro->home_address_country}}</br>
+    home_address_lat: {{$pro->home_address_lat}}</br>
+    home_address_line1: {{$pro->home_address_line1}}</br>
+    home_address_line2: {{$pro->home_address_line2}}</br>
+    home_address_long: {{$pro->home_address_long}}</br>
+    home_address_state: {{$pro->home_address_state}}</br>
+    home_address_zip: {{$pro->home_address_zip}}</br>
+    home_phone_number: {{$pro->home_phone_number}}</br>
+    is_cell_number_confirmation_pending: {{$pro->is_cell_number_confirmation_pending}}</br>
+    is_cell_number_confirmed: {{$pro->is_cell_number_confirmed}}</br>
+    is_email_address_confirmation_pending: {{$pro->is_email_address_confirmation_pending}}</br>
+    is_email_address_confirmed: {{$pro->is_email_address_confirmed}}</br>
+    is_enrolled_as_hcp: {{$pro->is_enrolled_as_hcp}}</br>
+    is_enrolled_as_mcp: {{$pro->is_enrolled_as_mcp}}</br>
+    is_hcp: {{$pro->is_hcp}}</br>
+    mailing_address_city: {{$pro->mailing_address_city}}</br>
+    mailing_address_country: {{$pro->mailing_address_country}}</br>
+    mailing_address_lat: {{$pro->mailing_address_lat}}</br>
+    mailing_address_line1: {{$pro->mailing_address_line1}}</br>
+    mailing_address_line2: {{$pro->mailing_address_line2}}</br>
+    mailing_address_long: {{$pro->mailing_address_long}}</br>
+    mailing_address_state: {{$pro->mailing_address_state}}</br>
+    mailing_address_zip: {{$pro->mailing_address_zip}}</br>
+    name_credential: {{$pro->name_credential}}</br>
+    name_display: {{$pro->name_display}}</br>
+    name_first: {{$pro->name_first}}</br>
+    name_last: {{$pro->name_last}}</br>
+    name_middle: {{$pro->name_middle}}</br>
+    name_prefix: {{$pro->name_prefix}}</br>
+    name_suffix: {{$pro->name_suffix}}</br>
+    payment_processing_detail: {{$pro->payment_processing_detail}}</br>
+    phone_numbers_memo: {{$pro->phone_numbers_memo}}</br>
+    previous_profession_category: {{$pro->previous_profession_category}}</br>
+    pro_type: {{$pro->pro_type}}</br>
+    profile_picture_base64: {{$pro->profile_picture_base64}}</br>
+    ssn: {{$pro->ssn}}</br>
+    supporter_memo: {{$pro->supporter_memo}}</br>
+    supporter_phone_number: {{$pro->supporter_phone_number}}</br>
+    w9detail: {{$pro->w9detail}}</br>
+    work_phone_number: {{$pro->work_phone_number}}</br>
+    created_at: {{$pro->created_at}}</br>
+    uid: {{$pro->uid}}</br>
+    created_by_session_id: {{$pro->created_by_session_id}}</br>
+    is_two_step_sms_auth_completed: {{$pro->is_two_step_sms_auth_completed}}</br>
+    is_two_step_sms_auth_pending: {{$pro->is_two_step_sms_auth_pending}}</br>
+    two_step_sms_auth_completed_at: {{$pro->two_step_sms_auth_completed_at}}</br>
+    two_step_sms_auth_token: {{$pro->two_step_sms_auth_token}}</br>
+    two_step_sms_auth_token_sent_at: {{$pro->two_step_sms_auth_token_sent_at}}</br>
+    is_sms_auth_pending: {{$pro->is_sms_auth_pending}}</br>
+    sms_auth_completed: {{$pro->sms_auth_completed}}</br>
+    sms_auth_completed_at: {{$pro->sms_auth_completed_at}}</br>
+    sms_auth_token: {{$pro->sms_auth_token}}</br>
+    sms_auth_token_sent_at: {{$pro->sms_auth_token_sent_at}}</br>
+    deactivated_at: {{$pro->deactivated_at}}</br>
+    deactivation_memo: {{$pro->deactivation_memo}}</br>
+    reactivated_at: {{$pro->reactivated_at}}</br>
+    reactivation_memo: {{$pro->reactivation_memo}}</br>
+    deactivated_by_id: {{$pro->deactivated_by_id}}</br>
+    reactivated_by_id: {{$pro->reactivated_by_id}}</br>
+    is_active: {{$pro->is_active}}</br>
+   
+</div>
+@endsection

+ 8 - 14
resources/views/public/pro-request-sms-login-token.blade.php

@@ -1,17 +1,11 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>Document</title>
-</head>
-<body>
-    <h1>Pro request sms login token</h1>
-    <form action="/api/session/proRequestSmsTokenToLogIn" method="POST">
+@extends('layouts.pro')
+@section('content')
+<h1>Pro request sms login token</h1>
+<div moe>
+    <form show url="/api/session/proRequestSmsTokenToLogIn" method="POST" redir="/pro/login?x=">
         <label for="">Cell number</label>
         <input type="text" name="cellNumber">
-        <button>Submit</button>
+        <button submit>Submit</button>
     </form>
-</body>
-</html>
+</div>
+@endsection

+ 5 - 0
routes/web.php

@@ -25,5 +25,10 @@ Route::middleware('ensureNoValidSession')->group(function(){
 
 Route::middleware('ensureValidSession')->group(function(){
     Route::get('/pro/dashboard', 'ProController@dashboard')->name('pro-dashboard');
+
+    Route::get("/pros", 'ProController@index')->name('pro-index');
+    Route::get("/pros/create", 'ProController@create')->name('pro-create');
+    Route::get("/pros/show/{uid}", 'ProController@show')->name('pro-show');
+
     Route::get('/pro/logout', 'AppSessionController@processProLogOut')->name('pro-logout');
 });