Skip to content

Commit

Permalink
All Sprint 17 items
Browse files Browse the repository at this point in the history
  • Loading branch information
GolnarNaghavi committed Oct 24, 2024
1 parent cdd2939 commit 8ce32d2
Show file tree
Hide file tree
Showing 14 changed files with 440 additions and 172 deletions.
287 changes: 160 additions & 127 deletions CAPS/CustomWorkflowActivities/SetChildCareCapacityReporting.cs

Large diffs are not rendered by default.

24 changes: 15 additions & 9 deletions CAPS/CustomWorkflowActivities/ValidateProjectRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,14 +518,20 @@ protected override void Execute(CodeActivityContext executionContext)
isValid = false;
validationMessage.AppendLine("Project End Date needs to be filled in.");
}
if(netTotalUnder36Months.HasValue || netTotal30MonthsSchoolAge.HasValue|| netTotalPreSchool.HasValue ||
netTotalMultiAge.HasValue || netTotalSchoolAge.HasValue && indoorFloorPlan == null)
if((netTotalUnder36Months.HasValue && netTotalUnder36Months != 0) ||
(netTotal30MonthsSchoolAge.HasValue && netTotal30MonthsSchoolAge != 0) ||
(netTotalPreSchool.HasValue && netTotalPreSchool != 0) ||
(netTotalMultiAge.HasValue && netTotalMultiAge != 0) ||
(netTotalSchoolAge.HasValue && netTotalSchoolAge != 0) && indoorFloorPlan == null)
{
isValid = false;
validationMessage.AppendLine("Indoor Floor Plan needs to be filled in.");
}
if (netTotalUnder36Months.HasValue || netTotal30MonthsSchoolAge.HasValue || netTotalPreSchool.HasValue ||
netTotalMultiAge.HasValue || netTotalSchoolAge.HasValue && outdoorPlan == null)
if ((netTotalUnder36Months.HasValue && netTotalUnder36Months != 0) ||
(netTotal30MonthsSchoolAge.HasValue && netTotal30MonthsSchoolAge != 0) ||
(netTotalPreSchool.HasValue && netTotalPreSchool != 0) ||
(netTotalMultiAge.HasValue && netTotalMultiAge != 0) ||
(netTotalSchoolAge.HasValue && netTotalSchoolAge != 0) && outdoorPlan == null)
{
isValid = false;
validationMessage.AppendLine("Site Plan needs to be filled in.");
Expand All @@ -537,11 +543,11 @@ protected override void Execute(CodeActivityContext executionContext)
validationMessage.AppendLine("Project Budget needs to be filled in.");
}

if(doYouIntendSelfOperate == false && ifNoHaveUIdentifiedOperator == false && securingPublicNotProfitOperator == false)
{
isValid = false;
validationMessage.AppendLine("Please provide operator information");
}
//if(doYouIntendSelfOperate == false && ifNoHaveUIdentifiedOperator == false && securingPublicNotProfitOperator == false)
//{
// isValid = false;
// validationMessage.AppendLine("Please provide operator information");
//}
}
#endregion
#region Check All CC Project Requests Except CC-AFG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<control namespace="moeCAPS" constructor="AFGProjectsEditGridV2" version="0.0.35" display-name-key="AFGProjectsEditGridV2" description-key="AFGProjectsEditGridV2 description" control-type="standard" >
<control namespace="moeCAPS" constructor="AFGProjectsEditGridV2" version="0.0.36" display-name-key="AFGProjectsEditGridV2" description-key="AFGProjectsEditGridV2 description" control-type="standard" >
<!--external-service-usage node declares whether this 3rd party PCF control is using external service or not, if yes, this control will be considered as premium and please also add the external domain it is using.
If it is not using any external service, please set the enabled="false" and DO NOT add any domain below. The "enabled" will be false by default.
Example1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ a:hover {text-decoration: underline;}
overflow-x: scroll;
overflow-y: hidden;
width: 100%;
margin-left: 100px;
}

.moeCAPS\.AFGProjectsEditGridV2 .DataSetControl_grid-FullHeader {
Expand Down Expand Up @@ -89,6 +90,9 @@ a:hover {text-decoration: underline;}
padding:5px;
text-align: left;
white-space: nowrap;



}

.moeCAPS\.AFGProjectsEditGridV2 .DataSetControl_grid-headerColDel{
Expand All @@ -100,6 +104,11 @@ a:hover {text-decoration: underline;}
padding:5px;
text-align: left;
white-space: nowrap;
margin: 0;
padding-left: 0;
position: absolute;
left: 0;
margin-left: 40px;
}

.moeCAPS\.AFGProjectsEditGridV2 .DataSetControl_grid-dataScroll {
Expand Down Expand Up @@ -143,6 +152,7 @@ a:hover {text-decoration: underline;}
padding: 5px;
white-space: nowrap;
z-index:1;
margin-left: 0px;
}

