Эх сурвалжийг харах

Generate view for bill > createForNote

Vijayakrishnan Krishnan 5 жил өмнө
parent
commit
9051363562

+ 7 - 1
app/Console/Commands/GenerateTreeCommand.php

@@ -83,8 +83,13 @@ class GenerateTreeCommand extends Command
                         // top level controller-action
                         if(strpos($line, "/") !== FALSE) {
                             if(!empty($currentController)) {
+                                $parts = explode(":", $line);
+                                $line = $parts[0];
                                 $method = explode("/", $line)[1];
                                 $newMethod = $currentController->addMethod($method, "/" . $line);
+                                if(count($parts) > 1) {
+                                    $newMethod->api = $parts[count($parts) - 1];
+                                }
                                 // create _SINGLE_ controller if view
                                 if($method === "view") {
                                     $currentSubController = new GenController($currentRoot, $currentController->name . "_SINGLE");
@@ -510,7 +515,7 @@ class GenController {
     {
         $text = file_get_contents(base_path('generatecv/tree-templates/add_new.template.blade.php'));
         $text = str_replace("_NAME_", $this->snakeToTitleCase($controller->name), $text);
-        $text = str_replace("_API_", "/api/{$this->snakeToCamelCase($controller->dbTable)}/create", $text);
+        $text = str_replace("_API_", "/api/{$this->snakeToCamelCase($controller->dbTable)}/{$method->api}", $text);
         $text = str_replace("_BACK_ROUTE_", "{$controller->name}-index", $text);
         $text = str_replace("_RETURN_ROUTE_", "{$controller->name}-add_new", $text);
         $columns = $method->data;
@@ -660,6 +665,7 @@ class GenControllerMethod {
     public $parentSub = false;
     public $childAddRoute = false;
     public $table = false;
+    public $api = 'create';
     public function __construct($name, $route)
     {
         $this->name = $name;

+ 6 - 0
app/Http/Controllers/bills_Controller.php

@@ -15,6 +15,12 @@ class bills_Controller extends Controller
 		return view('pro/bills/index', compact('records'));
 	}
 
+	// GET /bills/add_new
+	public function add_new(Request $request) {
+		$records = DB::table('bill')->get();
+		return view('pro/bills/add_new', compact('records'));
+	}
+
 	// GET /bills/view/{uid}
 	public function view(Request $request, $uid) {
 		return redirect("/bills/view/$uid/SUB_dashboard");

+ 12 - 1
generatecv/tree.txt

@@ -238,7 +238,18 @@ PRO
                 endingTime
         SUB
             dashboard
-    bills|bill|view
+    bills|bill|add|view
+    bills/add_new:createForNote
+        noteUid:record:note:uid,uid
+        effectiveDate:date
+        code
+        reason1
+        reason2
+        reason3
+        reason3Plus
+        serviceLocation
+        modifier
+        numberOfUnits:number
     bills/view/{uid}
         ACTIONS
             payHcpAmount

+ 78 - 0
resources/views/pro/bills/add_new.blade.php

@@ -0,0 +1,78 @@
+@extends('layouts.pro-logged-in')
+@section('content')
+
+    <h2 class="d-flex mb-3">
+        <div>Bills: Add New</div>
+        <div class="ml-auto">
+            <a class="btn btn-primary btn-sm" href="{{route('bills-index')}}">
+                <i class="fa fa-chevron-left" aria-hidden="true"></i>
+                Back
+            </a>
+        </div>
+    </h2>
+
+    <form action="/post-to-api"
+          method="post" enctype="multipart/form-data"
+          class="bg-light rounded border px-3 pt-3 mb-3">
+        @csrf
+
+        @if (session('message'))
+            <div class="alert alert-danger">{{ session('message') }}</div>
+        @endif
+
+        <input type="hidden" name="_api" value="/api/bill/createForNote">
+        <input type="hidden" name="_success" value="{{route('bills-index')}}">
+        <input type="hidden" name="_return" value="{{route('bills-add_new')}}">
+        <div class='form-group mb-3'>
+<label class='control-label'>Note Uid</label>
+<select class='form-control' name='noteUid' >
+<option value=''>-- Select --</option>
+<?php $dbOptions = \Illuminate\Support\Facades\DB::table('note')->get(); ?>
+<?php foreach($dbOptions as $o): ?>
+<option value='<?= $o->uid ?>'><?= $o->uid ?> (<?= $o->uid ?>)</option>
+<?php endforeach; ?>
+</select>
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Effective Date</label>
+<input class='form-control' type='date' name='effectiveDate' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Code</label>
+<input class='form-control' type='text' name='code' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Reason 1</label>
+<input class='form-control' type='text' name='reason1' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Reason 2</label>
+<input class='form-control' type='text' name='reason2' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Reason 3</label>
+<input class='form-control' type='text' name='reason3' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Reason 3Plus</label>
+<input class='form-control' type='text' name='reason3Plus' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Service Location</label>
+<input class='form-control' type='text' name='serviceLocation' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Modifier</label>
+<input class='form-control' type='text' name='modifier' >
+</div>
+<div class='form-group mb-3'>
+<label class='control-label'>Number Of Units</label>
+<input class='form-control' type='number' name='numberOfUnits' >
+</div>
+        <div class="form-group mb-3">
+            <button class="btn btn-sm btn-primary mr-3 px-5">Submit</button>
+            <a href="{{route('bills-index')}}" class="btn btn-sm btn-default px-5">Cancel</a>
+        </div>
+    </form>
+
+@endsection

+ 1 - 1
resources/views/pro/bills/index.blade.php

@@ -4,7 +4,7 @@
     <h2 class="d-flex mb-3">
         <div>Bills: List</div>
         <div class="ml-auto">
-            <!-- _ADD_NEW_LINK_ -->
+            <a class='btn btn-primary btn-sm' href='/bills/add_new'><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New</a>
         </div>
     </h2>
 

+ 1 - 0
routes/generated.php

@@ -114,6 +114,7 @@ Route::get('/care_month_entries/view/{uid}/SUB_dashboard', 'care_month_entries_S
 
 // --- pro: bills --- //
 Route::get('/bills', 'bills_Controller@index')->name('bills-index');
+Route::get('/bills/add_new', 'bills_Controller@add_new')->name('bills-add_new');
 Route::get('/bills/view/{uid}', 'bills_Controller@view')->name('bills-view');
 
 // --- pro: bills_SINGLE --- //