Skip to content

Commit b133194

Browse files
committed
Display and edit Event Name #12, Display and edit Event Visibility #25
1 parent 9e96e5f commit b133194

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

webapp/controller/CreateEntity.controller.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
sap.ui.define([
22
"com/sap/sapmentors/sitreg/events/controller/BaseController",
33
"sap/ui/model/json/JSONModel",
4+
"com/sap/sapmentors/sitreg/events/model/formatter",
45
"sap/m/MessageBox"
56

6-
], function(BaseController, JSONModel, MessageBox) {
7+
], function(BaseController, JSONModel, formatter, MessageBox) {
78
"use strict";
89

910
return BaseController.extend("com.sap.sapmentors.sitreg.events.controller.CreateEntity", {
11+
12+
formatter: formatter,
1013

1114
_oBinding: {},
1215

@@ -53,8 +56,17 @@ sap.ui.define([
5356
*/
5457
onSave: function() {
5558
var that = this,
56-
oModel = this.getModel();
59+
oModel = this.getModel(),
60+
oView = this.getView();
5761

62+
var oContext = oView.getBindingContext();
63+
var sPathVisible = oContext.getPath() + "/Visible";
64+
var bVisible = oView.byId("Visible_id").getState();
65+
if(bVisible) {
66+
oModel.setProperty(sPathVisible, "Y");
67+
} else {
68+
oModel.setProperty(sPathVisible, "N");
69+
}
5870
// abort if the model has not been changed
5971
if (!oModel.hasPendingChanges()) {
6072
MessageBox.information(

webapp/view/CreateEntity.view.xml

+12-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
enabled="{= ${viewModel>/mode} === 'edit'? false: true}" visible="true"
1313
value="{ path: 'ID', type: 'sap.ui.model.odata.type.Int32' , constraints:{ nullable:false } }"/>
1414
<Label text="{i18n>Location}" required="false"/>
15-
<Input name="Location" id="Location_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="true" visible="true"
15+
<Input name="Location" id="Location_id" valueLiveUpdate="true"
16+
liveChange="_validateSaveEnablement" enabled="true" visible="true"
1617
value="{ path: 'Location', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:100 } }"/>
18+
<Label text="{i18n>Description}" required="false"/>
19+
<Input name="Description" id="Description_id" valueLiveUpdate="true"
20+
liveChange="_validateSaveEnablement" enabled="true" visible="true"
21+
value="{ path: 'Description', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:100 } }"/>
1722
<Label text="{i18n>EventDate}" required="false"/>
1823
<DatePicker name="EventDate" value="{ path: 'EventDate', type: 'sap.ui.model.type.Date'}" id="EventDate_id" enabled="true"
1924
visible="true" valueFormat="yyyy-MM-dd" displayFormat="long"/>
@@ -29,6 +34,12 @@
2934
<Label text="{i18n>HomepageURL}" required="false"/>
3035
<Input name="HomepageURL" id="HomepageURL_id" valueLiveUpdate="true" liveChange="_validateSaveEnablement" enabled="true" visible="true"
3136
value="{ path: 'HomepageURL', type: 'sap.ui.model.odata.type.String' , constraints:{ maxLength:256 } }"/>
37+
<Label text="{i18n>Visible}" required="false"/>
38+
<Switch
39+
id="Visible_id"
40+
state="{= ${Visible} === 'Y' ? true : false }"
41+
customTextOn="Yes"
42+
customTextOff="No"/>
3243
</f:content>
3344
</f:SimpleForm>
3445
</semantic:content>

webapp/view/Detail.view.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
busyIndicatorDelay="{detailView>/delay}">
1414
<semantic:content>
1515
<ObjectHeader id="objectHeader"
16-
title="{Location}"
16+
title="{Description}"
1717
numberUnit="{i18n>detailEventID}: {ID}"
18-
number="{ path: 'EventDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }" />
18+
number="{ path: 'EventDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }">
19+
<ObjectAttribute text="{Location}" />
20+
</ObjectHeader>
1921
<IconTabBar id="iconTabBar" class="sapUiResponsiveContentPadding">
2022
<items>
2123
<IconTabFilter id="iconTabBarFilter1"

webapp/view/EventForm.fragment.xml

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<Text text="{History.ChangedBy}"/>
2323
<Label text="{i18n>HistoryChangedAt}"/>
2424
<Text text="{ path: 'History.ChangedAt', type: 'sap.ui.model.type.Date', formatOptions: { style: 'medium' } }"/>
25+
<Label text="{i18n>Visible}" required="false"/>
26+
<Switch state="{= ${Visible} === 'Y' ? true : false }"
27+
customTextOn="Yes"
28+
customTextOff="No"/>
2529
<Label text="{i18n>EventChangeable}"/>
2630
<Text text="{EventChangeable/Changeable}"/>
2731
</f:content>

0 commit comments

Comments
 (0)