Explorar el Código

Generator: Remove "Uid", add support for CME > Remove

Vijayakrishnan Krishnan hace 5 años
padre
commit
e39bc66a28

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

@@ -75,6 +75,7 @@ class GenerateTreeCommand extends Command
 
                 $hasAdd = in_array("add", $tokens);
                 $hasView = in_array("view", $tokens);
+                $hasRemove = in_array("remove", $tokens);
 
                 switch($ls) {
 
@@ -102,6 +103,9 @@ class GenerateTreeCommand extends Command
                                 else if(strpos($method, "add_new") === 0) {
                                     $newMethod->type = 'add';
                                 }
+                                else if(strpos($method, "remove") === 0) {
+                                    $newMethod->type = 'remove';
+                                }
                                 $currentMethod = $newMethod;
                             }
                         }
@@ -114,6 +118,7 @@ class GenerateTreeCommand extends Command
                             $currentController->dbTable = $dbTable;
                             $currentController->hasAdd = $hasAdd;
                             $currentController->hasView = $hasView;
+                            $currentController->hasRemove = $hasRemove;
                             $currentController->addMethod("index", "/$line");
                             if(!empty($currentSubController)) {
                                 $currentSubController->save();
@@ -135,7 +140,9 @@ class GenerateTreeCommand extends Command
                         if($line === 'ACTIONS' || $line === 'SUB') {
                             $currentSubType = $line;
                         }
-                        else if (!empty($currentMethod) && strpos($currentMethod->name, 'add_new') === 0) { // this is a field in add_new
+                        else if (!empty($currentMethod) &&
+                            (strpos($currentMethod->name, 'add_new') === 0 ||
+                                $currentMethod->name === 'remove')) { // this is a field in add_new
                             $currentMethod->data[] = $line;
                         }
 
@@ -213,6 +220,7 @@ class GenController {
     public $dbTable = null;
     public $hasAdd = false;
     public $hasView = false;
+    public $hasRemove = false;
     public $sub = false;
     public $parentControllerName = '';
     public $subLinksSaved = false;
@@ -332,6 +340,9 @@ class GenController {
             else if(strpos($method->name, 'add_new') === 0 && $controller->hasAdd) {
                 $this->saveAddNewView($controller, $method);
             }
+            else if($method->name === 'remove' && $controller->hasRemove) {
+                $this->saveAddNewView($controller, $method);
+            }
         }
 
     }
@@ -356,6 +367,12 @@ class GenController {
         $columns = DB::getSchemaBuilder()->getColumnListing($controller->dbTable);
         $ths = [];
         $tds = [];
+        if($controller->hasRemove) {
+            $ths[] = "<th></th>";
+            $tds[] = "<td><a href='/{$controller->name}/remove/<?= \$record->uid ?>'>" .
+                "<i class='fa fa-trash'></i>" .
+                "</a></td>";
+        }
         foreach ($columns as $column) {
             $ths[] = "<th>{$this->snakeToTitleCase($column)}</th>";
             $tds[] = "<td>" .
@@ -600,6 +617,7 @@ class GenController {
         if($dotPos !== FALSE) {
             $display = substr($name, $dotPos + 1);
         }
+        $display = preg_replace('/uid$/i', "", $display);
         $type = "text";
         $options = [];
         if(count($tokens) > 1) {

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

@@ -27,6 +27,12 @@ class care_month_entries_Controller extends Controller
 		return view('pro/care_month_entries/add_new_for_rm', compact('records'));
 	}
 
+	// GET /care_month_entries/remove/{uid}
+	public function remove(Request $request, $uid) {
+		$record = DB::table('care_month_entry')->where('uid', $uid)->first();
+		return view('pro/care_month_entries/remove', compact('record'));
+	}
+
 	// GET /care_month_entries/view/{uid}
 	public function view(Request $request, $uid) {
 		return redirect("/care_month_entries/view/$uid/SUB_dashboard");

+ 3 - 1
generatecv/tree.txt

@@ -224,7 +224,7 @@ PRO
             dashboard
             time_entries
             audit_log
-    care_month_entries|care_month_entry|add|view
+    care_month_entries|care_month_entry|add|view|remove
     care_month_entries/add_new_for_cm:createForCm
         careMonthUid:record:care_month:uid,start_date
         proUid:record:pro:uid,name_display
@@ -245,6 +245,8 @@ PRO
         endingTime:time
         contentText
         contentDetail
+    care_month_entries/remove/{uid}:remove
+        memo
     care_month_entries/view/{uid}
         ACTIONS
             updateContent

+ 1 - 1
resources/views/admin/pro_rates/add_new.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('pro_rates-index')}}">
         <input type="hidden" name="_return" value="{{route('pro_rates-add_new')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Pro Uid</label>
+<label class='control-label'>Pro</label>
 <select class='form-control' name='proUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

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

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('bills-index')}}">
         <input type="hidden" name="_return" value="{{route('bills-add_new_for_note')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Note Uid</label>
+<label class='control-label'>Note</label>
 <select class='form-control' name='noteUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('note')->get(); ?>

+ 2 - 2
resources/views/pro/care_month_entries/add_new_for_cm.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('care_month_entries-index')}}">
         <input type="hidden" name="_return" value="{{route('care_month_entries-add_new_for_cm')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Care Month Uid</label>
