Merge branch 'master' of github.com:akaunting/akaunting into 2.1-dev

This commit is contained in:
Cüneyt Şentürk
2020-09-23 14:25:40 +03:00
54 changed files with 1364 additions and 522 deletions

View File

@ -18,7 +18,7 @@
</el-carousel-item>
<el-carousel-item v-for="(screenshot, index) in screenshots" :key="index">
<img class="d-block w-100 carousel-frame" height="365px" :src="screenshot.path_string" :alt="screenshot.alt_attribute">
<img @click="openGallery(index)" class="d-block w-100 carousel-frame" height="365px" :src="screenshot.path_string" :alt="screenshot.alt_attribute">
<div class="carousel-description py-2" v-if="screenshot.description">
{{ screenshot.description }}
</div>
@ -27,12 +27,26 @@
</div>
</el-carousel-item>
</el-carousel>
<LightBox
ref="lightbox"
:media="media"
:show-caption="true"
:show-light-box="false"
/>
</div>
</template>
<script>
import Vue from 'vue';
import {Image, Carousel, CarouselItem} from 'element-ui';
import LightBox from 'vue-image-lightbox';
import 'vue-image-lightbox/dist/vue-image-lightbox.min.css';
import VueLazyLoad from 'vue-lazyload';
Vue.use(VueLazyLoad);
export default {
name: "akaunting-carousel",
@ -40,6 +54,7 @@ export default {
[Image.name]: Image,
[Carousel.name]: Carousel,
[CarouselItem.name]: CarouselItem,
LightBox
},
props: {
@ -108,6 +123,36 @@ export default {
default: 'horizontal',
description: "display direction (horizontal/vertical)"
}
},
mounted() {
let media = [];
if (this.screenshots.length) {
let name = this.name;
this.screenshots.forEach(function(screenshot) {
media.push({ // For image
thumb: screenshot.path_string,
src: screenshot.path_string,
caption: (screenshot.description.length) ? screenshot.description : name,
});
});
}
this.media = media;
},
data: function () {
return {
media: [],
}
},
methods: {
openGallery(index) {
this.$refs.lightbox.showImage(index)
}
}
}
</script>

View File

@ -11,7 +11,7 @@
formClasses
]"
:error="formError">
<el-select v-model="real_model" @input="change" disabled filterable v-if="disabled"
<el-select v-model="real_model" @input="change" disabled filterable v-if="disabled && !multiple"
remote
reserve-keyword
:placeholder="placeholder"
@ -165,6 +165,83 @@
</el-option>
</el-select>
<el-select v-model="real_model" @input="change" filterable v-if="disabled && multiple && !collapse" multiple disabled
remote
reserve-keyword
:placeholder="placeholder"
:remote-method="remoteMethod"
:loading="loading">
<div v-if="addNew.status && options.length != 0" class="el-select-dropdown__wrap" slot="empty">
<p class="el-select-dropdown__empty">
{{ noMatchingDataText }}
</p>
<ul class="el-scrollbar__view el-select-dropdown__list">
<li class="el-select-dropdown__item el-select__footer">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
{{ add_new_text }}
</span>
</div>
</li>
</ul>
</div>
<div v-else-if="addNew.status && options.length == 0" slot="empty">
<p class="el-select-dropdown__empty">
{{ noDataText }}
</p>
<ul class="el-scrollbar__view el-select-dropdown__list">
<li class="el-select-dropdown__item el-select__footer">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
{{ add_new_text }}
</span>
</div>
</li>
</ul>
</div>
<template slot="prefix">
<span class="el-input__suffix-inner el-select-icon">
<i :class="'select-icon-position el-input__icon fa fa-' + icon"></i>
</span>
</template>
<el-option v-if="!group" v-for="(label, value) in selectOptions"
:key="value"
:label="label"
:value="value">
<span class="float-left">{{ label }}</span>
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
</el-option>
<el-option-group
v-if="group"
v-for="(options, name) in selectOptions"
:key="name"
:label="name">
<el-option
v-for="(label, value) in options"
:key="value"
:label="label"
:value="value">
<span class="float-left">{{ label }}</span>
<span class="badge badge-pill badge-success float-right mt-2" v-if="new_options[value]">{{ new_text }}</span>
</el-option>
</el-option-group>
<el-option v-if="addNew.status && options.length != 0" class="el-select__footer" :disabled="true" :value="add_new">
<div @click="onAddItem">
<i class="fas fa-plus"></i>
<span>
{{ add_new_text }}
</span>
</div>
</el-option>
</el-select>
<el-select v-model="real_model" @input="change" filterable v-if="!disabled && multiple && !collapse" multiple
remote
reserve-keyword
@ -618,7 +695,7 @@ export default {
this.$emit('interface', this.real_model);
setTimeout(function() {
this.change();
//this.change(); for invoice item
}.bind(this), 800);
},

