Skip to content

Commit 0aebc6b

Browse files
Merge branch 'feature/FOUR-11531' of https://github.com/ProcessMaker/processmaker into feature/FOUR-12677
2 parents 7b2c90d + 0dde111 commit 0aebc6b

File tree

8 files changed

+145
-7
lines changed

8 files changed

+145
-7
lines changed

ProcessMaker/Http/Controllers/Api/ProcessController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ public function index(Request $request)
107107
if (!empty($filter)) {
108108
$processes->filter($filter);
109109
}
110+
// Filter by category
111+
$category = $request->input('category', null);
112+
if (!empty($category)) {
113+
$processes->processCategory($category);
114+
}
110115

111116
if (!empty($pmql)) {
112117
try {

ProcessMaker/Models/Process.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,14 @@ public function scopeArchived($query)
450450
return $query->where('processes.status', 'ARCHIVED');
451451
}
452452

453+
/**
454+
* Scope a query to include a specific category
455+
*/
456+
public function scopeProcessCategory($query, int $id)
457+
{
458+
return $query->where('processes.process_category_id', $id);
459+
}
460+
453461
public function getCollaborations()
454462
{
455463
$this->bpmnDefinitions = app(BpmnDocumentInterface::class, ['process' => $this]);
18.9 KB
Loading

resources/img/launchpad-images/noImage.svg

Lines changed: 23 additions & 0 deletions
Loading

resources/js/processes-catalogue/components/ProcessInfo.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<breadcrumbs />
44
<b-row>
55
<b-col cols="2">
6-
<h4> {{ $t('Processes Browser') }} </h4>
6+
<h4>{{ $t("Processes Browser") }}</h4>
77
<!--
88
Menu Catalogue FOUR-12111
99
<MenuCatologue
@@ -22,33 +22,33 @@
2222
:current-user-id="currentUserId"
2323
:is-documenter-installed="isDocumenterInstalled"
2424
/>
25+
<processes-carousel
26+
:process="process"
27+
/>
2528
</b-col>
2629
<b-col cols="3">
2730
<process-options :process="process" />
2831
</b-col>
2932
</div>
30-
<b-col cols="12">
31-
Process Tab
32-
</b-col>
33+
<b-col cols="12"> Process Tab </b-col>
3334
</b-col>
3435
</b-row>
3536
</div>
3637
</template>
3738

3839
<script>
40+
import ProcessesCarousel from "../components/ProcessesCarousel.vue";
3941
import ProcessMap from "./ProcessMap.vue";
4042
import ProcessOptions from "./ProcessOptions.vue";
4143
import Breadcrumbs from "./Breadcrumbs.vue";
4244
4345
export default {
44-
components: { ProcessOptions, Breadcrumbs, ProcessMap },
46+
components: { ProcessOptions, Breadcrumbs, ProcessMap, ProcessesCarousel },
4547
props: ["process", "permission", "isDocumenterInstalled", "currentUserId"],
4648
data() {
4749
return {
4850
fields: [],
4951
};
5052
},
51-
methods: {
52-
},
5353
};
5454
</script>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<template>
2+
<div>
3+
<b-carousel
4+
id="carousel-1"
5+
v-model="slide"
6+
:interval="interval"
7+
indicators
8+
@sliding-start="onSlideStart"
9+
@sliding-end="onSlideEnd"
10+
>
11+
<b-carousel-slide
12+
v-for="(image, index) in images.length > 0 ? images : defaultImage"
13+
:key="index"
14+
class="custom-style"
15+
:img-src="image.url"
16+
></b-carousel-slide>
17+
</b-carousel>
18+
</div>
19+
</template>
20+
21+
<script>
22+
export default {
23+
props: {
24+
process: {
25+
type: Object,
26+
required: true,
27+
},
28+
},
29+
data() {
30+
return {
31+
slide: 0,
32+
sliding: null,
33+
images: [
34+
{ url: "https://picsum.photos/1024/480/?image=55" },
35+
{ url: "https://picsum.photos/100/100/?image=54" },
36+
{ url: "https://picsum.photos/200/100/?image=53" },
37+
{ url: "https://picsum.photos/1024/800/?image=56" },
38+
],
39+
defaultImage: Array(4).fill({ url: "/img/launchpad-images/imageDefault.png" }),
40+
interval: 2000,
41+
};
42+
},
43+
methods: {
44+
onSlideStart(slide) {
45+
this.sliding = true;
46+
},
47+
onSlideEnd(slide) {
48+
this.sliding = false;
49+
},
50+
/**
51+
* TO DO: This method gets information related to processes Launchpad Settings
52+
*/
53+
getLaunchpadSettings() {
54+
//Here call API to retrieve information
55+
// ProcessMaker.apiClient
56+
// .get("query here")
57+
// .then((response) => {
58+
// this.carouselImages = response.data;
59+
// })
60+
// .catch((err) => {
61+
// console.log("Error", err);
62+
// });
63+
},
64+
},
65+
};
66+
</script>
67+
<style>
68+
.carousel-inner {
69+
overflow: hidden;
70+
}
71+
72+
.custom-style {
73+
background-size: cover;
74+
background-position: center;
75+
width: 100%;
76+
height: 400px;
77+
}
78+
</style>

tests/Feature/Api/ProcessTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,29 @@ public function testSorting()
555555
]);
556556
}
557557

558+
/**
559+
* Test filter by Category
560+
*/
561+
public function testFilterCategory()
562+
{
563+
// Create Category
564+
$categoryA = ProcessCategory::factory()->create();
565+
$categoryB = ProcessCategory::factory()->create();
566+
// Now we create process related to this
567+
Process::factory()->count(5)->create([
568+
'process_category_id' => $categoryB->id,
569+
]);
570+
// Get process without category
571+
$response = $this->apiCall('GET', route('api.processes.index', ['per_page' => 5, 'page' => 1]));
572+
$response->assertJsonCount(5, 'data');
573+
// Get process related categoryA
574+
$response = $this->apiCall('GET', route('api.processes.index', ['category' => $categoryA->id]));
575+
$response->assertJsonCount(0, 'data');
576+
// Get process related categoryB
577+
$response = $this->apiCall('GET', route('api.processes.index', ['category' => $categoryB->id]));
578+
$response->assertJsonCount(5, 'data');
579+
}
580+
558581
/**
559582
* Test pagination of process list
560583
*/

webpack.mix.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ mix.extract([
5454
"@fortawesome/vue-fontawesome"
5555
])
5656
.copy("resources/img/*", "public/img")
57+
.copy("resources/img/launchpad-images/*", "public/img/launchpad-images")
5758
.copy("resources/img/script_lang/*", "public/img/script_lang")
5859
.copy("node_modules/snapsvg/dist/snap.svg.js", "public/js")
5960
.copy("resources/js/components/CustomActions.vue", "public/js")

0 commit comments

Comments
 (0)