By filling in this form, you start the registration process of a foal with KWPN.
A number of data have already been entered for you, please check it and fill in the requested data, and if necessary, please adjust your (address) data in My Profile. If the foal is stabled in the Netherlands, your foal will be chipped by a KWPN passport consultant. If the foal is stabled abroad, you need to turn off the corresponding checkmark (chip by KWPN).
After saving this form, your foal will be registered and you will receive a confirmation email with more information about the following steps. By filling in this application for registration, the applicant commits to register this horse exclusively with the KWPN. The EC Regulation No. 2015/262 applies to the issue of a horse passport.
Important information for our UK Members
Due to Brexit, the European (EU) Breeding Regulation no longer applies in the United Kingdom. The Department of Environment, Food and Rural Affairs (Defra) has drawn up its own rules for studbook societies, breeding groups and their breeding programs. This means that for the time being no foreign studbook horses may be bred in England and that you are not allowed to register your KWPN foals with the KWPN.
What still remains possible is to obtain a studbookpaper of your foal. If you wish to receive this please send us a copy of the first page of the British passport (including the UELN-number / registrationnumber of your foal) and a hair-sample of your foal (please send several strands of mane - do not cut the mane but pull, we need to have the hairroots of the manes). DNA parentage testing is included in the price, we offer this for €112,40 incl. VAT.
As soon as there is more clarity about the (im)possibilities of KWPN foal registration in the UK, we will inform you about this. With regard to the rules for Identification & Registration, we recommend that you inquire with the authorities in the United Kingdom.
Error executing template "Designs/Kwpn/DataManagement/Forms/Form/FormRegisterFoal.cshtml" System.NullReferenceException: Object reference not set to an instance of an object. at CompiledRazorTemplates.Dynamic.RazorEngine_56ea25d39e574fa8bf336cb0aa9581ec.Execute() in D:\inetpub\wwwroot\www.kwpn.nl\Files\Templates\Designs\Kwpn\DataManagement\Forms\Form\FormRegisterFoal.cshtml:line 13 at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 2 @using Dynamicweb.Ecommerce.Products 3 @using Kwpn.Models.ApiModels 4 @using Kwpn.Models.Constants 5 @using Kwpn.Models.Enumerations 6 @using Kwpn.Repository.Repositories 7 @using Kwpn.Repository.Helpers 8 @using Kwpn.Core.Services.Abstract; 9 @using System.Web.Mvc; 10 11 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 12 @{ 13 var user = Kwpn.Repository.Repositories.KwpnUsers.CurrentUser().DwUser; 14 15 bool isLoggedIn = LoginHelper.CurrentUserIsLoggedIn(); 16 if (isLoggedIn) 17 { 18 // get culture 19 string culture = GetGlobalValue("Global:Area.LongLang"); 20 // get mare 21 string animalCode = System.Web.HttpContext.Current.Request.QueryString.Get(Translate("Horse", "Horse")); 22 if (string.IsNullOrEmpty(animalCode)) 23 { 24 animalCode = System.Web.HttpContext.Current.Request.Form.Get(Translate("Horse", "Horse")); 25 } 26 var showMemberContent = LoginHelper.HasAccessToExtendedHorseData(); // todo: KWPN-472 27 28 // try to get cached version if exists (database page caches the horse before calling the form data) else get minimal version 29 AnimalModel mare = HorseHelper.GetDatabasePageHorse(culture, animalCode, showMemberContent, true) ?? Horses.Get(animalCode, culture, false, false, false, false, false, false, false, false, false); 30 31 if (mare != null && HorseHelper.CheckIfMyHorse(animalCode) && !KwpnUsers.CurrentUser().IsBlocked) 32 { 33 // form date 34 DateTime currentDateTime = DateTime.Now; 35 36 // get user 37 var dwUser = KwpnUsers.CurrentUser().DwUser; 38 string membershipNumber = "", userId = "", userName = "", userEmail = "", authorizationName = "", authorizationResidence = ""; 39 membershipNumber = dwUser.UserName; 40 userId = dwUser.ID.ToString(); 41 userName = dwUser.Name; 42 userEmail = dwUser.Email; 43 authorizationName = dwUser.Name; 44 authorizationResidence = dwUser.City; 45 46 // get breeding 47 AnimalBreedingModel knownBreeding = null; 48 string actionIdParameter = "actionid"; 49 if (culture.Equals("nl-nl", System.StringComparison.InvariantCultureIgnoreCase)) 50 { 51 actionIdParameter = "actieid"; 52 } 53 string actionId = System.Web.HttpContext.Current.Request.QueryString.Get(actionIdParameter); 54 if (string.IsNullOrEmpty(actionId)) 55 { 56 actionId = System.Web.HttpContext.Current.Request.Form.Get(actionIdParameter); 57 } 58 if (!string.IsNullOrEmpty(actionId) && actionId.Contains("_")) 59 { 60 //actionid is expected in the format: date_studanimalcode 61 knownBreeding = HorseHelper.GetBreedingValues(culture, mare.AnimalCode, actionId); 62 63 } 64 bool isKnownBreeding = knownBreeding != null; 65 bool isUnknownBreeding = knownBreeding == null; 66 67 68 // mare info 69 string mareName = HorseHelper.GetHorseName(mare.SportsName, mare.AnimalName, null); 70 71 // breeding info 72 string studName = ""; 73 string studAnimalCode = ""; 74 string breedingDate = ""; 75 76 string buttonText = Translate("Pay", "Pay"); 77 78 // get product 79 Product registerFoalProduct = null; 80 var productService = new ProductService(); 81 var ecomLanguageId = Dynamicweb.Frontend.PageView.Current().Area.EcomLanguageId; 82 if (isKnownBreeding) 83 { 84 registerFoalProduct = productService.GetProductByNumber(StringConstants.ProductNumbers.RegisterFoalKnownBreeding, ecomLanguageId); 85 studName = knownBreeding.StallionName; 86 studAnimalCode = knownBreeding.AnimalcodeStallion; 87 breedingDate = knownBreeding.Date.ToShortDateString(); 88 } 89 else 90 { 91 registerFoalProduct = productService.GetProductByNumber(StringConstants.ProductNumbers.RegisterFoalUnknownBreeding, ecomLanguageId); 92 buttonText = Translate("Submit", "Submit"); 93 } 94 Product deceasedHorseProduct = productService.GetProductByNumber(StringConstants.ProductNumbers.RegisterDeceasedFoal, ecomLanguageId); 95 Product genomicBreedingValueResearchProduct = productService.GetProductByNumber(StringConstants.ProductNumbers.DNAResearch, ecomLanguageId); 96 Product wffsTestProduct = productService.GetProductByNumber(StringConstants.ProductNumbers.WFFSTest, ecomLanguageId); 97 Product wFFSTestWhenDNAResearchSelectedProduct = productService.GetProductByNumber(StringConstants.ProductNumbers.WFFSTestWhenDNAResearchSelected, ecomLanguageId); 98 if (wFFSTestWhenDNAResearchSelectedProduct == null) 99 { 100 wFFSTestWhenDNAResearchSelectedProduct = wffsTestProduct; 101 } 102 103 // product registerFoalPassportProduct removed: KWPN-1195 104 // product noChippingDiscountProduct removed: KWPN-1195 105 106 List<Kwpn.Repository.Kwpn_Colors> colors = HorseHelper.HorseColors(culture); 107 108 if (registerFoalProduct != null) 109 { 110 111 List<CountryModel> countries = Kwpn.Repository.EquisApi.Countries.GetCountries(); 112 113 var iban = Kwpn.Repository.Repositories.KwpnUsers.CurrentUser().IBAN; 114 var bic = Kwpn.Repository.Repositories.KwpnUsers.CurrentUser().BIC; 115 116 if (string.IsNullOrWhiteSpace(iban) && string.IsNullOrWhiteSpace(bic)) 117 { 118 var equisUser = UserHelper.GetEquisUser(); 119 iban = equisUser.Iban; 120 bic = equisUser.Bic; 121 } 122 123 <div class="w-section inverse"> 124 <div class="w-box sign-in-wr bg-5"> 125 <div id="FormRegisterHorse" class="form-body"> 126 @GetValue("Form.Start") 127 @GetValue("Form.Hidden") @*Hidden fields are filled with jquery*@ 128 129 @if (isKnownBreeding) 130 { 131 // add date unknown breeding fields as hidden, orelse the form will crash on post ... 132 <input type="hidden" id="Kwpn_Form_RegisterFoal_InseminationDate" name="Kwpn_Form_RegisterFoal_InseminationDate" value="" /> 133 <input type="hidden" id="Kwpn_Form_RegisterFoal_RinseDate" name="Kwpn_Form_RegisterFoal_RinseDate" value="" /> 134 <input type="hidden" id="Kwpn_Form_RegisterFoal_TransplantDate" name="Kwpn_Form_RegisterFoal_TransplantDate" value="" /> 135 } 136 137 <div class="col-xs-12"> 138 <p> 139 <i class="fa fa-asterisk" aria-hidden="true"></i> <small>@Translate("RequiredField", "Required field")</small> <i class="fa fa-asterisk" aria-hidden="true"></i><i class="fa fa-asterisk" aria-hidden="true"></i> <small>@Translate("RequiredFieldOfTwo", "At least one is required")</small> 140 </p> 141 </div> 142 143 <div class="row" id="breeding-data-panel"> 144 <div class="col-xs-12"> 145 <div id="Kwpn_Form_RegisterHorse_BreedingData"> 146 147 <h3>@Translate("FoalRegistrationBreedingData", "Breeding data")</h3> 148 149 @*MOTHER*@ 150 <div class="form-inline"> 151 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_MareName">@Translate("FoalMotherName", "Mare name")</label> 152 <input type="text" 153 class="form-control hide-hints" 154 id="Kwpn_Form_RegisterFoal_MareName" 155 name="Kwpn_Form_RegisterFoal_MareName" 156 value="@mareName" 157 maxlength="50" 158 required 159 readonly /> 160 </div> 161 162 @if (isUnknownBreeding) 163 { 164 <div class="form-inline"> 165 <label class="control-label col-sm-4" for="SearchFather">@Translate("SearchFather", "Search father")</label> 166 <div class="input-group form-control"> 167 <input type="text" id="SearchFather" name="SearchFather" placeholder="@Translate("SearchByNameOrLifenumber", "Search by name or lifenumber")" value="" required="required" /> 168 <span class="input-group-btn"> 169 <button class="btn btn-default" onclick="SearchAvailableStuds(); return false;" type="button"><i class="fa fa-search"></i></button> 170 </span> 171 <div id="StudSearchResults"></div> 172 </div> 173 <div id="StudSelected"></div> 174 </div> 175 176 <div id="addfathermanually"> 177 <div id="fatherinfo" class="hidden"> 178 179 @*Naam vader*@ 180 <div class="form-inline"> 181 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StudAnimalName">@Translate("FoalFatherManualName", "Stud name")</label> 182 <input type="text" 183 class="form-control hide-hints" 184 id="Kwpn_Form_RegisterFoal_StudAnimalName" 185 name="Kwpn_Form_RegisterFoal_StudAnimalName" 186 maxlength="50" 187 value="" /> 188 </div> 189 190 @*Levensnummer vader -- is gewijzigd naar Afstamming vader via translations*@ 191 <div class="form-inline"> 192 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StudLifeNumber">@Translate("FoalFatherLifenumber", "Stud life number")</label> 193 <input type="text" 194 class="form-control hide-hints" 195 id="Kwpn_Form_RegisterFoal_StudLifeNumber" 196 name="Kwpn_Form_RegisterFoal_StudLifeNumber" 197 maxlength="50" 198 value="" /> 199 </div> 200 201 @*Stamboek vader*@ 202 <div class="form-inline"> 203 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_FathersStudbook">@Translate("FoalFathersStudbook", "Fathers studbook")</label> 204 <input type="text" 205 class="form-control hide-hints" 206 id="Kwpn_Form_RegisterFoal_FathersStudbook" 207 name="Kwpn_Form_RegisterFoal_FathersStudbook" 208 maxlength="150" 209 value="" /> 210 </div> 211 212 </div> 213 </div> 214 215 <div id="extrafather"> 216 <div id="extrafatherinfo" class="hidden"> 217 218 @*Via dekstation/ hengstenhouder*@ 219 <div class="form-inline"> 220 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_ViaStation">@Translate("ViaStation", "Via station / stallionholder")</label> 221 <input type="text" 222 class="form-control hide-hints" 223 id="Kwpn_Form_RegisterFoal_ViaStation" 224 name="Kwpn_Form_RegisterFoal_ViaStation" 225 maxlength="50" 226 value="" /> 227 </div> 228 229 </div> 230 </div> 231 } 232 233 @if (isKnownBreeding) 234 { 235 @*FATHER*@ 236 <div class="form-inline"> 237 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StudAnimalName">@Translate("FoalFatherName", "Stud name")</label> 238 <input type="text" 239 class="form-control hide-hints text-uppercase" 240 id="Kwpn_Form_RegisterFoal_StudAnimalName" 241 name="Kwpn_Form_RegisterFoal_StudAnimalName" 242 value="@studName" 243 maxlength="50" 244 @if (!string.IsNullOrEmpty(studName)) { <text> readonly="readonly" </text> } 245 required /> 246 </div> 247 248 @*BREEDING DATE*@ 249 <div class="form-inline"> 250 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_BreedingDate_Visible">@Translate("BreedingDate", "Breeding date")</label> 251 <input type="text" 252 class="form-control hide-hints" 253 id="Kwpn_Form_RegisterFoal_BreedingDate_Visible" 254 name="Kwpn_Form_RegisterFoal_BreedingDate_Visible" 255 value="@breedingDate" 256 maxlength="50" 257 disabled /> 258 </div> 259 } 260 261 <div id="GestationPeriodWarning" class="warning hidden"> 262 @Translate("GestationPeriodWarning", "Gestation period too long or too short") 263 </div> 264 265 <div class="col-xs-12 col-md-8 col-md-offset-4 navigation-next"> 266 <button class="panelbutton panelbutton--next" id="btn-next-breeding-data" type="button" defaultText="@Translate("FoalRegistration_BtnToRegistrationData", "To registration data").JsEncode()" disabled="disabled">@Translate("FoalRegistration_BtnToRegistrationData", "To registration data")</button> 267 </div> 268 269 </div> 270 </div> 271 </div> 272 273 <div class="row hidden" id="registration-data-panel"> 274 <div class="col-xs-12"> 275 276 <div id="Kwpn_Form_RegisterHorse_FoalData"> 277 278 <h3>@Translate("FoalRegistration", "Registration")</h3> 279 280 <div class="form-group"> 281 <div class="form-inline" id="birthDateInfo"> 282 <label class="control-label col-sm-4"> </label> 283 <label class="control-label">@Translate("FirstSelectADate", "First select a date of birth")</label> 284 </div> 285 @*DATE OF BIRTH*@ 286 <div class="form-inline"> 287 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_FoalDateOfBirth">@Translate("FoalDateOfBirth", "Date of birth")</label> 288 <input type="text" 289 class="form-control hide-hints" 290 id="Kwpn_Form_RegisterFoal_FoalDateOfBirth" 291 name="Kwpn_Form_RegisterFoal_FoalDateOfBirth" 292 value="" 293 required /> 294 </div> 295 <div id="form-content-base-info" class="hidden"> 296 297 @*DECEASED*@ 298 <div class="form-inline"> 299 <label class="control-label col-sm-4">@Translate("FoalDeceased", "Foal deceased")</label> 300 <input type="checkbox" 301 id="Kwpn_Form_RegisterFoal_FoalDeceased" 302 name="Kwpn_Form_RegisterFoal_FoalDeceased" 303 value="true" /> 304 <label class="normal" for="Kwpn_Form_RegisterFoal_FoalDeceased">@Translate("YesNo", "yes/no")</label> 305 </div> 306 307 @*MOTHER DECEASED*@ 308 <div class="form-inline"> 309 <label class="control-label col-sm-4">@Translate("MareDeceased", "Mare deceased")</label> 310 <input type="checkbox" 311 id="Kwpn_Form_RegisterFoal_MareDeceased" 312 name="Kwpn_Form_RegisterFoal_MareDeceased" 313 value="true" /> 314 <label class="normal" for="Kwpn_Form_RegisterFoal_MareDeceased">@Translate("YesNo", "yes/no")</label> 315 </div> 316 @*NAME*@ 317 <div class="form-inline"> 318 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_FoalName">@Translate("FoalName", "Foal name")</label> 319 <input type="text" 320 class="form-control hide-hints text-uppercase" 321 id="Kwpn_Form_RegisterFoal_FoalName" 322 name="Kwpn_Form_RegisterFoal_FoalName" 323 value="" 324 required 325 maxlength="35" /> 326 </div> 327 @*GENDER: Required for deceased foals*@ 328 <div class="form-inline"> 329 <label class="control-label col-sm-4">@Translate("FoalGender", "Foal gender")</label> 330 <div class="checkboxList"> 331 <input type="radio" 332 id="@string.Format("Kwpn_Form_RegisterFoal_FoalGender_{0}", Kwpn.Models.Enumerations.Gender.HENGST.ToString())" 333 name="Kwpn_Form_RegisterFoal_FoalGender" 334 value="@Kwpn.Models.Enumerations.Gender.HENGST.ToString()" 335 checked="checked" /> 336 <label class="normal radio-label" 337 for="@string.Format("Kwpn_Form_RegisterFoal_FoalGender_{0}", Kwpn.Models.Enumerations.Gender.HENGST.ToString())">@Translate("FoalGenderMale", "Male / Colt")</label> 338 <br /> 339 <input type="radio" 340 id="@string.Format("Kwpn_Form_RegisterFoal_FoalGender_{0}", Kwpn.Models.Enumerations.Gender.MERRIE.ToString())" 341 name="Kwpn_Form_RegisterFoal_FoalGender" 342 value="@Kwpn.Models.Enumerations.Gender.MERRIE.ToString()" /> 343 <label class="normal radio-label" 344 for="@string.Format("Kwpn_Form_RegisterFoal_FoalGender_{0}", Kwpn.Models.Enumerations.Gender.MERRIE.ToString())">@Translate("FoalGenderFemale", "Female / Filly")</label> 345 </div> 346 </div> 347 348 @if (isUnknownBreeding) 349 { 350 <div class="form-inline"> 351 <label class="control-label col-sm-4">@Translate("BreedingType", "Breeding type")</label> 352 <div class="radiodiv"> 353 <input type="radio" id="Kwpn_Form_RegisterFoal_BreedingType_None" name="Kwpn_Form_RegisterFoal_BreedingType" value='@Kwpn.Models.Enumerations.BreedingType.None.ToString("G")' checked="checked" /> 354 <label for="Kwpn_Form_RegisterFoal_BreedingType_None" class="radio-label">@Translate("BreedingType_None", "not applicable")</label> 355 <br /> 356 <input type="radio" id="Kwpn_Form_RegisterFoal_BreedingType_ET" name="Kwpn_Form_RegisterFoal_BreedingType" value='@Kwpn.Models.Enumerations.BreedingType.ET.ToString("G")' /> 357 <label for="Kwpn_Form_RegisterFoal_BreedingType_ET" class="radio-label">@Translate("BreedingType_ET", "ET")</label> 358 <br /> 359 <input type="radio" id="Kwpn_Form_RegisterFoal_BreedingType_ICSI" name="Kwpn_Form_RegisterFoal_BreedingType" value='@Kwpn.Models.Enumerations.BreedingType.ICSI.ToString("G")' /> 360 <label for="Kwpn_Form_RegisterFoal_BreedingType_ICSI" class="radio-label">@Translate("BreedingType_ICSI", "ICSI")</label> 361 </div> 362 </div> 363 } 364 365 </div> 366 367 @if (isUnknownBreeding) 368 { 369 <div id="breedingdata"> 370 <div id="breedinginfo-insemination" class="hidden"> 371 @*Datum insemineren*@ 372 <div class="form-inline"> 373 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_InseminationDate">@Translate("InseminationDate", "Insemination date")</label> 374 <input type="text" 375 class="form-control hide-hints" 376 id="Kwpn_Form_RegisterFoal_InseminationDate" 377 name="Kwpn_Form_RegisterFoal_InseminationDate" 378 value="" 379 required="required" /> 380 </div> 381 </div> 382 <div id="breedinginfo" class="hidden"> 383 @*Datum spoelen*@ 384 <div class="form-inline"> 385 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_RinseDate">@Translate("RinseDate", "Rinse date")</label> 386 <input type="text" 387 class="form-control hide-hints" 388 id="Kwpn_Form_RegisterFoal_RinseDate" 389 name="Kwpn_Form_RegisterFoal_RinseDate" 390 value="" 391 required="required" /> 392 </div> 393 394 @*Datum transplanteren*@ 395 <div class="form-inline"> 396 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_TransplantDate">@Translate("TransplantDate", "Transplant date")</label> 397 <input type="text" 398 class="form-control hide-hints" 399 id="Kwpn_Form_RegisterFoal_TransplantDate" 400 name="Kwpn_Form_RegisterFoal_TransplantDate" 401 value="" 402 required="required" /> 403 </div> 404 405 @*Draagmerrie*@ 406 <div class="form-inline"> 407 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_SurrogateMother">@Translate("SurrogateMother", "Surrogate mother")</label> 408 <input type="text" class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_SurrogateMother" name="Kwpn_Form_RegisterFoal_SurrogateMother" value="" maxlength="50" required="required" /> 409 </div> 410 411 </div> 412 </div> 413 414 @*BREEDING DIRECTION*@ 415 <div class="form-inline hidden" id="unknown-breedingdirection"> 416 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_BreedingDirection">@Translate("BreedingDirection", "Breeding direction")</label> 417 <select class="form-control hide-hints unknown" id="Kwpn_Form_RegisterFoal_BreedingDirection" name="Kwpn_Form_RegisterFoal_BreedingDirection" required> 418 @*filled by javascript*@ 419 </select> 420 </div> 421 } 422 </div> 423 424 <div id="form-content-foal-deceased" class="hidden"> 425 <div class="form-group"> 426 @*DECEASED REASON *@ 427 <div class="form-inline"> 428 <label class="control-label col-sm-4">@Translate("FoalDeceasedReason", "Reason of death")</label> 429 <div class="checkboxList"> 430 @foreach (LoopItem f in GetLoop("Form.Fields").Where(f => f.GetString("Field.Systemname") == "Kwpn_Form_RegisterFoal_FoalDeceasedReason")) 431 { 432 foreach (LoopItem fo in f.GetLoop("FieldOptions")) 433 { 434 string id = string.Format("Kwpn_Form_RegisterFoal_FoalDeceasedReason_{0}", fo.GetString("Field.Option.Value")); 435 string value = Translate(string.Format("FoalDeceasedReason_Value_{0}", fo.GetString("Field.Option.Value")), fo.GetString("Field.Option.Value")); 436 string text = Translate(string.Format("FoalDeceasedReason_Text_{0}", fo.GetString("Field.Option.Text")), fo.GetString("Field.Option.Text")); 437 string checkedIndicator = ""; 438 if (fo.GetInteger("FieldOptions.LoopCounter") == 1) 439 { 440 checkedIndicator = "checked=\"checked\""; 441 } 442 <input type="radio" id="@id" name="Kwpn_Form_RegisterFoal_FoalDeceasedReason" value="@value" @checkedIndicator /> 443 <label for="@id" class="radio-label">@text</label> 444 <br /> 445 } 446 } 447 </div> 448 </div> 449 </div> 450 </div> 451 452 <div id="form-content-foal-alive" class="hidden"> 453 454 <div class="form-group"> 455 456 @*COLOR*@ 457 <div class="form-inline"> 458 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_FoalColor">@Translate("FoalColor", "Color")</label> 459 <select class="form-control hide-hints" 460 id="Kwpn_Form_RegisterFoal_FoalColor" 461 name="Kwpn_Form_RegisterFoal_FoalColor" 462 required> 463 <option value="">@Translate("Select", "Select")</option> 464 @foreach (Kwpn.Repository.Kwpn_Colors foalColor in colors) 465 { 466 <option value="@foalColor.ColorCode">@foalColor.Color</option> 467 } 468 </select> 469 @*todo: select with values from equis?*@ 470 </div> 471 472 @*CHIP*@ 473 <div class="form-inline"> 474 <label class="control-label col-sm-4">@Translate("ChipFoal", "Chip")</label> 475 <input type="checkbox" 476 id="Kwpn_Form_RegisterFoal_Chip" 477 name="Kwpn_Form_RegisterFoal_Chip" 478 value="true" checked="checked" /> 479 <label class="normal" for="Kwpn_Form_RegisterFoal_Chip">@Translate("YesNo", "yes/no")</label> 480 </div> 481 482 @*SEND PASSPORT TO STABLE OPTION FOR FOREIGN USERS*@ 483 @if (!string.Equals(dwUser.CountryCode, "NL") && !string.Equals(dwUser.Country, "NL")) 484 { 485 <div class="form-inline"> 486 <label class="control-label col-sm-4">@Translate("PassportViaStableAddress", "Passport via stable address")</label> 487 <input type="checkbox" 488 id="Kwpn_Form_RegisterFoal_PassportViaStabbleAddress" 489 name="Kwpn_Form_RegisterFoal_PassportViaStabbleAddress" 490 value="true" /> 491 <label class="normal" for="Kwpn_Form_RegisterFoal_PassportViaStabbleAddress">@Translate("YesNo", "yes/no")</label> 492 </div> 493 } 494 495 @if (isKnownBreeding) 496 { 497 @*BREEDING DIRECTION*@ 498 <div class="form-inline"> 499 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_BreedingDirection">@Translate("BreedingDirection", "Breeding direction")</label> 500 <select class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_BreedingDirection" name="Kwpn_Form_RegisterFoal_BreedingDirection" required> 501 @*filled by javascript*@ 502 </select> 503 </div> 504 } 505 506 </div> 507 508 @*GENOMIC BREEDING VALUE RESEARCH*@ 509 <div class="genome-box"> 510 <div class="form-inline"> 511 512 <h3>@Translate("RegisterFoal_GenomicBreedingValueResearchHeader", "Request genome breeding value OC")</h3> 513 514 <p>@Translate("RegisterFoal_GenomicBreedingValueResearchInfoIntro", "")</p> 515 516 <label class="control-label col-sm-4 no-asterisk" for="Kwpn_Form_RegisterFoal_RequestForDnaResearch">@Translate("RegisterFoal_GenomicBreedingValueResearchLabel", "Request direct genome breeding value OC")</label> 517 518 <input type="checkbox" 519 id="Kwpn_Form_RegisterFoal_RequestForDnaResearch" 520 name="Kwpn_Form_RegisterFoal_RequestForDnaResearch" 521 value="true" /><div id="DisabledByBreedingType">@Translate("GenomeBreedingValueTest_DisabledText", "Genome breeding value OC is not available for Dressage- and Geldinghorses")</div> 522 </div> 523 </div> 524 525 @*WFFS-TEST*@ 526 <div class="wffs-box"> 527 <div class="form-inline"> 528 529 <h3>@Translate("RegisterFoal_WFFSTestHeader", "Request WFFS-test")</h3> 530 <p>@Translate("RegisterFoal_WFFSTestIntro", "")</p> 531 532 <label class="control-label col-sm-4 no-asterisk" for="Kwpn_Form_RegisterFoal_RequestWffsTest">@Translate("RegisterFoal_WFFSTestAcceptance", "Request WFFS-test")</label> 533 <input type="checkbox" 534 id="Kwpn_Form_RegisterFoal_RequestWffsTest" 535 name="Kwpn_Form_RegisterFoal_RequestWffsTest" 536 value="true" /> 537 </div> 538 </div> 539 540 @if (isKnownBreeding) 541 { 542 // unknown breeding > owner = breeder 543 544 <br /> 545 <h3>@Translate("BreederData", "Breeder data")</h3> 546 <div class="form-group"> 547 @*BREEDER MEMBERSHIP NUMBER*@ 548 <div class="form-inline"> 549 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_BreederMembershipNumber">@Translate("BreederMembershipNumber", "BreederMembershipNumber")</label> 550 <input type="text" 551 class="form-control hide-hints" 552 id="Kwpn_Form_RegisterFoal_BreederMembershipNumber" 553 name="Kwpn_Form_RegisterFoal_BreederMembershipNumber" 554 value="" 555 maxlength="50" 556 required /> 557 </div> 558 @*BREEDER NAME*@ 559 <div class="form-inline"> 560 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_BreederName">@Translate("BreederName", "Breeder name")</label> 561 <input type="text" 562 class="form-control hide-hints" 563 id="Kwpn_Form_RegisterFoal_BreederName" 564 name="Kwpn_Form_RegisterFoal_BreederName" 565 value="" 566 maxlength="50" 567 required /> 568 </div> 569 @*BREEDER NAME*@ 570 <div class="form-inline"> 571 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_CoBreederMembershipNumbers">@Translate("Co-Breeders", "Co-breeders")</label> 572 <input type="text" 573 class="form-control hide-hints" 574 id="Kwpn_Form_RegisterFoal_CoBreederMembershipNumbers" 575 name="Kwpn_Form_RegisterFoal_CoBreederMembershipNumbers" 576 value="" 577 maxlength="255" /> 578 </div> 579 </div> 580 } 581 582 </div> 583 </div> 584 585 <div class="col-xs-12 col-md-8 col-md-push-4 navigation-next"> 586 <button class="panelbutton panelbutton--next" id="btn-next-owner-data" type="button" defaultText="@Translate("FoalRegistration_BtnToOwnerData", "To registered info").JsEncode()" disabled="disabled">@Translate("FoalRegistration_BtnToOwnerData", "To registered info")</button> 587 </div> 588 <div class="col-xs-12 col-md-4 col-md-pull-8 navigation-prev"> 589 <button class="panelbutton panelbutton--previous" id="btn-prev-beeding-data" type="button" defaultText="@Translate("FoalRegistration_BtnBackToBreedingData", "Back").JsEncode()">@Translate("FoalRegistration_BtnBackToBreedingData", "Back")</button> 590 </div> 591 592 </div> 593 </div> 594 595 <div class="row hidden" id="owner-data-panel"> 596 <div class="col-xs-12"> 597 <h3>@Translate("OwnerData", "Owner data")</h3> 598 <div class="form-group"> 599 @*OWNER NAME*@ 600 <div class="form-inline"> 601 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerName">@Translate("OwnerName", "Owner name")</label> 602 <input type="text" 603 class="form-control hide-hints" 604 id="Kwpn_Form_RegisterFoal_OwnerName" 605 name="Kwpn_Form_RegisterFoal_OwnerName" 606 value="@KwpnUsers.CurrentUser().DwUser.Name" 607 maxlength="50" 608 required 609 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.Name)) { <text> readonly="readonly" </text> } /> 610 </div> 611 @*OWNER ADDRESS*@ 612 <div class="form-inline"> 613 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerAddress">@Translate("OwnerAddress", "Owner address")</label> 614 <input type="text" 615 class="form-control hide-hints" 616 id="Kwpn_Form_RegisterFoal_OwnerAddress" 617 name="Kwpn_Form_RegisterFoal_OwnerAddress" 618 value="@KwpnUsers.CurrentUser().DwUser.Address" 619 maxlength="50" 620 required 621 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.Address)) { <text> readonly="readonly" </text> } /> 622 </div> @*OWNER HOUSE NUMBER*@ 623 <div class="form-inline"> 624 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerHouseNumber">@Translate("OwnerHouseNumber", "Owner house number")</label> 625 <input type="text" 626 class="form-control hide-hints" 627 id="Kwpn_Form_RegisterFoal_OwnerHouseNumber" 628 name="Kwpn_Form_RegisterFoal_OwnerHouseNumber" 629 value="@KwpnUsers.CurrentUser().DwUser.HouseNumber" 630 maxlength="10" 631 @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)) { <text> required</text>} 632 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.HouseNumber)) { <text> readonly="readonly" </text> } /> 633 </div> 634 @*OWNER POSTAL CODE*@ 635 <div class="form-inline"> 636 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerPostalCode">@Translate("OwnerPostalCode", "Owner postal code")</label> 637 <input type="text" 638 class="form-control hide-hints" 639 id="Kwpn_Form_RegisterFoal_OwnerPostalCode" 640 name="Kwpn_Form_RegisterFoal_OwnerPostalCode" 641 value="@KwpnUsers.CurrentUser().DwUser.Zip" 642 maxlength="10" 643 required 644 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.Zip)) { <text> readonly="readonly" </text> } /> 645 </div> 646 @*OWNER CITY*@ 647 <div class="form-inline"> 648 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerCity">@Translate("OwnerCity", "Owner city")</label> 649 <input type="text" 650 class="form-control hide-hints" 651 id="Kwpn_Form_RegisterFoal_OwnerCity" 652 name="Kwpn_Form_RegisterFoal_OwnerCity" 653 value="@KwpnUsers.CurrentUser().DwUser.City" 654 maxlength="50" 655 required 656 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.City)) { <text> readonly="readonly" </text> } /> 657 </div> 658 @*OWNER COUNTRY*@ 659 <div class="form-inline"> 660 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerCountry">@Translate("OwnerCountry", "Owner country")</label> 661 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.Country)) 662 { 663 <input type="hidden" name="Kwpn_Form_RegisterFoal_OwnerCountry" id="Kwpn_Form_RegisterFoal_OwnerCountry" value="@KwpnUsers.CurrentUser().DwUser.Country" /> 664 <input type="text" class="form-control" readonly="readonly" name="Kwpn_Form_RegisterFoal_OwnerCountryVisible" id="Kwpn_Form_RegisterFoal_OwnerCountryVisible" value="@countries.FirstOrDefault(c => c.CountryCode.Equals(KwpnUsers.CurrentUser().DwUser.Country) || c.CountryName.Equals(KwpnUsers.CurrentUser().DwUser.Country)).CountryName" /> 665 } 666 else 667 { 668 <select class="form-control hide-hints capitalize" name="Kwpn_Form_RegisterFoal_OwnerCountry" id="Kwpn_Form_RegisterFoal_OwnerCountry" required> 669 <option value="" selected>@Translate("Select")</option> 670 @foreach (var country in countries.OrderBy(c => c.CountryName)) 671 { 672 <option value="@country.CountryCode" data-code="@country.CountryCode" class="capitalize" @if (KwpnUsers.CurrentUser().DwUser.Country.Equals(country.CountryCode, StringComparison.InvariantCultureIgnoreCase) || KwpnUsers.CurrentUser().DwUser.Country.Equals(country.CountryName, StringComparison.InvariantCultureIgnoreCase)) { <text> selected="selected" </text> }>@country.CountryName</option> 673 } 674 </select> 675 } 676 677 678 679 </div> @*OWNER EMAIL*@ 680 <div class="form-inline"> 681 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerEmailAddress">@Translate("OwnerEmail", "Owner email address")</label> 682 <input type="email" 683 class="form-control hide-hints" 684 id="Kwpn_Form_RegisterFoal_OwnerEmailAddress" 685 name="Kwpn_Form_RegisterFoal_OwnerEmailAddress" 686 value="@KwpnUsers.CurrentUser().DwUser.Email" 687 maxlength="255" 688 required 689 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.Email)) { <text> readonly="readonly" </text> } /> 690 </div> 691 @*OWNER PHONE1*@ 692 <div class="form-inline"> 693 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerPhone1">@Translate("OwnerPhone1", "Owner phone 1")<span class="fa fa-asterisk" aria-hidden="true"></span></label> 694 <input type="tel" 695 class="form-control hide-hints" 696 id="Kwpn_Form_RegisterFoal_OwnerPhone1" 697 name="Kwpn_Form_RegisterFoal_OwnerPhone1" 698 value="@KwpnUsers.CurrentUser().DwUser.Phone" 699 maxlength="50" 700 required 701 @if (!string.IsNullOrWhiteSpace(KwpnUsers.CurrentUser().DwUser.Phone)) { <text> readonly="readonly" </text> } 702 onchange="ValidatePanelOwnerData(this)"/> 703 </div> 704 705 @*OWNER PHONE2*@ 706 <div class="form-inline"> 707 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_OwnerPhone2">@Translate("OwnerPhone2", "Owner phone 2")</label> 708 <input type="tel" 709 class="form-control hide-hints" 710 id="Kwpn_Form_RegisterFoal_OwnerPhone2" 711 name="Kwpn_Form_RegisterFoal_OwnerPhone2" 712 value="@KwpnUsers.CurrentUser().DwUser.PhoneMobile" 713 maxlength="50" 714 required 715 onchange="ValidatePanelOwnerData(this)"/> 716 </div> 717 718 <div class="form-inline not-in-form"> 719 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers">@Translate("Co-Registered", "(Co-)Registered")</label> 720 <input type="hidden" id="Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers" name="Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers" value="" /> 721 <div class="radiodiv"> 722 <div id="selectedCoRegistered"></div> 723 <button id="btnAddCoRegistered"><i class="fa fa-plus"></i> @Translate("AddCoRegistered", "Add a co-registered")</button> 724 </div> 725 </div> 726 727 </div> 728 729 <div class="col-xs-12 col-md-8 col-md-push-4 navigation-next"> 730 <button class="panelbutton panelbutton--next" id="btn-next-barn-data" type="button" defaultText="@Translate("FoalRegistration_BtnToBarnData", "To stable info").JsEncode()" disabled="disabled">@Translate("FoalRegistration_BtnToBarnData", "To stable info")</button> 731 </div> 732 <div class="col-xs-12 col-md-4 col-md-pull-8 navigation-prev"> 733 <button class="panelbutton panelbutton--previous" id="btn-prev-registration-data" type="button" defaultText="@Translate("FoalRegistration_BtnBackToRegistrationData", "Back").JsEncode()">@Translate("FoalRegistration_BtnBackToRegistrationData", "Back")</button> 734 </div> 735 736 </div> 737 </div> 738 739 740 <div class="row hidden" id="barn-data-panel"> 741 <div class="col-xs-12"> 742 743 <h3>@Translate("StableData", "Stable data")</h3> 744 <div class="form-group"> 745 @*STABLE ADDRESS*@ 746 <div class="form-inline"> 747 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StableAddress">@Translate("StableAddress", "Address")</label> 748 <input type="text" class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_StableAddress" name="Kwpn_Form_RegisterFoal_StableAddress" value="" required /> 749 </div> 750 @*STABLE HOUSE NUMBER*@ 751 <div class="form-inline"> 752 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StableHouseNumber">@Translate("StableHouseNumber", "House number")</label> 753 <input type="text" class="form-control hide-hints" maxlength="10" id="Kwpn_Form_RegisterFoal_StableHouseNumber" name="Kwpn_Form_RegisterFoal_StableHouseNumber" value="" @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)) { <text> required</text>} /> 754 </div> 755 @*STABLE POSTAL CODE*@ 756 <div class="form-inline"> 757 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StablePostalCode">@Translate("StablePostalCode", "Postal code")</label> 758 <input type="text" class="form-control hide-hints" maxlength="10" id="Kwpn_Form_RegisterFoal_StablePostalCode" name="Kwpn_Form_RegisterFoal_StablePostalCode" value="" required /> 759 </div> 760 @*STABLE CITY*@ 761 <div class="form-inline"> 762 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StableCity">@Translate("StableCity", "City")</label> 763 <input type="text" class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_StableCity" name="Kwpn_Form_RegisterFoal_StableCity" value="" required /> 764 </div> 765 @*STABLE COUNTRY*@ 766 <div class="form-inline"> 767 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_StableCountry">@Translate("StableCountry", "Country")</label> 768 <select class="form-control hide-hints capitalize" name="Kwpn_Form_RegisterFoal_StableCountry" id="Kwpn_Form_RegisterFoal_StableCountry" required> 769 <option value="" selected>@Translate("Select")</option> 770 @foreach (var country in countries.OrderBy(c => c.CountryName)) 771 { 772 <option value="@country.CountryCode" data-code="@country.CountryCode" class="capitalize" @if (KwpnUsers.CurrentUser().DwUser.Country.Equals(country.CountryCode, StringComparison.InvariantCultureIgnoreCase) || KwpnUsers.CurrentUser().DwUser.Country.Equals(country.CountryName, StringComparison.InvariantCultureIgnoreCase)) { <text> selected="selected" </text> }>@country.CountryName</option> 773 } 774 </select> 775 </div> 776 @*EXTRA FOAL AMOUNT*@ 777 <div class="form-inline"> 778 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_ExtraAmountOfRegistrations">@Translate("ExtraFoalAmount", "Are there any more foals submitted for registration on this stable address?")</label> 779 <input type="number" class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_ExtraAmountOfRegistrations" name="Kwpn_Form_RegisterFoal_ExtraAmountOfRegistrations" value="0" min="0" required /> 780 </div> 781 </div> 782 783 @if (!isKnownBreeding || ProductHelper.GetProductPrice(registerFoalProduct) > 0) 784 { 785 <br /><hr /> 786 } 787 788 @if (!isKnownBreeding) 789 { 790 <br /> 791 <h3>@Translate("Remarks", "Remarks")</h3> 792 <div class="form-group"> 793 @*REMARKS*@ 794 <div class="form-inline"> 795 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_Remarks">@Translate("YourRemarks", "Your remarks")</label> 796 <textarea class="form-control hide-hints" 797 id="Kwpn_Form_RegisterFoal_Remarks" 798 name="Kwpn_Form_RegisterFoal_Remarks"></textarea> 799 </div> 800 </div> 801 } 802 803 @if (ProductHelper.GetProductPrice(registerFoalProduct) > 0) 804 { 805 <div id="payment-data"> 806 <br /> 807 <h3>@Translate("PaymentData", "Payment data")</h3> 808 <div class="form-group"> 809 <div class="form-inline"> 810 <label class="control-label col-sm-4">@Translate("PaymentMethod", "Payment method")</label> 811 @foreach (var f in GetLoop("Form.Fields").Where(f => f.GetString("Field.Systemname") == "Kwpn_Form_RegisterFoal_PaymentMethod")) 812 { 813 var fieldOptions = f.GetLoop("FieldOptions"); 814 815 var checkedCounter = isKnownBreeding ? fieldOptions.Count : 1; // KWPN-1326 iDeal default bij known, per factuur bij unknown 816 817 // filter payment options 818 if (isUnknownBreeding) 819 { 820 fieldOptions = fieldOptions.Where(fo => fo.GetString("Field.Option.Value").Equals("OnAccount") || fo.GetString("Field.Option.Value").Equals("Authorization")).ToList(); 821 } 822 823 foreach (var fo in fieldOptions) 824 { 825 var id = string.Format("Kwpn_Form_RegisterFoal_PaymentMethod_{0}", fo.GetString("Field.Option.Value")); 826 var value = Translate(string.Format("PaymentMethod_Value_{0}", fo.GetString("Field.Option.Value")), fo.GetString("Field.Option.Value")); 827 var text = Translate(string.Format("PaymentMethod_Text_{0}", fo.GetString("Field.Option.Text")), fo.GetString("Field.Option.Text")); 828 var checkedIndicator = ""; 829 if (fo.GetInteger("FieldOptions.LoopCounter") == checkedCounter) 830 { 831 checkedIndicator = "checked=\"checked\""; 832 } 833 834 <input type="radio" id="@id" name="Kwpn_Form_RegisterFoal_PaymentMethod" value="@value" @checkedIndicator /> 835 <input type="hidden" id="@id" name="Kwpn_Form_RegisterFoal_PaymentMethod_FieldOptionId" value="@fo.GetInteger("Field.Option.ParentSystemname")" /> 836 <label for="@id" class="radio-label">@text</label> 837 } 838 } 839 </div> 840 </div> 841 842 <div class="row hidden" id="payment-container"> 843 <div class="col-xs-12"> 844 <div class="form-group"> 845 <br /> 846 <br /> 847 <h3>@Translate("AuthorizationData", "Authorization data")</h3> 848 <div class="form-inline"> 849 <label class="control-label col-sm-4">@Translate("Authorization", "Authorization")</label> 850 <input type="checkbox" id="Kwpn_Form_RegisterFoal_AgreedWithAuthorization" name="Kwpn_Form_RegisterFoal_AgreedWithAuthorization" required /> <label for="Kwpn_Form_RegisterFoal_AgreedWithAuthorization" class="checkbox-label no-asterisk">@Translate("AuthorizationApproved", "Approved")</label> 851 </div> 852 <div class="form-inline" id="iban-wrapper"> 853 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_IBAN">@Translate("IBAN", "IBAN")</label> 854 <input type="text" 855 class="form-control text-uppercase" 856 id="Kwpn_Form_RegisterFoal_IBAN" 857 name="Kwpn_Form_RegisterFoal_IBAN" 858 value="" 859 data-default="@iban" 860 title="@Translate("UseValidIBAN")" required /> 861 <br style="clear:both;" /> 862 <label class="control-label col-sm-4 hidden-xs no-asterisk"> </label> 863 <small class="nowrap">@Translate("IBAN_PatternInfo", "Pattern: NL12 BANK 3456 7890 12")</small> 864 </div> 865 <div class="form-inline"> 866 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_AuthorizationName">@Translate("AuthorizationName", "Name")</label> 867 <input type="text" class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_AuthorizationName" name="Kwpn_Form_RegisterFoal_AuthorizationName" value="@authorizationName" required /> 868 </div> 869 <div class="form-inline"> 870 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_AuthorizationResidence">@Translate("AuthorizationResidence", "Residence")</label> 871 <input type="text" class="form-control hide-hints" id="Kwpn_Form_RegisterFoal_AuthorizationResidence" name="Kwpn_Form_RegisterFoal_AuthorizationResidence" value="@authorizationResidence" required /> 872 </div> 873 <div class="form-inline"> 874 <label class="control-label col-sm-4" for="Kwpn_Form_RegisterFoal_BIC">@Translate("BIC", "BIC")</label> 875 <div class="inner-addon right-addon col-sm-4"> 876 <i class="fa fa-question" id="bicinfo" data-toggle="tooltip" title="@Translate("BICTooltip", "Visitors from outside the Netherlands have to enter their Business Identifier Code (BIC)")"></i> 877 <input type="text" 878 class="form-control text-uppercase" 879 id="Kwpn_Form_RegisterFoal_BIC" 880 name="Kwpn_Form_RegisterFoal_BIC" 881 value="" 882 data-default="@bic" 883 pattern="([a-zA-Z]{4}[a-zA-Z]{2}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?)" 884 title="@Translate("UseValidBIC")" /> 885 </div> 886 887 </div> 888 <br /> 889 <br /> 890 </div> 891 </div> 892 </div> 893 </div> 894 895 } 896 else 897 { 898 // no payment for foals of unknown breeding. 899 <input type="hidden" 900 name="Kwpn_Form_RegisterFoal_PaymentMethod" 901 id="Kwpn_Form_RegisterFoal_PaymentMethod" 902 value="@PaymentMethod.Unknown" /> 903 } 904 905 </div> 906 </div> 907 908 909 <button class="hidden" type="submit" id="kwpn_Form_RegisterFoal_FormSubmitter">@Translate("Submit", "Submit")</button> 910 911 <div class="row hidden" id="panel-order-overview"> 912 <div class="col-xs-12 form-order-overview"> 913 <h2>@Translate("OrderOverview", "Order overview")</h2> 914 <table> 915 <colgroup> 916 <col width="30" /> 917 <col /> 918 </colgroup> 919 <tr class="head"> 920 <th><i class="fa fa-info"></i></th> 921 <th>@Translate("Product", "Product")</th> 922 </tr> 923 <tr> 924 <td> </td> 925 <td><span id="foalRegisterOverviewProductName"></span></td> 926 </tr> 927 <tr class="head"> 928 <th><i class="fa fa-eur"></i></th> 929 <th>@Translate("Price", "Price")</th> 930 </tr> 931 <tr> 932 <td> </td> 933 <td><span id="foalRegisterOverviewProductPriceFormatted"></span></td> 934 </tr> 935 <tr class="conditions"> 936 <td><input type="checkbox" class="form-control agreement-checkbox" id="Kwpn_Form_RegisterFoal_AgreedWithConditions" name="Kwpn_Form_RegisterFoal_AgreedWithConditions" required="required" /></td> 937 <td><label for="Kwpn_Form_RegisterFoal_AgreedWithConditions">@FormHelper.GetAgreeWithConditionsText(Kwpn.Models.Enumerations.FormType.RegisterFoal)</label></td> 938 </tr> 939 <tr class="conditions"> 940 <td><input type="checkbox" class="form-control agreement-checkbox" id="Kwpn_Form_RegisterFoal_AgreedWithPrivacy" name="Kwpn_Form_RegisterFoal_AgreedWithPrivacy" required="required" /></td> 941 <td><label for="Kwpn_Form_RegisterFoal_AgreedWithPrivacy">@Translate("AgreeWithPrivacyStatement", "I agree with the conditions stated in the privacy statement page")</label></td> 942 </tr> 943 </table> 944 945 <div class="col-xs-12 navigation-next"> 946 <button class="submitBtn" type="button" defaultText="@buttonText.JsEncode()" disabled="disabled">@buttonText</button> 947 </div> 948 </div> 949 950 951 <div class="col-xs-12 navigation-prev"> 952 <button class="panelbutton panelbutton--previous" id="btn-prev-owner-data" type="button" defaultText="@Translate("FoalRegistration_BtnBackToOwnerData", "Back").JsEncode()">@Translate("FoalRegistration_BtnBackToOwnerData", "Back")</button> 953 </div> 954 </div> 955 956 @GetValue("Form.End") 957 958 </div> 959 </div> 960 </div> 961 962 @SnippetStart("JavascriptsBottom") 963 964 <div class="modal fade" id="select-co-registered" tabindex="-1" role="dialog" aria-labelledby="select-co-registered-modal" aria-hidden="true"> 965 <div class="modal-dialog"> 966 <div class="modal-content"> 967 <div class="modal-header"> 968 @Translate("FoalRegistration_SelectCoRegistered", "Select a co-registered") 969 </div> 970 <div class="modal-body"> 971 <form name="form-select-new-owner" class="form-body"> 972 <div class="form-group"> 973 <div class="form-inline"> 974 <label class="control-label col-sm-4" for="SearchCoRegisteredMemberNumber">@Translate("FoalRegistration_SearchCoRegisteredMemberNumber", "Membership number")</label> 975 <input type="text" class="form-control" maxlength="50" name="SearchCoRegisteredMemberNumber" id="SearchCoRegisteredMemberNumber" placeholder="@Translate("FoalRegistration_SearchCoRegisteredMemberNumberPlaceholder", "Membership number")" /> 976 </div> 977 <div class="form-inline"> 978 <label class="control-label col-sm-4" for="ButtonSearchCoRegistered"> </label> 979 <button class="btn btn-default" id="ButtonSearchCoRegistered" name="ButtonSearchCoRegistered">@Translate("FoalRegistration_SearchCoRegisteredButtonText", "Search")</button> 980 </div> 981 <div id="SearchCoRegisteredResult"></div> 982 </div> 983 </form> 984 </div> 985 <div class="modal-footer"> 986 <a class="orange_arrow_link" data-dismiss="modal" href="javascript:void(0);">@Translate("FoalRegistration_SearchCoRegisteredCancel", "Cancel")</a> 987 <a class="orange_balloon_link modal-ok hidden" href="javascript:void(0);">@Translate("FoalRegistration_SearchCoRegisteredSelectCoRegistered", "Select co-registered")</a> 988 </div> 989 </div> 990 </div> 991 </div> 992 993 <script> 994 var nameStartingLetters = ""; 995 996 @if (isUnknownBreeding) { 997 <text> 998 999 function ShowOrHideEtIcsiBreedingInfoFields() { 1000 if ($("input[name=Kwpn_Form_RegisterFoal_BreedingType]").is(":visible")) { 1001 var selectedBreedingType = $("input[name=Kwpn_Form_RegisterFoal_BreedingType]:checked").val(); 1002 if (selectedBreedingType === '@Kwpn.Models.Enumerations.BreedingType.None.ToString("G")') { 1003 HideEtIcsiBreedingInfoFields(); 1004 ShowInseminationBreedingInfoFields(); 1005 } else { 1006 HideInseminationBreedingInfoFields(); 1007 ShowEtIcsiBreedingInfoFields(); 1008 } 1009 } else { 1010 HideEtIcsiBreedingInfoFields(); 1011 HideInseminationBreedingInfoFields(); 1012 } 1013 } 1014 1015 function HideInseminationBreedingInfoFields() { 1016 1017 // hide all breeding info fields 1018 $("#breedinginfo-insemination").addClass("hidden"); 1019 1020 // clear all breeding info fields 1021 // unrequire all breeding info fields 1022 $("#breedinginfo-insemination").find(":input").each(function () { 1023 $(this).val(""); 1024 $(this).removeAttr("required"); 1025 }); 1026 1027 SetAsterisken(); 1028 } 1029 1030 function ShowInseminationBreedingInfoFields() { 1031 1032 // show new fields form 1033 $("#breedinginfo-insemination").removeClass("hidden");// make fields required 1034 $("#Kwpn_Form_RegisterFoal_InseminationDate", "#breedinginfo-insemination").attr("required", "required"); 1035 SetAsterisken(); 1036 1037 $("input[name=Kwpn_Form_RegisterFoal_BreedingType]").off("change").on("change", function () { 1038 ShowOrHideEtIcsiBreedingInfoFields(); 1039 }); 1040 } 1041 1042 function HideEtIcsiBreedingInfoFields() { 1043 1044 // hide all breeding info fields 1045 $("#breedinginfo").addClass("hidden"); 1046 1047 // clear all breeding info fields 1048 // unrequire all breeding info fields 1049 $("#breedinginfo").find(":input").each(function () { 1050 $(this).val(""); 1051 $(this).removeAttr("required"); 1052 }); 1053 1054 SetAsterisken(); 1055 } 1056 1057 function ShowEtIcsiBreedingInfoFields() { 1058 1059 // show new fields form 1060 $("#breedinginfo").removeClass("hidden"); 1061 1062 // make fields required 1063 $("#Kwpn_Form_RegisterFoal_RinseDate", "#breedinginfo").attr("required", "required"); 1064 $("#Kwpn_Form_RegisterFoal_TransplantDate", "#breedinginfo").attr("required", "required"); 1065 $("#Kwpn_Form_RegisterFoal_SurrogateMother", "#breedinginfo").attr("required", "required"); 1066 $("#Kwpn_Form_RegisterFoal_BreedingDirection.unknown").attr("required", "required"); 1067 SetAsterisken(); 1068 1069 $("input[name=Kwpn_Form_RegisterFoal_BreedingType]").off("change").on("change", function () { 1070 ShowOrHideEtIcsiBreedingInfoFields(); 1071 }); 1072 1073 } 1074 1075 function HideAddFatherManuallyFields() { 1076 1077 // make father required 1078 $("#SearchFather").attr("required", "required"); 1079 1080 // hide all add father manually fields 1081 $("#fatherinfo").addClass("hidden"); 1082 1083 // clear all add father manually fields 1084 // unrequire all add father manually fields 1085 $("#addfathermanually").find(":input").each(function () { 1086 $(this).val(""); 1087 $(this).removeAttr("required"); 1088 }); 1089 1090 SetAsterisken(); 1091 } 1092 1093 function ShowAddFatherManuallyFields() { 1094 1095 // clear previous 1096 ClearPreviousStudResults() 1097 1098 $addfathermanually = $("#addfathermanually"); 1099 1100 // clear input 1101 $("#SearchFather").val(""); 1102 $("label[for=SearchFather]").find("i").remove(); 1103 1104 // show new fields form 1105 $("#fatherinfo").removeClass("hidden"); 1106 1107 // make father search unrequired and father fields required 1108 $("#SearchFather").removeAttr("required"); 1109 $("#Kwpn_Form_RegisterFoal_StudAnimalName", $addfathermanually).attr("required", "required"); 1110 $("#Kwpn_Form_RegisterFoal_StudLifeNumber", $addfathermanually).attr("required", "required"); 1111 SetAsterisken(); 1112 1113 // focus on first field 1114 $("#addfathermanually input:text").first().focus(); 1115 1116 ShowExtraFatherFields(); 1117 } 1118 1119 function HideExtraFatherFields() { 1120 // hide all add father manually fields 1121 $("#extrafatherinfo").addClass("hidden"); 1122 1123 // clear all add father manually fields 1124 // unrequire all add father manually fields 1125 $("#extrafather > input").each(function () { 1126 $(this).val(""); 1127 $(this).removeAttr("required"); 1128 }); 1129 } 1130 1131 function ShowExtraFatherFields() { 1132 $extrafather = $("#extrafather"); 1133 1134 // show new fields form 1135 $("#extrafatherinfo").removeClass("hidden"); 1136 1137 // make fields required 1138 $("#Kwpn_Form_RegisterFoal_ViaStation", $extrafather).attr("required", "required"); 1139 SetAsterisken(); 1140 } 1141 1142 function SearchAvailableStuds() { 1143 1144 // clear previous 1145 ClearPreviousStudResults() 1146 1147 // hide add father manually form fields 1148 HideAddFatherManuallyFields(); 1149 1150 1151 // Hide registration fields 1152 $("#Kwpn_Form_RegisterFoal_FoalDateOfBirth").val(""); 1153 HideRegistration(); 1154 1155 var searchValue = $("#SearchFather").val(); 1156 if (searchValue === "") { 1157 return; 1158 } 1159 1160 var spinner = $('span.input-group-btn i'); 1161 var resultContainer = $("#StudSearchResults"); 1162 1163 if (searchValue.length !== 0) spinner.removeClass('fa-search').addClass('fa-spinner fa-spin'); 1164 1165 var getStudsUrl = "/kwpnwebapi/horses/findfather/@culture/" + searchValue; 1166 $.getJSON(getStudsUrl).done(function (result) { 1167 1168 // clear previous 1169 ClearPreviousStudResults(); 1170 1171 var addNewStudOption = "<p><hr/>@Translate("Stud_CreateNewText", "If you can not find the stud, you can create a new one bij pushing the link below. Extra fields will appear in the form.")<br /><a href=\"javascript:void(0);\" onclick=\"javascript:ShowAddFatherManuallyFields();\" id=\"create-new-stud\">@Translate("Father_CreateNewButtonText", "Add father manually")</a></p>"; 1172 1173 if (result == null || result.Top100 == null || result.Top100.length == 0) { 1174 resultContainer.append("<p>@Translate("NoFatherFound", "No optional father found") @Translate("PleaseRefineYourSearch", "Please refine your search")</p>" + addNewStudOption); 1175 $('div.input-group.form-control').height(resultContainer.height() + 24); 1176 $("#SearchFather").val(""); 1177 spinner.removeClass('fa-spinner fa-spin').addClass('fa-search'); 1178 } else { 1179 var studs = result.Top100; 1180 if (studs.length == 1) { 1181 // immediate select 1182 var stud = studs[0]; 1183 var lifeNumber = (stud.LifenumberComplete !== "") ? stud.LifenumberComplete : stud.Lifenumber; 1184 SelectFather(stud.HorseCode, stud.AnimalName, lifeNumber); 1185 spinner.removeClass('fa-spinner fa-spin').addClass('fa-search'); 1186 ShowExtraFatherFields(); 1187 } else { 1188 // create list 1189 resultContainer.append('<b>@Translate("SelectFather", "Select the father")</b><br />'); 1190 $.each(studs, function (i, stud) { 1191 var lifeNumber = (stud.LifenumberComplete !== "") ? stud.LifenumberComplete : stud.Lifenumber; 1192 var approved = (stud.IsApprovedStud) ? "<div class='fa-approved-stud'></div> " : ""; 1193 resultContainer.append("<div class='studoption' data-horsecode='" + stud.HorseCode + "' data-lifenumber='" + lifeNumber + "'>" + approved + stud.AnimalName + " <span class='small'>(" + stud.Father + " x " + stud.MothersFather + ")</span></div>"); 1194 }); 1195 resultContainer.append(addNewStudOption); 1196 1197 $(".studoption").click(function () { 1198 SelectFather($(this).attr("data-horsecode"), $(this).text(), $(this).attr("data-lifenumber")); 1199 ShowExtraFatherFields(); 1200 ValidatePanelBreedingData(true); 1201 }); 1202 1203 $('div.input-group.form-control').height(resultContainer.height() + 24); 1204 spinner.removeClass('fa-spinner fa-spin').addClass('fa-search'); 1205 } 1206 } 1207 }).fail(function (jqxhr, textStatus, error) { 1208 1209 // clear previous 1210 ClearPreviousStudResults() 1211 1212 var err = textStatus + ", " + error; 1213 console.error("Request SearchAvailableStuds Failed: " + err); 1214 spinner.removeClass('fa-spinner fa-spin').addClass('fa-search'); 1215 1216 }); 1217 } 1218 1219 function ClearPreviousStudResults() { 1220 var resultContainer = $("#StudSearchResults"); 1221 var selectedFather = $("#StudSelected"); 1222 resultContainer.html(""); 1223 selectedFather.html(""); 1224 1225 // clear father code 1226 var selectedFatherCode = $("#Kwpn_Form_RegisterFoal_StudAnimalCode"); 1227 selectedFatherCode.val(""); 1228 1229 // clear father name 1230 var selectedFatherName = $("#Kwpn_Form_RegisterFoal_StudAnimalName"); 1231 selectedFatherName.val(""); 1232 1233 // clear father lifenumber 1234 var selectedFatherLifenumber = $("#Kwpn_Form_RegisterFoal_StudLifeNumber"); 1235 selectedFatherLifenumber.val(""); 1236 1237 $('div.input-group.form-control').css('height', '40px'); 1238 // make searchfield required required 1239 $("#SearchFather").attr("required", "required"); 1240 } 1241 1242 function SelectFather(animalCode, animalName, animalLifenumber) { 1243 1244 $('div.input-group.form-control').css('height', '40px'); 1245 // get selected value and fill hiddenfiled and person balloon 1246 1247 // fill father code 1248 var selectedFatherCode = $("#Kwpn_Form_RegisterFoal_StudAnimalCode"); 1249 selectedFatherCode.val(animalCode); 1250 1251 // fill father name 1252 var selectedFatherName = $("#Kwpn_Form_RegisterFoal_StudAnimalName"); 1253 selectedFatherName.val(animalName); 1254 1255 // fill father lifenumber 1256 var selectedFatherLifenumber = $("#Kwpn_Form_RegisterFoal_StudLifeNumber"); 1257 selectedFatherLifenumber.val(animalLifenumber); 1258 1259 var selectedFather = $("#StudSelected"); 1260 selectedFather.append("<div class='form-inline'><label class='control-label col-sm-4'>@Translate("SelectedFather", "Selected father")</label><div class='selectedFather'><i class='fa fa-close delete-selected-father'></i> " + animalName + " (" + animalLifenumber + ")</div></div>"); 1261 1262 $("#StudSearchResults").html(""); 1263 $("#SearchFather").val(""); 1264 $("label[for=SearchFather]").find("i").remove(); 1265 1266 $(".delete-selected-father").click(function () { 1267 ClearPreviousStudResults(); 1268 HideExtraFatherFields(); 1269 $("#Kwpn_Form_RegisterFoal_FoalDateOfBirth").val(""); 1270 HideRegistration(); 1271 ValidatePanelBreedingData(true); 1272 SetAsterisken(); 1273 }); 1274 1275 // unrequire the search field and focus 1276 $("#SearchFather").removeAttr("required"); 1277 $("#SearchFather").focus(); 1278 1279 } 1280 1281 </text> 1282 } 1283 1284 // check if form is valid 1285 function FormIsHtml5Valid() { 1286 return $("#FormRegisterHorse .form-control:invalid").length == 0; 1287 } 1288 1289 function ibanIsForeign(iban) { 1290 return !iban.toLowerCase().match("^nl"); 1291 } 1292 1293 function makeBicRequired() { 1294 $("#Kwpn_Form_RegisterFoal_BIC").prop("required", true); 1295 var asterisk = "<i class=\"fa fa-asterisk\" aria-hidden=\"true\"></i>"; 1296 $("#Kwpn_Form_RegisterFoal_BIC") 1297 .closest(".form-inline") 1298 .children("label") 1299 .not(":has(> i)") 1300 .append(asterisk); 1301 } 1302 1303 function makeBicUnRequired() { 1304 $("#Kwpn_Form_RegisterFoal_BIC").prop("required", false); 1305 $("#Kwpn_Form_RegisterFoal_BIC") 1306 .closest(".form-inline") 1307 .children("label") 1308 .find("i") 1309 .remove(); 1310 } 1311 1312 // Validate name 1313 function validateName() { 1314 var name = $("#Kwpn_Form_RegisterFoal_FoalName").val(); 1315 1316 // validate starting letter 1317 if (nameStartingLetters != "") { 1318 if (name != "") { 1319 if (!name.toUpperCase().match("^" + nameStartingLetters.toUpperCase())) { 1320 Swal.fire({ title: "@Translate("InvalidInputTitle", "Invalid input")" ,text: "@Translate("FoalNameValidation_StartingLetter", "De naam moet beginnen met") '" + nameStartingLetters.toUpperCase() + "'.", customClass: layout.notifyCopyrightMessageClass }); 1321 $("#Kwpn_Form_RegisterFoal_FoalName").val(""); 1322 } 1323 } 1324 } else { 1325 // wat dan? breeding info ophalen wellicht niet geslaagd ... 1326 } 1327 1328 // validate syntax 1329 name = $("#Kwpn_Form_RegisterFoal_FoalName").val(); 1330 if (name != "") { 1331 1332 // accepts alphanumeric (plus diacritics), spaces, dots, apostrophe 1333 var myReg = new RegExp("^[A-Za-zÀ-ÖØ-öø-ÿ0-9 .'&-]*$"); 1334 if (!myReg.test(name)) { 1335 Swal.fire({ title: "@Translate("InvalidInputTitle", "Invalid input")" ,text: "@Translate("FoalNameValidation_CharCheck", "De naam bevat ongeldige karakters. Alleen letters, cijfers en spaties zijn toegestaan.")", customClass: layout.notifyCopyrightMessageClass }); 1336 $("#Kwpn_Form_RegisterFoal_FoalName").val(""); 1337 } 1338 } 1339 1340 ValidatePanelRegistrationData(true); 1341 } 1342 1343 function equisOffline() { 1344 $(".modal-body", "#equis-offline") // set alert text 1345 .html('@Translate("EquisOffline_Modal_BodyText_RegisterFoal", "Our back office is currently unavailable.<br />Most of the website is viewable.<br/>For the parts we need to communicate with our back office, we ask you to try again soon.<br />Sorry for the inconvenience.")'); 1346 $("#equis-offline").modal("show"); // show alert to user by showing modal (in master) 1347 $(".submitBtn").text("@Translate("EquisOffline_FormButtonReplaceText", "Back office offline")"); // change button text 1348 $("#kwpn_Form_RegisterFoal_FormSubmitter").prop("disabled", true); // disable hidden button 1349 $("#FormRegisterHorse :input").prop("disabled", true); // disable all input/textarea/select/checkbox/radio/button 1350 } 1351 1352 function setCoRegistered(personCode, personInfo) { 1353 var coRegistered = "<span class='coregisterred' data-personcode='" + personCode + "'><a href='#' class='pull-right removecoregistered' data-personcode='" + personCode + "'><i class='fa fa-trash'></i></a><span>" + personInfo + "</span></span>"; 1354 if ($("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val().length > 1) { 1355 //add co-registered 1356 $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val(function (idx, curr) { return curr + "," + personCode }); 1357 $("#selectedCoRegistered").html(function (idx, curr) { return curr + coRegistered }); 1358 } else { 1359 //set first co-registered 1360 $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val(personCode); 1361 $("#selectedCoRegistered").html(coRegistered); 1362 } 1363 $("#SearchCoRegisteredResult").html(""); 1364 $("#select-co-registered").modal("hide"); 1365 1366 $(".removecoregistered") 1367 .off("click") 1368 .on("click", function (e) { 1369 1370 e.preventDefault(); 1371 var removePersonCode = $(this).attr("data-personcode"); 1372 1373 // remove from hidden field 1374 var currentCoRegistered = $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val().split(','); 1375 var index = currentCoRegistered.indexOf(removePersonCode); 1376 if (index >= 0) { currentCoRegistered.splice(index, 1); } 1377 $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val(currentCoRegistered.join(",")); 1378 1379 // remove from list 1380 $("span[data-personcode=" + removePersonCode + "]", "#selectedCoRegistered").remove(); 1381 1382 }); 1383 } 1384 1385 function GetExVat(incVat) { 1386 return incVat / 1.21; // extract 21% VAT 1387 } 1388 1389 // shows or hides the iban and bic fields based on payment method selection 1390 function ValidateAuthorizationFields() { 1391 var toggleDiv = $("#payment-container"); 1392 var selectedValue = $("input[name=Kwpn_Form_RegisterFoal_PaymentMethod]:checked").val(); 1393 if (selectedValue == '@Kwpn.Models.Enumerations.PaymentMethod.Authorization.ToString()') { 1394 // show 1395 var userIban = $("#Kwpn_Form_RegisterFoal_IBAN").attr("data-default"); 1396 var userBic = $("#Kwpn_Form_RegisterFoal_BIC").attr("data-default"); 1397 $("#Kwpn_Form_RegisterFoal_IBAN").val(userIban); 1398 $("#Kwpn_Form_RegisterFoal_AuthorizationName").val("@KwpnUsers.CurrentUser().DwUser.Name.JsEscapeDoubleQuotes().FixAutoInputStringValue(50)"); 1399 $("#Kwpn_Form_RegisterFoal_AuthorizationResidence").val("@KwpnUsers.CurrentUser().DwUser.City.JsEscapeDoubleQuotes().FixAutoInputStringValue(50)"); 1400 $("#Kwpn_Form_RegisterFoal_BIC").val(userBic); 1401 1402 if (ibanIsForeign(userIban)) { 1403 makeBicRequired(); 1404 } else { 1405 makeBicUnRequired(); 1406 } 1407 1408 toggleDiv.removeClass("hidden"); 1409 } else { 1410 // clear fields 1411 $("#Kwpn_Form_RegisterFoal_AgreedWithAuthorization").prop('checked', false); 1412 $("#Kwpn_Form_RegisterFoal_IBAN").val(""); 1413 $("#Kwpn_Form_RegisterFoal_AuthorizationName").val(""); 1414 $("#Kwpn_Form_RegisterFoal_AuthorizationResidence").val(""); 1415 $("#Kwpn_Form_RegisterFoal_BIC").val(""); 1416 makeBicUnRequired(); 1417 // hide 1418 if (!toggleDiv.hasClass("hidden")) {toggleDiv.addClass("hidden");} 1419 } 1420 SetRequiredFields(); 1421 ValidatePanelBarnData(true); 1422 } 1423 1424 function SetBreedingInfo(breedingInfo) { 1425 1426 var breedingCode = breedingInfo.BreedingCode; // DEK-0000000 1427 //var dioNumber = breedingInfo.Dionumber; // 0 1428 var breedingDate = breedingInfo.DateOfBreeding; // 2015-07-27T00:00:00 1429 //var mareCode = breedingInfo.MareCode; // P-000000 (is current animalcode) 1430 var studCode = breedingInfo.StallionCode; // P-000000 1431 var studNumber = breedingInfo.StallionNumber; // 1234567890 1432 var studName = breedingInfo.StallionName; // HENKIE 1433 var breedingDirectionAdvice = breedingInfo.AdvicedBreedingDirection; // FOKR-000000 - not used anymore. if more than 1 user needs to select manually 1434 var dnaMessage = breedingInfo.DNAMessage; // DRAAGTIJD LANG 1435 //var dnaNumberMare = breedingInfo.DNANumberMare; // VHL_ID 155916 1436 //var dnaNumberStud = breedingInfo.DnaNumberStallion; // VHL_ID 252047 1437 var startingLetters = breedingInfo.StartingLetters; // P 1438 //var breedingDirectionEnabled = breedingInfo.blnEnableBreedingDirection; // true, if false there should only be 1 required option 1439 var breedingDirections = breedingInfo.lstBreedingDirection; // array of string: FOKR-000000, FOKR-000000, FOKR-000000 1440 var breeders = breedingInfo.lstBreeder; // array of PersonModel 1441 var owners = breedingInfo.lstOwner; // array of PersonModel 1442 var fathersName = breedingInfo.FathersName; // HENKIE 1443 var formattedDateOfBreeding = breedingInfo.FormattedDateOfBreeding; // empty sting when unknown breeding, short date pattern is is known breeding 1444 1445 1446 //var stableName = ""; // not used 1447 var stableAddress = ""; 1448 var stableHouseNumber = ""; 1449 var stablePostalCode = ""; 1450 var stableCity = ""; 1451 var stableCountryCode = ""; 1452 1453 if (breedingInfo.StableaddressPlace != "" && breedingInfo.StableaddressPostalcode != "") { 1454 // use stable info 1455 // stableName = breedingInfo.Stablename; // not used 1456 stableAddress = breedingInfo.StableaddressStreetname; 1457 stableHouseNumber = breedingInfo.StableaddressHouseno; 1458 stablePostalCode = breedingInfo.StableaddressPostalcode; 1459 stableCity = breedingInfo.StableaddressPlace; 1460 stableCountryCode = breedingInfo.StableaddressCountrycode; 1461 } else { 1462 // use prio 1 owner info 1463 if (owners.length > 0) { 1464 var prio1Owner = owners[0]; 1465 stableAddress = prio1Owner.Streetname; 1466 stableHouseNumber = prio1Owner.Houseno; 1467 stablePostalCode = prio1Owner.Postalcode; 1468 stableCity = prio1Owner.Place; 1469 stableCountryCode = prio1Owner.Countrycode; 1470 } 1471 } 1472 1473 // update fathersName and dateofbreeding, is possible the selected breeding has changed depending on submitted birthdate 1474 if (formattedDateOfBreeding && formattedDateOfBreeding !== null && formattedDateOfBreeding.length !== 0) { 1475 $("#Kwpn_Form_RegisterFoal_BreedingDate_Visible").val(formattedDateOfBreeding); 1476 } 1477 if (breedingDate && breedingDate !== null && breedingDate.length !== 0) { 1478 $("#Kwpn_Form_RegisterFoal_BreedingDate").val(breedingDate); 1479 } 1480 if (fathersName && fathersName !== null && fathersName.length !== 0) { 1481 $("#Kwpn_Form_RegisterFoal_StudAnimalName").val(fathersName); 1482 } 1483 1484 @if (isKnownBreeding) { 1485 <text> 1486 if (studCode > '') { 1487 $("#Kwpn_Form_RegisterFoal_StudAnimalCode").val(studCode); 1488 } 1489 1490 // if dnaMessage = "DRAAGTIJD LANG" dan is de draagtijd te kort OF te lang, waarschuwing tonen 1491 if (dnaMessage === "DRAAGTIJD LANG") { 1492 $("#GestationPeriodWarning").removeClass("hidden"); 1493 } else { 1494 $("#GestationPeriodWarning").addClass("hidden"); 1495 } 1496 if (dnaMessage > "") { // als dnaMessage gevuld is dan meesturen 1497 $("#Kwpn_Form_RegisterFoal_GestationPeriodInfo").val(dnaMessage); 1498 } 1499 // fill breeding code? 1500 $("#Kwpn_Form_RegisterFoal_BreedingCode").val(breedingCode); 1501 </text> 1502 } else { 1503 <text> 1504 if (studCode > '' && studCode !== $("#Kwpn_Form_RegisterFoal_StudAnimalCode").val()) { 1505 var alertText = "@Translate("BreedingWarning", "Waarschuwing! Controleer de vader gegevens zorgvuldig. Er is bij ons een dekking met hengst {paardcode} bekend.")"; 1506 alertText = alertText.replace("{paardcode}", studName + " (" + studNumber + ")"); 1507 Swal.fire({ title: "@Translate("WarningTitle", "Watch out!")" ,text: alertText, customClass: layout.notifyCopyrightMessageClass }); 1508 1509 } 1510 </text> 1511 } 1512 1513 // set starting letter for horse name 1514 nameStartingLetters = startingLetters; 1515 1516 // fill breeding directions and set adviced breeding direction 1517 try { 1518 1519 // set breeding direction default 1520 $("#Kwpn_Form_RegisterFoal_BreedingDirection").find('option') 1521 .remove() 1522 .end() 1523 .append('<option value="">@Translate("Select")</option>') 1524 .append('<option value="FOKR-000001">@Translate("Fokrichting_DP", "Dressage horse")</option>') 1525 .append('<option value="FOKR-000002">@Translate("Fokrichting_GP", "Gelderlander")</option>') 1526 .append('<option value="FOKR-000006">@Translate("Fokrichting_SP", "Jumping horse")</option>') 1527 .append(' <option value="FOKR-000007">@Translate("Fokrichting_TP", "Harness horse")</option>') 1528 .val(''); 1529 1530 if (breedingDirections.length > 0) { 1531 1532 // remove options with value and value not in breedingDirections array 1533 $("#Kwpn_Form_RegisterFoal_BreedingDirection").find('option').each(function() { 1534 var option = $(this); 1535 var optionValue = option.val(); 1536 if (optionValue != "" && jQuery.inArray(optionValue, breedingDirections) === -1) { 1537 option.remove(); 1538 } 1539 }); 1540 1541 // if only 1 breeding direction option, preselect it - KWPN-1390 1542 var remainingOptions = $("#Kwpn_Form_RegisterFoal_BreedingDirection").find('option'); 1543 if (remainingOptions.length == 2) { // not 1 because the empty 'select' option is also present 1544 $('#Kwpn_Form_RegisterFoal_BreedingDirection option:last-child').prop('selected', true); 1545 } 1546 } 1547 } catch (err) { 1548 console.error("Fill breeding directions failed: " + err.message); 1549 } 1550 1551 // fill breeder data 1552 try { 1553 if (breeders.length > 0) { 1554 1555 // breeder 1556 var primaryBreeder = breeders[0]; 1557 $("#Kwpn_Form_RegisterFoal_BreederMembershipNumber").val(primaryBreeder.Personcode); 1558 $("#Kwpn_Form_RegisterFoal_BreederMembershipNumber").attr("readonly", "readonly"); // readonly 1559 $("#Kwpn_Form_RegisterFoal_BreederName").val(primaryBreeder.Personname); 1560 $("#Kwpn_Form_RegisterFoal_BreederName").attr("readonly", "readonly"); // readonly 1561 1562 // co-breeders 1563 var coBreeders = ""; 1564 if (breeders.length > 1) { 1565 1566 for (i = 0; i < breeders.length; i++) { 1567 if (i > 0) { 1568 if (coBreeders != "") { 1569 coBreeders += ","; 1570 } 1571 coBreeders += breeders[i].Personname; 1572 } 1573 } 1574 } 1575 $("#Kwpn_Form_RegisterFoal_CoBreederMembershipNumbers").val(coBreeders); 1576 $("#Kwpn_Form_RegisterFoal_CoBreederMembershipNumbers").attr("readonly", "readonly"); // readonly 1577 1578 // list of breeder personcodes 1579 } 1580 } catch (err) { 1581 console.error("Fill breeder data failed: " + err.message); 1582 } 1583 1584 // fill co registered data (doesn't get saved in the form) 1585 try { 1586 var coRegisteredList = ""; 1587 if (owners.length > 0) { 1588 $.each(owners, function(i, owner) { 1589 if (owner.Personcode.toLowerCase() !== '@KwpnUsers.CurrentUser().DwUser.UserName.ToLower()') { 1590 var personCode = owner.Personcode; 1591 var personInfo = owner.Personname; 1592 if (owner.Place !== "") { 1593 personInfo = "<b>" + personInfo + "</b>, " + owner.Place.toUpperCase(); 1594 } 1595 var coRegistered = "<span class='coregisterred' data-personcode='" + personCode + "'><span>" + personInfo + "</span></span>"; 1596 if ($("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val().length > 1) { 1597 //add co-registered 1598 $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val(function(idx, curr) {return curr + "," + personCode}); 1599 $("#selectedCoRegistered").html(function (idx, curr) { return curr + coRegistered }); 1600 } else { 1601 //set first co-registered 1602 $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val(personCode); 1603 $("#selectedCoRegistered").html(coRegistered); 1604 } 1605 } 1606 }); 1607 if (coRegisteredList !== "") { 1608 $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val(coRegisteredList); 1609 } 1610 } 1611 } 1612 catch (err) { 1613 console.error("Fill co-registered data failed: " + err.message); 1614 } 1615 1616 // fill stable data 1617 try { 1618 $("#Kwpn_Form_RegisterFoal_StableAddress").val(stableAddress); 1619 $("#Kwpn_Form_RegisterFoal_StableHouseNumber").val(stableHouseNumber); 1620 $("#Kwpn_Form_RegisterFoal_StablePostalCode").val(stablePostalCode); 1621 $("#Kwpn_Form_RegisterFoal_StableCity").val(stableCity); 1622 $("#Kwpn_Form_RegisterFoal_StableCountry").val(stableCountryCode); 1623 } 1624 catch (err) { 1625 console.error("Fill stable data failed: " + err.message); 1626 } 1627 } 1628 1629 function FillHiddenFields() { 1630 // set hidden field values 1631 $("#Kwpn_Form_RegisterFoal_AccessUserID").val("@userId"); 1632 $("#Kwpn_Form_RegisterFoal_AccessUserUserName").val("@membershipNumber"); 1633 $("#Kwpn_Form_RegisterFoal_SubmitDateTime").val("@currentDateTime"); 1634 $("#Kwpn_Form_RegisterFoal_OrderStatus").val("@Kwpn.Models.Enumerations.FormOrderStatus.FormSubmitted.ToString()"); 1635 $("#Kwpn_Form_RegisterFoal_OrderStatusLastChanged").val("@currentDateTime"); 1636 $("#Kwpn_Form_RegisterFoal_ProductName").val("@registerFoalProduct.Name.FixAutoInputStringValue(150)"); 1637 $("#Kwpn_Form_RegisterFoal_ProductPrice").val("@ProductHelper.GetProductPrice(registerFoalProduct)"); 1638 $("#Kwpn_Form_RegisterFoal_Culture").val("@culture"); 1639 $("#Kwpn_Form_RegisterFoal_MareAnimalCode").val("@animalCode.ToUpper()"); 1640 @if (isKnownBreeding) 1641 { 1642 <text> 1643 $("#Kwpn_Form_RegisterFoal_StudAnimalCode").val("@studAnimalCode"); 1644 $("#Kwpn_Form_RegisterFoal_IsKnownBreeding").val('true'); 1645 $("#Kwpn_Form_RegisterFoal_BreedingDate").val("@breedingDate"); 1646 $("#Kwpn_Form_RegisterFoal_GestationPeriodInfo").val('EIGEN VERZOEK'); 1647 </text> 1648 } 1649 else 1650 { 1651 <text> 1652 $("#Kwpn_Form_RegisterFoal_IsKnownBreeding").val(''); // false/False/0 leveren True op in de db 1653 $("#Kwpn_Form_RegisterFoal_BreedingDate").val("1-1-1900"); // dw geeft date format error als deze niet wordt gevuld 1654 $("#Kwpn_Form_RegisterFoal_GestationPeriodInfo").val(''); 1655 </text> 1656 } 1657 } 1658 1659 function SetAsterisken() { 1660 var asterisk = "<i class=\"fa fa-asterisk\" aria-hidden=\"true\"></i>"; 1661 $('input,textarea,select') 1662 .filter('[required]:visible') 1663 .closest(".form-inline") 1664 .children("label") 1665 .not(".no-asterisk") 1666 .not(":has(> i)") 1667 .append(asterisk); 1668 } 1669 1670 function SetRequiredFields() { 1671 var deceasedValue = $("#Kwpn_Form_RegisterFoal_FoalDeceased:checked").length > 0; 1672 if (deceasedValue) { 1673 $("#Kwpn_Form_RegisterFoal_FoalName").removeAttr("required"); 1674 $("#Kwpn_Form_RegisterFoal_FoalColor").removeAttr("required"); 1675 $("#Kwpn_Form_RegisterFoal_BreedingDirection").removeAttr("required"); 1676 $("#Kwpn_Form_RegisterFoal_BreederMembershipNumber").removeAttr("required"); 1677 $("#Kwpn_Form_RegisterFoal_BreederName").removeAttr("required"); 1678 $("#Kwpn_Form_RegisterFoal_OwnerName").removeAttr("required"); 1679 $("#Kwpn_Form_RegisterFoal_OwnerAddress").removeAttr("required"); 1680 @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)){<text>$("#Kwpn_Form_RegisterFoal_OwnerHouseNumber").removeAttr("required");</text>} 1681 $("#Kwpn_Form_RegisterFoal_OwnerPostalCode").removeAttr("required"); 1682 $("#Kwpn_Form_RegisterFoal_OwnerCity").removeAttr("required"); 1683 $("#Kwpn_Form_RegisterFoal_OwnerEmailAddress").removeAttr("required"); 1684 $("#Kwpn_Form_RegisterFoal_OwnerPhone1").removeAttr("required"); 1685 $("#Kwpn_Form_RegisterFoal_StableAddress").removeAttr("required"); 1686 @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)){<text>$("#Kwpn_Form_RegisterFoal_StableHouseNumber").removeAttr("required");</text>} 1687 $("#Kwpn_Form_RegisterFoal_StablePostalCode").removeAttr("required"); 1688 $("#Kwpn_Form_RegisterFoal_StableCity").removeAttr("required"); 1689 $("#Kwpn_Form_RegisterFoal_StableCountry").removeAttr("required"); 1690 $("#Kwpn_Form_RegisterFoal_ExtraAmountOfRegistrations").removeAttr("required"); 1691 $("#Kwpn_Form_RegisterFoal_AgreedWithAuthorization").removeAttr("required"); 1692 $("#Kwpn_Form_RegisterFoal_IBAN").removeAttr("required"); 1693 $("#Kwpn_Form_RegisterFoal_AuthorizationName").removeAttr("required"); 1694 $("#Kwpn_Form_RegisterFoal_AuthorizationResidence").removeAttr("required"); 1695 } else { 1696 $("#Kwpn_Form_RegisterFoal_FoalName").attr("required", "required"); 1697 $("#Kwpn_Form_RegisterFoal_FoalColor").attr("required", "required"); 1698 $("#Kwpn_Form_RegisterFoal_BreedingDirection").attr("required", "required"); 1699 $("#Kwpn_Form_RegisterFoal_BreederMembershipNumber").attr("required", "required"); 1700 $("#Kwpn_Form_RegisterFoal_BreederName").attr("required", "required"); 1701 $("#Kwpn_Form_RegisterFoal_OwnerName").attr("required", "required"); 1702 $("#Kwpn_Form_RegisterFoal_OwnerAddress").attr("required", "required"); 1703 @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)){<text>$("#Kwpn_Form_RegisterFoal_OwnerHouseNumber").attr("required", "required");</text>} 1704 $("#Kwpn_Form_RegisterFoal_OwnerPostalCode").attr("required", "required"); 1705 $("#Kwpn_Form_RegisterFoal_OwnerCity").attr("required", "required"); 1706 $("#Kwpn_Form_RegisterFoal_OwnerEmailAddress").attr("required", "required"); 1707 $("#Kwpn_Form_RegisterFoal_OwnerPhone1").attr("required", "required"); 1708 $("#Kwpn_Form_RegisterFoal_StableAddress").attr("required", "required"); 1709 @if (culture.Equals("nl-NL", StringComparison.InvariantCultureIgnoreCase)){<text>$("#Kwpn_Form_RegisterFoal_StableHouseNumber").attr("required", "required");</text>} 1710 $("#Kwpn_Form_RegisterFoal_StablePostalCode").attr("required", "required"); 1711 $("#Kwpn_Form_RegisterFoal_StableCity").attr("required", "required"); 1712 $("#Kwpn_Form_RegisterFoal_StableCountry").attr("required", "required"); 1713 $("#Kwpn_Form_RegisterFoal_ExtraAmountOfRegistrations").attr("required", "required"); 1714 var paymentMethod = $("input[name=Kwpn_Form_RegisterFoal_PaymentMethod]:checked").val(); 1715 if (paymentMethod == '@Kwpn.Models.Enumerations.PaymentMethod.Authorization.ToString()') { 1716 $("#Kwpn_Form_RegisterFoal_AgreedWithAuthorization").attr("required", "required"); 1717 $("#Kwpn_Form_RegisterFoal_IBAN").attr("required", "required"); 1718 $("#Kwpn_Form_RegisterFoal_AuthorizationName").attr("required", "required"); 1719 $("#Kwpn_Form_RegisterFoal_AuthorizationResidence").attr("required", "required"); 1720 } else { 1721 $("#Kwpn_Form_RegisterFoal_AgreedWithAuthorization").removeAttr("required"); 1722 $("#Kwpn_Form_RegisterFoal_IBAN").removeAttr("required"); 1723 $("#Kwpn_Form_RegisterFoal_AuthorizationName").removeAttr("required"); 1724 $("#Kwpn_Form_RegisterFoal_AuthorizationResidence").removeAttr("required"); 1725 } 1726 1727 // numbers only 1728 $("#Kwpn_Form_RegisterFoal_ExtraAmountOfRegistrations").numeric(); 1729 } 1730 SetAsterisken(); 1731 } 1732 1733 function SetProductInformation() { 1734 1735 var requestForGenomicBreedingValueResearch = $("#Kwpn_Form_RegisterFoal_RequestForDnaResearch:checked").length > 0; 1736 var requestForWffsTest = $("#Kwpn_Form_RegisterFoal_RequestWffsTest:checked").length > 0; 1737 1738 var isDeceased = $("#Kwpn_Form_RegisterFoal_FoalDeceased:checked").length > 0; 1739 if (isDeceased) { 1740 $(".submitBtn").text("@Translate("Submit", "Submit")"); 1741 $("#Kwpn_Form_RegisterFoal_ProductName").val("@deceasedHorseProduct.Name"); 1742 $("#Kwpn_Form_RegisterFoal_ProductPrice").val("@ProductHelper.GetProductPrice(deceasedHorseProduct)"); 1743 $("#foalRegisterOverviewProductName").html("@deceasedHorseProduct.Name"); 1744 $("#foalRegisterOverviewProductPriceFormatted").html("@ProductHelper.FormatPrice(ProductHelper.GetProductPrice(deceasedHorseProduct))"); 1745 $("#register-foal-product-name").html("@deceasedHorseProduct.Name"); 1746 $("#register-foal-product-price").html("@ProductHelper.FormatPrice(ProductHelper.GetProductPrice(deceasedHorseProduct))"); 1747 $("#payment-data").addClass("hidden"); 1748 } else { 1749 $(".submitBtn").text("@Translate("Pay", "Pay")"); 1750 var registrationPrice = parseFloat(@ProductHelper.GetProductPrice(registerFoalProduct).ToString().Replace(",", ".")); 1751 var genomicBreedingValueResearchProductPrice = parseFloat(@ProductHelper.GetProductPrice(genomicBreedingValueResearchProduct).ToString().Replace(",", ".")); 1752 var wffsTestProductPrice = parseFloat(@ProductHelper.GetProductPrice(wffsTestProduct).ToString().Replace(",", ".")); 1753 var wFFSTestWhenDNAResearchSelectedProductPrice = parseFloat(@ProductHelper.GetProductPrice(wFFSTestWhenDNAResearchSelectedProduct).ToString().Replace(",", ".")); 1754 var products = ""; 1755 var productDescription = ""; 1756 var totalPrice = parseFloat(0.0); 1757 1758 // core product 1759 productDescription = "@registerFoalProduct.Name"; 1760 products += "@StringConstants.ProductNumbers.RegisterFoalKnownBreeding"; 1761 totalPrice = totalPrice + registrationPrice; 1762 1763 var productDescriptionFooter = productDescription; 1764 var productDescriptionAside = productDescription; 1765 1766 // add price when more products are added 1767 if (requestForGenomicBreedingValueResearch || requestForWffsTest) { 1768 productDescriptionAside = productDescriptionAside + " (@ProductHelper.FormatPrice(ProductHelper.GetProductPrice(registerFoalProduct)))"; 1769 } 1770 1771 // if genomic breeding value research is requested, add the product 1772 if (requestForGenomicBreedingValueResearch) { 1773 productDescriptionFooter = productDescriptionFooter + "<br />@genomicBreedingValueResearchProduct.Name"; 1774 productDescriptionAside = productDescriptionAside + "<br />@genomicBreedingValueResearchProduct.Name (@ProductHelper.FormatPrice(ProductHelper.GetProductPrice(genomicBreedingValueResearchProduct)))"; 1775 products += ";@StringConstants.ProductNumbers.DNAResearch"; 1776 totalPrice = totalPrice + genomicBreedingValueResearchProductPrice; 1777 } 1778 1779 // if wffs-test is requested, add the product 1780 // when genomic breeding value research is also checked use a combo discount product 1781 if (requestForWffsTest && requestForGenomicBreedingValueResearch) { 1782 productDescriptionFooter = productDescriptionFooter + "<br />@wFFSTestWhenDNAResearchSelectedProduct.Name"; 1783 productDescriptionAside = productDescriptionAside + "<br />@wFFSTestWhenDNAResearchSelectedProduct.Name (@ProductHelper.FormatPrice(ProductHelper.GetProductPrice(wFFSTestWhenDNAResearchSelectedProduct)))"; 1784 products += ";@StringConstants.ProductNumbers.WFFSTestWhenDNAResearchSelected"; 1785 totalPrice = totalPrice + wFFSTestWhenDNAResearchSelectedProductPrice; 1786 } 1787 else if (requestForWffsTest) { 1788 productDescriptionFooter = productDescriptionFooter + "<br />@wffsTestProduct.Name"; 1789 productDescriptionAside = productDescriptionAside + "<br />@wffsTestProduct.Name (@ProductHelper.FormatPrice(ProductHelper.GetProductPrice(wffsTestProduct)))"; 1790 products += ";@StringConstants.ProductNumbers.WFFSTest"; 1791 totalPrice = totalPrice + wffsTestProductPrice; 1792 } 1793 1794 // hidden field productname and price 1795 $("#Kwpn_Form_RegisterFoal_ProductName").val(products); 1796 $("#Kwpn_Form_RegisterFoal_ProductPrice").val(totalPrice.toFixed(2).replace(".", ",")); 1797 1798 // footer description and price 1799 var footerPriceText = 1800 "€" + 1801 GetExVat(totalPrice).toFixed(2).replace(".", ",") + 1802 " (@Translate("VatExcluded", "VAT excluded"))<br />€" + 1803 totalPrice.toFixed(2).replace(".", ",") + 1804 " (@Translate("VatIncluded", "VAT included"))"; 1805 1806 $("#foalRegisterOverviewProductName").html(productDescriptionFooter); 1807 $("#foalRegisterOverviewProductPriceFormatted").html(footerPriceText); 1808 1809 // aside description and price 1810 $("#register-foal-product-name").html(productDescriptionAside); 1811 $("#register-foal-product-price").html("€" + totalPrice.toFixed(2).replace(".", ",")); 1812 $("#payment-data").removeClass("hidden"); 1813 } 1814 1815 } 1816 1817 function HideRegistration() { 1818 1819 var birthDateInfo = $("#birthDateInfo"); 1820 var baseInfo = $("#form-content-base-info"); 1821 var aliveContent = $("#form-content-foal-alive"); 1822 var deceasedContent = $("#form-content-foal-deceased"); 1823 1824 baseInfo.addClass("hidden"); 1825 @if (isUnknownBreeding) { 1826 <text> 1827 ShowOrHideEtIcsiBreedingInfoFields(); 1828 $("#unknown-breedingdirection").addClass("hidden"); 1829 </text> 1830 } 1831 aliveContent.addClass("hidden"); 1832 deceasedContent.addClass("hidden"); 1833 birthDateInfo.removeClass("hidden"); 1834 } 1835 1836 function ShowRegistration(deceasedValue) { 1837 1838 var birthDateInfo = $("#birthDateInfo"); 1839 var baseInfo = $("#form-content-base-info"); 1840 var aliveContent = $("#form-content-foal-alive"); 1841 var deceasedContent = $("#form-content-foal-deceased"); 1842 1843 baseInfo.removeClass("hidden"); 1844 @if (isUnknownBreeding) { 1845 <text> 1846 ShowOrHideEtIcsiBreedingInfoFields(); 1847 $("#unknown-breedingdirection").removeClass("hidden"); 1848 </text> 1849 } 1850 if (deceasedValue.length > 0) { 1851 aliveContent.addClass("hidden"); 1852 deceasedContent.removeClass("hidden"); 1853 } else { 1854 aliveContent.removeClass("hidden"); 1855 deceasedContent.addClass("hidden"); 1856 } 1857 birthDateInfo.addClass("hidden"); 1858 ValidatePanelRegistrationData(true); 1859 } 1860 1861 function FixDateFields() { 1862 var defaultDateValue = '1-1-1900'; 1863 var dateFields = [ 1864 "Kwpn_Form_RegisterFoal_SubmitDateTime", 1865 "Kwpn_Form_RegisterFoal_BreedingDate", 1866 "Kwpn_Form_RegisterFoal_OrderStatusLastChanged", 1867 "Kwpn_Form_RegisterFoal_FoalDateOfBirth", 1868 "Kwpn_Form_RegisterFoal_InseminationDate", 1869 "Kwpn_Form_RegisterFoal_RinseDate", 1870 "Kwpn_Form_RegisterFoal_TransplantDate"] 1871 1872 $.each(dateFields, function (i, val) { 1873 var $field = $("#" + val); 1874 if (!$field.length) { 1875 console.error("field #" + val + " does not exist"); 1876 } 1877 else if ($field.val() === "") { 1878 $field.val(defaultDateValue); 1879 } else { 1880 //console.log("already filled with " + $field.val()); 1881 } 1882 }); 1883 } 1884 1885 function AfterBreedingDirectionSelection() { 1886 1887 var selectedValue = $("#Kwpn_Form_RegisterFoal_BreedingDirection").val(); 1888 1889 // als selectie is TUIGPAARD of GELDERSPAARD dan OC aanvragen disablen 1890 var $genomeBox = $(".genome-box"); 1891 if (selectedValue === "FOKR-000007" || selectedValue === "FOKR-000002") { 1892 $("#Kwpn_Form_RegisterFoal_RequestForDnaResearch").prop('checked', false); 1893 SetProductInformation(); 1894 SetRequiredFields(); 1895 $genomeBox.addClass("disabled"); 1896 $("#Kwpn_Form_RegisterFoal_RequestForDnaResearch").prop('disabled', true); 1897 } else { 1898 $genomeBox.removeClass("disabled"); 1899 $("#Kwpn_Form_RegisterFoal_RequestForDnaResearch").prop('disabled', false); 1900 } 1901 1902 ValidatePanelRegistrationData(true); 1903 } 1904 1905 function ValidatePanelBreedingData(handleButton) { 1906 1907 var breedingDataIdValid = true; 1908 1909 // check if stud data is available and no manual input is being entered 1910 if ($("#Kwpn_Form_RegisterFoal_StudAnimalCode").val() === "" && $("#fatherinfo").is(":hidden")) breedingDataIdValid = false; 1911 1912 // check required fields 1913 if (breedingDataIdValid) { 1914 $("#breeding-data-panel :input[required]:visible").each(function () { 1915 if ($(this).attr("type") === "checkbox" && $(this).prop("checked") === false) { 1916 breedingDataIdValid = false; 1917 } else if ($(this).val() === "") { 1918 breedingDataIdValid = false; 1919 } 1920 }); 1921 } 1922 1923 // set button 1924 if (handleButton) { 1925 $("#btn-next-breeding-data").prop("disabled", !breedingDataIdValid); 1926 } 1927 1928 return breedingDataIdValid; 1929 } 1930 1931 function ValidatePanelRegistrationData(handleButton) { 1932 1933 var registrationDataIdValid = true; 1934 1935 // check required fields 1936 $("#registration-data-panel :input[required]:visible").each(function () { 1937 if ($(this).attr("type") === "checkbox" && $(this).prop("checked") === false) { 1938 registrationDataIdValid = false; 1939 } else if ($(this).val() === "") { 1940 registrationDataIdValid = false; 1941 } 1942 }); 1943 1944 // set button 1945 if (handleButton) { 1946 $("#btn-next-owner-data").prop("disabled", !registrationDataIdValid); 1947 } 1948 1949 return registrationDataIdValid; 1950 } 1951 1952 function ValidatePanelOwnerData(handleButton) { 1953 1954 var ownerDataIdValid = true; 1955 1956 // phone 1 or phone 2 should contain a value, set them both to required in order to vaidate again 1957 $('#Kwpn_Form_RegisterFoal_OwnerPhone1, input[name=Kwpn_Form_RegisterFoal_OwnerPhone2]:visible').prop('required', true); 1958 $('#Kwpn_Form_RegisterFoal_OwnerPhone1, input[name=Kwpn_Form_RegisterFoal_OwnerPhone2]:visible').css('border', ''); 1959 1960 if ($('#Kwpn_Form_RegisterFoal_OwnerPhone1').val() || $('input[name=Kwpn_Form_RegisterFoal_OwnerPhone2]:visible').val()) { 1961 // if one of them has a value, remove the required attribute from both input fields 1962 $('#Kwpn_Form_RegisterFoal_OwnerPhone1, input[name=Kwpn_Form_RegisterFoal_OwnerPhone2]:visible').removeAttr('required'); 1963 } else { 1964 // add red border class when input fields are empty 1965 $('#Kwpn_Form_RegisterFoal_OwnerPhone1, input[name=Kwpn_Form_RegisterFoal_OwnerPhone2]:visible').css('border', '1px solid red'); 1966 } 1967 1968 // check required fields 1969 $("#owner-data-panel :input[required]:visible").each(function () { 1970 if ($(this).attr("type") === "checkbox" && $(this).prop("checked") === false) { 1971 ownerDataIdValid = false; 1972 } else if ($(this).val() === "") { 1973 ownerDataIdValid = false; 1974 } 1975 }); 1976 1977 // set button 1978 if (handleButton) { 1979 $("#btn-next-barn-data").prop("disabled", !ownerDataIdValid); 1980 } 1981 1982 return ownerDataIdValid; 1983 } 1984 1985 function ValidatePanelBarnData(handleButton) { 1986 1987 var barnDataIdValid = true; 1988 1989 // check required fields 1990 $("#barn-data-panel :input[required]:visible").each(function () { 1991 if ($(this).attr("type") === "checkbox" && $(this).prop("checked") === false) { 1992 barnDataIdValid = false; 1993 } else if ($(this).val() === "") { 1994 barnDataIdValid = false; 1995 } 1996 }); 1997 1998 // check overview required fields 1999 $("#panel-order-overview :input[required]:visible").each(function () { 2000 if ($(this).attr("type") === "checkbox" && $(this).prop("checked") === false) { 2001 barnDataIdValid = false; 2002 } else if ($(this).val() === "") { 2003 barnDataIdValid = false; 2004 } 2005 }); 2006 2007 // set button 2008 if (handleButton) { 2009 $(".submitBtn").prop("disabled", !barnDataIdValid); 2010 } 2011 2012 return barnDataIdValid; 2013 } 2014 2015 function ScrollToTop() { 2016 $('html, body').animate({ 2017 scrollTop: $("#FormRegisterHorse").offset().top 2018 }, 1000); 2019 } 2020 2021 $(document).ready(function() { 2022 2023 // check if Equis is online 2024 equis.IsOnline(equisOffline); 2025 2026 // Fill hidden input fields 2027 FillHiddenFields(); 2028 2029 // Make foal name field alphanumeric only, allowing spaces, dots and apostrophes 2030 $("#Kwpn_Form_RegisterFoal_FoalName").alphanumeric({ nchars: '_', allow: ' .\'-&' }); 2031 2032 // Product info 2033 SetProductInformation(); 2034 2035 // set country read only when filled 2036 if ($("#Kwpn_Form_RegisterFoal_OwnerCountry").val() !== "") { 2037 $("#Kwpn_Form_RegisterFoal_OwnerCountry").attr("readonly", "readonly"); 2038 } 2039 2040 // panelvalidation 2041 $("#breeding-data-panel :input").off("change").on("change", function () { 2042 ValidatePanelBreedingData(true); 2043 }); 2044 $("#btn-next-breeding-data").off("click").on("click", function () { 2045 2046 if (ValidatePanelBreedingData(false)) { 2047 $("#breeding-data-panel").addClass("hidden"); 2048 $("#registration-data-panel").removeClass("hidden"); 2049 $("#panel-order-overview").addClass("hidden"); 2050 $(".paragraphText").addClass("hidden"); 2051 ValidatePanelRegistrationData(true); 2052 ScrollToTop(); 2053 2054 $("#btn-prev-beeding-data").off("click").on("click", function () { 2055 $("#registration-data-panel").addClass("hidden"); 2056 $("#breeding-data-panel").removeClass("hidden"); 2057 $("#panel-order-overview").addClass("hidden"); 2058 $(".paragraphText").removeClass("hidden"); 2059 ScrollToTop(); 2060 }); 2061 } 2062 }); 2063 $("#registration-data-panel :input").off("change").on("change", function () { 2064 ValidatePanelRegistrationData(true); 2065 }); 2066 $("#btn-next-owner-data").off("click").on("click", function () { 2067 2068 if (ValidatePanelRegistrationData(false)) { 2069 $("#registration-data-panel").addClass("hidden"); 2070 $("#owner-data-panel").removeClass("hidden"); 2071 $("#panel-order-overview").addClass("hidden"); 2072 ValidatePanelOwnerData(true); 2073 ScrollToTop(); 2074 SetAsterisken(); 2075 2076 $("#btn-prev-registration-data").off("click").on("click", function () { 2077 $("#owner-data-panel").addClass("hidden"); 2078 $("#registration-data-panel").removeClass("hidden"); 2079 $("#panel-order-overview").addClass("hidden"); 2080 ScrollToTop(); 2081 }); 2082 } 2083 }); 2084 $("#owner-data-panel :input").off("change").on("change", function () { 2085 ValidatePanelOwnerData(true); 2086 }); 2087 $("#btn-next-barn-data").off("click").on("click", function () { 2088 2089 if (ValidatePanelOwnerData(false)) { 2090 $("#owner-data-panel").addClass("hidden"); 2091 $("#barn-data-panel").removeClass("hidden"); 2092 $("#panel-order-overview").removeClass("hidden"); 2093 ValidatePanelBarnData(true); 2094 ScrollToTop(); 2095 2096 $("#btn-prev-owner-data").off("click").on("click", function () { 2097 $("#barn-data-panel").addClass("hidden"); 2098 $("#owner-data-panel").removeClass("hidden"); 2099 $("#panel-order-overview").addClass("hidden"); 2100 ScrollToTop(); 2101 SetAsterisken(); 2102 }); 2103 } 2104 }); 2105 $("#barn-data-panel :input").off("change").on("change", function () { 2106 ValidatePanelBarnData(true); 2107 }); 2108 $("#panel-order-overview :input").off("change").on("change", function () { 2109 ValidatePanelBarnData(true); 2110 }); 2111 ValidatePanelBreedingData(true); 2112 2113 2114 @if (isUnknownBreeding) { 2115 <text> 2116 2117 // handle on-enter for father search 2118 $("#SearchFather").keypress(function (e) { 2119 var code = e.keyCode || e.which; 2120 if (code === 13) { 2121 // 13 = enter 2122 SearchAvailableStuds(); 2123 e.preventDefault(); 2124 return false; 2125 } 2126 return true; 2127 }); 2128 2129 // inseminiation date datepicker, date should always be in current or past year 2130 // rinse date datepicker, date should always be in current or past year 2131 // transplant date datepicker, date should always be in current or past year 2132 $("#Kwpn_Form_RegisterFoal_InseminationDate").datepicker({ 2133 minDate: '-2y', 2134 maxDate: 'today', 2135 }); 2136 $("#Kwpn_Form_RegisterFoal_RinseDate").datepicker({ 2137 minDate: '-2y', 2138 maxDate: 'today', 2139 }); 2140 $("#Kwpn_Form_RegisterFoal_TransplantDate").datepicker({ 2141 minDate: '-2y', 2142 maxDate: 'today', 2143 }); 2144 $.datepicker.setDefaults($.datepicker.regional["@culture"]); 2145 </text> 2146 } 2147 2148 $("#Kwpn_Form_RegisterFoal_BreedingDirection").off("change").on("change", function () { 2149 AfterBreedingDirectionSelection(); 2150 }); 2151 2152 $("input[name=Kwpn_Form_RegisterFoal_BreedingType]").off("change").on("change", function () { 2153 ShowOrHideEtIcsiBreedingInfoFields(); 2154 }); 2155 2156 // submit 2157 $("#kwpn_Form_RegisterFoal_FormSubmitter").click(function () { 2158 $(".hide-hints").removeClass("hide-hints"); 2159 if (!FormIsHtml5Valid()) { 2160 // reset spinner 2161 FormHelper.SubmitButtonReset(".submitBtn"); 2162 } else { 2163 // fix date fields if empty or dw will crash 2164 FixDateFields(); 2165 } 2166 }); 2167 2168 $(".submitBtn").click(function () { 2169 // spinner 2170 FormHelper.SubmitButtonClick(".submitBtn"); 2171 2172 // check name 2173 validateName(); 2174 2175 // check email 2176 var ownerEmailField = $("#Kwpn_Form_RegisterFoal_OwnerEmailAddress"); 2177 if (ownerEmailField[0]) { 2178 if (ownerEmailField.val() == "") { 2179 ownerEmailField.val("@KwpnUsers.CurrentUser().DwUser.Email"); 2180 } 2181 } else { 2182 // should not happen 2183 var newField = "<input type=\"hidden\" name=\"Kwpn_Form_RegisterFoal_OwnerEmailAddress\" id=\"Kwpn_Form_RegisterFoal_OwnerEmailAddress\" value=\"@KwpnUsers.CurrentUser().DwUser.Email\" />"; 2184 $("#FormRegisterHorse > form").append(newField); 2185 } 2186 2187 $("#kwpn_Form_RegisterFoal_FormSubmitter").click(); 2188 return false; 2189 }); 2190 2191 // add co-registered 2192 $("#btnAddCoRegistered") 2193 .off("click") 2194 .on("click", function() { 2195 $("#select-co-registered").modal("show"); 2196 return false; 2197 }); 2198 2199 2200 // search in equis for name 2201 $("#ButtonSearchCoRegistered") 2202 .off("click") 2203 .on("click", function(e) { 2204 2205 e.preventDefault(); 2206 2207 // add loading icon to button and disable 2208 var clickedButtonResetValue = $("#ButtonSearchCoRegistered").html(); 2209 $("#ButtonSearchCoRegistered").html(clickedButtonResetValue + " <i class='fa fa-spinner fa-spin'></i>"); 2210 $("#ButtonSearchCoRegistered").prop('disabled', true); 2211 2212 var personCode = $("#SearchCoRegisteredMemberNumber").val(); 2213 if (personCode == "") { 2214 personCode = "none"; 2215 } 2216 2217 var peopleSearchApi = "/kwpnwebapi/forms/getpersoninfo/" + personCode; 2218 var resultcontainer = $("#SearchCoRegisteredResult"); 2219 resultcontainer.html(""); 2220 $.getJSON(peopleSearchApi).done(function(data) { 2221 if (data != null) { 2222 2223 var personInfo = "<b>" + data.m_Item1 + "</b>"; 2224 var personAddress = data.m_Item2; 2225 if (personAddress !== "") { 2226 personInfo += ", "; 2227 personInfo += personAddress; 2228 } 2229 2230 var isSelected = false; 2231 var currentSelected = $("#Kwpn_Form_RegisterFoal_CoOwnerMembershipNumbers").val().split(',') 2232 if (currentSelected.indexOf(personCode) !== -1) { 2233 isSelected = true; 2234 } 2235 2236 if (isSelected || personCode === "@KwpnUsers.CurrentUser().DwUser.UserName") { 2237 resultcontainer.append("<span class='SearchCoRegisteredResultItem me'>" + personInfo.replace(data.m_Item1, "<b>" + data.m_Item1.toUpperCase() + "</b>") + "</span>"); 2238 } else { 2239 resultcontainer.append("<a href=\"#\" class=\"SearchCoRegisteredResultItem\" data-personcode=\"" + personCode + "\" data-personname=\"" + personInfo + "\" >" + personInfo.replace(data.m_Item1, "<b>" + data.m_Item1.toUpperCase() + "</b>") + "</a>"); 2240 } 2241 2242 $(".SearchCoRegisteredResultItem:not(.me)").click(function () { 2243 var clickedValue = $(this).attr("data-personcode"); 2244 var clickedName = $(this).attr("data-personname"); 2245 setCoRegistered(clickedValue, clickedName); 2246 return false; 2247 }); 2248 } else { 2249 resultcontainer.html("@Translate("FoalRegistration_SearchCoRegisteredNoResults", "No results")"); 2250 } 2251 }).fail(function (jqxhr, textStatus, error) { 2252 resultcontainer.html("@Translate("FoalRegistration_SearchCoRegisteredError", "An error occurred")"); 2253 var err = textStatus + ", " + error; 2254 console.error("Request People Search Failed: " + err); 2255 }).always(function () { 2256 $("#SearchCoRegisteredMemberNumber").val(""); 2257 $("#ButtonSearchCoRegistered").html(clickedButtonResetValue); // remove loading icon from button 2258 $("#ButtonSearchCoRegistered").prop('disabled', false); // enable button 2259 }); 2260 2261 }); 2262 2263 SetAsterisken(); 2264 2265 // show/hide payment shizzle on payment method change 2266 $("input[name=Kwpn_Form_RegisterFoal_PaymentMethod]").change(function () { 2267 ValidateAuthorizationFields(); 2268 }); 2269 ValidateAuthorizationFields(); 2270 2271 $("#Kwpn_Form_RegisterFoal_FoalDateOfBirth").change(function () { 2272 2273 @if (isUnknownBreeding) { 2274 <text> 2275 //validate if father fields are filled 2276 var fatherCode = $("#Kwpn_Form_RegisterFoal_StudAnimalCode").val(); 2277 var fatherName = $("#Kwpn_Form_RegisterFoal_StudAnimalName").val(); 2278 var fatherLifeNumber = $("#Kwpn_Form_RegisterFoal_StudLifeNumber").val(); 2279 if (fatherCode.length <= 0 && (fatherLifeNumber.length <= 0 || fatherName.length <= 0)) { 2280 Swal.fire({ title: "@Translate("ErrorTitle", "Error message")" ,text: "@Translate("FirstEnterFatherInfo", "First enter father info!")", customClass: layout.notifyCopyrightMessageClass }); 2281 $(this).val(""); 2282 return; 2283 } 2284 </text> 2285 } 2286 2287 $(this).parent().removeClass("error"); 2288 2289 // validate input and show/hide registration fields 2290 var foalDateOfBirth = FormHelper.GetJsDate($(this).val(), '@culture'); 2291 if (foalDateOfBirth === null) { 2292 HideRegistration(); 2293 return; 2294 } 2295 ShowRegistration($("#Kwpn_Form_RegisterFoal_FoalDeceased:checked")); 2296 2297 // get breedinginfo 2298 var breedingInfoUrl = ""; 2299 @if (isKnownBreeding) 2300 { 2301 <text> 2302 breedingInfoUrl = "/kwpnwebapi/horses/getbreedinginfo/@culture/@animalCode/" + foalDateOfBirth.getFullYear() + "/" + (foalDateOfBirth.getMonth() + 1) + "/" + foalDateOfBirth.getDate(); 2303 </text> 2304 } 2305 @if (isUnknownBreeding) 2306 { 2307 <text> 2308 var fatherCode = $("#Kwpn_Form_RegisterFoal_StudAnimalCode").val(); 2309 breedingInfoUrl = "/kwpnwebapi/horses/getfoalinfo/@culture/" + foalDateOfBirth.getFullYear() + "/" + (foalDateOfBirth.getMonth() + 1) + "/" + foalDateOfBirth.getDate() + "/@animalCode/" + fatherCode; 2310 </text> 2311 } 2312 if (breedingInfoUrl !== "") { 2313 $.getJSON(breedingInfoUrl).done(function (result) { 2314 if (result != null) { 2315 SetBreedingInfo(result); 2316 validateName(); 2317 } 2318 }).fail(function (jqxhr, textStatus, error) { 2319 var err = textStatus + ", " + error; 2320 console.error("Request BreedingInfo Failed: " + err); 2321 }); 2322 } 2323 2324 SetRequiredFields(); 2325 }); 2326 2327 $("#Kwpn_Form_RegisterFoal_FoalDeceased").change(function () { 2328 var aliveContent = $("#form-content-foal-alive"); 2329 var deceasedContent = $("#form-content-foal-deceased"); 2330 var deceasedValue = $("#Kwpn_Form_RegisterFoal_FoalDeceased:checked").length > 0; 2331 var paymentContent = $("#payment-container"); 2332 var birthDate = $("#Kwpn_Form_RegisterFoal_FoalDateOfBirth").val(); 2333 if (birthDate != "") { 2334 if (deceasedValue) { 2335 aliveContent.addClass("hidden"); 2336 paymentContent.addClass("hidden"); 2337 deceasedContent.removeClass("hidden"); 2338 } else { 2339 aliveContent.removeClass("hidden"); 2340 paymentContent.removeClass("hidden"); 2341 deceasedContent.addClass("hidden"); 2342 } 2343 } 2344 2345 SetProductInformation(); 2346 SetRequiredFields(); 2347 }); 2348 2349 $("#Kwpn_Form_RegisterFoal_Chip").change(function () { 2350 SetProductInformation(); 2351 }); 2352 2353 $("#Kwpn_Form_RegisterFoal_RequestForDnaResearch").change(function () { 2354 SetProductInformation(); 2355 SetRequiredFields(); 2356 }); 2357 2358 $("#Kwpn_Form_RegisterFoal_RequestWffsTest").change(function () { 2359 SetProductInformation(); 2360 SetRequiredFields(); 2361 }); 2362 2363 // date of birth date datepicker, date should always be in current year 2364 $("#Kwpn_Form_RegisterFoal_FoalDateOfBirth").datepicker({ 2365 minDate: @(1-DateTime.Now.DayOfYear), 2366 maxDate: 'today', 2367 }); 2368 $.datepicker.setDefaults($.datepicker.regional["@culture"]); 2369 2370 $("#Kwpn_Form_RegisterFoal_FoalName").change(function() { 2371 validateName(); 2372 }); 2373 2374 // Validate iban 2375 $("#Kwpn_Form_RegisterFoal_IBAN").change(function () { 2376 var errorContainer = $("#iban-wrapper"); 2377 2378 //remove possible error 2379 $("#validateIbanError").remove(); 2380 errorContainer.removeClass("error"); 2381 2382 //get value 2383 var iban = $(this).val(); 2384 2385 // validate 2386 if (iban !== "") { 2387 2388 var validateIbanUrl = "/kwpnwebapi/forms/checkbankaccount/" + iban; 2389 $.getJSON(validateIbanUrl).done(function (isValid) { 2390 if (!isValid) { 2391 2392 //show error and clear field 2393 errorContainer.addClass("error"); 2394 var error = "<div id=\"validateIbanError\" class=\"errortext col-sm-4 col-sm-offset-4 small uppercase\">@Translate("IbanError", "Not a valid IBAN"): " + iban + "</div>"; 2395 errorContainer.append(error); 2396 $("#Kwpn_Form_RegisterFoal_IBAN").val(""); 2397 } else { 2398 // make bic required if iban is not dutch 2399 if (ibanIsForeign(iban)) { 2400 makeBicRequired(); 2401 } else { 2402 makeBicUnRequired(); 2403 } 2404 } 2405 }).fail(function(jqxhr, textStatus, error) { 2406 var err = textStatus + ", " + error; 2407 console.error("Request Validate IBAN Failed: " + err); 2408 }); 2409 2410 } 2411 2412 }); 2413 2414 // only allow alphanumeric characters for bic field 2415 $("#Kwpn_Form_RegisterFoal_BIC").alphanumeric(); 2416 2417 }); 2418 </script> 2419 @SnippetEnd("JavascriptsBottom") 2420 } 2421 2422 } 2423 } 2424 }
The KWPN (Studbook of the Royal Dutch Sport Horse) is a Netherlands-based organization specializing in the breeding of jumpers, dressage horses, harness horses, and Gelder horses.
More info