Wizard edited

This commit is contained in:
Burak Civan 2021-05-28 15:45:19 +03:00
parent aaa7f79670
commit 0a9d80ca1b
7 changed files with 177 additions and 149 deletions

View File

@ -98,6 +98,7 @@ class Data extends Controller
'developer' => trans('modules.developer'),
'previous' => trans('pagination.previous'),
'go_to_dashboard' => trans('general.go_to_dashboard'),
'error_message' => trans('errors.title.500'),
]
];

View File

@ -26,8 +26,11 @@
/>
<p class="mb-0 mt--3">
<small>
<div><a href="https://akaunting.com/dashboard" target="_blank">Click here</a>
to get your API key.
<div>
<a href="https://akaunting.com/dashboard" target="_blank"
>Click here</a
>
to get your API key.
</div>
</small>
</p>
@ -71,14 +74,16 @@
</base-input>
</div>
<div class="col-3">
<label class="form-control-label">{{ translations.company.logo }}</label>
<akaunting-dropzone-file-upload
ref="dropzoneWizard"
preview-classes="single"
:attachments="logo"
:v-model="logo"
>
</akaunting-dropzone-file-upload>
<label class="form-control-label">{{
translations.company.logo
}}</label>
<akaunting-dropzone-file-upload
ref="dropzoneWizard"
preview-classes="single"
:attachments="logo"
:v-model="logo"
>
</akaunting-dropzone-file-upload>
</div>
</div>
</div>
@ -86,7 +91,7 @@
<div class="row">
<div class="col-md-12 text-right">
<base-button
id="button"
id="button"
type="success"
native-type="submit"
@click="onEditSave()"
@ -107,11 +112,11 @@
import { Step, Steps } from "element-ui";
import AkauntingDropzoneFileUpload from "./../../components/AkauntingDropzoneFileUpload";
import AkauntingDate from "./../../components/AkauntingDate";
import MixinsSpaGlobal from "./../../mixins/spa-global";
import WizardAction from "./wizardAction";
export default {
name: "Company",
mixins: [MixinsSpaGlobal],
mixins: [WizardAction],
components: {
[Step.name]: Step,
[Steps.name]: Steps,
@ -127,8 +132,8 @@ export default {
},
url: {
type: String,
default: 'text'
}
default: "text",
},
},
data() {
return {
@ -139,40 +144,40 @@ export default {
},
mounted() {
let company_data = this.company;
this.dataWatch(company_data);
this.onDataWatch(company_data);
},
watch: {
company: function (company) {
this.dataWatch(company);
this.onDataWatch(company);
},
},
methods: {
dataWatch(company) {
if(Object.keys(company).length) {
let logo_arr = [
{
id: company.logo.id,
name: company.logo.filename + "." + company.logo.extension,
path: company.logo.path,
type: company.logo.mime_type,
size: company.logo.size,
downloadPath: false,
},
];
this.logo.push(logo_arr);
this.real_date = company.financial_start;
onDataWatch(company) {
if (Object.keys(company).length) {
let logo_arr = [
{
id: company.logo.id,
name: company.logo.filename + "." + company.logo.extension,
path: company.logo.path,
type: company.logo.mime_type,
size: company.logo.size,
downloadPath: false,
},
];
this.logo.push(logo_arr);
this.real_date = company.financial_start;
}
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/currencies");
},
onEditSave() {
this.onEditCompany();
this.$router.push("/wizard/currencies");
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/currencies");
},
},
};
</script>

View File

@ -20,7 +20,7 @@
type="success"
native-type="button"
class="btn-sm"
@click="addItem()"
@click="onAddItem()"
>{{ translations.currencies.add_new }}</base-button
>
</div>
@ -63,7 +63,7 @@
<input
type="checkbox"
:checked="item.enabled"
@input="inputHandle(item)"
@input="onSwitchUpdate(item)"
/>
<span
class="custom-toggle-slider rounded-circle status-green"
@ -92,7 +92,7 @@
<button
type="button"
class="dropdown-item"
@click="handeClickEdit(item, index)"
@click="onEditItem(item, index)"
>
{{ translations.currencies.edit }}
</button>
@ -100,14 +100,14 @@
<button
type="button"
class="dropdown-item"
@click="handleClickDelete(item)"
@click="onClickDelete(item)"
>
{{ translations.currencies.delete }}
</button>
</div>
</div>
</td>
<td class="w-100 p-0 current-tab" v-if="currentTab == index">
<td class="w-100 p-0 current-tab" v-if="current_tab == index">
<div class="row pt-3 pb-3">
<div
class="form-container col-12 d-flex justify-content-between align-items-start"
@ -132,7 +132,7 @@
<el-select
name="code"
v-model="model.select"
@change="onChangeCode(model.select)"
@change="onChangeCodeItem(model.select)"
filterable
>
<template slot="prefix">
@ -167,14 +167,14 @@
<base-button
type="white"
native-type="button"
@click="handleClickCancel()"
@click="onCancelItem()"
>
{{ translations.currencies.cancel }}</base-button
>
<base-button
type="success"
native-type="button"
@click="onEditSave(item)"
@click="onEditForm(item)"
>
{{ translations.currencies.save }}</base-button
>
@ -183,7 +183,7 @@
</div>
</td>
</tr>
<tr v-if="newDatas">
<tr v-if="new_datas">
<td class="p-0">
<div class="row pt-3 pb-3">
<div
@ -208,7 +208,7 @@
name="code"
v-model="model.select"
required="required"
@change="onChangeCode(model.select)"
@change="onChangeCodeItem(model.select)"
filterable
>
<template slot="prefix">
@ -271,7 +271,7 @@
<form id="form-dynamic-component" method="POST" action="#"></form>
<component
v-bind:is="component"
@deleted="deleteCurrency($event)"
@deleted="onDeleteCurrency($event)"
></component>
</div>
@ -296,11 +296,11 @@ import { Step, Steps, Select, Option } from "element-ui";
import AkauntingRadioGroup from "./../../components/forms/AkauntingRadioGroup";
import BulkAction from "./../../plugins/bulk-action";
import MixinsGlobal from "./../../mixins/global";
import MixinsSpaGlobal from "./../../mixins/spa-global";
import WizardAction from "./wizardAction";
export default {
name: "Currencies",
mixins: [MixinsGlobal, MixinsSpaGlobal],
mixins: [MixinsGlobal, WizardAction],
components: {
[Step.name]: Step,
[Steps.name]: Steps,
@ -326,12 +326,12 @@ export default {
};
},
methods: {
inputHandle(item) {
onSwitchUpdate(item) {
this.onStatus(item.id, event);
this.onStatusControl(this.currencies, item.id, event);
},
handleClickDelete(item) {
onClickDelete(item) {
this.confirmDelete(
`${
new URL(url).protocol +
@ -348,17 +348,11 @@ export default {
);
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/taxes");
onDeleteCurrency(event) {
this.onEjetItem(event, this.currencies, event.currency_id);
},
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/companies");
},
onChangeCode(code) {
onChangeCodeItem(code) {
const formData = new FormData(this.$refs["form"]);
const data = {
rate: "",
@ -394,8 +388,8 @@ export default {
}, this);
},
onEditSave(item) {
this.onEditEvent(
onEditForm(item) {
this.onEditItemEvent(
"PATCH",
url + "/wizard/currencies/" + item.id,
"",
@ -413,8 +407,14 @@ export default {
);
},
deleteCurrency(event) {
this.onDeleteEvent(event, this.currencies, event.currency_id);
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/companies");
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/taxes");
},
},
};

View File

@ -1,5 +1,5 @@
<template>
<div>
<div v-if="is_loaded">
<h1 class="text-white">{{ translations.finish.title }}</h1>
<div class="card">
<div class="card-header wizard-header p-3">
@ -14,34 +14,47 @@
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="content-header">
<h3 class="text-white">{{ translations.finish.recommended_apps }}</h3>
<h3 class="text-white">
{{ translations.finish.recommended_apps }}
</h3>
</div>
<div class="row">
<div v-for="(item, index) in modules" :key="index" class="col-md-3">
<div
v-for="(item, index) in modules"
:key="index"
class="col-md-3"
>
<div class="card">
<div class="card-header py-2">
<h4 class="ml--3 mb-0 float-left">
<a
:href="item.slug"
>{{ item.name }}</a
>
<a :href="item.slug">{{ item.name }}</a>
</h4>
</div>
<a :href="route_url + '/' + item.slug"
><img
v-for="(file, indis) in item.files" :key="indis"
v-if="file.media_type == 'image' && file.pivot.zone == 'thumbnail'"
v-for="(file, indis) in item.files"
:key="indis"
v-if="
file.media_type == 'image' &&
file.pivot.zone == 'thumbnail'
"
:src="file.path_string"
:alt="item.name"
class="card-img-top border-radius-none"
/></a>
<div class="card-footer py-2">
<div class="float-left ml--3 mt--1">
<i v-for="(stars, indis) in item.vote" :key="indis" class="fa fa-star text-xs text-yellow"></i>
<i
v-for="(stars, indis) in item.vote"
:key="indis"
class="fa fa-star text-xs text-yellow"
></i>
<small class="text-xs"> {{ item.total_review }} </small>
</div>
<div class="float-right mr--3">
<small><strong> {{ item.price }} </strong></small>
<small
><strong> {{ item.price }} </strong></small
>
</div>
</div>
</div>
@ -54,10 +67,13 @@
<div class="card-footer">
<div class="row">
<div class="col-md-12 d-flex justify-content-between">
<base-button type="white" native-type="submit" @click="prev()"
>{{ translations.finish.previous }}</base-button
>
<base-button type="success" native-type="submit" v-if="button_show" @click="finish()"
<base-button type="white" native-type="submit" @click="prev()">{{
translations.finish.previous
}}</base-button>
<base-button
type="success"
native-type="submit"
@click="finish()"
>{{ translations.finish.go_to_dashboard }}</base-button
>
</div>
@ -68,7 +84,6 @@
</template>
<script>
import { Step, Steps } from "element-ui";
export default {
@ -78,41 +93,51 @@ export default {
[Steps.name]: Steps,
},
created() {
window.axios({
method: 'PATCH',
url: url + '/wizard/finish'
}).then(response => {
if(response.status == "200") {
this.button_show = true;
}
window
.axios({
method: "PATCH",
url: url + "/wizard/finish",
})
.then((response) => {
if (response.status == "200") {
this.is_loaded = true;
}
})
.catch((error) => {
this.$notify({
message: this.translations.finish.error_message,
timeout: 1000,
icon: "fas fa-bell",
type: 0
});
}).catch(error => {
});
this.prev();
});
},
props: {
modules: {
type: [Object, Array]
type: [Object, Array],
},
translations: {
type: [Object, Array]
type: [Object, Array],
}
},
data() {
return {
active: 3,
route_url: url,
button_show: false
is_loaded: false
};
},
methods: {
finish() {
window.location.href = url;
},
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/taxes");
},
finish() {
window.location.href = url;
},
},
};
</script>

View File

@ -16,7 +16,7 @@
type="success"
native-type="button"
class="btn-sm"
@click="addItem()"
@click="onAddItem()"
>{{ translations.taxes.add_new }}</base-button
>
</div>
@ -54,7 +54,7 @@
<input
type="checkbox"
:checked="item.enabled"
@input="inputHandle(item)"
@input="onSwitchUpdate(item)"
/>
<span
class="custom-toggle-slider rounded-circle status-green"
@ -83,7 +83,7 @@
<button
type="button"
class="dropdown-item"
@click="handeClickEdit(item, index)"
@click="onEditItem(item, index)"
>
{{ translations.taxes.edit }}
</button>
@ -91,14 +91,14 @@
<button
type="button"
class="dropdown-item"
@click="handleClickDelete(item)"
@click="onClickDelete(item)"
>
{{ translations.taxes.delete }}
</button>
</div>
</div>
</td>
<td class="w-100 p-0 current-tab" v-if="currentTab == index">
<td class="w-100 p-0 current-tab" v-if="current_tab == index">
<div class="row pt-3 pb-3">
<div
class="form-container col-12 d-flex justify-content-between align-items-start"
@ -129,14 +129,14 @@
<base-button
type="white"
native-type="button"
@click="handleClickCancel()"
@click="onCancelItem()"
>
{{ translations.taxes.cancel }}</base-button
>
<base-button
type="success"
native-type="button"
@click="onEditSave(item)"
@click="onEditForm(item)"
>{{ translations.taxes.save }}</base-button
>
</div>
@ -144,7 +144,7 @@
</div>
</td>
</tr>
<tr v-if="newDatas">
<tr v-if="new_datas">
<td class="p-0">
<div class="row pt-3 pb-3">
<div
@ -202,7 +202,7 @@
<form id="form-dynamic-component" method="POST" action="#"></form>
<component
v-bind:is="component"
@deleted="deleteCurrency($event)"
@deleted="onDeleteCurrency($event)"
></component>
</div>
<div class="card-footer">
@ -226,11 +226,11 @@ import { Step, Steps } from "element-ui";
import AkauntingRadioGroup from "./../../components/forms/AkauntingRadioGroup";
import BulkAction from "./../../plugins/bulk-action";
import MixinsGlobal from "./../../mixins/global";
import MixinsSpaGlobal from "./../../mixins/spa-global";
import WizardAction from "./wizardAction";
export default {
name: "Taxes",
mixins: [MixinsGlobal, MixinsSpaGlobal],
mixins: [MixinsGlobal, WizardAction],
components: {
[Step.name]: Step,
[Steps.name]: Steps,
@ -251,12 +251,12 @@ export default {
};
},
methods: {
inputHandle(item) {
onSwitchUpdate(item) {
this.onStatus(item.id, event);
this.onStatusControl(this.taxes, item.id, event);
},
handleClickDelete(item) {
onClickDelete(item) {
this.confirmDelete(
`${
new URL(url).protocol +
@ -277,18 +277,12 @@ export default {
);
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/finish");
onDeleteCurrency(event) {
this.onEjetItem(event, this.taxes, event.tax_id);
},
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/currencies");
},
onEditSave(item) {
this.onEditEvent(
onEditForm(item) {
this.onEditItemEvent(
"PATCH",
url + "/wizard/taxes/" + item.id,
"type",
@ -300,9 +294,15 @@ export default {
onSubmitForm() {
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes);
},
deleteCurrency(event) {
this.onDeleteEvent(event, this.taxes, event.tax_id);
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/currencies");
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/finish");
},
},
};

View File

@ -2,8 +2,8 @@
export default {
data: function () {
return {
currentTab: undefined,
newDatas: false,
current_tab: undefined,
new_datas: false,
model: {
name: "",
rate: "",
@ -14,9 +14,9 @@ export default {
}
},
methods: {
addItem() {
this.newDatas = true;
this.currentTab = undefined;
onAddItem() {
this.new_datas = true;
this.current_tab = undefined;
this.error_field = {};
if (this.model) {
@ -26,9 +26,9 @@ export default {
}
},
handeClickEdit(item, index) {
this.newDatas = false;
this.currentTab = index;
onEditItem(item, index) {
this.new_datas = false;
this.current_tab = index;
this.error_field = {};
if (this.model) {
@ -38,20 +38,20 @@ export default {
}
},
handleClickCancel() {
this.currentTab = undefined;
onCancelItem() {
this.current_tab = undefined;
},
dataHandleEvent() {
this.newDatas = false;
this.currentTab = undefined;
onDataChange() {
this.new_datas = false;
this.current_tab = undefined;
this.model.name = '';
this.model.rate = '';
this.model.select = '';
this.model.enabled = 1;
},
onSuccessEvent(response) {
onSuccessMessage(response) {
let type = response.data.success ? 'success' : 'error';
let timeout = 1000;
@ -66,10 +66,10 @@ export default {
type,
});
this.dataHandleEvent();
this.onDataChange();
},
onSuccessDelete(event) {
onDeleteItemMessage(event) {
let type = event.success ? 'success' : 'error';
let timeout = 1000;
@ -84,7 +84,7 @@ export default {
type,
});
this.dataHandleEvent();
this.onDataChange();
},
onStatusControl(status_form, status_item, event) {
@ -95,7 +95,7 @@ export default {
});
},
onEditEvent(form_method, form_url, plus_data, form_list, form_id) {
onEditItemEvent(form_method, form_url, plus_data, form_list, form_id) {
const formData = new FormData(this.$refs["form"]);
const data = {};
@ -128,7 +128,7 @@ export default {
});
}
this.onSuccessEvent(response);
this.onSuccessMessage(response);
}, this)
.catch(error => {
this.onFailError(error)
@ -165,7 +165,7 @@ export default {
"enabled": response.data.data.enabled != undefined ? response.data.data.enabled : 'true'
});
this.onSuccessEvent(response);
this.onSuccessMessage(response);
}, this)
.catch(error => {
this.onFailError(error);
@ -220,14 +220,14 @@ export default {
}
})
.then(response => {
this.onSuccessEvent(response);
this.onSuccessMessage(response);
}, this)
.catch(error => {
this.onFailError(error)
}, this);
},
onDeleteEvent(event, form_list, event_id) {
onEjetItem(event, form_list, event_id) {
form_list.forEach(function (item, index) {
if (item.id == event_id) {
form_list.splice(index, 1);
@ -237,7 +237,7 @@ export default {
this.component = "";
this.onSuccessDelete(event);
this.onDeleteItemMessage(event);
},
onFailErrorGet(field_name) {

View File

@ -5,11 +5,10 @@ import Vue from 'vue';
import VueRouter from 'vue-router';
import DashboardPlugin from './plugins/dashboard-plugin';
import Wizard from './Wizard.vue';
Vue.use(DashboardPlugin);
Vue.use(VueRouter);
import Wizard from './Wizard.vue';
import Company from './views/wizard/Company.vue';
import Currencies from './views/wizard/Currencies.vue';
import Taxes from './views/wizard/Taxes.vue';
@ -53,11 +52,9 @@ const router = new VueRouter({
if (savedPosition) {
return savedPosition;
}
if (to.hash) {
return { selector: to.hash };
}
return { x: 0, y: 0 };
}
});