Browse Source

fixed note heading editing

Josh 4 years ago
parent
commit
304178dca7

+ 24 - 0
app/Http/Controllers/note_template_section_templates_Controller.php

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

+ 33 - 0
app/Http/Controllers/note_template_section_templates_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 note_template_section_templates_SINGLE_Controller extends Controller
+{
+    public $selfName = 'note_template_section_templates_SINGLE_Controller';
+    public $dashboardName = 'dashboard';
+
+	// GET /note_template_section_templates/view/{uid}/ACTION_updateHeading
+	public function ACTION_updateHeading(Request $request, $uid) {
+		$record = DB::table('note_template_section_template')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('note_template_section_template')->where('id', $uid)->first();
+			if($record) return redirect('/note_template_section_templates/view/' . $record->uid . '/ACTION_updateHeading');
+		}
+		return response()->view('admin/note_template_section_templates_SINGLE/ACTION_updateHeading', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+
+	// GET /note_template_section_templates/view/{uid}/SUB_dashboard
+	public function SUB_dashboard(Request $request, $uid) {
+		$record = DB::table('note_template_section_template')->where('uid', $uid)->first();
+		if(!$record) {
+			$record = DB::table('note_template_section_template')->where('id', $uid)->first();
+			if($record) return redirect('/note_template_section_templates/view/' . $record->uid . '/SUB_dashboard');
+		}
+		return response()->view('admin/note_template_section_templates_SINGLE/SUB_dashboard', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+	}
+}

+ 7 - 0
generatecv/tree.txt

@@ -1597,3 +1597,10 @@ ADMIN
             remove
         SUB
             dashboard
+    note_template_section_templates|note_template_section_template|view|icon:check
+    note_template_section_templates/view/{uid}
+        ACTIONS
+            updateHeading
+                heading=heading
+        SUB
+            dashboard

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

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

+ 46 - 0
resources/views/admin/note_template_section_templates/index.blade.php

@@ -0,0 +1,46 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <h3 class="d-flex my-3 px-3 stag-heading stag-heading-index">
+        <div>Note Template Section Templates: List</div>
+        <div class="ml-auto">
+            <!-- _ADD_NEW_LINK_ -->
+        </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>Created At</th>
+<th>Type</th>
+<th>Position Index</th>
+<th>Created By Session Id</th>
+<th>Note Template Id</th>
+<th>Section Template Id</th>
+<th>Detail Json</th>
+<th>Is Removable</th>
+<th>Heading</th>
+            </tr>
+            </thead>
+            <tbody>
+            @foreach($records as $record)
+                <tr>
+<td><a href="/note_template_section_templates/view/<?= $record->uid ?>"><i class="fas fa-share-square"></i></a></td>
+<td><?= friendly_date_time($record->created_at) ?></td>
+<td><?= $record->type ?></td>
+<td><?= $record->position_index ?></td>
+<td><?= $record->created_by_session_id ?></td>
+<td><?= $record->note_template_id ?></td>
+<td><?= $record->section_template_id ?></td>
+<td><?= $record->detail_json ?></td>
+<td><?= $record->is_removable ?></td>
+<td><?= $record->heading ?></td>
+                </tr>
+            @endforeach
+            </tbody>
+        </table>
+    </div>
+
+@endsection

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

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

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

@@ -0,0 +1 @@
+<a href='/note_template_section_templates/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/note_template_section_templates/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/note_template_section_templates/info')</div>
+        <div class="d-flex align-items-stretch">
+            <div class="inner-side-nav">
+                <div class="border-right h-100">
+                    @include('admin/note_template_section_templates/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

+ 41 - 0
resources/views/admin/note_template_section_templates_SINGLE/ACTION_updateHeading.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.note_template_section_templates.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 Heading</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/noteTemplateSectionTemplate/updateHeading">
+        <input type="hidden" name="_success" value="{{route('note_template_section_templates-view', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('note_template_section_templates_SINGLE-ACTION_updateHeading', ['uid' => $record->uid])}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Heading </label>
+<input class='form-control' type='text' name='heading' value='{{ old('heading') ? old('heading') : $record->heading }}' >
+</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('note_template_section_templates-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/note_template_section_templates_SINGLE/SUB_dashboard.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.note_template_section_templates.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/note_template_section_templates/actions')
+        </div>
+    </div>
+</div>
+
+
+@endsection

+ 41 - 0
resources/views/admin/pro_text_shortcuts_SINGLE/ACTION_updateHeading.blade.php

@@ -0,0 +1,41 @@
+@extends('admin.pro_text_shortcuts.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 Heading</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/proTextShortcut/updateHeading">
+        <input type="hidden" name="_success" value="{{route('pro_text_shortcuts-view', ['uid' => $record->uid])}}">
+        <input type="hidden" name="_return" value="{{route('pro_text_shortcuts_SINGLE-ACTION_updateHeading', ['uid' => $record->uid])}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Heading </label>
+<input class='form-control' type='text' name='heading' value='{{ old('heading') ? old('heading') : $record->heading }}' >
+</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('pro_text_shortcuts-view', ['uid' => $record->uid])}}" class="btn btn-sm btn-default px-5" up-close>Cancel</a>
+        </div>
+    </form>
+
+    </div></div>
+
+@endsection

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

@@ -298,3 +298,10 @@
 		<p>Pro Text Shortcuts</p>
 	</a>
 </li>
+
+<li class='nav-item'>
+	<a href='/note_template_section_templates' class='nav-link {{ (isset(request()->route()->getController()->selfName) && strpos(request()->route()->getController()->selfName, 'note_template_section_templates') === 0 ? 'active' : '') }} '>
+		<i class='nav-icon fa fa-check'></i>
+		<p>Note Template Section Templates</p>
+	</a>
+</li>

+ 17 - 5
routes/generated.php

@@ -760,6 +760,13 @@ Route::prefix('/pro_teams/view/{uid}')->group(function () {
 	Route::get('SUB_dashboard', 'pro_teams_SINGLE_Controller@SUB_dashboard')->name('pro_teams_SINGLE-SUB_dashboard');
 });
 
+// --- admin: pro_text_shortcuts --- //
+Route::prefix('/pro_text_shortcuts')->group(function () {
+	Route::get('', 'pro_text_shortcuts_Controller@index')->name('pro_text_shortcuts-index');
+	Route::get('add_new', 'pro_text_shortcuts_Controller@add_new')->name('pro_text_shortcuts-add_new');
+	Route::get('view/{uid}', 'pro_text_shortcuts_Controller@view')->name('pro_text_shortcuts-view');
+});
+
 // --- admin: pro_text_shortcuts_SINGLE --- //
 Route::prefix('/pro_text_shortcuts/view/{uid}')->group(function () {
 	Route::get('ACTION_update', 'pro_text_shortcuts_SINGLE_Controller@ACTION_update')->name('pro_text_shortcuts_SINGLE-ACTION_update');
@@ -767,9 +774,14 @@ Route::prefix('/pro_text_shortcuts/view/{uid}')->group(function () {
 	Route::get('SUB_dashboard', 'pro_text_shortcuts_SINGLE_Controller@SUB_dashboard')->name('pro_text_shortcuts_SINGLE-SUB_dashboard');
 });
 
-// --- admin: pro_text_shortcuts --- //
-Route::prefix('/pro_text_shortcuts')->group(function () {
-	Route::get('', 'pro_text_shortcuts_Controller@index')->name('pro_text_shortcuts-index');
-	Route::get('add_new', 'pro_text_shortcuts_Controller@add_new')->name('pro_text_shortcuts-add_new');
-	Route::get('view/{uid}', 'pro_text_shortcuts_Controller@view')->name('pro_text_shortcuts-view');
+// --- admin: note_template_section_templates_SINGLE --- //
+Route::prefix('/note_template_section_templates/view/{uid}')->group(function () {
+	Route::get('ACTION_updateHeading', 'note_template_section_templates_SINGLE_Controller@ACTION_updateHeading')->name('note_template_section_templates_SINGLE-ACTION_updateHeading');
+	Route::get('SUB_dashboard', 'note_template_section_templates_SINGLE_Controller@SUB_dashboard')->name('note_template_section_templates_SINGLE-SUB_dashboard');
+});
+
+// --- admin: note_template_section_templates --- //
+Route::prefix('/note_template_section_templates')->group(function () {
+	Route::get('', 'note_template_section_templates_Controller@index')->name('note_template_section_templates-index');
+	Route::get('view/{uid}', 'note_template_section_templates_Controller@view')->name('note_template_section_templates-view');
 });