2020-02-18 11:49:28 +03:00
|
|
|
import Vue from 'vue';
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
import axios from 'axios';
|
|
|
|
|
2021-01-18 11:23:17 +03:00
|
|
|
import AkauntingDropzoneFileUpload from './../components/AkauntingDropzoneFileUpload';
|
2020-12-24 01:28:38 +03:00
|
|
|
import AkauntingContactCard from './../components/AkauntingContactCard';
|
|
|
|
import AkauntingCompanyEdit from './../components/AkauntingCompanyEdit';
|
|
|
|
import AkauntingEditItemColumns from './../components/AkauntingEditItemColumns';
|
|
|
|
import AkauntingItemButton from './../components/AkauntingItemButton';
|
2022-06-01 10:15:55 +03:00
|
|
|
import AkauntingDocumentButton from './../components/AkauntingDocumentButton';
|
2019-11-16 10:21:14 +03:00
|
|
|
import AkauntingSearch from './../components/AkauntingSearch';
|
|
|
|
import AkauntingModal from './../components/AkauntingModal';
|
2020-02-09 19:03:26 +03:00
|
|
|
import AkauntingMoney from './../components/AkauntingMoney';
|
2020-01-29 12:34:51 +03:00
|
|
|
import AkauntingModalAddNew from './../components/AkauntingModalAddNew';
|
2022-06-01 10:15:55 +03:00
|
|
|
import AkauntingRadioGroup from './../components/AkauntingRadioGroup';
|
2019-11-16 10:21:14 +03:00
|
|
|
import AkauntingSelect from './../components/AkauntingSelect';
|
2020-01-20 17:48:46 +03:00
|
|
|
import AkauntingSelectRemote from './../components/AkauntingSelectRemote';
|
2019-11-16 10:21:14 +03:00
|
|
|
import AkauntingDate from './../components/AkauntingDate';
|
|
|
|
import AkauntingRecurring from './../components/AkauntingRecurring';
|
2020-03-10 17:43:19 +03:00
|
|
|
import AkauntingHtmlEditor from './../components/AkauntingHtmlEditor';
|
2020-08-26 17:28:46 +03:00
|
|
|
import AkauntingCountdown from './../components/AkauntingCountdown';
|
2020-12-29 21:55:21 +03:00
|
|
|
import AkauntingCurrencyConversion from './../components/AkauntingCurrencyConversion';
|
2022-06-01 10:15:55 +03:00
|
|
|
import AkauntingConnectTransactions from './../components/AkauntingConnectTransactions';
|
|
|
|
import AkauntingSwitch from './../components/AkauntingSwitch';
|
|
|
|
import AkauntingSlider from './../components/AkauntingSlider';
|
|
|
|
import AkauntingColor from './../components/AkauntingColor';
|
2023-07-25 18:09:06 +03:00
|
|
|
import AkauntingImport from './../components/AkauntingImport';
|
2022-06-22 16:23:01 +03:00
|
|
|
import CardForm from './../components/CreditCard/CardForm';
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
import NProgress from 'nprogress';
|
|
|
|
import 'nprogress/nprogress.css';
|
|
|
|
import NProgressAxios from './../plugins/nprogress-axios';
|
|
|
|
|
2020-03-10 17:43:19 +03:00
|
|
|
import { Select, Option, Steps, Step, Button, Link, Tooltip, ColorPicker } from 'element-ui';
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-02-03 12:21:22 +03:00
|
|
|
import Form from './../plugins/form';
|
2022-06-01 10:15:55 +03:00
|
|
|
import Swiper, { Navigation, Pagination } from 'swiper';
|
|
|
|
import GLightbox from 'glightbox';
|
|
|
|
|
|
|
|
Swiper.use([Navigation, Pagination]);
|
2020-02-03 12:21:22 +03:00
|
|
|
|
2022-11-21 16:26:13 +03:00
|
|
|
import Bugsnag from './../exceptions/trackers/bugsnag';
|
|
|
|
import Sentry from './../exceptions/trackers/sentry';
|
2022-11-09 13:20:16 +03:00
|
|
|
|
2022-11-21 16:26:13 +03:00
|
|
|
// Exception Tracket start here!!s
|
|
|
|
if (typeof exception_tracker != 'undefined') {
|
|
|
|
switch (exception_tracker.channel) {
|
|
|
|
case 'bugsnag':
|
|
|
|
Vue.use(Bugsnag);
|
|
|
|
break;
|
|
|
|
case 'sentry':
|
|
|
|
Vue.use(Sentry);
|
|
|
|
break;
|
|
|
|
}
|
2022-11-09 16:27:00 +03:00
|
|
|
}
|
2022-11-09 13:20:16 +03:00
|
|
|
|
2022-11-09 15:10:38 +03:00
|
|
|
var BreakException = {};
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
export default {
|
|
|
|
components: {
|
2021-01-18 11:23:17 +03:00
|
|
|
AkauntingDropzoneFileUpload,
|
2020-12-24 01:28:38 +03:00
|
|
|
AkauntingContactCard,
|
|
|
|
AkauntingCompanyEdit,
|
|
|
|
AkauntingEditItemColumns,
|
|
|
|
AkauntingItemButton,
|
2022-06-01 10:15:55 +03:00
|
|
|
AkauntingDocumentButton,
|
2019-11-16 10:21:14 +03:00
|
|
|
AkauntingSearch,
|
|
|
|
AkauntingRadioGroup,
|
|
|
|
AkauntingSelect,
|
2020-01-20 17:48:46 +03:00
|
|
|
AkauntingSelectRemote,
|
2020-02-09 19:03:26 +03:00
|
|
|
AkauntingMoney,
|
2019-11-16 10:21:14 +03:00
|
|
|
AkauntingModal,
|
2020-01-29 12:34:51 +03:00
|
|
|
AkauntingModalAddNew,
|
2019-11-16 10:21:14 +03:00
|
|
|
AkauntingDate,
|
|
|
|
AkauntingRecurring,
|
2020-03-10 17:43:19 +03:00
|
|
|
AkauntingHtmlEditor,
|
2020-08-26 17:28:46 +03:00
|
|
|
AkauntingCountdown,
|
2020-12-29 21:55:21 +03:00
|
|
|
AkauntingCurrencyConversion,
|
2022-06-01 10:15:55 +03:00
|
|
|
AkauntingConnectTransactions,
|
|
|
|
AkauntingSwitch,
|
|
|
|
AkauntingSlider,
|
|
|
|
AkauntingColor,
|
2023-07-25 18:09:06 +03:00
|
|
|
AkauntingImport,
|
2022-06-22 16:23:01 +03:00
|
|
|
CardForm,
|
2019-11-16 10:21:14 +03:00
|
|
|
[Select.name]: Select,
|
2020-01-29 12:34:51 +03:00
|
|
|
[Option.name]: Option,
|
|
|
|
[Steps.name]: Steps,
|
|
|
|
[Step.name]: Step,
|
|
|
|
[Button.name]: Button,
|
2020-02-10 20:41:00 +03:00
|
|
|
[Link.name]: Link,
|
2020-02-12 16:09:44 +03:00
|
|
|
[Tooltip.name]: Tooltip,
|
2020-03-10 17:43:19 +03:00
|
|
|
[ColorPicker.name]: ColorPicker,
|
2019-11-16 10:21:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
2020-01-29 12:34:51 +03:00
|
|
|
component: '',
|
2021-01-18 11:23:17 +03:00
|
|
|
currency: {
|
|
|
|
"name":"US Dollar",
|
|
|
|
"code":"USD",
|
|
|
|
"rate":1,
|
|
|
|
"precision":2,
|
|
|
|
"symbol":"$",
|
|
|
|
"symbol_first":1,
|
|
|
|
"decimal_mark":".",
|
|
|
|
"thousands_separator":",",
|
2021-01-19 17:52:22 +03:00
|
|
|
},
|
2021-03-18 11:43:10 +03:00
|
|
|
all_currencies: [],
|
2022-06-16 12:27:19 +03:00
|
|
|
connect: {
|
|
|
|
show: false,
|
|
|
|
currency: {},
|
|
|
|
documents: [],
|
|
|
|
},
|
2022-06-22 16:23:01 +03:00
|
|
|
|
|
|
|
cardData: {
|
|
|
|
cardName: '',
|
|
|
|
cardNumber: '',
|
|
|
|
cardMonth: '',
|
|
|
|
cardYear: '',
|
|
|
|
cardCvv: '',
|
|
|
|
storeCard: false,
|
|
|
|
card_id: 0,
|
|
|
|
},
|
2022-12-19 11:36:23 +03:00
|
|
|
|
|
|
|
min_date: false,
|
|
|
|
item_name_input: false,
|
|
|
|
price_name_input: false,
|
|
|
|
quantity_name_input: false,
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
directives: {
|
2020-02-09 19:03:26 +03:00
|
|
|
//money: VMoney
|
2019-11-16 10:21:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
this.checkNotify();
|
2020-07-23 11:04:25 +03:00
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
GLightbox({
|
|
|
|
touchNavigation: true,
|
|
|
|
loop: false,
|
|
|
|
autoplayVideos: false,
|
|
|
|
selector: ".glightbox-video",
|
|
|
|
plyr: {
|
|
|
|
config: {
|
|
|
|
ratio: '16:9', // or '4:3'
|
|
|
|
muted: false,
|
|
|
|
hideControls: true,
|
|
|
|
youtube: {
|
|
|
|
noCookie: true,
|
|
|
|
rel: 0,
|
|
|
|
showinfo: 0,
|
|
|
|
iv_load_policy: 3
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2020-07-23 11:04:25 +03:00
|
|
|
if (aka_currency) {
|
|
|
|
this.currency = aka_currency;
|
|
|
|
}
|
2021-03-18 11:43:10 +03:00
|
|
|
|
|
|
|
if (typeof all_currencies !== 'undefined' && all_currencies) {
|
|
|
|
this.all_currencies = all_currencies;
|
|
|
|
}
|
2022-06-01 10:15:55 +03:00
|
|
|
|
|
|
|
GLightbox({
|
|
|
|
touchNavigation: true,
|
|
|
|
loop: false,
|
|
|
|
autoplayVideos: false,
|
|
|
|
selector: ".glightbox"
|
|
|
|
});
|
|
|
|
|
|
|
|
new Swiper(".swiper-container", {
|
|
|
|
loop: false,
|
|
|
|
slidesPerView: 2,
|
|
|
|
pagination: {
|
|
|
|
el: ".swiper-pagination",
|
|
|
|
clickable: true
|
|
|
|
},
|
|
|
|
navigation: {
|
|
|
|
nextEl: ".swiper-button-next",
|
|
|
|
prevEl: ".swiper-button-prev",
|
|
|
|
},
|
|
|
|
});
|
2022-11-03 18:41:39 +03:00
|
|
|
|
|
|
|
//swiper slider for long tabs items
|
|
|
|
for (let [index, item] of document.querySelectorAll('[data-swiper]').entries()) {
|
2022-11-24 16:59:04 +03:00
|
|
|
if (item.clientWidth < item.querySelector('[data-tabs-swiper-wrapper]').clientWidth && ! item.querySelector('[data-tabs-swiper-wrapper]').getAttribute('data-disable-slider', true)) {
|
2022-11-07 15:20:16 +03:00
|
|
|
let initial_slide = 0;
|
|
|
|
let hash_split = window.location.hash.split('#')[1];
|
2022-11-09 15:10:38 +03:00
|
|
|
let loop = 0;
|
|
|
|
let slides_view;
|
|
|
|
|
|
|
|
try {
|
|
|
|
item.querySelectorAll('[data-tabs-slide]').forEach((slide, index, arr) => {
|
|
|
|
loop += slide.clientWidth;
|
2022-11-04 14:23:53 +03:00
|
|
|
|
2022-11-09 15:10:38 +03:00
|
|
|
slide.classList.add('swiper-slide');
|
|
|
|
|
|
|
|
if (slide.getAttribute('data-tabs') == hash_split) {
|
|
|
|
initial_slide = index;
|
|
|
|
}
|
2022-11-04 14:23:53 +03:00
|
|
|
|
2022-11-09 15:10:38 +03:00
|
|
|
if (loop > item.clientWidth) {
|
|
|
|
slides_view = index;
|
|
|
|
throw BreakException;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
if (e !== BreakException) throw e;
|
|
|
|
}
|
|
|
|
|
2022-11-07 15:20:16 +03:00
|
|
|
item.querySelector('[data-tabs-swiper]').classList.add('swiper', 'swiper-links');
|
|
|
|
item.querySelector('[data-tabs-swiper-wrapper]').classList.add('swiper-wrapper');
|
2022-11-04 14:23:53 +03:00
|
|
|
|
2022-11-07 15:20:16 +03:00
|
|
|
let html = `
|
|
|
|
<div class="swiper-tabs-container">
|
|
|
|
${item.querySelector('[data-tabs-swiper]').innerHTML}
|
|
|
|
</div>
|
2022-11-04 14:23:53 +03:00
|
|
|
|
2022-11-10 14:21:11 +03:00
|
|
|
<div class="swiper-button-next bg-body text-white flex items-center justify-center right-0">
|
2022-11-07 15:20:16 +03:00
|
|
|
<span class="material-icons text-purple text-4xl">chevron_right</span>
|
|
|
|
</div>
|
2022-11-10 14:21:11 +03:00
|
|
|
<div class="swiper-button-prev bg-body text-white flex items-center justify-center left-0">
|
2022-11-07 15:20:16 +03:00
|
|
|
<span class="material-icons text-purple text-4xl">chevron_left</span>
|
|
|
|
</div>
|
|
|
|
`;
|
2022-11-04 14:23:53 +03:00
|
|
|
|
2022-11-09 15:10:38 +03:00
|
|
|
item.querySelector('[data-tabs-swiper]').innerHTML = html;
|
2022-11-09 15:16:13 +03:00
|
|
|
slides_view = Number(item.getAttribute('data-swiper')) != 0 ? Number(item.getAttribute('data-swiper')) : slides_view;
|
2022-11-10 14:28:20 +03:00
|
|
|
item.setAttribute('data-swiper', slides_view);
|
|
|
|
|
|
|
|
new Swiper(item.querySelector('.swiper-tabs-container'), {
|
2022-11-10 14:21:11 +03:00
|
|
|
loop: true,
|
2022-11-09 15:16:13 +03:00
|
|
|
slidesPerView: slides_view,
|
2022-11-07 15:20:16 +03:00
|
|
|
pagination: {
|
|
|
|
el: '.swiper-pagination',
|
|
|
|
clickable: true
|
|
|
|
},
|
|
|
|
navigation: {
|
|
|
|
nextEl: '.swiper-button-next',
|
|
|
|
prevEl: '.swiper-button-prev',
|
|
|
|
},
|
|
|
|
initialSlide: initial_slide,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
item.removeAttribute('data-swiper');
|
|
|
|
item.querySelector('[data-tabs-swiper]').removeAttribute('data-tabs-swiper');
|
|
|
|
item.querySelector('[data-tabs-swiper-wrapper]').removeAttribute('data-tabs-swiper-wrapper');
|
2022-11-04 14:23:53 +03:00
|
|
|
|
2022-11-07 15:20:16 +03:00
|
|
|
item.querySelectorAll('[data-tabs-slide]').forEach((slide) => {
|
|
|
|
slide.removeAttribute('data-tabs-slide');
|
|
|
|
});
|
2022-11-03 18:41:39 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//swiper slider for long tabs items
|
2019-11-16 10:21:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
// Check Default set notify > store / update action
|
|
|
|
checkNotify: function () {
|
2022-06-01 10:15:55 +03:00
|
|
|
if (! flash_notification) {
|
2019-11-16 10:21:14 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
flash_notification.forEach(notify => {
|
|
|
|
let type = notify.level;
|
2021-02-11 17:09:31 +03:00
|
|
|
let timeout = 5000;
|
|
|
|
|
|
|
|
if (notify.important) {
|
|
|
|
timeout = 0;
|
|
|
|
}
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
this.$notify({
|
2023-05-23 17:44:28 +03:00
|
|
|
verticalAlign: 'bottom',
|
|
|
|
horizontalAlign: 'left',
|
2019-11-16 10:21:14 +03:00
|
|
|
message: notify.message,
|
2021-02-11 17:09:31 +03:00
|
|
|
timeout: timeout,
|
2022-06-01 10:15:55 +03:00
|
|
|
icon: 'error_outline',
|
2019-11-16 10:21:14 +03:00
|
|
|
type
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// Form Submit
|
|
|
|
onSubmit() {
|
|
|
|
this.form.submit();
|
|
|
|
},
|
|
|
|
|
2021-11-05 19:16:04 +03:00
|
|
|
// Form Async Submit
|
|
|
|
async onAsyncSubmit() {
|
|
|
|
await this.form.asyncSubmit();
|
|
|
|
},
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
onHandleFileUpload(key, event) {
|
|
|
|
this.form[key] = '';
|
|
|
|
this.form[key] = event.target.files[0];
|
|
|
|
},
|
|
|
|
|
|
|
|
// Bulk Action Select all
|
2022-06-01 10:15:55 +03:00
|
|
|
onSelectAllBulkAction() {
|
2019-11-16 10:21:14 +03:00
|
|
|
this.bulk_action.selectAll();
|
|
|
|
},
|
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
// Bulk Action Checkbox checked/ unchecked
|
|
|
|
onSelectBulkAction() {
|
2019-11-16 10:21:14 +03:00
|
|
|
this.bulk_action.select();
|
|
|
|
},
|
|
|
|
|
|
|
|
// Bulk Action use selected Change
|
2022-06-01 10:15:55 +03:00
|
|
|
onChangeBulkAction(type) {
|
|
|
|
this.bulk_action.change(type);
|
|
|
|
|
|
|
|
if (this.bulk_action.message.length) {
|
|
|
|
this.bulk_action.modal=true;
|
|
|
|
} else {
|
|
|
|
this.onActionBulkAction();
|
|
|
|
}
|
2019-11-16 10:21:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// Bulk Action use selected Action
|
2022-06-01 10:15:55 +03:00
|
|
|
onActionBulkAction() {
|
2019-11-16 10:21:14 +03:00
|
|
|
this.bulk_action.action();
|
|
|
|
},
|
|
|
|
|
|
|
|
// Bulk Action modal cancel
|
2022-06-01 10:15:55 +03:00
|
|
|
onCancelBulkAction() {
|
2019-11-16 10:21:14 +03:00
|
|
|
this.bulk_action.modal = false;
|
2022-10-19 15:55:20 +03:00
|
|
|
|
|
|
|
let documentClasses = document.body.classList;
|
2022-12-13 10:57:11 +03:00
|
|
|
documentClasses.remove('overflow-y-hidden', 'overflow-overlay');
|
2019-11-16 10:21:14 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// Bulk Action Clear selected items
|
2022-06-01 10:15:55 +03:00
|
|
|
onClearBulkAction() {
|
2019-11-16 10:21:14 +03:00
|
|
|
this.bulk_action.modal = false;
|
|
|
|
|
|
|
|
this.bulk_action.clear();
|
|
|
|
},
|
|
|
|
|
|
|
|
// List Enabled column status changes
|
2022-06-01 10:15:55 +03:00
|
|
|
onStatusBulkAction(item_id, event) {
|
2019-11-16 10:21:14 +03:00
|
|
|
this.bulk_action.status(item_id, event, this.$notify);
|
|
|
|
},
|
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
onDeleteViaConfirmation(delete_id) {
|
|
|
|
let action = document.getElementById(delete_id).getAttribute('data-action');
|
|
|
|
let title = document.getElementById(delete_id).getAttribute('data-title');
|
|
|
|
let message = document.getElementById(delete_id).getAttribute('data-message');
|
|
|
|
let button_cancel = document.getElementById(delete_id).getAttribute('data-cancel');
|
|
|
|
let button_delete = document.getElementById(delete_id).getAttribute('data-delete');
|
|
|
|
|
|
|
|
this.confirmDelete(action, title, message, button_cancel, button_delete);
|
|
|
|
},
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
// Actions > Delete
|
|
|
|
confirmDelete(url, title, message, button_cancel, button_delete) {
|
2020-02-09 13:10:26 +03:00
|
|
|
let confirm = {
|
|
|
|
url: url,
|
|
|
|
title: title,
|
|
|
|
message: message,
|
|
|
|
button_cancel: button_cancel,
|
|
|
|
button_delete: button_delete,
|
|
|
|
show: true
|
|
|
|
};
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
2020-08-22 16:07:36 +03:00
|
|
|
template : '<div id="dynamic-delete-component"><akaunting-modal v-if="confirm.show" :show="confirm.show" :title="confirm.title" :message="confirm.message" :button_cancel="confirm.button_cancel" :button_delete="confirm.button_delete" @confirm="onDelete" @cancel="cancelDelete"></akaunting-modal></div>',
|
2020-02-09 13:10:26 +03:00
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingModal,
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
confirm: confirm,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
// Delete action post
|
|
|
|
async onDelete() {
|
|
|
|
let promise = Promise.resolve(axios({
|
|
|
|
method: 'DELETE',
|
|
|
|
url: this.confirm.url,
|
|
|
|
}));
|
|
|
|
|
|
|
|
promise.then(response => {
|
|
|
|
if (response.data.redirect) {
|
|
|
|
window.location.href = response.data.redirect;
|
|
|
|
}
|
2021-05-20 15:18:43 +03:00
|
|
|
|
|
|
|
this.$emit('deleted', response.data);
|
2020-02-09 13:10:26 +03:00
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.success = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// Close modal empty default value
|
|
|
|
cancelDelete() {
|
|
|
|
this.confirm.show = false;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
2019-11-16 10:21:14 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// Change bank account get money and currency rate
|
|
|
|
onChangeAccount(account_id) {
|
2022-06-01 10:15:55 +03:00
|
|
|
if (! account_id) {
|
2021-03-18 11:43:10 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
axios.get(url + '/banking/accounts/currency', {
|
|
|
|
params: {
|
|
|
|
account_id: account_id
|
|
|
|
}
|
2022-06-01 10:15:55 +03:00
|
|
|
})
|
2019-11-16 10:21:14 +03:00
|
|
|
.then(response => {
|
2020-06-04 22:21:37 +03:00
|
|
|
this.currency = response.data;
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
this.form.currency_code = response.data.currency_code;
|
|
|
|
this.form.currency_rate = response.data.currency_rate;
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
});
|
2019-12-16 17:22:34 +03:00
|
|
|
},
|
|
|
|
|
2020-02-29 11:40:33 +03:00
|
|
|
// Change currency get money
|
|
|
|
onChangeCurrency(currency_code) {
|
2022-06-01 10:15:55 +03:00
|
|
|
if (! currency_code) {
|
2021-03-18 11:43:10 +03:00
|
|
|
return;
|
|
|
|
}
|
2020-02-29 11:40:33 +03:00
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
if (! this.all_currencies.length) {
|
2021-03-18 11:43:10 +03:00
|
|
|
let currency_promise = Promise.resolve(window.axios.get((url + '/settings/currencies')));
|
|
|
|
|
|
|
|
currency_promise.then(response => {
|
2022-06-01 10:15:55 +03:00
|
|
|
if (response.data.success) {
|
2021-03-18 11:43:10 +03:00
|
|
|
this.all_currencies = response.data.data;
|
|
|
|
}
|
2022-06-01 10:15:55 +03:00
|
|
|
|
|
|
|
this.all_currencies.forEach(function (currency, index) {
|
|
|
|
if (currency_code == currency.code) {
|
|
|
|
this.currency = currency;
|
|
|
|
|
|
|
|
this.form.currency_code = currency.code;
|
|
|
|
this.form.currency_rate = currency.rate;
|
|
|
|
}
|
|
|
|
}, this);
|
2021-03-18 11:43:10 +03:00
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.onChangeCurrency(currency_code);
|
|
|
|
});
|
2022-06-01 10:15:55 +03:00
|
|
|
} else {
|
|
|
|
this.all_currencies.forEach(function (currency, index) {
|
|
|
|
if (currency_code == currency.code) {
|
|
|
|
this.currency = currency;
|
2021-03-18 11:43:10 +03:00
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
this.form.currency_code = currency.code;
|
|
|
|
this.form.currency_rate = currency.rate;
|
|
|
|
}
|
|
|
|
}, this);
|
|
|
|
}
|
2020-02-29 11:40:33 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// Pages limit change
|
2019-12-16 17:22:34 +03:00
|
|
|
onChangePaginationLimit(event) {
|
|
|
|
let path = '';
|
|
|
|
|
2023-06-01 11:11:38 +03:00
|
|
|
let split_href = window.location.href.split('#');
|
|
|
|
let href = split_href[0];
|
|
|
|
|
2019-12-16 17:22:34 +03:00
|
|
|
if (window.location.search.length) {
|
|
|
|
if (window.location.search.includes('limit')) {
|
|
|
|
let queries = [];
|
|
|
|
let query = window.location.search;
|
|
|
|
|
|
|
|
query = query.replace('?', '');
|
|
|
|
queries = query.split('&');
|
|
|
|
|
|
|
|
path = window.location.origin + window.location.pathname;
|
|
|
|
|
|
|
|
queries.forEach(function (_query, index) {
|
|
|
|
let query_partials = _query.split('=');
|
|
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
path += '?'
|
|
|
|
} else {
|
|
|
|
path += '&';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (query_partials[0] == 'limit') {
|
2022-06-01 10:15:55 +03:00
|
|
|
path += 'limit=' + event.target.getAttribute("value");
|
2019-12-16 17:22:34 +03:00
|
|
|
} else {
|
|
|
|
path += query_partials[0] + '=' + query_partials[1];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
2023-06-01 11:11:38 +03:00
|
|
|
path = href + '&limit=' + event.target.getAttribute("value");
|
2019-12-16 17:22:34 +03:00
|
|
|
}
|
|
|
|
} else {
|
2023-06-01 11:11:38 +03:00
|
|
|
path = href + '?limit=' + event.target.getAttribute("value");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (split_href[1]) {
|
|
|
|
path += '#' + split_href[1];
|
2019-12-16 17:22:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
window.location.href = path;
|
2020-01-29 12:34:51 +03:00
|
|
|
},
|
|
|
|
|
2020-02-29 11:40:33 +03:00
|
|
|
// Dynamic component get path view and show it.
|
2022-06-01 10:15:55 +03:00
|
|
|
onDynamicComponent(path) {
|
2023-05-10 12:07:42 +03:00
|
|
|
if (! path) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-01-29 12:34:51 +03:00
|
|
|
axios.get(path)
|
|
|
|
.then(response => {
|
|
|
|
let html = response.data.html;
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
|
|
|
template : '<div id="dynamic-component">' + html + '</div>',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingSearch,
|
|
|
|
AkauntingRadioGroup,
|
|
|
|
AkauntingSelect,
|
|
|
|
AkauntingSelectRemote,
|
|
|
|
AkauntingModal,
|
|
|
|
AkauntingModalAddNew,
|
|
|
|
AkauntingDate,
|
|
|
|
AkauntingRecurring,
|
|
|
|
[Select.name]: Select,
|
|
|
|
[Option.name]: Option,
|
|
|
|
[Steps.name]: Steps,
|
|
|
|
[Step.name]: Step,
|
|
|
|
[Button.name]: Button,
|
|
|
|
},
|
|
|
|
|
|
|
|
created: function() {
|
2020-09-25 17:35:48 +03:00
|
|
|
this.form = new Form('form-dynamic-component');
|
2020-01-29 12:34:51 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2020-02-04 16:33:01 +03:00
|
|
|
let form_id = document.getElementById('dynamic-component').querySelectorAll('form')[1].id;
|
2020-01-29 12:34:51 +03:00
|
|
|
|
|
|
|
this.form = new Form(form_id);
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
form: {},
|
|
|
|
dynamic: {
|
|
|
|
data: dynamic_data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.errors.push(e);
|
|
|
|
})
|
|
|
|
.finally(function () {
|
|
|
|
// always executed
|
|
|
|
});
|
|
|
|
},
|
2020-07-23 11:04:25 +03:00
|
|
|
|
2021-10-05 23:14:34 +03:00
|
|
|
onDynamicFormParams(path, params) {
|
2023-05-10 12:07:42 +03:00
|
|
|
if (! path) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-10-05 23:14:34 +03:00
|
|
|
let data = {};
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(params)) {
|
|
|
|
data[key] = eval(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
axios.get(path, {
|
|
|
|
params: data
|
|
|
|
}).then(response => {
|
|
|
|
if (response.data.data) {
|
|
|
|
let rows = response.data.data;
|
|
|
|
|
|
|
|
if (!Array.isArray(rows)) {
|
|
|
|
for (const [key, value] of Object.entries(rows)) {
|
|
|
|
this.form[key] = value;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rows.forEach(function (key, index) {
|
|
|
|
this.form[index] = key;
|
|
|
|
}, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch(error => {
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2020-07-24 12:46:44 +03:00
|
|
|
// Delete attachment file
|
|
|
|
onDeleteFile(file_id, url, title, message, button_cancel, button_delete) {
|
|
|
|
let file_data = {
|
|
|
|
page: null,
|
|
|
|
key: null,
|
|
|
|
value: null,
|
|
|
|
ajax: true,
|
2021-03-18 11:43:10 +03:00
|
|
|
redirect: window.location.href
|
2020-07-24 12:46:44 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
if (this.form['page' + file_id]) {
|
|
|
|
file_data.page = this.form['page' + file_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.form['key' + file_id]) {
|
|
|
|
file_data.key = this.form['key' + file_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.form['value' + file_id]) {
|
|
|
|
file_data.value = this.form['value' + file_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
let confirm = {
|
|
|
|
url: url,
|
|
|
|
title: title,
|
|
|
|
message: message,
|
|
|
|
button_cancel: button_cancel,
|
|
|
|
button_delete: button_delete,
|
|
|
|
file_data: file_data,
|
|
|
|
show: true
|
|
|
|
};
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
2020-08-22 16:07:36 +03:00
|
|
|
template : '<div id="dynamic-delete-file-component"><akaunting-modal v-if="confirm.show" :show="confirm.show" :title="confirm.title" :message="confirm.message" :button_cancel="confirm.button_cancel" :button_delete="confirm.button_delete" @confirm="onDelete" @cancel="cancelDelete"></akaunting-modal></div>',
|
2020-07-24 12:46:44 +03:00
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingModal,
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
confirm: confirm,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
// Delete action post
|
|
|
|
async onDelete() {
|
|
|
|
let promise = Promise.resolve(axios({
|
|
|
|
method: 'DELETE',
|
|
|
|
url: this.confirm.url,
|
|
|
|
data: file_data
|
|
|
|
}));
|
|
|
|
|
|
|
|
promise.then(response => {
|
|
|
|
if (response.data.redirect) {
|
|
|
|
window.location.href = response.data.redirect;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.success = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// Close modal empty default value
|
|
|
|
cancelDelete() {
|
|
|
|
this.confirm.show = false;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
},
|
2020-12-24 01:28:38 +03:00
|
|
|
|
|
|
|
// Change Contact Card set form fields..
|
|
|
|
onChangeContactCard(contact) {
|
|
|
|
this.form.contact_id = contact.id;
|
2021-01-19 17:52:22 +03:00
|
|
|
this.form.contact_name = (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name;
|
|
|
|
this.form.contact_email = (contact.email) ? contact.email : '';
|
|
|
|
this.form.contact_tax_number = (contact.tax_number) ? contact.tax_number : '';
|
|
|
|
this.form.contact_phone = (contact.phone) ? contact.phone : '';
|
|
|
|
this.form.contact_address = (contact.address) ? contact.address : '';
|
2021-11-08 02:40:40 +03:00
|
|
|
this.form.contact_country = (contact.country) ? contact.country : '';
|
|
|
|
this.form.contact_state = (contact.state) ? contact.state : '';
|
|
|
|
this.form.contact_zip_code = (contact.zip_code) ? contact.zip_code : '';
|
|
|
|
this.form.contact_city = (contact.city) ? contact.city : '';
|
2021-01-19 17:52:22 +03:00
|
|
|
|
|
|
|
let currency_code = (contact.currency_code) ? contact.currency_code : this.form.currency_code;
|
2020-12-24 01:28:38 +03:00
|
|
|
|
2021-01-19 17:52:22 +03:00
|
|
|
this.onChangeCurrency(currency_code);
|
2021-10-05 23:14:34 +03:00
|
|
|
},
|
2022-06-01 10:15:55 +03:00
|
|
|
|
2022-10-20 15:25:27 +03:00
|
|
|
async onAddPayment(url) {
|
|
|
|
let payment = {
|
|
|
|
modal: false,
|
|
|
|
url: url,
|
|
|
|
title: '',
|
|
|
|
html: '',
|
|
|
|
buttons:{}
|
|
|
|
};
|
|
|
|
|
|
|
|
let payment_promise = Promise.resolve(window.axios.get(payment.url));
|
|
|
|
|
|
|
|
payment_promise.then(response => {
|
|
|
|
payment.modal = true;
|
|
|
|
payment.title = response.data.data.title;
|
|
|
|
payment.html = response.data.html;
|
|
|
|
payment.buttons = response.data.data.buttons;
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
|
|
|
template: '<div id="dynamic-payment-component"><akaunting-modal-add-new modal-dialog-class="max-w-md" modal-position-top :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingDropzoneFileUpload,
|
|
|
|
AkauntingContactCard,
|
|
|
|
AkauntingCompanyEdit,
|
|
|
|
AkauntingEditItemColumns,
|
|
|
|
AkauntingItemButton,
|
|
|
|
AkauntingDocumentButton,
|
|
|
|
AkauntingSearch,
|
|
|
|
AkauntingRadioGroup,
|
|
|
|
AkauntingSelect,
|
|
|
|
AkauntingSelectRemote,
|
|
|
|
AkauntingMoney,
|
|
|
|
AkauntingModal,
|
|
|
|
AkauntingModalAddNew,
|
|
|
|
AkauntingDate,
|
|
|
|
AkauntingRecurring,
|
|
|
|
AkauntingHtmlEditor,
|
|
|
|
AkauntingCountdown,
|
|
|
|
AkauntingCurrencyConversion,
|
|
|
|
AkauntingConnectTransactions,
|
|
|
|
AkauntingSwitch,
|
|
|
|
AkauntingSlider,
|
|
|
|
AkauntingColor,
|
|
|
|
CardForm,
|
|
|
|
[Select.name]: Select,
|
|
|
|
[Option.name]: Option,
|
|
|
|
[Steps.name]: Steps,
|
|
|
|
[Step.name]: Step,
|
|
|
|
[Button.name]: Button,
|
|
|
|
[Link.name]: Link,
|
|
|
|
[Tooltip.name]: Tooltip,
|
|
|
|
[ColorPicker.name]: ColorPicker,
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
form:{},
|
|
|
|
payment: payment,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onSubmit(event) {
|
|
|
|
this.form = event;
|
|
|
|
|
|
|
|
this.form.response = {};
|
|
|
|
|
|
|
|
this.loading = true;
|
|
|
|
|
|
|
|
let data = this.form.data();
|
|
|
|
|
|
|
|
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
|
|
|
for(var name in data) {
|
|
|
|
if (wrapper) {
|
|
|
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
|
|
|
this.appendRecursive(data[name], wrapper + '[' + name + ']');
|
|
|
|
} else {
|
|
|
|
this.append(wrapper + '[' + name + ']', data[name]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
|
|
|
this.appendRecursive(data[name], name);
|
|
|
|
} else {
|
|
|
|
this.append(name, data[name]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let form_data = new FormData();
|
|
|
|
form_data.appendRecursive(data);
|
|
|
|
|
|
|
|
window.axios({
|
|
|
|
method: this.form.method,
|
|
|
|
url: this.form.action,
|
|
|
|
data: form_data,
|
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': window.Laravel.csrfToken,
|
|
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
|
|
'Content-Type': 'multipart/form-data'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(response => {
|
|
|
|
if (response.data.success) {
|
|
|
|
if (response.data.redirect) {
|
|
|
|
this.form.loading = true;
|
|
|
|
|
|
|
|
window.location.href = response.data.redirect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.data.error) {
|
|
|
|
this.form.loading = false;
|
|
|
|
|
|
|
|
this.form.response = response.data;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.form.loading = false;
|
|
|
|
|
|
|
|
this.form.onFail(error);
|
|
|
|
|
|
|
|
this.method_show_html = error.message;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
this.payment.modal = false;
|
|
|
|
this.payment.html = null;
|
|
|
|
|
|
|
|
let documentClasses = document.body.classList;
|
|
|
|
|
2022-12-13 10:57:11 +03:00
|
|
|
documentClasses.remove('overflow-y-hidden', 'overflow-overlay');
|
2022-10-20 15:25:27 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
})
|
|
|
|
.finally(function () {
|
|
|
|
// always executed
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
async onEditPayment(url) {
|
|
|
|
let payment = {
|
|
|
|
modal: false,
|
|
|
|
url: url,
|
|
|
|
title: '',
|
|
|
|
html: '',
|
|
|
|
buttons:{}
|
|
|
|
};
|
|
|
|
|
|
|
|
let payment_promise = Promise.resolve(window.axios.get(payment.url));
|
|
|
|
|
|
|
|
payment_promise.then(response => {
|
|
|
|
payment.modal = true;
|
|
|
|
payment.title = response.data.data.title;
|
|
|
|
payment.html = response.data.html;
|
|
|
|
payment.buttons = response.data.data.buttons;
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
|
|
|
template: '<div id="dynamic-payment-component"><akaunting-modal-add-new modal-dialog-class="max-w-md" modal-position-top :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingDropzoneFileUpload,
|
|
|
|
AkauntingContactCard,
|
|
|
|
AkauntingCompanyEdit,
|
|
|
|
AkauntingEditItemColumns,
|
|
|
|
AkauntingItemButton,
|
|
|
|
AkauntingDocumentButton,
|
|
|
|
AkauntingSearch,
|
|
|
|
AkauntingRadioGroup,
|
|
|
|
AkauntingSelect,
|
|
|
|
AkauntingSelectRemote,
|
|
|
|
AkauntingMoney,
|
|
|
|
AkauntingModal,
|
|
|
|
AkauntingModalAddNew,
|
|
|
|
AkauntingDate,
|
|
|
|
AkauntingRecurring,
|
|
|
|
AkauntingHtmlEditor,
|
|
|
|
AkauntingCountdown,
|
|
|
|
AkauntingCurrencyConversion,
|
|
|
|
AkauntingConnectTransactions,
|
|
|
|
AkauntingSwitch,
|
|
|
|
AkauntingSlider,
|
|
|
|
AkauntingColor,
|
|
|
|
CardForm,
|
|
|
|
[Select.name]: Select,
|
|
|
|
[Option.name]: Option,
|
|
|
|
[Steps.name]: Steps,
|
|
|
|
[Step.name]: Step,
|
|
|
|
[Button.name]: Button,
|
|
|
|
[Link.name]: Link,
|
|
|
|
[Tooltip.name]: Tooltip,
|
|
|
|
[ColorPicker.name]: ColorPicker,
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
form:{},
|
|
|
|
payment: payment,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onSubmit(event) {
|
|
|
|
this.form = event;
|
|
|
|
|
|
|
|
this.form.response = {};
|
|
|
|
|
|
|
|
this.loading = true;
|
|
|
|
|
|
|
|
let data = this.form.data();
|
|
|
|
|
|
|
|
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
|
|
|
for(var name in data) {
|
|
|
|
if (wrapper) {
|
|
|
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
|
|
|
this.appendRecursive(data[name], wrapper + '[' + name + ']');
|
|
|
|
} else {
|
|
|
|
this.append(wrapper + '[' + name + ']', data[name]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
|
|
|
this.appendRecursive(data[name], name);
|
|
|
|
} else {
|
|
|
|
this.append(name, data[name]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let form_data = new FormData();
|
|
|
|
form_data.appendRecursive(data);
|
|
|
|
|
|
|
|
window.axios({
|
|
|
|
method: this.form.method,
|
|
|
|
url: this.form.action,
|
|
|
|
data: form_data,
|
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': window.Laravel.csrfToken,
|
|
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
|
|
'Content-Type': 'multipart/form-data'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(response => {
|
|
|
|
if (response.data.success) {
|
|
|
|
if (response.data.redirect) {
|
|
|
|
this.form.loading = true;
|
|
|
|
|
|
|
|
window.location.href = response.data.redirect;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.data.error) {
|
|
|
|
this.form.loading = false;
|
|
|
|
|
|
|
|
this.form.response = response.data;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
this.form.loading = false;
|
|
|
|
|
|
|
|
this.form.onFail(error);
|
|
|
|
|
|
|
|
this.method_show_html = error.message;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
this.payment.modal = false;
|
|
|
|
this.payment.html = null;
|
|
|
|
|
|
|
|
let documentClasses = document.body.classList;
|
|
|
|
|
2022-12-13 10:57:11 +03:00
|
|
|
documentClasses.remove('overflow-y-hidden', 'overflow-overlay');
|
2022-10-20 15:25:27 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
})
|
|
|
|
.finally(function () {
|
|
|
|
// always executed
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
async onSendEmail(url) {
|
2022-10-20 14:59:04 +03:00
|
|
|
let email = {
|
|
|
|
modal: false,
|
2022-10-20 15:25:27 +03:00
|
|
|
url: url,
|
2022-10-20 14:59:04 +03:00
|
|
|
title: '',
|
|
|
|
html: '',
|
|
|
|
buttons:{}
|
|
|
|
};
|
|
|
|
|
2022-10-20 15:25:27 +03:00
|
|
|
let email_promise = Promise.resolve(window.axios.get(email.url));
|
2022-10-20 14:59:04 +03:00
|
|
|
|
|
|
|
if (this.email_template) {
|
2022-10-20 15:25:27 +03:00
|
|
|
email_promise = Promise.resolve(window.axios.get(email.url, {
|
2022-10-20 14:59:04 +03:00
|
|
|
params: {
|
|
|
|
email_template: this.email_template
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
this.email_template = false;
|
|
|
|
|
|
|
|
email_promise.then(response => {
|
|
|
|
email.modal = true;
|
|
|
|
email.title = response.data.data.title;
|
|
|
|
email.html = response.data.html;
|
|
|
|
email.buttons = response.data.data.buttons;
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
2023-05-31 16:22:40 +03:00
|
|
|
template: '<div id="dynamic-email-component"><akaunting-modal-add-new modal-dialog-class="max-w-screen-md" modal-position-top :show="email.modal" @submit="onSubmit" @cancel="onCancel" :buttons="email.buttons" :title="email.title" :is_component=true :message="email.html"></akaunting-modal-add-new></div>',
|
2022-10-20 14:59:04 +03:00
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingDropzoneFileUpload,
|
|
|
|
AkauntingContactCard,
|
|
|
|
AkauntingCompanyEdit,
|
|
|
|
AkauntingEditItemColumns,
|
|
|
|
AkauntingItemButton,
|
|
|
|
AkauntingDocumentButton,
|
|
|
|
AkauntingSearch,
|
|
|
|
AkauntingRadioGroup,
|
|
|
|
AkauntingSelect,
|
|
|
|
AkauntingSelectRemote,
|
|
|
|
AkauntingMoney,
|
|
|
|
AkauntingModal,
|
|
|
|
AkauntingModalAddNew,
|
|
|
|
AkauntingDate,
|
|
|
|
AkauntingRecurring,
|
|
|
|
AkauntingHtmlEditor,
|
|
|
|
AkauntingCountdown,
|
|
|
|
AkauntingCurrencyConversion,
|
|
|
|
AkauntingConnectTransactions,
|
|
|
|
AkauntingSwitch,
|
|
|
|
AkauntingSlider,
|
|
|
|
AkauntingColor,
|
|
|
|
CardForm,
|
|
|
|
[Select.name]: Select,
|
|
|
|
[Option.name]: Option,
|
|
|
|
[Steps.name]: Steps,
|
|
|
|
[Step.name]: Step,
|
|
|
|
[Button.name]: Button,
|
|
|
|
[Link.name]: Link,
|
|
|
|
[Tooltip.name]: Tooltip,
|
|
|
|
[ColorPicker.name]: ColorPicker,
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
form:{},
|
|
|
|
email: email,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onSubmit(event) {
|
|
|
|
this.$emit('submit', event);
|
|
|
|
|
|
|
|
event.submit();
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
this.email.modal = false;
|
|
|
|
this.email.html = null;
|
|
|
|
|
|
|
|
let documentClasses = document.body.classList;
|
|
|
|
|
2022-12-13 10:57:11 +03:00
|
|
|
documentClasses.remove('overflow-y-hidden', 'overflow-overlay');
|
2022-10-20 14:59:04 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
})
|
|
|
|
.finally(function () {
|
|
|
|
// always executed
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2022-06-01 10:15:55 +03:00
|
|
|
onShareLink(url) {
|
|
|
|
let share = {
|
|
|
|
modal: false,
|
|
|
|
url: url,
|
|
|
|
title: '',
|
|
|
|
html: '',
|
|
|
|
buttons:{}
|
|
|
|
};
|
|
|
|
|
|
|
|
let share_promise = Promise.resolve(window.axios.get(share.url));
|
|
|
|
|
|
|
|
share_promise.then(response => {
|
|
|
|
share.modal = true;
|
|
|
|
share.title = response.data.data.title;
|
|
|
|
share.success_message = response.data.data.success_message;
|
|
|
|
share.html = response.data.html;
|
|
|
|
share.buttons = response.data.data.buttons;
|
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
|
|
|
template: '<div id="dynamic-share-component"><akaunting-modal-add-new modal-dialog-class="max-w-screen-md" :show="share.modal" @submit="onCopyLink" @cancel="onCancel" :buttons="share.buttons" :is_component=true :title="share.title" :message="share.html"></akaunting-modal-add-new></div>',
|
|
|
|
|
|
|
|
components: {
|
|
|
|
AkauntingModalAddNew,
|
|
|
|
},
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
share: share,
|
|
|
|
form: {},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-08-31 15:28:40 +03:00
|
|
|
onCopyLink() {
|
2022-06-01 10:15:55 +03:00
|
|
|
let type = 'success';
|
2022-08-31 15:28:40 +03:00
|
|
|
let copy_html = document.getElementById('share');
|
|
|
|
|
|
|
|
copy_html.select();
|
|
|
|
document.execCommand('copy');
|
2022-06-01 10:15:55 +03:00
|
|
|
|
|
|
|
this.$notify({
|
2023-05-23 17:44:28 +03:00
|
|
|
verticalAlign: 'bottom',
|
|
|
|
horizontalAlign: 'left',
|
2022-06-01 10:15:55 +03:00
|
|
|
message: this.share.success_message,
|
|
|
|
timeout: 5000,
|
|
|
|
icon: 'error_outline',
|
|
|
|
type
|
|
|
|
});
|
|
|
|
|
|
|
|
this.onCancel();
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
this.share.modal = false;
|
|
|
|
this.share.html = null;
|
|
|
|
|
|
|
|
let documentClasses = document.body.classList;
|
|
|
|
|
2022-12-13 10:57:11 +03:00
|
|
|
documentClasses.remove('overflow-y-hidden', 'overflow-overlay');
|
2022-06-01 10:15:55 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
})
|
|
|
|
.finally(function () {
|
|
|
|
// always executed
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onCopyLink() {
|
|
|
|
let copy_html = document.getElementById('share');
|
|
|
|
let copy_badge = document.querySelector('[data-copied]');
|
|
|
|
|
|
|
|
copy_html.select();
|
|
|
|
document.execCommand('copy');
|
|
|
|
|
|
|
|
copy_badge.classList.remove('hidden');
|
|
|
|
copy_badge.classList.add('flex');
|
|
|
|
copy_html.classList.add('hidden');
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
copy_badge.classList.add('hidden');
|
|
|
|
copy_badge.classList.remove('flex');
|
|
|
|
copy_html.classList.remove('hidden');
|
|
|
|
}, 800);
|
2022-06-16 12:27:19 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
//connect transactions for account, document or etc.
|
|
|
|
onConnectTransactions(route) {
|
|
|
|
let dial_promise = Promise.resolve(window.axios.get(route));
|
|
|
|
|
|
|
|
dial_promise.then(response => {
|
|
|
|
this.connect.show = true;
|
|
|
|
|
|
|
|
this.connect.transaction = JSON.parse(response.data.transaction);
|
|
|
|
|
|
|
|
let currency = JSON.parse(response.data.currency);
|
|
|
|
|
|
|
|
this.connect.currency = {
|
|
|
|
decimal_mark: currency.decimal_mark,
|
|
|
|
precision: currency.precision,
|
|
|
|
symbol: currency.symbol,
|
|
|
|
symbol_first: currency.symbol_first,
|
|
|
|
thousands_separator: currency.thousands_separator,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.connect.documents = JSON.parse(response.data.documents);
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
})
|
|
|
|
.finally(function () {
|
|
|
|
// always executed
|
|
|
|
});
|
|
|
|
},
|
2022-07-22 19:49:37 +03:00
|
|
|
|
2022-07-25 12:15:40 +03:00
|
|
|
// if you use modal dynamic form. This method ger url form and posr it.
|
2022-07-22 19:49:37 +03:00
|
|
|
onModalAddNew(url) {
|
|
|
|
let modal = {
|
2022-07-25 09:53:16 +03:00
|
|
|
show: true,
|
2022-07-22 19:49:37 +03:00
|
|
|
title: '',
|
|
|
|
html: '',
|
|
|
|
buttons:{}
|
|
|
|
};
|
|
|
|
|
2022-07-25 12:15:40 +03:00
|
|
|
Promise.resolve(window.axios.get(url))
|
|
|
|
.then(response => {
|
2022-07-22 19:49:37 +03:00
|
|
|
if (response.data.success) {
|
2022-08-10 22:11:28 +03:00
|
|
|
modal.title = response.data.data.title;
|
2022-07-22 19:49:37 +03:00
|
|
|
modal.html = response.data.html;
|
2022-08-10 22:11:28 +03:00
|
|
|
modal.buttons = response.data.data.buttons;
|
2022-07-22 19:49:37 +03:00
|
|
|
|
|
|
|
this.component = Vue.component('add-new-component', (resolve, reject) => {
|
|
|
|
resolve({
|
2022-09-01 14:27:58 +03:00
|
|
|
template: '<div id="dynamic-add-new-modal-component"><akaunting-modal-add-new modal-dialog-class="max-w-md" :show="modal.show" :buttons="modal.buttons" :title="modal.title" :message="modal.html" :is_component=true @submit="onSubmit" @cancel="onCancel"></akaunting-modal-add-new></div>',
|
2022-07-22 19:49:37 +03:00
|
|
|
|
2022-07-25 12:15:40 +03:00
|
|
|
components: {
|
|
|
|
AkauntingDropzoneFileUpload,
|
|
|
|
AkauntingContactCard,
|
|
|
|
AkauntingCompanyEdit,
|
|
|
|
AkauntingEditItemColumns,
|
|
|
|
AkauntingItemButton,
|
|
|
|
AkauntingDocumentButton,
|
|
|
|
AkauntingSearch,
|
|
|
|
AkauntingRadioGroup,
|
|
|
|
AkauntingSelect,
|
|
|
|
AkauntingSelectRemote,
|
|
|
|
AkauntingMoney,
|
|
|
|
AkauntingModal,
|
|
|
|
AkauntingModalAddNew,
|
|
|
|
AkauntingDate,
|
|
|
|
AkauntingRecurring,
|
|
|
|
AkauntingHtmlEditor,
|
|
|
|
AkauntingCountdown,
|
|
|
|
AkauntingCurrencyConversion,
|
|
|
|
AkauntingConnectTransactions,
|
|
|
|
AkauntingSwitch,
|
|
|
|
AkauntingSlider,
|
|
|
|
AkauntingColor,
|
|
|
|
CardForm,
|
|
|
|
[Select.name]: Select,
|
|
|
|
[Option.name]: Option,
|
|
|
|
[Steps.name]: Steps,
|
|
|
|
[Step.name]: Step,
|
|
|
|
[Button.name]: Button,
|
|
|
|
[Link.name]: Link,
|
|
|
|
[Tooltip.name]: Tooltip,
|
|
|
|
[ColorPicker.name]: ColorPicker,
|
|
|
|
},
|
2022-07-22 19:49:37 +03:00
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
form:{},
|
|
|
|
modal: modal,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
onSubmit(event) {
|
|
|
|
this.$emit('submit', event);
|
|
|
|
event.submit();
|
|
|
|
},
|
|
|
|
|
|
|
|
onCancel() {
|
|
|
|
this.modal.show = false;
|
|
|
|
this.modal.html = null;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.errors.push(e);
|
|
|
|
})
|
|
|
|
},
|
2022-12-19 11:36:23 +03:00
|
|
|
|
|
|
|
//custom input settings for invoice
|
|
|
|
onSmallWidthColumn(item) {
|
|
|
|
this.$refs[item].$el.setAttribute('custom-half', true);
|
|
|
|
},
|
|
|
|
|
|
|
|
onFullWidthColumn(item) {
|
|
|
|
this.$refs[item].$el.removeAttribute('custom-half');
|
|
|
|
},
|
|
|
|
|
|
|
|
settingsInvoice() {
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
if (this.form.item_name == 'custom') {
|
|
|
|
this.item_name_input = true;
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
this.onSmallWidthColumn("item_name");
|
|
|
|
} else {
|
|
|
|
this.item_name_input = false;
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
this.onFullWidthColumn("item_name");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.form.price_name == 'custom') {
|
|
|
|
this.price_name_input = true;
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
this.onSmallWidthColumn("price_name");
|
|
|
|
} else {
|
|
|
|
this.price_name_input = false;
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
this.onFullWidthColumn("price_name");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.form.quantity_name == 'custom') {
|
|
|
|
this.quantity_name_input = true;
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
this.onSmallWidthColumn("quantity_name");
|
|
|
|
} else {
|
|
|
|
this.quantity_name_input = false;
|
2023-07-03 17:25:26 +03:00
|
|
|
|
2022-12-19 11:36:23 +03:00
|
|
|
this.onFullWidthColumn("quantity_name");
|
|
|
|
}
|
2023-07-03 17:25:26 +03:00
|
|
|
|
|
|
|
if (this.form.item_name == 'hide' && this.form.hide_item_description === 1) {
|
|
|
|
this.form.hide_item_description = 0;
|
|
|
|
|
|
|
|
let type = 'warning';
|
|
|
|
|
|
|
|
if (this.$notifications.state != undefined && this.$notifications.state.length > 0) {
|
|
|
|
this.$notifications.state.forEach((item, index) => {
|
|
|
|
if (item.message == this.form.item_name_or_description_required) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$notify({
|
|
|
|
verticalAlign: 'bottom',
|
|
|
|
horizontalAlign: 'left',
|
|
|
|
message: this.form.message_name_or_description_required,
|
|
|
|
timeout: 8000,
|
|
|
|
icon: 'error_outline',
|
|
|
|
type
|
|
|
|
});
|
|
|
|
}
|
2022-12-19 11:36:23 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
// set minimum date for date component
|
|
|
|
setMinDate(date) {
|
|
|
|
this.min_date = date;
|
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
}
|
2021-03-18 11:43:10 +03:00
|
|
|
}
|