Skip to content
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

Improved UX #912

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/travel_processor/layouts.cds
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ annotate TravelService.Travel with @UI : {
Label : '{i18n>Bookings}'
}],
FieldGroup#TravelData : { Data : [
{ Value : TravelID },
{ Value : to_Agency_AgencyID },
{ Value : to_Customer_CustomerID },
{ Value : to_Agency_AgencyID },
{ Value : Description },
{
$Type : 'UI.DataField',
Expand All @@ -116,7 +115,6 @@ annotate TravelService.Travel with @UI : {
FieldGroup #PriceData : {Data : [
{ $Type : 'UI.DataField', Value : BookingFee },
{ $Type : 'UI.DataField', Value : TotalPrice },
{ $Type : 'UI.DataField', Value : CurrencyCode_code }
]}
};

Expand Down
13 changes: 13 additions & 0 deletions srv/travel-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ class TravelService extends cds.ApplicationService { init() {
const { today } = cds.builtin.types.Date


/**
* Fill in primary keys for new Travels.
* Note: In contrast to Bookings and BookingSupplements that has to happen
* upon SAVE, as multiple users could create new Travels concurrently.
*/
this.before ('NEW', 'Travel.drafts', async req => {
let begin = new Date; begin.setDate (begin.getDate() + 1)
let end = new Date; end.setDate (begin.getDate() + 2)
req.data.BeginDate = begin.toISOString().slice(0,10) // today
req.data.EndDate = end.toISOString().slice(0,10) // today
req.data.BookingFee = 0
})

// Fill in alternative keys as consecutive numbers for new Travels, Bookings, and Supplements.
// Note: For Travels that can't be done at NEW events, that is when drafts are created,
// but on CREATE only, as multiple users could create new Travels concurrently.
Expand Down
Loading