From 84eece8e0655965cde8ba7d0a548f85ccb017e9e Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Thu, 22 Dec 2022 16:23:17 +0300 Subject: [PATCH] draggable development --- package.json | 3 ++- resources/assets/js/mixins/global.js | 1 - resources/assets/js/views/common/documents.js | 26 +++++++++++++++++++ .../documents/form/line-item.blade.php | 8 ++++-- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 72877b2a9..7bd769dc1 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "vue-flatpickr-component": "^8.1.3", "vue-router": "^3.1.3", "vue2-editor": "^2.10.3", - "vue2-transitions": "^0.3.0" + "vue2-transitions": "^0.3.0", + "vuedraggable": "^2.24.3" }, "devDependencies": { "@babel/core": "^7.15.5", diff --git a/resources/assets/js/mixins/global.js b/resources/assets/js/mixins/global.js index c76a5c81e..cc6a9f8fc 100644 --- a/resources/assets/js/mixins/global.js +++ b/resources/assets/js/mixins/global.js @@ -25,7 +25,6 @@ import AkauntingSwitch from './../components/AkauntingSwitch'; import AkauntingSlider from './../components/AkauntingSlider'; import AkauntingColor from './../components/AkauntingColor'; import CardForm from './../components/CreditCard/CardForm'; - import NProgress from 'nprogress'; import 'nprogress/nprogress.css'; import NProgressAxios from './../plugins/nprogress-axios'; diff --git a/resources/assets/js/views/common/documents.js b/resources/assets/js/views/common/documents.js index 2f42857ce..318937156 100644 --- a/resources/assets/js/views/common/documents.js +++ b/resources/assets/js/views/common/documents.js @@ -14,6 +14,7 @@ import Global from './../../mixins/global'; import Form from './../../plugins/form'; import BulkAction from './../../plugins/bulk-action'; +import draggable from 'vuedraggable'; // plugin setup Vue.use(DashboardPlugin); @@ -25,6 +26,10 @@ const app = new Vue({ Global ], + components: { + draggable + }, + data: function () { return { form: new Form('document'), @@ -77,6 +82,7 @@ const app = new Vue({ ], email_template: false, send_to: false, + drag: false } }, @@ -111,6 +117,26 @@ const app = new Vue({ }, methods: { + checkMove(event) { + debugger; + }, + + onStart(event) { + debugger; + }, + + onEnd(event, index) { + this.drag = false; + + let element = this.items[index]; + this.items.splice(index, 1); + this.items.splice(event.newIndex, 0, element); + }, + + log(event) { + debugger; + }, + onRefFocus(ref) { let index = this.form.items.length - 1; diff --git a/resources/views/components/documents/form/line-item.blade.php b/resources/views/components/documents/form/line-item.blade.php index 2180995ab..1eb244aae 100644 --- a/resources/views/components/documents/form/line-item.blade.php +++ b/resources/views/components/documents/form/line-item.blade.php @@ -19,7 +19,12 @@ @stack('move_td_start') - list + +
+ list +
+
+
@stack('move_td_end') @@ -27,7 +32,6 @@ @if (! $hideItems || (! $hideItemName && ! $hideItemDescription)) @stack('name_td_start') - @if (! $hideItemName)