edit settings
authorKilian Saffran <ksaffran@dks.lu>
Sun, 24 Feb 2019 21:26:52 +0000 (22:26 +0100)
committerKilian Saffran <ksaffran@dks.lu>
Sun, 24 Feb 2019 21:26:52 +0000 (22:26 +0100)
js/mainapp.js
modules/invoices/form_invoice.js
modules/invoices/index.html
modules/settings/form_datastore.js
modules/settings/index.html
modules/settings/index.js
modules/settings/lib/datastore.js
modules/settings/lib/emailtemplate.js [new file with mode: 0644]
modules/settings/lib/printtemplate.js [new file with mode: 0644]

index c20f490..145c9d6 100644 (file)
@@ -41,6 +41,9 @@ var browserapp = {
       $("#globaldatasets").append('<option value="'+ds[i]+'">'+prop.name+'</option>');
     }
   },
+  currentdataset: function(){
+    return  $("#globaldatasets :selected").val();
+  },
   loaddataset: function(){
     var gdset = $("#globaldatasets :selected").val();
     if (gdset == ""){
index 21bffa5..e98ccbc 100644 (file)
@@ -5,7 +5,7 @@ function initpage(){
         branding: false,
         menubar:false,
         statusbar: false,
-        plugins: 'searchreplace autolink directionality visualblocks visualchars advlist lists textcolor colorpicker textpattern',
+        plugins: 'searchreplace autolink directionality visualblocks visualchars advlist lists textpattern',
         toolbar: 'bold italic underline strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify  | numlist bullist outdent indent  | removeformat',
         image_advtab: true,
            language: 'de',
index 2a40eb3..f6c0642 100644 (file)
@@ -40,7 +40,7 @@
                 <th data-sortable="true">Sender</th>
                 <th data-sortable="true">Referenz</th>
                 <th data-sortable="true">Status</th>
-                <th data-sortable="true" data-align="right" data-width="100">Betrag</th>
+                <th data-sortable="true" data-align="right">Betrag</th>
         <tfoot></tfoot>
         <tbody></tbody>
     </table>
index 6bd237f..8aaa4ea 100644 (file)
@@ -1,6 +1,14 @@
 function initpage(){
     console.log("ID:" + mpref.cfg.id);
     if (mpref.cfg.id){
+        loadform();
+    }
+}
 
+function loadform(){
+    var pref = parent.usersystem.getPreference(mpref.cfg.id);
+    console.log(pref);
+    for (var i in pref){
+        $("#" + i).val(pref[i]);
     }
 }
index bf73115..205c241 100644 (file)
               </nav>
     <div class="cotainer-fluid" style="margin-top: 52px;">            
     <!-- <button class="btn btn-secondary" onclick="parent.usersystem.showError('MyError','My Error Message from settings!');">Show Error</button> -->
-    <table class="table table-bordered table-hover table-striped" id="tbl_databases">
+    <table class="table table-bordered table-hover table-striped" id="tbl_datasets">
         <thead class="thead-dark">
           <tr>
             <th data-checkbox="true"></th>
             <th data-sortable="true">Name</th>
             <th data-sortable="true">Database</th>
             <th data-sortable="true">Server</th>
-            <th data-sortable="true">Filepath</th>
             <th data-sortable="true">Type</th>
             <th data-sortable="true">VPN</th>
-            <th data-sortable="true">Verbunden</th>
+            <th>Verbunden</th>
           </tr>
         </thead>
+        <tfoot></tfoot>
+        <tbody></tbody>
       </table>
     </div>
 <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
index 543d6ec..3bc9e74 100644 (file)
@@ -1,4 +1,71 @@
+var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
+var tblh = winh-54;
+
 function initpage(){
     console.log(parent.usersystem.getsysinfo());
+    loadtable();
     //parent.usersystem.setProperty("testproperty",{id:"TEST"});
-}
\ No newline at end of file
+}
+
+function loadtable(){
+
+    var connected=parent.browserapp.currentdataset();
+
+    var localds = parent.usersystem.getLocalDataSets();
+    console.log(localds);
+    for (var i in localds){
+      var prop = parent.usersystem.getPreference(localds[i]);
+      console.log("PROP");
+      console.log(connected +"<=>"+ localds[i]);
+      
+      console.log(prop);
+      var row = '<tr id="' + localds[i] + '">' +
+      '<td></td>' +
+      '<td>'+prop.name+'</td>' +
+      '<td>'+prop.dbfile+'</td>' +
+      '<td>'+prop.server+'</td>' +
+      '<td>'+prop.type+'</td>' +
+      '<td>'+prop.vpn+'</td>' +     
+      '<td class="btn-'+ ((localds[i]==connected)?'success':'secondary')+'"></td>'+
+      '</tr>';
+      $("#tbl_datasets").append(row);
+
+      //$("#globaldatasets").append('<option value="'+ds[i]+'">'+prop.name+'</option>');
+    }
+    $('#tbl_datasets').bootstrapTable({
+        pagination: false,
+        search: false,
+        height: tblh,
+        clickToSelect: true
+    });
+}
+
+// function settings_edit(){
+//     var settings_id= getTableSelectionID();
+//     if (settings_id){
+//       parent.browserapp.loadmodulepage('settings','form_datastore',{"id":settings_id});
+//     }
+    
+//   }
+
+function getTableSelectionID(){
+    var sel = $('#tbl_datasets').bootstrapTable('getSelections');
+    var id = null;
+    
+    if (sel){  id=sel[0]._id; }
+    console.log("Selected ID:" + id);
+    return id;
+  }
+  
+  function getTableSelectionIDs(){
+    var sel = $('#tbl_datasets').bootstrapTable('getSelections');
+    var ids = [];
+    if (sel){  
+      for (var s in sel){
+        ids.push(s._id);
+      }
+    }
+    return ids;
+  }
+
+  
\ No newline at end of file
index 22563c3..834821a 100644 (file)
@@ -2,11 +2,12 @@ var datastore = {
     new: function(){
         parent.browserapp.loadmodulepage('settings','form_datastore',{"id":""});
     },
-    edit: function(name){
-        
-    },
-    load: function(name){
-
+    edit: function(){
+        var settings_id= getTableSelectionID();
+        console.log(settings_id);
+        if (settings_id){
+            parent.browserapp.loadmodulepage('settings','form_datastore',{"id":settings_id});
+        }
     },
     delete: function(){
         
diff --git a/modules/settings/lib/emailtemplate.js b/modules/settings/lib/emailtemplate.js
new file mode 100644 (file)
index 0000000..8cbb4ec
--- /dev/null
@@ -0,0 +1,14 @@
+var emailtemplate = {
+  new: function(){
+
+  },
+  edit: function(){
+    
+  },
+  duplicate: function(){
+    
+  },
+  delete: function(){
+    
+  }
+}
\ No newline at end of file
diff --git a/modules/settings/lib/printtemplate.js b/modules/settings/lib/printtemplate.js
new file mode 100644 (file)
index 0000000..6ca67db
--- /dev/null
@@ -0,0 +1,14 @@
+var printtemplate = {
+  new: function(){
+
+  },
+  edit: function(){
+    
+  },
+  duplicate: function(){
+    
+  },
+  delete: function(){
+    
+  }
+}