File indexing completed on 2024-12-29 05:24:44
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 * 0022 * Created: 31.05.2017 0023 */ 0024 0025 $helperPrintDate = new Default_View_Helper_PrintDate(); 0026 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0027 $helperImage = new Default_View_Helper_Image(); 0028 $helpMemberUrl = new Default_View_Helper_BuildMemberUrl(); 0029 0030 ?> 0031 <link href="/theme/flatui/js/lib/jquerymonthpicker/MonthPicker.css" rel="stylesheet" type="text/css" /> 0032 <link href="/theme/backend/lib/jquery-ui/themes/smoothness/jquery-ui.min.css" rel="stylesheet"> 0033 <link href="/theme/backend/lib/jtable/themes/jqueryui/jtable_jqueryui.min.css" rel="stylesheet"> 0034 <script src="/theme/backend/lib/jquery-ui/jquery-ui.min.js"></script> 0035 <script src="/theme/backend/lib/jtable/jquery.jtable.min.js"></script> 0036 <script src="/theme/flatui/js/lib/jquerymonthpicker/MonthPicker.js"></script> 0037 0038 <style type="text/css"> 0039 img.pimage{ 0040 float: left; 0041 } 0042 div.ptitle{ 0043 margin-left: 140px; 0044 font-size: 13px; 0045 font-weight: bold; 0046 } 0047 div.jtable-main-container table.jtable tbody > tr > td{ 0048 vertical-align: top; 0049 border-left:0px; 0050 border-right:0px; 0051 font-size: small; 0052 } 0053 div.jtable-main-container table.jtable{ 0054 border: 0px; 0055 } 0056 div.jtable-main-container table.jtable th{ 0057 border: 0px; 0058 background: none; 0059 font-weight: bold; 0060 } 0061 0062 #products-wrapper{ 0063 padding-bottom: 20px; 0064 } 0065 0066 0067 #explore-content .ui-state-default 0068 { 0069 background: none; 0070 border: 0px; 0071 0072 } 0073 0074 0075 #explore-content div.jtable-main-container table.jtable .rating{ 0076 width:80px; 0077 margin-left:140px; 0078 padding-top:20px; 0079 } 0080 #explore-content div.jtable-main-container table.jtable .tooltipuser{ 0081 color: #2673b0; 0082 cursor: pointer; 0083 } 0084 0085 .container-wrapper{ 0086 display: flex; 0087 flex-grow: 1; 0088 flex-direction: row; 0089 } 0090 0091 0092 </style> 0093 <main id="explore-content"> 0094 <section class="wrapper" id="products-wrapper" > 0095 <h1> 0096 Most New Products 0097 </h1> 0098 <form style="margin-top: 20px; margin-bottom: 20px"> 0099 0100 Month <input name="filterMonth" id="filterMonth" value="<?php echo date("Ym") ?>" /> 0101 <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button> 0102 <input type="checkbox" name="nonwallpaper" id="nonwallpaper" >Non-Wallpaper filter 0103 0104 </form> 0105 <div id="TableContainer"></div> 0106 0107 </section> 0108 </main> 0109 <div class="tooltip_templates" style="display: none"> 0110 <span id="tooltip_content"> 0111 <i class="fa fa-spinner"></i> 0112 </span> 0113 </div> 0114 <script type="text/javascript"> 0115 $(document).ready(function () { 0116 0117 //Re-load records when user click 'load records' button. 0118 $('#LoadRecordsButton').click(function (e) { 0119 e.preventDefault(); 0120 $('#TableContainer').jtable('load', { 0121 filterMonth: $('#filterMonth').val(), 0122 nonwallpaper:($('#nonwallpaper').is(':checked')?1:0) 0123 },function(){ 0124 0125 }); 0126 }); 0127 0128 $('#filterMonth').MonthPicker({ StartYear: 2019, ShowIcon: true,MonthFormat:'yymm',OnAfterChooseMonth: function() { 0129 window.selectedMonth = $(this).val(); 0130 } }); 0131 0132 $("#dialog-form").dialog({ 0133 autoOpen: false, 0134 //height: 350, 0135 width: 600, 0136 modal: true, 0137 buttons: { 0138 Close: function () { 0139 $(this).dialog("close"); 0140 } 0141 } 0142 }); 0143 0144 0145 $('#TableContainer').jtable({ 0146 jqueryuiTheme: true, 0147 paging: true, 0148 sorting: true, 0149 recordsLoaded: function (event, data) { 0150 TooltipUser.setup("tooltipuser","right"); 0151 }, 0152 rowInserted: function (event, data) { 0153 if (data.record.cntOther==0) { 0154 data.row.css("background", "#FF4500"); 0155 } 0156 }, 0157 actions: { 0158 listAction: '/newproducts/list' 0159 }, 0160 fields: { 0161 member_id: { 0162 title: 'member_id', 0163 key: true, 0164 create: false, 0165 edit: false, 0166 list: true , 0167 sorting: false 0168 }, 0169 username: { 0170 title: 'username', 0171 create: false, 0172 edit: false, 0173 list: true, 0174 sorting: false, 0175 display:function(data){ 0176 var html = '<a target="_blank" href="/u/'+data.record.username+'" class="tooltipuser" data-tooltip-content="#tooltip_content" data-user="'+data.record.member_id+'" >'+data.record.username+'</a>'; 0177 return html; 0178 } 0179 }, 0180 cnt: { 0181 title: 'cnt', 0182 width:'5%', 0183 create: false, 0184 edit: false, 0185 list: true 0186 }, 0187 created_at: { 0188 title: 'member_created_at', 0189 type: 'date', 0190 create: false, 0191 edit: false, 0192 list: true 0193 }, 0194 cntOther: { 0195 title: 'cnt <', 0196 create: false, 0197 edit: false, 0198 list: true 0199 }, 0200 0201 0202 } 0203 }); 0204 0205 $('body').on("click", 'a.toggle-status', function (event) { 0206 event.preventDefault(); 0207 event.stopImmediatePropagation(); 0208 0209 if (!confirm('This will toggle the active option for this product. Do you wish to proceed?')) { 0210 return; 0211 } 0212 0213 var elementRecord = $(this).data("record"); 0214 0215 jQuery.ajax({ 0216 data: {'project_id': elementRecord}, 0217 url: '/backend/project/togglestatus/', 0218 type: 'post', 0219 error: function () { 0220 alert("<span class='error'>Service is temporarily unavailable. Our engineers are working quickly to resolve this issue. <br/>Find out why you may have encountered this error.</span>"); 0221 return false; 0222 }, 0223 success: function (results) { 0224 $('#TableContainer').jtable('reload'); 0225 return false; 0226 } 0227 }); 0228 0229 return false; 0230 }); 0231 0232 0233 //Re-load records when user click 'remove filter' button. 0234 $('#RemoveFilterButton').click(function (e) { 0235 e.preventDefault(); 0236 $("#filter_member_id option[value='']").attr('selected', true) 0237 $('#TableContainer').jtable('load', { 0238 filter_member_id: null, 0239 }); 0240 }); 0241 0242 // $('#TableContainer').jtable('load', { 0243 // filter_member_id: $('#filter_member_id').val() 0244 // }); 0245 0246 $('#TableContainer').jtable('load', { 0247 filterMonth: $('#filterMonth').val(), 0248 },function(){ 0249 0250 }); 0251 0252 $('body').on("click", 'a.imghistory', function (event) { 0253 event.preventDefault(); 0254 event.stopImmediatePropagation(); 0255 0256 return false; 0257 }); 0258 0259 0260 0261 0262 0263 }); 0264 </script> 0265 0266