@hashtagcms/admin-ui-kit 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/admin-ui-kit.min.css +14 -0
- package/dist/admin-ui-kit.min.js +2 -0
- package/dist/admin-ui-kit.min.js.LICENSE.txt +175 -0
- package/package.json +53 -0
- package/packages/components/README.md +92 -0
- package/packages/components/package.json +28 -0
- package/packages/components/src/action-bar.vue +237 -0
- package/packages/components/src/category-platform.vue +97 -0
- package/packages/components/src/category-settings.vue +815 -0
- package/packages/components/src/cms-module-dropdown.vue +78 -0
- package/packages/components/src/downlods.vue +21 -0
- package/packages/components/src/file-uploader.vue +188 -0
- package/packages/components/src/frontend-module-creator.vue +599 -0
- package/packages/components/src/global-site-button.vue +94 -0
- package/packages/components/src/homepage.vue +1087 -0
- package/packages/components/src/html-slot.vue +23 -0
- package/packages/components/src/image-gallery.vue +144 -0
- package/packages/components/src/index.js +53 -0
- package/packages/components/src/info-boxes.vue +68 -0
- package/packages/components/src/info-popup.vue +121 -0
- package/packages/components/src/language-button.vue +80 -0
- package/packages/components/src/language-copier.vue +177 -0
- package/packages/components/src/left-nav.vue +159 -0
- package/packages/components/src/library/copy-paste.vue +186 -0
- package/packages/components/src/library/info-box.vue +102 -0
- package/packages/components/src/library/left-menu-show-hide.vue +47 -0
- package/packages/components/src/library/loader.vue +141 -0
- package/packages/components/src/library/modal-box.vue +136 -0
- package/packages/components/src/library/split-button.vue +127 -0
- package/packages/components/src/library/timer-button.vue +43 -0
- package/packages/components/src/library/toast-box.vue +53 -0
- package/packages/components/src/menu-sorter.vue +265 -0
- package/packages/components/src/module-creator.vue +650 -0
- package/packages/components/src/module-permission.vue +334 -0
- package/packages/components/src/pagination.vue +125 -0
- package/packages/components/src/platform-button.vue +118 -0
- package/packages/components/src/search-bar.vue +144 -0
- package/packages/components/src/site-button.vue +42 -0
- package/packages/components/src/site-cloner.vue +150 -0
- package/packages/components/src/sitewise-copier.vue +234 -0
- package/packages/components/src/sitewise-data.vue +347 -0
- package/packages/components/src/sorter.vue +239 -0
- package/packages/components/src/tabular-view.vue +824 -0
- package/packages/components/src/title-bar.vue +76 -0
- package/packages/components/src/top-nav.vue +96 -0
- package/packages/helpers/README.md +88 -0
- package/packages/helpers/package.json +20 -0
- package/packages/helpers/src/admin-config.js +9 -0
- package/packages/helpers/src/common.js +89 -0
- package/packages/helpers/src/dashboard.js +16 -0
- package/packages/helpers/src/editor.js +163 -0
- package/packages/helpers/src/error-message-handler.js +50 -0
- package/packages/helpers/src/event-bus.js +4 -0
- package/packages/helpers/src/form.js +4 -0
- package/packages/helpers/src/fx.js +106 -0
- package/packages/helpers/src/humanize.js +14 -0
- package/packages/helpers/src/map.js +3 -0
- package/packages/styles/README.md +37 -0
- package/packages/styles/package.json +15 -0
- package/packages/styles/src/_action-bar.scss +35 -0
- package/packages/styles/src/_admin.scss +22 -0
- package/packages/styles/src/_animate.scss +1579 -0
- package/packages/styles/src/_badges.scss +34 -0
- package/packages/styles/src/_category-list.scss +14 -0
- package/packages/styles/src/_common.scss +163 -0
- package/packages/styles/src/_info-box.scss +96 -0
- package/packages/styles/src/_left-nav.scss +59 -0
- package/packages/styles/src/_loader.scss +82 -0
- package/packages/styles/src/_menu-sorter.scss +39 -0
- package/packages/styles/src/_model-creator.scss +48 -0
- package/packages/styles/src/_module-permission.scss +25 -0
- package/packages/styles/src/_page-manager.scss +63 -0
- package/packages/styles/src/_popover-modal.scss +20 -0
- package/packages/styles/src/_table-grid.scss +39 -0
- package/packages/styles/src/_toast.scss +20 -0
- package/packages/styles/src/_variables.scss +37 -0
- package/packages/styles/src/app.scss +2 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
mounted() {
|
|
10
|
+
// console.log("html slot mounted");
|
|
11
|
+
for (var i in this) {
|
|
12
|
+
if (this.hasOwnProperty(i)) {
|
|
13
|
+
// console.log(i + " : "+ this[i].toString());
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
getAllInputs: function () {
|
|
19
|
+
console.log("all inputs");
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<modal-box ref="imageModalBox" data-show-footer="true">
|
|
3
|
+
<template #title>
|
|
4
|
+
<div class="row">
|
|
5
|
+
<div class="col-2">Gallery</div>
|
|
6
|
+
<div class="col-auto d-flex">
|
|
7
|
+
<input
|
|
8
|
+
type="text"
|
|
9
|
+
class="form-control me-1"
|
|
10
|
+
placeholder="Search image"
|
|
11
|
+
@keydown.enter="searchImages"
|
|
12
|
+
v-model="searchKey"
|
|
13
|
+
/>
|
|
14
|
+
<input
|
|
15
|
+
type="button"
|
|
16
|
+
class="btn btn-secondary me-1"
|
|
17
|
+
value="Search"
|
|
18
|
+
@click="searchImages"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
<template #content>
|
|
24
|
+
<div class="row">
|
|
25
|
+
<span class="spinner-border text-info" role="status" v-if="loading">
|
|
26
|
+
<span class="visually-hidden">Loading...</span>
|
|
27
|
+
</span>
|
|
28
|
+
<div class="col-auto m-1 border" v-for="current in data">
|
|
29
|
+
<img
|
|
30
|
+
:src="getImage(current.path)"
|
|
31
|
+
width="100"
|
|
32
|
+
@click="insertContentToEditor(getImage(current.path))"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
<div v-if="data.length === 0 && loading === false">No images found</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<template #footer>
|
|
39
|
+
<div class="container-fluid">
|
|
40
|
+
<file-uploader data-accept="image/*"></file-uploader>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</modal-box>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import AdminConfig from "@hashtagcms/helpers/admin-config";
|
|
48
|
+
import ModalBox from "./library/modal-box.vue";
|
|
49
|
+
import { EventBus } from "@hashtagcms/helpers/event-bus";
|
|
50
|
+
import fileUploader from "./file-uploader.vue";
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
components: {
|
|
54
|
+
"modal-box": ModalBox,
|
|
55
|
+
"file-uploader": fileUploader,
|
|
56
|
+
},
|
|
57
|
+
props: ["dataModel", "dataModuleRelations", "dataId", "dataEditor"],
|
|
58
|
+
mounted() {
|
|
59
|
+
EventBus.on("gallery-image-uploaded", (response) => {
|
|
60
|
+
this.data = [...response.data, ...this.data];
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
galleryCreate() {
|
|
65
|
+
return AdminConfig.admin_path(
|
|
66
|
+
"gallery/create?return_url=" + encodeURIComponent(window.location.href),
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
data: [],
|
|
73
|
+
loading: false,
|
|
74
|
+
searchKey: "",
|
|
75
|
+
editor: this.dataEditor,
|
|
76
|
+
form: {
|
|
77
|
+
file: "",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
loadData() {
|
|
83
|
+
this.data = [];
|
|
84
|
+
this.loading = true;
|
|
85
|
+
let url = AdminConfig.admin_path(`gallery/getAllImages`);
|
|
86
|
+
axios
|
|
87
|
+
.get(url)
|
|
88
|
+
.then((res) => {
|
|
89
|
+
this.data = res.data;
|
|
90
|
+
})
|
|
91
|
+
.catch((err) => {
|
|
92
|
+
console.log(err);
|
|
93
|
+
})
|
|
94
|
+
.finally(() => {
|
|
95
|
+
this.loading = false;
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
getImage(value) {
|
|
99
|
+
return AdminConfig.get_media(`${value}`);
|
|
100
|
+
},
|
|
101
|
+
insertContentToEditor(content) {
|
|
102
|
+
content = `<img src="${content}" />`;
|
|
103
|
+
if (this.editor) {
|
|
104
|
+
this.editor.insertContent(content);
|
|
105
|
+
}
|
|
106
|
+
this.close();
|
|
107
|
+
},
|
|
108
|
+
searchImages() {
|
|
109
|
+
if (this.searchKey.length > 0) {
|
|
110
|
+
this.data = [];
|
|
111
|
+
this.loading = true;
|
|
112
|
+
let url = AdminConfig.admin_path(
|
|
113
|
+
`gallery/searchImages/${this.searchKey}`,
|
|
114
|
+
);
|
|
115
|
+
axios
|
|
116
|
+
.get(url)
|
|
117
|
+
.then((res) => {
|
|
118
|
+
this.data = res.data;
|
|
119
|
+
})
|
|
120
|
+
.catch((err) => {
|
|
121
|
+
console.log(err);
|
|
122
|
+
})
|
|
123
|
+
.finally(() => {
|
|
124
|
+
this.loading = false;
|
|
125
|
+
});
|
|
126
|
+
} else {
|
|
127
|
+
this.loadData();
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
open(editor) {
|
|
131
|
+
this.loadData();
|
|
132
|
+
if (editor) {
|
|
133
|
+
this.editor = editor;
|
|
134
|
+
}
|
|
135
|
+
this.$refs.imageModalBox.open();
|
|
136
|
+
EventBus.emit("image-gallery-open");
|
|
137
|
+
},
|
|
138
|
+
close() {
|
|
139
|
+
this.$refs.imageModalBox.close();
|
|
140
|
+
EventBus.emit("image-gallery-close");
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "@hashtagcms/styles/src/app.scss";
|
|
2
|
+
export { default as ActionBar } from "./action-bar.vue";
|
|
3
|
+
export { default as CategoryPlatform } from "./category-platform.vue";
|
|
4
|
+
export { default as CategorySettings } from "./category-settings.vue";
|
|
5
|
+
export { default as CmsModuleDropdown } from "./cms-module-dropdown.vue";
|
|
6
|
+
export { default as DownloadButton } from "./downlods.vue";
|
|
7
|
+
export { default as FileUploader } from "./file-uploader.vue";
|
|
8
|
+
export { default as FrontendModuleCreator } from "./frontend-module-creator.vue";
|
|
9
|
+
export { default as GlobalSiteButton } from "./global-site-button.vue";
|
|
10
|
+
export { default as Homepage } from "./homepage.vue";
|
|
11
|
+
export { default as HtmlSlot } from "./html-slot.vue";
|
|
12
|
+
export { default as ImageGallery } from "./image-gallery.vue";
|
|
13
|
+
export { default as InfoBoxes } from "./info-boxes.vue";
|
|
14
|
+
export { default as InfoPopup } from "./info-popup.vue";
|
|
15
|
+
export { default as LanguageButton } from "./language-button.vue";
|
|
16
|
+
export { default as LanguageCopier } from "./language-copier.vue";
|
|
17
|
+
export { default as LeftNav } from "./left-nav.vue";
|
|
18
|
+
export { default as MenuSorter } from "./menu-sorter.vue";
|
|
19
|
+
export { default as ModuleCreator } from "./module-creator.vue";
|
|
20
|
+
export { default as ModulePermission } from "./module-permission.vue";
|
|
21
|
+
export { default as Pagination } from "./pagination.vue";
|
|
22
|
+
export { default as PlatformButton } from "./platform-button.vue";
|
|
23
|
+
export { default as SearchBar } from "./search-bar.vue";
|
|
24
|
+
export { default as SiteButton } from "./site-button.vue";
|
|
25
|
+
export { default as SiteCloner } from "./site-cloner.vue";
|
|
26
|
+
export { default as SitewiseCopier } from "./sitewise-copier.vue";
|
|
27
|
+
export { default as SitewiseData } from "./sitewise-data.vue";
|
|
28
|
+
export { default as Sorter } from "./sorter.vue";
|
|
29
|
+
export { default as TabularView } from "./tabular-view.vue";
|
|
30
|
+
export { default as TitleBar } from "./title-bar.vue";
|
|
31
|
+
export { default as TopNav } from "./top-nav.vue";
|
|
32
|
+
|
|
33
|
+
// Library exports
|
|
34
|
+
export { default as CopyPaste } from "./library/copy-paste.vue";
|
|
35
|
+
export { default as InfoBox } from "./library/info-box.vue";
|
|
36
|
+
export { default as LeftMenuShowHide } from "./library/left-menu-show-hide.vue";
|
|
37
|
+
export { default as Loader } from "./library/loader.vue";
|
|
38
|
+
export { default as ModalBox } from "./library/modal-box.vue";
|
|
39
|
+
export { default as SplitButton } from "./library/split-button.vue";
|
|
40
|
+
export { default as TimerButton } from "./library/timer-button.vue";
|
|
41
|
+
export { default as ToastBox } from "./library/toast-box.vue";
|
|
42
|
+
|
|
43
|
+
// Helpers
|
|
44
|
+
export { AdminConfig } from "@hashtagcms/helpers/admin-config";
|
|
45
|
+
export * from "@hashtagcms/helpers/common"; // Exports Toast, Storage, Fetcher, etc.
|
|
46
|
+
export { Dashboard } from "@hashtagcms/helpers/dashboard";
|
|
47
|
+
export { EditorHelper, PageManager } from "@hashtagcms/helpers/editor";
|
|
48
|
+
export { ErrorMessage } from "@hashtagcms/helpers/error-message-handler";
|
|
49
|
+
export { default as MapAPI } from "@hashtagcms/helpers/map";
|
|
50
|
+
export { default as Form } from "@hashtagcms/helpers/form";
|
|
51
|
+
|
|
52
|
+
// Package Version
|
|
53
|
+
export const VERSION = __VERSION__;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template v-for="(module, index) in allModules">
|
|
3
|
+
<div
|
|
4
|
+
v-if="hasAccess(module.id)"
|
|
5
|
+
class="col-auto hand"
|
|
6
|
+
@click="navigate(module)"
|
|
7
|
+
:title="module.name"
|
|
8
|
+
>
|
|
9
|
+
<info-box
|
|
10
|
+
:key="module.name + index"
|
|
11
|
+
:data-title="module.name"
|
|
12
|
+
:data-sub-title="module.sub_title"
|
|
13
|
+
:data-icon-css="module.icon_css"
|
|
14
|
+
>
|
|
15
|
+
</info-box>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import AdminConfig from "@hashtagcms/helpers/admin-config";
|
|
22
|
+
|
|
23
|
+
import InfoBox from "./library/info-box.vue";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
components: {
|
|
27
|
+
"info-box": InfoBox,
|
|
28
|
+
},
|
|
29
|
+
mounted() {
|
|
30
|
+
//console.log(this.modulesAllowed);
|
|
31
|
+
//
|
|
32
|
+
},
|
|
33
|
+
props: ["dataModules", "dataModulesAllowed", "dataIsAdmin"],
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
modulesAllowed: this.dataModulesAllowed
|
|
37
|
+
? JSON.parse(this.dataModulesAllowed)
|
|
38
|
+
: [],
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
computed: {
|
|
42
|
+
allModules() {
|
|
43
|
+
let modules =
|
|
44
|
+
typeof this.dataModules == "undefined"
|
|
45
|
+
? []
|
|
46
|
+
: JSON.parse(this.dataModules);
|
|
47
|
+
return modules.child;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
methods: {
|
|
51
|
+
navigate(current) {
|
|
52
|
+
window.location = AdminConfig.admin_path(current.controller_name);
|
|
53
|
+
},
|
|
54
|
+
hasAccess(module_id) {
|
|
55
|
+
if (this.dataIsAdmin.toString() == "1") {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
for (let i = 0; i < this.modulesAllowed.length; i++) {
|
|
59
|
+
let current = this.modulesAllowed[i];
|
|
60
|
+
if (current.module_id == module_id) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<modal-box ref="infoModal" data-show-footer="true">
|
|
3
|
+
<template #title>
|
|
4
|
+
<div style="text-transform: capitalize">{{ model }} Info</div>
|
|
5
|
+
</template>
|
|
6
|
+
<template #content>
|
|
7
|
+
<div class="row" style="max-height: 500px; overflow: scroll">
|
|
8
|
+
<table class="table table-striped">
|
|
9
|
+
<tbody>
|
|
10
|
+
<template v-for="(res, key) in resData">
|
|
11
|
+
<tr v-if="!shouldExclude(key)">
|
|
12
|
+
<td>
|
|
13
|
+
{{ key }}
|
|
14
|
+
</td>
|
|
15
|
+
<td>
|
|
16
|
+
<span v-if="key === 'id'" v-html="getValue(key, res)"></span>
|
|
17
|
+
<span v-if="key !== 'id'" v-text="getValue(key, res)"></span>
|
|
18
|
+
</td>
|
|
19
|
+
</tr>
|
|
20
|
+
</template>
|
|
21
|
+
<tr v-if="errorMessage !== ''">
|
|
22
|
+
<td style="background-color: #fff; border: none">
|
|
23
|
+
<div class="text text-danger">
|
|
24
|
+
{{ errorMessage }}
|
|
25
|
+
</div>
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
<template #footer>
|
|
33
|
+
<button class="btn btn-outline-secondary" @click="close()">Close</button>
|
|
34
|
+
</template>
|
|
35
|
+
</modal-box>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import AdminConfig from "@hashtagcms/helpers/admin-config";
|
|
40
|
+
import { Toast, Loader } from "@hashtagcms/helpers/common";
|
|
41
|
+
import ModalBox from "./library/modal-box.vue";
|
|
42
|
+
import { EventBus } from "@hashtagcms/helpers/event-bus";
|
|
43
|
+
|
|
44
|
+
export default {
|
|
45
|
+
components: {
|
|
46
|
+
"modal-box": ModalBox,
|
|
47
|
+
},
|
|
48
|
+
props: ["dataModel", "dataModuleRelations", "dataId"],
|
|
49
|
+
mounted() {
|
|
50
|
+
//console.log('Component mounted...')
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
model:
|
|
55
|
+
typeof this.dataModel === "undefined" || this.dataModel === ""
|
|
56
|
+
? null
|
|
57
|
+
: this.dataModel,
|
|
58
|
+
relation:
|
|
59
|
+
typeof this.dataModuleRelations === "undefined" ||
|
|
60
|
+
this.dataModuleRelations === ""
|
|
61
|
+
? ""
|
|
62
|
+
: this.dataModuleRelations,
|
|
63
|
+
id:
|
|
64
|
+
typeof this.dataId === "undefined" || this.dataId === ""
|
|
65
|
+
? 0
|
|
66
|
+
: parseInt(this.dataId),
|
|
67
|
+
resData: [],
|
|
68
|
+
errorMessage: "",
|
|
69
|
+
isEditable: true,
|
|
70
|
+
excludeFields: [],
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
shouldExclude(key) {
|
|
75
|
+
return this.excludeFields.indexOf(key) >= 0;
|
|
76
|
+
},
|
|
77
|
+
getValue(key, value) {
|
|
78
|
+
if (!this.isEditable) {
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
if (key === "id" && this.isEditable) {
|
|
82
|
+
let path = `edit/${value}`;
|
|
83
|
+
path = AdminConfig.admin_path(`${this.model}/${path}`);
|
|
84
|
+
return `<a href="${path}">${value}</a>`;
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
},
|
|
88
|
+
showInfo(model, id, excludeFields = [], isEditable = true) {
|
|
89
|
+
this.isEditable = isEditable.toString() === "true";
|
|
90
|
+
this.excludeFields = excludeFields;
|
|
91
|
+
this.model = model;
|
|
92
|
+
let $this = this;
|
|
93
|
+
Loader.show(this);
|
|
94
|
+
axios
|
|
95
|
+
.get(AdminConfig.get("base_path") + `/ajax/getInfo/${model}/${id}`)
|
|
96
|
+
.then(function (res) {
|
|
97
|
+
$this.errorMessage = "";
|
|
98
|
+
$this.resData = {};
|
|
99
|
+
$this.resData = res.data.results;
|
|
100
|
+
if (res.data.error === true) {
|
|
101
|
+
$this.errorMessage = res.data.message;
|
|
102
|
+
}
|
|
103
|
+
$this.open();
|
|
104
|
+
Loader.hide($this);
|
|
105
|
+
})
|
|
106
|
+
.catch(function (res) {
|
|
107
|
+
Toast.show($this, res.message);
|
|
108
|
+
Loader.hide($this);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
open() {
|
|
112
|
+
this.$refs.infoModal.open();
|
|
113
|
+
EventBus.emit("info-popup-open");
|
|
114
|
+
},
|
|
115
|
+
close() {
|
|
116
|
+
this.$refs.infoModal.close();
|
|
117
|
+
EventBus.emit("info-popup-close");
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
</script>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<split-button
|
|
3
|
+
v-if="hasLanguage()"
|
|
4
|
+
:data-options="dataLanguages"
|
|
5
|
+
@change="setLanguage"
|
|
6
|
+
:data-parser="parseLang"
|
|
7
|
+
:data-selected="currentIndex"
|
|
8
|
+
data-btn-css="lang"
|
|
9
|
+
>English</split-button
|
|
10
|
+
>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import AdminConfig from "@hashtagcms/helpers/admin-config";
|
|
15
|
+
import SplitButton from "./library/split-button.vue";
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
components: {
|
|
19
|
+
"split-button": SplitButton,
|
|
20
|
+
},
|
|
21
|
+
props: ["dataLanguages", "dataSelectedLanguage"],
|
|
22
|
+
mounted() {
|
|
23
|
+
//console.log(this.languages);
|
|
24
|
+
},
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
languages:
|
|
28
|
+
typeof this.dataLanguages == "undefined"
|
|
29
|
+
? null
|
|
30
|
+
: JSON.parse(this.dataLanguages),
|
|
31
|
+
currentLang:
|
|
32
|
+
typeof this.dataSelectedLanguage == "undefined"
|
|
33
|
+
? 1
|
|
34
|
+
: parseInt(this.dataSelectedLanguage),
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
computed: {
|
|
38
|
+
currentIndex() {
|
|
39
|
+
if (this.languages != null) {
|
|
40
|
+
for (var i = 0; i < this.languages.length; i++) {
|
|
41
|
+
var item = this.languages[i];
|
|
42
|
+
|
|
43
|
+
if (item.id == this.currentLang) {
|
|
44
|
+
return i;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//console.log($this.currentLang);
|
|
49
|
+
return 0;
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
hasLanguage() {
|
|
54
|
+
//has language greate than one
|
|
55
|
+
return this.languages != null && this.languages.length > 1;
|
|
56
|
+
},
|
|
57
|
+
parseLang: function (row) {
|
|
58
|
+
//console.log(row);
|
|
59
|
+
return { label: row.name, value: row.id };
|
|
60
|
+
},
|
|
61
|
+
setLanguage(data) {
|
|
62
|
+
//console.log("changed happend")
|
|
63
|
+
|
|
64
|
+
let ajaxController = AdminConfig.admin_path(
|
|
65
|
+
`ajax/setLanguage/${data.value}`,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
axios
|
|
69
|
+
.get(ajaxController)
|
|
70
|
+
.then(function (response) {
|
|
71
|
+
//console.log(response);
|
|
72
|
+
window.location.reload();
|
|
73
|
+
})
|
|
74
|
+
.catch(function (error) {
|
|
75
|
+
console.log(error);
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="col-lg-6">
|
|
4
|
+
<form
|
|
5
|
+
id="addEditFrm"
|
|
6
|
+
method="post"
|
|
7
|
+
class="form-horizontal"
|
|
8
|
+
role="form"
|
|
9
|
+
v-on:submit.prevent="saveNow"
|
|
10
|
+
v-on:keyup="hideErrorMessage($event)"
|
|
11
|
+
>
|
|
12
|
+
<div>
|
|
13
|
+
<div class="mb-2">
|
|
14
|
+
<p>
|
|
15
|
+
<strong>Source Language:</strong> Data will be copied from the
|
|
16
|
+
selected lanuage
|
|
17
|
+
</p>
|
|
18
|
+
<select
|
|
19
|
+
required
|
|
20
|
+
name="sourceLang"
|
|
21
|
+
class="form-select"
|
|
22
|
+
v-model="form.sourceLang"
|
|
23
|
+
@change="hideErrorMessage($event)"
|
|
24
|
+
>
|
|
25
|
+
<option value="">Select</option>
|
|
26
|
+
<option v-for="language in languages" :value="language.id">
|
|
27
|
+
{{ language.name }} - {{ language.iso_code }}
|
|
28
|
+
</option>
|
|
29
|
+
</select>
|
|
30
|
+
<div class="text text-danger">{{ this.errors.sourceLang }}</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<div class="mb-2">
|
|
35
|
+
<p>
|
|
36
|
+
<strong>Target Language:</strong> New record will be inserted with
|
|
37
|
+
this language id in selected tables
|
|
38
|
+
</p>
|
|
39
|
+
<select
|
|
40
|
+
required
|
|
41
|
+
name="targetLang"
|
|
42
|
+
class="form-select"
|
|
43
|
+
v-model="form.targetLang"
|
|
44
|
+
@change="hideErrorMessage($event)"
|
|
45
|
+
>
|
|
46
|
+
<option value="">Select</option>
|
|
47
|
+
<option v-for="language in languages" :value="language.id">
|
|
48
|
+
{{ language.name }} - {{ language.iso_code }}
|
|
49
|
+
</option>
|
|
50
|
+
</select>
|
|
51
|
+
<div class="text text-danger">{{ this.errors.targetLang }}</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div>
|
|
56
|
+
<div class="mb-2">
|
|
57
|
+
<p>Select tables</p>
|
|
58
|
+
<select
|
|
59
|
+
required
|
|
60
|
+
style="height: 200px"
|
|
61
|
+
name="tables"
|
|
62
|
+
class="form-select"
|
|
63
|
+
multiple
|
|
64
|
+
v-model="form.tables"
|
|
65
|
+
@change="hideErrorMessage($event)"
|
|
66
|
+
>
|
|
67
|
+
<option v-for="langTable in languageTables">
|
|
68
|
+
{{ langTable.name }}
|
|
69
|
+
</option>
|
|
70
|
+
</select>
|
|
71
|
+
<div class="text text-danger">{{ this.errors.tables }}</div>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="row">
|
|
75
|
+
<div
|
|
76
|
+
class="alert alert-danger"
|
|
77
|
+
v-show="typeof errorMessage == 'string' && errorMessage != ''"
|
|
78
|
+
>
|
|
79
|
+
{{ errorMessage }}
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div v-for="message in messages" :class="getCss(message)">
|
|
83
|
+
{{ message.message }}
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div class="form-group center-align">
|
|
87
|
+
<input
|
|
88
|
+
type="submit"
|
|
89
|
+
name="submit"
|
|
90
|
+
value="Submit and Hold on"
|
|
91
|
+
class="btn btn-success btn-large"
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</form>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script>
|
|
101
|
+
import AdminConfig from "@hashtagcms/helpers/admin-config";
|
|
102
|
+
|
|
103
|
+
import Form from "@hashtagcms/helpers/form";
|
|
104
|
+
import { Toast } from "@hashtagcms/helpers/common";
|
|
105
|
+
export default {
|
|
106
|
+
mounted() {},
|
|
107
|
+
props: ["dataLanguages", "dataLanguageTables"],
|
|
108
|
+
data() {
|
|
109
|
+
return {
|
|
110
|
+
languages:
|
|
111
|
+
this.dataLanguages && this.dataLanguages !== "null"
|
|
112
|
+
? JSON.parse(this.dataLanguages)
|
|
113
|
+
: [],
|
|
114
|
+
languageTables:
|
|
115
|
+
this.dataLanguageTables && this.dataLanguageTables !== "null"
|
|
116
|
+
? JSON.parse(this.dataLanguageTables)
|
|
117
|
+
: [],
|
|
118
|
+
messages: [],
|
|
119
|
+
form: new Form({
|
|
120
|
+
tables: [],
|
|
121
|
+
sourceLang: "",
|
|
122
|
+
targetLang: "",
|
|
123
|
+
}),
|
|
124
|
+
errors: {},
|
|
125
|
+
saveUrl: "language/translateNow",
|
|
126
|
+
errorMessage: "",
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
methods: {
|
|
130
|
+
getCss(row) {
|
|
131
|
+
return row.status === 0 ? "text text-danger" : "text text-success";
|
|
132
|
+
},
|
|
133
|
+
showError(res) {
|
|
134
|
+
//console.log("res");
|
|
135
|
+
//console.log(res);
|
|
136
|
+
for (let i in res.errors) {
|
|
137
|
+
if (res.errors.hasOwnProperty(i)) {
|
|
138
|
+
this.errors[i] = res.errors[i][0];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
this.errorMessage = res.message;
|
|
143
|
+
},
|
|
144
|
+
hideErrorMessage(event) {
|
|
145
|
+
let name = event.target.getAttribute("name");
|
|
146
|
+
this.errors[name] = "";
|
|
147
|
+
if (this.errorMessage !== "") {
|
|
148
|
+
this.errorMessage = "";
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
onSuccess(response) {
|
|
152
|
+
console.log(response);
|
|
153
|
+
//console.log("response.isSaved ",response.isSaved);
|
|
154
|
+
if (response.isSaved === 0) {
|
|
155
|
+
Toast.show(this, response.message);
|
|
156
|
+
this.errorMessage = {};
|
|
157
|
+
this.errorMessage = response.message;
|
|
158
|
+
} else {
|
|
159
|
+
this.errorMessage = "";
|
|
160
|
+
//Toast.show(this, response.message, 5000);
|
|
161
|
+
this.messages = response.message;
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
saveNow() {
|
|
165
|
+
let $this = this;
|
|
166
|
+
let url = AdminConfig.admin_path(this.saveUrl);
|
|
167
|
+
|
|
168
|
+
this.form
|
|
169
|
+
.post(url)
|
|
170
|
+
.then((response) => this.onSuccess(response))
|
|
171
|
+
.catch((response) => this.showError(response));
|
|
172
|
+
|
|
173
|
+
return false;
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
</script>
|