NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

handleFormChange = (index, event, sectioncnt, dropdowntype) => {
let data = this.state.Sections;

// //Restrict input more then the provided max length for numeric fields.
// if (data[sectioncnt].sectionControls[index].controlboxType === "number") {
// let value=event.target.value.replace(/[,]/g, "").trim()
// if(value.length > data[sectioncnt].sectionControls[index].controlMaxLength ){
// return
// }
// }

//Restrict input more then the provided max length for text fields.
if (data[sectioncnt].sectionControls[index].controlboxType === "text" && data[sectioncnt].sectionControls[index].controlID === "ORGANIZATIONNAME") {
if (event.target.value.trim().length > data[sectioncnt].sectionControls[index].controlMaxLength) {
return;
}
}

let isCyber = data.filter((section) => section.sectionTitle === "Coverages")[0].sectionControls.filter((control) => control.controlID === "CYBER_CVRG")[0].controlValue;
if (data[sectioncnt].sectionControls[index].controlboxType === "number") {
const validated = event.target.value.match(/^(d*.{0,1}d{0,2}$)/);
if (validated) {
data[sectioncnt].sectionControls[index]["controlValue"] = event.target.value;
}
}
if (data[sectioncnt].sectionControls[index].controlboxType === "date") {
if (event.target.value != null) {
let expiration_date;

if (data[sectioncnt].sectionControls[index].controlID === "EFFECTIVEDATE") {
this.state.effectiveDateVal = event.target.value;

data[sectioncnt].sectionControls[index]["controlValue"] = moment(this.state.effectiveDateVal, "MM-DD-YYYY");

//let EffectiveDateValue = data[sectioncnt].sectionControls.filter(e => e.controlID === "expirationDate");


this.state.EffectiveDateValue = moment(event.target.value).format("MM-DD-YYYY");
if (this.state.EffectiveDateValue !== "" && this.state.ExpirationDateValue !== "" && this.state.PolicyNumberValue !== "") {
if (this.isCyber === "Blend") {
this.fetchCyberRaterData(this.state.OpportunityIDValue, this.state.EffectiveDateValue, this.state.ExpirationDateValue);
}
}

let expiratioDateConrols = data[sectioncnt].sectionControls.filter((e) => e.controlID === "EXPIRATIONDATE");

if (data[sectioncnt].sectionControls.filter((e) => e.controlID === "EXPIRATIONDATE")) {
let expirationDate = this.state.effectiveDateVal.setFullYear(this.state.effectiveDateVal.getFullYear() + 1);

expiratioDateConrols[0].controlValue = moment(expirationDate).format("MM-DD-YYYY");
expiratioDateConrols[0].isRequiredValid = "no-error";
this.state.ExpirationDateValue = moment(expirationDate).format("MM-DD-YYYY");
if (this.state.EffectiveDateValue !== "" && this.state.ExpirationDateValue !== "" && this.state.OpportunityIDValue !== "") {
if (isCyber === "Blend") {
this.fetchCyberRaterData(this.state.OpportunityIDValue, this.state.EffectiveDateValue, this.state.ExpirationDateValue);
}
}
}
}

if (data[sectioncnt].sectionControls[index].controlID === "EXPIRATIONDATE") {
expiration_date = moment(event.target.value).format("MM-DD-YYYY");
let expiratioDateConrols = data[sectioncnt].sectionControls.filter((e) => e.controlID === "EXPIRATIONDATE");

let EffectiveDate = data[sectioncnt].sectionControls.filter((e) => e.controlID === "EFFECTIVEDATE");

expiratioDateConrols[0].controlValue = this.checkDateValidation(EffectiveDate[0].controlValue, expiration_date, data[sectioncnt].sectionControls[index]);
this.state.ExpirationDateValue = expiration_date;
if (this.state.EffectiveDateValue !== "" && this.state.ExpirationDateValue !== "" && this.state.OpportunityIDValue !== "") {
if (isCyber === "Blend") {
this.fetchCyberRaterData(this.state.OpportunityIDValue, this.state.EffectiveDateValue, this.state.ExpirationDateValue);
}
}
}
} else {
data[sectioncnt].sectionControls[index].controlValue = "";
}
if (moment(data[sectioncnt].sectionControls[index].controlValue).format("MM-DD-YYYY") != "Invalid date") {
data[sectioncnt].sectionControls[index].isRequiredValid = "no-error";
} else {
data[sectioncnt].sectionControls[index].isRequiredValid = "has-error";
}
}

if (data[sectioncnt].sectionControls[index].controlID === "OPPORTUNITY_ID") {
data[sectioncnt].sectionControls[index].controlValue = event.target.value;
this.state.OpportunityIDValue = event.target.value;
if (this.state.EffectiveDateValue !== "" && this.state.ExpirationDateValue !== "" && this.state.OpportunityIDValue !== "") {
if (isCyber === "Blend") {
this.fetchCyberRaterData(this.state.OpportunityIDValue, this.state.EffectiveDateValue, this.state.ExpirationDateValue);
}
}
} else {
if (dropdowntype === "Shared Limit") {
data[sectioncnt].sectionControls[index]["sharedLimit"].controlValue = event.target.value;
} else {
data[sectioncnt].sectionControls[index]["controlValue"] = event.target.value;
let controlData = data[sectioncnt].sectionControls[index]["controlData"];
if (controlData) {
var filteredData = controlData.filter((e) => e.value === event.target.value);
data[sectioncnt].sectionControls[index]["factor"] = filteredData[0]?.factor;
}
}
}
if (data[sectioncnt].sectionControls[index].controlID === "Class") {
let policyeffectiveDate = data.filter((e) => e.sectionTitle === "General Underwriting Information")[0].sectionControls.filter((control) => control.controlID === "EFFECTIVEDATE");
if (data[sectioncnt].sectionControls[index].controlValue == "Producers") {
this.state.policyCalculationYear = 3;
if (policyeffectiveDate[0].controlValue != "") {
confirmAlert({
message: "Is this a 3 year term ?",
buttons: [
{
label: "Yes",
onClick: () => {
this.state.policyCalculationYear = 3;
data.filter((e) => e.sectionTitle === "General Underwriting Information")[0].sectionControls.filter((control) => control.controlID === "EXPIRATIONDATE")[0].controlValue = moment(
new Date(policyeffectiveDate[0].controlValue).setFullYear(new Date(policyeffectiveDate[0].controlValue).getFullYear() + this.state.policyCalculationYear)
).format("MM-DD-YYYY");
this.setState({
Sections: data,
});
},
},
{
label: "No",
onClick: () => {
this.state.policyCalculationYear = 1;
},
},
],
});
}
} else {
this.state.policyCalculationYear = 1;
if (policyeffectiveDate[0].controlValue != "") {
data.filter((e) => e.sectionTitle === "General Underwriting Information")[0].sectionControls.filter((control) => control.controlID === "EXPIRATIONDATE")[0].controlValue = moment(
new Date(policyeffectiveDate[0].controlValue).setFullYear(new Date(policyeffectiveDate[0].controlValue).getFullYear() + this.state.policyCalculationYear)
).format("MM-DD-YYYY");
}
}
}

this.setState({Sections: data});
if (data[sectioncnt].sectionControls[index].controlType === "DropDown") {
let coveragesDropdown = ["MISC_CVRG", "TECH_CVRG", "MEDIA_CVRG", "CYBER_CVRG"];
if (coveragesDropdown.includes(data[sectioncnt].sectionControls[index].controlID)) {

this.handleTabs(data[sectioncnt].sectionControls[index]);
}
}

this.getTotalCoverageSharedLimit(sectioncnt);
};

checkDateValidation(startDate, expirationDate, control) {
const year = new Date(expirationDate).getFullYear();
if (year.toString().length >= 4) {
if (new Date(startDate) < new Date(expirationDate)) {
return expirationDate;
} else {
ExpirationDateValidation();
return moment(new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 1)).format("MM-DD-YYYY");
}
} else {
return expirationDate;
}
}

Test cases:

Verify policy effective & policy expiration dates are having the terms like 1 or 3 term policy.

Verify when user try to enter the dates manually it should allow to enter it manually.

verify user can enter manually in policy expiration date with out fail.

verify after changing the dates user should bale to save & calculate the data with out fail.

Verify asterisk is displaying near these fields, as these are mandatory fields.

Verify summary should display same dates as in policy information page.

Verify Current Vs Prior Year comparison table is fetching dates from policy information page.

Verify Rate Change Calculator is fetching dates from policy information page.



     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.