Error executing template "/Designs/Kde/Paragraph/Contracts.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_424abf32328c4e09ae853dc0b1ddd856.Execute() in D:\web\kde.dk\Website\Files\Templates\Designs\Kde\Paragraph\Contracts.cshtml:line 19
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 3 @using System.Web.Mvc 4 @using Dynamicweb.Content 5 @using Dynamicweb.Content.Items 6 @using Dynamicweb.Core 7 @using Dynamicweb.Ecommerce.Products; 8 @using Website.ServiceNAV; 9 @using Website.CustomCode.Helpers; 10 @using Page = System.Web.UI.Page 11 12 @{ 13 string contractid = Dynamicweb.Context.Current.Request.QueryString["contractid"]; 14 15 string pageId = GetString("ParagraphPageID"); 16 Dynamicweb.Security.UserManagement.User user = Dynamicweb.Security.UserManagement.User.GetCurrentUser(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend); 17 ContractHelpers contractHelpers = new ContractHelpers(); 18 19 var secondaryUserIsAdministrator = Dynamicweb.Core.Converter.ToBoolean(Pageview.User.CurrentSecondaryUser != null ? Pageview.User.CurrentSecondaryUser?.CustomFieldValues?.FirstOrDefault(x => x.CustomField?.Name == "Administration user")?.Value : Pageview.User?.CustomFieldValues?.FirstOrDefault(x => x.CustomField?.Name == "Administration user")?.Value); 20 21 if (Dynamicweb.Context.Current.Request.HttpMethod == "POST") 22 { 23 string signature = ""; 24 bool isConfirmed = false; 25 26 foreach (string key in Dynamicweb.Context.Current.Request.Form) 27 { 28 if (!String.IsNullOrEmpty(key)) 29 { 30 if (key == "signature") 31 { 32 signature = Dynamicweb.Context.Current.Request.Form[key]; 33 } 34 if (key == "confirmation") 35 { 36 isConfirmed = Dynamicweb.Context.Current.Request.Form[key] == "true"; 37 } 38 } 39 } 40 41 if (!String.IsNullOrEmpty(contractid) && isConfirmed) 42 { 43 var contract = contractHelpers.GetContractByNumber(contractid); 44 if (contract.DW_Customer_Contract[0].Status[0] == "To Be Signed") 45 { 46 var updateContract = new DW_Customer_Contracts_Update(); 47 var customerContractList = new List<DW_Customer_Contract_Update>(); 48 var customerContract = new DW_Customer_Contract_Update(); 49 50 customerContract.No = contract.DW_Customer_Contract[0].No[0]; 51 customerContract.Status = "Signed"; // "To Be Signed" eller "Signed" 52 customerContract.Signed_Date = DateTime.Now.ToString("MM/dd/yyyy"); 53 customerContract.Signed_By = signature; 54 customerContract.Approved_On_Webshop = contract.DW_Customer_Contract[0].Approved_On_Webshop[0]; 55 56 customerContractList.Add(customerContract); 57 updateContract.DW_Customer_Contract_Update = customerContractList.ToArray(); 58 59 contractHelpers.UpdateContract(updateContract); 60 61 string cacheKey = $"contractproducts-{user.CustomerNumber}"; 62 if (Dynamicweb.Caching.Cache.Current.Contains(cacheKey)) 63 { 64 Dynamicweb.Caching.Cache.Current.Remove(cacheKey); 65 } 66 67 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + GetPageIdByNavigationTag("WarehousePage")); 68 } 69 } 70 71 //remove lines button submit 72 if (!string.IsNullOrEmpty(contractid) && Dynamicweb.Context.Current.Request.Form.AllKeys.Any(x => x == "button_5")) 73 { 74 bool removeAllLines = false; 75 var contract = contractHelpers.GetContractByNumber(contractid); 76 List<string> prodLinesToRemove = new List<string>(); 77 foreach (string key in Dynamicweb.Context.Current.Request.Form) 78 { 79 if (key == "removeall") 80 { 81 removeAllLines = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Request.Form[key]); 82 } 83 if (key.Contains("prodline_")) 84 { 85 prodLinesToRemove.Add(key.Replace("prodline_", "")); 86 } 87 } 88 89 var updateContract = new DW_Customer_Contracts_Update(); 90 var customerContractList = new List<DW_Customer_Contract_Update>(); 91 var customerContract = new DW_Customer_Contract_Update(); 92 93 94 var contractLines = new List<DW_Customer_Contract_Line_Update>(); 95 96 97 if (removeAllLines) 98 { 99 foreach (var item in contract.DW_Customer_Contract) 100 { 101 foreach (var item2 in item.DW_Customer_Contract_Lines) 102 { 103 foreach (var item3 in item2.DW_Customer_Contract_Line) 104 { 105 contractLines.Add(new DW_Customer_Contract_Line_Update 106 { 107 Line_Item_No = item3.Item_No[0], 108 Line_Canceled = "1", 109 Line_Canceled_Date = DateTime.Now.ToString("MM/dd/yyyy") 110 }); 111 } 112 } 113 } 114 } 115 else if (prodLinesToRemove.Count > 0) 116 { 117 //remove lines included in post 118 foreach (var item in contract.DW_Customer_Contract) 119 { 120 foreach (var item2 in item.DW_Customer_Contract_Lines) 121 { 122 foreach (var item3 in item2.DW_Customer_Contract_Line) 123 { 124 if (prodLinesToRemove.Any(x => x == item3.Item_No[0])) 125 { 126 contractLines.Add(new DW_Customer_Contract_Line_Update 127 { 128 Line_Item_No = item3.Item_No[0], 129 Line_Canceled = "1", 130 Line_Canceled_Date = DateTime.Now.ToString("MM/dd/yyyy") 131 }); 132 } 133 } 134 } 135 } 136 } 137 138 var contractLinesUpdate = new List<DW_Customer_Contract_Lines_Update>(); 139 140 var contractLine = new DW_Customer_Contract_Lines_Update(); 141 142 contractLine.DW_Customer_Contract_Line_Update = contractLines.ToArray(); 143 144 contractLinesUpdate.Add(contractLine); 145 146 customerContract.DW_Customer_Contract_Lines_Update = contractLinesUpdate.ToArray(); 147 148 customerContract.No = contract.DW_Customer_Contract[0].No[0]; 149 customerContract.Status = contract.DW_Customer_Contract[0].Status[0]; // "To Be Signed" eller "Signed" 150 DateTime dt; 151 DateTime.TryParse(contract.DW_Customer_Contract[0].Signed_Date[0], out dt); 152 customerContract.Signed_Date = dt.ToString("MM/dd/yyyy"); 153 customerContract.Signed_By = contract.DW_Customer_Contract[0].Signed_By[0]; 154 customerContract.Approved_On_Webshop = contract.DW_Customer_Contract[0].Approved_On_Webshop[0]; 155 156 customerContractList.Add(customerContract); 157 updateContract.DW_Customer_Contract_Update = customerContractList.ToArray(); 158 159 contractHelpers.UpdateContract(updateContract); 160 161 if (contractLines.Count > 0) 162 { 163 using (var mailMessage = new System.Net.Mail.MailMessage()) 164 { 165 mailMessage.Subject = $"KDE - {user.Name} har opdateret deres aftale ({contractid})"; 166 mailMessage.From = new System.Net.Mail.MailAddress("noreply@kde.dk", "Kde"); 167 mailMessage.To.Add("indkob@kde.dk"); 168 mailMessage.To.Add(user.Email); 169 mailMessage.IsBodyHtml = true; 170 if (removeAllLines) 171 { 172 mailMessage.Body = $"{contract.DW_Customer_Contract[0].Customer_Name[0]} [{contract.DW_Customer_Contract[0].Customer_No[0]}] har opsagt hele deres aftale ({contractid})"; 173 } 174 else 175 { 176 mailMessage.Body = $"{contract.DW_Customer_Contract[0].Customer_Name[0]} [{contract.DW_Customer_Contract[0].Customer_No[0]}] har redigeret deres aftale og opsagt følgende produkter: {string.Join(", ", prodLinesToRemove)}"; 177 } 178 mailMessage.BodyEncoding = System.Text.Encoding.UTF8; 179 mailMessage.SubjectEncoding = System.Text.Encoding.UTF8; 180 mailMessage.HeadersEncoding = System.Text.Encoding.UTF8; 181 Dynamicweb.Mailing.EmailHandler.Send(mailMessage); 182 } 183 } 184 } 185 } 186 } 187 188 <div class="contracts"> 189 <div class="container"> 190 <div class="row"> 191 <div class="col-md-3"> 192 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 193 194 <ul class="nav__ecom"> 195 @{ 196 Dynamicweb.Ecommerce.Assortments.AssortmentService assortmentService = new Dynamicweb.Ecommerce.Assortments.AssortmentService(); 197 Dynamicweb.Ecommerce.International.LanguageService languageService = new Dynamicweb.Ecommerce.International.LanguageService(); 198 Dynamicweb.Ecommerce.International.Language defaultLang = languageService.GetDefaultLanguage(); 199 Dynamicweb.Security.UserManagement.User currentUser = Dynamicweb.Security.UserManagement.User.GetCurrentUser(Dynamicweb.Security.UserManagement.PagePermissionLevels.Frontend); 200 List<string> userAssortments = new List<string>(assortmentService.GetAssortmentIdsByUser(currentUser)); 201 202 new GroupService().ClearCache(); 203 204 IEnumerable<Dynamicweb.Ecommerce.Products.Group> groups = new GroupService().GetToplevelGroups(); 205 206 string currentGroup = GetString("Ecom:Group.ID"); 207 if (string.IsNullOrEmpty(currentGroup)) 208 { 209 currentGroup = GetString("Ecom:Product.PrimaryOrFirstGroupID"); 210 } 211 212 Dynamicweb.Ecommerce.Products.GroupCollection groupCollection = new Dynamicweb.Ecommerce.Products.GroupCollection(groups); 213 214 groupCollection.Sort(Dynamicweb.Ecommerce.Products.GroupCollectionSortBy.ShopOrder); 215 216 foreach (Group group in groupCollection) 217 { 218 219 //only show groups from KDE 220 if (group.ShopId != "SHOP1") 221 { 222 continue; 223 } 224 225 string active = string.Empty; 226 227 if (group.HasChildGroups || group.Products.Count > 0) 228 { 229 <li> 230 @if (group.Id == currentGroup) 231 { 232 active = "active"; 233 } 234 @if (group.HasChildGroups || group.Products.Count > 0) 235 { 236 <a href="Default.aspx?ID=6&GroupID=@group.Id" class="@active">@group.Name</a> 237 } 238 239 @if (group.HasChildGroups) 240 { 241 var ulClass = "hidden"; 242 var plusClass = "fa-plus"; 243 244 if (group.Subgroups.Contains(new GroupService().GetGroup(currentGroup)) || group.Id == currentGroup) 245 { 246 ulClass = ""; 247 plusClass = "fa-minus"; 248 } 249 250 group.Subgroups.SortByParentGroupOrder(group.Id); 251 252 foreach (Group subSub in group.Subgroups) 253 { 254 if (subSub.Subgroups.Contains(new GroupService().GetGroup(currentGroup))) 255 { 256 ulClass = ""; 257 plusClass = "fa-minus"; 258 259 break; 260 } 261 } 262 263 <span class="pull-right"><a href="#" class="nav__ecom-plus js-nav-ecom-expand-sub"><i class="fas @plusClass"></i></a></span> 264 265 <ul class="M2 @ulClass"> 266 @foreach (Group childGroup in group.Subgroups) 267 { 268 269 active = string.Empty; 270 if (childGroup.Id == currentGroup) 271 { 272 active = "active"; 273 } 274 /*<span>@childGroup.Name - @childGroup.HasChildGroups - @childGroup.Products.Count</span>*/ 275 if (childGroup.HasChildGroups || childGroup.Products.Count > 0) 276 { 277 bool display = true; 278 //Has products so I need to check if any belong to user's assortments 279 if (!childGroup.HasChildGroups && childGroup.Products.Count > 0) 280 { 281 display = false; 282 List<Dynamicweb.Ecommerce.Products.Product> products = new List<Dynamicweb.Ecommerce.Products.Product>(childGroup.Products); 283 foreach (var p in products) 284 { 285 List<Dynamicweb.Ecommerce.Assortments.Assortment> productAssortments = new List<Dynamicweb.Ecommerce.Assortments.Assortment>(assortmentService.GetAssortmentsByProduct(p)); 286 if (!productAssortments.Any()) 287 { 288 display = true; 289 break; 290 } 291 foreach (Dynamicweb.Ecommerce.Assortments.Assortment a in productAssortments) 292 { 293 if (userAssortments.Contains(a.ID)) 294 { 295 display = true; 296 break; 297 } 298 } 299 if (display == true) 300 { 301 break; 302 } 303 } 304 } 305 306 if (display == true) 307 { 308 <li> 309 <a href="Default.aspx?ID=6&GroupID=@childGroup.Id" class="@active">@childGroup.Name</a> 310 @if (childGroup.HasChildGroups) 311 { 312 ulClass = "hidden"; 313 plusClass = "fa-plus"; 314 315 if (childGroup.Subgroups.Contains(new GroupService().GetGroup(currentGroup)) || childGroup.Id == currentGroup) 316 { 317 ulClass = ""; 318 plusClass = "fa-minus"; 319 } 320 321 childGroup.Subgroups.SortByParentGroupOrder(childGroup.Id); 322 323 <span class="pull-right"><a href="#" class="nav__ecom-plus js-nav-ecom-expand-sub-sub"><i class="fas @plusClass"></i></a></span> 324 325 <ul class="M3 @ulClass"> 326 @foreach (Group childChildGroup in childGroup.Subgroups) 327 { 328 active = string.Empty; 329 if (childChildGroup.Id == currentGroup) 330 { 331 active = "active"; 332 } 333 if (childChildGroup.HasChildGroups || childChildGroup.Products.Count > 0) 334 { 335 <li> 336 <a href="Default.aspx?ID=6&GroupID=@childChildGroup.Id" class="@active">@childChildGroup.Name</a> 337 </li> 338 } 339 } 340 </ul> 341 } 342 </li> 343 } 344 } 345 } 346 </ul> 347 } 348 </li> 349 } 350 } 351 } 352 </ul> 353 </div> 354 <div class="col-md-9"> 355 @using Dynamicweb.Content 356 @{ 357 int orderPageId = GetPageIdByNavigationTag("OrderPage"); 358 int addressPageId = GetPageIdByNavigationTag("AddressPage"); 359 int profilePageId = GetPageIdByNavigationTag("ProfilePage"); 360 int favoritesPageId = GetPageIdByNavigationTag("FavoritesPage"); 361 int newUserPageId = GetPageIdByNavigationTag("NewUserPage"); 362 int contractPageId = GetPageIdByNavigationTag("ContractPage"); 363 int warehousePageId = GetPageIdByNavigationTag("WarehousePage"); 364 365 <ul class="customercenter__menu"> 366 <li><a href="/Default.aspx?ID=@contractPageId" class="btn btn-default customercenter__button">Lagerføringsaftale</a></li> 367 <li><a href="/Default.aspx?ID=@warehousePageId" class="btn btn-default customercenter__button">Forecast</a></li> 368 <li><a href="/Default.aspx?ID=@profilePageId" class="btn btn-default customercenter__button">@Translate("Profile", "Profile")</a></li> 369 <li><a href="/Default.aspx?ID=@addressPageId" class="btn btn-default customercenter__button">@Translate("Addresses", "Addresses")</a></li> 370 <!--<li><a href="/Default.aspx?ID=@newUserPageId" class="btn btn-default customercenter__button">@Translate("New_User", "New User")</a></li>--> 371 <li><a href="/Default.aspx?ID=@orderPageId" class="btn btn-default customercenter__button" title='@Translate("Orders", "Orders")'>@Translate("Orders", "Orders")</a></li> 372 <li><a href="/Default.aspx?ID=@favoritesPageId&CC164=MyLists" class="btn btn-default customercenter__button">@Translate("Favorites", "Favorites")</a></li> 373 <li><a href="/Admin/Public/ExtranetLogoff.aspx" class="btn btn-default customercenter__button">@Translate("Log off", "Log off")</a></li> 374 </ul> 375 <hr /> 376 } 377 @if (!String.IsNullOrEmpty(contractid) && Dynamicweb.Context.Current.Request.HttpMethod == "GET") 378 { 379 var contract = contractHelpers.GetContractByNumber(contractid); 380 381 bool cancelView = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Request.QueryString["cancelview"]); 382 if (contract != null && contract.DW_Customer_Contract[0].Customer_No[0] == user?.CustomerNumber && secondaryUserIsAdministrator) 383 { 384 <form method="post"> 385 <div class="contracts__contract"> 386 <div class="container-fluid " style="border: dashed 1px;"> 387 <div class="row"> 388 <div class="col-lg-12"> 389 <h2 class="contracts__contract__header">@(cancelView ? "Opsigelse af " : "")Lagerføringsaftale mellem @contract.DW_Customer_Contract[0].Customer_Name[0] og KD Emballage A/S (@contractid):</h2> 390 </div> 391 </div> 392 <div class="row"> 393 <div class="col-lg-6"> 394 <p> 395 @contract.DW_Customer_Contract[0].Customer_Name[0] 396 <br> 397 @contract.DW_Customer_Contract[0].Customer_Address[0] 398 <br> 399 @contract.DW_Customer_Contract[0].Customer_PostCode[0] @contract.DW_Customer_Contract[0].Customer_City[0] 400 </p> 401 </div> 402 <div class="col-lg-6"> 403 <p> 404 KD Emballage A/S 405 <br> 406 Logistikvej 11, HI Park 407 <br> 408 7400 Herning 409 </p> 410 </div> 411 </div> 412 <div class="row"> 413 <div class="col-lg-12"> 414 <p class="contracts__contract-date"> 415 @contract.DW_Customer_Contract[0].Starting_Date[0] 416 </p> 417 </div> 418 </div> 419 <div class="row"> 420 <div class="col-lg-12"> 421 <h2 class="contracts__contract__deal-header">Lagerføringsaftale:</h2> 422 <p> 423 @contract.DW_Customer_Contract[0].Description[0].Replace("[Firma]", user.Company) 424 </p> 425 </div> 426 </div> 427 <div class="row"> 428 <div class="col-lg-12"> 429 <table class="table table-responsive"> 430 <thead> 431 <tr> 432 <th>VARENUMMER:</th> 433 <th>VARETEKST:</th> 434 @* <th>PRIS EKSKL. MOMS:</th> *@ 435 @if (contract.DW_Customer_Contract[0].Status[0] == "Signed" && cancelView) 436 { 437 <th style="padding-right: 0px;"> 438 <span class="contracts__contract__confirm__checkbox-for-all-lines">Opsig hele aftalen</span> 439 <input class="contracts__contract__confirm__checkbox-remove-line" type="checkbox" id="removeall" name="removeall" value="true" style="float: right; margin-top: 2px;margin-right: 0px!important;"/> 440 </th> 441 } 442 </tr> 443 </thead> 444 <tbody> 445 @foreach (var contractLine in contract.DW_Customer_Contract[0].DW_Customer_Contract_Lines[0].DW_Customer_Contract_Line) 446 { 447 DateTime endDate; 448 var validDate = DateTime.TryParse(contractLine.Item_Ending_Date[0], out endDate); 449 if (!validDate || endDate > DateTime.Now) 450 { 451 ProductService ps = new ProductService(); 452 var product = ps.GetProductByNumber(contractLine.Item_No[0], true); 453 bool isCancelled = contractLine.Item_Canceled[0] == "1"; 454 if (product != null) 455 { 456 <tr class="@(isCancelled ? "contracts__contract__tablerow-fade" : "")"> 457 <td>@(product?.Number) @(isCancelled ? "- " + Translate("opsagt") : "")</td> 458 <td>@(product?.Name)</td> 459 @if (contract.DW_Customer_Contract[0].Status[0] == "Signed" && cancelView) 460 { 461 <td style="padding-right: 0px;"> 462 <input class="contracts__contract__confirm__checkbox-remove-line" @(isCancelled ? "disabled" : "") type="checkbox" id="prodline_@(product?.Number)" name="prodline_@(product?.Number)" style="float: right; margin: 0px !important;"/> 463 </td> 464 } 465 </tr> 466 } 467 } 468 } 469 </tbody> 470 </table> 471 </div> 472 </div> 473 <div class="row"> 474 <div class="col-lg-12"> 475 <p> 476 <p>Det er KD Emballage en gl&aelig;de hermed at indg&aring; aftale om lagerf&oslash;ring af den valgte kundespecifikke emballage. Med denne aftale accepteres f&oslash;lgende betingelser:</p> 477 478 <ol> 479 <li>KD Emballage lagerf&oslash;rer med udgangspunkt i det afgivne forecast den valgte emballage i et omfang, som afspejler op til 6 m&aring;neders forbrug. KD Emballage har herefter ret til at producere l&oslash;bende til lager indenfor denne ramme.</li> 480 </ol> 481 <ol> 482 <li value="2"> 483 Ved din/jeres accept af n&aelig;rv&aelig;rende accepterer du/I, at v&aelig;re forpligtet til at aftage 484 <ol style="list-style-type:lower-alpha;"> 485 <li>de til enhver tid lagerf&oslash;rte emballager</li> 486 <li>samt allerede bestilte men endnu ikke leverede produktioner fra KD Emballages leverand&oslash;rer</li> 487 </ol> 488 </li> 489 </ol> 490 <ol> 491 <li value="3">Det er din/jeres forpligtelse l&oslash;bende at aftage lagerf&oslash;rte varer i det omfang, der er forecastet eller aftalt. KD Emballage forbeholder sig retten til p&aring; ethvert tidspunkt at levere lagerf&oslash;rte varer i det omfang, der ikke aftages som anf&oslash;rt i forecastet eller s&aelig;rskilt aftalt mellem parterne.</li> 492 </ol> 493 <ol> 494 <li value="4">Priser reguleres i den imellem dig/jer og KD Emballage indg&aring;ede Samhandelsaftale og s&aring;fremt en Samhandelsaftale ikke er indg&aring;et i overensstemmelse med KD Emballages til hver tid g&aelig;ldende Salg- og leveringsbetingelser. De g&aelig;ldende salgs- og leveringsbetingelser kan findes p&aring; &nbsp;<a href="http://www.kde.dk/">www.kde.dk</a>. &nbsp;</li> 495 </ol> 496 <ol> 497 <li value="5">Lagerf&oslash;ringsaftalen kan gensidigt opsiges til udgangen af en m&aring;ned. Aftalen oph&oslash;rer herefter, n&aring;r varelager samt bestilte produktioner er leveret og betalt. KD Emballage kan ikke foretage bestillinger til lager efter opsigelse er modtaget, medmindre det s&aelig;rskilt aftales.</li> 498 </ol> 499 </p> 500 <p> 501 Vi ser frem til samhandel, og står altid klar til dialog, såfremt der måtte være behov for det. 502 <br> 503 <br> 504 </p> 505 </div> 506 <div class="col-md-6"> 507 <p> 508 Med venlig hilsen 509 <br> 510 <span style="font-weight: bold">KD Emballage A/S</span> 511 </p> 512 </div> 513 @if (contract.DW_Customer_Contract[0].Status[0] == "Signed" && cancelView) 514 { 515 <div class="col-md-6"> 516 <div class="row"> 517 <div class="col-md-6"> 518 <button type="button" class="contracts__contract__confirm-btn-cancel-selected">Opsig valgte</button> 519 </div> 520 <div class="col-md-6"> 521 <a href="Default.aspx?ID=@GetPageIdByNavigationTag("ContractPage")" type="button" class="contracts__contract__confirm-btn-cancel">Annuller</a> 522 </div> 523 </div> 524 </div> 525 } 526 </div> 527 </div> 528 <div class="container-fluid"> 529 <div class="row"> 530 <div class="col-lg-12 contracts__contract__confirm"> 531 <p class="contracts__contract__confirm__text"> 532 Underskriv dokumentet 533 </p> 534 <div> 535 <input type="text" placeholder="Indtast navn" value="@contract.DW_Customer_Contract[0].Signed_By[0]" class="contracts__contract__confirm__signature" name="signature" required/> 536 <div class="contracts__contract__confirm__date">Dato: &nbsp; &nbsp; @(contract.DW_Customer_Contract[0].Status[0] == "Signed" ? contract.DW_Customer_Contract[0].Signed_Date[0] : DateTime.Now.ToShortDateString())</div> 537 </div> 538 <div style="margin-top: 50px"> 539 <input class="contracts__contract__confirm__checkbox" type="checkbox" id="confirmation" name="confirmation" value="true" @(contract.DW_Customer_Contract[0].Status[0] == "Signed" ? "disabled checked" : "") required/> 540 <label class="contracts__contract__confirm__checkbox-text" for="confirmation"> Jeg bekræfter at jeg er berettiget til at godkende aftalen på vegne af virksomheden nævnt i den pågældende aftale.</label> 541 </div> 542 <div style="margin-top: 25px"> 543 <button type="submit" name="button_1" class="contracts__contract__confirm-btn" @(contract.DW_Customer_Contract[0].Status[0] == "Signed" ? "disabled" : "")>GODKEND AFTALE</button> 544 <a href="/Default.axpx?ID=@GetPageIdByNavigationTag("ContractPage")" class="contracts__contract__confirm-btn-back">TILBAGE</a> 545 </div> 546 </div> 547 </div> 548 </div> 549 </div> 550 <div id="confirmationModal" class="modal contracts-modal" data-hasunsignedcontracts=""> 551 <div class="modal-content" style="width:425px;max-width: 100%"> 552 <span class="close">&times;</span> 553 <div> 554 <h1>Er du sikker?</h1> 555 <div class="row contracts__contract__confirm-modal-content"> 556 <div class="col-md-12"> 557 <div class="contracts__contract__confirm-modal-content-message"> 558 @if (!string.IsNullOrEmpty(Pageview.Area.Item["OpsigelsesModalTekst"]?.ToString())) 559 { 560 @(Pageview.Area.Item["OpsigelsesModalTekst"]?.ToString().Replace("<p>", "").Replace("</p>", "")) 561 } 562 </div> 563 </div> 564 <div class="col-md-6"> 565 <button type="submit" name="button_5" class="contracts__contract__confirm-modal-cancel-selected">Opsig valgte</button> 566 </div> 567 <div class="col-md-6"> 568 <button type="button" name="button_4" class="contracts__contract__confirm-modal-cancel">Annuller</button> 569 </div> 570 </div> 571 </div> 572 </div> 573 </div> 574 </form> 575 } 576 else 577 { 578 <div> 579 @Translate("Not authorized", "Du har ikke adgang") 580 </div> 581 } 582 } 583 else 584 { 585 if (user != null && !string.IsNullOrEmpty(user.CustomerNumber) && secondaryUserIsAdministrator) 586 { 587 var contracts = contractHelpers.GetAllCustomerContracts(user.CustomerNumber); 588 <h2>Lagerføringsaftale</h2> 589 <div class="table-responsive"> 590 <table class="table table-striped"> 591 <thead> 592 <tr> 593 <th width="20%">Aftalenavn</th> 594 <th width="15%">Aftalenummer</th> 595 <th width="20%">Dato</th> 596 <th>Status</th> 597 <th class="text-center" width="13%">Opsig aftale</th> 598 <th class="text-right" width="10%">Se aftale</th> 599 </tr> 600 </thead> 601 602 @if (contracts.DW_Customer_Contract != null) 603 { 604 foreach (var contract in contracts.DW_Customer_Contract) 605 { 606 if (contract.Approved_On_Webshop[0] == "1" || Convert.ToBoolean(Pageview.Area.Item["Deaktiver_KDEAftaleGodkendelse"])) //use "Godkendt by KDE" prop when its avaiable 607 { 608 <tr> 609 <td> 610 <a href="/Default.aspx?ID=@pageId&contractid=@contract.No[0]">Lagerføringsaftale</a> 611 </td> 612 <td> 613 @contract.No[0] 614 </td> 615 <td> 616 @contract.Starting_Date[0] 617 </td> 618 <td> 619 @(contract.Status[0] == "Signed" ? "Godkendt" : "Mangler godkendelse") 620 </td> 621 <td class="text-center"> 622 @if (contract.Status[0] == "Signed") 623 { 624 <a href="/Default.aspx?ID=@pageId&contractid=@contract.No[0]&cancelview=true" class="btn btn-default btn-xs customercenter__button" title="Opsig aftale" style="margin-bottom: 0px;"> 625 <span class="far fa-file"></span> 626 </a> 627 } 628 </td> 629 <td> 630 <a href="/Default.aspx?ID=@pageId&contractid=@contract.No[0]" class="btn btn-default btn-xs customercenter__button pull-right" title="Godkend aftale" style="margin-bottom: 0px;"> 631 <span class="far fa-file"></span> 632 </a> 633 </td> 634 </tr> 635 } 636 } 637 } 638 </table> 639 </div> 640 } 641 } 642 </div> 643 </div> 644 </div> 645 </div>