Bläddra i källkod

Merge branch 'dev' of rav.triplestart.com:TigerPHP/stagfe into dev

Josh 4 år sedan
förälder
incheckning
0e6e7a2aca

+ 2 - 2
.idea/dataSources.xml

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
-    <data-source source="LOCAL" name="stag@localhost" uuid="d127a3b7-9799-49f9-8d87-747f4dd66e7d">
+    <data-source source="LOCAL" name="stag2@localhost" uuid="d127a3b7-9799-49f9-8d87-747f4dd66e7d">
       <driver-ref>postgresql</driver-ref>
       <synchronize>true</synchronize>
       <jdbc-driver>org.postgresql.Driver</jdbc-driver>
-      <jdbc-url>jdbc:postgresql://localhost:5432/stag</jdbc-url>
+      <jdbc-url>jdbc:postgresql://localhost:5432/stag2</jdbc-url>
     </data-source>
   </component>
 </project>

+ 2 - 2
app/Http/Controllers/AppSessionController.php

@@ -287,9 +287,9 @@ class AppSessionController extends Controller
         }
     }
 
-    public function loginWithSessionKey($sessionKey, $appAccessUID, Request $request){
+    public function loginWithSessionKey($sessionKey, $appAccessUID = null, Request $request){
         $url = "/api/session/pro_log_in_with_session_key/${sessionKey}";
-        if(!!$appAccessUID) {
+        if($appAccessUID) {
             $url .= "/$appAccessUID";
         }
         $api = new Backend();

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

@@ -0,0 +1,30 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Auth;
+
+class handouts_Controller extends Controller
+{
+    public $selfName = 'handouts_Controller';
+    public $dashboardName = 'dashboard';
+
+	// GET /handouts
+	public function index(Request $request) {
+		$records = DB::table('handout')->get();
+		return response()->view('admin/handouts/index', compact('records'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /handouts/add_new
+	public function add_new(Request $request) {
+		$records = DB::table('handout')->get();
+		return response()->view('admin/handouts/add_new', compact('records'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /handouts/view/{uid}
+	public function view(Request $request, $uid) {
+		return redirect("/handouts/view/$uid/SUB_dashboard");
+	}
+}

+ 33 - 0
app/Http/Controllers/handouts_SINGLE_Controller.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Auth;
+
+class handouts_SINGLE_Controller extends Controller
+{
+    public $selfName = 'handouts_SINGLE_Controller';
+    public $dashboardName = 'dashboard';
+
+	// GET /handouts/view/{uid}/ACTION_updateBasic
+	public function ACTION_updateBasic(Request $request, $uid) {
+		$record = DB::table('handout')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('handout')->where('id', $uid)->first();
+			if($record) return redirect('/handouts/view/' . $record->uid . '/ACTION_updateBasic');
+		}
+		return response()->view('admin/handouts_SINGLE/ACTION_updateBasic', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /handouts/view/{uid}/SUB_dashboard
+	public function SUB_dashboard(Request $request, $uid) {
+		$record = DB::table('handout')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('handout')->where('id', $uid)->first();
+			if($record) return redirect('/handouts/view/' . $record->uid . '/SUB_dashboard');
+		}
+		return response()->view('admin/handouts_SINGLE/SUB_dashboard', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+}

+ 16 - 2
generatecv/tree.txt

@@ -1174,7 +1174,7 @@ ADMIN
             changePositionIndex
                 newPositionIndex:number=position_index
             setIsCanvasToTrue
-            setIsCanvasToFalse  
+            setIsCanvasToFalse
         SUB
             dashboard
     note_templates|note_template|add|view|icon:user-md
@@ -1258,6 +1258,20 @@ ADMIN
 		        notes:text
         SUB
             dashboard
+    handouts|handout|add|view|icon:tablet-alt
+    handouts/add_new:create
+        internalName*
+        displayName*
+        tags
+        pdfFile:file
+    handouts/view/{uid}
+        ACTIONS
+            updateBasic
+                internalName*=internal_name
+                displayName*=display_name
+                tags=tags
+        SUB
+            dashboard
     bdt_devices|bdt_device|add|view|icon:tablet-alt
     bdt_devices/add_new:create
         imei
@@ -1340,4 +1354,4 @@ ADMIN
             updateMemo
                 memo=memo
         SUB
-            dashboard
+            dashboard

+ 1 - 0
resources/views/admin/handouts/actions.blade.php

@@ -0,0 +1 @@
+<a up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href='/handouts/view/<?= $record->uid ?>/ACTION_updateBasic?optimised=1' class='d-block btn btn-sm btn-default mb-3'>Update Basic</a>

+ 53 - 0
resources/views/admin/handouts/add_new.blade.php

@@ -0,0 +1,53 @@
+<?php /* DO NOT GENERATE */ ?>
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Handouts: Add New</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="{{route('handouts-index')}}" up-close>
+                <i class="fa fa-times"></i>
+            </a>
+        </div>
+    </h4>
+
+    <form action="/api/handout/create"
+          up-target="#main-content" up-history="false" up-fail-target=".failed-form-contents" up-reveal="false"
+          method="post" enctype="multipart/form-data"
+          class="border-top px-3 pt-3 pb-1 custom-submit">
+        @csrf
+
+        @if (session('message'))
+            <div class="alert alert-danger">{{ session('message') }}</div>
+        @endif
+
+        <input type="hidden" name="_api" value="/api/handout/create">
+        <input type="hidden" name="_success" value="{{route('handouts-index')}}">
+        <input type="hidden" name="_return" value="{{route('handouts-add_new')}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Internal Name *</label>
+<input class='form-control' type='text' name='internalName' value='{{ old('internalName') ? old('internalName') : '' }}' required>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Display Name *</label>
+<input class='form-control' type='text' name='displayName' value='{{ old('displayName') ? old('displayName') : '' }}' required>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Tags </label>
+<input class='form-control' type='text' name='tags' value='{{ old('tags') ? old('tags') : '' }}' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Pdf File </label>
+<input class='form-control' type='file' name='pdfFile' value='{{ old('pdfFile') ? old('pdfFile') : '' }}' >
+</div>
+        <div class="form-group mb-3 d-flex justify-content-center">
+            <button class="btn btn-sm btn-primary mr-3 px-5">Submit</button>
+            <a href="{{route('handouts-index')}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 60 - 0
resources/views/admin/handouts/index.blade.php

@@ -0,0 +1,60 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <h3 class="d-flex my-3 px-3 stag-heading stag-heading-index">
+        <div>Handouts: List</div>
+        <div class="ml-auto">
+            <a class='btn btn-primary btn-sm ml-2' up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href='/handouts/add_new?optimised=1'><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New</a>
+        </div>
+    </h3>
+
+    <div class="table-responsive p-0 bg-white border stag-table stag-table-index">
+        <table class="table table-hover text-nowrap table-striped">
+            <thead>
+            <tr>
+<th>&nbsp;</th>
+<th>Internal Name</th>
+<th>Display Name</th>
+<th>Tags</th>
+<th>Pdf File Path</th>
+<th>Pdf File Size In Bytes</th>
+<th>Content Text</th>
+<th>Created At</th>
+<th>Created By Session Id</th>
+<th>Type</th>
+<th>Is Active</th>
+<th>Deactivated At</th>
+<th>Deactivated By Session Id</th>
+<th>Deactivation Memo</th>
+<th>Reactivated At</th>
+<th>Reactivated By Session Id</th>
+<th>Reactivation Memo</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($records as $record)
+                <tr>
+<td><a href="/handouts/view/<?= $record->uid ?>"><i class="fas fa-share-square"></i></a></td>
+<td><?= $record->internal_name ?></td>
+<td><?= $record->display_name ?></td>
+<td><?= $record->tags ?></td>
+<td><?= $record->pdf_file_path ?></td>
+<td><?= $record->pdf_file_size_in_bytes ?></td>
+<td><?= $record->content_text ?></td>
+<td><?= friendly_date_time($record->created_at) ?></td>
+<td><?= $record->created_by_session_id ?></td>
+<td><?= $record->type ?></td>
+<td><?= $record->is_active ?></td>
+<td><?= friendly_date_time($record->deactivated_at) ?></td>
+<td><?= $record->deactivated_by_session_id ?></td>
+<td><?= $record->deactivation_memo ?></td>
+<td><?= friendly_date_time($record->reactivated_at) ?></td>
+<td><?= $record->reactivated_by_session_id ?></td>
+<td><?= $record->reactivation_memo ?></td>
+                </tr>
+            @endforeach
+            </tbody>
+        </table>
+    </div>
+
+@endsection

+ 3 - 0
resources/views/admin/handouts/info.blade.php

@@ -0,0 +1,3 @@
+<h4 class="d-flex my-3 px-3 stag-heading stag-heading-info">
+    <div>Handouts: Single [<?= $record->uid ?>]</div>
+</h4>

+ 1 - 0
resources/views/admin/handouts/subs.blade.php

@@ -0,0 +1 @@
+<a href='/handouts/view/<?= $record->uid ?>/SUB_dashboard' class='d-block px-3 py-2 border-bottom stag-sublink {{ request()->route()->getActionMethod() === 'SUB_dashboard' ? 'bg-secondary text-white font-weight-bold' : '' }}{{ strpos(request()->route()->getActionMethod(), 'ACTION_') === 0 ? 'bg-secondary text-white font-weight-bold' : '' }}'>Dashboard</a>

+ 20 - 0
resources/views/admin/handouts/view.blade.php

@@ -0,0 +1,20 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <div class="card rounded-0">
+        <div class="border-bottom bg-light">@include('admin/handouts/info')</div>
+        <div class="d-flex align-items-stretch">
+            <div class="inner-side-nav">
+                <div class="border-right h-100">
+                    @include('admin/handouts/subs')
+                </div>
+            </div>
+            <div class="flex-grow-1 px-3 pb-3 mb-3 inner-content">
+                <div>
+                    @yield('content-inner')
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 49 - 0
resources/views/admin/handouts_SINGLE/ACTION_updateBasic.blade.php

@@ -0,0 +1,49 @@
+@extends('admin.handouts.view')
+@section('content-inner')
+
+    <div class="form-contents"><div class="failed-form-contents">
+
+    <h4 class="d-flex m-0 p-3 stag-heading stag-heading-modal">
+        <div>Update Basic</div>
+        <div class="ml-auto">
+            <a class="text-secondary" href="#" up-close>
+                <i class="fa fa-times"></i>
+            </a>
+        </div>
+    </h4>
+
+    <form action="/post-to-api"
+          up-target="#main-content" up-history="false" up-fail-target=".failed-form-contents" up-reveal="false"
+          method="post" enctype="multipart/form-data"
+          class="border-top px-3 pt-3 pb-1 custom-submit">
+        @csrf
+
+        @if (session('message'))
+            <div class="alert alert-danger">{{ session('message') }}</div>
+        @endif
+
+        <input type="hidden" name="_uid" value="{{ $record->uid }}">
+        <input type="hidden" name="_api" value="/api/handout/updateBasic">
+        <input type="hidden" name="_success" value="{{route('handouts-view', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('handouts_SINGLE-ACTION_updateBasic', ['uid' => $record->uid])}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Internal Name *</label>
+<input class='form-control' type='text' name='internalName' value='{{ old('internalName') ? old('internalName') : $record->internal_name }}' required>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Display Name *</label>
+<input class='form-control' type='text' name='displayName' value='{{ old('displayName') ? old('displayName') : $record->display_name }}' required>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Tags </label>
+<input class='form-control' type='text' name='tags' value='{{ old('tags') ? old('tags') : $record->tags }}' >
+</div>
+        <div class="form-group mb-3 d-flex justify-content-center">
+            <button class="btn btn-sm btn-primary mr-3 px-5">Submit</button>
+            <a href="{{route('handouts-view', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

+ 41 - 0
resources/views/admin/handouts_SINGLE/SUB_dashboard.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.handouts.view')
+@section('content-inner')
+
+    <div class="row mt-3">
+    <div class="col-8">
+
+        <div class="table-responsive p-0 bg-white table-sm stag-table border-top">
+            <table class="table table-hover text-nowrap table-striped border-left border-right border-bottom">
+                <thead>
+                <tr>
+                    <th colspan="2" class="px-2">Record Details</th>
+                </tr>
+                </thead>
+                <tbody>
+                <?php foreach($record as $k => $v): ?>
+                    <?php
+                    if($k === 'id' || $k === 'uid') continue;
+                    $displayValue = $record->$k;
+                    if(substr($k, -3) === '_at') {
+                        $displayValue = friendly_date_time($record->$k);
+                    }
+                    ?>
+                    <tr>
+                        <td class="px-2 text-secondary border-right w-50">{{ ucwords(str_replace("_", " ", $k)) }}</td>
+                        <td class="px-2 font-weight-bold w-50">{{ $displayValue }}</td>
+                    </tr>
+                <?php endforeach; ?>
+                </tbody>
+            </table>
+        </div>
+
+    </div>
+    <div class="col-4">
+        <div class="border-left h-100 pl-3">
+            @include('admin/handouts/actions')
+        </div>
+    </div>
+</div>
+
+
+@endsection

+ 7 - 0
resources/views/layouts/generated-links.blade.php

@@ -159,6 +159,13 @@
 	</a>
 </li>
 
+<li class='nav-item'>
+	<a href='/handouts' class='nav-link {{ (isset(request()->route()->getController()->selfName) && strpos(request()->route()->getController()->selfName, 'handouts') === 0 ? 'active' : '') }} '>
+		<i class='nav-icon fa fa-tablet-alt'></i>
+		<p>Handouts</p>
+	</a>
+</li>
+
 <li class='nav-item'>
 	<a href='/bdt_devices' class='nav-link {{ (isset(request()->route()->getController()->selfName) && strpos(request()->route()->getController()->selfName, 'bdt_devices') === 0 ? 'active' : '') }} '>
 		<i class='nav-icon fa fa-tablet-alt'></i>

+ 13 - 0
routes/generated.php

@@ -505,6 +505,19 @@ Route::prefix('/client_documents/view/{uid}')->group(function () {
 	Route::get('SUB_dashboard', 'client_documents_SINGLE_Controller@SUB_dashboard')->name('client_documents_SINGLE-SUB_dashboard');
 });
 
+// --- admin: handouts --- //
+Route::prefix('/handouts')->group(function () {
+	Route::get('', 'handouts_Controller@index')->name('handouts-index');
+	Route::get('add_new', 'handouts_Controller@add_new')->name('handouts-add_new');
+	Route::get('view/{uid}', 'handouts_Controller@view')->name('handouts-view');
+});
+
+// --- admin: handouts_SINGLE --- //
+Route::prefix('/handouts/view/{uid}')->group(function () {
+	Route::get('ACTION_updateBasic', 'handouts_SINGLE_Controller@ACTION_updateBasic')->name('handouts_SINGLE-ACTION_updateBasic');
+	Route::get('SUB_dashboard', 'handouts_SINGLE_Controller@SUB_dashboard')->name('handouts_SINGLE-SUB_dashboard');
+});
+
 // --- admin: bdt_devices --- //
 Route::prefix('/bdt_devices')->group(function () {
 	Route::get('', 'bdt_devices_Controller@index')->name('bdt_devices-index');