commit
fc18ee49db
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
{
|
||||
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=c4a401caebe3c2e07327",
|
||||
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=85f1631d3994891a32ac",
|
||||
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=a828a243b3741b14fc5e",
|
||||
"/js/vue/Modules/Reservation/app.js": "/js/vue/Modules/Reservation/app.js?id=72de11d485732e00a6ee",
|
||||
"/js/vue/User/app.js": "/js/vue/User/app.js?id=89a9264b54775a35224c"
|
||||
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=f01c1b5058842989bda8",
|
||||
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=2a67932b9f1c2c43df90",
|
||||
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=cbbc762df1ddb670242b",
|
||||
"/js/vue/Modules/Reservation/app.js": "/js/vue/Modules/Reservation/app.js?id=262f8b64cafdb30a40eb",
|
||||
"/js/vue/User/app.js": "/js/vue/User/app.js?id=9a0599de25555c864f98"
|
||||
}
|
||||
|
@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<v-dialog v-model="modal" width="40%" transition="slide-x-transition">
|
||||
<v-card class="RTL">
|
||||
<v-card-title class="red lighten-5" primary-title>
|
||||
<WM-PartTitle
|
||||
class="WM-Margin-T-20"
|
||||
:TitleFa="getAlertProperties.title || defaultMessage[type].title"
|
||||
:TitleEn="getAlertProperties.titleEn || defaultMessage[type].titleEn"
|
||||
:Color="getAlertProperties.color || defaultMessage[type].color"
|
||||
></WM-PartTitle>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<div class="WM-Align-R WM-Margin-T-10">{{ getAlertProperties.message || defaultMessage[type].message }}</div>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn :color="getAlertProperties.cancelButtonColor || defaultMessage[type].cancelButtonColor" @click="cancel" depressed dark>
|
||||
<v-icon dark right>fas fa-times</v-icon>
|
||||
{{getAlertProperties.cancelButtonText || defaultMessage[type].cancelButtonText}}
|
||||
</v-btn>
|
||||
<v-btn :color="getAlertProperties.confirmButtonColor || defaultMessage[type].confirmButtonColor" depressed dark @click="confirm">
|
||||
<v-icon dark right>fas fa-trash-alt</v-icon>
|
||||
{{getAlertProperties.confirmButtonText || defaultMessage[type].confirmButtonText}}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
export default {
|
||||
data: () => ({
|
||||
defaultMessage: {
|
||||
delete: {
|
||||
onConfirm: function() {
|
||||
return "";
|
||||
},
|
||||
onCancel: function() {
|
||||
return "";
|
||||
},
|
||||
message:
|
||||
"آیا از حذف آیتم مطمئن هستید؟ امکان بازگشت وجود نخواهد داشت.",
|
||||
title: " تایید حذف ",
|
||||
titleEn: " Remove Confirmation ",
|
||||
color: "red",
|
||||
cancelButtonText: "انصراف",
|
||||
confirmButtonText: "حذف",
|
||||
cancelButtonColor: "cyan",
|
||||
confirmButtonColor: "red"
|
||||
},
|
||||
},
|
||||
type: 'delete'
|
||||
}),
|
||||
watch: {
|
||||
getAlertType(type) {
|
||||
if (["delete"].includes(type)) {
|
||||
this.type = type;
|
||||
} else {
|
||||
this.type = "delete";
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
...mapGetters('modal', ['getAlertType', 'getAlertProperties', 'isModal']),
|
||||
modal: {
|
||||
get() {
|
||||
return this.isModal("modal/alert");
|
||||
},
|
||||
set(value) {
|
||||
if (value) {
|
||||
this.openModal("modal/alert");
|
||||
} else {
|
||||
this.closeModal("modal/alert");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions('modal', ['closeModal']),
|
||||
async confirm() {
|
||||
|
||||
if(typeof this.getAlertProperties.onConfirm == 'function') {
|
||||
await this.getAlertProperties.onConfirm();
|
||||
}
|
||||
this.closeModal('modal/alert');
|
||||
},
|
||||
async cancel() {
|
||||
if(typeof this.getAlertProperties.onCancel == 'function') {
|
||||
await this.getAlertProperties.onCancel();
|
||||
}
|
||||
this.closeModal('modal/alert');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,3 +1,17 @@
|
||||
export default {
|
||||
//
|
||||
//Modal
|
||||
SET_RESULT_CURRENT_MODAL(state, result) {
|
||||
state.result = result;
|
||||
},
|
||||
SET_PROPERTIES_CURRENT_MODAL(state, properties) {
|
||||
state.properties = properties;
|
||||
},
|
||||
|
||||
//Alert
|
||||
SET_ALERT_TYPE(state, type = 'delete') {
|
||||
state.alertType = type;
|
||||
},
|
||||
SET_ALERT_PROPERTIES(state, properties = {}) {
|
||||
state.alertProperties = properties;
|
||||
}
|
||||
};
|
||||
|
@ -1,4 +1,10 @@
|
||||
export default {
|
||||
properties: null,
|
||||
result: null
|
||||
result: null,
|
||||
|
||||
modal:{
|
||||
alert: false,
|
||||
},
|
||||
alertProperties: {},
|
||||
alertType: {}
|
||||
};
|
||||
|
@ -0,0 +1,9 @@
|
||||
const WMAlert = {
|
||||
delete(Options) {
|
||||
let text = Options.text ? Options.text : 'آیا از حذف آیتم مطمئن هستید؟ امکان بازگشت وجود نخواهد نداشت. ';
|
||||
let removeCallBack = Options.remove ? Options.remove : function () {} ;
|
||||
},
|
||||
success(){
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,240 @@
|
||||
// const convertTreeToList = (data) => {
|
||||
// var arrayList = [];
|
||||
|
||||
// function recursiveFunction(array) {
|
||||
// for (const iterator of array) {
|
||||
// if (iterator.children && iterator.children.length) {
|
||||
// let clone = Object.assign({}, iterator);
|
||||
// delete clone.children;
|
||||
// arrayList.push(clone);
|
||||
// let list = recursiveFunction(iterator.children);
|
||||
// arrayList.concat(list);
|
||||
// } else {
|
||||
// arrayList.push(iterator);
|
||||
// }
|
||||
// }
|
||||
// return arrayList;
|
||||
// }
|
||||
|
||||
// return recursiveFunction(data);
|
||||
// };
|
||||
const convertTreeToList = data => {
|
||||
var arrayList = {};
|
||||
|
||||
function recursiveFunction(
|
||||
array,
|
||||
level,
|
||||
hierarchy = [],
|
||||
hierarchy_id = [],
|
||||
parent_id = null
|
||||
) {
|
||||
for (const key in array) {
|
||||
if (array.hasOwnProperty(key)) {
|
||||
let new_hierarchy = [...hierarchy];
|
||||
let new_hierarchy_id = [...hierarchy_id];
|
||||
new_hierarchy.push(key);
|
||||
new_hierarchy_id.push(array[key].id);
|
||||
let clone = Object.assign({}, array[key]);
|
||||
|
||||
//set level
|
||||
clone.lvl = level;
|
||||
//set level
|
||||
clone.parent_id = parent_id;
|
||||
//set hierarchy key Base Tree Array
|
||||
clone.hierarchy = new_hierarchy;
|
||||
//set hierarchy id Base Tree Array
|
||||
clone.hierarchy_id = new_hierarchy_id;
|
||||
//set hasChildren
|
||||
clone.hasChildren = false;
|
||||
|
||||
delete clone.children;
|
||||
arrayList[clone.id] = clone;
|
||||
if (array[key].children && array[key].children.length) {
|
||||
arrayList[clone.id].hasChildren = true;
|
||||
recursiveFunction(
|
||||
array[key].children,
|
||||
level + 1,
|
||||
new_hierarchy,
|
||||
new_hierarchy_id,
|
||||
array[key].id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
return recursiveFunction(data, 1);
|
||||
};
|
||||
const listSearchSelect = Options => {
|
||||
let treeArray = Options.array ? Options.array : [];
|
||||
var listArray = Options.list ? Options.list : convertTreeToList(treeArray);
|
||||
var fromLevel = Options.fromLevel ? Options.fromLevel : 1;
|
||||
var justLevel = Options.justLevel ? Options.justLevel : null;
|
||||
var untilLevel = Options.upToLevel ? Options.upToLevel : "End";
|
||||
var headerLevel = Options.titleLevel ? Options.titleLevel : null;
|
||||
var seperator = Options.seperator ? Options.seperator : " >> ";
|
||||
var selectedIds = Options.selectedIds ? Options.selectedIds : getEndIds();
|
||||
var showVarible = Options.variableShow ? Options.variableShow : "name";
|
||||
var hasDivider = Options.hasDivider ? Options.hasDivider : true;
|
||||
var list = [];
|
||||
|
||||
return process();
|
||||
|
||||
function process() {
|
||||
var headers = [];
|
||||
for (const index in listArray) {
|
||||
if (listArray.hasOwnProperty(index)) {
|
||||
if (selectedIds.includes(listArray[index].id)) {
|
||||
var name = "";
|
||||
var group = "";
|
||||
for (const key in listArray[index].hierarchy_id) {
|
||||
if (listArray[index].hierarchy_id.hasOwnProperty(key)) {
|
||||
let item = listArray[listArray[index].hierarchy_id[key]];
|
||||
if (fromLevel <= key + 1) {
|
||||
name += item[showVarible] + seperator;
|
||||
}
|
||||
if (headerLevel && headerLevel == key + 1) {
|
||||
group = item[showVarible];
|
||||
headers.push(item[showVarible]);
|
||||
}
|
||||
}
|
||||
}
|
||||
name = name.replace(new RegExp(seperator + "$"), "");
|
||||
list.push({ id: listArray[index].id, lastName: listArray[index][showVarible], name: name, group: group });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (headers.length) {
|
||||
let uniqueHeaders = [...new Set(headers)];
|
||||
var newList =[];
|
||||
for (const iterator of uniqueHeaders) {
|
||||
newList.push({ header: iterator });
|
||||
let arrayGrop = list.filter(x => x.group == iterator);
|
||||
newList = [...newList, ...arrayGrop];
|
||||
if (hasDivider) {
|
||||
newList.push({ divider: true });
|
||||
}
|
||||
}
|
||||
list = [...newList];
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
function getEndIds() {
|
||||
var ids = [];
|
||||
for (const key in listArray) {
|
||||
if (listArray.hasOwnProperty(key)) {
|
||||
if (justLevel) {
|
||||
if (listArray[key].lvl == justLevel) {
|
||||
ids.push(listArray[key].id);
|
||||
}
|
||||
} else if (untilLevel == "End") {
|
||||
if (listArray[key].hasChildren == false) {
|
||||
ids.push(listArray[key].id);
|
||||
}
|
||||
} else {
|
||||
if (listArray[key].lvl <= untilLevel && listArray[key].hasChildren == false || listArray[key].lvl == untilLevel) {
|
||||
ids.push(listArray[key].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
};
|
||||
const deleteTreeArray = (treeArray, id, listArray = null) => {
|
||||
if (!listArray) {
|
||||
listArray = convertTreeToList(treeArray);
|
||||
}
|
||||
|
||||
let hierarchy = listArray[id].hierarchy;
|
||||
let array = treeArray;
|
||||
for (const key in hierarchy) {
|
||||
if (hierarchy.hasOwnProperty(key)) {
|
||||
if (key == 0) {
|
||||
if (hierarchy.length - 1 == key) {
|
||||
array.splice([hierarchy[key]], 1);
|
||||
} else {
|
||||
array = array[hierarchy[key]];
|
||||
}
|
||||
} else {
|
||||
if (hierarchy.length - 1 == key) {
|
||||
array["children"].splice([hierarchy[key]], 1);
|
||||
} else {
|
||||
array = array["children"][hierarchy[key]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeArray;
|
||||
};
|
||||
const updateTreeArray = (treeArray, update, id, listArray = null) => {
|
||||
if (!listArray) {
|
||||
listArray = convertTreeToList(treeArray);
|
||||
}
|
||||
let hierarchy = listArray[id].hierarchy;
|
||||
let array = treeArray;
|
||||
for (const key in hierarchy) {
|
||||
if (hierarchy.hasOwnProperty(key)) {
|
||||
if (key == 0) {
|
||||
if (hierarchy.length - 1 == key) {
|
||||
update["children"] = array[hierarchy[key]]["children"];
|
||||
array[hierarchy[key]] = update;
|
||||
} else {
|
||||
array = array[hierarchy[key]];
|
||||
}
|
||||
} else {
|
||||
if (hierarchy.length - 1 == key) {
|
||||
update["children"] = array[hierarchy[key]]["children"];
|
||||
array["children"][hierarchy[key]] = update;
|
||||
} else {
|
||||
array = array["children"][hierarchy[key]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeArray;
|
||||
};
|
||||
const insertTreeArray = (
|
||||
treeArray,
|
||||
store,
|
||||
parent_id = null,
|
||||
listArray = null
|
||||
) => {
|
||||
let array = treeArray;
|
||||
if (!parent_id) {
|
||||
treeArray.push(store);
|
||||
return treeArray;
|
||||
}
|
||||
if (!listArray) {
|
||||
listArray = convertTreeToList(treeArray);
|
||||
}
|
||||
let hierarchy = listArray[parent_id].hierarchy;
|
||||
for (const key in hierarchy) {
|
||||
if (hierarchy.hasOwnProperty(key)) {
|
||||
if (key == 0) {
|
||||
if (hierarchy.length - 1 == key) {
|
||||
array[hierarchy[key]]["children"].push(store);
|
||||
} else {
|
||||
array = array[hierarchy[key]];
|
||||
}
|
||||
} else {
|
||||
if (hierarchy.length - 1 == key) {
|
||||
array["children"][hierarchy[key]]["children"].push(store);
|
||||
} else {
|
||||
array = array["children"][hierarchy[key]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return treeArray;
|
||||
};
|
||||
|
||||
export {
|
||||
convertTreeToList,
|
||||
insertTreeArray,
|
||||
updateTreeArray,
|
||||
deleteTreeArray,
|
||||
listSearchSelect
|
||||
};
|
@ -1,20 +0,0 @@
|
||||
export default (data) => {
|
||||
var arrayList = [];
|
||||
|
||||
function recursiveFunction(array) {
|
||||
for (const iterator of array) {
|
||||
if (iterator.children && iterator.children.length) {
|
||||
let clone = Object.assign({}, iterator);
|
||||
delete clone.children;
|
||||
arrayList.push(clone);
|
||||
let list = recursiveFunction(iterator.children);
|
||||
arrayList.concat(list);
|
||||
} else {
|
||||
arrayList.push(iterator);
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
return recursiveFunction(data);
|
||||
};
|
Loading…
Reference in new issue