var ProductVm=function(n){var t=this;t.Id=ko.observable(n.Id);t.Name=ko.observable(n.Name)},ReportingProductVm=function(n){var t=this,i;t.items=ko.observableArray();i=ko.utils.arrayMap(n.ReportingProductViewModels,function(n){return new ProductVm(n)});t.items(i)},Submission=Submission||{};Submission.InstanceOfViewModel={};Submission.EditViewModelForSubmissionNewCurrentYear=function(){var n=this;n.PossibleSpecialAreas=ko.observableArray();n.PossibleSubmissionIntentions=ko.observableArray();n.PossibleSpecialProjects=ko.observableArray();n.ExchangeAllQuestionsSayYes=ko.observableArray();n.MedicareProductsForReportingProduct=ko.observableArray();n.MedicaidProductsForReportingProduct=ko.observableArray();n.ExchangeProductsForReportingProduct=ko.observableArray();n.CommercialProductsForReportingProduct=ko.observableArray();n.CahpsComponentsForReportingProduct=ko.observableArray();n.CahpsComponentsForReportingProductErrorMessages=ko.observableArray();n.CahpsComponentsAlreadyRequested=ko.observableArray();n.PossibleProductLines=ko.observableArray();n.PossibleFirstYearReportingUnitOperationalOptions=ko.observableArray();n.PossibleFirstYearReportingUnitOperationalOptions.push(2014);n.PossibleFirstYearReportingUnitOperationalOptions.push(2015);n.PossibleFirstYearReportingUnitOperationalOptions.push(2016);n.PossibleFirstYearReportingUnitOperationalOptions.push(2017);n.PossibleFirstYearReportingUnitOperationalOptions.push(2018);n.PossibleFirstYearReportingUnitOperationalOptions.push(2019);n.PossibleFirstYearReportingUnitOperationalOptions.push(2020);n.PossibleFirstYearReportingUnitOperationalOptions.push(2021);n.PossibleIsReportingUnitOperationalOptions=ko.observableArray();n.PossibleIsReportingUnitOperationalOptions.push(!0);n.PossibleIsReportingUnitOperationalOptions.push(!1);n.IsSpecialProjectEnabled=ko.observable(!0);n.IsSpecialAreaEnabled=ko.observable(!0);n.SaveAttempted=ko.observable(!1);n.SelectedFirstYearReportingUnitOperational=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()!==null&&n.SelectedProductLine()!==undefined&&n.SelectedProductLine()===5}}});n.SelectedIsReportingUnitOperational=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()!==null&&n.SelectedProductLine()!==undefined&&n.SelectedProductLine()===5}}});n.SelectedReportingProduct=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()!==null&&n.SelectedProductLine()!==undefined}},validation:[{validator:function(){return n.SelectedProductLine()===1?ko.utils.arrayFirst(n.CommercialProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProduct()&&t.Exists})!==null:n.SelectedProductLine()===3?ko.utils.arrayFirst(n.MedicareProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProduct()&&t.Exists})!==null:n.SelectedProductLine()===2?ko.utils.arrayFirst(n.MedicaidProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProduct()&&t.Exists})!==null:n.SelectedProductLine()===5?ko.utils.arrayFirst(n.ExchangeProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProduct()&&t.Exists})!==null:void 0},message:"You are attempting to request a submission and have not completed the corresponding product information. Please click Product on the menu bar and click the View/Edit link to complete the product information.",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedReportingProduct()!==undefined}},{validator:function(t){return ko.utils.arrayFirst(n.ExchangeAllQuestionsSayYes(),function(n){return n.Id===t&&n.Exists})!==null},message:'You have chosen "No" to the enrollment questions or have indicated this product will discontinue prior to June 15, 2020.',onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===5&&n.SelectedReportingProduct()!==undefined}},{validator:function(t){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===2&&n.SelectedReportingProduct&&t&&t!==1&&t!==3&&n.SelectedSpecialProject&&n.SelectedSpecialProject()&&n.SelectedSpecialProject()===367?!1:!0},message:"You must select either HMO or POS if the special project is LTSS",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===2&&n.SelectedReportingProduct&&n.SelectedReportingProduct()&&n.SelectedSpecialProject&&n.SelectedSpecialProject()}}]});n.ShowReportingProductNeedsApproval=ko.computed(function(){return n.SelectedReportingProduct&&n.SelectedReportingProduct()?n.SelectedReportingProduct()===1||n.SelectedReportingProduct()===2||n.SelectedReportingProduct()===3||n.SelectedReportingProduct()===4||n.SelectedReportingProduct()===6||n.SelectedReportingProduct()===12?!1:!0:!1});n.SelectedProductLine=ko.observable().extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()}}});n.ReportingProductViewModels=ko.observable();n.SelectedProductLine.subscribe(function(t){if(n.SelectedCmsSubmissionType(undefined),n.SelectedAdultCahpsRequested(null),n.SelectedChildCahpsRequested(null),n.SelectedChildCahpsCCCRequested(null),n.SelectedQHPSurveyRequested(null),n.SelectedIsAuditRequired(null),n.SelectedSoftwareQuestionId(null),n.SelectedIdss(null),n.SelectedIsThisAnOPMSubmission(null),n.SelectedFehbId1(""),n.SelectedFehbId2(""),n.SelectedFehbId3(""),n.SelectedFehbId4(""),n.SelectedFehbId5(""),n.SelectedFehbId6(""),n.SelectedFehbId7(""),n.SelectedFehbId8(""),n.SelectedFehbId9(""),n.SelectedFehbId10(""),n.SelectedCmsContractNumber(""),n.SelectedCmsMarketArea(null),n.SelectedIssuerId(""),n.SaveAttempted(!1),n.SelectedCmsSubmissionType(undefined),n.SelectedSpecialArea(undefined),n.SelectedSpecialProject(undefined),n.SelectedReportingProduct(undefined),t===5?(n.SelectedQHPSurveyRequested(!0),n.SelectedCmsSubmissionType(3),n.SelectedSpecialArea(0),n.SelectedSpecialProject(254),n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0),n.IsSpecialAreaEnabled(!1),n.IsSpecialProjectEnabled(!1)):t===3?(n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0)):(n.SelectedCmsSubmissionType(undefined),n.SelectedIsAuditRequired(null),n.SelectedIdss(null),n.IsSpecialAreaEnabled(!0),n.IsSpecialProjectEnabled(!0),n.SelectedSpecialArea(null),n.SelectedSpecialProject(null)),t){var i=ko.utils.arrayFilter(n.PossibleProductLines(),function(n){return n.Id===t})[0],r=new ReportingProductVm(i);n.ReportingProductViewModels(r.items())}});n.SelectedState=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===5&&n.SaveAttempted()}}});n.SelectedCmsContractNumber=ko.observable().extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===3&&n.SaveAttempted()}},pattern:{params:"^(H|R)[0-9]{4}?$",message:"CMS Contract # must start with H or R followed by four numbers",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===3&&n.SaveAttempted()}}});n.SelectedCmsMarketArea=ko.observable();n.SelectedReportingUnitId=ko.computed(function(){return n.SelectedState&&n.SelectedState()&&n.SelectedIssuerId&&n.SelectedIssuerId()&&n.SelectedReportingProduct&&n.SelectedReportingProduct()?n.SelectedIssuerId()+"-"+n.SelectedState().Id()+"-"+(n.SelectedReportingProduct()===1?"HMO":n.SelectedReportingProduct()===3?"POS":n.SelectedReportingProduct()===4?"PPO":"EPO"):""});n.SelectedIssuerId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===5}},inputmask:{params:"99999",message:"Please enter 5 digit codes only",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===5}}});n.FilteredSubmissionIntentions=ko.computed(function(){var t,i;return n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()!==3?n.PossibleSubmissionIntentions():n.SelectedProductLine&&n.SelectedProductLine()&&n.SelectedProductLine()===3?n.SelectedReportingProduct&&n.SelectedReportingProduct()&&n.SelectedReportingProduct()===1?(t=ko.observableArray([{Id:1,Name:"CMS (Medicare Advantage) Submission"},{Id:2,Name:"Special Needs Plan"},{Id:3,Name:"Other (Accreditation, state, etc.)"},{Id:4,Name:"MMP HMO Demonstration"}]),t()):(i=ko.observableArray([{Id:1,Name:"CMS (Medicare Advantage) Submission"},{Id:2,Name:"Special Needs Plan"},{Id:3,Name:"Other (Accreditation, state, etc.)"}]),i()):n.PossibleSubmissionIntentions()});n.SelectedReportingProduct.subscribe(function(t){var r,i;t&&(r=ko.utils.arrayFirst(n.CahpsComponentsForReportingProduct(),function(n){return n.Id===t}),n.SelectedMedicaidScoringComponent(r.CahpsComponent));n.SelectedProductLine&&n.SelectedProductLine()===3&&(n.SelectedCmsSubmissionType(undefined),n.SelectedSpecialArea(undefined),n.SelectedSpecialProject(undefined),n.IsSpecialProjectEnabled(!0),n.IsSpecialAreaEnabled(!0));n.SelectedProductLine&&n.SelectedProductLine()===5&&(i=ko.utils.arrayFirst(n.ExchangeAllQuestionsSayYes(),function(n){return n.Id===t&&n.Exists}),i===undefined||i===null)});n.SelectedCmsSubmissionType=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()&&(n.SelectedProductLine&&n.SelectedProductLine()===1||n.SelectedProductLine&&n.SelectedProductLine()===2||n.SelectedProductLine&&n.SelectedProductLine()===5||n.SelectedProductLine&&n.SelectedProductLine()===3)}}});n.SelectedSpecialProject=ko.observable(null).extend({validation:[{validator:function(t){return n.SaveAttempted()&&n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType()===2&&t===0?!1:!0},message:"Required",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedReportingProduct()!==undefined}}]});n.FilteredSpecialProjects=ko.computed(function(){return n.SelectedProductLine&&n.SelectedProductLine()!==3?(n.SelectedProductLine()!==5?n.IsSpecialProjectEnabled(!0):n.IsSpecialProjectEnabled(!1),n.PossibleSpecialProjects()):n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType&&n.SelectedCmsSubmissionType()===2?(n.IsSpecialProjectEnabled(!0),ko.utils.arrayFilter(n.PossibleSpecialProjects(),function(n){return n.Id>=189&&n.Id<=191||n.Id===0})):n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType&&n.SelectedCmsSubmissionType()===1?(n.IsSpecialProjectEnabled(!1),ko.utils.arrayFilter(n.PossibleSpecialProjects(),function(n){return n.Id===51})):n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType&&n.SelectedCmsSubmissionType()===4?(n.IsSpecialProjectEnabled(!1),ko.utils.arrayFilter(n.PossibleSpecialProjects(),function(n){return n.Id===253})):(n.IsSpecialProjectEnabled(!0),n.PossibleSpecialProjects())});n.SelectedSpecialProject.subscribe(function(t){n.SelectedProductLine()===2&&t===367&&(n.SelectedIsAuditRequired(!0),n.SelectedCmsSubmissionType(3),n.SelectedIdss(!0))});n.FilteredSpecialAreas=ko.computed(function(){return n.SelectedProductLine&&n.SelectedProductLine()!==3?(n.SelectedProductLine&&n.SelectedProductLine()===5?n.IsSpecialAreaEnabled(!1):n.IsSpecialAreaEnabled(!0),n.PossibleSpecialAreas()):n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType()===2?ko.utils.arrayFilter(n.PossibleSpecialAreas(),function(t){return n.IsSpecialAreaEnabled(!0),t.Name.indexOf("SNP")===0||t.Id===0}):n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType()===4?ko.utils.arrayFilter(n.PossibleSpecialAreas(),function(t){return n.IsSpecialAreaEnabled(!0),t.Id===456||t.Id===505||t.Id===506||t.Id===507||t.Id===0}):n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType()===1?ko.utils.arrayFilter(n.PossibleSpecialAreas(),function(t){return n.IsSpecialAreaEnabled(!1),t.Id===0}):(n.IsSpecialAreaEnabled(!0),n.PossibleSpecialAreas())});n.SelectedSpecialArea=ko.observable(null).extend({validation:[{validator:function(t){return n.SaveAttempted()&&n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType()===2&&t===0?!1:n.SaveAttempted()&&n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedCmsSubmissionType()===4&&t===0?!1:!0},message:"Required",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()===3&&n.SelectedReportingProduct()!==undefined}}]});n.SelectedMedicaidScoringComponent=ko.observable().extend({validation:[{validator:function(){return!(n.SelectedMedicaidScoringComponent&&n.SelectedMedicaidScoringComponent()===null&&n.SelectedProductLine&&n.SelectedProductLine()===2&&n.SelectedReportingProduct()!==undefined)},message:"No CAHPS component selected for this component.  Please select the Products tab and edit an existing Medicaid product and select a CAHPS Component that needs to be scored.",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&n.SelectedReportingProduct()!==undefined}},{validator:function(){return!(n.SelectedMedicaidScoringComponent&&n.SelectedMedicaidScoringComponent()==="No CAHPS component selected for this component"&&n.SelectedProductLine&&n.SelectedProductLine()===2&&n.SelectedReportingProduct()!==undefined)},message:"You are attempting to request a submission and have not completed the corresponding product information. Please select the Products tab and click the new product button & complete the product information. Or, if you have discontinued the relevant product then please uncheck discontinued.",onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&n.SelectedReportingProduct()!==undefined}},{validator:function(){var t=ko.utils.arrayFirst(n.CahpsComponentsForReportingProductErrorMessages(),function(t){return t.Id===n.SelectedReportingProduct()});return t.IsCahpsComponentsSame},message:function(){var t=ko.utils.arrayFirst(n.CahpsComponentsForReportingProductErrorMessages(),function(t){return t.Id===n.SelectedReportingProduct()});return t.CahpsComponent},onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&n.SelectedReportingProduct()!==undefined}}]});n.IsSaveHappening=ko.observable(!1);n.SelectedSoftwareQuestionId=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()}}});n.SelectedSoftwareVendorId=ko.observable(0).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedSoftwareQuestionId()===2}}});n.SelectedSoftwareQuestionId.subscribe(function(t){t!==2&&n.SelectedSoftwareVendorId(undefined)});n.SelectedIsAuditRequired=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()}},validation:[{validator:function(){return n.SelectedMedicaidScoringComponent()==="Not Required"&&n.SelectedIsAuditRequired()===!0&&(n.SelectedAdultCahpsRequested()||n.SelectedChildCahpsRequested()||n.SelectedChildCahpsCCCRequested())?!1:!0},message:'Your Medicaid CAHPS scoring component cannot be "Not Required" if Audit Required is Yes. Please return to the Product step and update.',onlyIf:function(){return n.SelectedProductLine&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&n.SelectedReportingProduct()!==undefined}}]});n.SelectedAuditFirmId=ko.observable(0).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedIsAuditRequired()===!0}}});n.SelectedIsAuditRequired.subscribe(function(t){t||n.SelectedAuditFirmId(undefined)});n.SelectedIsThisAnOPMSubmission=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()===1}}});n.SelectedFehbId1=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1}},inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId1().length!==2}}});n.SelectedFehbId2=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId2()!==""&&n.SelectedFehbId2().length!==2}}});n.SelectedFehbId3=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId3()!==""&&n.SelectedFehbId3().length!==2}}});n.SelectedFehbId4=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId4()!==""&&n.SelectedFehbId4().length!==2}}});n.SelectedFehbId5=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId5()!==""&&n.SelectedFehbId5().length!==2}}});n.SelectedFehbId6=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId6()!==""&&n.SelectedFehbId6()!==null&&n.SelectedFehbId6().length!==2}}});n.SelectedFehbId7=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId7()!==""&&n.SelectedFehbId7()!==null&&n.SelectedFehbId7().length!==2}}});n.SelectedFehbId8=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId8()!==""&&n.SelectedFehbId8()!==null&&n.SelectedFehbId8().length!==2}}});n.SelectedFehbId9=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId9()!==""&&n.SelectedFehbId9()!==null&&n.SelectedFehbId9().length!==2}}});n.SelectedFehbId10=ko.observable("").extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLine()===1&&n.SelectedFehbId10()!==""&&n.SelectedFehbId10()!==null&&n.SelectedFehbId10().length!==2}}});n.SelectedIdss=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()}}});n.SelectedIdss.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedAdultCahpsRequested=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SaveAttempted()&&(n.SelectedProductLine()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!==367||n.SelectedProductLine()===1)}},validation:[{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="AdultCAHPS"&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since AdultCahps is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProduct&&n.SelectedReportingProduct()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProduct()&&t.CahpsComponent==="AdultCAHPS"});return n.SaveAttempted()&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&t===null}}}]});n.SelectedAdultCahpsRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedAdultCahpsComponentVendorId=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedAdultCahpsRequested()===!0&&!(n.SelectedSpecialProject()===367&&n.SelectedProductLine()===2)}}});n.SelectedAdultCahpsSampleFrame=ko.observable();n.SelectedAdultCahpsRequested.subscribe(function(t){t?n.SelectedAdultCahpsSampleFrame(1):(n.SelectedAdultCahpsComponentVendorId(undefined),n.SelectedAdultCahpsSampleFrame(undefined))});n.SelectedChildCahpsRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!==367}},validation:[{validator:function(){return!(n.SelectedChildCahpsRequested()&&n.SelectedChildCahpsCCCRequested())},message:"You may select ChildCAHPS OR ChildCAHPSCCC but not both on the same submission.",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367}},{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="ChildCAHPS"&&n.SelectedChildCahpsRequested&&n.SelectedChildCahpsRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since ChildCahps is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProduct&&n.SelectedReportingProduct()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProduct()&&t.CahpsComponent==="ChildCAHPS"});return n.SaveAttempted()&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&t===null}}}]});n.SelectedChildCahpsRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedChildCahpsComponentVendorId=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedChildCahpsRequested()===!0&&!(n.SelectedSpecialProject()===367&&n.SelectedProductLine()===2)}}});n.SelectedChildCahpsSampleFrame=ko.observable();n.SelectedChildCahpsRequested.subscribe(function(t){t?n.SelectedChildCahpsSampleFrame(1):(n.SelectedChildCahpsComponentVendorId(undefined),n.SelectedChildCahpsSampleFrame(undefined))});n.SelectedChildCahpsCCCRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!==367}},validation:[{validator:function(){return!(n.SelectedChildCahpsRequested()&&n.SelectedChildCahpsCCCRequested())},message:"You may select ChildCAHPS OR ChildCAHPSCCC but not both on the same submission.",onlyIf:function(){return n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367}},{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="ChildCAHPSCCC"&&n.SelectedChildCahpsCCCRequested&&n.SelectedChildCahpsCCCRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since ChildCAHPSCCC is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProduct&&n.SelectedReportingProduct()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProduct()&&t.CahpsComponent==="ChildCAHPSCCC"});return n.SaveAttempted()&&n.SelectedProductLine()===2&&n.SelectedSpecialProject()!==367&&t===null}}}]});n.SelectedChildCahpsCCCRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedChildCahpsCCCComponentVendorId=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedChildCahpsCCCRequested()===!0&&!(n.SelectedSpecialProject()===367&&n.SelectedProductLine()===2)}}});n.SelectedChildCahpsCCCSampleFrame=ko.observable();n.SelectedChildCahpsCCCRequested.subscribe(function(t){t?n.SelectedChildCahpsCCCSampleFrame(1):(n.SelectedChildCahpsCCCComponentVendorId(undefined),n.SelectedChildCahpsCCCSampleFrame(undefined))});n.SelectedQHPSurveyRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()===5}}});n.SelectedQHPSurveyComponentVendorId=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SaveAttempted()&&n.SelectedProductLine()===5&&n.SelectedQHPSurveyRequested()===!0}}});n.SelectedQHPSurveySampleFrame=ko.observable();n.SelectedQHPSurveyRequested.subscribe(function(t){t?n.SelectedQHPSurveySampleFrame(1):(n.SelectedQHPSurveyComponentVendorId(undefined),n.SelectedQHPSurveySampleFrame(undefined))});n.ShowIdssWarning=ko.observable(!1);n.errors=ko.validation.group([n.SelectedSoftwareQuestionId,n.SelectedSoftwareVendorId,n.SelectedIsAuditRequired,n.SelectedAuditFirmId,n.SelectedIsThisAnOPMSubmission,n.SelectedFehbId1,n.SelectedFehbId2,n.SelectedFehbId3,n.SelectedFehbId4,n.SelectedFehbId5,n.SelectedFehbId6,n.SelectedFehbId7,n.SelectedFehbId8,n.SelectedFehbId9,n.SelectedFehbId10,n.SelectedIdss,n.SelectedAdultCahpsRequested,n.SelectedAdultCahpsComponentVendorId,n.SelectedChildCahpsRequested,n.SelectedChildCahpsComponentVendorId,n.SelectedChildCahpsCCCRequested,n.SelectedChildCahpsCCCComponentVendorId,n.SelectedHOSFollowupRequested,n.SelectedHOSFollowupComponentVendorId,n.SelectedHOSBaselineRequested,n.SelectedHOSBaselineComponentVendorId,n.SelectedMedicaidScoringComponent,n.SelectedQHPSurveyRequested,n.SelectedQHPSurveyComponentVendorId,n.SelectedProductLine,n.SelectedReportingProduct,n.SelectedCmsSubmissionType,n.SelectedCmsContractNumber,n.SelectedState,n.SelectedIssuerId,n.SelectedSpecialProject,n.SelectedSpecialArea,n.SelectedFirstYearReportingUnitOperational,n.SelectedIsReportingUnitOperational]);n.save=function(){var t,i;if(n.SaveAttempted(!0),n.IsSaveHappening(!0),n.errors().length>0)return console.log(n.errors()),t={dir1:"up",dir2:"right",spacing1:0,spacing2:0},new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"Please correct the validations errors",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:1500,stack:t,type:"error"}),n.IsSaveHappening(!1),!1;if(n.SelectedProductLine()===2&&n.SelectedIdss&&n.SelectedIdss()===!1&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1&&n.SelectedChildCahpsRequested&&n.SelectedChildCahpsRequested()===!1&&n.SelectedChildCahpsCCCRequested&&n.SelectedChildCahpsCCCRequested()===!1||n.SelectedProductLine()===1&&n.SelectedIdss&&n.SelectedIdss()===!1&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1)return n.ShowIdssWarning(!0),n.IsSaveHappening(!1),!1;n.SelectedIsThisAnOPMSubmission()?(n.SelectedValues.FehbId1=n.SelectedFehbId1,n.SelectedValues.FehbId2=n.SelectedFehbId2,n.SelectedValues.FehbId3=n.SelectedFehbId3,n.SelectedValues.FehbId4=n.SelectedFehbId4,n.SelectedValues.FehbId5=n.SelectedFehbId5,n.SelectedValues.FehbId6=n.SelectedFehbId6,n.SelectedValues.FehbId7=n.SelectedFehbId7,n.SelectedValues.FehbId8=n.SelectedFehbId8,n.SelectedValues.FehbId9=n.SelectedFehbId9,n.SelectedValues.FehbId10=n.SelectedFehbId10):(n.SelectedValues.FehbId1="",n.SelectedValues.FehbId2="",n.SelectedValues.FehbId3="",n.SelectedValues.FehbId4="",n.SelectedValues.FehbId5="",n.SelectedValues.FehbId6="",n.SelectedValues.FehbId7="",n.SelectedValues.FehbId8="",n.SelectedValues.FehbId9="",n.SelectedValues.FehbId10="");n.SelectedValues.AuditFirmId=n.SelectedAuditFirmId()===undefined?-1:n.SelectedAuditFirmId();n.SelectedValues.IsAuditRequired=n.SelectedIsAuditRequired;n.SelectedValues.AdultCahpsRequested=n.SelectedAdultCahpsRequested;n.SelectedValues.AdultCahpsSubmissionComponentId=-1;n.SelectedValues.AdultCahpsComponentVendorId=n.SelectedAdultCahpsComponentVendorId()===undefined?-1:n.SelectedAdultCahpsComponentVendorId();n.SelectedValues.AdultCahpsSampleFrame=n.SelectedAdultCahpsSampleFrame()===undefined?-1:n.SelectedAdultCahpsSampleFrame();n.SelectedValues.ChildCahpsRequested=n.SelectedChildCahpsRequested;n.SelectedValues.ChildCahpsSubmissionComponentId=-1;n.SelectedValues.ChildCahpsComponentVendorId=n.SelectedChildCahpsComponentVendorId()===undefined?-1:n.SelectedChildCahpsComponentVendorId();n.SelectedValues.ChildCahpsSampleFrame=n.SelectedChildCahpsSampleFrame()===undefined?-1:n.SelectedChildCahpsSampleFrame();n.SelectedValues.ChildCahpsCCCRequested=n.SelectedChildCahpsCCCRequested;n.SelectedValues.ChildCahpsCCCSubmissionComponentId=-1;n.SelectedValues.ChildCahpsCCCComponentVendorId=n.SelectedChildCahpsCCCComponentVendorId()===undefined?-1:n.SelectedChildCahpsCCCComponentVendorId();n.SelectedValues.ChildCahpsCCCSampleFrame=n.SelectedChildCahpsCCCSampleFrame()===undefined?-1:n.SelectedChildCahpsCCCSampleFrame();n.SelectedValues.QHPSurveyRequested=n.SelectedQHPSurveyRequested;n.SelectedValues.QHPSurveySubmissionComponentId=-1;n.SelectedValues.QHPSurveyComponentVendorId=n.SelectedQHPSurveyComponentVendorId()===undefined?-1:n.SelectedQHPSurveyComponentVendorId();n.SelectedValues.QHPSurveySampleFrame=n.SelectedQHPSurveySampleFrame()===undefined?-1:n.SelectedQHPSurveySampleFrame();n.SelectedValues.IsThisAnOPMSubmission=n.SelectedIsThisAnOPMSubmission;n.SelectedValues.SoftwareVendorId=n.SelectedSoftwareVendorId()===undefined?-1:n.SelectedSoftwareVendorId();n.SelectedValues.SoftwareQuestionId=n.SelectedSoftwareQuestionId()===undefined?-1:n.SelectedSoftwareQuestionId();n.SelectedValues.Idss=n.SelectedIdss;n.SelectedValues.ProductLineId=n.SelectedProductLine();n.SelectedValues.ReportingProductId=n.SelectedReportingProduct();n.SelectedValues.CmsSubmissionTypeId=n.SelectedCmsSubmissionType?n.SelectedCmsSubmissionType():-1;n.SelectedValues.SpecialAreaId=n.SelectedSpecialArea?n.SelectedSpecialArea():-1;n.SelectedValues.SpecialProjectId=n.SelectedSpecialProject?n.SelectedSpecialProject():-1;n.SelectedValues.CmsContractNumber=n.SelectedCmsContractNumber();n.SelectedValues.CmsMarketAreaId=n.SelectedCmsMarketArea&&n.SelectedCmsMarketArea()?n.SelectedCmsMarketArea().Id():-1;n.SelectedValues.ReportingUnitId=n.SelectedProductLine()===5?n.SelectedReportingUnitId():"";n.SelectedValues.IssuerId=n.SelectedIssuerId();n.SelectedValues.FirstYearReportingUnitOperational=n.SelectedFirstYearReportingUnitOperational;n.SelectedValues.IsReportingUnitOperational=n.SelectedIsReportingUnitOperational;n.SelectedValues.ProductLine="";n.EisSubmissionId=-1;n.SubmissionId=-1;i=ko.mapping.toJSON(n.SelectedValues);$.ajax("Submissions/SaveSubmissionNewCurrentYear",{cache:!1,beforeSend:function(){$("div#spinner").show();$("#alert-error").hide()},type:"POST",contentType:"application/json",complete:function(){$("div#spinner").hide();n.IsSaveHappening(!1)},data:i,success:function(n){var t;try{n.data.DoesPreviousYearsSubmissionExist?(t={dir1:"up",dir2:"right",spacing1:0,spacing2:0},new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:n.data.MessageForDupSubmission,width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:8e3,stack:t,type:"error"})):($("#CreateSubmissionNewCurrentYear").modal("hide"),$("#btnAddOrUpdateRowToGrid").trigger("click",[n.data.SelectedValues.EisSubmissionId]))}catch(i){t={dir1:"up",dir2:"right",spacing1:0,spacing2:0};new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"An error occured while savings, please try again.",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:2500,stack:t,type:"error"});$("#CreateSubmissionNewCurrentYear").modal("hide")}},error:function(){new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"An error occured while savings, please try again.",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:2500,stack:{dir1:"up",dir2:"right",spacing1:0,spacing2:0},type:"error"})}})}};Submission=Submission||{};Submission.InstanceOfViewModel={};Submission.EditViewModelForSubmissionCurrentYear=function(){var n=this;n.IsRequested=ko.observable(!1);n.IsSharedSubmission=ko.observable(!1);n.SelectedSubmissionComponents=ko.observableArray();n.MedicareProductsForReportingProduct=ko.observableArray();n.MedicaidProductsForReportingProduct=ko.observableArray();n.ExchangeProductsForReportingProduct=ko.observableArray();n.CommercialProductsForReportingProduct=ko.observableArray();n.SelectedCmsSubmissionTypeId=ko.observable();n.SelectedReportingProductId=ko.observable();n.CahpsComponentsForReportingProduct=ko.observableArray();n.CahpsComponentsForReportingProductErrorMessages=ko.observableArray();n.CahpsComponentsAlreadyRequested=ko.observableArray();n.SubmissionId=ko.observable();n.PossibleFirstYearReportingUnitOperationalOptions=ko.observableArray();n.PossibleFirstYearReportingUnitOperationalOptions.push(2014);n.PossibleFirstYearReportingUnitOperationalOptions.push(2015);n.PossibleFirstYearReportingUnitOperationalOptions.push(2016);n.PossibleFirstYearReportingUnitOperationalOptions.push(2017);n.PossibleFirstYearReportingUnitOperationalOptions.push(2018);n.PossibleFirstYearReportingUnitOperationalOptions.push(2019);n.PossibleFirstYearReportingUnitOperationalOptions.push(2020);n.PossibleFirstYearReportingUnitOperationalOptions.push(2021);n.PossibleIsReportingUnitOperationalOptions=ko.observableArray();n.PossibleIsReportingUnitOperationalOptions.push(!0);n.PossibleIsReportingUnitOperationalOptions.push(!1);n.SelectedProductLine=ko.observable();n.SelectedSpecialArea=ko.observable();n.SelectedCmsContractNumber=ko.observable();n.SelectedIssuerId=ko.observable();n.SelectedReportingUnitId=ko.observable();n.SelectedFirstYearReportingUnitOperational=ko.observable().extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()!==null&&n.SelectedProductLineId()!==undefined&&n.SelectedProductLineId()===5}}});n.SelectedIsReportingUnitOperational=ko.observable().extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()!==null&&n.SelectedProductLineId()!==undefined&&n.SelectedProductLineId()===5}}});n.SelectedReportingProduct=ko.observable().extend({validation:[{validator:function(){return n.SelectedProductLineId()===1?ko.utils.arrayFirst(n.CommercialProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:n.SelectedProductLineId()===3?ko.utils.arrayFirst(n.MedicareProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:n.SelectedProductLineId()===2?ko.utils.arrayFirst(n.MedicaidProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:n.SelectedProductLineId()===5?ko.utils.arrayFirst(n.ExchangeProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:void 0},message:"You are attempting to request a submission and have not completed the corresponding product information. Please click Product on the menu bar and click the View/Edit link to complete the product information.",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()&&n.SelectedReportingProduct()!==undefined}}]});n.SelectedMedicaidScoringComponent=ko.observable().extend({validation:[{validator:function(){return!(n.SelectedMedicaidScoringComponent&&n.SelectedMedicaidScoringComponent()===null&&n.SelectedProductLineId&&n.SelectedProductLineId()===2)},message:"No CAHPS component selected for this component.  Please select the Products tab and edit an existing Medicaid product and select a CAHPS Component that needs to be scored.",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){return!(n.SelectedMedicaidScoringComponent&&n.SelectedMedicaidScoringComponent()==="No CAHPS component selected for this component"&&n.SelectedProductLineId&&n.SelectedProductLineId()===2)},message:"You are attempting to request a submission and have not completed the corresponding product information. Please select the Products tab and click the new product button & complete the product information. Or, if you have discontinued the relevant product then please uncheck discontinued.",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){var t=ko.utils.arrayFirst(n.CahpsComponentsForReportingProductErrorMessages(),function(t){return t.Id===n.SelectedReportingProductId()});return t.IsCahpsComponentsSame},message:function(){console.log(n.CahpsComponentsForReportingProductErrorMessages());var t=ko.utils.arrayFirst(n.CahpsComponentsForReportingProductErrorMessages(),function(t){return t.Id===n.SelectedReportingProductId()});return t.CahpsComponent},onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&n.SelectedReportingProductId&&n.SelectedReportingProductId()!==undefined&&n.CahpsComponentsForReportingProductErrorMessages().length>0}}]});n.IsSaveHappening=ko.observable(!1);n.SelectedSpecialProject=ko.observable();n.SelectedProductLineId=ko.observable();n.SelectedSpecialProject.subscribe(function(t){n.SelectedProductLineId()===2&&t==="LTSS"&&(n.SelectedIsAuditRequired(!0),n.SelectedCmsSubmissionTypeId(3),n.SelectedAdultCahpsRequested(!1),n.SelectedChildCahpsRequested(!1),n.SelectedChildCahpsCCCRequested(!1),n.SelectedIdss(!0))});n.SelectedProductLineId.subscribe(function(t){if(t&&t===5?(n.SelectedQHPSurveyRequested(!0),n.SelectedCmsSubmissionTypeId(3),n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0)):t&&t===3&&(n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0)),n.SelectedReportingProductId&&n.SelectedReportingProductId()){var i=ko.utils.arrayFirst(n.CahpsComponentsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()});n.SelectedMedicaidScoringComponent(i.CahpsComponent)}});n.SelectedSoftwareQuestionId=ko.observable().extend({required:{params:!0,message:"Required"}});n.SelectedSoftwareVendorId=ko.observable(0).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedSoftwareQuestionId()===2}}});n.SelectedSoftwareQuestionId.subscribe(function(t){t!==2&&n.SelectedSoftwareVendorId(undefined)});n.SelectedIsAuditRequired=ko.observable().extend({required:{params:!0,message:"Required"},validation:[{validator:function(){return n.SelectedMedicaidScoringComponent()==="Not Required"&&n.SelectedIsAuditRequired()===!0&&(n.SelectedAdultCahpsRequested()||n.SelectedChildCahpsRequested()||n.SelectedChildCahpsCCCRequested())?!1:!0},message:'Your Medicaid CAHPS scoring component cannot be "Not Required" if Audit Required is Yes. Please return to the Product step and update.',onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&n.SelectedReportingProductId()!==undefined}}]});n.SelectedAuditFirmId=ko.observable(0).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedIsAuditRequired()===!0}}});n.SelectedIsAuditRequired.subscribe(function(t){t||n.SelectedAuditFirmId(undefined)});n.SelectedIsThisAnOPMSubmission=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===1}}});n.SelectedFehbId1=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1}},inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId1()!==null&&n.SelectedFehbId1()!==""&&n.SelectedFehbId1().length!==2}}});n.SelectedFehbId2=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId2()!==null&&n.SelectedFehbId2()!==""&&n.SelectedFehbId2().length!==2}}});n.SelectedFehbId3=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId3()!==null&&n.SelectedFehbId3()!==""&&n.SelectedFehbId3().length!==2}}});n.SelectedFehbId4=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId4()!==null&&n.SelectedFehbId4()!==""&&n.SelectedFehbId4().length!==2}}});n.SelectedFehbId5=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId5()!==null&&n.SelectedFehbId5()!==""&&n.SelectedFehbId5().length!==2}}});n.SelectedFehbId6=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId6()!==null&&n.SelectedFehbId6()!==""&&n.SelectedFehbId6().length!==2}}});n.SelectedFehbId7=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId7()!==null&&n.SelectedFehbId7()!==""&&n.SelectedFehbId7().length!==2}}});n.SelectedFehbId8=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId8()!==null&&n.SelectedFehbId8()!==""&&n.SelectedFehbId8().length!==2}}});n.SelectedFehbId9=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId9()!==null&&n.SelectedFehbId9()!==""&&n.SelectedFehbId9().length!==2}}});n.SelectedFehbId10=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId10()!==null&&n.SelectedFehbId10()!==""&&n.SelectedFehbId10().length!==2}}});n.SelectedIdss=ko.observable().extend({required:{message:"Required"}});n.SelectedIdss.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedAdultCahpsRequested=ko.observable().extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!=="LTSS"||n.SelectedProductLineId()===1}},validation:[{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="AdultCAHPS"&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since AdultCAHPS is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProductId&&n.SelectedReportingProductId()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProductId()&&t.CahpsComponent==="AdultCAHPS"&&t.SubmissionId!==n.SubmissionId()});return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&t===null}}}]});n.SelectedAdultCahpsRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedAdultCahpsComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedAdultCahpsRequested()===!0}}});n.SelectedAdultCahpsSampleFrame=ko.observable();n.SelectedAdultCahpsRequested.subscribe(function(t){t?n.SelectedAdultCahpsSampleFrame(1):(n.SelectedAdultCahpsComponentVendorId(undefined),n.SelectedAdultCahpsSampleFrame(undefined))});n.SelectedChildCahpsRequested=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!=="LTSS"}},validation:[{validator:function(){return!(n.SelectedChildCahpsRequested()&&n.SelectedChildCahpsCCCRequested())},message:"You may select ChildCAHPS OR ChildCAHPSCCC but not both on the same submission.",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="ChildCAHPS"&&n.SelectedChildCahpsRequested&&n.SelectedChildCahpsRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since ChildCAHPS is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProductId&&n.SelectedReportingProductId()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProductId()&&t.CahpsComponent==="ChildCAHPS"&&t.SubmissionId!==n.SubmissionId()});return n.SelectedProductLineId()===2&&t===null&&n.SelectedSpecialProject()!=="LTSS"}}}]});n.SelectedChildCahpsRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedChildCahpsComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedChildCahpsRequested()===!0&&n.SelectedSpecialProject()!=="LTSS"}}});n.SelectedChildCahpsSampleFrame=ko.observable();n.SelectedChildCahpsRequested.subscribe(function(t){t?n.SelectedChildCahpsSampleFrame(1):(n.SelectedChildCahpsComponentVendorId(undefined),n.SelectedChildCahpsSampleFrame(undefined))});n.SelectedChildCahpsCCCRequested=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"}},validation:[{validator:function(){return!(n.SelectedChildCahpsRequested()&&n.SelectedChildCahpsCCCRequested())},message:"You may select ChildCAHPS OR ChildCAHPSCCC but not both on the same submission.",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="ChildCAHPSCCC"&&n.SelectedChildCahpsCCCRequested&&n.SelectedChildCahpsCCCRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since ChildCahpsCCC is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProductId&&n.SelectedReportingProductId()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProductId()&&t.CahpsComponent==="ChildCAHPSCCC"&&t.SubmissionId!==n.SubmissionId()});return n.SelectedProductLineId()===2&&t===null&&n.SelectedSpecialProject()!=="LTSS"}}}]});n.SelectedChildCahpsCCCRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedChildCahpsCCCComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedChildCahpsCCCRequested()===!0&&n.SelectedSpecialProject()!=="LTSS"}}});n.SelectedChildCahpsCCCSampleFrame=ko.observable();n.SelectedChildCahpsCCCRequested.subscribe(function(t){t?n.SelectedChildCahpsCCCSampleFrame(1):(n.SelectedChildCahpsCCCComponentVendorId(undefined),n.SelectedChildCahpsCCCSampleFrame(undefined))});n.SelectedQHPSurveyRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===5}}});n.SelectedQHPSurveyComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===5&&n.SelectedQHPSurveyRequested()===!0}}});n.SelectedQHPSurveySampleFrame=ko.observable();n.SelectedQHPSurveyRequested.subscribe(function(t){t?n.SelectedQHPSurveySampleFrame(1):(n.SelectedQHPSurveyComponentVendorId(undefined),n.SelectedQHPSurveySampleFrame(undefined))});n.ShowIdssWarning=ko.observable(!1);n.errors=ko.validation.group([n.SelectedSoftwareQuestionId,n.SelectedSoftwareVendorId,n.SelectedIsAuditRequired,n.SelectedAuditFirmId,n.SelectedIsThisAnOPMSubmission,n.SelectedFehbId1,n.SelectedFehbId2,n.SelectedFehbId3,n.SelectedFehbId4,n.SelectedFehbId5,n.SelectedFehbId6,n.SelectedFehbId7,n.SelectedFehbId8,n.SelectedFehbId9,n.SelectedFehbId10,n.SelectedIdss,n.SelectedAdultCahpsRequested,n.SelectedAdultCahpsComponentVendorId,n.SelectedChildCahpsRequested,n.SelectedChildCahpsComponentVendorId,n.SelectedChildCahpsCCCRequested,n.SelectedChildCahpsCCCComponentVendorId,n.SelectedMedicaidScoringComponent,n.SelectedQHPSurveyRequested,n.SelectedQHPSurveyComponentVendorId,n.SelectedReportingProduct,n.SelectedFirstYearReportingUnitOperational,n.SelectedIsReportingUnitOperational]);n.save=function(){var t,i;if(n.IsSaveHappening(!0),n.errors().length>0)return console.log(n.errors()),t={dir1:"up",dir2:"right",spacing1:0,spacing2:0},new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"Please correct the validations errors",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:1500,stack:t,type:"error"}),n.IsSaveHappening(!1),!1;if(n.SelectedProductLineId()===2&&n.SelectedIdss&&n.SelectedIdss()===!1&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1&&n.SelectedChildCahpsRequested&&n.SelectedChildCahpsRequested()===!1&&n.SelectedChildCahpsCCCRequested&&n.SelectedChildCahpsCCCRequested()===!1||n.SelectedProductLineId()===1&&n.SelectedIdss&&n.SelectedIdss()===!1&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1)return n.ShowIdssWarning(!0),n.IsSaveHappening(!1),!1;n.SelectedIsThisAnOPMSubmission()?(n.SelectedValues.FehbId1=n.SelectedFehbId1,n.SelectedValues.FehbId2=n.SelectedFehbId2,n.SelectedValues.FehbId3=n.SelectedFehbId3,n.SelectedValues.FehbId4=n.SelectedFehbId4,n.SelectedValues.FehbId5=n.SelectedFehbId5,n.SelectedValues.FehbId6=n.SelectedFehbId6,n.SelectedValues.FehbId7=n.SelectedFehbId7,n.SelectedValues.FehbId8=n.SelectedFehbId8,n.SelectedValues.FehbId9=n.SelectedFehbId9,n.SelectedValues.FehbId10=n.SelectedFehbId10):(n.SelectedValues.FehbId1="",n.SelectedValues.FehbId2="",n.SelectedValues.FehbId3="",n.SelectedValues.FehbId4="",n.SelectedValues.FehbId5="",n.SelectedValues.FehbId6="",n.SelectedValues.FehbId7="",n.SelectedValues.FehbId8="",n.SelectedValues.FehbId9="",n.SelectedValues.FehbId10="");n.SelectedValues.AuditFirmId=n.SelectedAuditFirmId()===undefined?-1:n.SelectedAuditFirmId();n.SelectedValues.IsAuditRequired=n.SelectedIsAuditRequired;n.SelectedValues.AdultCahpsRequested=n.SelectedAdultCahpsRequested;n.SelectedValues.AdultCahpsComponentVendorId=n.SelectedAdultCahpsComponentVendorId()===undefined?-1:n.SelectedAdultCahpsComponentVendorId();n.SelectedValues.AdultCahpsSampleFrame=n.SelectedAdultCahpsSampleFrame()===undefined?-1:n.SelectedAdultCahpsSampleFrame();n.SelectedValues.ChildCahpsRequested=n.SelectedChildCahpsRequested;n.SelectedValues.ChildCahpsComponentVendorId=n.SelectedChildCahpsComponentVendorId()===undefined?-1:n.SelectedChildCahpsComponentVendorId();n.SelectedValues.ChildCahpsSampleFrame=n.SelectedChildCahpsSampleFrame()===undefined?-1:n.SelectedChildCahpsSampleFrame();n.SelectedValues.ChildCahpsCCCRequested=n.SelectedChildCahpsCCCRequested;n.SelectedValues.ChildCahpsCCCComponentVendorId=n.SelectedChildCahpsCCCComponentVendorId()===undefined?-1:n.SelectedChildCahpsCCCComponentVendorId();n.SelectedValues.ChildCahpsCCCSampleFrame=n.SelectedChildCahpsCCCSampleFrame()===undefined?-1:n.SelectedChildCahpsCCCSampleFrame();n.SelectedValues.QHPSurveyRequested=n.SelectedQHPSurveyRequested;n.SelectedValues.QHPSurveyComponentVendorId=n.SelectedQHPSurveyComponentVendorId()===undefined?-1:n.SelectedQHPSurveyComponentVendorId();n.SelectedValues.QHPSurveySampleFrame=n.SelectedQHPSurveySampleFrame()===undefined?-1:n.SelectedQHPSurveySampleFrame();n.SelectedValues.IsThisAnOPMSubmission=n.SelectedIsThisAnOPMSubmission;n.SelectedValues.SoftwareVendorId=n.SelectedSoftwareVendorId()===undefined?-1:n.SelectedSoftwareVendorId();n.SelectedValues.SoftwareQuestionId=n.SelectedSoftwareQuestionId()===undefined?-1:n.SelectedSoftwareQuestionId();n.SelectedValues.ProductLineId=n.SelectedProductLineId;n.SelectedValues.Idss=n.SelectedIdss;n.SelectedValues.SpecialProject=n.SelectedSpecialProject;n.SelectedValues.CmsSubmissionTypeId=n.SelectedCmsSubmissionTypeId;n.SelectedValues.FirstYearReportingUnitOperational=n.SelectedFirstYearReportingUnitOperational;n.SelectedValues.IsReportingUnitOperational=n.SelectedIsReportingUnitOperational;i=ko.mapping.toJSON(n.SelectedValues);$.ajax("Submissions/SaveSubmissionCurrentYear",{cache:!1,beforeSend:function(){$("div#spinner").show();$("#alert-error").hide()},type:"POST",contentType:"application/json",complete:function(){$("div#spinner").hide();n.IsSaveHappening(!1)},data:i,success:function(n){try{$("#btnAddOrUpdateRowToGrid").trigger("click",[n.data.SelectedValues.EisSubmissionId])}catch(i){var t={dir1:"up",dir2:"right",spacing1:0,spacing2:0};new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"An error occured while savings, please try again.",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:2500,stack:t,type:"error"})}finally{$("#EditSaveSubmissionCurrentYear").modal("hide")}},error:function(){new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"An error occured while savings, please try again.",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:2500,stack:{dir1:"up",dir2:"right",spacing1:0,spacing2:0},type:"error"})}})}};Submission=Submission||{};Submission.InstanceOfViewModel={};Submission.EditViewModelForSubmissionReportedLastYear=function(){var n=this;n.MedicareProductsForReportingProduct=ko.observableArray();n.MedicaidProductsForReportingProduct=ko.observableArray();n.ExchangeProductsForReportingProduct=ko.observableArray();n.CommercialProductsForReportingProduct=ko.observableArray();n.ExchangeAllQuestionsSayYes=ko.observableArray();n.SelectedCmsSubmissionTypeId=ko.observable();n.CahpsComponentsForReportingProduct=ko.observableArray();n.CahpsComponentsForReportingProductErrorMessages=ko.observableArray();n.CahpsComponentsAlreadyRequested=ko.observableArray();n.PossibleFirstYearReportingUnitOperationalOptions=ko.observableArray();n.PossibleFirstYearReportingUnitOperationalOptions.push(2014);n.PossibleFirstYearReportingUnitOperationalOptions.push(2015);n.PossibleFirstYearReportingUnitOperationalOptions.push(2016);n.PossibleFirstYearReportingUnitOperationalOptions.push(2017);n.PossibleFirstYearReportingUnitOperationalOptions.push(2018);n.PossibleFirstYearReportingUnitOperationalOptions.push(2019);n.PossibleFirstYearReportingUnitOperationalOptions.push(2020);n.PossibleFirstYearReportingUnitOperationalOptions.push(2021);n.PossibleIsReportingUnitOperationalOptions=ko.observableArray();n.PossibleIsReportingUnitOperationalOptions.push(!0);n.PossibleIsReportingUnitOperationalOptions.push(!1);n.SelectedFirstYearReportingUnitOperational=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()!==null&&n.SelectedProductLineId()!==undefined&&n.SelectedProductLineId()===5}}});n.SelectedIsReportingUnitOperational=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()!==null&&n.SelectedProductLineId()!==undefined&&n.SelectedProductLineId()===5}}});n.SelectedMedicaidScoringComponent=ko.observable().extend({validation:[{validator:function(){return!(n.SelectedMedicaidScoringComponent&&n.SelectedMedicaidScoringComponent()===null&&n.SelectedProductLineId&&n.SelectedProductLineId()===2)},message:"No CAHPS component selected for this component.  Please select the Products tab and edit an existing Medicaid product and select a CAHPS Component that needs to be scored.",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){return!(n.SelectedMedicaidScoringComponent&&n.SelectedMedicaidScoringComponent()==="No CAHPS component selected for this component"&&n.SelectedProductLineId&&n.SelectedProductLineId()===2)},message:"You are attempting to request a submission and have not completed the corresponding product information. Please select the Products tab and click the new product button & complete the product information. Or, if you have discontinued the relevant product then please uncheck discontinued.",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){var t=ko.utils.arrayFirst(n.CahpsComponentsForReportingProductErrorMessages(),function(t){return t.Id===n.SelectedReportingProductId()});return t.IsCahpsComponentsSame},message:function(){var t=ko.utils.arrayFirst(n.CahpsComponentsForReportingProductErrorMessages(),function(t){return t.Id===n.SelectedReportingProductId()});return t.CahpsComponent},onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&n.SelectedReportingProductId&&n.SelectedReportingProductId()!==undefined&&n.CahpsComponentsForReportingProductErrorMessages().length>0}}]});n.IsSaveHappening=ko.observable(!1);n.SelectedSpecialProject=ko.observable();n.SelectedIdss=ko.observable(null).extend({required:{message:"Required"}});n.SelectedSpecialProject.subscribe(function(t){n.SelectedProductLineId()===2&&t==="LTSS"&&(n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0))});n.SelectedProductLineId=ko.observable();n.SelectedReportingProductId=ko.observable();n.SelectedReportingProduct=ko.observable().extend({validation:[{validator:function(){return n.SelectedProductLineId()===1?ko.utils.arrayFirst(n.CommercialProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:n.SelectedProductLineId()===3?ko.utils.arrayFirst(n.MedicareProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:n.SelectedProductLineId()===2?ko.utils.arrayFirst(n.MedicaidProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:n.SelectedProductLineId()===5?ko.utils.arrayFirst(n.ExchangeProductsForReportingProduct(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null:void 0},message:"You are attempting to request a submission and have not completed the corresponding product information. Please click Product on the menu bar and click the View/Edit link to complete the product information.",onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()&&n.SelectedReportingProduct()!==undefined}},{validator:function(){return ko.utils.arrayFirst(n.ExchangeAllQuestionsSayYes(),function(t){return t.Id===n.SelectedReportingProductId()&&t.Exists})!==null},message:'You have chosen "No" to the enrollment questions or have indicated this product will discontinue prior to June 15, 2020.',onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()&&n.SelectedProductLineId()===5&&n.SelectedReportingProductId()!==undefined}}]});n.SelectedProductLineId.subscribe(function(t){t&&t===5?(n.SelectedQHPSurveyRequested(!0),n.SelectedCmsSubmissionTypeId(3),n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0)):t&&t===3&&(n.SelectedIsAuditRequired(!0),n.SelectedIdss(!0))});n.SelectedSoftwareQuestionId=ko.observable().extend({required:{params:!0,message:"Required"}});n.SelectedSoftwareVendorId=ko.observable(0).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedSoftwareQuestionId()===2}}});n.SelectedSoftwareQuestionId.subscribe(function(t){t!==2&&n.SelectedSoftwareVendorId(undefined)});n.SelectedIsAuditRequired=ko.observable().extend({required:{params:!0,message:"Required"},validation:[{validator:function(){return n.SelectedMedicaidScoringComponent()==="Not Required"&&n.SelectedIsAuditRequired()===!0&&(n.SelectedAdultCahpsRequested()||n.SelectedChildCahpsRequested()||n.SelectedChildCahpsCCCRequested())?!1:!0},message:'Your Medicaid CAHPS scoring component cannot be "Not Required" if Audit Required is Yes. Please return to the Product step and update.',onlyIf:function(){return n.SelectedProductLineId&&n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&n.SelectedReportingProductId()!==undefined}}]});n.SelectedAuditFirmId=ko.observable(0).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedIsAuditRequired()===!0}}});n.SelectedIsAuditRequired.subscribe(function(t){t||n.SelectedAuditFirmId(undefined)});n.SelectedIsThisAnOPMSubmission=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===1}}});n.SelectedFehbId1=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1}},inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId1()!==null&&n.SelectedFehbId1()!==""&&n.SelectedFehbId1().length!==2}}});n.SelectedFehbId2=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId2()!==null&&n.SelectedFehbId2()!==""&&n.SelectedFehbId2().length!==2}}});n.SelectedFehbId3=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId3()!==null&&n.SelectedFehbId3()!==""&&n.SelectedFehbId3().length!==2}}});n.SelectedFehbId4=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId4()!==null&&n.SelectedFehbId4()!==""&&n.SelectedFehbId4().length!==2}}});n.SelectedFehbId5=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId5()!==null&&n.SelectedFehbId5()!==""&&n.SelectedFehbId5().length!==2}}});n.SelectedFehbId6=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId6()!==null&&n.SelectedFehbId6()!==""&&n.SelectedFehbId6().length!==2}}});n.SelectedFehbId7=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId7()!==null&&n.SelectedFehbId7()!==""&&n.SelectedFehbId7().length!==2}}});n.SelectedFehbId8=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId8()!==null&&n.SelectedFehbId8()!==""&&n.SelectedFehbId8().length!==2}}});n.SelectedFehbId9=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId9()!==null&&n.SelectedFehbId9()!==""&&n.SelectedFehbId9().length!==2}}});n.SelectedFehbId10=ko.observable().extend({inputmask:{message:"Please enter 2 digit codes only",onlyIf:function(){return n.SelectedIsThisAnOPMSubmission()===!0&&n.SelectedProductLineId()===1&&n.SelectedFehbId10()!==null&&n.SelectedFehbId10()!==""&&n.SelectedFehbId10().length!==2}}});n.SelectedIdss.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedAdultCahpsRequested=ko.observable(null).extend({required:{params:!0,message:"Required",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!=="LTSS"||n.SelectedProductLineId()===1}},validation:[{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="AdultCAHPS"&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since AdultCAHPS is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProductId&&n.SelectedReportingProductId()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProductId()&&t.CahpsComponent==="AdultCAHPS"});return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&t===null}}}]});n.SelectedAdultCahpsRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedAdultCahpsComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedAdultCahpsRequested()===!0}}});n.SelectedAdultCahpsSampleFrame=ko.observable();n.SelectedAdultCahpsRequested.subscribe(function(t){t?n.SelectedAdultCahpsSampleFrame(1):(n.SelectedAdultCahpsComponentVendorId(undefined),n.SelectedAdultCahpsSampleFrame(undefined))});n.SelectedChildCahpsRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!=="LTSS"}},validation:[{validator:function(){return!(n.SelectedChildCahpsRequested()&&n.SelectedChildCahpsCCCRequested())},message:"You may select ChildCAHPS OR ChildCAHPSCCC but not both on the same submission.",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="ChildCAHPS"&&n.SelectedChildCahpsRequested&&n.SelectedChildCahpsRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since ChildCAHPS is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProductId&&n.SelectedReportingProductId()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProductId()&&t.CahpsComponent==="ChildCAHPS"});return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&t===null}}}]});n.SelectedChildCahpsRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedChildCahpsComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedChildCahpsRequested()===!0}}});n.SelectedChildCahpsSampleFrame=ko.observable();n.SelectedChildCahpsRequested.subscribe(function(t){t?n.SelectedChildCahpsSampleFrame(1):(n.SelectedChildCahpsComponentVendorId(undefined),n.SelectedChildCahpsSampleFrame(undefined))});n.SelectedChildCahpsCCCRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedMedicaidScoringComponent()!==null&&n.SelectedMedicaidScoringComponent()!=="No CAHPS component selected for this component"&&n.SelectedSpecialProject()!=="LTSS"}},validation:[{validator:function(){return!(n.SelectedChildCahpsRequested()&&n.SelectedChildCahpsCCCRequested())},message:"You may select ChildCAHPS OR ChildCAHPSCCC but not both on the same submission.",onlyIf:function(){return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"}},{validator:function(){return!(n.SelectedMedicaidScoringComponent()==="ChildCAHPSCCC"&&n.SelectedChildCahpsCCCRequested&&n.SelectedChildCahpsCCCRequested()===!1&&n.SelectedIsAuditRequired&&n.SelectedIsAuditRequired())},message:"Since ChildCahpsCCC is the Medicaid Scoring Component selected, you must request this component",onlyIf:function(){if(n.SelectedReportingProductId&&n.SelectedReportingProductId()){var t=ko.utils.arrayFirst(n.CahpsComponentsAlreadyRequested(),function(t){return t.Id===n.SelectedReportingProductId()&&t.CahpsComponent==="ChildCAHPSCCC"});return n.SelectedProductLineId()===2&&n.SelectedSpecialProject()!=="LTSS"&&t===null}}}]});n.SelectedChildCahpsCCCRequested.subscribe(function(t){t&&n.ShowIdssWarning(!1)});n.SelectedChildCahpsCCCComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedChildCahpsCCCRequested()===!0}}});n.SelectedChildCahpsCCCSampleFrame=ko.observable();n.SelectedChildCahpsCCCRequested.subscribe(function(t){t?n.SelectedChildCahpsCCCSampleFrame(1):(n.SelectedChildCahpsCCCComponentVendorId(undefined),n.SelectedChildCahpsCCCSampleFrame(undefined))});n.SelectedQHPSurveyRequested=ko.observable(null).extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===5}}});n.SelectedQHPSurveyComponentVendorId=ko.observable().extend({required:{message:"Required",onlyIf:function(){return n.SelectedProductLineId()===5&&n.SelectedQHPSurveyRequested()===!0}}});n.SelectedQHPSurveySampleFrame=ko.observable();n.SelectedQHPSurveyRequested.subscribe(function(t){t?n.SelectedQHPSurveySampleFrame(1):(n.SelectedQHPSurveyComponentVendorId(undefined),n.SelectedQHPSurveySampleFrame(undefined))});n.ShowIdssWarning=ko.observable(!1);n.errors=ko.validation.group([n.SelectedSoftwareQuestionId,n.SelectedSoftwareVendorId,n.SelectedIsAuditRequired,n.SelectedAuditFirmId,n.SelectedIsThisAnOPMSubmission,n.SelectedFehbId1,n.SelectedFehbId2,n.SelectedFehbId3,n.SelectedFehbId4,n.SelectedFehbId5,n.SelectedFehbId6,n.SelectedFehbId7,n.SelectedFehbId8,n.SelectedFehbId9,n.SelectedFehbId10,n.SelectedIdss,n.SelectedAdultCahpsRequested,n.SelectedAdultCahpsComponentVendorId,n.SelectedChildCahpsRequested,n.SelectedChildCahpsComponentVendorId,n.SelectedChildCahpsCCCRequested,n.SelectedChildCahpsCCCComponentVendorId,n.SelectedHOSFollowupRequested,n.SelectedHOSFollowupComponentVendorId,n.SelectedHOSBaselineRequested,n.SelectedHOSBaselineComponentVendorId,n.SelectedMedicaidScoringComponent,n.SelectedQHPSurveyRequested,n.SelectedQHPSurveyComponentVendorId,n.SelectedReportingProduct,n.SelectedFirstYearReportingUnitOperational,n.SelectedIsReportingUnitOperational]);n.save=function(){var t,i;if(n.IsSaveHappening(!0),n.errors().length>0)return console.log(n.errors()),t={dir1:"up",dir2:"right",spacing1:0,spacing2:0},new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"Please correct the validations errors",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:1500,stack:t,type:"error"}),n.IsSaveHappening(!1),!1;if(n.SelectedProductLineId()===2&&n.SelectedIdss&&n.SelectedIdss()===!1&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1&&n.SelectedChildCahpsRequested&&n.SelectedChildCahpsRequested()===!1&&n.SelectedChildCahpsCCCRequested&&n.SelectedChildCahpsCCCRequested()===!1||n.SelectedProductLineId()===1&&n.SelectedIdss&&n.SelectedIdss()===!1&&n.SelectedAdultCahpsRequested&&n.SelectedAdultCahpsRequested()===!1)return n.ShowIdssWarning(!0),n.IsSaveHappening(!1),!1;n.SelectedIsThisAnOPMSubmission()?(n.SelectedValues.FehbId1=n.SelectedFehbId1,n.SelectedValues.FehbId2=n.SelectedFehbId2,n.SelectedValues.FehbId3=n.SelectedFehbId3,n.SelectedValues.FehbId4=n.SelectedFehbId4,n.SelectedValues.FehbId5=n.SelectedFehbId5,n.SelectedValues.FehbId6=n.SelectedFehbId6,n.SelectedValues.FehbId7=n.SelectedFehbId7,n.SelectedValues.FehbId8=n.SelectedFehbId8,n.SelectedValues.FehbId9=n.SelectedFehbId9,n.SelectedValues.FehbId10=n.SelectedFehbId10):(n.SelectedValues.FehbId1="",n.SelectedValues.FehbId2="",n.SelectedValues.FehbId3="",n.SelectedValues.FehbId4="",n.SelectedValues.FehbId5="",n.SelectedValues.FehbId6="",n.SelectedValues.FehbId7="",n.SelectedValues.FehbId8="",n.SelectedValues.FehbId9="",n.SelectedValues.FehbId10="");n.SelectedValues.AuditFirmId=n.SelectedAuditFirmId()===undefined?-1:n.SelectedAuditFirmId();n.SelectedValues.IsAuditRequired=n.SelectedIsAuditRequired;n.SelectedValues.AdultCahpsRequested=n.SelectedAdultCahpsRequested()===-1?!1:n.SelectedAdultCahpsRequested();n.SelectedValues.AdultCahpsComponentVendorId=n.SelectedAdultCahpsComponentVendorId()===undefined?-1:n.SelectedAdultCahpsComponentVendorId();n.SelectedValues.AdultCahpsSampleFrame=n.SelectedAdultCahpsSampleFrame()===undefined?-1:n.SelectedAdultCahpsSampleFrame();n.SelectedValues.ChildCahpsRequested=n.SelectedChildCahpsRequested()===-1?!1:n.SelectedChildCahpsRequested();n.SelectedValues.ChildCahpsComponentVendorId=n.SelectedChildCahpsComponentVendorId()===undefined?-1:n.SelectedChildCahpsComponentVendorId();n.SelectedValues.ChildCahpsSampleFrame=n.SelectedChildCahpsSampleFrame()===undefined?-1:n.SelectedChildCahpsSampleFrame();n.SelectedValues.ChildCahpsCCCRequested=n.SelectedChildCahpsCCCRequested()===-1?!1:n.SelectedChildCahpsCCCRequested();n.SelectedValues.ChildCahpsCCCComponentVendorId=n.SelectedChildCahpsCCCComponentVendorId()===undefined?-1:n.SelectedChildCahpsCCCComponentVendorId();n.SelectedValues.ChildCahpsCCCSampleFrame=n.SelectedChildCahpsCCCSampleFrame()===undefined?-1:n.SelectedChildCahpsCCCSampleFrame();n.SelectedValues.QHPSurveyRequested=n.SelectedQHPSurveyRequested;n.SelectedValues.QHPSurveyComponentVendorId=n.SelectedQHPSurveyComponentVendorId()===undefined?-1:n.SelectedQHPSurveyComponentVendorId();n.SelectedValues.QHPSurveySampleFrame=n.SelectedQHPSurveySampleFrame()===undefined?-1:n.SelectedQHPSurveySampleFrame();n.SelectedValues.IsThisAnOPMSubmission=n.SelectedIsThisAnOPMSubmission;n.SelectedValues.SoftwareVendorId=n.SelectedSoftwareVendorId()===undefined?-1:n.SelectedSoftwareVendorId();n.SelectedValues.SoftwareQuestionId=n.SelectedSoftwareQuestionId()===undefined?-1:n.SelectedSoftwareQuestionId();n.SelectedValues.ProductLineId=n.SelectedProductLineId;n.SelectedValues.Idss=n.SelectedIdss;n.SelectedValues.SpecialProject=n.SelectedSpecialProject;n.SelectedValues.CmsSubmissionTypeId=n.SelectedCmsSubmissionTypeId;n.SelectedValues.FirstYearReportingUnitOperational=n.SelectedFirstYearReportingUnitOperational;n.SelectedValues.IsReportingUnitOperational=n.SelectedIsReportingUnitOperational;i=ko.mapping.toJSON(n.SelectedValues);$.ajax("Submissions/SaveSubmissionReportedLastYear",{cache:!1,beforeSend:function(){$("div#spinner").show();$("#alert-error").hide()},type:"POST",contentType:"application/json",complete:function(){$("div#spinner").hide();n.IsSaveHappening(!1)},data:i,success:function(n){var t;try{n.data.DoesPreviousYearsSubmissionExist?(t={dir1:"up",dir2:"right",spacing1:0,spacing2:0},new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:n.data.MessageForDupSubmission,width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:8e3,stack:t,type:"error"})):$("#btnAddOrUpdateRowToGrid").trigger("click",[n.data.SelectedValues.EisSubmissionId])}catch(i){t={dir1:"up",dir2:"right",spacing1:0,spacing2:0};new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"An error occured while savings, please try again.",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:2500,stack:t,type:"error"})}finally{$("#EditSaveSubmissionReportedLastYear").modal("hide")}},error:function(){new PNotify({title:"Submissions",icon:"glyphicon glyphicon-paperclip",text:"An error occured while savings, please try again.",width:"70%",addclass:"stack-bar-bottom",styling:"bootstrap3",delay:2500,stack:{dir1:"up",dir2:"right",spacing1:0,spacing2:0},type:"error"})}})}}