.moeCAPS\.AFGProjectsEditGridV2 .DataSetControl_grid-dataCol input {
Expand All @@ -168,6 +178,10 @@ a:hover {text-decoration: underline;}
white-space: nowrap;
z-index:1;
cursor: grab;
position: absolute;
left: 0;
justify-self : start;
margin-left: 20px;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LocalizedName description="AFGProjectsEditGrid_V2" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.34</Version>
<Version>1.35</Version>
<!-- Solution Package Type: Unmanaged(0)/Managed(1)/Both(2)-->
<Managed>2</Managed>
<Publisher>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<control namespace="CCAFGProjectsGridPCFNS" constructor="CCAFGProjectsGridPCF" version="0.0.99" display-name-key="CCAFGProjectsGridPCF" description-key="CCAFGProjectsGridPCF description" control-type="standard" >
<control namespace="CCAFGProjectsGridPCFNS" constructor="CCAFGProjectsGridPCF" version="0.0.109" display-name-key="CCAFGProjectsGridPCF" description-key="CCAFGProjectsGridPCF description" control-type="standard" >
<!--external-service-usage node declares whether this 3rd party PCF control is using external service or not, if yes, this control will be considered as premium and please also add the external domain it is using.
If it is not using any external service, please set the enabled="false" and DO NOT add any domain below. The "enabled" will be false by default.
Example1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ a:hover {text-decoration: underline;}
overflow-x: scroll;
overflow-y: hidden;
width: 100%;
margin-left: 100px;
}

.CCAFGProjectsGridPCFNS\.CCAFGProjectsGridPCF .DataSetControl_grid-FullHeader {
Expand Down Expand Up @@ -58,6 +59,7 @@ a:hover {text-decoration: underline;}
padding-left: 0px;
margin-top: 20px;*/
text-align: left;

}

.CCAFGProjectsGridPCFNS\.CCAFGProjectsGridPCF .DataSetControl_category-header input {
Expand Down Expand Up @@ -89,6 +91,8 @@ a:hover {text-decoration: underline;}
padding:5px;
text-align: left;
white-space: nowrap;


}

.CCAFGProjectsGridPCFNS\.CCAFGProjectsGridPCF .DataSetControl_grid-headerColDel{
Expand All @@ -100,6 +104,11 @@ a:hover {text-decoration: underline;}
padding:5px;
text-align: left;
white-space: nowrap;
margin: 0;
padding-left: 0;
position: absolute;
left: 0;
margin-left: 40px;
}

.CCAFGProjectsGridPCFNS\.CCAFGProjectsGridPCF .DataSetControl_grid-dataScroll {
Expand Down Expand Up @@ -143,6 +152,7 @@ a:hover {text-decoration: underline;}
padding: 5px;
white-space: nowrap;
z-index:1;
margin-left: 0px;
}

