Skip to content

Commit

Permalink
Merge pull request #19 from fleetbase/dev-v0.1.4
Browse files Browse the repository at this point in the history
v0.1.4
  • Loading branch information
roncodes authored Nov 16, 2023
2 parents ebc8ee9 + c5e344d commit 3c40d9e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 32 deletions.
1 change: 1 addition & 0 deletions addon/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default class ContactModel extends Model {
@attr('string') public_id;
@attr('string') company_uuid;
@attr('string') photo_uuid;
@attr('string') internal_id;

/** @relationships */
@belongsTo('file') photo;
Expand Down
1 change: 1 addition & 0 deletions addon/models/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class DriverModel extends Model {
@attr('string') vehicle_id;
@attr('string') vendor_id;
@attr('string') current_job_id;
@attr('string') internal_id;

/** @relationships */
@belongsTo('user', { async: true }) user;
Expand Down
68 changes: 38 additions & 30 deletions addon/models/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,125 +146,133 @@ export default class OrderModel extends Model {
}

@computed('updated_at') get updatedAgo() {
if (!this.updated_at) {
if (!isValidDate(this.updated_at)) {
return null;
}

return formatDistanceToNow(this.updated_at);
}

@computed('updated_at') get updatedAt() {
if (!this.updated_at) {
if (!isValidDate(this.updated_at)) {
return null;
}

return formatDate(this.updated_at, 'PP HH:mm');
}

@computed('updated_at') get updatedAtShort() {
if (!this.updated_at) {
if (!isValidDate(this.updated_at)) {
return null;
}

return formatDate(this.updated_at, 'PP');
}

@computed('created_at') get createdAgo() {
if (!this.created_at) {
if (!isValidDate(this.created_at)) {
return null;
}

return formatDistanceToNow(this.created_at);
}

@computed('created_at') get createdAt() {
if (!this.created_at) {
if (!isValidDate(this.created_at)) {
return null;
}

return formatDate(this.created_at, 'PP HH:mm');
}

@computed('created_at') get createdAtShort() {
if (!this.created_at) {
if (!isValidDate(this.created_at)) {
return null;
}

return formatDate(this.created_at, 'PP');
}

@computed('created_at') get createdAtWithTime() {
if (!isValidDate(this.created_at)) {
return null;
}

return formatDate(this.created_at, 'PP HH:mm');
}

@computed('created_at') get createdAtDetailed() {
if (!isValidDate(this.created_at)) {
return null;
}

return formatDate(this.created_at, 'PP HH:mm');
}

@computed('dispatched_at') get dispatchedAgo() {
if (!this.dispatched_at) {
return 'N/A';
if (!isValidDate(this.dispatched_at)) {
return null;
}

return formatDistanceToNow(this.dispatched_at);
}

@computed('dispatched_at') get dispatchedAt() {
if (!this.dispatched_at) {
return 'N/A';
if (!isValidDate(this.dispatched_at)) {
return null;
}

return formatDate(this.dispatched_at, 'PP HH:mm');
}

@computed('dispatched_at') get dispatchedAtShort() {
if (!this.dispatched_at) {
return 'N/A';
if (!isValidDate(this.dispatched_at)) {
return null;
}

return formatDate(this.dispatched_at, 'PP');
}

@computed('started_at') get startedAgo() {
if (!this.started_at) {
return 'N/A';
if (!isValidDate(this.started_at)) {
return null;
}

return formatDistanceToNow(this.started_at);
}

@computed('started_at') get startedAt() {
if (!this.started_at) {
return 'N/A';
if (!isValidDate(this.started_at)) {
return null;
}

return formatDate(this.started_at, 'PP HH:mm');
}

@computed('started_at') get startedAtShort() {
if (!this.started_at) {
return 'N/A';
if (!isValidDate(this.started_at)) {
return null;
}

return formatDate(this.started_at, 'PP');
}

@computed('scheduled_at') get scheduledAt() {
if (!this.scheduled_at || !isValidDate(this.scheduled_at)) {
return 'N/A';
if (!isValidDate(this.scheduled_at)) {
return null;
}

return formatDate(this.scheduled_at, 'PP HH:mm');
}

@computed('scheduled_at') get scheduledAtTime() {
if (!this.scheduled_at || !isValidDate(this.scheduled_at)) {
return 'N/A';
if (!isValidDate(this.scheduled_at)) {
return null;
}

return formatDate(this.scheduled_at, 'HH:mm');
}

@computed('created_at') get createdAtWithTime() {
return formatDate(this.created_at, 'PP HH:mm');
}

@computed('created_at') get createdAtDetailed() {
return formatDate(this.created_at, 'PP HH:mm');
}

// eslint-disable-next-line ember/use-brace-expansion
@computed('payload.isMultiDrop', 'payload.waypoints.[]', 'payload.pickup_uuid', 'payload.dropoff_uuid')
get isMultipleDropoffOrder() {
Expand Down
2 changes: 1 addition & 1 deletion addon/models/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class VehicleModel extends Model {
@attr('string') plate_number;
@attr('string') vin;
@attr('raw') vin_data;
@attr('raw') model;
@attr('raw') model_data;
@attr('raw') telematics;
@attr('raw') meta;
@attr('string') status;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/fleetops-data",
"version": "0.1.3",
"version": "0.1.4",
"description": "Fleetbase Fleet-Ops based models, serializers, transforms, adapters and GeoJson utility functions.",
"keywords": [
"fleetbase-data",
Expand Down

0 comments on commit 3c40d9e

Please sign in to comment.