Guest User

Untitled

a guest
Feb 8th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. @model PagedList.IPagedList<CRMEntities.Customer>
  2.  
  3.  
  4. <link href="../../Content/Paging.css" rel="stylesheet" type="text/css" />
  5. <link href="../../Content/EventEntity.css" rel="stylesheet" type="text/css" />
  6. <script src="<%=Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")%>" type="text/javascript"></script>
  7.  
  8. <div id="ListBox">
  9. <div id="ListHeader">
  10. All customers(@Model.TotalItemCount)
  11. </div>
  12.  
  13. @foreach (var item in Model)
  14. {
  15.  
  16. <div id="ListContent">
  17. <span class="ContentTitleField">@Html.ActionLink(item.Name, "Details", new { id = item.Id }, new { @style="color:#1A6690;" })</span>
  18. @if (item.Owner != null)
  19. {
  20. <span class="ContentSecondaryField">@Html.ActionLink(item.Owner.FullName, "Details", "Employee", new { id = item.OwnerId }, new { @style = "color:#1A6690;" })</span>
  21. }
  22. <span class="ContentSecondaryField">@Html.DisplayFor(modelItem => item.Address)</span>
  23. <span id="flagMenus">
  24. @Html.Action("ShowFlag", "Flagging", new { entityId=item.Id, entityType="Customer"})
  25. </span>
  26. @if (item.Opportunities.Count > 0)
  27. {
  28. <span class="FlagOpportunity">@Html.ActionLink("opportunities(" + item.Opportunities.Count + ")", "Index", "Opportunity", new { custid = item.Id }, new { @style = "color:#fff;" })</span>
  29. }
  30.  
  31. <div style="float:right;">
  32. @Html.Action("SetRate", "Rating", new { entityId = item.Id, rating = item.Rating, entityname = "Customer" })
  33.  
  34. </div>
  35. <div id="subscribeStatus" style="float:right;">
  36. @Html.Action("ShowSubscribedStatus", "Subscribing", new { entityId = item.Id, entityType = "Customer" })
  37. </div>
  38. <div class="ListLinks">
  39. <span class="ListEditLinks">
  40. <span style="float:left;">@Html.ActionLink("edit", "Edit", new { id = item.Id })</span>
  41. <span class="LinkSeparator"></span>
  42. </span>
  43. <span class="ListAddLinks">
  44. <span style="float:left;">@Html.ActionLink("+opportunity", "Create", "Opportunity", new { custid = item.Id }, null)</span>
  45. <span class="LinkSeparator"></span>
  46. <span>@Ajax.ActionLink("+Comment", null, null, null, new { id = item.Id, @class = "addremark" })</span>
  47. </span>
  48.  
  49. <div class="RemarkBox"></div>
  50.  
  51. </div>
  52.  
  53. <span class="CommentAdd">
  54.  
  55. </span>
  56.  
  57. <div class="CommentBlock">
  58.  
  59.  
  60. </div>
  61.  
  62. <span>@Ajax.ActionLink("Add Comment", null, null, null, new { id = item.Id, @class = "addremark" })</span>
  63.  
  64.  
  65.  
  66. </div>
  67. }
  68.  
  69. <div class="PagingBox">
  70. @Html.Action("CreateLinks", "Pager", new { hasPreviousPage = Model.HasPreviousPage, hasNextPage = Model.HasNextPage, pageNumber = Model.PageNumber, pageCount = Model.PageCount })
  71. </div>
  72.  
  73. </div>
  74.  
  75. <script type="text/javascript">
  76.  
  77. $(document).ready(function () {
  78.  
  79. $('.RemarkBox').hide();
  80.  
  81. $('a.addremark').click(function () {
  82.  
  83.  
  84. var url="@Html.Raw(Url.Action("ShowCommentBox", "Comment", new { Id = "idValue", EntityType = "Customer" }))";
  85.  
  86. url=url.replace("idValue",event.target.id);
  87. $('.RemarkBox').load(url);
  88.  
  89. $(this).closest('div').find('div.RemarkBox').slideToggle(300);
  90. return false;
  91. });
  92.  
  93.  
  94. $("a.pagenumber").click(function () {
  95. var page = 0;
  96. page = parseInt($(this).attr("id"));
  97.  
  98. $.ajax({
  99. url: '@Url.Action("GetPagedCustomers")',
  100. data: { "page": page },
  101. success: function (data) { $("#customerlist").html(data); }
  102. });
  103. return false;
  104. });
  105.  
  106. });
  107.  
  108. </script>
  109.  
  110. $('.RemarkBox').load(url, function() {
  111. //RECALL JAVASCRIPT
  112.  
  113. });
  114.  
  115. function AssignEventHandlers() {
  116.  
  117. $('a.addremark').click(function () {
  118. ....
  119. });
  120.  
  121. $("a.pagenumber").click(function () {
  122. var page = 0;
  123. page = parseInt($(this).attr("id"));
  124.  
  125. $.ajax({
  126. url: '@Url.Action("GetPagedCustomers")',
  127. data: { "page": page },
  128. success: function (data) {
  129. $("#customerlist").html(data);
  130. AssignEventHandlers();
  131. }
  132. });
  133. return false;
  134. });
  135. }
  136.  
  137. $(document).ready(function () {
  138.  
  139. $('.RemarkBox').hide();
  140.  
  141. AssignEventHandlers();
  142. }
Add Comment
Please, Sign In to add comment