styling..

This commit is contained in:
Cüneyt Şentürk 2021-05-30 17:17:37 +03:00
parent 1d3cbadcb5
commit 03fce57394
4 changed files with 371 additions and 340 deletions

View File

@ -115,129 +115,140 @@ import AkauntingDate from "./../../components/AkauntingDate";
import WizardAction from "./../../mixins/wizardAction"; import WizardAction from "./../../mixins/wizardAction";
export default { export default {
name: "Company", name: "Company",
mixins: [WizardAction],
components: { mixins: [WizardAction],
[Step.name]: Step,
[Steps.name]: Steps, components: {
AkauntingDropzoneFileUpload, [Step.name]: Step,
AkauntingDate, [Steps.name]: Steps,
}, AkauntingDropzoneFileUpload,
props: { AkauntingDate,
company: {
type: [Object, Array],
},
translations: {
type: [Object, Array],
},
url: {
type: String,
default: "text",
},
},
data() {
return {
active: 0,
logo: [],
real_date: "",
};
},
mounted() {
let company_data = this.company;
this.onDataWatch(company_data);
},
watch: {
company: function (company) {
this.onDataWatch(company);
},
},
methods: {
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;
}
}, },
onEditSave() { props: {
FormData.prototype.appendRecursive = function (data, wrapper = null) { company: {
for (var name in data) { type: [Object, Array],
if (name == "previewElement" || name == "previewTemplate") { },
continue;
}
if (wrapper) {
if (
(typeof data[name] == "object" || Array.isArray(data[name])) &&
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" || Array.isArray(data[name])) &&
data[name] instanceof File != true &&
data[name] instanceof Blob != true
) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
const formData = new FormData(this.$refs["form"]); translations: {
let data_name = {}; type: [Object, Array],
},
url: {
type: String,
default: "text",
},
},
data() {
return {
active: 0,
logo: [],
real_date: "",
};
},
mounted() {
let company_data = this.company;
this.onDataWatch(company_data);
},
methods: {
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;
}
},
onEditSave() {
FormData.prototype.appendRecursive = function (data, wrapper = null) {
for (var name in data) {
if (name == "previewElement" || name == "previewTemplate") {
continue;
}
if (wrapper) {
if (
(typeof data[name] == "object" || Array.isArray(data[name])) &&
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" || Array.isArray(data[name])) &&
data[name] instanceof File != true &&
data[name] instanceof Blob != true
) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
const formData = new FormData(this.$refs["form"]);
let data_name = {};
for (let [key, val] of formData.entries()) { for (let [key, val] of formData.entries()) {
Object.assign(data_name, { Object.assign(data_name, {
[key]: val, [key]: val,
["logo"]: this.$refs.dropzoneWizard.files[1] ["logo"]: this.$refs.dropzoneWizard.files[1]
? this.$refs.dropzoneWizard.files[1] ? this.$refs.dropzoneWizard.files[1]
: this.$refs.dropzoneWizard.files[0], : this.$refs.dropzoneWizard.files[0],
["_prefix"]: "company", ["_prefix"]: "company",
["_token"]: window.Laravel.csrfToken, ["_token"]: window.Laravel.csrfToken,
["_method"]: "POST", ["_method"]: "POST",
}); });
} }
formData.appendRecursive(data_name); formData.appendRecursive(data_name);
window
.axios({ window.axios({
method: "POST", method: "POST",
url: url + "/wizard/companies", url: url + "/wizard/companies",
data: formData, data: formData,
headers: { headers: {
"X-CSRF-TOKEN": window.Laravel.csrfToken, "X-CSRF-TOKEN": window.Laravel.csrfToken,
"X-Requested-With": "XMLHttpRequest", "X-Requested-With": "XMLHttpRequest",
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
}, },
}) })
.then((response) => { .then((response) => {
this.onSuccessMessage(response); this.onSuccessMessage(response);
this.$router.push("/wizard/currencies"); this.$router.push("/wizard/currencies");
}, this) }, this)
.catch((error) => { .catch((error) => {
}, this); }, this);
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/currencies");
},
}, },
next() { watch: {
if (this.active++ > 2); company: function (company) {
this.$router.push("/wizard/currencies"); this.onDataWatch(company);
},
}, },
},
}; };
</script> </script>

View File

@ -299,124 +299,133 @@ import MixinsGlobal from "./../../mixins/global";
import WizardAction from "./../../mixins/wizardAction"; import WizardAction from "./../../mixins/wizardAction";
export default { export default {
name: "Currencies", name: "Currencies",
mixins: [MixinsGlobal, WizardAction],
components: { mixins: [MixinsGlobal, WizardAction],
[Step.name]: Step,
[Steps.name]: Steps, components: {
[Select.name]: Select, [Step.name]: Step,
[Option.name]: Option, [Steps.name]: Steps,
AkauntingRadioGroup, [Select.name]: Select,
}, [Option.name]: Option,
props: { AkauntingRadioGroup,
currencies: {
type: [Object, Array],
},
currency_codes: {
type: [Object, Array],
},
translations: {
type: [Object, Array],
},
},
data() {
return {
active: 1,
bulk_action: new BulkAction(url + "/settings/currencies"),
};
},
methods: {
onSwitchUpdate(item) {
this.onStatus(item.id, event);
this.onStatusControl(this.currencies, item.id, event);
}, },
onClickDelete(item) { props: {
this.confirmDelete( currencies: {
`${ type: [Object, Array],
new URL(url).protocol + },
"//" +
location.host + currency_codes: {
location.pathname + type: [Object, Array],
"/" + },
item.id
}`, translations: {
this.translations.currencies.title, type: [Object, Array],
`Confirm Delete <strong>${item.name}</strong> ${this.translations.currencies.title}?`, },
this.translations.currencies.cancel,
this.translations.currencies.delete
);
}, },
onDeleteCurrency(event) { data() {
this.onEjetItem(event, this.currencies, event.currency_id); return {
active: 1,
bulk_action: new BulkAction(url + "/settings/currencies"),
};
}, },
onChangeCodeItem(code) { methods: {
const formData = new FormData(this.$refs["form"]); onSwitchUpdate(item) {
const data = { this.onStatus(item.id, event);
rate: "",
precision: "",
symbol: "",
symbol_first: "",
decimal_mark: "",
thousands_separator: "",
};
for (let [key, val] of formData.entries()) { this.onStatusControl(this.currencies, item.id, event);
Object.assign(data, { },
[key]: val,
});
}
window onClickDelete(item) {
.axios({ this.confirmDelete(
method: "GET", `${
url: url + "/settings/currencies/config", new URL(url).protocol +
params: { "//" +
code: code, location.host +
}, location.pathname +
}) "/" +
.then((response) => { item.id
data.rate = response.data.rate; }`,
data.precision = response.data.precision; this.translations.currencies.title,
data.symbol = response.data.symbol; `Confirm Delete <strong>${item.name}</strong> ${this.translations.currencies.title}?`,
data.symbol_first = response.data.symbol_first; this.translations.currencies.cancel,
data.decimal_mark = response.data.decimal_mark; this.translations.currencies.delete
data.thousands_separator = response.data.thousands_separator; );
this.model.rate = response.data.rate; },
}, this);
onDeleteCurrency(event) {
this.onEjetItem(event, this.currencies, event.currency_id);
},
onChangeCodeItem(code) {
const formData = new FormData(this.$refs["form"]);
const data = {
rate: "",
precision: "",
symbol: "",
symbol_first: "",
decimal_mark: "",
thousands_separator: "",
};
for (let [key, val] of formData.entries()) {
Object.assign(data, {
[key]: val,
});
}
window.axios({
method: "GET",
url: url + "/settings/currencies/config",
params: {
code: code,
},
})
.then((response) => {
data.rate = response.data.rate;
data.precision = response.data.precision;
data.symbol = response.data.symbol;
data.symbol_first = response.data.symbol_first;
data.decimal_mark = response.data.decimal_mark;
data.thousands_separator = response.data.thousands_separator;
this.model.rate = response.data.rate;
}, this);
},
onEditForm(item) {
this.onSubmitEvent(
"PATCH",
url + "/wizard/currencies/" + item.id,
"",
this.currencies,
item.id
);
},
onSubmitForm() {
this.onSubmitEvent(
"POST",
url + "/wizard/currencies",
"",
this.currencies
);
},
prev() {
if (this.active-- > 2);
history.back()
this.$router.push("/wizard/companies");
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/taxes");
},
}, },
onEditForm(item) {
this.onSubmitEvent(
"PATCH",
url + "/wizard/currencies/" + item.id,
"",
this.currencies,
item.id
);
},
onSubmitForm() {
this.onSubmitEvent(
"POST",
url + "/wizard/currencies",
"",
this.currencies
);
},
prev() {
if (this.active-- > 2);
history.back()
this.$router.push("/wizard/companies");
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/taxes");
},
},
}; };
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div v-if="is_loaded"> <div>
<h1 class="text-white">{{ translations.finish.title }}</h1> <h1 class="text-white">{{ translations.finish.title }}</h1>
<div class="card"> <div class="card">
<div class="card-header wizard-header p-3"> <div class="card-header wizard-header p-3">
@ -87,57 +87,61 @@
import { Step, Steps } from "element-ui"; import { Step, Steps } from "element-ui";
export default { export default {
name: "Finish", name: "Finish",
components: {
[Step.name]: Step, components: {
[Steps.name]: Steps, [Step.name]: Step,
}, [Steps.name]: Steps,
created() { },
window
.axios({ props: {
method: "PATCH", modules: {
url: url + "/wizard/finish", type: [Object, Array],
}) },
.then((response) => {
if (response.status == "200") { translations: {
this.is_loaded = true; type: [Object, Array],
} }
}) },
.catch((error) => {
this.$notify({ data() {
message: this.translations.finish.error_message, return {
timeout: 1000, active: 3,
icon: "fas fa-bell", route_url: url,
type: 0 };
},
created() {
window.axios({
method: "PATCH",
url: url + "/wizard/finish",
})
.then((response) => {
})
.catch((error) => {
this.$notify({
message: this.translations.finish.error_message,
timeout: 1000,
icon: "fas fa-bell",
type: 0
});
this.prev();
}); });
this.prev();
});
},
props: {
modules: {
type: [Object, Array],
},
translations: {
type: [Object, Array],
}
},
data() {
return {
active: 3,
route_url: url,
is_loaded: false
};
},
methods: {
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/taxes");
}, },
finish() { methods: {
window.location.href = url; prev() {
this.active--;
if (this.active > 2) {
this.$router.push("/wizard/taxes");
}
},
finish() {
window.location.href = url;
},
}, },
},
}; };
</script> </script>

View File

@ -229,82 +229,89 @@ import MixinsGlobal from "./../../mixins/global";
import WizardAction from "./../../mixins/wizardAction"; import WizardAction from "./../../mixins/wizardAction";
export default { export default {
name: "Taxes", name: "Taxes",
mixins: [MixinsGlobal, WizardAction],
components: { mixins: [MixinsGlobal, WizardAction],
[Step.name]: Step,
[Steps.name]: Steps, components: {
AkauntingRadioGroup, [Step.name]: Step,
}, [Steps.name]: Steps,
props: { AkauntingRadioGroup,
taxes: {
type: [Object, Array],
},
translations: {
type: [Object, Array],
},
},
data() {
return {
active: 2,
bulk_action: new BulkAction(url + "/settings/taxes"),
};
},
methods: {
onSwitchUpdate(item) {
this.onStatus(item.id, event);
this.onStatusControl(this.taxes, item.id, event);
}, },
onClickDelete(item) { props: {
this.confirmDelete( taxes: {
`${ type: [Object, Array],
new URL(url).protocol + },
"//" +
location.host + translations: {
location.pathname + type: [Object, Array],
"/" + },
item.id
}`,
this.translations.taxes.title,
`${
this.translations.currencies.title +
"&nbsp;" +
this.translations.currencies.delete
} <strong>${item.name}</strong>?`,
this.translations.taxes.cancel,
this.translations.taxes.delete
);
}, },
onDeleteCurrency(event) { data() {
this.onEjetItem(event, this.taxes, event.tax_id); return {
active: 2,
bulk_action: new BulkAction(url + "/settings/taxes"),
};
}, },
onEditForm(item) { methods: {
this.onSubmitEvent( onSwitchUpdate(item) {
"PATCH", this.onStatus(item.id, event);
url + "/wizard/taxes/" + item.id,
"type",
this.taxes,
item.id
);
},
onSubmitForm() { this.onStatusControl(this.taxes, item.id, event);
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes); },
},
prev() { onClickDelete(item) {
if (this.active-- > 2); this.confirmDelete(
this.$router.push("/wizard/currencies"); `${
}, new URL(url).protocol +
"//" +
location.host +
location.pathname +
"/" +
item.id
}`,
this.translations.taxes.title,
`${
this.translations.currencies.title +
"&nbsp;" +
this.translations.currencies.delete
} <strong>${item.name}</strong>?`,
this.translations.taxes.cancel,
this.translations.taxes.delete
);
},
next() { onDeleteCurrency(event) {
if (this.active++ > 2); this.onEjetItem(event, this.taxes, event.tax_id);
this.$router.push("/wizard/finish"); },
onEditForm(item) {
this.onSubmitEvent(
"PATCH",
url + "/wizard/taxes/" + item.id,
"type",
this.taxes,
item.id
);
},
onSubmitForm() {
this.onSubmitEvent("POST", url + "/wizard/taxes", "type", this.taxes);
},
prev() {
if (this.active-- > 2);
this.$router.push("/wizard/currencies");
},
next() {
if (this.active++ > 2);
this.$router.push("/wizard/finish");
},
}, },
},
}; };
</script> </script>