File indexing completed on 2025-05-04 05:29:02

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 ?>
0023 <div class="messages">
0024     <?php foreach (Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger')
0025                        ->getCurrentMessages() as $message) : ?>
0026         <p><?php echo $this->escape($message); ?></p>
0027     <?php endforeach; ?>
0028 </div>
0029 <?php
0030 $lastMonth = date("Ym", strtotime("first day of previous month"));
0031 ?>
0032 
0033 <div class="filtering">
0034     <form>
0035         Status: 
0036             <select name="filter_status" id="filter_status">
0037                 <option value=""></option>
0038                 <option value="Completed">Completed</option>
0039                 <option value="Pending">Pending</option>
0040                 <option value="Returned">Returned</option>
0041                 <option value="Unclaimed">Unclaimed</option>
0042                 <option value="Error">Error</option>
0043             </select>
0044         Member Id: <input type="text" name="filter_member_id" id="filter_member_id"/>
0045         PayPal-Mail: <input type="text" name="filter_paypal_mail" id="filter_paypal_mail"/>
0046         <button type="submit" id="LoadRecordsButton"><?= $this->translate('Load records'); ?></button>
0047         <button type="reset" id="RemoveFilterButton"><?= $this->translate('Remove filter'); ?></button>
0048     </form>
0049 </div>
0050 <div id="TableContainer"></div>
0051 <script type="text/javascript">
0052     $(document).ready(function () {
0053         $('#TableContainer').jtable({
0054             jqueryuiTheme: true,
0055             paging: true,
0056             sorting: true,
0057             defaultSorting: 'amount asc',
0058             title: 'Table of member payouts',
0059             actions: {
0060                 listAction: '/backend/memberpaypaladdress/list',
0061                 createAction: '/backend/memberpaypaladdress/create',
0062                 updateAction: '/backend/memberpaypaladdress/update',
0063                 deleteAction: '/backend/memberpaypaladdress/delete'
0064             },
0065             fields: {
0066                 id: {
0067                     title: 'Id',
0068                     key: true,
0069                     create: false,
0070                     edit: false,
0071                     list: false
0072                 },
0073                 member_id: {
0074                     title: 'Member Id',
0075                     list: true,
0076                     edit: true,
0077                     create: true
0078                 },
0079                 paypal_address: {
0080                     title: 'PayPal Address',
0081                     list: true,
0082                     edit: true,
0083                     create: true
0084                 },
0085                 name: {
0086                     title: 'Name',
0087                     list: true,
0088                     edit: true,
0089                     create: true
0090                 },
0091                 address: {
0092                     title: 'Address',
0093                     list: true,
0094                     edit: true,
0095                     create: true
0096                 },
0097                 currency: {
0098                     title: 'Curency',
0099                     list: true,
0100                     edit: true,
0101                     create: true
0102                 },
0103                 country_code: {
0104                     title: 'Country Code',
0105                     list: true,
0106                     edit: true,
0107                     create: true
0108                 },
0109                 last_payment_status: {
0110                     title: 'Last Status',
0111                     options: {'': '', 'Completed': 'Completed', 'Pending': 'Pending', 'Error' : 'Error', 'Returned' : 'Returned', 'Unclaimed' : 'Unclaimed'},
0112                     optionsSorting: 'id',
0113                     list: true,
0114                     edit: true
0115                 },
0116                 last_payment_amount: {
0117                     title: 'Last amount',
0118                     list: true,
0119                     edit: true,
0120                     create: true
0121                 },
0122                 last_transaction_id: {
0123                     title: 'Last Tx-Id',
0124                     list: true,
0125                     edit: true,
0126                     create: true
0127                 },
0128             },
0129             recordsLoaded: function (event, data) {
0130                 for (var i in data.records) {
0131                     if (data.records[i].last_payment_status == 'Completed') {
0132                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:green !important; color:white !important;");
0133                     }
0134                     if (data.records[i].last_payment_status == 'Pending') {
0135                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:yellow !important; color:black !important;");
0136                     }
0137                     if (data.records[i].last_payment_status == 'Error') {
0138                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:red !important; color:white !important;");
0139                     }
0140                     if (data.records[i].last_payment_status == 'Unclaimed') {
0141                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:red !important; color:white !important;");
0142                     }
0143                     if (data.records[i].last_payment_status == 'Returned') {
0144                         $('#TableContainer').find(".jtable tbody tr:eq(" + i + ")").css("cssText", "background-color:red !important; color:white !important;");
0145                     }
0146                 }
0147             },
0148             recordUpdated: function (event, data) {
0149                 if (data.record) {
0150                     $('#TableContainer').jtable('load', {
0151                         filter_status: $('#filter_status').val(),
0152                         filter_member_id: $('#filter_member_id').val(),
0153                         filter_paypal_mail: $('#filter_paypal_mail').val()
0154                     });
0155                 }
0156             },
0157             rowUpdated: function (event, data) {
0158                 if (data.record) {
0159                     $('#TableContainer').jtable('load', {
0160                         filter_yearmonth: $('#filter_status').val(),
0161                         filter_member_id: $('#filter_member_id').val(),
0162                         filter_paypal_mail: $('#filter_paypal_mail').val()
0163                     });
0164                 }
0165             }
0166         });
0167 
0168         //Re-load records when user click 'load records' button.
0169         $('#LoadRecordsButton').click(function (e) {
0170             e.preventDefault();
0171             $('#TableContainer').jtable('load', {
0172                 filter_status: $('#filter_status').val(),
0173                 filter_member_id: $('#filter_member_id').val(),
0174                 filter_paypal_mail: $('#filter_paypal_mail').val()
0175             });
0176         });
0177 
0178         //Re-load records when user click 'remove filter' button.
0179         $('#RemoveFilterButton').click(function (e) {
0180             e.preventDefault();
0181             $('#TableContainer').jtable('load', {
0182                 filter_status: null,
0183                 filter_member_id: null,
0184                 filter_paypal_mail: null
0185             });
0186         });
0187 
0188         $('#TableContainer').jtable('load');
0189         
0190         
0191     });
0192 </script>