· 6 years ago · Dec 17, 2019, 12:32 PM
1@using PrimeGov.LegislativeManagement.Web.Models
2@using PrimeGov.LegislativeManagement.Resources
3@model LoginViewModel
4
5@{
6 ViewBag.Title = Common.Search;
7 Layout = "~/Views/Shared/_PortalLayout.cshtml";
8}
9
10@section styles{
11 <link href="//cdn.datatables.net/1.10.17/css/jquery.dataTables.min.css" rel="stylesheet">
12 <link href="~/Content/portal/Content/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" />
13 <link href="~/Content/portal/Content/plugins/bootstrap-multiselect/css/bootstrap-multiselect.css" rel="stylesheet" />
14 <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
15
16 <style>
17 .compiledTable tr td {
18 border-top: none !important;
19 padding: 5px !important;
20 padding-right: 5px !important;
21 }
22
23 .compiledTable a {
24 font-weight: bold;
25 }
26
27 .compiledTable a:hover {
28 text-decoration: none;
29 }
30
31 table.dataTable {
32 width: 100% !important;
33 }
34 </style>
35}
36
37<div class="content">
38 <div id="FilterHeading" class="header-bar">
39 Search Meeting Content
40 <span class="glyphicon glyphicon-minus pull-right"></span>
41 </div>
42
43 <div id="FilterContent" class="content-area">
44
45 @*<div class="">
46 <div class="row col-md-12">
47 <div class="col-md-6">
48 <label class="control-label" for="From">Date Range:</label>
49 <div class="input-group">
50 <input class="form-control date" id="From" name="From" placeholder="MM/DD/YYYY" />
51 <span class="input-group-addon">to</span>
52 <input class="form-control date" id="To" name="To" placeholder="MM/DD/YYYY" />
53 </div>
54 </div>
55 <div class="col-md-6">
56 <label class="control-label pull-left" for="MeetingType">Meeting Type: </label>
57 <select id="MeetingType" name="MeetingTypeId" class="form-control editor"></select>
58 </div>
59 </div>
60 <div class="row col-md-12">
61 <div class="col-md-6">
62 <label class="control-label">Committee:</label>
63 <select id="Committee" name="CommitteeId" class="form-control editor"></select>
64 </div>
65 <div class="col-md-6">
66 <label class="control-label">Text:</label>
67 <input class="form-control " id="text" name="text" placeholder="Text" />
68 </div>
69 </div>
70 <div class="col-md-12" style="height: 5px"></div>
71 <div class="row col-md-12">
72 <div class="pull-right">
73 <br />
74 <button type="submit" id="SearchButton" class="btn btn-primary btn-md" title="search"><span class="glyphicon glyphicon-search"></span></button>
75 <br /><br />
76 </div>
77 </div>
78 </div>*@
79 @*<div class="clearfix"></div>*@
80
81 <form id="FilterForm">
82
83 <div class="basicSearch col-sm-12 col-md-12">
84 <div class="basicSearch__input col-md-12">
85
86 <input class="form-control basicSearch__input--search" id="Text" name="text" placeholder="Text Search" />
87 <button type="submit" id="SearchButton" class="btn btn-primary btn-md basicSearch__input--button" title="search">
88 <span class="glyphicon glyphicon-search"></span>
89 </button>
90
91 </div>
92 </div>
93
94 <div class="advancedSearch col-md-12">
95 <div class="advancedSearch__dropdown col-md-6">
96 <span class="advancedSearch__dropdown--toggle">
97 Advanced Search
98 <span id="advancedSearchButton" class="plus-minus-toggle collapsed"></span>
99 </span>
100
101 </div>
102
103 <div class="advancedSearch__fields opacity-hidden col-md-12">
104
105 <input class="form-control date advancedSearch__fields--input col-md-6" id="From" name="From" placeholder="Date Start" />
106
107 <input class="form-control date advancedSearch__fields--input col-md-6" id="To" name="To" placeholder="Date End" />
108
109 <select id="Committee" name="CommitteeId" class="form-control editor advancedSearch__fields--select">
110 <option value="" disabled selected hidden>Committee Name</option>
111 </select>
112
113 <select id="MeetingType" name="MeetingTypeId" class="form-control editor advancedSearch__fields--select">
114 <option value="" disabled selected hidden>Meeting Type</option>
115 </select>
116
117 <input class="form-control advancedSearch__fields--input" id="ItemTitle" name="text" placeholder="Item Title" />
118
119 <select id="ItemType" name="ItemTypeId" class="form-control editor">
120 <option value="" disabled selected hidden>Item Type</option>
121 </select>
122
123 <input class="form-control advancedSearch__fields--input" id="Sponsor" name="text" placeholder="Sponsor" />
124
125 <input class="form-control advancedSearch__fields--input" id="TrackingNumber" name="text" placeholder="Tracking Number" />
126
127 <button type="submit" id="SearchButton" class="btn btn-primary advancedSearch__fields--button" title="search">
128 <span class="glyphicon glyphicon-search"></span>
129 Search
130 </button>
131
132 <button type="submit" id="" class="btn btn-secondary advancedSearch__fields--button clearFilters" title="search">
133 <span class="glyphicon glyphicon-remove"></span>
134 Clear Filters
135 </button>
136
137 </div>
138 </div>
139
140 </form>
141 </div>
142 <div id="ResultsHeading" class="header-bar">
143 Meetings & Agendas
144 <span class="glyphicon glyphicon-minus pull-right"></span>
145 </div>
146 <div id="ResultsContent" class="tabs content-area">
147 <ul id="meeting-tabs" class="nav nav-tabs" role="tablist">
148 <li role="presentation"><a data-toggle="tab" title="Search Vote Records" id="tab-vote-records" href="#tabs-vote-records" aria-controls="Vote Records" role="tab" style="display: none;">Vote Records</a></li>
149 <li role="presentation" id="ResultsTab" class="hidden"><a data-toggle="tab" href="#tabs-results" aria-controls="Results" role="tab" title="View All Results">Results</a></li>
150 </ul>
151 <div id="tab-content" class="tab-content in active">
152 <div id="tabs-vote-records" class="tab-pane fade in">
153 <h3>Vote Record</h3>
154 <hr />
155 <div class="row">
156 <div class="col-sm-4">
157 <select id="CommitteeMembersList" class="form-control"></select>
158 </div>
159 <div class="col-sm-6">
160 <div class="input-group">
161 <span class="input-group-addon">From</span>
162 <input class="form-control date" placeholder="MM/DD/YYYY" id="VoteRecordsFrom" value="@DateTime.Now.AddMonths(-6).ToString("MM/dd/yyyy")" />
163 <span class="input-group-addon">To</span>
164 <input class="form-control date" placeholder="MM/DD/YYYY" id="VoteRecordsTo" value="@DateTime.Now.ToString("MM/dd/yyyy")" />
165 </div>
166 </div>
167 <div class="col-sm-2">
168 <button type="button" class="btn btn-default" onclick="loadVotes();">Search</button>
169 </div>
170 </div>
171 <br />
172 <div id="VoteRecordTableArea" style="display:none;">
173 <table id="VoteRecordsTable" class="row-border">
174 <thead>
175 <tr>
176 <th>Meeting Time</th>
177 <th>Item</th>
178 <th>Motion Status</th>
179 <th>Their Vote</th>
180 <th>Result</th>
181 <th>Type</th>
182 </tr>
183 </thead>
184 <tbody id="VoteRecordsTableBody"></tbody>
185 </table>
186 </div>
187 </div>
188 <div id="tabs-results" class="tab-pane fade in">
189 <h3>Results</h3>
190 <hr />
191 <table id="FilterRestultsTable" class="row-border">
192 <thead>
193 @*<tr>
194 <th>Type</th>
195 <th>Title</th>
196 <th>Meeting Name/Date</th>
197 <th>Highlights</th>
198 <th>Score</th>
199 <th>Sponsor</th>
200 <th>Item Type</th>
201 <th>Tracking Number</th>
202 <th>Commitee Name</th>
203 <th>Meeting Type</th>
204 <th>View / Download</th>
205 </tr>
206 </thead>
207 <tbody>
208 <tr>
209 <td>Item</td>
210 <td>Test Item Title</td>
211 <td>12/15/2019 - City Council</td>
212 <td>Highlights testing 1234567</td>
213 <td>0.252542</td>
214 <td>Jimmy</td>
215 <td>Planning Item</td>
216 <td>1234567</td>
217 <td>City Council</td>
218 <td>City Council Regular Meeting</td>
219 <td>View</td>
220 </tr>
221 <tr>
222 <td>Attachment</td>
223 <td>Test Attachment Title</td>
224 <td>12/15/2019 - City Council</td>
225 <td>Highlights testing 1234567</td>
226 <td>0.252542</td>
227 <td>Jimmy</td>
228 <td>Planning Item</td>
229 <td>1234567</td>
230 <td>City Council</td>
231 <td>City Council Regular Meeting</td>
232 <td>View Parent - Download</td>
233 </tr>
234 <tr>
235 <td>Item</td>
236 <td>Test Item Title</td>
237 <td>12/17/2019 - City Council</td>
238 <td>Highlights testing 1234567</td>
239 <td>0.252542</td>
240 <td>Jimmy</td>
241 <td>Planning Item</td>
242 <td>1234567</td>
243 <td>City Council</td>
244 <td>City Council Regular Meeting</td>
245 <td>View</td>
246 </tr>
247 <tr>
248 <td>Attachment</td>
249 <td>Test Attachment Title</td>
250 <td>12/17/2019 - Planning Commission</td>
251 <td>Highlights testing 1234567</td>
252 <td>0.252542</td>
253 <td>Jimmy</td>
254 <td>Planning Item</td>
255 <td>1234567</td>
256 <td>City Council</td>
257 <td>City Council Regular Meeting</td>
258 <td>View Parent - Download</td>
259 </tr>*@
260 </tbody>
261 </table>
262 </div>
263 </div>
264 </div>
265 <hr />
266</div>
267
268<div id="tabTemplate" class="tab-pane fade in hidden">
269 <h3 class="tab-title">2017</h3>
270 <hr />
271 <table class="row-border tab-table">
272 <thead>
273 <tr>
274 <th>Meeting</th>
275 <th>Date</th>
276 <th>Documents</th>
277 <th>Options</th>
278 </tr>
279 </thead>
280 <tbody></tbody>
281 </table>
282</div>
283
284
285@{
286 Html.RenderPartial("~/Views/Portal/_PublicSpeaker.cshtml");
287}
288
289@{ Html.RenderPartial("~/Views/Shared/_PortalLogin.cshtml");}
290
291@section scripts{
292 <script src="//cdn.datatables.net/1.10.17/js/jquery.dataTables.min.js"></script>
293 <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js"></script>
294 <script src="//cdn.datatables.net/plug-ins/1.10.17/sorting/datetime-moment.js"></script>
295 <script src="~/Content/portal/Content/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
296 <script src="~/Content/portal/Content/plugins/bootstrap-multiselect/js/bootstrap-multiselect.js"></script>
297 <script src="//cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
298 <script src="~/Content/portal/Scripts/lodash.js"></script>
299 <script src="~/Content/portal/Scripts/portalCommon.js"></script>
300 <script src="~/Content/portal/Scripts/moment.js"></script>
301 <script src="~/Content/portal/Scripts/publicSpeaker.js?v=1.1"></script>
302 <script type="text/javascript">
303 jQuery.fn.dataTableExt.oSort['datetest-asc'] = function (a, b) {
304 var x = new Date(a),
305 y = new Date(b);
306 return ((x < y) ? -1 : ((x > y) ? 1 : 0));
307 };
308
309 jQuery.fn.dataTableExt.oSort['datetest-desc'] = function (a, b) {
310 var x = new Date(a),
311 y = new Date(b);
312 x.setHours(23 - x.getHours());
313 y.setHours(23 - y.getHours());
314 x.setMinutes(59 - x.getMinutes());
315 y.setMinutes(59 - y.getMinutes());
316 return ((x < y) ? 1 : ((x > y) ? -1 : 0));
317 };
318
319 var filterTable;
320 var _MeetingTypes = [];
321 var _Committees = [];
322 var _MeetingTypeSelectedFirst = false;
323 var _CommitteeSelectedFirst = false;
324 var portal = new Portal;
325 var columns = [
326 {
327 'data': 'title',
328 'className': 'meeting_Title'
329 },
330 {
331 'data': 'date',
332 'type': 'datetest'
333 },
334 {
335 'data': 'videoUrl'
336 },
337 {
338 'data': 'options',
339 'className': 'portal_options'
340 }
341 ];
342
343 //function getRoleRadio(id, role, checked) {
344 // var checkedStr = '';
345 // if (checked) {
346 // checkedStr = ' checked';
347 // }
348 // return '<input class=" ' + checked + '" type="radio" data-role=' + role + ' data-id=' + id + ' onclick="" name="vote ' + role + '" value=' + role + ' required/>'
349 //}
350
351 $(document).ready(function () {
352
353 //toastr["info"]("Search Portal Results Loading...");
354
355 portal.LoadMeetingTypes();
356 portal.LoadCommittees();
357 portal.ListCommitteeMembers();
358
359 //New items stuff
360 portal.LoadItemTypes();
361 showAdvancedSearch();
362 resetSearchFilters();
363
364 pageUrl = window.location.href;
365
366 // if showSearch is true then show the search html else don't
367 if (verifyURLParamExists('showSearch')) {
368 if (!(getParameterByName('showSearch')=='true')) {
369 $("#FilterHeading").hide();
370 $("#FilterContent").hide();
371 }
372 }
373
374 //$('#tabs-2016').slideUp();
375 //$('#tabs-vote-records').slideUp();
376
377 var filters = ["start", "end", "mIds", "cId", "meetingId"];
378 var filterList = [];
379
380 filters.forEach(function(filter) {
381 result = verifyURLParamExists(filter);
382 if (result == false) {
383 filterList.push(null);
384 }
385 else {
386 filterList.push(getParameterByName(filter));
387 }
388 });
389
390 //loadFilteredMeetings(start date, end date, text, meeting type Ids, committee Id, meeting Id)
391 loadFilteredMeetings(
392 filterList[0],
393 filterList[1],
394 null,
395 filterList[2],
396 filterList[3],
397 filterList[4]
398 );
399
400 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
401 var target = $(e.target).attr("href"); // activated tab
402 });
403
404 $('#FilterHeading').click(function () {
405 $('#FilterContent').slideToggle();
406 $('span', '#FilterHeading').toggleClass('glyphicon-minus');
407 $('span', '#FilterHeading').toggleClass('glyphicon-plus');
408 });
409 $('#ResultsHeading').click(function () {
410 $('#ResultsContent').slideToggle();
411 $('span', '#ResultsHeading').toggleClass('glyphicon-minus');
412 $('span', '#ResultsHeading').toggleClass('glyphicon-plus');
413 });
414
415 $(window).on('load resize', function () {
416 sizeFrametabs();
417 });
418
419 $('.date').datepicker({
420 todayBtn: true,
421 autoclose: true,
422 todayHighlight: true,
423 language: defaultLanguage
424 });
425 $('.multiselect').multiselect();
426
427 $('#FilterForm').submit(function (e) {
428 e.preventDefault();
429
430 var searchMeetingModel = {
431
432 CommitteeId: $("#Committee").val(),
433 MeetingDateFrom : $("#From").val(),
434 MeetingDateTo : $("#To").val(),
435 ItemTypeId :$("#ItemType").val(),
436 ItemTitle : $("#ItemTitle").val(),
437 Sponsor :$("#Sponsor").val(),
438 TrackingNo :$("#TrackingNo").val(),
439 Text :$("#Text").val(),
440 };
441
442 console.log(searchMeetingModel);
443
444 $.ajax({
445 type: "get",
446 url: '@Url.Content("~/api/portal/search")',
447 data: searchMeetingModel,
448 success: function (result) {
449 console.log(data);
450 bindSearchData(data);
451 },
452 error: function (e) {
453 alert(e.message);
454 }
455 });
456 });
457
458 var isBound = false;
459 function bindSearchData(data) {
460 var searchColumns = [
461 {
462 data: 'name',
463 render: function (data, type, row) {
464 return data;
465 }
466 }, {
467 data: 'created',
468 render: function (data, type, row) {
469 return data;
470 }
471 }, {
472 data: 'documentType',
473 render: function (data, type, row) {
474 return data;
475 }
476 }, {
477 data: 'highlights',
478 render: function (data, type, row) {
479 var html = "<div class='highlights'>";
480 $(data).each(function (i, highlight) {
481 html += highlight + "<br />";
482 });
483 html += "</div>";
484 return html;
485 }
486 }, {
487 data: 'score',
488 render: function (data, type, row) {
489 return data;
490 }
491 }, {
492 data: null,
493 render: function (data, type, row) {
494 var html = '<a href="/DocumentManager/Document/'+ data.documentId + '" title="View Document"><span class="glyphicon glyphicon-eye-open"></span></a>';
495
496 return html;
497 }
498 }
499 ];
500
501 if (!isBound) {
502
503 //$('#ItemsGrid').DataTable({
504 // data: data,
505 // "lengthMenu": [25, 50, 75, 100],
506 // columns: searchColumns,
507 // order: [[4, "desc"]]
508 //});
509 //isBound = true;
510
511 var groupColumn = 2;
512 var filterTable = $('#FilterRestultsTable').DataTable({
513 data: data,
514 "columnDefs": [
515 {
516 "visible": false,
517 "targets": groupColumn
518 }
519 ],
520 columns: searchColumns,
521 'searching': false,
522 "order": [[ groupColumn, 'asc' ]],
523 "displayLength": 25,
524 "drawCallback": function ( settings ) {
525 var api = this.api();
526 var rows = api.rows( {page:'current'} ).nodes();
527 var last=null;
528
529 api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) {
530 if ( last !== group ) {
531 $(rows).eq( i ).before(
532 '<tr class="group"><td colspan="12">'+group+'</td></tr>'
533 );
534
535 last = group;
536 }
537 });
538 }
539 });
540 isBound = true;
541
542 //Order by the grouping
543 $('#FilterRestultsTable tbody').on( 'click', 'tr.group', function () {
544 var currentOrder = filterTable.order()[0];
545 if ( currentOrder[0] === groupColumn && currentOrder[1] === 'asc' ) {
546 filterTable.order( [ groupColumn, 'desc' ] ).draw();
547 }
548 else {
549 filterTable.order( [ groupColumn, 'asc' ] ).draw();
550 }
551 });
552
553 } else {
554 filterTable.clear().rows.add(data).draw();
555 }
556
557 }
558
559
560
561 $('#ResultsTab').removeClass('hidden');
562 $('.nav-tabs a[href="#tabs-results"]').tab('show');
563 $('#tabs-results').slideDown();
564 //$('#tabs-2016').slideUp();
565 //$('#tabs-2017').slideUp();
566
567
568 if ('@ViewBag.IsUserLoggedIn' === 'True') {
569 $('#logoutPortal').show();
570 $('#loginPortal').hide();
571 } else {
572 $('#logoutPortal').hide();
573 $('#loginPortal').show();
574 }
575 $('#cancelPortalLogin')
576 .on('click',
577 function () {
578 $('#portalLoginModal')
579 .modal('hide');
580 });
581 $('#loginPortal')
582 .on('click',
583 function () {
584 $('#portalLoginModal')
585 .modal({
586 backdrop: 'static'
587 });
588 });
589
590 $('#logoutPortal').on('click',
591 function () {
592 portal.LogOff();
593 });
594
595 $('#PortalLoginForm').submit(function (e) {
596 e.preventDefault();
597 portal.Logon();
598 });
599 $('#MeetingType').on('change', function () {
600 if (!_CommitteeSelectedFirst) {
601 _MeetingTypeSelectedFirst = true;
602 var meetingTypeId = $('#MeetingType').val();
603 portal.FilterCommitteesByMeetingType(meetingTypeId);
604 }
605 });
606 $('#Committee').on('change', function () {
607 if (!_MeetingTypeSelectedFirst) {
608 var committteeId = $('#Committee').val();
609 portal.FilterMeetingTypesByCommitttee(committteeId);
610 _CommitteeSelectedFirst = true;
611 }
612 });
613 //$('#tab-2016').on('click', function() {
614 // $('#tabs-2016').slideDown();
615 // $('#tabs-2017').slideUp();
616 // $('#tabs-results').slideUp();
617 // $('#tabs-2016').addClass('active');
618 //});
619
620 //$('#ResultsTab').on('click', function() {
621 // $('#tabs-2016').slideUp();
622 // $('#tabs-2017').slideUp();
623 // $('#tabs-results').slideDown();
624 //});
625
626 //$('#tab-2017').on('click', function() {
627 // $('#tabs-2017').slideDown();
628 // $('#tabs-2016').slideUp();
629 // $('#tabs-results').slideUp();
630 // $('#tabs-2017').addClass('active');
631 //});
632
633 //display alt text for table pagination
634 $('.paginate_button > .next').attr("title","View Next Page")
635 });
636
637 function showAdvancedSearch() {
638
639 $('.plus-minus-toggle').on('click', function() {
640 $(this).toggleClass('collapsed');
641 $('.advancedSearch__fields').toggleClass('opacity-hidden ');
642 $('#FilterForm').toggleClass('advancedHeight');
643
644 $('.basicSearch__input--button').toggleClass('hidden');
645 $('.basicSearch__input--search').toggleClass('full-width');
646
647 //if $('.advancedSeach__fields').hasClass('hidden') {
648
649 //}
650 });
651
652 }
653
654 function resetSearchFilters() {
655 $('.clearFilters').on('click', function () {
656 $("select").each(function() { this.selectedIndex = 0 });
657 $('#FilterForm').find("input, textarea").val("");
658 });
659
660 }
661
662 // gets a param value from URL
663 function getParameterByName(name) {
664 var url = new URL(window.location.href);
665 return url.searchParams.get(name);
666 }
667
668 function getParameterByList(names) {
669 var dict = [];
670
671 for (var i = 0; i < names; i++) {
672
673 }
674 var url = new URL(window.location.href);
675 return url.searchParams.get(name);
676 }
677
678
679 // checks if a param is present in URL
680 function verifyURLParamExists(name) {
681 var filters = ["start", "end", "mIds", "cId", "meetingId", "showSearch"];
682 if (window.location.href.indexOf(name) > -1) {
683 return true;
684 }
685 else {
686 return false;
687 }
688 }
689
690 function loadMeetings() {
691 $.getJSON('@Url.Content("~/api/meeting/list")', null, function (data) {
692 bindMeetings(data);
693 });
694 }
695
696 function loadFilteredMeetings(start, end, text, mIds, cId, meetingId) {
697 var values = {"start": start, "end": end, "text": text, "mIds": mIds, "cId": cId, "meetingId": meetingId};
698 var filter = {};
699
700 for (var key in values) {
701 if (values[key] != null) {
702 switch (key) {
703 case "start":
704 filter['start'] = start;
705 break;
706 case "end":
707 filter['end'] = end;
708 break;
709 case "mIds":
710 filter['mIds'] = mIds;
711 break;
712 case "text":
713 filter['text'] = text;
714 break;
715 case "cId":
716 filter['cId'] = cId;
717 break;
718 case "meetingId":
719 filter['meetingId'] = meetingId;
720 break;
721 }
722 }
723 }
724
725 $.getJSON('@Url.Content("~/api/meeting/list")',filter , function (data) {
726 bindMeetings(data);
727 });
728 }
729
730 function bindMeetings(meetingData) {
731
732 var years = getYears(meetingData);
733 loadYearElements(years);
734
735 $.each(years, function (indx, yr) {
736 $('#' + yr + 'Meetings').DataTable({
737 'data': $.grep(meetingData, function (meeting) {
738 var meetingDate = new Date(meeting.date);
739 //console.log(meeting.id);
740 return meetingDate.getFullYear() == yr;
741
742 }),
743 'responsive': true,
744 'columns': columns,
745 'aaSorting': [[1, "desc"]],
746 'searching': false,
747 "columnDefs": [{
748 "targets": 0,
749 "render": $.fn.dataTable.render.text()
750 },
751 {
752 "targets": 1,
753 "data": null,
754 "render": function (data, type, full, meta) {
755 return full.date + " " + full.time;
756
757 }
758 },
759 {
760 "targets": 2,
761 "data": null,
762 "render": function (data, type, full, meta) {
763 return getMeetingDocumentHtml(full);
764 }
765 },
766 {
767 "targets": 3,
768 "data": null,
769 "render": function (data, type, full, meta) {
770 var html = '';
771 if (full.allowPublicSpeaker) {
772 html += '<a onclick="requestSpeaker(this)" class="speaker_icon" data-id=' + full.id + ' title="Request to Speak" href="#"><i class="fa fa-microphone"></i></a>';
773 }
774 return html;
775 }
776 }]
777 });
778 });
779 }
780
781
782 // Polyfill for .find for IE
783 if (!Array.prototype.find) {
784 Object.defineProperty(Array.prototype, 'find', {
785 value: function(predicate) {
786 // 1. Let O be ? ToObject(this value).
787 if (this == null) {
788 throw new TypeError('"this" is null or not defined');
789 }
790
791 var o = Object(this);
792
793 // 2. Let len be ? ToLength(? Get(O, "length")).
794 var len = o.length >>> 0;
795
796 // 3. If IsCallable(predicate) is false, throw a TypeError exception.
797 if (typeof predicate !== 'function') {
798 throw new TypeError('predicate must be a function');
799 }
800
801 // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
802 var thisArg = arguments[1];
803
804 // 5. Let k be 0.
805 var k = 0;
806
807 // 6. Repeat, while k < len
808 while (k < len) {
809 // a. Let Pk be ! ToString(k).
810 // b. Let kValue be ? Get(O, Pk).
811 // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
812 // d. If testResult is true, return kValue.
813 var kValue = o[k];
814 if (predicate.call(thisArg, kValue, k, o)) {
815 return kValue;
816 }
817 // e. Increase k by 1.
818 k++;
819 }
820
821 // 7. Return undefined.
822 return undefined;
823 },
824 configurable: true,
825 writable: true
826 });
827 }
828
829 function getMeetingDocumentHtml(meeting) {
830 var html = '';
831 $.each(meeting.templates, function (index, template) {
832 var pdfOut = template.compiledMeetingDocumentFiles.find(function (file) {
833 return file.compileOutputType === 1;
834 });
835 var docxOut = template.compiledMeetingDocumentFiles.find(function (file) {
836 return file.compileOutputType === 2;
837 });
838 var htmlOut = template.compiledMeetingDocumentFiles.find(function (file) {
839 return file.compileOutputType === 3;
840 });
841
842 html += '<table class="compiledTable"><tr><td rowspan=0 width=20>';
843 if (htmlOut) {
844 html += compiledFileLink(htmlOut.id, htmlOut.compileOutputType, '<i class="fa fa-lg fa-desktop"></i>', 'View Interactive Page for ' + template.title);
845 html += '</td><td width=140>';
846 html += compiledFileLink(htmlOut.id, htmlOut.compileOutputType, template.title, 'View Interactive Page for ' + template.title);
847 }
848 else {
849 html += ' </td><td width=140 rowspan=0>' + template.title;
850 }
851
852 html += '</td><td width=15>';
853
854 if (pdfOut)
855 html += compiledFileLink(pdfOut.id, pdfOut.compileOutputType, '<i class="far fa-lg fa-file-pdf"></i>', 'Download PDF for ' + template.title);
856 else
857 html += ' ';
858
859 html += '</td><td width=15>';
860
861 if (docxOut) {
862 html += compiledFileLink(docxOut.id, docxOut.compileOutputType, '<i class="far fa-lg fa-file-word"></i>', 'Download Word Document for ' + template.title);
863 }
864 else
865 html += ' ';
866
867 html += '</td></tr>';
868
869 });
870 return html;
871 }
872
873 function compiledFileLink(id, compileOutputType, text, altText) {
874 return '<a href="javascript:downloadCompiledMeetingDoc(' + id + ', ' + compileOutputType + ');" title="' + altText + '">' + text + '</a>';
875 }
876
877
878 function getYears(meetingData) {
879 var minYear = new Date().getFullYear();
880 var maxYear = new Date().getFullYear();
881
882 $(meetingData).each(function (i, meeting) {
883 var meetingDate = new Date(meeting.date);
884 var year = meetingDate.getFullYear();
885
886 if (year < minYear)
887 minYear = year;
888 else if (year > maxYear)
889 maxYear = year;
890 });
891
892 var years = [];
893
894 for (var year = minYear; year <= maxYear; year++) {
895 years.push(year);
896 }
897
898 return years;
899 }
900
901 function loadYearElements(years) {
902
903 $(years).each(function (i, year) {
904 loadYearTab(year, (i == years.length - 1));
905 loadMeetingTable(year, (i == years.length - 1));
906 });
907
908 if ($("#tabs-vote-records").hasClass("active") || $("#ResultsTab").hasClass("active")) {
909 $("#tabs-" + years[years.length - 1]).removeClass("active");
910 $("#tab-" + years[years.length -1]).parent().removeClass("active");
911 }
912
913 toastr["success"]("Search Portal Results Loaded");
914
915 }
916
917 function loadYearTab(year, isActive) {
918 var a = $("<a>")
919 .attr("id", "tab-" + year)
920 .attr("href", "#tabs-" + year)
921 .attr("aria-controls", year)
922 .attr("role", "tab")
923 .attr("data-toggle", "tab")
924 .attr("title", "View results from " + year)
925 .html(year);
926
927 var li = $("<li>").attr("role", "presentation");
928 if (isActive)
929 $(li).addClass("active");
930
931 $(li).append(a);
932
933 $("#meeting-tabs").prepend(li);
934
935 }
936
937 function loadMeetingTable(year, isActive) {
938 var template = $("#tabTemplate").clone();
939
940 $(template).removeClass("hidden");
941 $(template).attr("id", "tabs-" + year);
942 $(template).find(".tab-title").html(year);
943 $(template).find(".tab-table").attr("id", year + "Meetings");
944
945 if (isActive)
946 $(template).addClass("active");
947
948 $("#tab-content").prepend(template);
949 }
950
951 function loadVotes() {
952 var uId = $('#CommitteeMembersList').val();
953 var from = $('#VoteRecordsFrom').val();
954 var to = $('#VoteRecordsTo').val();
955 portal.ListUserVotes(uId, from, to);
956 }
957
958 function downloadCompiledMeetingDoc(id, outputType) {
959 if (outputType == 3) {
960 window.open("/Portal/Meeting?compiledMeetingDocumentFileId=" + id);
961 } else {
962 $.getJSON('@Url.Content("~/api/Meeting/getcompiledfiledownloadurl")?compiledFileId=' + id, null, function (data) {
963 window.location = data;
964 })
965 .fail(function (jqXHR, status, error) {
966 handleError('@Common.Error: ' + jqXHR.responseJSON.exceptionMessage, jqXHR);
967 });
968 }
969 }
970
971 function sizeFrametabs() {
972 $window = $(window);
973 $('.iframetab').height(function () {
974 return $window.height() - $(this).offset().top - $('footer').height() - 50;
975 });
976 }
977
978 function downloadPacket(id) {
979 $.getJSON('@Url.Content("~/api/meeting/GetPacketDownloadUrl/")' + id, null, function (data) {
980 window.location = data;
981 })
982 .fail(function (jqXHR, status, error) {
983 handleError('@Common.Error: ' + jqXHR.responseJSON.exceptionMessage, jqXHR);
984 });
985 }
986 </script>
987}