You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

325 lines
16 KiB

  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FeedDetail.aspx.cs" Inherits="Swift.web.Remit.SocialWall.Feeds.FeedDetail" %>
  2. <%@ Register TagPrefix="uc1" TagName="SwiftTextBoxCustom" Src="~/Component/AutoComplete/SwiftTextBoxCustom.ascx" %>
  3. <!DOCTYPE html>
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head runat="server">
  6. <link href="../../../../ui/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
  7. <link href="../../../../ui/css/waves.min.css" rel="stylesheet" />
  8. <link href="../../../../ui/css/menu.css" rel="stylesheet" />
  9. <link href="../../../../ui/css/style.css" rel="stylesheet" />
  10. <link href="../../../../ui/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
  11. <link href="../../../../ui/css/sweetalert.css" rel="stylesheet" />
  12. <script src="../../../../ui/js/jquery.min.js"></script>
  13. <script src="../../../../ui/js/jquery-ui.min.js"></script>
  14. <script src="../../../../ui/bootstrap/js/bootstrap.min.js"></script>
  15. <script src="../../../../js/Swift_grid.js"></script>
  16. <link href="../../../../js/jQuery/jquery-ui.css" rel="stylesheet" />
  17. <link href="../../../../css/datatables/datatables.min.css" rel="stylesheet" />
  18. <script src="../../../../js/functions.js"></script>
  19. <script src="../../../../js/swift_autocomplete_custom.js"></script>
  20. <style type="text/css">
  21. .form-control-sm
  22. {
  23. height: 26px;
  24. padding: 2px 6px;
  25. }
  26. .feedpagination
  27. {
  28. margin:5px 0;
  29. }
  30. .btnfeed
  31. {
  32. margin-left: 10px;
  33. }
  34. </style>
  35. <script type="text/javascript">
  36. function GetReportedFeed(feedId) {
  37. var param = "dialogHeight:550px;dialogWidth:800px;dialogLeft:150;dialogTop:80;center:yes;";
  38. var res = PopUpWindow("ReportedFeedDetail.aspx?methodName=" + "ReportedFeed" + "&feedId=" + feedId, param);
  39. }
  40. </script>
  41. <script type="text/javascript">
  42. function ViewFeedDetail(feedId) {
  43. var param = "dialogHeight:550px;dialogWidth:800px;dialogLeft:150;dialogTop:80;center:yes;";
  44. var res = PopUpWindow("ViewFeedDetail.aspx?methodName=" + "GetReport" + "&feedId=" + feedId, param);
  45. }
  46. </script>
  47. </head>
  48. <body>
  49. <form id="form2" runat="server">
  50. <div class="page-wrapper">
  51. <div class="row">
  52. <div class="col-sm-12">
  53. <div class="page-title">
  54. <h1></h1>
  55. <ol class="breadcrumb">
  56. <li><a href="../../../Front.aspx" target="mainFrame"><i class="fa fa-home"></i></a></li>
  57. <li><a href="#">Feeds List</a></li>
  58. <li class="active"><a href="FeedDetail.aspx">Feed Details </a></li>
  59. </ol>
  60. </div>
  61. </div>
  62. </div>
  63. <!-- Nav tabs -->
  64. <div class="listtabs">
  65. <ul class="nav nav-tabs" role="tablist">
  66. <li role="presentation" class="active"><a href="#list" aria-controls="home" role="tab" data-toggle="tab">Feeds List</a></li>
  67. </ul>
  68. </div>
  69. <div class="tab-content">
  70. <div role="tabpanel" class="tab-pane active" id="list">
  71. <div class="row">
  72. <div class="col-md-12">
  73. <div class="panel panel-default ">
  74. <!-- Start .panel -->
  75. <div class="panel-heading">
  76. <h4 class="panel-title" style="margin-top: 20px">Search Feed Details</h4>
  77. <div class="panel-actions">
  78. <a href="#" class="panel-action panel-action-toggle" data-panel-toggle></a>
  79. </div>
  80. </div>
  81. <div class="panel-body">
  82. <input type="hidden" id="hddPrevious" />
  83. <input type="hidden" id="hddiTotalRecords" />
  84. <input type="hidden" id="hddNext" runat="server" />
  85. <%--<div class="form-group">
  86. <label class="col-lg-2 col-md-3 control-label" for="">
  87. User Id:
  88. </label>
  89. <div class="col-lg-10 col-md-9">
  90. <uc1:SwiftTextBoxCustom ID="userAc" runat="server" Category="remit-UserInfo" />
  91. </div>
  92. </div>--%>
  93. <div class="form-group">
  94. <label for="" class="col-sm-2 col-form-label">Operative Country:</label>
  95. <div class="col-lg-10 col-md-9">
  96. <asp:DropDownList ID="ddlOperativeCountry" CssClass="form-control" runat="server"></asp:DropDownList>
  97. </div>
  98. </div>
  99. <div class="form-group">
  100. <label for="" class="col-sm-2 col-form-label">Reported:</label>
  101. <div class="col-lg-10 col-md-9">
  102. <input type="checkbox" id="chkReported" />
  103. </div>
  104. </div>
  105. <div class="form-group row">
  106. <div class="col-md-2 col-md-offset-2">
  107. <input type="button" id="btnSearch" class="btn btn-primary m-t-25 btnfeed" value="Search" onclick="GenerateFeeds();" />
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <!-- End .panel -->
  113. </div>
  114. <!--end .col-->
  115. </div>
  116. <!--end .row-->
  117. <div class="row">
  118. <div class="col-md-12">
  119. <div class="panel panel-default ">
  120. <!-- Start .panel -->
  121. <div class="panel-body">
  122. <div style="margin-top: 10px;">
  123. <div id="divfeeddetail">
  124. <div class="row">
  125. <div class="col-md-1">
  126. Show
  127. </div>
  128. <div class="col-md-1">
  129. <select class="form-control form-control-sm" id="ddlPageSize">
  130. <option value="2">2</option>
  131. <option value="5">5</option>
  132. <option value="10" selected="selected">10</option>
  133. <option value="25">25</option>
  134. <option value="75">75</option>
  135. <option value="100">100</option>
  136. </select>
  137. </div>
  138. <div class="col-md-1">
  139. entries
  140. </div>
  141. </div>
  142. <div class="data-table-scroll">
  143. <table id="feed-report" cellspacing="0" class="table table-striped">
  144. <thead>
  145. <tr>
  146. <th colspan="0" style="display: none;" rowspan="0">Feed Id</th>
  147. <th>UserId</th>
  148. <th style="display:none;">CreatedDate</th>
  149. <th style="width: 400px;">FeedText</th>
  150. <th>FeedImage</th>
  151. <th>Action1</th>
  152. <th>Action2</th>
  153. </tr>
  154. </thead>
  155. <tbody id="rpt" runat="server">
  156. </tbody>
  157. </table>
  158. </div>
  159. <div class="feedpagination">
  160. <button type="button" onclick="return GenerateFeeds(this.id);" id="btnPrevious" class="btn btn-primary m-t-25">&laquo; Previous</button>
  161. <button type="button" onclick="return GenerateFeeds(this.id);" id="btnNext" class="btn btn-primary m-t-25">Next &raquo;</button>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. </div>
  172. <script src="../../../../js/datatables/datatables.min.js"></script>
  173. <script src="../../../../ui/js/sweet-alert/sweetalert.min.js"></script>
  174. <script type="text/javascript">
  175. $(document).ready(function()
  176. {
  177. $("#btnPrevious").hide();
  178. $("#btnNext").hide();
  179. });
  180. </script>
  181. <script type="text/javascript">
  182. function feedReport() {
  183. var table = $('#feed-report').DataTable({
  184. "order": [[ 2, "desc" ]],
  185. "bserverSide": true,
  186. "bPaginate": false,
  187. "lengthMenu": [[10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, "All"]],
  188. "recordsTotal": parseInt($("hddiTotalRecords").val()),
  189. "recordsDisplay": parseInt($("hddiTotalRecords").val())
  190. });
  191. $(".table.table-striped.dataTable").wrap(function () {
  192. return "<div class='data-table-scroll" + "'></div>";
  193. });
  194. }
  195. </script>
  196. <script type="text/javascript">
  197. function GenerateFeeds(id) {
  198. if (id != undefined) {
  199. var previous = "";
  200. var next = "";
  201. if (document.getElementById('btnPrevious').id == id) {
  202. previous = $("#hddPrevious").val();
  203. }
  204. else {
  205. previous = null;
  206. }
  207. if (document.getElementById('btnNext').id == id) {
  208. next = $("#hddNext").val();
  209. }
  210. else {
  211. next = null;
  212. }
  213. }
  214. else
  215. {
  216. $("#btnPrevious").attr("disabled", true);
  217. }
  218. //var userId = $("#userAc_aText").val();
  219. //var user = userId.split('|');
  220. //var res = null;
  221. //if (user[1] != null || user[1] != undefined) {
  222. // userId = user[1].trim();
  223. //}
  224. //var ddlCountry = document.getElementById("userAc_aCustom");
  225. //var country = ddlCountry.options[ddlCountry.selectedIndex].text;
  226. var country = $("#ddlOperativeCountry").val();
  227. var dataToSend = {
  228. methodName: "SearchFeeds",
  229. userId: "",
  230. country: country,
  231. before: previous,
  232. after: next,
  233. onlyReported: chkReported.checked == true ? "true" : "false",
  234. limit: $('#ddlPageSize').val()
  235. };
  236. var xhr = $.ajax({
  237. type: "POST",
  238. url: '',
  239. dataType: "JSON",
  240. data: dataToSend,
  241. success: function (result) {
  242. $("#btnPrevious").show();
  243. $("#btnNext").show();
  244. $('#hddPrevious').val(result.pageInformation.before);
  245. $('#hddNext').val(result.pageInformation.after);
  246. if (result.pageInformation.remaining == "0" && next != null) {
  247. $("#btnNext").attr("disabled", true);
  248. }
  249. else {
  250. $("#btnNext").removeAttr("disabled");
  251. }
  252. if ((result.pageInformation.remaining == "0" && previous != null)) {
  253. $("#btnPrevious").attr("disabled", true);
  254. }
  255. else {
  256. $("#btnPrevious").removeAttr("disabled");
  257. }
  258. if ((previous == null && next == null))
  259. {
  260. $("#btnPrevious").attr("disabled", true);
  261. }
  262. PopulateData(result.objects);
  263. },
  264. error: function () {
  265. swal("Error!", "Oops!!! something went wrong, please try again.", "error");
  266. }
  267. });
  268. };
  269. function PopulateData(dt) {
  270. var table = '';
  271. if (dt.length == 0) {
  272. debugger
  273. table += "<tr>"
  274. table += "<td colspan='6' align='center'>No Data to Display!</td>"
  275. table += "</tr>"
  276. $("#rpt").html(table);
  277. $("#btnPrevious").hide();
  278. $("#btnNext").hide();
  279. return;
  280. }
  281. debugger;
  282. console.log(dt);
  283. for (var i = 0; i < dt.length; i++) {
  284. table += "<tr>"
  285. table += "<td scope='row' style='display:none;'>" + dt[i]["id"] + "</td>"
  286. table += "<td>" + dt[i]["userId"] + "</td>"
  287. table += "<td style='display:none;'>" + dt[i]["createdDate"] + "</td>"
  288. var imgUrl = dt[i]["feedImage"];
  289. table += "<td>" + dt[i]["feedText"] + "</td>"
  290. table += "<td>" + ((dt[i]["feedImage"] != null) ? "<div class='show-image'><a href='javascript:void(0)' onclick=OpenInNewWindow('" + imgUrl + "');><img src='" + imgUrl + "' style='width:20px;height:20px;'></a></div>" : "No Image") + "</td>"
  291. table += "<td><a onclick=ViewFeedDetail('" + dt[i]["id"] + "')><i class='fa fa-eye' aria-hidden='true'></i></a></td>"
  292. table += "<td><input id='btn1' type='button' value='Reported Feed' onclick=GetReportedFeed('" + dt[i]["id"] + "') class='btn btn-primary'></td>"
  293. table += "</tr>"
  294. }
  295. if ($.fn.DataTable.isDataTable('#feed-report')) {
  296. $('#feed-report').DataTable().destroy();
  297. }
  298. $("#rpt").html(table);
  299. feedReport();
  300. };
  301. </script>
  302. </form>
  303. </body>
  304. </html>