invoice-refund-view.php 4.52 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

	<title>Edit CE Hours</title>
	<style type="text/css">
	   
	   html, body { margin:0px; padding:0;}
	   .title-link {
        color:#f7bd55; 
        font-size: 12px;
        font-weight: bold;
        text-align: left;
        line-height: 1.75em;
        background: #3b0d32;
        border: solid 1px #FFF;
        border-bottom: solid 1px #999;
        cursor: default;
        padding: 0em; padding:3px 10px 3px 10px;
        margin: 0em;
        
	   }
	   
	   
	   form {
	       display: block;
	       margin-right:20px;
	   }
	   
	   table.item-listings tr th { text-align:left; border-bottom:1px solid #ccc; }
	   table.item-listings tr td { text-aling:left; border-bottom:1px solid #e8e8e8; }
	   
	   table.item-listings tr th,
	   table.item-listings tr td { padding: 4px 5px; }
	   
	   .dashboard-section-title { font-weight:bold; color:#3b0d32; }
	</style>
</head>

<body>
    
    <div style="display:block; width:750px; margin-bottom:0px;">
        <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Refund: <?php echo $invoice->post_title; ?></div>
        <div style="padding:10px;">
            
            <form id="invoice_refund_form">
            
            <table cellpadding="0" cellspacing="0" width="100%" border="0" style="border-collapse:collapse;" class="item-listings">
                <tr>
                    <th>Item Description</th>
                    <th width="140">Refund?</th>
                </tr>
                
                <?php
                $items = get_post_meta($invoice->ID, 'items', true);
                foreach($items as $key=>$item):
                ?>
                <tr>
                    <td>
                    <?php 
                    if ( isset($item['post_id']) && $item['post_id'] > 0) {
                        $p = get_post($item['post_id']);
                        echo $p->post_title;
                    } else {
                        echo $item['description'];
                    }
                    ?>
                    </td>
                    <td><input type="checkbox" checked="checked" name="keys[<?php echo $key?>]" /> <span style="color:#999;font-size:11px;">(-$<?php echo number_format($item['total'], 2, ".", "");?>)</span></td>
                </tr>
                <?php endforeach; ?>
            </table>
            
            
            <div style="border-top:1px solid #ccc;padding-top:8px;margin-top:25px;">
                
                <table cellpadding="0" cellspacing="0" width="100%" border="0" style="border-collapse:collapse;">
                    <tr>
                        <td>
                            <input name="force_cancellation_fee" value="on" type="checkbox" checked="checked" />&nbsp;<label>Apply cancellation fee?</label>
                        </td>
                        <td width="400" style="text-align:right;">
                            <input type="submit" value="Apply Changes" /> <input type="button" value="Cancel Changes" id="refund_cancel_btn" />
                        </td>
                    </tr>
                </table>
                
                
            </div>
            
            </form>
            
        </div>
    
    </div>
    
    <script type="text/javascript">
        
        jQuery(document).ready(function($) {
            $('#invoice_refund_form').ajaxForm({
                url:    '/wp-admin/admin-ajax.php'
              , data:   ({ajax:"yes", action: 'issue_invoice_refund', invoice_id: <?php echo $invoice->ID?>})
              , dataType: 'json'
              , type:   'POST'
              , success: function(data) {
                if (data.success == 'true') {
                    document.location.href = document.location.href;
                } else {
                    jAlert(data.msg, 'Server Error Encountered');   
                }
              }
            });
        
        
            $('#refund_cancel_btn').click(function(e) {
                e.preventDefault();
                $.colorbox.close();
            });
        });
                
    </script>
        
</body>
</html>