diff --git a/resources/assets/js/components/dataViews/vueCardView/VueCard.vue b/resources/assets/js/components/dataViews/vueCardView/VueCard.vue new file mode 100644 index 000000000..c94a7a0e7 --- /dev/null +++ b/resources/assets/js/components/dataViews/vueCardView/VueCard.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/resources/assets/js/components/dataViews/vueCardView/VueCardView.vue b/resources/assets/js/components/dataViews/vueCardView/VueCardView.vue new file mode 100644 index 000000000..26c4ed368 --- /dev/null +++ b/resources/assets/js/components/dataViews/vueCardView/VueCardView.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/resources/assets/js/components/dataViews/vueCardView/VueCardViewMixins.js b/resources/assets/js/components/dataViews/vueCardView/VueCardViewMixins.js new file mode 100644 index 000000000..d7604a7ce --- /dev/null +++ b/resources/assets/js/components/dataViews/vueCardView/VueCardViewMixins.js @@ -0,0 +1,55 @@ +export default { + data() { + let that = this; + return { + height: 0, + config: { + page: 1 + }, + data: [] + } + }, + mounted: function () { + this.getData(); + this.getBodyHeight(); + }, + methods: { + /** + * Get data similar to vue Table + */ + getData() { + let options = _.extend({}, this.config, this.options), + that = this; + this.options.requestFunction(options) + .then((data) => { + that.data = data.data; + }) + .catch(() => { + + }); + }, + /** + * Get data when press the button more view + */ + viewMore() { + let options = _.extend({}, this.config, this.options, { page: this.config.page + 1 }), + that = this; + this.options.requestFunctionViewMore(options) + .then((data) => { + if (data.data && data.data.length != 0) { + that.data = that.data.concat(data.data); + that.config.page += 1; + } + }) + .catch(() => { + + }); + }, + /** + * Return the height for Vue Card View body + */ + getBodyHeight() { + this.height = window.innerHeight - this.$root.$el.clientHeight; + } + } +} \ No newline at end of file diff --git a/resources/assets/js/components/dataViews/vueListView/VueList.vue b/resources/assets/js/components/dataViews/vueListView/VueList.vue new file mode 100644 index 000000000..759f3a967 --- /dev/null +++ b/resources/assets/js/components/dataViews/vueListView/VueList.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/resources/assets/js/components/dataViews/vueListView/VueListView.vue b/resources/assets/js/components/dataViews/vueListView/VueListView.vue new file mode 100644 index 000000000..71fd252ae --- /dev/null +++ b/resources/assets/js/components/dataViews/vueListView/VueListView.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/resources/assets/js/components/dataViews/vueListView/VueListViewMixins.js b/resources/assets/js/components/dataViews/vueListView/VueListViewMixins.js new file mode 100644 index 000000000..ee26a8354 --- /dev/null +++ b/resources/assets/js/components/dataViews/vueListView/VueListViewMixins.js @@ -0,0 +1,55 @@ +export default { + data() { + let that = this; + return { + height: 0, + config: { + page: 1 + }, + data: [] + } + }, + mounted: function () { + this.getData(); + this.getBodyHeight(); + }, + methods: { + /** + * Get data similar to vue Table + */ + getData() { + let options = _.extend({}, this.config, this.options), + that = this; + this.options.requestFunction(options) + .then((data) => { + that.data = data.data; + }) + .catch(() => { + + }); + }, + /** + * Get data when press the button more view + */ + viewMore() { + let options = _.extend({}, this.config, this.options, { page: this.config.page + 1 }), + that = this; + this.options.requestFunctionViewMore(options) + .then((data) => { + if (data.data && data.data.length != 0) { + that.data = that.data.concat(data.data); + that.config.page += 1; + } + }) + .catch(() => { + + }); + }, + /** + * Return the height for Vue list View body + */ + getBodyHeight() { + this.height = window.innerHeight - this.$root.$el.clientHeight; + } + } +} \ No newline at end of file diff --git a/resources/assets/js/components/headers/MultiviewHeader.vue b/resources/assets/js/components/headers/MultiviewHeader.vue new file mode 100644 index 000000000..d7402e3aa --- /dev/null +++ b/resources/assets/js/components/headers/MultiviewHeader.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/resources/assets/js/home/Home.vue b/resources/assets/js/home/Home.vue index 68b3022ab..c780de3ee 100644 --- a/resources/assets/js/home/Home.vue +++ b/resources/assets/js/home/Home.vue @@ -40,7 +40,7 @@ import CustomSidebar from "./../components/menu/CustomSidebar"; import MyCases from "./MyCases"; import MyDocuments from "./MyDocuments"; -import Todo from "./Todo"; +import Todo from "./Inbox/Todo.vue"; import Draft from "./Draft"; import Paused from "./Paused"; import Unassigned from "./Unassigned"; diff --git a/resources/assets/js/home/Inbox/Todo.vue b/resources/assets/js/home/Inbox/Todo.vue new file mode 100644 index 000000000..b0b90de6e --- /dev/null +++ b/resources/assets/js/home/Inbox/Todo.vue @@ -0,0 +1,522 @@ + + + + \ No newline at end of file diff --git a/resources/assets/js/home/Inbox/defaultMixins.js b/resources/assets/js/home/Inbox/defaultMixins.js new file mode 100644 index 000000000..ed071edac --- /dev/null +++ b/resources/assets/js/home/Inbox/defaultMixins.js @@ -0,0 +1,166 @@ +import api from "../../api/index"; +export default { + data() { + let that = this; + return { + typeView: "GRID", + dataMultiviewHeader: { + actions: [ + { + id: "view-grid", + title: "Grid", + onClick(action) { + that.typeView = "GRID"; + }, + icon: "fas fa-table", + }, + { + id: "view-list", + title: "List", + onClick(action) { + that.typeView = "LIST"; + }, + icon: "fas fa-list", + }, + { + id: "view-card", + title: "Card", + onClick(action) { + that.typeView = "CARD"; + }, + icon: "fas fa-th", + }, + ], + }, + optionsVueCardView: { + limit: 10, + headings: { + detail: "", + case_number: this.$i18n.t("ID_MYCASE_NUMBER"), + case_title: this.$i18n.t("ID_CASE_TITLE"), + process_name: this.$i18n.t("ID_PROCESS_NAME"), + task: this.$i18n.t("ID_TASK"), + current_user: this.$i18n.t("ID_CURRENT_USER"), + due_date: this.$i18n.t("ID_DUE_DATE"), + delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), + priority: this.$i18n.t("ID_PRIORITY") + }, + columns: [ + "detail", + "case_number", + "case_title", + "process_name", + "due_date", + "delegation_date", + "priority", + "task" + ], + requestFunction(data) { + return that.getCasesVueCard(data); + }, + requestFunctionViewMore(data) { + return that.getCasesVueCardViewMore(data); + } + }, + optionsVueListView: { + limit: 10, + headings: { + detail: "", + case_number: this.$i18n.t("ID_MYCASE_NUMBER"), + case_title: this.$i18n.t("ID_CASE_TITLE"), + process_name: this.$i18n.t("ID_PROCESS_NAME"), + task: this.$i18n.t("ID_TASK"), + current_user: this.$i18n.t("ID_CURRENT_USER"), + due_date: this.$i18n.t("ID_DUE_DATE"), + delegation_date: this.$i18n.t("ID_DELEGATION_DATE"), + priority: this.$i18n.t("ID_PRIORITY") + }, + columns: [ + "detail", + "case_number", + "case_title", + "process_name", + "due_date", + "delegation_date", + "priority", + "task" + ], + requestFunction(data) { + return that.getCasesVueCard(data); + }, + requestFunctionViewMore(data) { + return that.getCasesVueCardViewMore(data); + } + } + } + }, + created: function () { + + }, + methods: { + /** + * Get cases for Vue Card View + */ + getCasesVueCard(data) { + let that = this, + dt, + start = 0, + limit = data.limit, + filters = {}; + filters = { + paged: "0," + limit, + }; + + _.forIn(this.filters, function (item, key) { + filters[item.filterVar] = item.value; + }); + return new Promise((resolutionFunc, rejectionFunc) => { + api.cases + .todo(filters) + .then((response) => { + dt = that.formatDataResponse(response.data.data); + resolutionFunc({ + data: dt, + count: response.data.total, + }); + }) + .catch((e) => { + rejectionFunc(e); + }); + }); + }, + /** + * Get cases for Vue Card View + */ + getCasesVueCardViewMore(data) { + let that = this, + dt, + paged, + limit = data.limit, + start = data.page === 1 ? 0 : limit * (data.page - 1), + filters = {}; + paged = start + "," + limit; + + filters = { + paged: paged, + }; + _.forIn(this.filters, function (item, key) { + filters[item.filterVar] = item.value; + }); + return new Promise((resolutionFunc, rejectionFunc) => { + api.cases + .todo(filters) + .then((response) => { + dt = that.formatDataResponse(response.data.data); + resolutionFunc({ + data: dt, + count: response.data.total, + }); + }) + .catch((e) => { + rejectionFunc(e); + }); + }); + }, + } +} \ No newline at end of file