Skip to content

Modular logistics and supply chain operating system (LSOS)

added translation

TemuulenBMbe382fcbd3ff
diff --git a/console/app/controllers/console/admin/organizations/index.js b/console/app/controllers/console/admin/organizations/index.js
index 0fd040bf..58567544 100644
--- a/console/app/controllers/console/admin/organizations/index.js
+++ b/console/app/controllers/console/admin/organizations/index.js
@@ -17,6 +17,14 @@ export default class ConsoleAdminOrganizationsController extends Controller {
* @type {Object}
*/
@service store;
+
+ /**
+ * Inject the `intl` service
+ *
+ * @var {Service}
+ */
+ @service intl;
+
/**
* The Ember Router service for handling transitions between routes.
*
@@ -60,6 +68,13 @@ export default class ConsoleAdminOrganizationsController extends Controller {
*/
@tracked name;
+ /**
+ * The filterable param `country`
+ *
+ * @var {String}
+ */
+ @tracked country;
+
/**
* Queryable parameters for this controller's model
*
@@ -79,15 +94,23 @@ export default class ConsoleAdminOrganizationsController extends Controller {
this.getAllCompanies();
this.columns = [
{
- label: 'Name',
+ label: this.intl.t('common.name'),
valuePath: 'name',
+ resizable: true,
+ sortable: true,
+ filterable: true,
+ filterComponent: 'filter/string',
},
{
- label: 'Country',
+ label: this.intl.t('common.country'),
valuePath: 'country_name',
+ resizable: true,
+ sortable: true,
+ filterable: true,
+ filterComponent: 'filter/string',
},
{
- label: 'Created At',
+ label: this.intl.t('common.created-at'),
valuePath: 'createdAt',
},
];
diff --git a/console/app/controllers/console/admin/organizations/users.js b/console/app/controllers/console/admin/organizations/users.js
index 2e0aae07..26226c44 100644
--- a/console/app/controllers/console/admin/organizations/users.js
+++ b/console/app/controllers/console/admin/organizations/users.js
@@ -9,6 +9,13 @@ export default class ConsoleAdminOrganizationUsersController extends Controller
*/
@service filters;
+ /**
+ * Inject the `intl` service
+ *
+ * @var {Service}
+ */
+ @service intl;
+
/**
* The current page of data being viewed
*
@@ -69,19 +76,19 @@ export default class ConsoleAdminOrganizationUsersController extends Controller
super(...arguments);
this.columns = [
{
- label: 'Name',
+ label: this.intl.t('common.name'),
valuePath: 'name',
},
{
- label: 'Phone',
+ label: this.intl.t('common.phone-number'),
valuePath: 'phone',
},
{
- label: 'Email',
+ label: this.intl.t('common.email'),
valuePath: 'email',
},
{
- label: 'Status',
+ label: this.intl.t('common.status'),
valuePath: 'status',
},
];
diff --git a/console/app/router.js b/console/app/router.js
index 53539546..4e2c3533 100644
--- a/console/app/router.js
+++ b/console/app/router.js
@@ -57,22 +57,22 @@ Router.map(function () {
this.mount('@fleetbase/dev-engine', {
as: 'developers',
- path: 'developers',
+ path: 'developers'
});
this.mount('@fleetbase/iam-engine', {
as: 'iam',
- path: 'iam',
+ path: 'iam'
});
this.mount('@fleetbase/storefront-engine', {
as: 'storefront',
- path: 'storefront',
+ path: 'storefront'
});
this.mount('@fleetbase/fleetops-engine', {
as: 'fleet-ops',
- path: 'fleet-ops',
+ path: 'fleet-ops'
});
});
this.route('install');
diff --git a/console/app/routes/console/admin/organizations/index.js b/console/app/routes/console/admin/organizations/index.js
index 61ce321c..da1a9005 100644
--- a/console/app/routes/console/admin/organizations/index.js
+++ b/console/app/routes/console/admin/organizations/index.js
@@ -1,9 +1,57 @@
import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
+import { task } from 'ember-concurrency';
+/**
+ * `ConsoleAdminOrganizationsRoute` is a Route that handles the logic for the admin organizations console.
+ *
+ * @class ConsoleAdminOrganizationsRoute
+ * @extends Route
+ * @public
+ */
export default class ConsoleAdminOrganizationsRoute extends Route {
+ /**
+ * `store` is a service that provides methods for querying and manipulating the application's data store.
+ *
+ * @service store
+ * @public
+ */
+ @service store;
+
queryParams = {
page: { refreshModel: true },
+ query: { refreshModel: true },
+ sort: { refreshModel: true },
limit: { refreshModel: true },
name: { refreshModel: true },
+ country: { refreshModel: true },
};
+
+ /**
+ * `search` is a task that performs a search query on the 'company' model in the store.
+ *
+ * @method search
+ * @param {string} query - The search query.
+ * @returns {Promise} A promise that resolves with the search results.
+ * @public
+ */
+ search = task(function* (query) {
+ try {
+ return yield this.store.query('company', { query });
+ } catch (error) {
+ console.error('An error occurred during the search:', error);
+ }
+ }).restartable();
+
+ /**
+ * `model` is a method that queries the 'company' model in the store with the provided parameters.
+ *
+ * @method model
+ * @param {Object} params - The query parameters.
+ * @returns {Promise} A promise that resolves with the query results.
+ * @public
+ */
+ model(params) {
+ return this.store.query('company', params);
+ }
}
diff --git a/console/app/routes/console/admin/organizations/users.js b/console/app/routes/console/admin/organizations/users.js
index d3903e3a..1b979cfc 100644
--- a/console/app/routes/console/admin/organizations/users.js
+++ b/console/app/routes/console/admin/organizations/users.js
@@ -41,16 +41,4 @@ export default class ConsoleAdminOrganizationUsersRoute extends Route {
const users = await this.fetch.get(`companies/${id}/users`);
return users.toArray();
}
-
- /**
- * Sets up the controller with the company ID.
- *
- * @method setupController
- * @param {Controller} controller - The controller for this route.
- * @param {Array} model - An array containing the users associated with the company.
- */
- setupController(controller, model) {
- super.setupController(controller, model);
- controller.companyId = model.company_id;
- }
}
diff --git a/console/app/templates/console/admin/organizations/index.hbs b/console/app/templates/console/admin/organizations/index.hbs
index a57f4fc9..27d453e0 100644
--- a/console/app/templates/console/admin/organizations/index.hbs
+++ b/console/app/templates/console/admin/organizations/index.hbs
@@ -1,4 +1,4 @@
-<Layout::Section::Header @title="Organizations" @searchQuery={{this.query}} @onSearch={{perform this.search}} />
+<Layout::Section::Header @title={{t "console.admin.organizations.index.title"}} @searchQuery={{this.query}} @onSearch={{perform this.search}} />
<Layout::Section::Body>
<Table
@@ -13,7 +13,7 @@
@onPageChange={{fn (mut this.page)}}
@tfootVerticalOffset="53"
@tfootVerticalOffsetElements=".next-view-section-subheader"
- @onRowClick={{fn this.goToCompany}}
+ @onRowClick={{this.goToCompany}}
/>
</Layout::Section::Body>
{{outlet}}
\ No newline at end of file
diff --git a/console/app/templates/console/admin/organizations/users.hbs b/console/app/templates/console/admin/organizations/users.hbs
index 614881ad..3469185e 100644
--- a/console/app/templates/console/admin/organizations/users.hbs
+++ b/console/app/templates/console/admin/organizations/users.hbs
@@ -1,4 +1,4 @@
-<Layout::Section::Header @title='Users' @searchQuery={{this.query}} @onSearch={{perform this.search}} />
+<Layout::Section::Header @title={{t "console.admin.organizations.users.title"}} @searchQuery={{this.query}} @onSearch={{perform this.search}} />
<Layout::Section::Body>
<Table
diff --git a/console/router.map.js b/console/router.map.js
index 3ccde312..eeb7e69c 100644
--- a/console/router.map.js
+++ b/console/router.map.js
@@ -49,8 +49,10 @@ Router.map(function () {
this.route('notifications');
this.route('two-fa-settings');
this.route('virtual', { path: '/:slug/:view' });
- this.route('organizations');
- this.route('organization-users', { path: '/:company_id' });
+ this.route('organizations', function () {
+ this.route('index', { path: '/' });
+ this.route('users', { path: '/:company_id' });
+ });
});
});
this.route('install');
diff --git a/console/translations/en-us.yaml b/console/translations/en-us.yaml
index d3ca0162..3b1d4d92 100644
--- a/console/translations/en-us.yaml
+++ b/console/translations/en-us.yaml
@@ -46,6 +46,10 @@ common:
two-factor: Two Factor
uploading: Uploading...
your-profile: Your Profile
+ created-at: Created At
+ country: Country
+ phone-number: Phone
+ status: Status
component:
two-fa-enforcement-alert:
message: To enhance the security of your account, your organization requires Two-Factor Authentication (2FA). Enable 2FA in your account settings for an additional layer of protection.
@@ -152,6 +156,11 @@ console:
notifications:
title: Notifications
notification-settings: Notification Settings
+ organizations:
+ index:
+ title: Organizations
+ users:
+ title: Users
settings:
index:
title: Organization Settings