.CCAFGProjectsGridPCFNS\.CCAFGProjectsGridPCF .DataSetControl_grid-dataCol input {
Expand All @@ -168,6 +178,10 @@ a:hover {text-decoration: underline;}
white-space: nowrap;
z-index:1;
cursor: grab;
position: absolute;
left: 0;
justify-self : start;
margin-left: 20px;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LocalizedName description="CCAFGProjectsGridPCFSolution" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.98</Version>
<Version>1.108</Version>
<!-- Solution Package Type: Unmanaged(0)/Managed(1)/Both(2)-->
<Managed>2</Managed>
<Publisher>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"use strict";

var CAPS = CAPS || {};
CAPS.ChildCareQuarterlyReport = CAPS.ChildCareQuarterlyReport || {

};

CAPS.ChildCareQuarterlyReport.onLoad = function (executionContext) {

var formContext = executionContext.getFormContext();
CAPS.ChildCareQuarterlyReport.ShowHideFields(executionContext);
formContext.getAttribute("caps_notdirectlyoperatingsecuredauthorizedoperator").addOnChange(CAPS.ChildCareQuarterlyReport.ShowHideFields);
formContext.getAttribute("caps_whattypeofauthorizedoperator").addOnChange(CAPS.ChildCareQuarterlyReport.ShowHideFields);
formContext.getAttribute("caps_receivedfundingfromadditionalsources").addOnChange(CAPS.ChildCareQuarterlyReport.ShowHideFields);
};

CAPS.ChildCareQuarterlyReport.ShowHideFields = function (executionContext) {

var formContext = executionContext.getFormContext();
if (formContext.getAttribute("caps_selfoperated").getValue() === true) {
formContext.getControl("caps_notdirectlyoperatingsecuredauthorizedoperator").setVisible(false);
}
else {
formContext.getControl("caps_notdirectlyoperatingsecuredauthorizedoperator").setVisible(true);
}
//If no Or Information Previously Provided Or Self Operated is Yes
if (formContext.getAttribute("caps_notdirectlyoperatingsecuredauthorizedoperator").getValue() === 746660001 ||
formContext.getAttribute("caps_notdirectlyoperatingsecuredauthorizedoperator").getValue() === 746660002 ||
formContext.getAttribute("caps_notdirectlyoperatingsecuredauthorizedoperator").getValue() === null ||
formContext.getAttribute("caps_selfoperated").getValue() === true) {
formContext.getControl("caps_whattypeofauthorizedoperator").setVisible(false);
formContext.getControl("caps_forprofitoperatorjustification").setVisible(false);
formContext.getAttribute("caps_whattypeofauthorizedoperator").setValue(null);
formContext.getAttribute("caps_forprofitoperatorjustification").setValue(null);
}
else {
formContext.getControl("caps_whattypeofauthorizedoperator").setVisible(true);
//If what type of authorized operator is Public/Not-For-Profit
if (formContext.getAttribute("caps_whattypeofauthorizedoperator").getValue() === 746660000 ||
formContext.getAttribute("caps_whattypeofauthorizedoperator").getValue() === null) {
formContext.getControl("caps_forprofitoperatorjustification").setVisible(false);
formContext.getAttribute("caps_forprofitoperatorjustification").setValue(null);
}
else {
formContext.getControl("caps_forprofitoperatorjustification").setVisible(true);
}
}
//If Received funding from additional sources is No or Information Previously Provided
if (formContext.getAttribute("caps_receivedfundingfromadditionalsources").getValue() === 746660001 ||
formContext.getAttribute("caps_receivedfundingfromadditionalsources").getValue() === 746660002 ||
formContext.getAttribute("caps_receivedfundingfromadditionalsources").getValue() === null) {
formContext.getControl("caps_amountreceivedandfromwhom").setVisible(false);
formContext.getAttribute("caps_amountreceivedandfromwhom").setValue(null);
}
else {
formContext.getControl("caps_amountreceivedandfromwhom").setVisible(true);
}

}
123 changes: 99 additions & 24 deletions CAPS/WebResources/Scripts/FormHandler/caps_Project.Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ CAPS.Project.onLoad = function (executionContext) {
CAPS.Project.PopulateAddress(executionContext);
formContext.getAttribute("caps_facility").addOnChange(CAPS.Project.PopulateAddress);
formContext.getAttribute("caps_existingfacility").addOnChange(CAPS.Project.PopulateAddress);
formContext.getAttribute("caps_existingchildcarefacility").addOnChange(CAPS.Project.PopulateAddress);
formContext.getAttribute("caps_childcare").addOnChange(CAPS.Project.PopulateAddress);
}

formContext.getAttribute("caps_areyourelocatingexistingchildcarespaces").addOnChange(CAPS.Project.HideTotalChildCareSpace);
Expand Down Expand Up @@ -1604,36 +1606,109 @@ CAPS.Project.ToggleExistingChildCareFacility = function (executionContext) {

}

CAPS.Project.PopulateAddress = function (executionContext) {
CAPS.Project.PopulateAddress = async function (executionContext) {
debugger;
var formContext = executionContext.getFormContext();
var schoolFacility = CAPS.Project.GetLookup("caps_facility", formContext);
if (schoolFacility !== undefined) {

var options = "?$select=caps_streetaddress,caps_postalcode";
Xrm.WebApi.retrieveRecord("caps_facility", CAPS.Project.RemoveCurlyBraces(schoolFacility.id), options).then(
function success(result) {
debugger;
var streetAddress = result.caps_streetaddress;
var postalCode = result.caps_postalcode;
formContext.getAttribute("caps_streetaddress").setValue(streetAddress);
formContext.getAttribute("caps_postcode").setValue(postalCode);
formContext.getAttribute("caps_streetaddress").controls.forEach(control => control.setDisabled(true));
formContext.getAttribute("caps_postcode").controls.forEach(control => control.setDisabled(true));

},
function (error) {
console.log(error.message);
}
);
var expansionOfExistingCCFacility = formContext.getAttribute("caps_existingchildcarefacility").getValue();
var submissionCategoryCode = formContext.getAttribute("caps_submissioncategorycode").getValue();

if (expansionOfExistingCCFacility === true) {
formContext.getAttribute("caps_streetaddress").controls.forEach(control => control.setDisabled(true));
formContext.getAttribute("caps_postcode").controls.forEach(control => control.setDisabled(true));
formContext.getAttribute("caps_postcode").setRequiredLevel("none");
var childCareFacility = CAPS.Project.GetLookup("caps_childcare", formContext);

if (childCareFacility === undefined) {
formContext.getAttribute("caps_streetaddress").setValue(null);
formContext.getAttribute("caps_postcode").setValue(null);

}
else if (childCareFacility !== undefined) {
CAPS.Project.SetAddressFromCCFacility(formContext, childCareFacility);
}
}
else {
else if (expansionOfExistingCCFacility === false) {

formContext.getAttribute("caps_streetaddress").setValue(null);
formContext.getAttribute("caps_postcode").setValue(null);
formContext.getAttribute("caps_streetaddress").controls.forEach(control => control.setDisabled(false));
formContext.getAttribute("caps_postcode").controls.forEach(control => control.setDisabled(false));

if (submissionCategoryCode === "Major_CC_New_Spaces" || submissionCategoryCode === "CC_MAJOR_NEW_SPACES_INTEGRATED") {
var existingSchoolFacilitySite = formContext.getAttribute("caps_existingfacility").getValue();

if (existingSchoolFacilitySite === false) {
formContext.getAttribute("caps_streetaddress").setValue(null);
formContext.getAttribute("caps_postcode").setValue(null);
formContext.getAttribute("caps_postcode").setRequiredLevel("required");
formContext.getAttribute("caps_streetaddress").controls.forEach(control => control.setDisabled(false));
formContext.getAttribute("caps_postcode").controls.forEach(control => control.setDisabled(false));
}
else if (existingSchoolFacilitySite === true) {
formContext.getAttribute("caps_postcode").setRequiredLevel("none");
var schoolFacility = CAPS.Project.GetLookup("caps_facility", formContext);
if (schoolFacility !== undefined) {
CAPS.Project.SetAddressFromSchoolFacility(formContext, schoolFacility);
}
}
}
else if (submissionCategoryCode === "CC_CONVERSION" || submissionCategoryCode === "CC_CONVERSION_MINOR") {
var schoolFacility = CAPS.Project.GetLookup("caps_facility", formContext);
if (schoolFacility !== undefined) {
CAPS.Project.SetAddressFromSchoolFacility(formContext, schoolFacility);
}
}
else if (submissionCategoryCode === "CC_UPGRADE_MINOR" || submissionCategoryCode === "CC_UPGRADE") {
var childCareFacility = CAPS.Project.GetLookup("caps_childcare", formContext);

if (childCareFacility === undefined) {
formContext.getAttribute("caps_streetaddress").setValue(null);
formContext.getAttribute("caps_postcode").setValue(null);
}
else if (childCareFacility !== undefined) {
CAPS.Project.SetAddressFromCCFacility(formContext, childCareFacility);
}
}

}

}

CAPS.Project.SetAddressFromCCFacility = async function (formContext, childCareFacility) {
try {
var ccFacilityOptions = "?$select=_caps_facility_value";
const childCareFacilityResult = await Xrm.WebApi.retrieveRecord("caps_childcare", CAPS.Project.RemoveCurlyBraces(childCareFacility.id), ccFacilityOptions);
var schoolFacilityBasedOnCC = childCareFacilityResult._caps_facility_value;

var schoolFacilityOoptions = "?$select=caps_streetaddress,caps_postalcode";
const schoolFacilityResult = await Xrm.WebApi.retrieveRecord("caps_facility", schoolFacilityBasedOnCC, schoolFacilityOoptions);
var streetAddress = schoolFacilityResult.caps_streetaddress;
var postalCode = schoolFacilityResult.caps_postalcode;
formContext.getAttribute("caps_streetaddress").setValue(streetAddress);
formContext.getAttribute("caps_postcode").setValue(postalCode);
formContext.getAttribute("caps_streetaddress").controls.forEach(control => control.setDisabled(true));
formContext.getAttribute("caps_postcode").controls.forEach(control => control.setDisabled(true));

} catch (error) {
console.log("Error during retrieve:", error);
}
}

CAPS.Project.SetAddressFromSchoolFacility = function (formContext, schoolFacility) {
var options = "?$select=caps_streetaddress,caps_postalcode";
return Xrm.WebApi.retrieveRecord("caps_facility", CAPS.Project.RemoveCurlyBraces(schoolFacility.id), options).then(
function success(result) {
debugger;
var streetAddress = result.caps_streetaddress;
var postalCode = result.caps_postalcode;
formContext.getAttribute("caps_streetaddress").setValue(streetAddress);
formContext.getAttribute("caps_postcode").setValue(postalCode);
formContext.getAttribute("caps_streetaddress").controls.forEach(control => control.setDisabled(true));
formContext.getAttribute("caps_postcode").controls.forEach(control => control.setDisabled(true));


},
function (error) {
console.log(error.message);
}
);
}

CAPS.Project.WipeSchoolFacility = function (executionContext) {
Expand Down
Loading

0 comments on commit 8ce32d2

Please sign in to comment.