PMCORE-2554

This commit is contained in:
Henry Jordan
2020-12-15 23:56:44 +00:00
parent eeb3427927
commit 464062c815
8 changed files with 328 additions and 31 deletions

View File

@@ -6,8 +6,16 @@ export let caseNotes = {
params.append('appUid', data.APP_UID); params.append('appUid', data.APP_UID);
params.append('noteText', data.COMMENT); params.append('noteText', data.COMMENT);
params.append('swSendMail', data.SEND_MAIL ? 1 : 0); params.append('swSendMail', data.SEND_MAIL ? 1 : 0);
_.each(data.FILES, (f) => {
params.append("filesToUpload[]", f);
})
return axios.post(window.config.SYS_SERVER + return axios.post(window.config.SYS_SERVER +
window.config.SYS_URI + window.config.SYS_URI +
`appProxy/postNote`, params); `appProxy/postNote`, params, {
} headers: {
"Content-Type": "multipart/form-data",
},
});
},
}; };

View File

@@ -51,7 +51,7 @@ export default {
return "btn v-btn-request " + cls; return "btn v-btn-request " + cls;
}, },
classIcon(icon) { classIcon(icon) {
return this.icon[icon]; return this.icon[icon] ? this.icon[icon] : "fas fa-file-alt";
}, },
href(item) { href(item) {
return ( return (

View File

@@ -0,0 +1,122 @@
<template>
<div class="card v-case-summary-card" style="width: 20rem">
<div class="card-body">
<h6 class="card-subtitle mb-2 text-muted">{{ data.title }}</h6>
<div class="card-text">
<div
v-for="item in data.items"
:key="item.title"
class="v-attached-block"
>
<span>
<div class="v-list v-list-row block">
<div
class="float-right text-md text-danger btn-default"
@click="removeDocument(item)"
>
<i class="fas fa-times-circle"></i>
</div>
<div class="v-list-item">
<div class="v-attached-icon">
<i :class="classIcon(item.extension)"></i>
</div>
<div class="flex">
<a
@click="item.onClick(item)"
class="v-item-except text-sm h-1x"
>
{{ item.title }}
</a>
</div>
</div>
</div></span
>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "AttachedDocumentsEdit",
props: {
data: Object,
onRemove: Function,
},
data() {
return {
icon: {
pdf: "fas fa-file-pdf",
doc: "fas fa-file-word",
png: "fas fa-image",
},
};
},
computed: {},
methods: {
classBtn(cls) {
return "btn v-btn-request " + cls;
},
classIcon(icon) {
return this.icon[icon] ? this.icon[icon] : "fas fa-file-alt";
},
/**
* Remove file from view and update the view
*/
removeDocument(item) {
let dt = this.data.items;
_.remove(dt, function (n) {
return item.title == n.title;
});
this.data.items = dt;
this.$forceUpdate();
this.onRemove(item);
},
},
};
</script>
<style>
.v-list-item {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
}
.v-list-row .v-list-item {
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-align: center;
align-items: center;
}
.block {
background: #fff;
border-width: 0;
border-radius: 0.25rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.v-list {
padding-left: 0;
padding-right: 0;
}
.v-item-except {
padding-left: 10px;
color: #6c757d !important;
}
.v-attached-icon {
font-size: 25px;
}
.text-md {
font-size: 20px;
}
</style>

View File

@@ -11,6 +11,12 @@
<div class="comment-content col-md-11 col-sm-10 v-comment"> <div class="comment-content col-md-11 col-sm-10 v-comment">
<div class="comment-meta"> <div class="comment-meta">
<a href="#">{{ data.user }}</a> {{ data.date }} <a href="#">{{ data.user }}</a> {{ data.date }}
<div
class="btn-default float-right"
v-if="this.data.data.attachments.length > 0"
>
<i class="fas fa-paperclip"></i>
</div>
</div> </div>
<div class="comment-body"> <div class="comment-body">
<p>{{ data.comment }}</p> <p>{{ data.comment }}</p>

View File

@@ -14,7 +14,16 @@
/> />
</div> </div>
</div> </div>
<div class="comments col-md-12"> <div class="v-comments col-md-12" @dragover="onDragOver">
<div
class="mask flex-center rgba-green-strong"
v-show="showMaskDrop"
@dragover="onDragOver"
@dragleave="onDragLeave"
@drop="onDropFile"
>
<p class="white-text">{{ $t("ID_UPLOAD_FILE") }}</p>
</div>
<div class="comment mb-2 row"> <div class="comment mb-2 row">
<div class="comment-avatar col-md-1 col-sm-2 text-center pr-1"> <div class="comment-avatar col-md-1 col-sm-2 text-center pr-1">
<a href="" <a href=""
@@ -66,12 +75,15 @@ export default {
data: Object, data: Object,
onClick: Function, onClick: Function,
postComment: Function, postComment: Function,
dropFiles: Function,
}, },
components: { components: {
CaseComment, CaseComment,
}, },
data() { data() {
return { return {
showMaskDrop: false,
files: [],
itemSelected: null, itemSelected: null,
}; };
}, },
@@ -92,16 +104,59 @@ export default {
return this.icon[icon]; return this.icon[icon];
}, },
onClickComment() { onClickComment() {
this.postComment(this.$refs["comment"].value, this.$refs["send"].checked); let fls = this.files;
this.postComment(
this.$refs["comment"].value,
this.$refs["send"].checked,
fls
);
this.resetComment(); this.resetComment();
}, },
resetComment() { resetComment() {
this.$refs["comment"].value = ""; this.$refs["comment"].value = "";
this.$refs["send"].checked = false; this.$refs["send"].checked = false;
this.files = [];
}, },
onSelected(item) { onSelected(item) {
this.itemSelected = item; this.itemSelected = item;
}, },
onDropFile(e) {
e.preventDefault();
e.stopPropagation();
let that = this,
fls = [];
_.each(e.dataTransfer.files, (f) => {
that.files.push(f);
});
_.each(that.files, (f) => {
fls.push({
data: f,
title: f.name,
extension: f.name.split(".").pop(),
onClick: () => {},
});
});
this.dropFiles(fls);
this.showMaskDrop = false;
},
onDragOver(e) {
e.preventDefault();
if (!this.showMaskDrop) {
this.showMaskDrop = true;
}
},
onDragLeave(e) {
if (this.showMaskDrop) {
this.showMaskDrop = false;
}
},
removeFile(file) {
_.remove(this.files, function (n) {
return file.title == n.name;
});
},
}, },
}; };
</script> </script>
@@ -111,8 +166,47 @@ export default {
padding-right: 20px; padding-right: 20px;
} }
.v-comments {
display: inline-block;
}
.mask {
z-index: 100;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-attachment: fixed;
outline: 5px dashed #2ba070;
outline-offset: -20px;
}
.flex-center {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
height: 100%;
}
.rgba-green-strong,
.rgba-green-strong:after {
background-color: rgba(76, 175, 80, 0.7);
}
.v-img-fluid { .v-img-fluid {
max-width: 30px; max-width: 30px;
height: auto; height: auto;
} }
.white-text {
font-size: 32px;
color: antiquewhite;
}
</style> </style>

