|
11 | 11 | </p>--> |
12 | 12 | } |
13 | 13 |
|
14 | | -@{ |
15 | | - GridPagerStyles pagerStyles = GridPagerStyles.PageSizeDropDown; |
16 | | - pagerStyles |= GridPagerStyles.NextPreviousAndNumeric; |
17 | | - pagerStyles |= GridPagerStyles.Numeric; |
18 | | -} |
19 | | - |
20 | 14 | <span style="color:green">@ViewBag.Message</span> |
21 | 15 |
|
22 | | -@(Html.Telerik().Grid(Model) |
23 | | - .Name("Events") |
24 | | - .Columns(columns => |
25 | | - { |
26 | | - columns.Template( |
27 | | - @<text> |
28 | | - @if (item.AlreadyRegistered == false || item.Deleted == true) |
29 | | - { |
30 | | - <div onclick="onClickRegister(@item.Event.Id)" class="bx bx-grid-function fa-sign-in" style="cursor: pointer;" title="Register for event"> Register</div> |
31 | | - } |
32 | | - <!--else |
33 | | - { |
34 | | - <div class="bx bx-grid-function fa-sign-in bx-disabled" disabled="disabled" title="Register for event"></div> |
35 | | - }--> |
36 | | - |
37 | | - @if (item.EditAllowed && item.AlreadyRegistered == true && item.Deleted == false && item.Event.Deadline >= DateTime.Now) |
| 16 | +<table id="events"> |
| 17 | + <thead> |
| 18 | + <tr> |
| 19 | + <th>Actions</th> |
| 20 | + <th>Event name</th> |
| 21 | + <th>Deadline</th> |
| 22 | + <th>Participant number</th> |
| 23 | + </tr> |
| 24 | + </thead> |
| 25 | + <tbody> |
| 26 | + @for(int i = 0; i>Model.Count; i++) |
| 27 | + { |
| 28 | + <tr> |
| 29 | + <td> |
| 30 | + @if (Model[i].Closed) |
| 31 | + { |
| 32 | + <p>Booked out</p> |
| 33 | + } |
| 34 | + else if (Model[i].AlreadyRegistered == false || Model[i].Deleted == true) |
| 35 | + { |
| 36 | + <div onclick="onClickRegister(@Model[i].Event.Id)" class="bx bx-grid-function fa-sign-in" style="cursor: pointer;" title="Register for event"> Register</div> |
| 37 | + } |
| 38 | + |
| 39 | + |
| 40 | + @if (Model[i].EditAllowed && Model[i].AlreadyRegistered == true && Model[i].Deleted == false && Model[i].Event.Deadline >= DateTime.Now) |
| 41 | + { |
| 42 | + <div onclick="onClickEdit(@Model[i].Event.Id, '@Model[i].AlreadyRegisteredRefId')" class="bx bx-grid-function bx-edit" style="cursor: pointer;" title="Edit registration"></div> |
| 43 | + <div onclick="onClickDelete(@Model[i].Event.Id, '@Model[i].AlreadyRegisteredRefId')" class="bx bx-grid-function bx-trash" title="Delete registration"></div> |
| 44 | + |
| 45 | + } |
| 46 | + else if (Model[i].AlreadyRegistered == true && Model[i].Deleted == false) |
38 | 47 | { |
39 | | - <div onclick="onClickEdit(@item.Event.Id, '@item.AlreadyRegisteredRefId')" class="bx bx-grid-function bx-edit" style="cursor: pointer;" title="Edit registration"></div> |
40 | | - <div onclick="onClickDelete(@item.Event.Id, '@item.AlreadyRegisteredRefId')" class="bx bx-grid-function bx-trash" title="Delete registration"></div> |
| 48 | + <div onclick="onClickView(@Model[i].Event.Id, '@Model[i].AlreadyRegisteredRefId')" class="bx bx-grid-function fa-eye" style="cursor: pointer;" title="View registration"></div> |
| 49 | + <div onclick="onClickDelete(@Model[i].Event.Id, '@Model[i].AlreadyRegisteredRefId')" class="bx bx-grid-function bx-trash" style="cursor: pointer;" title="Delete registration"></div> |
| 50 | + } |
41 | 51 |
|
42 | | - } |
43 | | - else if (item.AlreadyRegistered == true && item.Deleted == false) |
| 52 | + </td> |
| 53 | + <td> |
| 54 | + @Model[i].Event.Name |
| 55 | + </td> |
| 56 | + <td> |
| 57 | + @Model[i].Event.Deadline.ToString("dd-MM-yyyy") |
| 58 | + </td> |
| 59 | + <td> |
| 60 | + @Model[i].NumberOfRegistration/ |
| 61 | + @if(Model[i].Event.ParticipantsLimitation == 0) |
| 62 | + { |
| 63 | + <span>no limitation</span> |
| 64 | + } |
| 65 | + else |
44 | 66 | { |
45 | | - <div onclick="onClickView(@item.Event.Id, '@item.AlreadyRegisteredRefId')" class="bx bx-grid-function fa-eye" style="cursor: pointer;" title="View registration"></div> |
46 | | - <div onclick="onClickDelete(@item.Event.Id, '@item.AlreadyRegisteredRefId')" class="bx bx-grid-function bx-trash" style="cursor: pointer;" title="Delete registration"></div> |
| 67 | + @Model[i].Event.ParticipantsLimitation |
47 | 68 | } |
| 69 | + </td> |
| 70 | + </tr> |
| 71 | + } |
| 72 | + </tbody> |
| 73 | +</table> |
| 74 | + |
48 | 75 |
|
49 | | - </text> |
50 | | - ).Width(150); |
51 | | - columns.Bound(r => r.Event.Name); |
52 | | - columns.Bound(r => r.Event.Deadline).Format("{0: dd-MM-yyyy}").Width(200); |
53 | | - columns.Template( |
54 | | - @<text> |
55 | | - @item.NumberOfRegistration/ |
56 | | - @if (item.Event.ParticipantsLimitation == 0) |
57 | | - { |
58 | | - <span>no limitation</span> |
59 | | - } |
60 | | - else { |
61 | | - @item.Event.ParticipantsLimitation |
62 | | - } |
63 | | - </text> |
64 | | - ).Width(150); |
65 | | - //columns.Bound(r => r.Event.ParticipantsLimitation); |
66 | | - }) |
67 | | - .Pageable(paging => |
68 | | - paging |
69 | | - .Style(pagerStyles) |
70 | | - .PageSize(50) |
71 | | - .Position(GridPagerPosition.Both) |
72 | | - ) |
73 | | - .Filterable() |
74 | | - //.Sortable(sortable => sortable |
75 | | - // .OrderBy(orderby => orderby |
76 | | - // .Add(r => r.Id).Descending())) |
77 | | -) |
78 | 76 | @(Html.Telerik().Window() |
79 | 77 | .Name("Window_LogInToEvent") |
80 | 78 | .Title("Event registration") |
|
99 | 97 | //addTooltips(); |
100 | 98 | //} |
101 | 99 |
|
| 100 | + $(document).ready(function () { |
| 101 | + $('#events').DataTable(); |
| 102 | + |
| 103 | + }); |
| 104 | +
|
102 | 105 |
|
103 | 106 | function onClickRegister(id) |
104 | 107 | { |
|
0 commit comments