Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ProcessMaker/Http/Controllers/CasesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public function show($case_number)
// "Initialload.js" file causes an issue related to SVG in the modeler
// The other scripts are not needed in the case detail
$scriptsDisabled = ['package-slideshow', 'package-process-optimization', 'package-ab-testing', 'package-testing', 'initialLoad'];
$managerModelerScripts = array_filter($managerModeler->getScripts(), function ($script) use ($scriptsDisabled) {
$managerModelerScripts = array_filter($managerModeler->getScriptWithParams(), function ($script) use ($scriptsDisabled) {
foreach ($scriptsDisabled as $enabledScript) {
if (strpos($script, $enabledScript) !== false) {
if (strpos($script['src'], $enabledScript) !== false) {
return false;
}
}
Expand Down
7 changes: 5 additions & 2 deletions ProcessMaker/Http/Controllers/RequestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ public function show(ProcessRequest $request, Media $mediaItems)
event(new ModelerStarting($managerModeler));

$scriptsEnabled = ['package-slideshow', 'package-process-optimization', 'package-ab-testing', 'package-testing'];
$managerModelerScripts = array_filter($managerModeler->getScripts(), function ($script) use ($scriptsEnabled) {
$managerModelerScripts = array_filter($managerModeler->getScriptWithParams(), function ($script) use ($scriptsEnabled) {
foreach ($scriptsEnabled as $enabledScript) {
if (strpos($script, $enabledScript) !== false) {
if (empty($script['src'])) {
continue;
}
if (strpos($script['src'], $enabledScript) !== false) {
return false;
}
}
Expand Down
301 changes: 152 additions & 149 deletions resources/jscomposition/cases/casesDetail/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,170 +13,173 @@ import {

Vue.globalStore.registerModule("core:cases", cases);

const caseDetail = new Vue({
el: "#case-detail",
components: {
CaseDetail, Tabs, CollapsableContainer, Timeline, StageBar,
},
data() {
return {
data,
request,
canCancel,
canViewPrint,
status: "ACTIVE",
userRequested: [],
errorLogs,
packages: [],
processId,
canViewComments,
disabled: false,
retryDisabled: false,
tabDefault: "details",
collapseContainer: true,
tabs: [
{
name: "Details",
href: "#details",
current: "details",
show: true,
content: null,
},
{
name: "Comments",
href: "#comments",
current: "comments",
show: true,
content: null,
},
],
headerModel: false,
progressStage: getProgressStage(),
stageName: getStageName(),
};
},
computed: {
/**
* Get the list of participants in the request.
*
*/
participants() {
return this.request.participants;
window.addEventListener("load", () => {
const caseDetail = new Vue({
el: "#case-detail",
components: {
CaseDetail, Tabs, CollapsableContainer, Timeline, StageBar,
},
classStatusCard() {
const header = {
ACTIVE: "active-style",
COMPLETED: "active-style",
CANCELED: "canceled-style ",
ERROR: "canceled-style",
};
return `tw-rounded-md text-status ${header[this.request.status.toUpperCase()]}`;
},
labelDate() {
const label = {
ACTIVE: "In Progress Since",
COMPLETED: "Completed On",
CANCELED: "Canceled ",
ERROR: "Failed On",
};
return label[this.request.status.toUpperCase()];
},
statusDate() {
const status = {
ACTIVE: this.request.created_at,
COMPLETED: this.request.completed_at,
CANCELED: this.request.updated_at,
ERROR: this.request.updated_at,
data() {
return {
data,
request,
canCancel,
canViewPrint,
status: "ACTIVE",
userRequested: [],
errorLogs,
packages: [],
processId,
canViewComments,
disabled: false,
retryDisabled: false,
tabDefault: "details",
collapseContainer: true,
tabs: [
{
name: "Details",
href: "#details",
current: "details",
show: true,
content: null,
},
{
name: "Comments",
href: "#comments",
current: "comments",
show: true,
content: null,
},
],
headerModel: false,
progressStage: getProgressStage(),
stageName: getStageName(),
};

return status[this.request.status.toUpperCase()];
},
statusLabel() {
const status = {
ACTIVE: this.$t("In Progress"),
COMPLETED: this.$t("Completed"),
CANCELED: this.$t("Canceled"),
ERROR: this.$t("Error"),
};
computed: {
/**
* Get the list of participants in the request.
*
*/
participants() {
return this.request.participants;
},
classStatusCard() {
const header = {
ACTIVE: "active-style",
COMPLETED: "active-style",
CANCELED: "canceled-style ",
ERROR: "canceled-style",
};
return `tw-rounded-md text-status ${header[this.request.status.toUpperCase()]}`;
},
labelDate() {
const label = {
ACTIVE: "In Progress Since",
COMPLETED: "Completed On",
CANCELED: "Canceled ",
ERROR: "Failed On",
};
return label[this.request.status.toUpperCase()];
},
statusDate() {
const status = {
ACTIVE: this.request.created_at,
COMPLETED: this.request.completed_at,
CANCELED: this.request.updated_at,
ERROR: this.request.updated_at,
};

return status[this.request.status.toUpperCase()];
},
requestBy() {
return [this.request.user];
},
panCommentInVueOptionsComponents() {
return "pan-comment" in Vue.options.components;
},
return status[this.request.status.toUpperCase()];
},
statusLabel() {
const status = {
ACTIVE: this.$t("In Progress"),
COMPLETED: this.$t("Completed"),
CANCELED: this.$t("Canceled"),
ERROR: this.$t("Error"),
};

},
async mounted() {
const store = useStore();
this.packages = window.ProcessMaker.requestShowPackages;
return status[this.request.status.toUpperCase()];
},
requestBy() {
return [this.request.user];
},
panCommentInVueOptionsComponents() {
return "pan-comment" in Vue.options.components;
},

const response = await this.getUserConf();

store.commit("core:cases/updateUserConfiguration", response);
this.collapseContainer = store.getters["core:cases/getCollapseContainer"];
},
methods: {
onCancel() {
ProcessMaker.confirmModal(
this.$t("Caution!"),
this.$t("Are you sure you want cancel this request?"),
"",
() => {
this.okCancel();
},
);
},
async onToogleContainer(value) {
async mounted() {
const store = useStore();
store.commit("core:cases/updateCollapseContainer", value);
this.packages = window.ProcessMaker.requestShowPackages;

const userConf = store.getters["core:cases/getUserConfiguration"];
const response = await this.getUserConf();

const response = await updateUserConfiguration({
user_id: userConf.user_id,
ui_configuration: userConf.ui_configuration,
});
store.commit("core:cases/updateUserConfiguration", response);
this.collapseContainer = store.getters["core:cases/getCollapseContainer"];
},
getUserConf: async () => {
const response = await getUserConfiguration();
methods: {
onCancel() {
ProcessMaker.confirmModal(
this.$t("Caution!"),
this.$t("Are you sure you want cancel this request?"),
"",
() => {
this.okCancel();
},
);
},
async onToogleContainer(value) {
const store = useStore();
store.commit("core:cases/updateCollapseContainer", value);

return {
user_id: response.user_id,
ui_configuration: JSON.parse(response.ui_configuration),
};
},
getCommentsData: async () => {
const request = getRequest();
const userConf = store.getters["core:cases/getUserConfiguration"];

const response = await getCommentsData({
params: {
type: "COMMENT,REPLY",
order_direction: "desc",
case_number: request.case_number,
},
});
const response = await updateUserConfiguration({
user_id: userConf.user_id,
ui_configuration: userConf.ui_configuration,
});
},
getUserConf: async () => {
const response = await getUserConfiguration();

return response;
},
async okCancel() {
// single click
if (this.disabled) {
return;
}
this.disabled = true;
try {
await updateRequest(getRequestId(), {
status: "CANCELED",
return {
user_id: response.user_id,
ui_configuration: JSON.parse(response.ui_configuration),
};
},
getCommentsData: async () => {
const request = getRequest();

const response = await getCommentsData({
params: {
type: "COMMENT,REPLY",
order_direction: "desc",
case_number: request.case_number,
},
});

ProcessMaker.alert(this.$t("The request was canceled."), "success");
window.location.reload();
} catch (error) {
this.disabled = false;
}
return response;
},
async okCancel() {
// single click
if (this.disabled) {
return;
}
this.disabled = true;
try {
await updateRequest(getRequestId(), {
status: "CANCELED",
});

ProcessMaker.alert(this.$t("The request was canceled."), "success");
window.location.reload();
} catch (error) {
this.disabled = false;
}
},
},
},
});
});

12 changes: 10 additions & 2 deletions resources/views/cases/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,16 @@ class="tw-grow tw-overflow-hidden"
@endforeach

<!-- Load the modeler scripts -->
@foreach($managerModelerScripts as $script)
<script src="{{ $script }}"></script>
@foreach($managerModelerScripts as $params)
<script
@foreach ($params as $key => $value)
@if (is_bool($value))
{{ $key }}
@else
{{ $key }}="{{ $value }}"
@endif
@endforeach
></script>
@endforeach

@if (hasPackage('package-files'))
Expand Down
12 changes: 10 additions & 2 deletions resources/views/requests/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,16 @@ class="btn btn-outline-info btn-block"
};
</script>

@foreach($managerModelerScripts as $script)
<script src="{{ $script }}"></script>
@foreach($managerModelerScripts as $params)
<script
@foreach ($params as $key => $value)
@if (is_bool($value))
{{ $key }}
@else
{{ $key }}="{{ $value }}"
@endif
@endforeach
></script>
@endforeach
@foreach($manager->getScripts() as $script)
<script src="{{$script}}"></script>
Expand Down
Loading