Compare commits

...

2 Commits

Author SHA1 Message Date
snipe
37381f6976 @!&(&*^&%&!!!
Signed-off-by: snipe <snipe@snipe.net>
2024-10-15 16:39:09 +01:00
snipe
2ad891cc9c Beginning of drag+drop re-ordering for status labels
Signed-off-by: snipe <snipe@snipe.net>
2024-10-15 14:29:50 +01:00
12 changed files with 2409 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ class StatuslabelsTransformer
{
$array = [
'id' => (int) $statuslabel->id,
'reorder_icon' => '<i class="fas fa-ellipsis-v"></i>',
'name' => e($statuslabel->name),
'type' => $statuslabel->getStatuslabelType(),
'color' => ($statuslabel->color) ? e($statuslabel->color) : null,

View File

@@ -21,6 +21,14 @@ class StatusLabelPresenter extends Presenter
'switchable' => true,
'title' => trans('general.id'),
'visible' => false,
],
[
'field' => 'reorder_icon',
'searchable' => false,
'sortable' => false,
'switchable' => false,
'title' => trans('admin/custom_fields/general.reorder'),
'visible' => true,
], [
'field' => 'name',
'searchable' => true,

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('status_labels', function (Blueprint $table) {
$table->tinyInteger('display_order')->nullable()->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('status_labels', function (Blueprint $table) {
$table->dropColumn('display_order');
});
}
};

6
package-lock.json generated
View File

@@ -35,6 +35,7 @@
"select2": "4.0.13",
"sheetjs": "^2.0.0",
"signature_pad": "^4.2.0",
"tablednd": "^1.0.5",
"tableexport.jquery.plugin": "1.30.0",
"tether": "^1.4.0",
"webpack": "^5.94.0"
@@ -10388,6 +10389,11 @@
"acorn-node": "^1.2.0"
}
},
"node_modules/tablednd": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tablednd/-/tablednd-1.0.5.tgz",
"integrity": "sha512-iC230jusaekjzzAy0jigZLbzb7jKKnW9xiNiZ4W17p7y8AvBYf5KunyrIE3HwL1FhL2VEeogZtjP5VeBeIW4xg=="
},
"node_modules/tableexport.jquery.plugin": {
"version": "1.30.0",
"license": "MIT",

View File

@@ -55,6 +55,7 @@
"select2": "4.0.13",
"sheetjs": "^2.0.0",
"signature_pad": "^4.2.0",
"tablednd": "^1.0.5",
"tableexport.jquery.plugin": "1.30.0",
"tether": "^1.4.0",
"webpack": "^5.94.0"

View File

@@ -2,6 +2,8 @@
.fix-sticky{position:fixed !important;overflow:hidden;z-index:100}.fix-sticky table thead{background:#fff}.fix-sticky table thead.thead-light{background:#e9ecef}.fix-sticky table thead.thead-dark{background:#212529}
.reorder-rows-on-drag-class td{background-color:#eee;box-shadow:6px 4px 5px 1px #555,0 1px 0 #ccc inset,0 -1px 0 #ccc inset;-box-shadow:6px 4px 5px 1px #555,0 1px 0 #ccc inset,0 -1px 0 #ccc inset}.reorder-rows-on-drag-class td:last-child{box-shadow:0 9px 4px -4px #555,0 1px 0 #ccc inset,0 -1px 0 #ccc inset,-1px 0 0 #ccc inset;-box-shadow:0 9px 4px -4px #555,0 1px 0 #ccc inset,0 -1px 0 #ccc inset,-1px 0 0 #ccc inset}
/*
* dragtable
*

File diff suppressed because it is too large Load Diff

View File

@@ -108,8 +108,8 @@
"/css/dist/skins/skin-red.min.css": "/css/dist/skins/skin-red.min.css?id=44bf834f2110504a793dadec132a5898",
"/css/dist/skins/skin-yellow-dark.min.css": "/css/dist/skins/skin-yellow-dark.min.css?id=393aaa7b368b0670fc42434c8cca7dc7",
"/css/dist/skins/skin-yellow.min.css": "/css/dist/skins/skin-yellow.min.css?id=7b315b9612b8fde8f9c5b0ddb6bba690",
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=393d720a0f9aba560094fbc8d3b0c0f0",
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=9a35fafd5eb2a66d108b8b669e84f9e1",
"/js/build/vendor.js": "/js/build/vendor.js?id=5269eb5a6beb74f03387c78938cf17b2",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=6660df122e24940d42d03c06775fec7b",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=bdb65484f5b26ceb5d8ca13331ff2749",
"/js/dist/all.js": "/js/dist/all.js?id=e0a4b1a80b09333a460973137f39eab4"
}

View File

@@ -47,7 +47,6 @@
<!-- drag handle -->
<span class="handle">
<i class="fas fa-ellipsis-v"></i>
<i class="fas fa-ellipsis-v"></i>
</span>
</td>
@endcan

View File

@@ -98,14 +98,52 @@
},
formatNoMatches: function () {
return '{{ trans('table.no_matching_records') }}';
}
},
{{--onDrop: function (table, row) {--}}
{{-- var rows = table.tBodies[0].rows;--}}
{{-- var debugStr = "Row dropped was " + row.id + ". New order: ";--}}
{{-- for (var i = 0; i < rows.length; i++) {--}}
{{-- debugStr += rows[i].id + " ";--}}
{{-- }--}}
{{-- --}}
{{-- $.ajax({--}}
{{-- url: '{{ route('api.reorder') }}',--}}
{{-- type: 'POST',--}}
{{-- data: {--}}
{{-- ids: rows.map(function (row) {--}}
{{-- return row.id;--}}
{{-- })--}}
{{--},--}}
});
});
$(function () {
var debugStr = '';
$('.snipe-table').on('reorder-row.bs.table', function (e, data, row){
console.log('All Data:');
console.log(data);
console.log('Dragged Row Data:');
console.dir(row);
console.log('E:');
console.dir(e);
for (var i = 0; i < data.length; i++) {
debugStr += data[i].id + " ";
}
alert('re-order ID: ' + row.id + ' to ' + debugStr);
});
});
});
// function onReorderDrop (rows, row) {
// var rows = table.tBodies[0].rows;
// var debugStr = "Row dropped was " + row.id + ". New order: ";
// for (var i = 0; i < rows.length; i++) {
// debugStr += rows[i].id + " ";
// }
// }

View File

@@ -24,6 +24,7 @@
<div class="box-body">
<div class="table-responsive">
<table
data-columns="{{ \App\Presenters\StatusLabelPresenter::dataTableLayout() }}"
data-cookie-id-table="statuslabelsTable"
@@ -36,6 +37,8 @@
data-show-export="true"
data-show-fullscreen="true"
data-show-refresh="true"
data-use-row-attr-func="true"
data-reorderable-rows="true"
data-sort-order="asc"
data-sort-name="name"
id="statuslabelsTable"

View File

@@ -103,6 +103,7 @@ mix
[
"./node_modules/bootstrap-table/dist/bootstrap-table.css",
"./node_modules/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.css",
"./node_modules/bootstrap-table/dist/extensions/reorder-rows/bootstrap-table-reorder-rows.css",
"./resources/assets/css/dragtable.css",
],
"public/css/dist/bootstrap-table.css"
@@ -148,8 +149,10 @@ mix
'./node_modules/bootstrap-table/dist/extensions/export/bootstrap-table-export.js',
'./node_modules/bootstrap-table/dist/extensions/cookie/bootstrap-table-cookie.js',
'./node_modules/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.js',
'./node_modules/bootstrap-table/dist/extensions/reorder-rows/bootstrap-table-reorder-rows.js',
'./node_modules/bootstrap-table/dist/extensions/addrbar/bootstrap-table-addrbar.js',
'./resources/assets/js/extensions/jquery.base64.js',
"./node_modules/tablednd/dist/jquery.tablednd.js",
'./node_modules/tableexport.jquery.plugin/tableExport.min.js',
'./node_modules/tableexport.jquery.plugin/libs/jsPDF/jspdf.umd.min.js',
'./resources/assets/js/FileSaver.min.js',