+<label class='control-label'>Care Month</label>
 <select class='form-control' name='careMonthUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('care_month')->get(); ?>
@@ -34,7 +34,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Pro Uid</label>
+<label class='control-label'>Pro</label>
 <select class='form-control' name='proUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 2 - 2
resources/views/pro/care_month_entries/add_new_for_rm.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('care_month_entries-index')}}">
         <input type="hidden" name="_return" value="{{route('care_month_entries-add_new_for_rm')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Care Month Uid</label>
+<label class='control-label'>Care Month</label>
 <select class='form-control' name='careMonthUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('care_month')->get(); ?>
@@ -34,7 +34,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Pro Uid</label>
+<label class='control-label'>Pro</label>
 <select class='form-control' name='proUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 2 - 0
resources/views/pro/care_month_entries/index.blade.php

@@ -13,6 +13,7 @@
         <table class="table table-hover text-nowrap">
             <thead>
             <tr>
+<th></th>
 <th>Id</th>
 <th>Created At</th>
 <th>Type</th>
@@ -41,6 +42,7 @@
             <tbody>
             @foreach($records as $record)
                 <tr>
+<td><a href='/care_month_entries/remove/<?= $record->uid ?>'><i class='fa fa-trash'></i></a></td>
 <td><?= $record->id ?></td>
 <td><?= $record->created_at ?></td>
 <td><?= $record->type ?></td>

+ 1 - 1
resources/views/pro/care_months/add_new.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('care_months-index')}}">
         <input type="hidden" name="_return" value="{{route('care_months-add_new')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Client Uid</label>
+<label class='control-label'>Client</label>
 <select class='form-control' name='clientUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('client')->get(); ?>

+ 3 - 3
resources/views/pro/my_clients/add_new.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('my_clients-index')}}">
         <input type="hidden" name="_return" value="{{route('my_clients-add_new')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Team Uid</label>
+<label class='control-label'>Team</label>
 <select class='form-control' name='teamUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('team')->get(); ?>
@@ -34,7 +34,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Mcp Pro Uid</label>
+<label class='control-label'>Mcp Pro</label>
 <select class='form-control' name='mcpProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>
@@ -44,7 +44,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Ally Pro Uid</label>
+<label class='control-label'>Ally Pro</label>
 <select class='form-control' name='allyProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 2 - 2
resources/views/pro/my_clients_SINGLE/ACTION_notesAddNew.blade.php

@@ -20,7 +20,7 @@
         <input type="hidden" name="_return" value="{{route('my_clients_SINGLE-ACTION_notesAddNew', ['uid' => $record->uid])}}">
         <input class='form-control' type='hidden' name='clientUid' value='<?= $record->uid ?>' >
 <div class='form-group mb-3'>
-<label class='control-label'>Hcp Pro Uid</label>
+<label class='control-label'>Hcp Pro</label>
 <select class='form-control' name='hcpProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>
