Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1. @using DayPilot.Web.Mvc;
  2. @using DayPilot.Web.Mvc.Events.Scheduler;
  3. @using DayPilot.Web.Mvc.Enums.Scheduler;
  4. @using Kalendarz_pro.Models;
  5.  
  6. @{
  7.     ViewBag.Title = "DayPilot Scheduler for ASP.NET MVC 4";
  8. }
  9.  
  10. <script src="@Url.Content("~/Scripts/DayPilot/daypilot-all.min.js")" type="text/javascript"></script>
  11.  
  12. @Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig
  13. {
  14.     BackendUrl = Url.Action("SchedulerActive", "Scheduler"),
  15.     EventResizeHandling = EventResizeHandlingType.CallBack,
  16.     EventMoveHandling = EventMoveHandlingType.CallBack,
  17.     EventDeleteHandling = EventDeleteHandlingType.CallBack,
  18.     BusinessBeginsHour = 7,
  19.     BusinessEndsHour = 22,
  20.     Scale = DayPilot.Web.Mvc.Enums.TimeScale.CellDuration,
  21.     CellDuration = 30,
  22.     TimeHeaders = new TimeHeaderCollection
  23.     {
  24.         new TimeHeader(DayPilot.Web.Mvc.Enums.GroupBy.Month, "dd MMMM yyyy"),
  25.         new TimeHeader(DayPilot.Web.Mvc.Enums.GroupBy.Hour),
  26.         new TimeHeader(DayPilot.Web.Mvc.Enums.GroupBy.Cell)
  27.     },
  28.     RowHeaderWidthAutoFit = true,
  29.     ShowNonBusiness = false,
  30. })
  31. <div>
  32.     <ul id="external">
  33.         @foreach (WorkScheduler x in ViewBag.Persons)
  34.         {
  35.             <li data-id="@x.WorkSchedulerID" data-duration="1800"><span style="cursor:move">@x.PaintballWorker.User.Username @x.PlanStart - @x.PlanEnd</span></li>
  36.         }
  37.     </ul>
  38. </div>
  39.  
  40. <script type="text/javascript">
  41.     $(document).ready(function makeDraggable() {
  42.   var parent = document.getElementById("external");
  43.   var items = parent.getElementsByTagName("li");
  44.   for (var i = 0; i < items.length; i++) {
  45.       var e = items[i];
  46.       var item = {
  47.           element: e,
  48.           id: e.getAttribute("data-id"),
  49.           text: e.innerText,
  50.           duration: e.getAttribute("data-duration"),
  51.           keepElement: true
  52.       };
  53.       DayPilot.Scheduler.makeDraggable(item);
  54.   }
  55. })
  56. </script>
  57.  
  58. <script type="text/javascript">
  59. function modal(url) {
  60.     var m = new DayPilot.Modal();
  61.     m.closed = function() {
  62.         if(this.result == "OK") {
  63.             dps.commandCallBack('refresh');
  64.         }
  65.         dps.clearSelection();
  66.     };
  67.     m.showUrl(url);
  68. }
  69. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement