Merged in feature/PMCORE-3517-2 (pull request #8303)

PMCORE-3517 PMCORE-3505

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Paula Quispe
2021-12-06 21:53:22 +00:00
committed by Julio Cesar Laura Avendaño
34 changed files with 1009 additions and 420 deletions

View File

@@ -1,81 +1,89 @@
<template>
<div>
<SearchPopover
target="popover-target-1"
@savePopover="onOk"
:title="addSearchTitle"
>
<template v-slot:body>
<b-form-group>
<b-form-radio-group
v-model="selected"
:options="criteriaItems"
value-field="id"
text-field="optionLabel"
name="flavour-2a"
stacked
></b-form-radio-group>
<b-form-group>
</b-form-group>
<b-form-checkbox
id="checkbox-1"
v-model="byProcessName"
name="checkbox-1"
value="processName"
>
{{$t('ID_BY_PROCESS_NAME') }}
</b-form-checkbox>
</b-form-group>
</template>
</SearchPopover>
<div class="p-1 v-flex">
<h5 class="v-search-title">{{ title }}</h5>
<div class="pm-in-text-icon">
<i :class="icon"></i>
</div>
<b-input-group class="w-75 p-1">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span
class="input-group-text bg-primary-pm text-white"
id="popover-target-1"
@click="searchClickHandler"
>
<b-icon icon="search"></b-icon
></span>
</div>
<b-form-tags input-id="tags-pills" v-model="searchTags">
<template v-slot="{ tags, tagVariant, removeTag }">
<div class="d-inline-block" style="font-size: 1rem">
<b-form-tag
v-for="tag in tags"
@remove="customRemove(removeTag, tag)"
:key="tag"
:title="tag"
:variant="tagVariant"
class="mr-1 badge badge-light"
>
<div :id="tag">
<i class="fas fa-tags"></i>
{{ tagContent(tag) }}
</div>
<component
v-bind:is="tagComponent(tag)"
v-bind:info="tagInfo(tag)"
v-bind:tag="tag"
v-bind:filter="dataToFilter(tag)"
@updateSearchTag="updateSearchTag"
/>
</b-form-tag>
</div>
<div>
<SearchPopover
target="popover-target-1"
@savePopover="onOk"
:title="addSearchTitle"
>
<template v-slot:body>
<b-form-group>
<b-form-radio-group
v-model="selected"
:options="criteriaItems"
value-field="id"
text-field="optionLabel"
name="flavour-2a"
stacked
></b-form-radio-group>
<b-form-group> </b-form-group>
<b-form-checkbox
id="checkbox-1"
v-model="byProcessName"
name="checkbox-1"
value="processName"
>
{{ $t("ID_BY_PROCESS_NAME") }}
</b-form-checkbox>
<b-form-checkbox
id="checkbox-2"
v-model="byProcessCategory"
name="checkbox-2"
value="processCategory"
>
{{ $t("ID_BY_PROCESS_CATEGORY") }}
</b-form-checkbox>
</b-form-group>
</template>
</b-form-tags>
</SearchPopover>
<div class="p-1 v-flex">
<h5 class="v-search-title">{{ title }}</h5>
<div class="pm-in-text-icon">
<i :class="icon"></i>
</div>
<b-input-group class="w-75 p-1">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span
class="input-group-text bg-primary-pm text-white"
id="popover-target-1"
@click="searchClickHandler"
>
<b-icon icon="search"></b-icon
></span>
</div>
<b-form-tags input-id="tags-pills" v-model="searchTags">
<template v-slot="{ tags, tagVariant, removeTag }">
<div class="d-inline-block" style="font-size: 1rem">
<b-form-tag
v-for="tag in tags"
@remove="customRemove(removeTag, tag)"
:key="tag"
:title="tag"
:variant="tagVariant"
class="mr-1 badge badge-light"
>
<div :id="tag">
<i class="fas fa-tags"></i>
{{ tagContent(tag) }}
</div>
<component
:filters="filters"
v-bind:is="tagComponent(tag)"
v-bind:info="tagInfo(tag)"
v-bind:tag="tag"
v-bind:filter="dataToFilter(tag)"
@updateSearchTag="updateSearchTag"
/>
</b-form-tag>
</div>
</template>
</b-form-tags>
</div>
</b-input-group>
</div>
</b-input-group>
</div>
</div>
</template>
<script>
@@ -83,376 +91,469 @@ import SearchPopover from "./popovers/SearchPopover.vue";
import CaseNumber from "./popovers/CaseNumber.vue";
import CaseTitle from "./popovers/CaseTitle.vue";
import ProcessName from "./popovers/ProcessName.vue";
import ProcessCategory from "./popovers/ProcessCategory.vue";
import DateFilter from "./popovers/DateFilter.vue";
import TaskTitle from "./popovers/TaskTitle.vue";
import CurrentUser from "./popovers/CurrentUser.vue";
import api from "./../../api/index";
export default {
name: "Cases",
props: ["filters", "title", "icon" , "hiddenItems"],
components: {
SearchPopover,
CaseNumber,
CaseTitle,
ProcessName,
DateFilter,
TaskTitle,
CurrentUser
},
data() {
return {
searchLabel: this.$i18n.t("ID_SEARCH"),
addSearchTitle: this.$i18n.t("ID_ADD_SEARCH_FILTER_CRITERIA"),
searchTags: [],
dataLoaded: false,
filterItems: [
{
type: "CaseNumber",
id: "caseNumber",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_CASE_NUMBER"
)}`,
optionLabel: this.$i18n.t("ID_BY_CASE_NUMBER"),
detail: this.$i18n.t("ID_PLEASE_SET_THE_CASE_NUMBER_TO_BE_SEARCHED"),
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_CASE_NUMBER"),
items: [
{
id: "filterCases",
value: "",
name: "Cases",
props: ["filters", "title", "icon", "hiddenItems"],
components: {
SearchPopover,
CaseNumber,
CaseTitle,
ProcessName,
ProcessCategory,
DateFilter,
TaskTitle,
CurrentUser,
},
data() {
return {
searchLabel: this.$i18n.t("ID_SEARCH"),
addSearchTitle: this.$i18n.t("ID_ADD_SEARCH_FILTER_CRITERIA"),
searchTags: [],
dataLoaded: false,
filterItems: [
{
type: "CaseNumber",
id: "caseNumber",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_CASE_NUMBER"
)}`,
optionLabel: this.$i18n.t("ID_BY_CASE_NUMBER"),
detail: this.$i18n.t(
"ID_PLEASE_SET_THE_CASE_NUMBER_TO_BE_SEARCHED"
),
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_CASE_NUMBER"),
items: [
{
id: "filterCases",
value: "",
},
],
autoShow: true,
makeTagText: function(params, data) {
return `${params.tagPrefix}: ${data[0].value}`;
},
],
autoShow: true,
makeTagText: function (params, data) {
return `${params.tagPrefix}: ${data[0].value}`;
},
},
{
type: "CaseTitle",
id: "caseTitle",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_CASE_THREAD_TITLE"
)}`,
optionLabel: this.$i18n.t("ID_BY_CASE_THREAD_TITLE"),
tagPrefix: this.$i18n.t("ID_SEARCH_BY_CASE_THREAD_TITLE"),
detail: "",
tagText: "",
items: [
{
id: "caseTitle",
value: "",
{
type: "CaseTitle",
id: "caseTitle",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_CASE_THREAD_TITLE"
)}`,
optionLabel: this.$i18n.t("ID_BY_CASE_THREAD_TITLE"),
tagPrefix: this.$i18n.t("ID_SEARCH_BY_CASE_THREAD_TITLE"),
detail: "",
tagText: "",
items: [
{
id: "caseTitle",
value: "",
},
],
autoShow: true,
makeTagText: function(params, data) {
return `${this.tagPrefix} ${data[0].value}`;
},
],
autoShow: true,
makeTagText: function (params, data) {
return `${this.tagPrefix} ${data[0].value}`;
},
},
{
type: "DateFilter",
id: "delegationDate",
title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_DELEGATION_DATE')}`,
optionLabel: this.$i18n.t('ID_BY_DELEGATION_DATE'),
detail: this.$i18n.t('ID_PLEASE_SELECT_THE_DELEGATION_DATE_TO_BE_SEARCHED'),
tagText: "",
tagPrefix: this.$i18n.t('ID_SEARCH_BY_DELEGATION_DATE'),
items:[
{
id: "delegateFrom",
value: "",
label: this.$i18n.t('ID_FROM_DELEGATION_DATE')
{
type: "DateFilter",
id: "delegationDate",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_DELEGATION_DATE"
)}`,
optionLabel: this.$i18n.t("ID_BY_DELEGATION_DATE"),
detail: this.$i18n.t(
"ID_PLEASE_SELECT_THE_DELEGATION_DATE_TO_BE_SEARCHED"
),
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_DELEGATION_DATE"),
items: [
{
id: "delegateFrom",
value: "",
label: this.$i18n.t("ID_FROM_DELEGATION_DATE"),
},
{
id: "delegateTo",
value: "",
label: this.$i18n.t("ID_TO_DELEGATION_DATE"),
},
],
makeTagText: function(params, data) {
return `${params.tagPrefix} ${data[0].value} - ${data[1].value}`;
},
{
id: "delegateTo",
value: "",
label: this.$i18n.t('ID_TO_DELEGATION_DATE')
}
],
makeTagText: function (params, data) {
return `${params.tagPrefix} ${data[0].value} - ${data[1].value}`;
}
},
{
type: "CurrentUser",
id: "bySendBy",
title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_SEND_BY')}`,
optionLabel: this.$i18n.t('ID_BY_SEND_BY'),
detail: this.$i18n.t('ID_PLEASE_SELECT_USER_NAME_TO_BE_SEARCHED'),
placeholder: this.$i18n.t('ID_USER_NAME'),
tagText: "",
tagPrefix: this.$i18n.t('ID_SEARCH_BY_SEND_BY'),
autoShow: true,
items:[
{
id: "sendBy",
value: "",
options: [],
placeholder: this.$i18n.t('ID_USER_NAME')
}
],
makeTagText: function (params, data) {
return `${params.tagPrefix} : ${data[0].label || ''}`;
}
},
{
type: "TaskTitle",
id: "taskTitle",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_TASK_NAME"
)}`,
optionLabel: this.$i18n.t("ID_BY_TASK"),
detail: "",
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_TASK_NAME"),
autoShow: true,
items: [
{
id: "task",
value: "",
options: [],
placeholder: this.$i18n.t("ID_TASK_NAME"),
},
],
makeTagText: function (params, data) {
return `${this.tagPrefix}: ${data[0].label || ""}`;
},
},
],
processName: {
{
type: "CurrentUser",
id: "bySendBy",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_SEND_BY"
)}`,
optionLabel: this.$i18n.t("ID_BY_SEND_BY"),
detail: this.$i18n.t(
"ID_PLEASE_SELECT_USER_NAME_TO_BE_SEARCHED"
),
placeholder: this.$i18n.t("ID_USER_NAME"),
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_SEND_BY"),
autoShow: true,
items: [
{
id: "sendBy",
value: "",
options: [],
placeholder: this.$i18n.t("ID_USER_NAME"),
},
],
makeTagText: function(params, data) {
return `${params.tagPrefix} : ${data[0].label || ""}`;
},
},
{
type: "TaskTitle",
id: "taskTitle",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_TASK_NAME"
)}`,
optionLabel: this.$i18n.t("ID_BY_TASK"),
detail: "",
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_TASK_NAME"),
autoShow: true,
items: [
{
id: "task",
value: "",
options: [],
placeholder: this.$i18n.t("ID_TASK_NAME"),
},
],
makeTagText: function(params, data) {
return `${this.tagPrefix}: ${data[0].label || ""}`;
},
},
],
processName: {
type: "ProcessName",
id: "processName",
title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_PROCESS_NAME')}`,
optionLabel: this.$i18n.t('ID_BY_PROCESS_NAME'),
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_PROCESS_NAME"
)}`,
optionLabel: this.$i18n.t("ID_BY_PROCESS_NAME"),
detail: "",
tagText: "",
tagPrefix: this.$i18n.t('ID_SEARCH_BY_PROCESS_NAME'),
tagPrefix: this.$i18n.t("ID_SEARCH_BY_PROCESS_NAME"),
autoShow: true,
items:[
items: [
{
id: "process",
value: "",
options: [],
placeholder: this.$i18n.t('ID_PROCESS_NAME')
}
placeholder: this.$i18n.t("ID_PROCESS_NAME"),
},
],
makeTagText: function (params, data) {
return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`;
makeTagText: function(params, data) {
return `${this.tagPrefix} ${(data[0].options &&
data[0].options.label) ||
""}`;
},
},
processCategory: {
type: "ProcessCategory",
id: "processCategory",
title: `${this.$i18n.t("ID_FILTER")}: ${this.$i18n.t(
"ID_BY_PROCESS_CATEGORY"
)}`,
optionLabel: this.$i18n.t("ID_BY_PROCESS_CATEGORY"),
detail: "",
tagText: "",
tagPrefix: this.$i18n.t("ID_SEARCH_BY_PROCESS_CATEGORY"),
autoShow: true,
items: [
{
id: "category",
value: "",
options: [],
placeholder: "",
},
],
makeTagText: function(params, data) {
return `${params.tagPrefix}: ${data[0].label || ""}`;
},
},
selected: "",
itemModel: {},
byProcessName: "",
byProcessCategory: "",
};
},
computed: {
// a computed getter
criteriaItems: function() {
let found,
criteria = [];
if (this.hiddenItems && this.hiddenItems.length) {
this.filterItems.forEach((item) => {
found = this.hiddenItems.find((elem) => elem !== item.id);
if (found) {
criteria.push(item);
}
});
return criteria;
} else {
return this.filterItems;
}
},
},
mounted() {},
watch: {
filters: {
immediate: true,
handler(newVal, oldVal) {
this.searchTags = [];
this.selected = [];
//Prevent show popover at the first time
if (newVal.length) {
this.setFilters(newVal, oldVal);
this.searchClickHandler();
}
},
selected: "",
itemModel: {},
byProcessName: ""
};
},
computed: {
// a computed getter
criteriaItems: function () {
let found,
criteria = [];
if (this.hiddenItems && this.hiddenItems.length) {
this.filterItems.forEach(item => {
found = this.hiddenItems.find( elem => elem !== item.id);
if (found) {
criteria.push(item);
}
});
return criteria;
} else {
return this.filterItems;
}
}
},
mounted() {
},
watch: {
filters: {
immediate: true,
handler(newVal, oldVal) {
this.searchTags = [];
this.selected = [];
//Prevent show popover at the first time
if (newVal.length) {
this.setFilters(newVal, oldVal);
this.searchClickHandler();
},
},
methods: {
/**
* Add filter criteria save button handler
*/
onOk() {
let self = this,
element,
initialFilters = [],
item;
this.$root.$emit("bv::hide::popover");
element = _.find(this.filterItems, function(o) {
return o.id === self.selected;
});
if (element) {
initialFilters = this.prepareFilterItems(
element.items,
this.selected,
true
);
}
}
}
},
methods: {
/**
* Add filter criteria save button handler
*/
onOk() {
let self = this,
element,
initialFilters = [],
item;
this.$root.$emit("bv::hide::popover");
element = _.find(this.filterItems, function (o) {
return o.id === self.selected;
});
if (element) {
initialFilters = this.prepareFilterItems(element.items, this.selected, true);
}
//adding process name filter
if (self.byProcessName !== "") {
if (element !== undefined) {
this.processName.autoShow = false;
} else {
this.processName.autoShow = true;
//adding process name filter
if (self.byProcessName !== "") {
if (element !== undefined) {
this.processName.autoShow = false;
} else {
this.processName.autoShow = true;
}
initialFilters = [
...new Set([
...initialFilters,
...this.prepareFilterItems(
this.processName.items,
self.byProcessName,
true
),
]),
];
}
initialFilters =[...new Set([...initialFilters,...this.prepareFilterItems(this.processName.items, self.byProcessName, true)])];
}
this.$emit("onUpdateFilters", {params: initialFilters, refresh: false});
},
/**
* Prepare the filter items
* @param {array} items
* @param {id} string
* @param {boolean} restore
*/
prepareFilterItems(items, id, restore){
let initialFilters = [],
self = this,
filter,
item;
_.forEach(items, function(value, key) {
filter = _.find(self.filters, function(o) { return o.filterVar === value.id; });
if (filter && restore) {
initialFilters.push(filter);
} else {
item = {
filterVar: value.id,
fieldId: id,
value: '',
label: "",
options: [],
autoShow: true
};
initialFilters.push(item);
if (self.byProcessCategory !== "") {
if (element !== undefined) {
this.processCategory.autoShow = false;
} else {
this.processCategory.autoShow = true;
}
initialFilters = [
...new Set([
...initialFilters,
...this.prepareFilterItems(
this.processCategory.items,
self.byProcessCategory,
true
),
]),
];
}
});
return initialFilters;
},
/**
* Set Filters and make the tag labels
* @param {object} filters json to manage the query
*/
setFilters(filters, oldVal) {
let self = this;
_.forEach(filters, function (item, key) {
let component = _.find(self.filterItems, function (o) {
return o.id === item.fieldId;
});
if (component) {
self.searchTags.push(component.id);
self.selected = component.id;
self.itemModel[component.id] = component;
self.itemModel[component.id].autoShow = typeof item.autoShow !== "undefined" ? item.autoShow : true;
}
if(item.fieldId === "processName") {
self.searchTags.push(self.processName.id);
self.byProcessName = self.processName.id;
self.itemModel[self.processName.id] = self.processName;
self.itemModel[self.processName.id].autoShow = typeof item.autoShow !== "undefined" ? item.autoShow : self.processName.autoShow;
}
});
},
dataToFilter(id) {
let data = [];
_.forEach(this.filters, function (item) {
if (item.fieldId === id) {
data.push(item);
}
});
return data;
},
/**
*
*/
tagContent(id) {
if (
this.itemModel[id] &&
typeof this.itemModel[id].makeTagText === "function"
) {
return this.itemModel[id].makeTagText(
this.itemModel[id],
this.dataToFilter(id)
);
}
return "";
},
tagComponent(id) {
if (this.itemModel[id]) {
return this.itemModel[id].type;
}
return null;
},
this.$emit("onUpdateFilters", {
params: initialFilters,
refresh: false,
});
},
/**
* Prepare the filter items
* @param {array} items
* @param {id} string
* @param {boolean} restore
*/
prepareFilterItems(items, id, restore) {
let initialFilters = [],
self = this,
filter,
item;
_.forEach(items, function(value, key) {
filter = _.find(self.filters, function(o) {
return o.filterVar === value.id;
});
if (filter && restore) {
initialFilters.push(filter);
} else {
item = {
filterVar: value.id,
fieldId: id,
value: "",
label: "",
options: [],
autoShow: true,
};
initialFilters.push(item);
}
});
return initialFilters;
},
/**
* Set Filters and make the tag labels
* @param {object} filters json to manage the query
*/
setFilters(filters, oldVal) {
let self = this;
_.forEach(filters, function(item, key) {
let component = _.find(self.filterItems, function(o) {
return o.id === item.fieldId;
});
if (component) {
self.searchTags.push(component.id);
self.selected = component.id;
self.itemModel[component.id] = component;
self.itemModel[component.id].autoShow =
typeof item.autoShow !== "undefined"
? item.autoShow
: true;
}
if (item.fieldId === "processName") {
self.searchTags.push(self.processName.id);
self.byProcessName = self.processName.id;
self.itemModel[self.processName.id] = self.processName;
self.itemModel[self.processName.id].autoShow =
typeof item.autoShow !== "undefined"
? item.autoShow
: self.processName.autoShow;
}
if (item.fieldId === "processCategory") {
self.searchTags.push(self.processCategory.id);
self.byProcessCategory = self.processCategory.id;
self.itemModel[self.processCategory.id] =
self.processCategory;
self.itemModel[self.processCategory.id].autoShow =
typeof self.processCategory.autoShow !== "undefined"
? self.processCategory.autoShow
: true;
}
});
},
dataToFilter(id) {
let data = [];
_.forEach(this.filters, function(item) {
if (item.fieldId === id) {
data.push(item);
}
});
return data;
},
/**
*
*/
tagContent(id) {
if (
this.itemModel[id] &&
typeof this.itemModel[id].makeTagText === "function"
) {
return this.itemModel[id].makeTagText(
this.itemModel[id],
this.dataToFilter(id)
);
}
return "";
},
tagComponent(id) {
if (this.itemModel[id]) {
return this.itemModel[id].type;
}
return null;
},
tagInfo(id) {
if (this.itemModel[id]) {
return this.itemModel[id];
}
return null;
},
/**
* Remove from tag button
* @param {function} removeTag - default callback
* @param {string} tag filter identifier
*/
customRemove(removeTag, tag) {
let temp = [];
_.forEach(this.filters, function(item, key) {
if(item.fieldId !== tag) {
temp.push(item);
tagInfo(id) {
if (this.itemModel[id]) {
return this.itemModel[id];
}
});
if (tag === "processName") {
this.byProcessName = "";
}
this.$emit("onUpdateFilters", {params: temp, refresh: true});
return null;
},
/**
* Remove from tag button
* @param {function} removeTag - default callback
* @param {string} tag filter identifier
*/
customRemove(removeTag, tag) {
let temp = [];
_.forEach(this.filters, function(item, key) {
if (item.fieldId !== tag) {
temp.push(item);
}
});
if (tag === "processName") {
this.byProcessName = "";
}
if (tag === "processCategory") {
this.byProcessCategory = "";
}
this.$emit("onUpdateFilters", { params: temp, refresh: true });
},
/**
* Update the filter model this is fired from filter popaver save action
* @param {object} params - arrives the settings
* @param {string} tag filter identifier
*/
updateSearchTag(params) {
let temp = this.filters.concat(params);
temp = [...new Set([...this.filters, ...params])];
this.$emit("onUpdateFilters", { params: temp, refresh: true });
},
searchClickHandler() {
this.$root.$emit("bv::hide::popover");
},
},
/**
* Update the filter model this is fired from filter popaver save action
* @param {object} params - arrives the settings
* @param {string} tag filter identifier
*/
updateSearchTag(params) {
let temp = this.filters.concat(params);
temp = [...new Set([...this.filters, ...params])];
this.$emit("onUpdateFilters", { params: temp, refresh: true });
},
searchClickHandler() {
this.$root.$emit("bv::hide::popover");
},
},
};
</script>
<style scoped>
.bv-example-row .row + .row {
margin-top: 1rem;
margin-top: 1rem;
}
.bv-example-row-flex-cols .row {
min-height: 10rem;
min-height: 10rem;
}
.bg-primary-pm {
background-color: #0099dd;
background-color: #0099dd;
}
.v-flex {
display: flex;
display: flex;
}
.v-search-title {
padding-right: 10px;
line-height: 40px;
padding-right: 10px;
line-height: 40px;
}
.pm-in-text-icon {
font-size: 1.40rem;
padding-right: 10px;
line-height: 40px;
font-size: 1.4rem;
padding-right: 10px;
line-height: 40px;
}
</style>
</style>

View File

@@ -17,7 +17,7 @@
></b-form-radio-group>
<b-form-group> </b-form-group>
<b-form-checkbox-group
id="checkbox-1"
id="checkbox-custom-filter"
v-model="selectedCheckbox"
:options="getFilterColletion('checkbox')"
value-field="id"
@@ -61,6 +61,7 @@
{{ tagContent(tag) }}
</div>
<component
:filters="filters"
v-bind:is="tagComponent(tag)"
v-bind:info="tagInfo(tag)"
v-bind:tag="tag"
@@ -82,6 +83,7 @@ import SearchPopover from "./popovers/SearchPopover.vue";
import CaseNumber from "./popovers/CaseNumber.vue";
import CaseTitle from "./popovers/CaseTitle.vue";
import ProcessName from "./popovers/ProcessName.vue";
import ProcessCategory from "./popovers/ProcessCategory.vue";
import DateFilter from "./popovers/DateFilter.vue";
import TaskTitle from "./popovers/TaskTitle.vue";
import CurrentUser from "./popovers/CurrentUser.vue";
@@ -97,6 +99,7 @@ export default {
CaseNumber,
CaseTitle,
ProcessName,
ProcessCategory,
DateFilter,
TaskTitle,
CurrentUser,
@@ -113,11 +116,13 @@ export default {
selectedCheckbox: [],
itemModel: {},
byProcessName: "",
byProcessCategory: "",
criteriaItemsRadio: [],
criteriaItemsCheckbox: [],
showProcessName: true,
};
},
mounted(){},
watch: {
filters: {
immediate: true,
@@ -365,3 +370,9 @@ export default {
line-height: 3vw;
}
</style>
<style>
#checkbox-custom-filter > .custom-control-inline{
display: block !important;
margin-right: 1rem;
}
</style>

View File

@@ -6,6 +6,7 @@
:title="addSearchTitle"
>
<template v-slot:body>
<b-form-group>
<b-form-radio-group
v-model="selected"
@@ -24,6 +25,15 @@
>
{{$t('ID_BY_PROCESS_NAME') }}
</b-form-checkbox>
<b-form-checkbox
id="checkbox-2"
v-model="byProcessCategory"
name="checkbox-2"
value="processCategory"
>
{{$t('ID_BY_PROCESS_CATEGORY') }}
</b-form-checkbox>
</template>
</SearchPopover>
@@ -61,6 +71,7 @@
</div>
<component
:filters="filters"
v-bind:is="tagComponent(tag)"
v-bind:info="tagInfo(tag)"
v-bind:tag="tag"
@@ -82,6 +93,7 @@ import SearchPopover from "./popovers/SearchPopover.vue";
import CaseNumber from "./popovers/CaseNumber.vue";
import CaseTitle from "./popovers/CaseTitle.vue";
import ProcessName from "./popovers/ProcessName.vue";
import ProcessCategory from "./popovers/ProcessCategory.vue";
import DateFilter from "./popovers/DateFilter.vue";
import TaskTitle from "./popovers/TaskTitle.vue";
import api from "./../../api/index";
@@ -94,6 +106,7 @@ export default {
CaseNumber,
CaseTitle,
ProcessName,
ProcessCategory,
DateFilter,
TaskTitle
},
@@ -235,9 +248,31 @@ export default {
return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`;
}
},
processCategory:{
type: "ProcessCategory",
id: "processCategory",
title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_PROCESS_CATEGORY')}`,
optionLabel: this.$i18n.t('ID_BY_PROCESS_CATEGORY'),
detail: "",
tagText: "",
tagPrefix: this.$i18n.t('ID_SEARCH_BY_PROCESS_CATEGORY'),
autoShow: true,
items:[
{
id: "category",
value: "",
options: [],
placeholder: ""
}
],
makeTagText: function (params, data) {
return `${params.tagPrefix}: ${data[0].label || ''}`;
}
},
selected: "",
itemModel: {},
byProcessName: ""
byProcessName: "",
byProcessCategory: "",
};
},
mounted() {
@@ -284,6 +319,15 @@ export default {
}
initialFilters =[...new Set([...initialFilters,...this.prepareFilterItems(this.processName.items, self.byProcessName, true)])];
}
//adding process name filter
if (self.byProcessCategory !== "") {
if (element !== undefined) {
this.processCategory.autoShow = false;
} else {
this.processCategory.autoShow = true;
}
initialFilters =[...new Set([...initialFilters,...this.prepareFilterItems(this.processCategory.items, self.byProcessCategory, true)])];
}
this.$emit("onUpdateFilters", {params: initialFilters, refresh: false});
},
/**
@@ -334,6 +378,12 @@ export default {
self.itemModel[self.processName.id] = self.processName;
self.itemModel[self.processName.id].autoShow = typeof self.processName.autoShow !== "undefined" ? self.processName.autoShow : true;
}
if(item.fieldId === "processCategory") {
self.searchTags.push(self.processCategory.id);
self.byProcessCategory = self.processCategory.id;
self.itemModel[self.processCategory.id] = self.processCategory;
self.itemModel[self.processCategory.id].autoShow = typeof self.processCategory.autoShow !== "undefined" ? self.processCategory.autoShow : true;
}
});
},
dataToFilter(id) {
@@ -382,6 +432,9 @@ export default {
if (tag === "processName") {
this.byProcessName = "";
}
if (tag === "processCategory") {
this.byProcessCategory = "";
}
this.$emit("onUpdateFilters", {params: temp, refresh: true});
},
/**

View File

@@ -38,6 +38,7 @@
import SearchPopover from "./SearchPopover.vue";
import Multiselect from "vue-multiselect";
import api from "./../../../api/index";
import _ from "lodash";
export default {
components: {
@@ -57,11 +58,16 @@ export default {
* @param {string} query - string from the text field
*/
asyncFind(query) {
let self = this;
let self = this,
cat = this.verifyCategory(),
params = { text: query };
this.isLoading = true;
if (cat) {
params.category = cat;
}
self.processes = [];
api.filters
.processList(query)
.processListPaged(params)
.then((response) => {
self.processes = [];
_.forEach(response.data, function(elem, key) {
@@ -76,6 +82,13 @@ export default {
console.error(err);
});
},
verifyCategory() {
let cat = _.find(
this.$attrs.filters,
(o) => o.fieldId == "processCategory"
);
return cat ? cat.value : null;
},
/**
* Form validations review
*/

View File

@@ -52,6 +52,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
@@ -143,6 +146,7 @@ export default {
columns: [
"case_number",
"process_name",
"process_category",
"status",
"thread_title",
"task",
@@ -158,6 +162,7 @@ export default {
headings: {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
status: this.$i18n.t("ID_STATUS"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
task: this.$i18n.t("ID_TASK"),
@@ -296,6 +301,7 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.THREAD_TITLES,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
TASK: this.formatTasks(v.THREAD_TASKS),
USER_DATA: this.formatUser(v.THREAD_USERS),
START_DATE: v.APP_CREATE_DATE_LABEL,

View File

@@ -58,7 +58,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
@@ -131,6 +133,9 @@
<span v-if="column === 'process_name'" class="v-card-text-highlight">
{{ props["item"]["PROCESS_NAME"] }}
</span>
<span v-if="column === 'process_category'" class="v-card-text-highlight">
{{ props["item"]["PROCESS_CATEGORY"] }}
</span>
<span v-if="column === 'due_date'" class="v-card-text-highlight">
{{ props["item"]["DUE_DATE"] }}
</span>
@@ -185,6 +190,9 @@
<span v-if="column === 'process_name'" class="v-card-text-highlight">
{{ props["item"]["PROCESS_NAME"] }}
</span>
<span v-if="column === 'process_category'" class="v-card-text-highlight">
{{ props["item"]["PROCESS_CATEGORY"] }}
</span>
<span v-if="column === 'due_date'" class="v-card-text-highlight">
{{ props["item"]["DUE_DATE"] }}
</span>
@@ -317,6 +325,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
@@ -393,7 +402,8 @@ export default {
thread_title: "caseTitle",
delegation_date: "delegationDate",
send_by: "bySendBy",
process_name: "processName"
process_name: "processName",
process_category: "processCategory"
},
customItems:{
VARCHAR: {
@@ -576,7 +586,30 @@ export default {
makeTagText: function (params, data) {
return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`;
}
}
},
processCategory: {
group: "checkbox",
type: "ProcessCategory",
id: "processCategory",
title: `${this.$i18n.t('ID_FILTER')}: ${this.$i18n.t('ID_BY_PROCESS_CATEGORY')}`,
optionLabel: this.$i18n.t('ID_BY_PROCESS_CATEGORY'),
detail: "",
tagText: "",
tagPrefix: this.$i18n.t('ID_SEARCH_BY_PROCESS_CATEGORY'),
autoShow: false,
items:[
{
id: "process",
value: "",
options: [],
placeholder: this.$i18n.t('ID_CATEGORY_PROCESS')
}
],
makeTagText: function (params, data) {
return `${this.tagPrefix} ${data[0].options && data[0].options.label || ''}`;
}
},
showUserTooltip: true
}
};
},
@@ -844,6 +877,7 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.DEL_TITLE,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
TASK: [
{
TITLE: v.TAS_TITLE,

View File

@@ -54,6 +54,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
@@ -104,6 +107,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -178,6 +189,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -296,6 +315,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
priority: this.$i18n.t("ID_PRIORITY"),
actions: ""
@@ -523,6 +543,7 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.DEL_TITLE,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
TASK: [{
TITLE: v.TAS_TITLE,
CODE_COLOR: v.TAS_COLOR,

View File

@@ -54,6 +54,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
current_user: this.$i18n.t("ID_CURRENT_USER"),
due_date: this.$i18n.t("ID_DUE_DATE"),

View File

@@ -49,7 +49,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
@@ -112,6 +114,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -193,6 +203,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -328,6 +346,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
@@ -558,6 +577,7 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.DEL_TITLE,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
TASK: [
{
TITLE: v.TAS_TITLE,

View File

@@ -54,6 +54,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
current_user: this.$i18n.t("ID_CURRENT_USER"),
@@ -65,6 +66,7 @@ export default {
"case_number",
"thread_title",
"process_name",
"process_category",
"due_date",
"delegation_date",
"priority",

View File

@@ -50,6 +50,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="pending_taks" slot-scope="props">
<GroupedCell :data="props.row.PENDING_TASKS" />
</div>
@@ -161,6 +164,7 @@ export default {
headings: {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
pending_taks: this.$i18n.t("ID_PENDING_TASKS"),
status: this.$i18n.t("ID_CASESLIST_APP_STATUS"),
@@ -454,6 +458,8 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.THREAD_TITLES,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
STATUS: v.APP_STATUS,
START_DATE: v.APP_CREATE_DATE_LABEL || "",
FINISH_DATE: v.APP_FINISH_DATE_LABEL || "",

View File

@@ -1,8 +1,12 @@
import _ from "lodash";
import api from "../../api/index";
export default {
data() {
return {
random: 1
random: 1,
defaultColumnsDisabled: [
"process_category"
]
};
},
methods: {

View File

@@ -48,6 +48,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
@@ -110,6 +113,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -191,6 +202,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -327,6 +346,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
@@ -556,6 +576,7 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.DEL_TITLE,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
TASK: [{
TITLE: v.TAS_TITLE,
CODE_COLOR: v.TAS_COLOR,

View File

@@ -53,6 +53,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
current_user: this.$i18n.t("ID_CURRENT_USER"),
@@ -64,6 +65,7 @@ export default {
"case_number",
"thread_title",
"process_name",
"process_category",
"due_date",
"delegation_date",
"priority",

View File

@@ -46,6 +46,9 @@
<div slot="process_name" slot-scope="props">
{{ props.row.PROCESS_NAME }}
</div>
<div slot="process_category" slot-scope="props">
{{ props.row.PROCESS_CATEGORY }}
</div>
<div slot="task" slot-scope="props">
<TaskCell :data="props.row.TASK" />
</div>
@@ -105,6 +108,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -186,6 +197,14 @@
>{{ props["item"]["PROCESS_NAME"] }}
</span>
</div>
<div slot="process_category" 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_CATEGORY"] }}
</span>
</div>
<div slot="due_date" slot-scope="props" class="v-card-text">
<span class="v-card-text-dark"
>{{ props["headings"][props.column] }} :</span
@@ -319,6 +338,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
due_date: this.$i18n.t("ID_DUE_DATE"),
@@ -519,6 +539,7 @@ export default {
CASE_NUMBER: v.APP_NUMBER,
THREAD_TITLE: v.DEL_TITLE,
PROCESS_NAME: v.PRO_TITLE,
PROCESS_CATEGORY: v.CATEGORY,
TASK: [{
TITLE: v.TAS_TITLE,
CODE_COLOR: v.TAS_COLOR,

View File

@@ -53,6 +53,7 @@ export default {
case_number: this.$i18n.t("ID_MYCASE_NUMBER"),
thread_title: this.$i18n.t('ID_CASE_THREAD_TITLE'),
process_name: this.$i18n.t("ID_PROCESS_NAME"),
process_category: this.$i18n.t("ID_CATEGORY_PROCESS"),
task: this.$i18n.t("ID_TASK"),
send_by: this.$i18n.t("ID_SEND_BY"),
current_user: this.$i18n.t("ID_CURRENT_USER"),
@@ -64,6 +65,7 @@ export default {
"case_number",
"thread_title",
"process_name",
"process_category",
"due_date",
"delegation_date",
"priority",

View File

@@ -6,6 +6,9 @@ use Exception;
use G;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\BusinessModel\Cases\AbstractCases;
use ProcessMaker\BusinessModel\Cases\Draft;
use ProcessMaker\BusinessModel\Cases\Paused;
use ProcessMaker\BusinessModel\Cases\Unassigned;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
@@ -738,6 +741,8 @@ class AbstractCasesTest extends TestCase
$absCases = new AbstractCases();
$properties = [];
$absCases->setProperties($properties);
$actual = $absCases->getCategoryId();
$this->assertEquals(0, $actual);
$actual = $absCases->getProcessId();
$this->assertEquals(0, $actual);
$actual = $absCases->getTaskId();
@@ -784,6 +789,7 @@ class AbstractCasesTest extends TestCase
* This check the setter related all the properties
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setProperties()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setCategoryId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setProcessId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setTaskId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setUserId()
@@ -799,6 +805,7 @@ class AbstractCasesTest extends TestCase
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setOffset()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::setLimit()
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getCategoryId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getProcessId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getTaskId()
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getUserId()
@@ -820,6 +827,7 @@ class AbstractCasesTest extends TestCase
$absCases = new AbstractCases();
$properties = [
// Filters that works for all list
'category' => rand(),
'process' => rand(),
'task' => rand(),
'user' => rand(),
@@ -836,6 +844,8 @@ class AbstractCasesTest extends TestCase
];
$absCases->setProperties($properties);
// Tasks - Cases
$actual = $absCases->getCategoryId();
$this->assertEquals($properties['category'], $actual);
$actual = $absCases->getProcessId();
$this->assertEquals($properties['process'], $actual);
$actual = $absCases->getTaskId();
@@ -887,6 +897,33 @@ class AbstractCasesTest extends TestCase
$this->assertNotEmpty($result);
}
/**
* This check the get task color
*
* @covers \ProcessMaker\BusinessModel\Cases\AbstractCases::getTaskColor()
* @test
*/
public function it_return_task_color_class()
{
$absCases = new Draft();
$dueDate = date('Y-m-d');
// Review on-time
$result = $absCases->getTaskColor($dueDate,'DRAFT' ,'2000-01-01');
$this->assertNotEmpty($result);
$absCases = new Paused();
$dueDate = date('Y-m-d');
// Review on-time
$result = $absCases->getTaskColor($dueDate,'PAUSED' ,'2000-01-01');
$this->assertNotEmpty($result);
$absCases = new Unassigned();
$dueDate = date('Y-m-d');
// Review on-time
$result = $absCases->getTaskColor($dueDate,'UNASSIGNED' ,'2000-01-01');
$this->assertNotEmpty($result);
}
/**
* This check task color according the due date
*
@@ -925,5 +962,31 @@ class AbstractCasesTest extends TestCase
$result = $absCases->threadInformation($thread, true, true);
$this->assertNotEmpty($result);
}
// APP_STATUS = DRAFT
foreach ($taskPending as $thread) {
$thread['APP_STATUS'] = 'DRAFT';
$result = $absCases->threadInformation($thread, true, true);
$this->assertNotEmpty($result);
}
// APP_STATUS = COMPLETED
foreach ($taskPending as $thread) {
$thread['APP_STATUS'] = 'COMPLETED';
$result = $absCases->threadInformation($thread, true, true);
$this->assertNotEmpty($result);
}
// DEL_THREAD_STATUS = PAUSED
foreach ($taskPending as $thread) {
$thread['APP_STATUS'] = 'TO_DO';
$thread['DEL_THREAD_STATUS'] = 'PAUSED';
$result = $absCases->threadInformation($thread, true, true);
$this->assertNotEmpty($result);
}
// TAS_ASSIGN_TYPE = SELF_SERVICE
foreach ($taskPending as $thread) {
$thread['APP_STATUS'] = 'TO_DO';
$thread['TAS_ASSIGN_TYPE'] = 'SELF_SERVICE';
$result = $absCases->threadInformation($thread, true, true);
$this->assertNotEmpty($result);
}
}
}

View File

@@ -789,7 +789,7 @@ class DraftTest extends TestCase
'APP_INIT_USER' => $user->USR_UID,
'APP_CUR_USER' => $user->USR_UID,
]);
factory(Delegation::class)->states('foreign_keys')->create([
$del = factory(Delegation::class)->states('foreign_keys')->create([
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_INDEX' => 1,
'USR_UID' => $application[0]->APP_INIT_USER,
@@ -805,7 +805,7 @@ class DraftTest extends TestCase
$draft = new Draft();
$draft->setUserId($user->USR_ID);
$draft->setUserUid($user->USR_ID);
$res = $draft->getCasesRisk($process->PRO_ID);
$res = $draft->getCasesRisk($process->PRO_ID, $currentDate, $currentDate, 'ON_TIME', 10);
$this->assertCount(1, $res);
}

View File

@@ -291,7 +291,7 @@ class HomeTest extends TestCase
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
]);
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$arguments = [$caseList->CAL_ID, 0, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$home = new Home($application->APP_INIT_USER);
$result = $home->getCustomDraft(...$arguments);
@@ -344,7 +344,7 @@ class HomeTest extends TestCase
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
]);
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$arguments = [$caseList->CAL_ID, 0, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$home = new Home($application->APP_INIT_USER);
$result = $home->getCustomDraft(...$arguments);
@@ -423,7 +423,7 @@ class HomeTest extends TestCase
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
]);
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$arguments = [$caseList->CAL_ID, 0, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$home = new Home($application->APP_INIT_USER);
$result = $home->getCustomDraft(...$arguments);
@@ -522,7 +522,7 @@ class HomeTest extends TestCase
'CAL_COLUMNS' => '[{"field":"case_number","enableFilter":false,"set":true},{"field":"case_title","enableFilter":false,"set":true},{"field":"process_name","enableFilter":false,"set":true},{"field":"task","enableFilter":false,"set":true},{"field":"send_by","enableFilter":false,"set":true},{"field":"due_date","enableFilter":false,"set":true},{"field":"delegation_date","enableFilter":false,"set":true},{"field":"priority","enableFilter":false,"set":true},{"field":"VAR1","enableFilter":false,"set":true},{"field":"VAR2","enableFilter":false,"set":true},{"field":"VAR3","enableFilter":false,"set":false}]',
'ADD_TAB_UID' => $additionalTables->ADD_TAB_UID
]);
$arguments = [$caseList->CAL_ID, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$arguments = [$caseList->CAL_ID, 0, 0, 0, 0, 15, 0, '', '', 'APP_NUMBER,DESC'];
$home = new Home($application1->APP_INIT_USER);
$result = $home->getCustomDraft(...$arguments);

View File

@@ -4403,6 +4403,12 @@ msgstr "The category name with {0}: \"{1}\" already exists."
msgid "The category with {0}: '{1}' does not exist."
msgstr "The category with {0}: '{1}' does not exist."
# TRANSLATION
# LABEL/ID_CATEGORY_PROCESS
#: LABEL/ID_CATEGORY_PROCESS
msgid "Process Category"
msgstr "Process Category"
# TRANSLATION
# LABEL/ID_CATEGORY_SUCCESS_DELETE
#: LABEL/ID_CATEGORY_SUCCESS_DELETE

View File

@@ -393,6 +393,11 @@ class AppProxy extends HttpProxyController
'label' => G::LoadTranslation('ID_PROCESS_NAME') . ': ',
'value' => $processInfo['PRO_TITLE'],
],
$i++ => [ // Process Category
'id' => 'CATEGORY',
'label' => G::LoadTranslation('ID_CATEGORY_PROCESS') . ': ',
'value' => $processInfo['PRO_CATEGORY_LABEL'],
],
$i++ => [ // Process description
'id' => 'PRO_DESCRIPTION',
'label' => G::LoadTranslation('ID_PRO_DESCRIPTION') . ': ',

View File

@@ -57548,6 +57548,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CATEGORY_NAME','en','Category Name','2014-01-15') ,
( 'LABEL','ID_CATEGORY_NAME_ALREADY_EXISTS','en','The category name with {0}: "{1}" already exists.','2014-06-12') ,
( 'LABEL','ID_CATEGORY_NOT_EXIST','en','The category with {0}: ''{1}'' does not exist.','2014-05-29') ,
( 'LABEL','ID_CATEGORY_PROCESS','en','Process Category','2021-11-25') ,
( 'LABEL','ID_CATEGORY_SUCCESS_DELETE','en','Process category has been deleted correctly.','2014-01-15') ,
( 'LABEL','ID_CATEGORY_SUCCESS_NEW','en','Process category has been created correctly.','2014-01-15') ,
( 'LABEL','ID_CATEGORY_SUCCESS_UPDATE','en','Process category has been updated correctly.','2014-01-15') ,

View File

@@ -1343,6 +1343,10 @@ class AbstractCases implements CasesInterface
*/
public function setProperties(array $properties)
{
// Filter by category
if (!empty($properties['category'])) {
$this->setCategoryId($properties['category']);
}
// Filter by process
if (!empty($properties['process'])) {
$this->setProcessId($properties['process']);

View File

@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Draft extends AbstractCases
@@ -16,6 +17,7 @@ class Draft extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'APP_DELEGATION.DEL_TASK_DUE_DATE', // Due Date
@@ -67,6 +69,10 @@ class Draft extends AbstractCases
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -113,6 +119,9 @@ class Draft extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -199,6 +208,11 @@ class Draft extends AbstractCases
$query = Delegation::query()->select();
// Add the initial scope for draft cases
$query->draft($this->getUserId());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -38,7 +38,9 @@ class Home
/**
* Get the draft cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -47,10 +49,12 @@ class Home
* @param string $filterCases
* @param string $sort
* @param callable $callback
*
* @return array
*/
public function getDraft(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -67,6 +71,7 @@ class Home
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -87,7 +92,9 @@ class Home
/**
* Get the inbox cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -99,10 +106,12 @@ class Home
* @param string $sort
* @param string $sendBy
* @param callable $callback
*
* @return array
*/
public function getInbox(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -124,6 +133,7 @@ class Home
$properties['delegateFrom'] = $delegateFrom;
$properties['delegateTo'] = $delegateTo;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -145,7 +155,9 @@ class Home
/**
* Get the unassigned cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -157,10 +169,12 @@ class Home
* @param string $sort
* @param string $sendBy
* @param callable $callback
*
* @return array
*/
public function getUnassigned(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -182,6 +196,7 @@ class Home
$properties['delegateFrom'] = $delegateFrom;
$properties['delegateTo'] = $delegateTo;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -205,7 +220,9 @@ class Home
/**
* Get the paused cases.
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -217,10 +234,12 @@ class Home
* @param string $sort
* @param string $sendBy
* @param callable $callback
*
* @return array
*/
public function getPaused(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -242,6 +261,7 @@ class Home
$properties['delegateFrom'] = $delegateFrom;
$properties['delegateTo'] = $delegateTo;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API
@@ -263,6 +283,7 @@ class Home
/**
* Build the columns and data from the custom list.
*
* @param string $type
* @param int $id
* @param array $arguments
@@ -339,14 +360,16 @@ class Home
}
};
}
$arguments[1] = $proId;
$arguments[2] = $proId;
}
}
/**
* Get the custom draft cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -355,11 +378,13 @@ class Home
* @param string $filterCases
* @param string $sort
* @param array $customFilters
*
* @return array
*/
public function getCustomDraft(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -372,6 +397,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -382,7 +408,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'filterCases', 'sort'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'filterCases', 'sort'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}
@@ -398,8 +424,10 @@ class Home
/**
* Get the custom inbox cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -411,11 +439,13 @@ class Home
* @param string $sort
* @param string $sendBy
* @param array $customFilters
*
* @return array
*/
public function getCustomInbox(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -431,6 +461,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -444,7 +475,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}
@@ -460,8 +491,10 @@ class Home
/**
* Get the custom unassigned cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -473,11 +506,13 @@ class Home
* @param string $sort
* @param string $sendBy
* @param array $customFilters
*
* @return array
*/
public function getCustomUnassigned(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -493,6 +528,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -506,7 +542,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}
@@ -522,8 +558,10 @@ class Home
/**
* Get the custom paused cases.
*
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -535,11 +573,13 @@ class Home
* @param string $sort
* @param string $sendBy
* @param array $customFilters
*
* @return array
*/
public function getCustomPaused(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -555,6 +595,7 @@ class Home
{
$arguments = [
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -568,7 +609,7 @@ class Home
];
//clear duplicate indexes
$keys = ['caseNumber', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
$keys = ['caseNumber', 'category', 'process', 'task', 'limit', 'offset', 'caseTitle', 'delegateFrom', 'delegateTo', 'filterCases', 'sort', 'sendBy'];
foreach ($keys as $value) {
unset($customFilters[$value]);
}

View File

@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Inbox extends AbstractCases
@@ -16,6 +17,7 @@ class Inbox extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'USERS.USR_USERNAME', // Current UserName
@@ -70,6 +72,10 @@ class Inbox extends AbstractCases
if (!empty($this->getCaseTitle())) {
$query->title($this->getCaseTitle());
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -131,6 +137,9 @@ class Inbox extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -216,6 +225,11 @@ class Inbox extends AbstractCases
$query = Delegation::query()->select();
// Scope that sets the queries for List Inbox
$query->inbox($this->getUserId());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -2,10 +2,12 @@
namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Participated extends AbstractCases
@@ -15,6 +17,7 @@ class Participated extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process Name
'TASK.TAS_TITLE', // Pending Task
'TASK.TAS_ASSIGN_TYPE', // Task assign rule
@@ -72,6 +75,10 @@ class Participated extends AbstractCases
// Add the filter
$query->specificCases($result);
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Scope to search for an specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -168,6 +175,9 @@ class Participated extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) use ($filter) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Apply the date format defined in environment
$item['APP_CREATE_DATE_LABEL'] = !empty($item['APP_CREATE_DATE']) ? applyMaskDateEnvironment($item['APP_CREATE_DATE']): null;
$item['APP_FINISH_DATE_LABEL'] = !empty($item['APP_FINISH_DATE']) ? applyMaskDateEnvironment($item['APP_FINISH_DATE']): null;
@@ -367,6 +377,11 @@ class Participated extends AbstractCases
$query->lastThread();
break;
}
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -6,6 +6,7 @@ use G;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Paused extends AbstractCases
@@ -15,6 +16,7 @@ class Paused extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'USERS.USR_USERNAME', // Current UserName
@@ -125,6 +127,9 @@ class Paused extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -210,6 +215,11 @@ class Paused extends AbstractCases
$query = Delegation::query()->select();
// Scope that set the paused cases
$query->paused($this->getUserId());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -7,8 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use ProcessMaker\Model\ProcessCategory;
class Search extends AbstractCases
{
@@ -17,6 +16,7 @@ class Search extends AbstractCases
// Columns view in the cases list
'APPLICATION.APP_NUMBER', // Case #
'APPLICATION.APP_TITLE AS DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'APPLICATION.APP_STATUS', // Status
'APPLICATION.APP_CREATE_DATE', // Case create date
@@ -156,6 +156,9 @@ class Search extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Apply the date format defined in environment
$item['APP_CREATE_DATE_LABEL'] = !empty($item['APP_CREATE_DATE']) ? applyMaskDateEnvironment($item['APP_CREATE_DATE']): null;
$item['APP_FINISH_DATE_LABEL'] = !empty($item['APP_FINISH_DATE']) ? applyMaskDateEnvironment($item['APP_FINISH_DATE']): null;

View File

@@ -2,9 +2,11 @@
namespace ProcessMaker\BusinessModel\Cases;
use G;
use ProcessMaker\Model\AppNotes;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\ProcessUser;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Supervising extends AbstractCases
@@ -14,6 +16,7 @@ class Supervising extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process Name
'TASK.TAS_TITLE', // Pending Task
'APPLICATION.APP_STATUS', // Status
@@ -70,6 +73,10 @@ class Supervising extends AbstractCases
// Add the filter
$query->specificCases($result);
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Scope to search for an specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -144,6 +151,9 @@ class Supervising extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get task color label
$item['TAS_COLOR'] = $this->getTaskColor($item['DEL_TASK_DUE_DATE']);
$item['TAS_COLOR_LABEL'] = self::TASK_COLORS[$item['TAS_COLOR']];
@@ -243,6 +253,11 @@ class Supervising extends AbstractCases
$processes = ProcessUser::getProcessesOfSupervisor($this->getUserUid());
// Scope the specific array of processes supervising
$query->processInList($processes);
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -7,6 +7,7 @@ use ProcessMaker\Model\Application;
use ProcessMaker\Model\CaseList;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\User;
class Unassigned extends AbstractCases
@@ -16,6 +17,7 @@ class Unassigned extends AbstractCases
// Columns view in the cases list
'APP_DELEGATION.APP_NUMBER', // Case #
'APP_DELEGATION.DEL_TITLE', // Case Title
'PROCESS.CATEGORY_ID', // Category
'PROCESS.PRO_TITLE', // Process
'TASK.TAS_TITLE', // Task
'USERS.USR_USERNAME', // Current UserName
@@ -70,6 +72,10 @@ class Unassigned extends AbstractCases
if ($this->getCaseTitle()) {
$query->title($this->getCaseTitle());
}
// Specific category
if ($this->getCategoryId()) {
$query->categoryId($this->getCategoryId());
}
// Specific process
if ($this->getProcessId()) {
$query->processId($this->getProcessId());
@@ -134,6 +140,9 @@ class Unassigned extends AbstractCases
$results = $query->get();
// Prepare the result
$results->transform(function ($item, $key) {
// Get the category
$category = !empty($item['CATEGORY_ID']) ? ProcessCategory::getCategory($item['CATEGORY_ID']) : '';
$item['CATEGORY'] = !empty($category) ? $category : G::LoadTranslation('ID_PROCESS_NONE_CATEGORY');
// Get priority label
$priorityLabel = self::PRIORITIES[$item['DEL_PRIORITY']];
$item['DEL_PRIORITY_LABEL'] = G::LoadTranslation("ID_PRIORITY_{$priorityLabel}");
@@ -219,6 +228,11 @@ class Unassigned extends AbstractCases
$query = Delegation::query()->select();
// Add the initial scope for self-service cases
$query->selfService($this->getUserUid());
// Check if the category was defined
if ($this->getCategoryId()) {
// Join with process if the filter with category exist
$query->joinProcess();
}
// Apply filters
$this->filters($query);
// Return the number of rows

View File

@@ -390,6 +390,15 @@ class CaseList extends Model
'typeSearch' => 'search text',
'enableFilter' => false,
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'process_category',
'name' => G::LoadTranslation('ID_PROCESS_CATEGORY'),
'type' => 'string',
'source' => 'APPLICATION',
'typeSearch' => 'search text',
'enableFilter' => false,
'set' => true
], [
'list' => ['inbox', 'draft', 'paused', 'unassigned'],
'field' => 'task',

View File

@@ -17,6 +17,18 @@ class ProcessCategory extends Model
public $timestamps = false;
/**
* Scope a query to specific category id
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param int $category
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeCategory($query, $category)
{
return $query->where('CATEGORY_ID', $category);
}
/**
* Scope a query to specific category name
*
@@ -92,4 +104,22 @@ class ProcessCategory extends Model
return $query->first()->CATEGORY_ID;
}
}
/**
* Get category name
*
* @param int $category
*
* @return string
*/
public static function getCategory(int $category)
{
$query = ProcessCategory::query()->select(['CATEGORY_NAME']);
$query->category($category);
if ($query->first()) {
return $query->first()->CATEGORY_NAME;
} else {
return '';
}
}
}

View File

@@ -51,6 +51,7 @@ class Home extends Api
* @url GET /draft
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -68,6 +69,7 @@ class Home extends Api
*/
public function doGetDraftCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -81,6 +83,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getDraft(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -101,6 +104,7 @@ class Home extends Api
* @url GET /todo [This is kept for compatibility should not be used 'todo', the reason is to only handle the same verb (inbox) for all 'normal case list' and 'custom case list']
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -121,6 +125,7 @@ class Home extends Api
*/
public function doGetTodoCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -137,6 +142,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getInbox(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -159,6 +165,7 @@ class Home extends Api
* @url GET /unassigned
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -179,6 +186,7 @@ class Home extends Api
*/
public function doGetUnassignedCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -195,6 +203,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getUnassigned(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -217,6 +226,7 @@ class Home extends Api
* @url GET /paused
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -237,6 +247,7 @@ class Home extends Api
*/
public function doGetPausedCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -253,6 +264,7 @@ class Home extends Api
$bmHome = new BMHome($this->getUserId());
return $bmHome->getPaused(
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -274,6 +286,7 @@ class Home extends Api
* @url POST /draft/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -290,6 +303,7 @@ class Home extends Api
public function doGetCustomDraftCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -305,6 +319,7 @@ class Home extends Api
return $bmHome->getCustomDraft(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -324,6 +339,7 @@ class Home extends Api
* @url POST /inbox/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -343,6 +359,7 @@ class Home extends Api
public function doGetCustomInboxCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -361,6 +378,7 @@ class Home extends Api
return $bmHome->getCustomInbox(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -383,6 +401,7 @@ class Home extends Api
* @url POST /unassigned/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -402,6 +421,7 @@ class Home extends Api
public function doGetCustomUnassignedCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -420,6 +440,7 @@ class Home extends Api
return $bmHome->getCustomUnassigned(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -442,6 +463,7 @@ class Home extends Api
* @url POST /paused/:id
* @param int $id
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -461,6 +483,7 @@ class Home extends Api
public function doGetCustomPausedCases(
int $id,
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -479,6 +502,7 @@ class Home extends Api
return $bmHome->getCustomPaused(
$id,
$caseNumber,
$category,
$process,
$task,
$limit,
@@ -502,6 +526,7 @@ class Home extends Api
* @url GET /mycases
*
* @param int $caseNumber
* @param int $category
* @param int $process
* @param int $task
* @param int $limit
@@ -525,6 +550,7 @@ class Home extends Api
*/
public function doGetMyCases(
int $caseNumber = 0,
int $category = 0,
int $process = 0,
int $task = 0,
int $limit = 15,
@@ -544,6 +570,7 @@ class Home extends Api
$properties['caseNumber'] = $caseNumber;
$properties['caseTitle'] = $caseTitle;
$properties['filterCases'] = $filterCases;
$properties['category'] = $category;
$properties['process'] = $process;
$properties['task'] = $task;
// Get the user that access to the API