Files
luos/resources/assets/js/home/Unassigned/Unassigned.vue

515 lines
15 KiB
Vue
Raw Normal View History

2020-12-07 15:59:15 +00:00
<template>
<div id="v-unassigned" ref="v-unassigned" class="v-container-unassigned">
<button-fleft :data="newCase"></button-fleft>
<modal-new-request ref="newRequest"></modal-new-request>
2020-12-18 19:26:38 +00:00
<CasesFilter
:filters="filters"
2020-12-18 23:44:44 +00:00
:title="$t('ID_UNASSIGNED')"
2020-12-18 19:26:38 +00:00
@onRemoveFilter="onRemoveFilter"
@onUpdateFilters="onUpdateFilters"
/>
2021-07-15 19:34:33 +00:00
<multiview-header :data="dataMultiviewHeader" />
2020-12-07 15:59:15 +00:00
<v-server-table
2021-07-15 19:34:33 +00:00
v-if="typeView === 'GRID'"
2020-12-07 15:59:15 +00:00
:columns="columns"
:options="options"
ref="vueTable"
@row-click="onRowClick"
2020-12-07 15:59:15 +00:00
>
2020-12-11 19:36:41 +00:00
<div slot="detail" slot-scope="props">
<div class="btn-default" @click="openCaseDetail(props.row)">
<i class="fas fa-info-circle"></i>
</div>
</div>
2020-12-07 15:59:15 +00:00
<div slot="case_number" slot-scope="props">
{{ props.row.CASE_NUMBER }}
</div>
<div slot="case_title" slot-scope="props">
{{ props.row.CASE_TITLE }}
</div>
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
<div slot="due_date" slot-scope="props">
{{ props.row.DUE_DATE }}
</div>
<div slot="delegation_date" slot-scope="props">
{{ props.row.DELEGATION_DATE }}
</div>
<div slot="priority" slot-scope="props">{{ props.row.PRIORITY }}</div>
<div slot="actions" slot-scope="props">
<div @click="updateDataEllipsis(props.row)">
<ellipsis v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div>
2020-12-07 15:59:15 +00:00
</div>
</v-server-table>
2021-07-15 19:34:33 +00:00
<VueCardView
v-if="typeView === 'CARD'"
:options="optionsVueList"
ref="vueCardView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
>{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span
>
</div>
<div slot="case_title" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["CASE_TITLE"] }}
</span>
</div>
<div slot="process_name" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["DUE_DATE"] }}
</span>
</div>
<div slot="delegation_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["DELEGATION_DATE"] }}
</span>
</div>
<div slot="task" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<TaskCell :data="props.item.TASK" />
</span>
</div>
</VueCardView>
<VueListView
v-if="typeView === 'LIST'"
:options="optionsVueList"
ref="vueListView"
>
<div slot="detail" slot-scope="props">
<div class="v-pm-card-info" @click="openCaseDetail(props.item)">
<i class="fas fa-info-circle"></i>
</div>
</div>
<div slot="case_number" slot-scope="props" class="v-card-text">
<span class="v-card-text-highlight"
>{{ props["headings"][props.column] }} : {{ props["item"]["CASE_NUMBER"] }}</span
>
</div>
<div slot="case_title" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["CASE_TITLE"] }}
</span>
</div>
<div slot="process_name" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["DUE_DATE"] }}
</span>
</div>
<div slot="delegation_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light"
>{{ props["item"]["DELEGATION_DATE"] }}
</span>
</div>
<div slot="task" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
>
<span class="v-card-text-light">
<TaskCell :data="props.item.TASK" />
</span>
</div>
</VueListView>
2020-12-11 19:36:41 +00:00
<ModalClaimCase ref="modal-claim-case"></ModalClaimCase>
2020-12-07 15:59:15 +00:00
</div>
</template>
<script>
2021-07-15 19:34:33 +00:00
import HeaderCounter from "../../components/home/HeaderCounter.vue";
import ButtonFleft from "../../components/home/ButtonFleft.vue";
import ModalNewRequest from "../ModalNewRequest.vue";
import TaskCell from "../../components/vuetable/TaskCell.vue";
import CasesFilter from "../../components/search/CasesFilter";
import ModalClaimCase from "../modal/ModalClaimCase.vue";
import api from "../../api/index";
import utils from "../../utils/utils";
import Ellipsis from '../../components/utils/ellipsis.vue';
import MultiviewHeader from "../../components/headers/MultiviewHeader.vue";
import VueCardView from "../../components/dataViews/vueCardView/VueCardView.vue";
import VueListView from "../../components/dataViews/vueListView/VueListView.vue";
import defaultMixins from "./defaultMixins";
2020-12-07 15:59:15 +00:00
export default {
name: "Unassigned",
2021-07-15 19:34:33 +00:00
mixins: [defaultMixins],
2020-12-07 15:59:15 +00:00
components: {
HeaderCounter,
ButtonFleft,
ModalNewRequest,
TaskCell,
2020-12-11 19:36:41 +00:00
ModalClaimCase,
2020-12-18 19:26:38 +00:00
CasesFilter,
Ellipsis,
2021-07-15 19:34:33 +00:00
MultiviewHeader,
VueCardView,
VueListView
2020-12-07 15:59:15 +00:00
},
2021-04-06 14:49:58 +00:00
props: ["defaultOption", "filters"],
2020-12-07 15:59:15 +00:00
data() {
return {
newCase: {
title: this.$i18n.t("ID_NEW_CASE"),
2020-12-07 15:59:15 +00:00
class: "btn-success",
onClick: () => {
this.$refs["newRequest"].show();
},
},
columns: [
2020-12-11 19:36:41 +00:00
"detail",
2020-12-07 15:59:15 +00:00
"case_number",
"case_title",
"process_name",
"task",
"due_date",
"delegation_date",
"priority",
"actions",
],
options: {
2020-12-18 19:26:38 +00:00
filterable: false,
2020-12-07 15:59:15 +00:00
headings: {
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"),
actions: "",
2020-12-11 19:36:41 +00:00
detail: "",
2020-12-07 15:59:15 +00:00
},
texts: {
count:this.$i18n.t("ID_SHOWING_FROM_RECORDS_COUNT"),
first: this.$i18n.t("ID_FIRST"),
last: this.$i18n.t("ID_LAST"),
filter: this.$i18n.t("ID_FILTER") + ":",
limit: this.$i18n.t("ID_RECORDS") + ":",
page: this.$i18n.t("ID_PAGE") + ":",
noResults: this.$i18n.t("ID_NO_MATCHING_RECORDS")
},
2020-12-07 15:59:15 +00:00
selectable: {
mode: "single",
only: function (row) {
return true;
},
selectAllMode: "page",
programmatic: false,
},
requestFunction(data) {
return this.$parent.$parent.getCasesForVueTable(data);
2020-12-07 15:59:15 +00:00
},
},
pmDateFormat: "Y-m-d H:i:s",
clickCount: 0,
singleClickTimer: null,
statusTitle: {
"ON_TIME": this.$i18n.t("ID_IN_PROGRESS"),
"OVERDUE": this.$i18n.t("ID_TASK_OVERDUE"),
"DRAFT": this.$i18n.t("ID_IN_DRAFT"),
"PAUSED": this.$i18n.t("ID_PAUSED"),
"UNASSIGNED": this.$i18n.t("ID_UNASSIGNED")
},
dataEllipsis: {
buttons: {}
},
showEllipsis: false
2020-12-07 15:59:15 +00:00
};
},
mounted() {
this.initFilters();
},
2020-12-07 15:59:15 +00:00
watch: {},
computed: {
/**
* Build our ProcessMaker apiClient
*/
ProcessMaker() {
return window.ProcessMaker;
},
},
updated() {},
beforeCreate() {},
methods: {
/**
* Initialize filters
* updates the filters if there is an appUid parameter
*/
initFilters() {
let params,
filter = {refresh: true};
if(this.defaultOption) {
params = utils.getAllUrlParams(this.defaultOption);
if (params && params.openapplicationuid) {
filter = {
params: [
{
fieldId: "caseNumber",
filterVar: "caseNumber",
label: "",
options:[],
value: params.openapplicationuid,
autoShow: false
}
],
refresh: true
};
}
this.$emit("cleanDefaultOption");
}
this.onUpdateFilters(filter);
},
/**
* On row click event handler
* @param {object} event
*/
onRowClick(event) {
let self = this;
self.clickCount += 1;
if (self.clickCount === 1) {
self.singleClickTimer = setTimeout(function() {
self.clickCount = 0;
}, 400);
} else if (self.clickCount === 2) {
clearTimeout(self.singleClickTimer);
self.clickCount = 0;
self.claimCase(event.row);
}
},
2020-12-07 15:59:15 +00:00
/**
* Get cases unassigned data
*/
getCasesForVueTable(data) {
2020-12-07 15:59:15 +00:00
let that = this,
dt,
paged,
limit = data.limit,
2020-12-18 19:26:38 +00:00
start = data.page === 1 ? 0 : limit * (data.page - 1),
filters = {};
paged = start + "," + limit;
filters = {
paged: paged,
};
_.forIn(this.filters, function (item, key) {
if(filters && item.value) {
filters[item.filterVar] = item.value;
}
2020-12-18 19:26:38 +00:00
});
2020-12-07 15:59:15 +00:00
return new Promise((resolutionFunc, rejectionFunc) => {
api.cases
2020-12-18 19:26:38 +00:00
.unassigned(filters)
2020-12-07 15:59:15 +00:00
.then((response) => {
dt = that.formatDataResponse(response.data.data);
resolutionFunc({
data: dt,
count: response.data.total,
});
})
.catch((e) => {
rejectionFunc(e);
});
});
},
/**
* Format Response API TODO to grid todo and columns
*/
formatDataResponse(response) {
let data = [];
_.forEach(response, (v) => {
data.push({
CASE_NUMBER: v.APP_NUMBER,
2020-12-17 19:08:08 +00:00
CASE_TITLE: v.DEL_TITLE,
2020-12-07 15:59:15 +00:00
PROCESS_NAME: v.PRO_TITLE,
TASK: [{
2020-12-07 15:59:15 +00:00
TITLE: v.TAS_TITLE,
CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL,
DELAYED_TITLE: v.TAS_STATUS === "OVERDUE" ?
this.$i18n.t("ID_DELAYED") + ":" : this.statusTitle[v.TAS_STATUS],
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : ""
}],
DUE_DATE: v.DEL_TASK_DUE_DATE_LABEL,
DELEGATION_DATE: v.DEL_DELEGATE_DATE_LABEL,
2020-12-07 15:59:15 +00:00
PRIORITY: v.DEL_PRIORITY_LABEL,
2020-12-11 19:36:41 +00:00
PRO_UID: v.PRO_UID,
TAS_UID: v.TAS_UID,
DEL_INDEX: v.DEL_INDEX,
APP_UID: v.APP_UID,
2020-12-07 15:59:15 +00:00
});
});
return data;
},
/**
2020-12-11 19:36:41 +00:00
* Claim case
*
* @param {object} item
*/
claimCase(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "unassigned" }, item)).then(() => {
2021-01-15 14:46:37 -04:00
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$refs["modal-claim-case"].data = item;
that.$refs["modal-claim-case"].show();
});
2020-12-11 19:36:41 +00:00
});
},
/**
* Open selected cases in the inbox
*
* @param {object} item
*/
openCase(item) {
this.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
ACTION: "todo"
});
this.$emit("onUpdatePage", "XCase");
},
2020-12-11 19:36:41 +00:00
/**
* Open case detail
2020-12-07 15:59:15 +00:00
*
* @param {object} item
*/
2020-12-11 19:36:41 +00:00
openCaseDetail(item) {
let that = this;
2021-01-13 19:25:01 +00:00
api.cases.open(_.extend({ ACTION: "todo" }, item)).then(() => {
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$emit("onUpdateDataCase", {
APP_UID: item.APP_UID,
DEL_INDEX: item.DEL_INDEX,
PRO_UID: item.PRO_UID,
TAS_UID: item.TAS_UID,
APP_NUMBER: item.CASE_NUMBER,
});
that.$emit("onUpdatePage", "case-detail");
2020-12-11 19:36:41 +00:00
});
});
},
2020-12-18 19:26:38 +00:00
onRemoveFilter(data) {},
onUpdateFilters(data) {
if (data.params) {
this.$emit("onUpdateFilters", data.params);
}
2020-12-18 19:26:38 +00:00
if (data.refresh) {
this.$nextTick(() => {
2021-07-15 19:34:33 +00:00
if (this.typeView === "GRID") {
this.$refs["vueTable"].getData();
}
if (this.typeView === "CARD") {
this.$refs["vueCardView"].getData();
}
if (this.typeView === "LIST") {
this.$refs["vueListView"].getData();
}
2020-12-18 19:26:38 +00:00
});
}
},
/**
* update view in component
*/
updateView(){
this.$refs["vueTable"].getData();
},
/**
* set data by default in the ellipsis component
*/
setDataEllipsis() {
this.dataEllipsis = {
showNote: true,
showPause: true,
showClaim: true
}
},
/**
* Show options in the ellipsis
*/
updateDataEllipsis(data) {
let that = this;
this.showEllipsis = !this.showEllipsis;
if (this.showEllipsis) {
this.dataEllipsis = {
buttons: {
note: {
name: "case note",
icon: "far fa-comments",
fn: function() {console.log("comments");}
},
pause: {
name: "pause case",
icon: "far fa-pause-circle",
fn: function() {console.log("pause case");}
},
claim: {
name: "claim case",
icon: "fas fa-briefcase",
fn: function() {console.log("claim case");}
}
}
}
}
},
2020-12-07 15:59:15 +00:00
},
};
</script>
<style>
.v-container-unassigned {
padding-top: 20px;
padding-bottom: 20px;
padding-left: 50px;
padding-right: 50px;
}
</style>