View File

@@ -14,9 +14,13 @@
<i :class="classIcon(item.extension)"></i> <i :class="classIcon(item.extension)"></i>
</div> </div>
<div class="flex"> <div class="flex">
<div @click="item.onClick" class="v-item-except text-sm h-1x"> <a
@click="item.onClick"
:href="href(item)"
class="v-item-except text-sm h-1x"
>
{{ item.title }} {{ item.title }}
</div> </a>
</div> </div>
</div> </div>
</div> </div>
@@ -36,9 +40,13 @@
<i :class="classIcon(item.extension)"></i> <i :class="classIcon(item.extension)"></i>
</div> </div>
<div class="flex"> <div class="flex">
<div @click="item.onClick" class="v-item-except text-sm h-1x"> <a
@click="item.onClick"
:href="hrefOutput(item)"
class="v-item-except text-sm h-1x"
>
{{ item.title }} {{ item.title }}
</div> </a>
</div> </div>
</div> </div>
</div> </div>
@@ -68,7 +76,23 @@ export default {
return "btn v-btn-request " + cls; return "btn v-btn-request " + cls;
}, },
classIcon(icon) { classIcon(icon) {
return this.icon[icon]; return this.icon[icon] ? this.icon[icon] : "fas fa-file-alt";
},
href(item) {
return (
window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/cases_ShowDocument?a=${item.data.APP_DOC_UID}&v=${item.data.DOC_VERSION}`
);
},
hrefOutput(item) {
let random = _.random(0, 10000000),
cacheTime = Date.now();
return (
window.config.SYS_SERVER +
window.config.SYS_URI +
`cases/cases_ShowOutputDocument?a=${item.data.APP_DOC_UID}&v=${item.data.DOC_VERSION}&ext=doc&random=${random}&nocachetime=${cacheTime}`
);
}, },
}, },
}; };

View File

@@ -67,16 +67,23 @@
<div class="row"> <div class="row">
<div class="col-sm-9"> <div class="col-sm-9">
<case-comments <case-comments
ref="case-comments"
:data="dataComments" :data="dataComments"
:onClick="onClickComment" :onClick="onClickComment"
:postComment="postComment" :postComment="postComment"
:dropFiles="dropFiles"
/> />
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<attached-documents <attached-documents
v-if="dataAttachedDocuments.items.length > 0" v-if="dataAttachedDocuments.items.length > 0 && !attachDocuments"
:data="dataAttachedDocuments" :data="dataAttachedDocuments"
></attached-documents> ></attached-documents>
<attached-documents-edit
v-if="dataAttachedDocuments.items.length > 0 && attachDocuments"
:data="dataAttachedDocuments"
:onRemove="onRemoveAttachedDocument"
></attached-documents-edit>
</div> </div>
</div> </div>
</div> </div>
@@ -86,6 +93,7 @@
import IoDocuments from "../components/home/caseDetail/IoDocuments.vue"; import IoDocuments from "../components/home/caseDetail/IoDocuments.vue";
import CaseSummary from "../components/home/caseDetail/CaseSummary.vue"; import CaseSummary from "../components/home/caseDetail/CaseSummary.vue";
import AttachedDocuments from "../components/home/caseDetail/AttachedDocuments.vue"; import AttachedDocuments from "../components/home/caseDetail/AttachedDocuments.vue";
import AttachedDocumentsEdit from "../components/home/caseDetail/AttachedDocumentsEdit.vue";
import CaseComment from "../components/home/caseDetail/CaseComment"; import CaseComment from "../components/home/caseDetail/CaseComment";
import CaseComments from "../components/home/caseDetail/CaseComments"; import CaseComments from "../components/home/caseDetail/CaseComments";
import TabsCaseDetail from "../home/TabsCaseDetail.vue"; import TabsCaseDetail from "../home/TabsCaseDetail.vue";
@@ -102,12 +110,13 @@ export default {
IoDocuments, IoDocuments,
CaseSummary, CaseSummary,
AttachedDocuments, AttachedDocuments,
AttachedDocumentsEdit,
CaseComment, CaseComment,
CaseComments, CaseComments,
ModalCancelCase, ModalCancelCase,
ButtonFleft, ButtonFleft,
ModalNewRequest, ModalNewRequest,
TaskCell TaskCell,
}, },
props: {}, props: {},
data() { data() {
@@ -164,6 +173,7 @@ export default {
title: "Attached Documents", title: "Attached Documents",
items: [], items: [],
}, },
attachDocuments: false,
dataComments: { dataComments: {
title: "Comments", title: "Comments",
items: [], items: [],
@@ -181,17 +191,20 @@ export default {
this.getCasesNotes(); this.getCasesNotes();
}, },
methods: { methods: {
postComment(comment, send) { postComment(comment, send, files) {
let that = this; let that = this;
Api.caseNotes Api.caseNotes
.post( .post(
_.extend({}, this.dataCase, { _.extend({}, this.dataCase, {
COMMENT: comment, COMMENT: comment,
SEND_MAIL: send, SEND_MAIL: send,
FILES: files,
}) })
) )
.then((response) => { .then((response) => {
if (response.data.success === "success") { if (response.data.success === "success") {
that.attachDocuments = false;
this.dataAttachedDocuments.items = [];
that.getCasesNotes(); that.getCasesNotes();
} }
}); });
@@ -263,7 +276,8 @@ export default {
info = { info = {
title: document[i].TITLE, title: document[i].TITLE,
extension: document[i].TITLE.split(".")[1], extension: document[i].TITLE.split(".")[1],
onClick: document[i].DOWNLOAD_LINK, onClick: () => {},
data: document[i],
}; };
this.dataIoDocuments.inputDocuments.push(info); this.dataIoDocuments.inputDocuments.push(info);
} }
@@ -288,7 +302,8 @@ export default {
info = { info = {
title: document[i].TITLE, title: document[i].TITLE,
extension: document[i].TITLE.split(".")[1], extension: document[i].TITLE.split(".")[1],
onClick: document[i].DOWNLOAD_LINK, onClick: () => {},
data: document[i],
}; };
this.dataIoDocuments.outputDocuments.push(info); this.dataIoDocuments.outputDocuments.push(info);
} }
@@ -298,6 +313,13 @@ export default {
throw new Error(err); throw new Error(err);
}); });
}, },
dropFiles(files) {
this.attachDocuments = true;
this.dataAttachedDocuments.items = files;
},
onRemoveAttachedDocument(file) {
this.$refs["case-comments"].removeFile(file);
},
/** /**
* Get for user format name configured in Processmaker Environment Settings * Get for user format name configured in Processmaker Environment Settings
* *
@@ -386,18 +408,18 @@ export default {
dt; dt;
return new Promise((resolutionFunc, rejectionFunc) => { return new Promise((resolutionFunc, rejectionFunc) => {
Api.cases Api.cases
.pendingtask(that.$parent.dataCase) .pendingtask(that.$parent.dataCase)
.then((response) => { .then((response) => {
dt = that.formatDataResponse(response.data); dt = that.formatDataResponse(response.data);
resolutionFunc({ resolutionFunc({
data: dt, data: dt,
count: response.data.length count: response.data.length,
});
that.showTable = response.data.length > 0 ? true : false;
})
.catch((err) => {
throw new Error(err);
}); });
that.showTable = response.data.length > 0 ? true : false;
})
.catch((err) => {
throw new Error(err);
});
}); });
}, },
formatDataResponse(response) { formatDataResponse(response) {
@@ -407,17 +429,17 @@ export default {
TASK: { TASK: {
TITLE: v.TAS_TITLE, TITLE: v.TAS_TITLE,
CODE_COLOR: v.TAS_COLOR, CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL COLOR: v.TAS_COLOR_LABEL,
}, },
CASE_TITLE: v.DEL_TITLE, CASE_TITLE: v.DEL_TITLE,
ASSIGNEE: v.USR_FIRSTNAME + " " + v.USR_LASTNAME, ASSIGNEE: v.USR_FIRSTNAME + " " + v.USR_LASTNAME,
STATUS: v.DEL_THREAD_STATUS, STATUS: v.DEL_THREAD_STATUS,
DUE_DATE: v.DEL_TASK_DUE_DATE, DUE_DATE: v.DEL_TASK_DUE_DATE,
TASK_COLOR: v.TAS_COLOR_LABEL TASK_COLOR: v.TAS_COLOR_LABEL,
}); });
}); });
return data; return data;
} },
}, },
}; };
</script> </script>

View File

@@ -4,15 +4,23 @@
<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
<case-comments <case-comments
ref="case-comments"
:data="dataComments" :data="dataComments"
:onClick="onClickComment" :onClick="onClickComment"
:postComment="postComment" :postComment="postComment"
:dropFiles="dropFiles"
/> />
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<attached-documents <attached-documents
v-if="dataAttachedDocuments.items.length > 0 && !attachDocuments"
:data="dataAttachedDocuments" :data="dataAttachedDocuments"
></attached-documents> ></attached-documents>
<attached-documents-edit
v-if="dataAttachedDocuments.items.length > 0 && attachDocuments"
:data="dataAttachedDocuments"
:onRemove="onRemoveAttachedDocument"
></attached-documents-edit>
</div> </div>
</div> </div>
</b-modal> </b-modal>
@@ -23,17 +31,20 @@
import Api from "./../../api/index"; import Api from "./../../api/index";
import CaseComments from "../../components/home/caseDetail/CaseComments.vue"; import CaseComments from "../../components/home/caseDetail/CaseComments.vue";
import AttachedDocuments from "../../components/home/caseDetail/AttachedDocuments.vue"; import AttachedDocuments from "../../components/home/caseDetail/AttachedDocuments.vue";
import AttachedDocumentsEdit from "../../components/home/caseDetail/AttachedDocumentsEdit.vue";
export default { export default {
name: "ModalComments", name: "ModalComments",
components: { components: {
CaseComments, CaseComments,
AttachedDocuments, AttachedDocuments,
AttachedDocumentsEdit,
}, },
props: {}, props: {},
mounted() {}, mounted() {},
data() { data() {
return { return {
dataCase: null, dataCase: null,
attachDocuments: false,
dataComments: { dataComments: {
title: this.$i18n.t("ID_COMMENTS"), title: this.$i18n.t("ID_COMMENTS"),
items: [], items: [],
@@ -55,17 +66,20 @@ export default {
}); });
this.dataAttachedDocuments.items = att; this.dataAttachedDocuments.items = att;
}, },
postComment: (comment, send) => { postComment: (comment, send, files) => {
let that = this; let that = this;
Api.caseNotes Api.caseNotes
.post( .post(
_.extend({}, this.dataCase, { _.extend({}, this.dataCase, {
COMMENT: comment, COMMENT: comment,
SEND_MAIL: send, SEND_MAIL: send,
FILES: files,
}) })
) )
.then((response) => { .then((response) => {
if (response.data.success === "success") { if (response.data.success === "success") {
that.attachDocuments = false;
this.dataAttachedDocuments.items = [];
that.getCasesNotes(); that.getCasesNotes();
} }
}); });
@@ -94,6 +108,9 @@ export default {
throw new Error(err); throw new Error(err);
}); });
}, },
onRemoveAttachedDocument(file) {
this.$refs["case-comments"].removeFile(file);
},
formatResponseCaseNotes(notes) { formatResponseCaseNotes(notes) {
let that = this, let that = this,
notesArray = []; notesArray = [];
@@ -112,6 +129,10 @@ export default {
this.dataComments.items = notesArray; this.dataComments.items = notesArray;
}, },
dropFiles(files) {
this.attachDocuments = true;
this.dataAttachedDocuments.items = files;
},
/** /**
* Get for user format name configured in Processmaker Environment Settings * Get for user format name configured in Processmaker Environment Settings
* *