Merge branch 'master' of https://github.com/brkcvn/akaunting into new-plans

This commit is contained in:
Burak Civan
2022-10-11 10:34:11 +03:00
25 changed files with 260 additions and 70 deletions

View File

@@ -7,7 +7,7 @@
tabindex="-1"
role="dialog"
:aria-hidden="!show">
<div class="w-full my-10 m-auto flex flex-col" :class="modalDialogClass ? modalDialogClass : 'max-w-screen-sm'">
<div class="w-full my-10 m-auto flex flex-col" :class="modalDialogClass ? modalDialogClass : 'max-w-md'">
<slot name="modal-content">
<div class="modal-content">
<div class="p-5 bg-body rounded-tl-lg rounded-tr-lg">

View File

@@ -7,7 +7,7 @@
tabindex="-1"
role="dialog"
:aria-hidden="!show">
<div class="w-full my-10 m-auto flex flex-col" :class="modalDialogClass ? modalDialogClass : 'max-w-screen-sm'">
<div class="w-full my-10 m-auto flex flex-col" :class="modalDialogClass ? modalDialogClass : 'max-w-md'">
<slot name="modal-content">
<div class="modal-content">
<div class="p-5 bg-body rounded-tl-lg rounded-tr-lg">

View File

@@ -1,37 +1,39 @@
<template>
<div
:id="'search-field-' + _uid"
class="h-12 my-5 searh-field flex border-b transition-all js-search"
class="lg:h-12 my-5 searh-field flex flex-col lg:flex-row border-b transition-all js-search"
:class="input_focus ? 'border-gray-500' : 'border-gray-300'"
>
<div class="tags-group group items-center" style="display:contents;" v-for="(filter, index) in filtered" :index="index">
<span v-if="filter.option" class="flex items-center bg-purple-lighter text-black border-0 mt-3 px-3 py-4 text-sm cursor-pointer el-tag el-tag--small el-tag-option">
{{ filter.option }}
<div class="w-full lg:w-auto flex overflow-x-scroll large-overflow-unset" :class="filtered.length ? 'h-12 lg:h-auto' : ''">
<div class="tags-group group items-center" style="display:contents;" v-for="(filter, index) in filtered" :index="index">
<span v-if="filter.option" class="flex items-center bg-purple-lighter text-black border-0 mt-3 px-3 py-4 text-sm cursor-pointer el-tag el-tag--small el-tag-option">
{{ filter.option }}
<i v-if="!filter.operator && !filter.value" class="mt-1 ltr:-right-2 rtl:left-0 rtl:right-0 el-tag__close el-icon-close" style="font-size: 16px;" @click="onFilterDelete(index)"></i>
</span>
<i v-if="!filter.operator && !filter.value" class="mt-1 ltr:-right-2 rtl:left-0 rtl:right-0 el-tag__close el-icon-close" style="font-size: 16px;" @click="onFilterDelete(index)"></i>
</span>
<span v-if="filter.operator" class="flex items-center bg-purple-lighter text-black border-2 border-body border-l border-r border-t-0 border-b-0 mt-3 px-3 py-4 text-sm cursor-pointer el-tag el-tag--small el-tag-operator" style="margin-left:0; margin-right:0;">
<span v-if="filter.operator == '='" class="material-icons text-2xl">drag_handle</span>
<span v-else-if="filter.operator == '><'" class="material-icons text-2xl transform rotate-90">height</span>
<span v-if="filter.operator" class="flex items-center bg-purple-lighter text-black border-2 border-body border-l border-r border-t-0 border-b-0 mt-3 px-3 py-4 text-sm cursor-pointer el-tag el-tag--small el-tag-operator" style="margin-left:0; margin-right:0;">
<span v-if="filter.operator == '='" class="material-icons text-2xl">drag_handle</span>
<span v-else-if="filter.operator == '><'" class="material-icons text-2xl transform rotate-90">height</span>
<img v-else :src="not_equal_image" class="w-5 h-5 object-cover block" />
<img v-else :src="not_equal_image" class="w-5 h-5 object-cover block" />
<i v-if="!filter.value" class="mt-1 ltr:-right-2 rtl:left-0 rtl:right-0 el-tag__close el-icon-close " style="font-size: 16px;" @click="onFilterDelete(index)"></i>
</span>
<i v-if="!filter.value" class="mt-1 ltr:-right-2 rtl:left-0 rtl:right-0 el-tag__close el-icon-close " style="font-size: 16px;" @click="onFilterDelete(index)"></i>
</span>
<span v-if="filter.value" class="flex items-center bg-purple-lighter text-black border-0 mt-3 px-3 py-4 text-sm cursor-pointer el-tag el-tag--small el-tag-value">
{{ filter.value }}
<span v-if="filter.value" class="flex items-center bg-purple-lighter text-black border-0 mt-3 px-3 py-4 text-sm cursor-pointer el-tag el-tag--small el-tag-value">
{{ filter.value }}
<i class="mt-1 ltr:-right-2 rtl:left-0 rtl:right-0 el-tag__close el-icon-close " style="font-size: 16px;" @click="onFilterDelete(index)"></i>
</span>
<i class="mt-1 ltr:-right-2 rtl:left-0 rtl:right-0 el-tag__close el-icon-close " style="font-size: 16px;" @click="onFilterDelete(index)"></i>
</span>
</div>
</div>
<div class="relative w-full h-full flex">
<input
v-if="!show_date"
type="text"
class="w-full bg-transparent text-black text-sm border-0 pb-0 focus:outline-none focus:ring-transparent focus:border-purple-100"
class="w-full h-12 lg:h-auto bg-transparent text-black text-sm border-0 pb-0 focus:outline-none focus:ring-transparent focus:border-purple-100"
:class="!show_icon ? 'px-4' : 'px-10'"
:placeholder="dynamicPlaceholder"
:ref="'input-search-field-' + _uid"
@@ -47,7 +49,7 @@
@on-open="onInputFocus"
@blur="onBlur"
:config="dateConfig"
class="w-full bg-transparent text-black text-sm border-0 pb-0 focus:outline-none focus:ring-transparent focus:border-purple-100 datepicker"
class="w-full h-12 lg:h-auto bg-transparent text-black text-sm border-0 pb-0 focus:outline-none focus:ring-transparent focus:border-purple-100 datepicker"
:class="!show_icon ? 'px-4' : 'px-10'"
:placeholder="dynamicPlaceholder"
:ref="'input-search-date-field-' + _uid"
@@ -65,7 +67,7 @@
search
</span>
<button type="button" class="absolute ltr:right-0 rtl:left-0 top-2 clear" v-if="show_close_icon" @click="onSearchAndFilterClear">
<button type="button" class="absolute ltr:right-0 rtl:left-0 top-4 lg:top-2 clear" v-if="show_close_icon" @click="onSearchAndFilterClear">
<span class="material-icons text-sm">close</span>
</button>

