Skip to content

Modular logistics and supply chain operating system (LSOS)

added fleetbase config file, added ability to set tz for user and organization

Ronald A. Richardsond61205d8987e
diff --git a/api/config/app.php b/api/config/app.php
index c8cb2158..0daffd9d 100644
--- a/api/config/app.php
+++ b/api/config/app.php
@@ -26,7 +26,7 @@ return [
|
*/
- 'env' => env('APP_ENV', 'production'),
+ 'env' => env('APP_ENV', env('ENVIRONMENT', 'production')),
/*
|--------------------------------------------------------------------------
diff --git a/console/app/controllers/console/account/index.js b/console/app/controllers/console/account/index.js
index 3b4dcc86..26fb856a 100644
--- a/console/app/controllers/console/account/index.js
+++ b/console/app/controllers/console/account/index.js
@@ -1,7 +1,9 @@
import Controller from '@ember/controller';
+import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { alias } from '@ember/object/computed';
+import { debug } from '@ember/debug';
import { task } from 'ember-concurrency';
export default class ConsoleAccountIndexController extends Controller {
@@ -40,6 +42,18 @@ export default class ConsoleAccountIndexController extends Controller {
*/
@alias('currentUser.user') user;
+ /**
+ * Available timezones for selection.
+ *
+ * @memberof ConsoleAccountIndexController
+ */
+ @tracked timezones = [];
+
+ constructor() {
+ super(...arguments);
+ this.loadTimezones.perform();
+ }
+
/**
* Handle upload of new photo
*
@@ -116,6 +130,19 @@ export default class ConsoleAccountIndexController extends Controller {
return isPasswordValid;
}
+ /**
+ * Load all available timezones from lookup.
+ *
+ * @memberof ConsoleAccountIndexController
+ */
+ @task *loadTimezones() {
+ try {
+ this.timezones = yield this.fetch.get('lookup/timezones');
+ } catch (error) {
+ debug(`Unable to load timezones : ${error.message}`);
+ }
+ }
+
/**
* Checks if any user attribute has been changed
*
diff --git a/console/app/controllers/console/settings/index.js b/console/app/controllers/console/settings/index.js
index f98a5b67..03b45e06 100644
--- a/console/app/controllers/console/settings/index.js
+++ b/console/app/controllers/console/settings/index.js
@@ -2,6 +2,8 @@ import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
+import { debug } from '@ember/debug';
+import { task } from 'ember-concurrency';
export default class ConsoleSettingsIndexController extends Controller {
/**
@@ -25,13 +27,6 @@ export default class ConsoleSettingsIndexController extends Controller {
*/
@service fetch;
- /**
- * The request loading state.
- *
- * @memberof ConsoleSettingsIndexController
- */
- @tracked isLoading = false;
-
/**
* the upload queue.
*
@@ -46,23 +41,32 @@ export default class ConsoleSettingsIndexController extends Controller {
*/
@tracked uploadedFiles = [];
+ /**
+ * Available timezones for selection.
+ *
+ * @memberof ConsoleAccountIndexController
+ */
+ @tracked timezones = [];
+
+ constructor() {
+ super(...arguments);
+ this.loadTimezones.perform();
+ }
+
/**
* Save the organization settings.
*
* @memberof ConsoleSettingsIndexController
*/
- @action saveSettings(event) {
- event.preventDefault();
- this.isLoading = true;
+ @task *saveSettings(event) {
+ event?.preventDefault();
- this.model
- .save()
- .then(() => {
- this.notifications.success('Organization changes successfully saved.');
- })
- .finally(() => {
- this.isLoading = false;
- });
+ try {
+ yield this.model.save();
+ this.notifications.success('Organization changes successfully saved.');
+ } catch (error) {
+ debug(`Unable to save organization settings : ${error.message}`);
+ }
}
/**
@@ -91,4 +95,17 @@ export default class ConsoleSettingsIndexController extends Controller {
}
);
}
+
+ /**
+ * Load all available timezones from lookup.
+ *
+ * @memberof ConsoleAccountIndexController
+ */
+ @task *loadTimezones() {
+ try {
+ this.timezones = yield this.fetch.get('lookup/timezones');
+ } catch (error) {
+ debug(`Unable to load timezones : ${error.message}`);
+ }
+ }
}
diff --git a/console/app/templates/console/account/index.hbs b/console/app/templates/console/account/index.hbs
index b5cb0719..a02349a7 100644
--- a/console/app/templates/console/account/index.hbs
+++ b/console/app/templates/console/account/index.hbs
@@ -33,6 +33,9 @@
<PhoneInput @value={{this.user.phone}} @onInput={{fn (mut this.user.phone)}} class="form-input input-lg w-full" />
</InputGroup>
<InputGroup @name={{t "common.date-of-birth"}} @type="date" @value={{this.user.date_of_birth}} />
+ <InputGroup @name={{t "common.timezone"}} @helpText={{t "console.account.index.timezone"}}>
+ <Select @value={{this.user.timezone}} @options={{this.timezones}} @onSelect={{fn (mut this.user.timezone)}} @placeholder={{t "console.account.index.timezone"}} />
+ </InputGroup>
</div>
<div class="mt-3 flex items-center justify-end">
<Button @buttonType="submit" @type="primary" @size="lg" @icon="save" @text={{t "common.save-button-text"}} @onClick={{perform this.saveProfile}} @isLoading={{not this.saveProfile.isIdle}} />
diff --git a/console/app/templates/console/settings/index.hbs b/console/app/templates/console/settings/index.hbs
index 47a0446e..9768a5d5 100644
--- a/console/app/templates/console/settings/index.hbs
+++ b/console/app/templates/console/settings/index.hbs
@@ -4,7 +4,7 @@
<div class="container mx-auto h-screen">
<div class="max-w-3xl my-10 mx-auto space-y-6">
<ContentPanel @title={{t "console.settings.index.title"}} @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
- <form {{on "submit" this.saveSettings}}>
+ <form {{on "submit" (perform this.saveSettings)}}>
<InputGroup @name={{t "console.settings.index.organization-name"}} @value={{@model.name}} />
<InputGroup @name={{t "console.settings.index.organization-description"}} @value={{@model.description}} />
<InputGroup @name={{t "console.settings.index.organization-phone"}}>
@@ -13,9 +13,12 @@
<InputGroup @name={{t "console.settings.index.organization-currency"}}>
<CurrencySelect @currency={{@model.currency}} @onCurrencyChange={{fn (mut @model.currency)}} @triggerClass="w-full form-select" />
</InputGroup>
+ <InputGroup @name={{t "common.timezone"}} @helpText={{t "console.settings.index.organization-timezone"}}>
+ <Select @value={{@model.timezone}} @options={{this.timezones}} @onSelect={{fn (mut @model.timezone)}} @placeholder={{t "console.settings.index.select-timezone"}} class="w-full form-select" />
+ </InputGroup>
<InputGroup @name={{t "console.settings.index.organization-id"}} @value={{@model.public_id}} @disabled={{true}} />
<div class="mt-3 flex items-center justify-end">
- <Button @buttonType="submit" @type="primary" @size="lg" @icon="save" @text="{{t "common.save-button-text"}}" @isLoading={{this.isLoading}} />
+ <Button @buttonType="submit" @type="primary" @size="lg" @icon="save" @text="{{t "common.save-button-text"}}" @isLoading={{this.saveSettings.isRunning}} />
</div>
</form>
</ContentPanel>
diff --git a/console/fleetbase.config.json b/console/fleetbase.config.json
new file mode 100644
index 00000000..f81ce25c
--- /dev/null
+++ b/console/fleetbase.config.json
@@ -0,0 +1,3 @@
+{
+ "API_HOST": "http://localhost:8000"
+}
diff --git a/console/translations/en-us.yaml b/console/translations/en-us.yaml
index ebdbb919..48e6f65f 100644
--- a/console/translations/en-us.yaml
+++ b/console/translations/en-us.yaml
@@ -75,6 +75,7 @@ common:
permissions-required-for-changes: You do not have the required permissions to make changes.
push-notifications: Push Notifications
role: Role
+ timezone: Timezone
component:
file:
dropdown-label: File actions
@@ -229,6 +230,7 @@ console:
upload-new: Upload new
phone: Your phone number.
photos: photos
+ timezone: Select your timezone.
admin:
schedule-monitor:
schedule-monitor: Schedule Monitor
@@ -301,6 +303,8 @@ console:
backdrop: Backdrop
backdrop-help-text: Optional banner or background image for your organization.
upload-new-backdrop: Upload new backdrop
+ organization-timezone: Select the default timezone for your organization.
+ select-timezone: Select timezone.
extensions:
title: Extensions are coming soon!
message: Please check back in the upcoming versions as we prepare to launch the Extensions repository and marketplace.
diff --git a/docker-compose.yml b/docker-compose.yml
index 7037dfce..7c7d5a26 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -63,7 +63,7 @@ services:
ports:
- "4200:4200"
volumes:
- - ./docker/fleetbase.config.json:/usr/share/nginx/html/fleetbase.config.json
+ - ./console/fleetbase.config.json:/usr/share/nginx/html/fleetbase.config.json
application:
image: fleetbase/fleetbase-api:v0.7.0