Fix Transaction and debug Modal and tree-select clientCategory and department

pull/1/head
saeid_01 5 years ago
parent 6cd601af28
commit 8fe2fdd24b

4317
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=b35f9bb66dd6f92a81da",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=10d74a8d32acd6f8ba07",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=a5887fa0b5bccea8d02c",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=5089292949251a6ac964"
"/js/vue/Authentication/app.js": "/js/vue/Authentication/app.js?id=995804b44ba7fff5cf26",
"/js/vue/Home/app.js": "/js/vue/Home/app.js?id=282385fcf570cf6806fd",
"/js/vue/Modules/CRM/app.js": "/js/vue/Modules/CRM/app.js?id=1c16066aba64f2126ddd",
"/js/vue/User/app.js": "/js/vue/User/app.js?id=e31bbf5815716146198a"
}

@ -1,11 +1,8 @@
var CommingSoonArray = [
"document",
"discount",
"transaction",
"email",
"prescription",
"user_sms",
"crm-setting",
"crm-statistics",
];

@ -5,23 +5,44 @@ export default {
if (state.modals.findIndex(x => x.name == data.name) == -1) {
state.modals.push(data);
let module = data.name.split("_");
rootState[module[1]].relation = data.rel ? data.rel : {};
rootState[module[1]].current_model = data.model ? data.model : {};
if (data.rel) {
rootState[module[1]].relation = data.rel
state.rel.push(data.rel);
}
if (data.model) {
rootState[module[1]].current_model = data.model;
state.model.push(data.model);
}
rootState[module[1]].page_type = data.page_type ? data.page_type : 'modal';
}
},
$_closeModalStack({ state, rootState }) {
if (state.modals.length) {
let last_data = [...state.modals].pop();
let module = last_data.name.split("_")[1];
if (state.modals.length > 1) {
state.modals[state.modals.length - 2]['last_modal_data'] = last_data;
} else {
rootState[module].page_type = '';
}
if(last_data.rel) {
state.rel.pop();
if (state.rel.length) {
rootState[module].relation = state.rel[state.rel.length - 1];
} else {
rootState[module].relation = {};
}
}
if(last_data.model) {
state.model.pop();
if (state.model.length) {
rootState[module].current_model = state.model[state.model.length - 1];
} else {
rootState[module].current_model = {};
}
}
let module = last_data.name.split("_");
rootState[module[1]].relation = {};
rootState[module[1]].current_model = {};
rootState[module[1]].page_type = '';
state.modals.pop();
}
},

@ -6,6 +6,8 @@ export default {
dialog: false,
},
modals: [],
rel: [],
model: [],
dialogProperties: {},
dialogType: {},
};

@ -67,63 +67,26 @@ const convertTreeToList = data => {
return recursiveFunction(data, 1);
};
const readyForTreeSelect = tree => {
function removechildEmpty(array) {
for (const node of array) {
if (node.id == null) {
node.id = 0;
}
node.label = node.name;
if (Array.isArray(node.children) && node.children.length == 0) {
delete node.children;
} else {
if (Array.isArray(node.children)) {
removechildEmpty(node.children);
}
}
}
}
if (Array.isArray(tree)) {
removechildEmpty(tree);
}
return tree;
}
const convertListToTree = list => {
var object = [];
for (const key in list) {
if (list.hasOwnProperty(key)) {
if (list[key].parent_id == null) {
if (!list[key].parent_id) {
var childrenItem = {...list[key]};
var listChildren = recursiveFunctionToTree(list, childrenItem);
object.push(listChildren);
}
}
}
}
function recursiveFunctionToTree( list, item ) {
for (const key in list) {
if (list.hasOwnProperty(key)) {
if (list[key].parent_id == item.id) {
if (typeof item.children == 'undefined') {
item['children'] = [];
}
var childrenItem = {...list[key]};
if (childrenItem.hasChildren == true) {
var listChildren = recursiveFunctionToTree(list, childrenItem);
item.children.push(listChildren);
} else {
item.children.push(childrenItem);
function recursiveFunctionToTree( list, parent_id = null ) {
let object = [];
for (const item of list) {
item.label = item.label ? item.label : item.name;
if (item.id) {
if (item.parent_id == parent_id) {
let children = recursiveFunctionToTree(list, item.id);
if (children.length) {
item['children'] = children;
}
object.push(item);
}
}
}
return item;
return object;
}
return object;
return recursiveFunctionToTree(list);
};
const listSearchSelect = Options => {
let treeArray = Options.array ? Options.array : [];
@ -303,5 +266,5 @@ export {
updateTreeArray,
deleteTreeArray,
listSearchSelect,
readyForTreeSelect
convertListToTree
};

Loading…
Cancel
Save