File tree Expand file tree Collapse file tree
resources/js/processes-catalogue/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 </div >
2929 <div class =" d-flex align-items-center flex-shrink-0 tw-text-xs" >
3030 <mini-pie-chart
31- :count =" process.counts.in_progress "
32- :total =" process.counts. total"
31+ :count =" inProgress "
32+ :total =" total"
3333 :name =" $t('In Progress')"
3434 color =" #4EA075"
3535 />
3636 <mini-pie-chart
37- :count =" process.counts. completed"
38- :total =" process.counts. total"
37+ :count =" completed"
38+ :total =" total"
3939 :name =" $t('Completed')"
4040 color =" #478FCC"
4141 />
@@ -148,6 +148,9 @@ export default {
148148 infoCollapsed: true ,
149149 processEvents: [],
150150 singleStartEvent: null ,
151+ inProgress: 0 ,
152+ completed: 0 ,
153+ total: 0 ,
151154 };
152155 },
153156 computed: {
@@ -163,11 +166,25 @@ export default {
163166 },
164167 mounted () {
165168 this .verifyDescription ();
169+ // Initialize chart data from process.counts
170+ this .inProgress = this .process .counts ? .in_progress || 0 ;
171+ this .completed = this .process .counts ? .completed || 0 ;
172+ this .total = this .process .counts ? .total || 0 ;
166173 ProcessMaker .EventBus .$on (" reloadByNewScreen" , () => {
167174 window .location .reload ();
168175 });
176+ ProcessMaker .EventBus .$on (" chartDataUpdated" , (data ) => {
177+ if (data .processId === this .process .id ) {
178+ this .completed = data .completed ;
179+ this .inProgress = data .inProgress ;
180+ this .total = data .total ;
181+ }
182+ });
169183 this .getStartEvents ();
170184 },
185+ beforeDestroy () {
186+ ProcessMaker .EventBus .$off (" chartDataUpdated" );
187+ },
171188 methods: {
172189 /**
173190 * Verify if the Description is large
Original file line number Diff line number Diff line change 1313 class =" charts"
1414 >
1515 <mini-pie-chart
16- :count =" process.counts.in_progress "
17- :total =" process.counts. total"
16+ :count =" inProgress "
17+ :total =" total"
1818 :name =" $t('In Progress')"
1919 color =" #4EA075"
2020 />
2121 <mini-pie-chart
22- :count =" process.counts. completed"
23- :total =" process.counts. total"
22+ :count =" completed"
23+ :total =" total"
2424 :name =" $t('Completed')"
2525 color =" #478FCC"
2626 />
@@ -38,6 +38,9 @@ export default {
3838 data () {
3939 return {
4040 count: 0 ,
41+ inProgress: 0 ,
42+ completed: 0 ,
43+ total: 0 ,
4144 };
4245 },
4346 computed: {
@@ -58,6 +61,27 @@ export default {
5861 .catch (() => {
5962 this .count = 0 ;
6063 });
64+
65+ ProcessMaker .apiClient
66+ .get (` requests/${ this .process .id } /default-chart` )
67+ .then ((response ) => {
68+ const { data: { datasets: { data: [completedCount , inProgressCount ] } } } = response .data ;
69+ this .completed = completedCount;
70+ this .inProgress = inProgressCount;
71+ this .total = this .completed + this .inProgress ;
72+ // Emit event to update other components
73+ ProcessMaker .EventBus .$emit (" chartDataUpdated" , {
74+ processId: this .process .id ,
75+ completed: this .completed ,
76+ inProgress: this .inProgress ,
77+ total: this .total ,
78+ });
79+ })
80+ .catch (() => {
81+ this .inProgress = 0 ;
82+ this .completed = 0 ;
83+ this .total = 0 ;
84+ });
6185 },
6286 },
6387};
You can’t perform that action at this time.
0 commit comments