PMCORE-2512

This commit is contained in:
Henry Jordan
2020-12-04 13:33:23 +00:00
parent e54bf886f1
commit c2f0d239aa
12 changed files with 251 additions and 188 deletions

View File

@@ -0,0 +1,113 @@
import _ from "lodash";
import axios from "axios";
const urlBase = "{server}/api/1.0/{workspace}{service}";
const services = {
AUTHENTICATE_USER: "/oauth2/token",
USER_DATA: "/light/user/data",
GET_MAIN_MENU_COUNTERS: "/light/counters",
GET_CASE_NOTES_LIST: "/light/case/{app_uid}/notes",
GET_PROCESS_MAP: "/light/project/{prj_uid}/case/{app_uid}",
GET_LISTS_TODO: "/light/todo",
GET_LIST_UNASSIGNED: "/light/unassigned{suffix}",
GET_LISTS_PARTICIPATED: "/light/participated{suffix}",
GET_LISTS_DRAFT: "/light/draft{suffix}",
GET_LISTS_PAUSED: "/light/paused",
GET_LISTS_COMPLETED: "/light/completed",
GET_USERS_PICTURES: "/light/users/data",
FORMS_ARRAY: "/light/project/{pro_uid}/activity/{act_uid}/steps",
GET_NEW_CASES: "/light/start-case",
GET_HISTORY_CASES: "/light/history/{app_uid}",
LOGOUT_USER: "/light/logout",
UPLOAD_LOCATION: "/light/case/{app_uid}/upload/location",
GET_FORM_ID_TO_UPLOAD: "/light/case/{app_uid}/upload",
UPLOAD_FILE: "/light/case/{app_uid}/upload/{app_doc_uid}",
GET_CASE_INFO: "/light/{type}/case/{app_uid}",
REQUEST_PAUSE_CASE: "/light/cases/{app_uid}/pause",
REQUEST_UNPAUSE_CASE: "/light/cases/{app_uid}/unpause",
REQUEST_CANCEL_CASE: "/light/cases/{app_uid}/cancel",
REQUEST_SYS_CONFIG: "/light/config",
REQUEST_SYS_CONFIG_V2: "/light/config?fileLimit=true",
ROUTE_CASE: "/light/cases/{app_uid}/route-case",
CLAIM_CASE: "/light/case/{app_uid}/claim",
GET_FILE_VERSIONS: "/cases/{app_uid}/input-document/{app_doc_uid}/versions",
REGISTER: "https:trial32.processmaker.com/syscolosa/en/neoclassic_pro/9893000714bdb2d52ecc317052629917/Trial_RequestPostMobile.php",
ADD_NOTE: "/light/case/{app_uid}/note",
LAST_OPEN_INDEX: "/light/lastopenindex/case/{app_uid}",
REGISTER_WITH_GOOGLE_FAKE_URL: "fakeurl",
SIGN_IN_TO_PM_WITH_GOOGLE: "/authentication/gmail",
GET_CASE_VARIABLES: "/light/{app_uid}/variables?pro_uid={pro_uid}&act_uid={act_uid}&app_index={del_index}",
REGISTER_DEVICE_TOKEN_FOR_NOTIFICATIONS: "/light/notification",
UNREGISTER_DEVICE_TOKEN_FOR_NOTIFICATIONS: "/light/notification/{dev_uid}",
GET_ASSIGMENT_USERS: "/light/task/{act_uid}/case/{app_uid}/{del_index}/assignment",
GET_CASE_INPUT_FILES: "/cases/{app_uid}/input-documents",
GET_CASE_OUTPUT_FILES: "/cases/{app_uid}/output-documents",
DOWNLOAD_IMAGE_BASE64: "/light/case/{app_uid}/download64",
DOWNLOAD_INPUT_FILE: "/cases/{app_uid}/input-document/{app_doc_uid}/file?v=1",
DOWNLOAD_OUTPUT_FILE: "/cases/{app_uid}/output-document/{app_doc_uid}/file?v=1",
VERIFY_CASE_NOT_ROUTED: "/light/case/{app_uid}/{del_index}",
GET_FORM_DEFINITION: "/light/project/{prj_uid}/dynaform/{dyn_uid}",
GET_FORM_DEFINITION_PREPROCESSED: "/light/project/{prj_uid}/dynaformprocessed/{dyn_uid}?app_uid={app_uid}&del_index={del_index}",
START_CASE: "/light/process/{pro_uid}/task/{task_uid}/start-case",
GET_FORM_DEFINITIONS: "/cases/{app_uid}/input-document/{app_doc_uid}/file?v={version}",
SAVE_FORM_DATA: "/light/{app_uid}/variable?dyn_uid={dyn_uid}&del_index={del_index}",
EXECUTE_TRIGGERS_AFTER: "/light/process/{pro_uid}/task/{act_uid}/case/{app_uid}/step/{step_uid}/execute-trigger/after",
EXECUTE_QUERY: "/project/{prj_uid}/process-variable/{var_name}/execute-query",
EXECUTE_QUERY_SUGGEST: "/project/{prj_uid}/process-variable/{var_name}/execute-query-suggest",
CHECK: "/light/{listType}/check",
GET_NEXT_STEP: "/light/get-next-step/{app_uid}",
REQUEST_SQLITE_DATABASE_TABLES: "/pmtable?offline=1",
REQUEST_SQLITE_DATABASE_TABLES_DATA: "/pmtable/offline/data?compress=false"
};
export default {
getUrl(keys, service) {
let k;
let url = urlBase.replace(/{service}/, services[service]);
let index;
let reg;
// eslint-disable-next-line no-restricted-syntax
for (k in keys) {
if (Object.prototype.hasOwnProperty.call(keys, k)) {
url = url.replace(new RegExp(`{${k}}`, "g"), keys[k]);
}
}
index = url.indexOf("?");
if (index !== -1) {
reg = new RegExp("{\\w+}", "g");
if (reg.exec(url)) {
url = url.substring(0, index);
}
}
return url;
},
/**
* options.method = "post|get"
* options.service = "ENDPOINT ALIAS"
* options.keys = "keys for URL"
* @param {*} options
*/
fetch(options) {
let service = options.service || "",
data = options.data || {},
keys = options.keys || {},
url,
credentials = window.config.SYS_CREDENTIALS,
workspace = window.config.SYS_WORKSPACE,
server = window.config.SYS_SERVER,
method = options.method || "get";
url = this.getUrl(_.extend(keys, credentials, { server }, { workspace }), service);
return axios({
method: method,
url: url,
data: data,
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": `Bearer ` + credentials.accessToken
}
});
}
};

