Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8451

Re: full-dayhalf-day-customisation-of-my-leave-requests

$
0
0

Ah ok so it's similar to what i have.  So long as your dropdown options have a key that you can access then then you can set the submit method to do different things based on date and time.

 

First give the change event

so have method something like

selectChange: function(oEvent){

var key = oEvent.getSource().selectedKey();

 

if (key === "fullDay"){

--hide the time fields--

}

}

 

then the submit method is the big one that chooses what exactly to submit in to the database. this is my amended code based on my new inputs.

 

    submit: function ( ) {

         var s, S, e, E;

         var sD, eD, dU;

         this.bApproverOK = null;

         this.bSubmitOK = null;

         this.oSubmitResult = {};

         this.bSimulation = i;

         if (this.cale) {

             var _ = this._getStartEndDate(this.cale.getSelectedDates());

             if(this.fullDay.getSelected()===true){  // user selects a fullday

             if (this.timeFrom && this.timeTo && this.leaveType.AllowedDurationPartialDayInd) {

                 s = hcm.emp.myleaverequests.utils.Formatters.DATE_YYYYMMdd(_.startDate) + "T00:00:00";

                 if (this.timeFrom.getValue() === "") {

                     S = "PT00H00M00S";

                 } else {

                     S = "PT" + this.timeFrom.getValue().substring(0, 2) + "H" + this.timeFrom.getValue().substring(3, 5) + "M00S";

                 }

                 e = hcm.emp.myleaverequests.utils.Formatters.DATE_YYYYMMdd(_.endDate) + "T00:00:00";

                 if (this.timeTo.getValue() === "") {

                     E = "PT00H00M00S";

                 } else {

                     E = "PT" + this.timeTo.getValue().substring(0, 2) + "H" + this.timeTo.getValue().substring(3, 5) + "M00S";

                 }

             } else {

                 s = hcm.emp.myleaverequests.utils.Formatters.DATE_YYYYMMdd(_.startDate) + "T00:00:00";

                 S = "PT00H00M00S";

                 e = hcm.emp.myleaverequests.utils.Formatters.DATE_YYYYMMdd(_.endDate) + "T00:00:00";

                 E = "PT00H00M00S";

             }

             if (!this.oBusy) {

                 this.oBusy = new sap.m.BusyDialog();

             }

             this.oBusy.open();

             var n = "";

             if (this.note) {

                 n = this.note.getValue();

             }

             if (this.changeMode) {

                 hcm.emp.myleaverequests.utils.DataManager.changeLeaveRequest(this.oChangeModeData.employeeID, this.oChangeModeData.requestID, this.oChangeModeData.changeStateID, this.oChangeModeData.leaveKey, s, S, e, E, this.leaveType.AbsenceTypeCode, n, i, this.onSubmitLRCsuccess, this.onSubmitLRCfail);

             } else {

                 hcm.emp.myleaverequests.utils.DataManager.submitLeaveRequest(s, S, e, E, this.leaveType.AbsenceTypeCode, n, i, this.onSubmitLRCsuccess, this.onSubmitLRCfail);

             }

             }else{

              s = hcm.emp.myleaverequests.utils.Formatters.DATE_YYYYMMdd(_.startDate) + "T00:00:00";

              e = hcm.emp.myleaverequests.utils.Formatters.DATE_YYYYMMdd(_.endDate) + "T00:00:00";

              if (this.note) {

                 n = this.note.getValue();

              }

  if (this.changeMode) {

  if(this.halfDay.getSelected()=== true && this.am.getSelected()=== true){ //1 = First half leave, 2 = second half leave

              //yC = yes change , nC = no Change

                  var schedule = hcm.emp.myleaverequests.HCM_LR_CREExtension.utils.zDataManager.getWorkSchedulesForDay(s,e, this,1, n, i, "yC");

              } else{

              var schedule = hcm.emp.myleaverequests.HCM_LR_CREExtension.utils.zDataManager.getWorkSchedulesForDay(s,e, this,2, n, i, "yC");

              }

  }else{

              if(this.halfDay.getSelected()=== true && this.am.getSelected()=== true){ //1 = First half leave, 2 = second half leave

              //yC = yes change , nC = no Change

                  var schedule = hcm.emp.myleaverequests.HCM_LR_CREExtension.utils.zDataManager.getWorkSchedulesForDay(s,e, this,1, n, i, "nC");

              } else{

              var schedule = hcm.emp.myleaverequests.HCM_LR_CREExtension.utils.zDataManager.getWorkSchedulesForDay(s,e, this,2, n, i, "nC");

              }

  }

            

             }

         }

         if (this.extHookSubmit) {

             this.extHookSubmit();

         }

     },

 

 

Sorry the code looks rather messy here if you have any more questions about this let me know, but depending on weather the user whats a full, half-day(am or pm) the submit send the data to different functions


Viewing all articles
Browse latest Browse all 8451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>