View File

@@ -107,7 +107,7 @@
<span slot="infoBlock" class="absolute right-8 top-3 bg-green text-white px-2 py-1 rounded-md text-xs" v-if="new_options[selected]">{{ addNew.new_text }}</span>
<select :name="name" :id="name" v-model="selected" class="d-none">
<select :name="name" :id="name" class="hidden">
<option v-for="option in sortedOptions" :key="option.key" :value="option.key">{{ option.value }}</option>
</select>
</base-input>
@@ -299,6 +299,11 @@ export default {
default: '',
description: "Selectbox input search placeholder text"
},
forceDynamicOptionValue: {
type: [Boolean, String],
default: false,
},
},
data() {
@@ -350,7 +355,6 @@ export default {
} else {
this.sorted_options.sort(this.sortBy(this.option_sortable));
}
return this.sorted_options;
},
},
@@ -865,6 +869,33 @@ export default {
this.setSortedOptions();
}
},
dynamicOptionsValue(options) {
if (! this.forceDynamicOptionValue) {
if (this.multiple) {
this.selected = [];
} else {
this.selected = null;
}
return;
}
if (this.multiple) {
let selected = this.selected;
this.selected = [];
selected.forEach(function (select, index) {
if (this.sorted_options.find((option) => option.key == select)) {
this.selected.push(select);
}
}, this);
} else {
if (! options.find((option) => option == this.selected)) {
this.selected = null;
}
}
}
},
watch: {
@@ -882,15 +913,17 @@ export default {
let is_string = false;
let pre_value = [];
selected.forEach(item => {
if (typeof item != 'string') {
is_string = true;
if (selected !== undefined && selected.length) {
selected.forEach(item => {
if (typeof item != 'string') {
is_string = true;
if (item != '') {
pre_value.push(item.toString());
if (item != '') {
pre_value.push(item.toString());
}
}
}
});
});
}
if (is_string) {
this.selected = pre_value;
@@ -949,11 +982,10 @@ export default {
dynamicOptions: function(options) {
this.sorted_options = [];
this.selected = '';
if (this.group) {
// Option set sort_option data
if (!Array.isArray(options)) {
if (! Array.isArray(options)) {
for (const [index, _options] of Object.entries(options)) {
let values = [];
@@ -991,7 +1023,7 @@ export default {
}
} else {
// Option set sort_option data
if (!Array.isArray(options)) {
if (! Array.isArray(options)) {
for (const [key, value] of Object.entries(options)) {
this.sorted_options.push({
key: key.toString(),
@@ -1018,6 +1050,8 @@ export default {
}
}, this);
}
this.dynamicOptionsValue(options);
}
},
},

View File

@@ -104,7 +104,7 @@
<span slot="infoBlock" class="absolute right-8 top-3 bg-green text-white px-2 py-1 rounded-md text-xs" v-if="new_options[selected]">{{ addNew.new_text }}</span>
<select :name="name" :id="name" v-model="selected" class="d-none">
<select :name="name" :id="name" class="hidden">
<option v-for="option in sortedOptions" :key="option.key" :value="option.key">{{ option.value }}</option>
</select>
@@ -1089,6 +1089,33 @@ export default {
},
},
dynamicOptionsValue(options) {
if (! this.forceDynamicOptionValue) {
if (this.multiple) {
this.selected = [];
} else {
this.selected = null;
}
return;
}
if (this.multiple) {
let selected = this.selected;
this.selected = [];
selected.forEach(function (select, index) {
if (this.sorted_options.find((option) => option.key == select)) {
this.selected.push(select);
}
}, this);
} else {
if (! options.find((option) => option == this.selected)) {
this.selected = null;
}
}
},
watch: {
selected: function (selected) {
if (!this.multiple) {
@@ -1237,6 +1264,8 @@ export default {
}
}, this);
}
this.dynamicOptionsValue(options);
}
},
},

View File

@@ -479,6 +479,10 @@ export default class Form {
this.loading = true;
window.location.href = response.data.redirect;
if (window.location.hash !== undefined) {
location.reload();
}
}
this.response = response.data;

View File

@@ -52,7 +52,7 @@ const app = new Vue({
this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-email-component"><akaunting-modal-add-new modal-dialog-class="max-w-screen-md" :show="email.modal" @submit="onSubmit" @cancel="onCancel" :buttons="email.buttons" :title="email.title" :is_component=true :message="email.html"></akaunting-modal-add-new></div>',
template: '<div id="dynamic-email-component"><akaunting-modal-add-new modal-dialog-class="max-w-md" :show="email.modal" @submit="onSubmit" @cancel="onCancel" :buttons="email.buttons" :title="email.title" :is_component=true :message="email.html"></akaunting-modal-add-new></div>',
mixins: [
Global

View File

@@ -856,7 +856,7 @@ const app = new Vue({
this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-email-component"><akaunting-modal-add-new modal-dialog-class="max-w-screen-md" :show="email.modal" @submit="onSubmit" @cancel="onCancel" :buttons="email.buttons" :title="email.title" :is_component=true :message="email.html"></akaunting-modal-add-new></div>',
template: '<div id="dynamic-email-component"><akaunting-modal-add-new modal-dialog-class="max-w-md" :show="email.modal" @submit="onSubmit" @cancel="onCancel" :buttons="email.buttons" :title="email.title" :is_component=true :message="email.html"></akaunting-modal-add-new></div>',
mixins: [
Global

View File

@@ -30,7 +30,6 @@ const app = new Vue({
form: new Form('category'),
bulk_action: new BulkAction('categories'),
categoriesBasedTypes: null,
isParentCategoryDisabled: true,
}
},
@@ -42,7 +41,6 @@ const app = new Vue({
if (typeof JSON.parse(this.form.categories)[event] === 'undefined') {
this.categoriesBasedTypes = [];
this.isParentCategoryDisabled = true;
return;
}
@@ -54,7 +52,6 @@ const app = new Vue({
}
this.categoriesBasedTypes = JSON.parse(this.form.categories)[event];
this.isParentCategoryDisabled = false;
}
}
});