View File

@@ -1,3 +1,4 @@
import axios from "axios";
import headerData from "./../mocks/casesHeader.json"; import headerData from "./../mocks/casesHeader.json";
import startedData from "./../mocks/startedCasesFaker.js"; import startedData from "./../mocks/startedCasesFaker.js";
import inprogressData from "./../mocks/inprogressCases.json"; import inprogressData from "./../mocks/inprogressCases.json";
@@ -38,6 +39,15 @@ export let cases = {
}, },
delete(id) { delete(id) {
return Client.delete(`${resource}/${id}`) return Client.delete(`${resource}/${id}`)
},
start(dt) {
var params = new URLSearchParams();
params.append('action', 'startCase');
params.append('processId', dt.pro_uid);
params.append('taskId', dt.task_uid);
return axios.post(window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/casesStartPage_Ajax.php`, params);
} }
}; };

View File

@@ -0,0 +1,14 @@
import Api from "./Api.js";
export let process = {
list: {
start(dt) {
return Api.fetch({
service: "GET_NEW_CASES",
method: "get",
data: {},
keys: {}
});
}
}
};

View File

@@ -1,9 +1,12 @@
import { menu } from "./Menu"; import { menu } from "./Menu";
import { cases, casesHeader } from "./Cases"; import { cases, casesHeader } from "./Cases";
import { process } from "./Process";
export default { export default {
menu, menu,
cases, cases,
casesHeader casesHeader,
process
}; };

View File

@@ -24,6 +24,7 @@ import CustomSidebar from "./../components/menu/CustomSidebar";
import MyCases from "./MyCases"; import MyCases from "./MyCases";
import MyDocuments from "./MyDocuments"; import MyDocuments from "./MyDocuments";
import BatchRouting from "./BatchRouting"; import BatchRouting from "./BatchRouting";
import XCase from "./XCase";
import TaskReassignments from "./TaskReassignments"; import TaskReassignments from "./TaskReassignments";
export default { export default {
@@ -34,11 +35,13 @@ export default {
MyDocuments, MyDocuments,
BatchRouting, BatchRouting,
TaskReassignments, TaskReassignments,
XCase,
}, },
data() { data() {
return { return {
page: "MyCases", page: "MyCases",
menu: [], menu: [],
dataCase: {},
hideToggle: true, hideToggle: true,
collapsed: false, collapsed: false,
selectedTheme: "", selectedTheme: "",
@@ -54,6 +57,15 @@ export default {
OnClickSidebarItem(item) { OnClickSidebarItem(item) {
this.page = item.item.id || "MyCases"; this.page = item.item.id || "MyCases";
}, },
/**
* Update page component
*/
updatePage(data) {
if (data.component == "ModalNewRequest") {
this.data = data.page;
this.dataCase = data.dataCase;
}
},
onResize() { onResize() {
if (window.innerWidth <= 767) { if (window.innerWidth <= 767) {
this.isOnMobile = true; this.isOnMobile = true;

View File

@@ -3,7 +3,7 @@
<b-modal <b-modal
ref="my-modal" ref="my-modal"
hide-footer hide-footer
title="Weve made it easy for you to make the following request" :title="$t('ID_WEVE_MADE_IT_EASY_FOR_YOU')"
size="xl" size="xl"
> >
<div class="input-group mb-3"> <div class="input-group mb-3">
@@ -16,13 +16,13 @@
v-model="filter" v-model="filter"
type="text" type="text"
class="form-control" class="form-control"
placeholder="Search" :placeholder="$t('ID_CASES_MENU_SEARCH')"
aria-label="Search" aria-label="Search"
aria-describedby="basic-addon1" aria-describedby="basic-addon1"
@input="onChangeFilter" @input="onChangeFilter"
/> />
</div> </div>
<div v-for="item in categories" :key="item.title"> <div v-for="item in categoriesFiltered" :key="item.title">
<process-category :data="item" /> <process-category :data="item" />
</div> </div>
</b-modal> </b-modal>
@@ -41,181 +41,13 @@ export default {
props: { props: {
data: Object, data: Object,
}, },
mounted() { mounted() {},
//this.categoriesFiltered = this.categories;
},
data() { data() {
return { return {
filter: "", filter: "",
categories: [], categories: [],
//Data for test categoriesFiltered: [],
dataCaseSummary: { TRANSLATIONS: window.config.TRANSLATIONS,
title: "Case Summary",
titleActions: "Actions",
btnLabel: "Success",
onClick: () => {
console.log("acitons");
},
label: {
numberCase: "Case #",
process: "Process",
status: "Status",
caseTitle: "Case title",
created: "Created",
delegationDate: "Delegation Date",
duration: "Duration",
},
text: {
numberCase: "123",
process: "Leave Absence Request",
status: "In progress",
caseTitle: "CVacation request for Enrique",
created: "# days Ago",
delegationDate: "10 mins ago",
duration: "34hrs",
},
},
dataAttachedDocuments: {
title: "Attached Documents",
items: [
{
title: "Invoice January 2018.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "Invoice Febrauery 2018.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "GPRD Employee GR90.doc",
extension: "doc",
onClick: () => {
console.log("Attached document");
},
},
{
title: "Contract one tres.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "GPRD Employee 2020.doc",
extension: "doc",
onClick: () => {
console.log("Attached document");
},
},
],
},
dataIoDocuments: {
titleInput: "Input Document",
inputDocuments: [
{
title: "Invoice January 2018.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "Invoice Febrauery 2018.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "GPRD Employee GR90.doc",
extension: "doc",
onClick: () => {
console.log("Attached document");
},
},
{
title: "Contract one tres.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "GPRD Employee 2020.doc",
extension: "doc",
onClick: () => {
console.log("Attached document");
},
},
],
titleOutput: "Output Document",
outputDocuments: [
{
title: "Invoice January 2018.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "Invoice Febrauery 2018.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "GPRD Employee GR90.doc",
extension: "doc",
onClick: () => {
console.log("Attached document");
},
},
{
title: "Contract one tres.pdf",
extension: "pdf",
onClick: () => {
console.log("Attached document");
},
},
{
title: "GPRD Employee 2020.doc",
extension: "doc",
onClick: () => {
console.log("Attached document");
},
},
],
},
dataComments: {
title: "Comments",
items: [
{
user: "Gustavo Cruz",
date: "Today 2:38",
comment:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod http://wwwwww.com tempoua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.",
},
{
user: "Gustavo Cruz",
date: "Today 2:39",
comment:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod http://wwwwww.com tempoua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.",
},
{
user: "Gustavo Cruz",
date: "Today 2:40",
comment:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod http://wwwwww.com tempoua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.",
},
],
},
}; };
}, },
methods: { methods: {
@@ -228,10 +60,11 @@ export default {
}, },
getProcess() { getProcess() {
let that = this; let that = this;
api.process api.process.list
.get() .start()
.then((response) => { .then((response) => {
that.categories = that.formatResponseGetProcess(response); that.categories = that.formatCategories(response.data);
that.categoriesFiltered = that.categories;
}) })
.catch((e) => { .catch((e) => {
console.error(e); console.error(e);
@@ -290,17 +123,41 @@ export default {
}); });
return res; return res;
}, },
formatCategories(data) {
let res = [],
that = this,
index,
categories = [];
_.each(data, (o) => {
index = _.findIndex(categories, (c) => {
return c.id == o.categoryId;
});
if (index == -1) {
categories.push({
id: o.categoryId,
title: o.categoryName,
items: [],
});
index = categories.length - 1;
}
categories[index].items.push({
title: o.text,
description: o.text,
task_uid: o.taskId,
pro_uid: o.processId,
onClick: that.startNewCase,
});
});
return categories;
},
startNewCase(dt) { startNewCase(dt) {
let self = this; let self = this;
api.cases api.cases
.start(dt) .start(dt)
.then(function (data) { .then(function (data) {
console.log("newCase yeah!!!!!!!!!!"); self.$refs["my-modal"].hide();
if (self.isIE) { self.$parent.$parent.dataCase = data.data;
window.open(data.data.url); self.$parent.$parent.page = "XCase";
} else {
window.location.href = `http://localhost/sysworkflow/en/neoclassic/viena/index.php/cases/xcase/project/${dt.pro_uid}/activity/${dt.task_uid}/case/${data.data.caseId}/index/${data.data.caseIndex}`;
}
}) })
.catch((err) => { .catch((err) => {
throw new Error(err); throw new Error(err);

View File

@@ -0,0 +1,47 @@
<template>
<div>
<iframe
:width="width"
ref="xIFrame"
frameborder="0"
:src="path"
:height="height"
allowfullscreen
></iframe>
</div>
</template>
<script>
export default {
name: "XCase",
components: {},
props: {
data: Object,
},
mounted() {
this.height = window.innerHeight - this.diffHeight;
this.dataCase = this.$parent.dataCase;
this.path =
window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/open?APP_UID=${this.dataCase.APPLICATION}&DEL_INDEX=1&action=draft`;
},
data() {
return {
height: "100%",
width: "100%",
diffHeight: 10,
dataCase: null,
path: "",
};
},
methods: {
classBtn(cls) {
return "btn v-btn-request " + cls;
},
},
};
</script>
<style>
</style>

View File

@@ -50,7 +50,7 @@ const router = new VueRouter({
new Vue({ new Vue({
i18n, i18n,
// eslint-disable-line no-new // eslint-disable-line no-new
el: "#home", el: "#app",
router, router,
render: (h) => h(Home), render: (h) => h(Home),
}); });

View File

@@ -11,7 +11,7 @@
<body> <body>
{{ ScriptVariables::render() }} {{ ScriptVariables::render() }}
<div id="home"> <div id="app">
</div> </div>
</body> </body>
<script type="text/javascript" src="/webapp/js/home/main.js"></script> <script type="text/javascript" src="/webapp/js/home/main.js"></script>

File diff suppressed because one or more lines are too long

View File

@@ -52051,4 +52051,10 @@ msgstr "Repeat on"
# LABEL/ID_CUSTOM_SETTINGS # LABEL/ID_CUSTOM_SETTINGS
#: LABEL/ID_CUSTOM_SETTINGS #: LABEL/ID_CUSTOM_SETTINGS
msgid "Custom settings" msgid "Custom settings"
msgstr "Custom settings" msgstr "Custom settings"
# TRANSLATION
# LABEL/ID_WEVE_MADE_IT_EASY_FOR_YOU
#: LABEL/ID_WEVE_MADE_IT_EASY_FOR_YOU
msgid "We've made it easy for you to make the following requests"
msgstr "We've made it easy for you to make the following requests"

View File

@@ -61570,6 +61570,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_WELL_DONE','en','Well Done!','2015-03-30') , ( 'LABEL','ID_WELL_DONE','en','Well Done!','2015-03-30') ,
( 'LABEL','ID_WEN','en','Wen','2014-01-15') , ( 'LABEL','ID_WEN','en','Wen','2014-01-15') ,
( 'LABEL','ID_WESTPANEL','en','westPanel','2014-01-15') , ( 'LABEL','ID_WESTPANEL','en','westPanel','2014-01-15') ,
( 'LABEL','ID_WEVE_MADE_IT_EASY_FOR_YOU','en',"We've made it easy for you to make the following requests",'2020-12-04') ,
( 'LABEL','ID_WF_DATABASE_NAME','en','Workflow Database Name','2014-01-15') , ( 'LABEL','ID_WF_DATABASE_NAME','en','Workflow Database Name','2014-01-15') ,
( 'LABEL','ID_WITHOUT_RESUME','en','Without resume!','2014-01-15') , ( 'LABEL','ID_WITHOUT_RESUME','en','Without resume!','2014-01-15') ,
( 'LABEL','ID_WIZARD_LIBRARY_AND_FUNCTION_IS_INVALID_FOR_TRIGGER','en','The wizard with the library "{0}" and function "{1}", is invalid for the trigger with {2}: {3}.','2014-05-20') , ( 'LABEL','ID_WIZARD_LIBRARY_AND_FUNCTION_IS_INVALID_FOR_TRIGGER','en','The wizard with the library "{0}" and function "{1}", is invalid for the trigger with {2}: {3}.','2014-05-20') ,