Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .cdsrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"comment": "will not longer be needed with cds^9.5",
"features": {
"compile_for_flows": true
}
Expand Down
4 changes: 4 additions & 0 deletions _i18n/i18n_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Agency=Agency
AgencyName=Agency Name
AvgPrice=Average Price
BeginDate=Starting Date
BlockTravel=Block Travel
Booking=Booking
BookingDate=Booking Date
BookingDetails=Booking Details
Expand Down Expand Up @@ -36,6 +37,8 @@ Prices=Prices
ProductID=Product
ProductPrice=Product Price
RejectTravel=Reject Travel
ReopenTravel=Reopen Travel
ReviewTravel=Review Travel
Status=Status
Street=Street
Title=Title
Expand All @@ -45,4 +48,5 @@ Travel=Travel
TravelAgency=Travel Agency
Travels=Travels
TravelStatus=Travel Status
UnblockTravel=Unblock Travel
WebAddress=Web Address
5 changes: 0 additions & 5 deletions app/travels/field-control.cds
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ annotate TravelService.Travels with @(Common : {
EndDate @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);
Agency @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);
Customer @readonly: (Status.code = #Accepted) @mandatory: (Status.code != #Accepted);

} actions {
rejectTravel @from: [#Open, #Accepted];
acceptTravel @from: [#Open, #Canceled];
deductDiscount @(
from: #Open,
Common.SideEffects.TargetProperties : ['in/TotalPrice', 'in/BookingFee'],
);
draftEdit @from: [#Open, #Accepted]
}

annotate TravelService.Travels @Common.SideEffects#ReactonItemCreationOrDeletion : {
Expand Down
18 changes: 13 additions & 5 deletions app/travels/layouts.cds
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ using { TravelService } from '../../srv/travel-service';
annotate TravelService.Travels with @UI : {

Identification : [
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.reviewTravel', Label : '{i18n>ReviewTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.reopenTravel', Label : '{i18n>ReopenTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.blockTravel', Label : '{i18n>BlockTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.unblockTravel', Label : '{i18n>UnblockTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.acceptTravel', Label : '{i18n>AcceptTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.rejectTravel', Label : '{i18n>RejectTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.deductDiscount', Label : '{i18n>DeductDiscount}' }
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.deductDiscount', Label : '{i18n>DeductDiscount}' },
],

HeaderInfo : {
Expand All @@ -35,6 +39,10 @@ annotate TravelService.Travels with @UI : {

LineItem : [

{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.reviewTravel', Label : '{i18n>ReviewTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.reopenTravel', Label : '{i18n>ReopenTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.blockTravel', Label : '{i18n>BlockTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.unblockTravel', Label : '{i18n>UnblockTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.acceptTravel', Label : '{i18n>AcceptTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.rejectTravel', Label : '{i18n>RejectTravel}' },
{ $Type : 'UI.DataFieldForAction', Action : 'TravelService.deductDiscount', Label : '{i18n>DeductDiscount}' },
Expand All @@ -50,8 +58,8 @@ annotate TravelService.Travels with @UI : {
{ Value : (Status.code),
Criticality : (
Status.code == #Accepted ? 3 :
Status.code == #Open ? 2 :
Status.code == #Canceled ? 1 : 0
Status.code == #Open OR Status.code == #InReview ? 2 :
Status.code == #Canceled OR Status.code == #Blocked ? 1 : 0
),
@UI.Importance : #High,
@HTML5.CssDefaults: {width:'10em'}
Expand All @@ -74,8 +82,8 @@ annotate TravelService.Travels with @UI : {
{ Value : (Status.code),
Criticality : (
Status.code == #Accepted ? 3 :
Status.code == #Open ? 2 :
Status.code == #Canceled ? 1 : 0
Status.code == #Open OR Status.code == #InReview ? 2 :
Status.code == #Canceled OR Status.code == #Blocked ? 1 : 0
),
},
{ Value : BeginDate },
Expand Down
2 changes: 2 additions & 0 deletions db/data/sap.capire.travels-TravelStatus.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
code;name
O;Open
P;InReview
B;Blocked
A;Accepted
X;Canceled
Loading