-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New Components - limoexpress #16933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
luancazarine
wants to merge
8
commits into
master
Choose a base branch
from
issue-16907
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New Components - limoexpress #16933
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a31d6d1
limoexpress init
luancazarine 8b76745
[Components] limoexpress #16907
luancazarine 46804d5
pnpm update
luancazarine 048c838
Merge branch 'master' into issue-16907
luancazarine dfcdaf5
pnpm update
luancazarine b9cb3b4
some adjusts
luancazarine 182d103
pnpm update
luancazarine e0feef7
pnpm update
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ export default { | |
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; | ||
}; |
294 changes: 294 additions & 0 deletions
294
components/limoexpress/actions/create-booking/create-booking.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,294 @@ | ||
import { PRICE_TYPE_OPTIONS } from "../../common/constants.mjs"; | ||
import { throwError } from "../../common/utils.mjs"; | ||
import limoexpress from "../../limoexpress.app.mjs"; | ||
|
||
export default { | ||
key: "limoexpress-create-booking", | ||
name: "Create Limo Booking", | ||
description: "Creates a new limo booking with specified details. [See the documentation](https://api.limoexpress.me/api/docs/v1#/Bookings/createBooking)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
limoexpress, | ||
bookingTypeId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"bookingTypeId", | ||
], | ||
}, | ||
bookingStatusId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"bookingStatusId", | ||
], | ||
optional: true, | ||
}, | ||
fromLocationName: { | ||
type: "string", | ||
label: "From Location Name", | ||
description: "The pickup location name.", | ||
}, | ||
fromLocationFullAddress: { | ||
type: "string", | ||
label: "From Location Full Address", | ||
description: "The pickup location full address.", | ||
}, | ||
fromLocationLatitude: { | ||
type: "string", | ||
label: "From Location Latitude", | ||
description: "The pickup location latitude.", | ||
optional: true, | ||
}, | ||
fromLocationLongitude: { | ||
type: "string", | ||
label: "From Location Longitude", | ||
description: "The pickup location longitude.", | ||
optional: true, | ||
}, | ||
toLocationName: { | ||
type: "string", | ||
label: "To Location Name", | ||
description: "The dropoff location name.", | ||
}, | ||
toLocationFullAddress: { | ||
type: "string", | ||
label: "To Location Full Address", | ||
description: "The dropoff location full address.", | ||
}, | ||
toLocationLatitude: { | ||
type: "string", | ||
label: "To Location Latitude", | ||
description: "The dropoff location latitude.", | ||
optional: true, | ||
}, | ||
toLocationLongitude: { | ||
type: "string", | ||
label: "To Location Longitude", | ||
description: "The dropoff location longitude.", | ||
optional: true, | ||
}, | ||
pickupTime: { | ||
type: "string", | ||
label: "Pickup Time", | ||
description: "The time scheduled for pickup. **Format: YYYY-MM-DD HH:MM:SS**", | ||
}, | ||
expectedDropOffTime: { | ||
type: "string", | ||
label: "Expected Drop Off Time", | ||
description: "The expected drop off time. **Format: YYYY-MM-DD HH:MM:SS**", | ||
optional: true, | ||
}, | ||
expectedComebackTime: { | ||
type: "string", | ||
label: "Expected Comeback Time", | ||
description: "The expected comeback time. **Format: YYYY-MM-DD HH:MM:SS**", | ||
optional: true, | ||
}, | ||
vehicleClassId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"vehicleClassId", | ||
], | ||
withLabel: true, | ||
optional: true, | ||
}, | ||
vehicleId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"vehicleId", | ||
({ vehicleClassId }) => ({ | ||
vehicleClassId: vehicleClassId.label, | ||
}), | ||
], | ||
optional: true, | ||
}, | ||
price: { | ||
type: "string", | ||
label: "Price", | ||
description: "The price of the booking.", | ||
optional: true, | ||
}, | ||
priceType: { | ||
type: "string", | ||
label: "Price Type", | ||
description: "The type of price for the booking.", | ||
options: PRICE_TYPE_OPTIONS, | ||
optional: true, | ||
}, | ||
commissionAmount: { | ||
type: "string", | ||
label: "Commission Amount", | ||
description: "The commission amount for the booking.", | ||
optional: true, | ||
}, | ||
currencyId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"currencyId", | ||
], | ||
optional: true, | ||
}, | ||
vatPercentage: { | ||
type: "string", | ||
label: "VAT Percentage", | ||
description: "The VAT percentage for the booking.", | ||
optional: true, | ||
}, | ||
paymentMethodId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"paymentMethodId", | ||
], | ||
optional: true, | ||
}, | ||
distance: { | ||
type: "integer", | ||
label: "Distance", | ||
description: "Number of kilometers/miles that booking will take.", | ||
optional: true, | ||
}, | ||
duration: { | ||
type: "string", | ||
label: "Duration", | ||
description: "Number of hours and minutes that booking will take. **Format: HH:MM**", | ||
optional: true, | ||
}, | ||
paid: { | ||
type: "boolean", | ||
label: "Paid", | ||
description: "Flag that says is the booking paid or not.", | ||
optional: true, | ||
}, | ||
confirmed: { | ||
type: "boolean", | ||
label: "Confirmed", | ||
description: "Flag that says is the booking confirmed or not.", | ||
optional: true, | ||
}, | ||
roundTrip: { | ||
type: "boolean", | ||
label: "Round Trip", | ||
description: "Flag that says is the booking a round trip or not.", | ||
optional: true, | ||
}, | ||
note: { | ||
type: "string", | ||
label: "Note", | ||
description: "Note for the dispatcher.", | ||
optional: true, | ||
}, | ||
noteForDriver: { | ||
type: "string", | ||
label: "Note for Driver", | ||
description: "Note for the driver.", | ||
optional: true, | ||
}, | ||
flightNumber: { | ||
type: "string", | ||
label: "Flight Number", | ||
description: "Flight number for the booking.", | ||
optional: true, | ||
}, | ||
numOfWaitingHours: { | ||
type: "integer", | ||
label: "Number of Waiting Hours", | ||
description: "Number of waiting hours.", | ||
optional: true, | ||
}, | ||
clientId: { | ||
propDefinition: [ | ||
limoexpress, | ||
"clientId", | ||
], | ||
optional: true, | ||
}, | ||
waitingBoardText: { | ||
type: "string", | ||
label: "Waiting Board Text", | ||
description: "Text that will be places on the waiting board.", | ||
optional: true, | ||
}, | ||
babySeatCount: { | ||
type: "integer", | ||
label: "Baby Seat Count", | ||
description: "Number of baby seats that will be used for the booking.", | ||
optional: true, | ||
}, | ||
suitcaseCount: { | ||
type: "integer", | ||
label: "Suitcase Count", | ||
description: "Number of suitcases that will be used for the booking.", | ||
optional: true, | ||
}, | ||
checkpoints: { | ||
type: "string[]", | ||
label: "Checkpoints", | ||
description: "List of objects of checkpoints location and time. **Format: [{\"location\": { \"name\": string, \"full_address\": string, \"coordinates\": { \"lat\": number, \"lng\": number } }, \"time\": \"01:14\"}]**", | ||
optional: true, | ||
}, | ||
passengers: { | ||
type: "string[]", | ||
label: "Passengers", | ||
description: "List of objects of passengers. **Format: [{\"first_name\": string, \"last_name\": string, \"phone\": string, \"email\": string, \"nationality\": string, \"passport\": string, \"country_id\": UUID }]", | ||
optional: true, | ||
}, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
async run({ $ }) { | ||
try { | ||
const response = await this.limoexpress.createBooking({ | ||
$, | ||
data: { | ||
booking_type_id: this.bookingTypeId, | ||
booking_status_id: this.bookingStatusId, | ||
from_location: { | ||
name: this.fromLocationName, | ||
full_address: this.fromLocationFullAddress, | ||
coordinates: { | ||
lat: this.fromLocationLatitude, | ||
lng: this.fromLocationLongitude, | ||
}, | ||
}, | ||
to_location: { | ||
name: this.toLocationName, | ||
full_address: this.toLocationFullAddress, | ||
coordinates: { | ||
lat: this.toLocationLatitude, | ||
lng: this.toLocationLongitude, | ||
}, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
pickup_time: this.pickupTime, | ||
expected_drop_off_time: this.expectedDropOffTime, | ||
expected_comeback_time: this.expectedComebackTime, | ||
vehicle_class_id: this.vehicleClassId.value, | ||
vehicle_id: this.vehicleId, | ||
price: this.price && parseFloat(this.price), | ||
price_type: this.priceType, | ||
commission_amount: this.commissionAmount && parseFloat(this.commissionAmount), | ||
currency_id: this.currencyId, | ||
vat_percentage: this.vatPercentage && parseFloat(this.vatPercentage), | ||
payment_method_id: this.paymentMethodId, | ||
distance: this.distance, | ||
duration: this.duration, | ||
paid: this.paid, | ||
confirmed: this.confirmed, | ||
round_trip: this.roundTrip, | ||
note: this.note, | ||
note_for_driver: this.noteForDriver, | ||
flight_number: this.flightNumber, | ||
num_of_waiting_hours: this.numOfWaitingHours, | ||
client_id: this.clientId, | ||
waiting_board_text: this.waitingBoardText, | ||
baby_seat_count: this.babySeatCount, | ||
suitcase_count: this.suitcaseCount, | ||
checkpoints: this.checkpoints, | ||
passengers: this.passengers, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created booking with ID ${response.data.id}`); | ||
return response; | ||
} catch ({ response }) { | ||
throwError(response); | ||
} | ||
}, | ||
}; |
68 changes: 68 additions & 0 deletions
68
components/limoexpress/actions/create-client/create-client.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { TYPE_OPTIONS } from "../../common/constants.mjs"; | ||
import { throwError } from "../../common/utils.mjs"; | ||
import limoexpress from "../../limoexpress.app.mjs"; | ||
|
||
export default { | ||
key: "limoexpress-create-client", | ||
name: "Create Client", | ||
description: "Creates a new client with specified details. [See the documentation](https://api.limoexpress.me/api/docs/v1#/Clients/createAOrganisationClient)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
limoexpress, | ||
name: { | ||
type: "string", | ||
label: "Name", | ||
description: "Name of the client.", | ||
}, | ||
address: { | ||
type: "string", | ||
label: "Address", | ||
description: "Address of the client.", | ||
optional: true, | ||
}, | ||
phone: { | ||
type: "string", | ||
label: "Phone", | ||
description: "Phone of the client.", | ||
optional: true, | ||
}, | ||
email: { | ||
type: "string", | ||
label: "Email", | ||
description: "Email of the client.", | ||
optional: true, | ||
}, | ||
type: { | ||
type: "string", | ||
label: "Type", | ||
description: "Type of the client.", | ||
options: TYPE_OPTIONS, | ||
}, | ||
active: { | ||
type: "boolean", | ||
label: "Active", | ||
description: "Active flag is the class active or not.", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
try { | ||
const response = await this.limoexpress.createClient({ | ||
$, | ||
data: { | ||
name: this.name, | ||
address: this.address, | ||
phone: this.phone, | ||
email: this.email, | ||
type: this.type, | ||
active: this.active, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created client with ID ${response.data.id}`); | ||
return response; | ||
} catch ({ response }) { | ||
throwError(response); | ||
} | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.