Skip to content

Commit 934c9d8

Browse files
committed
saving progress ready for PR
1 parent c02029e commit 934c9d8

5 files changed

Lines changed: 88 additions & 42 deletions

File tree

‎ProcessMaker/Http/Controllers/TaskController.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public function index()
6262

6363
$userConfiguration = (new UserConfigurationController())->index()['ui_configuration'] ?? [];
6464

65-
return view('tasks.index', compact('title', 'userFilter', 'defaultColumns', 'taskDraftsEnabled', 'userConfiguration', 'showOldTaskScreen'));
65+
$currentUser = Auth::user();
66+
67+
return view('tasks.index', compact('title', 'userFilter', 'defaultColumns', 'taskDraftsEnabled', 'userConfiguration', 'showOldTaskScreen', 'currentUser'));
6668
}
6769

6870
public function edit(ProcessRequestToken $task, string $preview = '')
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
<template>
22
<div>
3-
<h2>Dashboard Viewer</h2>
4-
<p v-if="dashboardId">Dashboard ID: {{ dashboardId }}</p>
5-
<p v-else>No selected dashboard</p>
3+
<vue-form-renderer
4+
v-model="formData"
5+
:config="screen.config"
6+
:computed="screen.computed"
7+
:custom-css="screen.custom_css"
8+
:watchers="screen.watchers"
9+
/>
610
</div>
711
</template>
812

913
<script>
10-
export default {
11-
name: 'DashboardViewer',
12-
props: {
13-
dashboardId: {
14-
type: [String, null],
15-
default: null
14+
15+
export default {
16+
props: ["screen", "formData"],
17+
data() {
18+
return {
19+
disabled: false,
20+
};
21+
},
22+
methods: {},
23+
watch: {
24+
screen: {
25+
deep: true,
26+
handler() {
27+
this.disabled = false;
1628
}
29+
}
1730
}
18-
}
19-
</script>
31+
};
32+
</script>

‎resources/js/tasks/components/ProcessesDashboardsMenu.vue‎

Lines changed: 57 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,18 @@
2222

2323
<div class="divider-custom"></div>
2424

25-
<div class="dashboard-section">
26-
<div class="buttons-list-dashboard">
27-
<button
28-
v-for="dashboard in dashboards"
29-
:key="dashboard.id"
30-
class="menu-btn"
31-
@click="openProcessDashboard(dashboard.id, 'dashboard')"
32-
>
33-
<i class="fp-tachometer-alt-average"></i>
34-
<span :id="`dashboard-${dashboard.id}`" class="title-dashboard">
35-
{{ dashboard.name }}
36-
</span>
37-
</button>
38-
</div>
25+
<div class="buttons-list-dashboard">
26+
<button
27+
v-for="dashboard in dashboards"
28+
:key="dashboard.id"
29+
class="menu-btn"
30+
@click="openProcessDashboard(dashboard.id, 'dashboard')"
31+
>
32+
<i class="fp-tachometer-alt-average"></i>
33+
<span :id="`dashboard-${dashboard.id}`" class="title-dashboard">
34+
{{ dashboard.title }}
35+
</span>
36+
</button>
3937
</div>
4038
</div>
4139
</div>
@@ -50,15 +48,14 @@ export default {
5048
pmql: `user_id=${window.ProcessMaker.user.id}`,
5149
processesList: [],
5250
labelIcon: "Default Icon",
53-
dashboards: [
54-
{ id: 1, name: "Dashboard 1" },
55-
{ id: 2, name: "Dashboard 2" },
56-
{ id: 3, name: "Dashboard 3" },
57-
],
51+
dashboards: [],
52+
screen: null,
53+
formData: null,
5854
};
5955
},
6056
mounted() {
6157
this.loadProcesses();
58+
this.loadDashboards();
6259
},
6360
methods: {
6461
openProcessDashboard(id, type) {
@@ -76,28 +73,43 @@ export default {
7673
}
7774
});
7875
} else {
79-
router
80-
.push({
81-
name: "dashboard",
82-
params: { dashboardId: id.toString() },
83-
})
84-
.catch((err) => {
85-
if (err.name !== "NavigationDuplicated") {
86-
throw err;
87-
}
88-
});
76+
this.getDashboardViewScreen(id.toString());
8977
}
9078
9179
this.$emit("processDashboardSelected", { id, type });
9280
this.$emit("menuItemSelected");
9381
},
82+
callDashboardViewScreen(id, screen, formData) {
83+
const router = this.$router || this.$root.$router;
84+
router
85+
.push({
86+
name: "dashboard",
87+
params: {
88+
dashboardId: id.toString(),
89+
screen: screen,
90+
formData: formData,
91+
},
92+
})
93+
.catch((err) => {
94+
if (err.name !== "NavigationDuplicated") {
95+
throw err;
96+
}
97+
});
98+
},
9499
loadProcesses() {
95100
const url = this.buildURL();
96101
97102
ProcessMaker.apiClient.get(url).then((response) => {
98103
this.processesList = this.processesList.concat(response.data.data);
99104
});
100105
},
106+
loadDashboards() {
107+
const url = this.buildURLDashboards();
108+
109+
ProcessMaker.apiClient.get(url).then((response) => {
110+
this.dashboards = this.dashboards.concat(response.data);
111+
});
112+
},
101113
/**
102114
* Build URL for Process Cards
103115
*/
@@ -109,6 +121,13 @@ export default {
109121
&order_by=name&order_direction=asc
110122
&include=user,categories,category`;
111123
},
124+
buildURLDashboards() {
125+
return `/dynamic-ui/custom-dashboards`;
126+
},
127+
buildURLDashboardsScreen(id) {
128+
//return `/dynamic-ui/custom-dashboards/${token}`;
129+
return `/dynamic-ui/custom-dashboards/screen/${id}`;
130+
},
112131
getIconProcess(process) {
113132
let icon = "Default Icon";
114133
const unparseProperties = process?.launchpad?.properties || null;
@@ -118,6 +137,15 @@ export default {
118137
119138
return `/img/launchpad-images/icons/${icon}.svg`;
120139
},
140+
getDashboardViewScreen(id) {
141+
const url = this.buildURLDashboardsScreen(id);
142+
143+
ProcessMaker.apiClient.get(url).then((response) => {
144+
this.screen = response.data.screen;
145+
this.formData = response.data.formData;
146+
this.callDashboardViewScreen(id, this.screen, this.formData);
147+
});
148+
},
121149
},
122150
};
123151
</script>

‎resources/js/tasks/router.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ const router = new VueRouter({
2424
name: "dashboard",
2525
component: DashboardViewer,
2626
props: route => ({
27-
dashboardId: route.params.dashboardId || null
27+
dashboardId: route.params.dashboardId || null,
28+
screen: route.params.screen || null,
29+
formData: route.params.formData || null
2830
})
2931
}
3032
]

‎resources/views/tasks/index.blade.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
window.ProcessMaker.userConfiguration = @json($userConfiguration ?? []);
160160
window.sessionStorage.setItem('elementDestinationURL', window.location.href);
161161
window.ProcessMaker.showOldTaskScreen = @json($showOldTaskScreen);
162+
window.Processmaker.user = @json($currentUser);
162163
</script>
163164
<script>
164165
window.ProcessMaker.ellipsisPermission = {{

0 commit comments

Comments
 (0)