@@ -30,7 +30,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Ally Pro Uid</label>
+<label class='control-label'>Ally Pro</label>
 <select class='form-control' name='allyProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 1 - 1
resources/views/pro/my_clients_SINGLE/ACTION_putAlly.blade.php

@@ -19,7 +19,7 @@
         <input type="hidden" name="_success" value="{{route('my_clients-view', ['uid' => $record->uid])}}">
         <input type="hidden" name="_return" value="{{route('my_clients_SINGLE-ACTION_putAlly', ['uid' => $record->uid])}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Ally Pro Uid</label>
+<label class='control-label'>Ally Pro</label>
 <select class='form-control' name='allyProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 1 - 1
resources/views/pro/my_clients_SINGLE/ACTION_putMcp.blade.php

@@ -19,7 +19,7 @@
         <input type="hidden" name="_success" value="{{route('my_clients-view', ['uid' => $record->uid])}}">
         <input type="hidden" name="_return" value="{{route('my_clients_SINGLE-ACTION_putMcp', ['uid' => $record->uid])}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Mcp Pro Uid</label>
+<label class='control-label'>Mcp Pro</label>
 <select class='form-control' name='mcpProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 1 - 1
resources/views/pro/my_clients_SINGLE/ACTION_putTeam.blade.php

@@ -19,7 +19,7 @@
         <input type="hidden" name="_success" value="{{route('my_clients-view', ['uid' => $record->uid])}}">
         <input type="hidden" name="_return" value="{{route('my_clients_SINGLE-ACTION_putTeam', ['uid' => $record->uid])}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Team Uid</label>
+<label class='control-label'>Team</label>
 <select class='form-control' name='teamUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('team')->get(); ?>

+ 2 - 2
resources/views/pro/my_teams/add_new.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('my_teams-index')}}">
         <input type="hidden" name="_return" value="{{route('my_teams-add_new')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Hcp Pro Uid</label>
+<label class='control-label'>Hcp Pro</label>
 <select class='form-control' name='hcpProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>
@@ -34,7 +34,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Ally Pro Uid</label>
+<label class='control-label'>Ally Pro</label>
 <select class='form-control' name='allyProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 3 - 3
resources/views/pro/notes/add_new.blade.php

@@ -24,7 +24,7 @@
         <input type="hidden" name="_success" value="{{route('notes-index')}}">
         <input type="hidden" name="_return" value="{{route('notes-add_new')}}">
         <div class='form-group mb-3'>
-<label class='control-label'>Client Uid</label>
+<label class='control-label'>Client</label>
 <select class='form-control' name='clientUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('client')->get(); ?>
@@ -34,7 +34,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Hcp Pro Uid</label>
+<label class='control-label'>Hcp Pro</label>
 <select class='form-control' name='hcpProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>
@@ -44,7 +44,7 @@
 </select>
 </div>
 <div class='form-group mb-3'>
-<label class='control-label'>Ally Pro Uid</label>
+<label class='control-label'>Ally Pro</label>
 <select class='form-control' name='allyProUid' >
 <option value=''>-- Select --</option>
 <?php $dbOptions = \Illuminate\Support\Facades\DB::table('pro')->get(); ?>

+ 1 - 0
routes/generated.php

@@ -107,6 +107,7 @@ Route::get('/care_months/view/{uid}/SUB_audit_log', 'care_months_SINGLE_Controll
 Route::get('/care_month_entries', 'care_month_entries_Controller@index')->name('care_month_entries-index');
 Route::get('/care_month_entries/add_new_for_cm', 'care_month_entries_Controller@add_new_for_cm')->name('care_month_entries-add_new_for_cm');
 Route::get('/care_month_entries/add_new_for_rm', 'care_month_entries_Controller@add_new_for_rm')->name('care_month_entries-add_new_for_rm');
+Route::get('/care_month_entries/remove/{uid}', 'care_month_entries_Controller@remove')->name('care_month_entries-remove');
 Route::get('/care_month_entries/view/{uid}', 'care_month_entries_Controller@view')->name('care_month_entries-view');
 
 // --- pro: care_month_entries_SINGLE --- //