+
+
⚠️ Plugin not supported for current usageType. It is recommended that you disable this plugin.
{{ plugin.description }}
+
Usage type: {{ plugin.usage_type }}
@@ -32,6 +34,21 @@ export default {
plugins: {
type: Array,
required: true
+ },
+ mainSettings: {
+ type: Object,
+ required: true
+ }
+ },
+ computed: {
+ enrichedPlugins: function() {
+ return this.plugins.map(plugin => ({
+ ...plugin,
+ plugin_for_usage_type: this.validUsageType(
+ plugin.usage_type,
+ this.mainSettings.usageType
+ )
+ }))
}
},
methods: {
@@ -57,6 +74,9 @@ export default {
title: type + ' !',
text: message
})
+ },
+ validUsageType(plugin_usage_type, customer_usage_types) {
+ return plugin_usage_type === 'general' || customer_usage_types.includes(plugin_usage_type)
}
}
}
@@ -83,6 +103,17 @@ export default {
font-size: 0.7rem;
}
+.usage-type-warning {
+ font-weight: 400;
+ font-size: 0.7rem;
+ background-color: #f0f0f0;
+ padding: 5px;
+ border-radius: 5px;
+ color: #333333;
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); // Optional: Add shadow for depth
+ max-width: 400px; // Optional: Set maximum width for responsiveness
+}
+
.stepper-title {
text-align: center !important;
font-size: large !important;
@@ -101,4 +132,4 @@ export default {
margin-left: 3rem !important;
float: right;
}
-
\ No newline at end of file
+
diff --git a/Website/ui/src/modules/Settings/Settings.vue b/Website/ui/src/modules/Settings/Settings.vue
index cd58bade7..d47a3d004 100644
--- a/Website/ui/src/modules/Settings/Settings.vue
+++ b/Website/ui/src/modules/Settings/Settings.vue
@@ -9,7 +9,7 @@
-
+
@@ -75,6 +75,7 @@ export default {
id: plugin.id,
name: plugin.name,
description: plugin.description,
+ usage_type: plugin.usage_type,
checked: foundPlugin && foundPlugin.status === 1
}
})
@@ -92,4 +93,4 @@ export default {
height: 200px;
}
}
-
\ No newline at end of file
+
diff --git a/Website/ui/src/repositories/RepositoryFactory.js b/Website/ui/src/repositories/RepositoryFactory.js
index 28eca7094..418df1f17 100644
--- a/Website/ui/src/repositories/RepositoryFactory.js
+++ b/Website/ui/src/repositories/RepositoryFactory.js
@@ -76,6 +76,7 @@ import ManufacturerRepository from '@/repositories/ManufacturerRepository'
import EBikeRepository from '@/repositories/EBikeRepository'
import TransactionExportRepository from '@/repositories/TransactionExportRepository'
import OutstandingDebtsExportRepository from '@/repositories/OutstandingDebtsExportRepository'
+import UsageTypeRepository from '@/repositories/UsageTypeRepository'
const repositories = {
'address': AddressRepository,
@@ -156,6 +157,7 @@ const repositories = {
'eBike': EBikeRepository,
'transactionExport': TransactionExportRepository,
'outstandingDebtsExportRepository': OutstandingDebtsExportRepository,
+ 'usageType': UsageTypeRepository,
}
export default {
diff --git a/Website/ui/src/repositories/UsageTypeRepository.js b/Website/ui/src/repositories/UsageTypeRepository.js
new file mode 100644
index 000000000..1fb7cbf6d
--- /dev/null
+++ b/Website/ui/src/repositories/UsageTypeRepository.js
@@ -0,0 +1,10 @@
+import Client from './Client/AxiosClient'
+import { baseUrl } from './Client/AxiosClient'
+
+const resource = `${baseUrl}/api/usage-types`
+
+export default {
+ list() {
+ return Client.get(`${resource}`)
+ },
+}
diff --git a/Website/ui/src/services/MainSettingsService.js b/Website/ui/src/services/MainSettingsService.js
index 2c29ee5c7..f6a6eac6b 100644
--- a/Website/ui/src/services/MainSettingsService.js
+++ b/Website/ui/src/services/MainSettingsService.js
@@ -13,6 +13,7 @@ export class MainSettingsService {
language: null,
vatEnergy: null,
vatAppliance: null,
+ usageType: null,
}
}
@@ -26,6 +27,7 @@ export class MainSettingsService {
language: mainSettings.language,
vatEnergy: mainSettings.vat_energy,
vatAppliance: mainSettings.vat_appliance,
+ usageType: mainSettings.usage_type,
}
return this.mainSettings
}
@@ -55,6 +57,7 @@ export class MainSettingsService {
language: this.mainSettings.language,
vat_energy: this.mainSettings.vatEnergy,
vat_appliance: this.mainSettings.vatAppliance,
+ usage_type: this.mainSettings.usageType,
}
let response = await this.repository.update(mainSettingsPm.id,
mainSettingsPm)
diff --git a/Website/ui/src/services/MpmPluginService.js b/Website/ui/src/services/MpmPluginService.js
index 44d8b3f73..d67a75a8b 100644
--- a/Website/ui/src/services/MpmPluginService.js
+++ b/Website/ui/src/services/MpmPluginService.js
@@ -21,7 +21,7 @@ export class MpmPluginService {
description:plugin.description,
checked:false,
root_class:plugin.root_class,
-
+ usage_type: plugin.usage_type
}
})
return this.list
diff --git a/Website/ui/src/services/UsageTypeListService.js b/Website/ui/src/services/UsageTypeListService.js
new file mode 100644
index 000000000..c0beefad1
--- /dev/null
+++ b/Website/ui/src/services/UsageTypeListService.js
@@ -0,0 +1,24 @@
+import Repository from '../repositories/RepositoryFactory'
+import { ErrorHandler } from '@/Helpers/ErrorHander'
+
+export class UsageTypeListService {
+ constructor() {
+ this.repository = Repository.get('usageType')
+ this.usageTypeList = []
+ }
+
+ async list() {
+ try {
+ let response = await this.repository.list()
+ if (response.status === 200) {
+ this.usageTypeList = response.data.data
+ return this.usageTypeList
+ } else {
+ return new ErrorHandler(response.error, 'http', response.status)
+ }
+ } catch (e) {
+ let erorMessage = e.response.data.message
+ return new ErrorHandler(erorMessage, 'http')
+ }
+ }
+}