From b2986eb76d61b1a766872ca0245a14716b328707 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Wed, 28 Jun 2017 23:15:40 +0100
Subject: [PATCH] FEAT #5661 start status administration MVC

---
 .../Views/status-administration.component.html      | 13 ++++++++-----
 .../angular/app/status-administration.component.js  |  4 ++--
 .../angular/app/status-administration.component.ts  |  4 ++--
 core/Controllers/StatusController.php               |  4 ++--
 core/Models/LangModelAbstract.php                   |  1 +
 core/Models/StatusModelAbstract.php                 |  4 ++--
 rest/index.php                                      |  2 +-
 7 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/apps/maarch_entreprise/Views/status-administration.component.html b/apps/maarch_entreprise/Views/status-administration.component.html
index 6479d1c286f..1d599282e1b 100644
--- a/apps/maarch_entreprise/Views/status-administration.component.html
+++ b/apps/maarch_entreprise/Views/status-administration.component.html
@@ -28,22 +28,25 @@
 
             <p>
                 <label for="can_be_searched">{{lang.can_be_searched}}</label>
-                <textarea name="can_be_searched" id="can_be_searched" [(ngModel)]="status.can_be_searched" ></textarea>
+                <input type="radio" name="can_be_searched" class="check" value="Y" [(ngModel)]="status.can_be_searched">Oui    
+                <input type="radio" name="can_be_searched" class="check" value="N" [(ngModel)]="status.can_be_searched">Non
             </p>
 
             <p>
                 <label for="can_be_modified">{{lang.can_be_modified}}</label>
-                <textarea name="can_be_modified" id="can_be_modified" [(ngModel)]="status.can_be_modified" ></textarea>
+                <input type="radio" name="can_be_modified" class="check" value="Y" [(ngModel)]="status.can_be_modified"checked="checked">Oui    
+                <input type="radio" name="can_be_modified" class="check" value="N" [(ngModel)]="status.can_be_modified">Non 
             </p>
 
             <p>
                 <label for="is_folder_status">{{lang.is_folder_status}}</label>
-                <textarea name="is_folder_status" id="is_folder_status" [(ngModel)]="status.is_folder_status" ></textarea>
+                <input type="radio" name="is_folder_status" class="check" value="Y" [(ngModel)]="status.is_folder_status">Oui                    
+                <input type="radio" name="is_folder_status" class="check" value="N" [(ngModel)]="status.is_folder_status">Non
             </p>            
 
             <p>
-                <label for="img_related">{{lang.img_related}}</label>
-                <textarea name="img_related" id="img_related" [(ngModel)]="status.img_related" ></textarea>
+                <label for="img_filename">{{lang.img_related}}</label>
+                <textarea name="img_filename" id="img_filename" [(ngModel)]="status.img_filename" ></textarea>
             </p>
 
             <p class="button" style="text-align:center">
diff --git a/apps/maarch_entreprise/js/angular/app/status-administration.component.js b/apps/maarch_entreprise/js/angular/app/status-administration.component.js
index df076dc31de..1d47c4ebaea 100644
--- a/apps/maarch_entreprise/js/angular/app/status-administration.component.js
+++ b/apps/maarch_entreprise/js/angular/app/status-administration.component.js
@@ -22,11 +22,11 @@ var StatusAdministrationComponent = (function () {
         this.mode = null;
         this.status = {
             id: null,
-            description: null,
+            label_status: null,
             can_be_searched: null,
             can_be_modified: null,
             is_folder_status: null,
-            img_related: null
+            img_filename: null
         };
         this.lang = "";
         this.resultInfo = "";
diff --git a/apps/maarch_entreprise/js/angular/app/status-administration.component.ts b/apps/maarch_entreprise/js/angular/app/status-administration.component.ts
index 758294261ce..18600f83de2 100644
--- a/apps/maarch_entreprise/js/angular/app/status-administration.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/status-administration.component.ts
@@ -18,11 +18,11 @@ export class StatusAdministrationComponent implements OnInit {
     type            : string;
     status   : any   = {
         id              : null,
-        description     : null,
+        label_status     : null,
         can_be_searched : null,
         can_be_modified : null,
         is_folder_status : null,
-        img_related     : null
+        img_filename     : null
     };
     paramDateTemp   : string;
     lang        : any = "";
diff --git a/core/Controllers/StatusController.php b/core/Controllers/StatusController.php
index c83795ecc95..17733144188 100644
--- a/core/Controllers/StatusController.php
+++ b/core/Controllers/StatusController.php
@@ -73,7 +73,7 @@ class StatusController
                 ->withJson(['errors' => $errors]);
         }
 
-        $aArgs = $request->getQueryParams();
+        $aArgs = $request->getParams();
 
         $return = StatusModel::create($aArgs);
 
@@ -107,7 +107,7 @@ class StatusController
                 ->withJson(['errors' => $errors]);
         }
 
-        $aArgs = $request->getQueryParams();
+        $aArgs = $request->getParams();
 
         $return = StatusModel::update($aArgs);
 
diff --git a/core/Models/LangModelAbstract.php b/core/Models/LangModelAbstract.php
index 4a8e7cc5dd1..888d7e276ea 100644
--- a/core/Models/LangModelAbstract.php
+++ b/core/Models/LangModelAbstract.php
@@ -170,6 +170,7 @@ class LangModelAbstract
             'yes'              => _YES,
             'no'               => _NO,
             'modify_status'    => _MODIFY_STATUS,
+            'deleteConfirm'    => _REALLY_DELETE,
         ];
         return $aLang;
     }
diff --git a/core/Models/StatusModelAbstract.php b/core/Models/StatusModelAbstract.php
index 33aa6c7306a..608453954ff 100644
--- a/core/Models/StatusModelAbstract.php
+++ b/core/Models/StatusModelAbstract.php
@@ -22,7 +22,7 @@ class StatusModelAbstract extends \Apps_Table_Service
     public static function getList()
     {
         $aReturn = static::select([
-            'select'    => '*',
+            'select'    => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
             'table'     => ['status'],
         ]);
 
@@ -88,4 +88,4 @@ class StatusModelAbstract extends \Apps_Table_Service
 
         return $aReturn;
     }
-}
+}
\ No newline at end of file
diff --git a/rest/index.php b/rest/index.php
index a91c109e65b..0e8ddfde943 100644
--- a/rest/index.php
+++ b/rest/index.php
@@ -109,7 +109,7 @@ $app->get('/administration/status', \Core\Controllers\StatusController::class .
 $app->get('/status/lang', \Core\Controllers\StatusController::class . ':getLang');
 $app->get('/status/{id}', \Core\Controllers\StatusController::class . ':getById');
 $app->post('/status', \Core\Controllers\StatusController::class . ':create');
-$app->put('/status', \Core\Controllers\StatusController::class . ':update');
+$app->put('/status/{id}', \Core\Controllers\StatusController::class . ':update');
 $app->delete('/status/{id}', \Core\Controllers\StatusController::class . ':delete');
 
 //docserver
-- 
GitLab