View File

@ -12,6 +12,8 @@ export default class BulkAction {
this['value'] = '*';
// Select action message
this['message'] = '';
// Action type
this['type'] = '';
// Bulk action view status
this['show'] = false;
// Bulk action modal status
@ -63,6 +65,18 @@ export default class BulkAction {
this.message = '';
}
this.path = document.getElementsByName("bulk_action_path")[0].getAttribute('value');
if (event.target.options[event.target.options.selectedIndex].dataset.path) {
this.path = event.target.options[event.target.options.selectedIndex].dataset.path;
}
this.type = '*';
if (event.target.options[event.target.options.selectedIndex].dataset.type) {
this.type = event.target.options[event.target.options.selectedIndex].dataset.type;
}
return this.message;
}
@ -72,72 +86,79 @@ export default class BulkAction {
return;
}
var path = document.getElementsByName("bulk_action_path")[0].getAttribute('value');
this.loading = true;
if (this.value != 'export') {
window.axios.post(path, {
'handle': this.value,
'selected': this.selected
})
.then(response => {
if (response.data.redirect) {
window.location.reload(false);
}
})
.catch(error => {
//this.loading = false;
//this.modal = false;
// bwfore version 2.0.23
if (this.value == 'export') {
this.type = 'download';
}
//window.location.reload(false);
})
.finally(function () {
//window.location.reload(false);
});
} else {
window.axios({
url: path,
method: 'POST',
data:{
switch (this.type) {
case 'download':
let download_promise = Promise.resolve(window.axios({
url: this.path,
method: 'POST',
data:{
'handle': this.value,
'selected': this.selected
},
responseType: 'blob',
}));
download_promise.then((response) => {
const blob = new Blob([response.data], {type: response.data.type});
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
const contentDisposition = response.headers['content-disposition'];
let fileName = 'unknown';
if (contentDisposition) {
const fileNameMatch = contentDisposition.match(/filename=(.+)/);
if (fileNameMatch.length === 2) {
fileName = fileNameMatch[1];
}
}
link.setAttribute('download', fileName);
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(url);
this.loading = false;
this.modal = false;
this.value = '*';
this.clear();
});
break;
default:
let type_promise = Promise.resolve(window.axios.post(this.path, {
'handle': this.value,
'selected': this.selected
},
responseType: 'blob',
}).then((response) => {
console.log(response.data);
const blob = new Blob([response.data], {type: response.data.type});
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
}));
link.href = url;
const contentDisposition = response.headers['content-disposition'];
let fileName = 'unknown';
if (contentDisposition) {
const fileNameMatch = contentDisposition.match(/filename=(.+)/);
if (fileNameMatch.length === 2) {
fileName = fileNameMatch[1];
type_promise.then(response => {
if (response.data.redirect) {
window.location.reload(false);
}
}
})
.catch(error => {
//this.loading = false;
//this.modal = false;
link.setAttribute('download', fileName);
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(url);
this.loading = false;
this.modal = false;
this.value = '*';
this.clear();
});
//window.location.reload(false);
})
.finally(function () {
//window.location.reload(false);
});
}
}

View File

@ -46,7 +46,7 @@ const app = new Vue({
edit: {
status: false,
currency: false,
items: false,
items: 0,
},
}
},
@ -291,8 +291,8 @@ const app = new Vue({
},
onSelectItem(item, index) {
if (this.edit.status && !this.edit.items) {
this.edit.items = true;
if (this.edit.status && this.edit.items < this.form.items.length) {
this.edit.items += 1;
return;
}

View File

@ -46,7 +46,7 @@ const app = new Vue({
edit: {
status: false,
currency: false,
items: false,
items: 0,
},
}
},
@ -291,8 +291,8 @@ const app = new Vue({
},
onSelectItem(item, index) {
if (this.edit.status && !this.edit.items) {
this.edit.items = true;
if (this.edit.status && this.edit.items < this.form.items.length) {
this.edit.items += 1;
return;
}