From 7fe285c65a0a23d132469df4f9e79c324352c548 Mon Sep 17 00:00:00 2001
From: Marty Fabien <fabien_marty@yahoo.fr>
Date: Wed, 18 Dec 2019 10:31:16 +0000
Subject: [PATCH] dashboard junk

---
 conf/Gruntfile.js                             |   4 +-
 conf/requires/config.js                       |   4 +-
 .../module/component/dashboard/dashboard.html |  20 +
 .../module/component/dashboard/dashboard.js   | 380 ++++++++++++++++++
 .../module/component/dashboard/dashboard.less |   3 +
 .../module/index_dashboard.html               |   1 +
 .../module/javascript/script_module.js        |   1 +
 .../module/less/main.less                     |   5 +
 8 files changed, 415 insertions(+), 3 deletions(-)
 create mode 100644 src/module_suivi_prod_immo/module/component/dashboard/dashboard.html
 create mode 100644 src/module_suivi_prod_immo/module/component/dashboard/dashboard.js
 create mode 100644 src/module_suivi_prod_immo/module/component/dashboard/dashboard.less
 create mode 100644 src/module_suivi_prod_immo/module/index_dashboard.html
 create mode 100644 src/module_suivi_prod_immo/module/less/main.less

diff --git a/conf/Gruntfile.js b/conf/Gruntfile.js
index d30c6c9d..ac08d3b0 100755
--- a/conf/Gruntfile.js
+++ b/conf/Gruntfile.js
@@ -43,7 +43,7 @@ module.exports = function (grunt) {
                         sHome + 'modules/vm4ms/javascript/**/*.js',
                         // Fichiers ANC
                         sHome + 'modules/anc/javascript/**/*.js',
-                        sHome + 'modules/suivi_prod_immo/javascript/**/*.js'
+                        sHome + 'modules/suivi_prod_immo/**/*.js'
                     ]
                 },
                 options: {
@@ -126,7 +126,7 @@ module.exports = function (grunt) {
                     '"' + sHome + 'modules/vm4ms/javascript ' + sClosureDepsHome + 'modules/vm4ms/javascript"',
                     // Fichiers vMap4MapServer
                     '"' + sHome + 'modules/anc/javascript ' + sClosureDepsHome + 'modules/anc/javascript"',
-                    '"' + sHome + 'modules/suivi_prod_immo/javascript ' + sClosureDepsHome + 'modules/suivi_prod_immo/javascript"',
+                    '"' + sHome + 'modules/suivi_prod_immo ' + sClosureDepsHome + 'modules/suivi_prod_immo"',
                     // Closure library
                     '"' + sHome + 'conf/node_modules/google-closure-library/closure/goog ' + sClosureDepsHome + 'conf/node_modules/google-closure-library/closure/goog"'
                 ]
diff --git a/conf/requires/config.js b/conf/requires/config.js
index 5f087772..a76b12e0 100755
--- a/conf/requires/config.js
+++ b/conf/requires/config.js
@@ -38,7 +38,9 @@ var oApplicationFiles = {
         'css/lib/jquery/plugins/bootstrap-treeview/bootstrap-treeview.min.css',
         'css/lib/jquery/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css',
         'css/lib/jquery/plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css',
-        'css/lib/viewer/viewer.min.css'
+        'css/lib/viewer/viewer.min.css',
+        // Urbalyon
+        'modules/suivi_prod_immo/less/main.less'
     ],
     'css_mobile': [
         // Vitis
diff --git a/src/module_suivi_prod_immo/module/component/dashboard/dashboard.html b/src/module_suivi_prod_immo/module/component/dashboard/dashboard.html
new file mode 100644
index 00000000..865b1666
--- /dev/null
+++ b/src/module_suivi_prod_immo/module/component/dashboard/dashboard.html
@@ -0,0 +1,20 @@
+<!--<input ng-model="city_show" type="text">
+<select ng-options="city as city.label for city in citys track by city.id" ng-model="city_show"></select>
+<div ng-repeat="user in users"  ng-if="user.city==city_show.id">
+    
+<div ng-repeat="user in users" ng-if="user.city==city_show">
+    <div ng-style="{'background-color': user.color ? user.color : 'green'}" ng-repeat="(key, value) in user">{{key}} : {{value}}</div>
+    <div class="user" ng-repeat="(key, value) in user">{{key}} : {{value}}</div>
+</div>-->
+
+
+<div id="select_display_form_reader" app-form-reader app-form-definition="formCity" app-form-definition-name="'insert'"
+    app-form-values="formCityValues"> </div>
+<div ng-repeat="city in citys">
+    <div class="user" ng-repeat="(key, value) in city">{{key}} : {{value}}</div>
+    <input type="button" value="Edit" ng-click="getUpdateForm(city)">
+    <div ng-if="city.updateForm">
+        <div app-form-reader app-form-definition="city.updateForm.forDef"
+            app-form-definition-name="city.updateForm.formName" app-form-values="city.updateForm.formValues"> </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/src/module_suivi_prod_immo/module/component/dashboard/dashboard.js b/src/module_suivi_prod_immo/module/component/dashboard/dashboard.js
new file mode 100644
index 00000000..59c33c28
--- /dev/null
+++ b/src/module_suivi_prod_immo/module/component/dashboard/dashboard.js
@@ -0,0 +1,380 @@
+goog.provide('vmap.suivi_prod_immo.dashboard');
+
+console.log('urbalyon Dashboard');
+
+/**
+ * Dashboard Directive
+ *
+ * @return {angular.Directive} The directive specs.
+ * @export
+ * @constructor
+ */
+vitisApp.dashboardDirective = function () {
+  // vitisApp.broadcast('dashboardDirectiveLoaded');
+  return {
+    restrict: 'A',
+    templateUrl: 'modules/suivi_prod_immo/component/dashboard/dashboard.html',
+    link: function (scope, element, attrs) {
+      scope.getUpdateForm = function (city) {
+        city.updateForm = {
+          formValues: {
+            display: {},
+            update: {},
+            insert: {}
+          },
+          formDef: scope.formCity,
+          formName: 'update'
+        };
+      };
+      scope.citys = [{ id: 1, label: 'Lyon' }, { id: 2, label: 'Perpignan' }, { id: 3, label: 'Bordeaux' }];
+      /*scope.city_show=scope.citys[0];
+      scope.users=[
+          {"name":'fabien', "city":1, "color":'red'},
+          {"name":'armand', "city":2, "color":'yellow'},
+          {"name":'nicolas', "city":3}
+      ];*/
+      scope.formCityValues = {
+        display: {},
+        update: {},
+        insert: {}
+      };
+      scope.formCity = {
+        "display": {
+          "name": "custom-form",
+          "title": "veremes_commune_point",
+          "input_size": "xxs",
+          "nb_cols": 12,
+          "javascript": false,
+          "rows": [
+            {
+              "fields": [
+                {
+                  "type": "label",
+                  "name": "code",
+                  "label": "Code INSEE",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "code_1_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "label",
+                  "name": "nom",
+                  "label": "Nom de la commune",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "nom_2_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "label",
+                  "pattern": "[-+]?(\\d*[.])?\\d+",
+                  "name": "pop90",
+                  "label": "Population en 1990",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "pop90_3_1"
+                }
+              ]
+            }
+          ],
+          "tabs": {
+            "position": "top",
+            "list": [
+              {
+                "label": "Tab 0",
+                "elements": [
+                  "code",
+                  "nom",
+                  "pop90"
+                ]
+              }
+            ]
+          }
+        },
+        "search": {
+          "name": "custom-form",
+          "title": "veremes_commune_point",
+          "input_size": "xxs",
+          "nb_cols": 12,
+          "javascript": false,
+          "rows": [
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "nom",
+                  "label": "Nom de la commune",
+                  "required": false,
+                  "pattern": "",
+                  "nb_cols": 4,
+                  "id": "Element_0_2_1"
+                },
+                {
+                  "type": "text",
+                  "name": "code",
+                  "label": "Code INSEE",
+                  "required": false,
+                  "pattern": "",
+                  "nb_cols": 4,
+                  "id": "Element_0_1_1"
+                },
+                {
+                  "type": "text",
+                  "name": "pop90",
+                  "label": "Population en 1990",
+                  "required": false,
+                  "pattern": "",
+                  "nb_cols": 4,
+                  "id": "Element_0_3_1"
+                }
+              ]
+            }
+          ],
+          "tabs": {
+            "position": "top",
+            "list": [
+              {
+                "label": "Tab 0",
+                "elements": [
+                  "code",
+                  "nom",
+                  "pop90"
+                ]
+              }
+            ]
+          }
+        },
+        "insert": {
+          "name": "custom-form",
+          "title": "veremes_commune_point",
+          "input_size": "xxs",
+          "nb_cols": 12,
+          "javascript": false,
+          "event": function (oValues) {
+            console.log(oValues);
+            scope.citys.push({ id: oValues.update.id, label: oValues.update.label });
+            //alert(oValues.nom);
+          },
+          "rows": [
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "code",
+                  "label": "Code INSEE",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "code_1_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "nom",
+                  "label": "Nom de la commune",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "nom_2_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "pattern": "[-+]?(\\d*[.])?\\d+",
+                  "name": "pop90",
+                  "label": "Population en 1990",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "pop90_3_1"
+                }
+              ]
+            }
+          ],
+          "tabs": {
+            "position": "top",
+            "list": [
+              {
+                "label": "Tab 0",
+                "elements": [
+                  "code",
+                  "nom",
+                  "pop90"
+                ]
+              }
+            ]
+          }
+        },
+        "update": {
+          "name": "custom-form",
+          "title": "veremes_commune_point",
+          "input_size": "xxs",
+          "nb_cols": 12,
+          "javascript": false,
+          "rows": [
+            {
+              "fields": [
+                {
+                  "type": "label",
+                  "name": "code",
+                  "label": "Code INSEE",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "code_1_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "label",
+                  "label": "Nom de la commune",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "nom_2_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "id",
+                  "label": "Identifiant",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "pop90_3_1"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "info",
+                  "label": "Info",
+                  "required": false,
+                  "nb_cols": 12,
+                  "id": "Element_1_1576580650627",
+                  "dynamic_event_type": "focus",
+                  "dynamic_event_function": "getData()"
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "button",
+                  "name": "Element_0",
+                  "nb_cols": 12,
+                  "id": "Element_0_1576578099615",
+                  "class": "btn-ungroup btn-group-sm",
+                  "buttons": [
+                    {
+                      "type": "submit",
+                      "name": "form_submit",
+                      "label": "FORM_UPDATE",
+                      "class": "btn-primary"
+                    }
+                  ]
+                }
+              ]
+            }
+          ],
+          "tabs": {
+            "position": "top",
+            "list": [
+              {
+                "label": "Tab 0",
+                "elements": [
+                  "label",
+                  "id",
+                  "Element_0"
+                ]
+              }
+            ]
+          }
+        },
+        "datasources": {},
+        "multi-update": {
+          "name": "custom-form",
+          "title": "Commune",
+          "input_size": "xxs",
+          "nb_cols": 12,
+          "javascript": false,
+          "rows": [
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "code",
+                  "label": "code",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "nom",
+                  "label": "nom",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "integer",
+                  "name": "pop90",
+                  "label": "pop90",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12
+                }
+              ]
+            },
+            {
+              "fields": [
+                {
+                  "type": "text",
+                  "name": "geom",
+                  "label": "geom",
+                  "disabled": false,
+                  "required": false,
+                  "nb_cols": 12
+                }
+              ]
+            }
+          ]
+        }
+      };
+    }
+  };
+};
+vitisApp.module.directive("appDashboard", vitisApp.dashboardDirective);
diff --git a/src/module_suivi_prod_immo/module/component/dashboard/dashboard.less b/src/module_suivi_prod_immo/module/component/dashboard/dashboard.less
new file mode 100644
index 00000000..7072f05a
--- /dev/null
+++ b/src/module_suivi_prod_immo/module/component/dashboard/dashboard.less
@@ -0,0 +1,3 @@
+.user{
+    font-size: large;
+}
\ No newline at end of file
diff --git a/src/module_suivi_prod_immo/module/index_dashboard.html b/src/module_suivi_prod_immo/module/index_dashboard.html
new file mode 100644
index 00000000..79f7b8de
--- /dev/null
+++ b/src/module_suivi_prod_immo/module/index_dashboard.html
@@ -0,0 +1 @@
+<div app-dashboard id="app-dashboard"></div>
\ No newline at end of file
diff --git a/src/module_suivi_prod_immo/module/javascript/script_module.js b/src/module_suivi_prod_immo/module/javascript/script_module.js
index c11531c3..2e67c539 100644
--- a/src/module_suivi_prod_immo/module/javascript/script_module.js
+++ b/src/module_suivi_prod_immo/module/javascript/script_module.js
@@ -2,6 +2,7 @@
 
 'use strict';
 goog.provide('vmap.suivi_prod_immo.script_module');
+goog.require('vmap.suivi_prod_immo.dashboard');
 vitisApp.on('appMainDrtvLoaded', function () {
 
     /**
diff --git a/src/module_suivi_prod_immo/module/less/main.less b/src/module_suivi_prod_immo/module/less/main.less
new file mode 100644
index 00000000..dc471d48
--- /dev/null
+++ b/src/module_suivi_prod_immo/module/less/main.less
@@ -0,0 +1,5 @@
+@import '../component/dashboard/dashboard.less';
+
+.icon-suivi_prod_immo_dashboard:before {
+    content: 'h';
+}
\ No newline at end of file
-- 
GitLab