Browse Source

:construction: wip

jqh 5 years ago
parent
commit
2911876386

+ 33 - 0
resources/assets/dcat/js/extensions/Ajax.js

@@ -10,6 +10,39 @@ export default class Ajax {
     }
 
     init(Dcat) {
+        $.get = function (url, data, success, dataType) {
+            let options = {
+                type: 'GET',
+                url: url,
+            };
+
+            if (typeof data === 'function') {
+                dataType = success;
+                success = data;
+                data = null
+            }
+
+            if (typeof success === 'function') {
+                options.success = success;
+            }
+
+            if (typeof data === 'object') {
+                options.data = data
+            }
+
+            if (dataType) {
+                options.dataType = dataType;
+            }
+
+            return $.ajax(options)
+        };
+
+        $.post = function (options) {
+            options.type = 'POST';
+
+            return $.ajax(options);
+        };
+
         $.delete = function (options) {
             options.type = 'POST';
             options.data = {_method: 'DELETE'};

+ 5 - 1
resources/assets/dcat/sass/components/_custom-data-table.scss

@@ -84,6 +84,10 @@ table.custom-data-table tbody tr {
   background: $white;
 }
 
+table.data-table {
+  border-collapse: separate !important;
+}
+
 table.custom-data-table.data-table thead th {
   //padding: .714rem 1.785rem;
   padding: 0.714rem .51rem;
@@ -136,7 +140,7 @@ table.custom-data-table.data-table tbody td {
   //padding: 1.357rem;
   border: none;
   vertical-align: middle;
-  height: 46px;
+  height: $table-td-height;
   padding: .55rem;
   line-height: 1.42857;
 }

+ 12 - 17
resources/assets/dcat/sass/components/_table.scss

@@ -92,11 +92,11 @@ table.table-bordered.data-table th:last-child, table.table-bordered.data-table t
 }
 
 table.data-table.complex-headers {
-  border: 1px solid $table-border-color;
+  border: 1px solid $table-border-color-darker;
 }
 table.data-table.complex-headers thead th, table.data-table.complex-headers thead td, table.data-table.complex-headers tfoot th, table.data-table.complex-headers tfoot td {
-  border-bottom: 1px solid $table-border-color;
-  border-right: 1px solid $table-border-color;
+  border-bottom: 1px solid $table-border-color-darker;
+  border-right: 1px solid $table-border-color-darker;
 }
 
 .data-table.table-bordered:not(.complex-headers) thead th {
@@ -126,8 +126,8 @@ table.table-bordered.data-table.complex-headers {
     border-radius: 0;
 
     td {
-      border-bottom: 1px solid lighten($table-border-color, 4%);
-      border-right: 1px solid lighten($table-border-color, 4%);
+      border-bottom: 1px solid lighten($table-border-color-darker, 4%);
+      border-right: 1px solid lighten($table-border-color-darker, 4%);
     }
 
     td:first-child {
@@ -176,6 +176,7 @@ table.table-bordered.data-table.complex-headers {
 
 
 $table-border-color: #eff3f8;
+$table-bg: darken(#f7f7f9, 3.8%);
 
 .table-collapse {
   .custom-data-table.data-table tbody tr td:first-child {
@@ -202,24 +203,21 @@ $table-border-color: #eff3f8;
   }
 
   .table.custom-data-table {
-    padding: 3px 7px 7px;
+    padding: 3px 5px 5px;
   }
 
   .table-fixed-left .table.custom-data-table {
-    padding: 3px 0 0 7px;
+    padding: 3px 0 0 5px;
   }
   .table-fixed-right .table.custom-data-table {
-    padding: 3px 7px 0 0;
+    padding: 3px 5px 0 0;
   }
   .table-fixed th {
-    background: darken(#f7f7f9, 3.5%);
+    background: $table-bg;
   }
 }
 
 
-//$table-bg: darken(#f7f7f9, 3.5%);
-$table-bg: $white;
-
 body:not(.dark-mode) {
   .table-collapse {
     box-shadow: $shadow;
@@ -232,23 +230,20 @@ body:not(.dark-mode) {
       //border-collapse:collapse!important;
       margin-top: 0!important;
       background-color: $table-bg;
-      border: 1px solid #e1e4e8;
       //border-radius: $card-border-radius;
     }
 
     table.custom-data-table thead th {
       //border-top: 1px solid $table-border-color;
       //border-bottom: 2px solid $table-border-color;
-      height: 36px;
+      height: 42px;
       vertical-align: middle;
-      border-top: 1px solid #e1e4e8;
-      border-bottom: 1px solid #e1e4e8;
       //background: $white;
     }
 
     .custom-data-table tbody td {
       border-top: 1px solid $table-border-color;
-      height: 45px;
+      height: $table-td-height;
     }
 
     .custom-data-table tbody tr:first-child td {

+ 3 - 1
resources/assets/dcat/sass/theme/_colors.scss

@@ -119,4 +119,6 @@ $input-border-color: darken(#e4eaec, 3%);
 $divider-color: #f4f4f4;
 
 //$table-border-color: darken(#f1f1f1, 5%);
-$table-border-color: #f0f0f0;
+$table-border-color: #f0f0f0;
+$table-border-color-darker: #e4e4e4;
+$table-td-height: 60px;

+ 1 - 1
resources/views/grid/table.blade.php

@@ -9,7 +9,7 @@
 
     {!! $grid->renderHeader() !!}
 
-    <div class="table-responsive table-collapse table-wrapper complex-container table-middle mt-1">
+    <div class="table-responsive {{ $grid->option('table_collapse') ? 'table-collapse' : '' }} table-wrapper complex-container table-middle mt-1">
         <table class="{{ $grid->formatTableClass() }}" id="{{ $tableId }}" >
             <thead>
             @if ($headers = $grid->getComplexHeaders())

+ 1 - 1
src/Grid.php

@@ -180,7 +180,7 @@ class Grid
         'show_toolbar'           => true,
         'create_mode'            => self::CREATE_MODE_DEFAULT,
         'dialog_form_area'       => ['700px', '670px'],
-        'table_class'            => ['table', 'custom-data-table'],
+        'table_class'            => ['table', 'custom-data-table', 'data-table'],
     ];
 
     /**

+ 2 - 5
src/Grid/Displayers/Editable.php

@@ -78,9 +78,7 @@ $('.{$this->selector}+.save').on("click",function() {
 
     value = tmp.text().replace(new RegExp("<br>","g"), '').replace(new RegExp("&nbsp;","g"), '').trim();
     
-    var data = {
-        _method: 'PUT'
-    };
+    var data = {};
     if (name.indexOf('.') === -1) {
         data[name] = value;
     } else {
@@ -91,9 +89,8 @@ $('.{$this->selector}+.save').on("click",function() {
     }
     
     Dcat.NP.start();
-    $.ajax({
+    $.put({
         url: url,
-        type: "POST",
         data: data,
         success: function (data) {
             if (data.status) {

+ 0 - 1
src/Grid/Tools/QuickCreate.php

@@ -357,7 +357,6 @@ class QuickCreate implements Renderable
             success: function(data) {
                 ctr.attr('submitting', '');
                 btn.buttonLoading(false);
-                console.info(data);
                 
                 if (data.status == true) {
                     Dcat.success(data.message);