Subversion Repositories wpShopGermany4

Rev

Blame | Last modification | View Log | RSS feed

<?php
        
        declare(strict_types=1);
        
        /**
         * @author: Daniel Schmitzer (daniel@maennchen1.de)
         * @date: 03.12.23
         * @time: 15:14
         */
        
        namespace wpsgTicket;
        
        /** @var \wpsg_order $oOrder */
    $oOrder = \wpsg_order::getInstance(intval($this->view['data']['id']));
        
        $data = [];
        
        foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
                
                if (intval($oOrderProduct->getMeta('ticket_id', false, 0)) > 0) {
                
                        for ($amount_index = 0; $amount_index < $oOrderProduct->getAmount(); $amount_index++) {
                        
                                $oTicketBooking = TicketBooking::getInstanceByBookingKey(TicketBooking::encodeBookingKey($oOrderProduct->getId(), $amount_index));
                                
                                $data[] = $oTicketBooking->toJSON();
                        
                        }
                
                }
                
        }
        
?>

<?php echo wpsg_drawForm_AdminboxStart(__('Ticketbuchungen', 'wpsg')); ?>
        <div id="order_view_app">
                
                <table>
                        <thead>
                                <tr>
                                        <th class="col_ticket"><?php echo __('Ticket', 'wpsg'); ?></th>
                                        <th class="col_product"><?php echo __('Ticket Produkt', 'wpsg'); ?></th>
                                        <th class="col_date"><?php echo __('Datum / Zeitraum', 'wpsg'); ?></th>
                                        <th class="col_state"><?php echo __('Status', 'wpsg'); ?></th>
                                </tr>
                        </thead>
                        <tbody v-for="(row, i) in data">
                                <tr>
                                        <td class="col_ticket">
                                                <a :href="row.urls.pdf" target="_blank">{{row.label}}</a>
                                        </td>
                                        <td class="col_product">
                                                <a :href="row.urls.product_edit">{{row.ticket_product_label}}</a>
                                        </td>
                                        <td class="col_date">{{row.ticket_data.label}}</td>
                                        <td class="col_state">
                                                <span :class="{'text-red': row.state_code === <?php echo TicketBooking::STATUS_UNAVAILABLE; ?>, 'text-green': row.state_code === <?php echo TicketBooking::STATUS_AVAILABLE; ?>}">{{row.state_label}}</span>
                                                <span v-if="row.is_send" :title="row.is_send_tooltip" class="ml-4 glyphicon glyphicon-send text-green"></span>
                                        </td>
                                </tr>
                                <template v-if="row.arProductVars.length > 0">
                                        <template v-for="(pv_data, pv_id) of row.arProductVars">
                                                <tr>
                                                        <td colspan="2">
                                                                {{pv_data['name']}}:
                                                        </td>
                                                        <td colspan="2">
                                                                {{pv_data['value']}}
                                                        </td>
                                                </tr>
                                        </template>
                                </template>
                        </tbody>
                </table>
                
                <br />
                
                <div class="flex items-center gap-2">
                        
                        <a href="<?php echo \add_query_arg([
                                'action' => 'wpsg_ticket',
                                'ticket_action' => 'export',
                                'order_id' => $oOrder->getId()
                        ], \admin_url('admin-ajax.php')); ?>" target="_blank" class="button"><?php echo __('Terminübersicht exportieren', 'wpsg'); ?></a>
                        
                        <a href="<?php echo \add_query_arg([
                                'action' => 'wpsg_ticket',
                                'ticket_action' => 'resend',
                                'order_id' => $oOrder->getId()
                        ], \admin_url('admin-ajax.php')); ?>" class="button"><?php echo __('Tickets per E-Mail an Kunden versenden', 'wpsg'); ?></a>
                
                </div>
                
        </div>
        <style>
                
                #order_view_app table { width:100%; }
                #order_view_app table tr td { padding:0.25rem 0.5rem 0.25rem 0; border-bottom:1px solid #DEDEDE; }
                #order_view_app table tr th { border-bottom:1px solid black; }
                #order_view_app .text-red { color:red; }
                #order_view_app .text-green { color:green; }
                #order_view_app .flex { display:flex; }
                #order_view_app .items-center { align-items:center; }
                #order_view_app .ml-4 { margin-left:1rem; }
                #order_view_app .gap-2 { gap:0.5rem; }
                
        </style>
<?php echo wpsg_drawForm_AdminboxEnd(); ?>

<script type="module">
        
        const wpsgSettings = {
                baseUrl: '<?php echo WPSG_URL; ?>'
        };
        
        import { order_view } from '<?php echo WPSG_URL; ?>mods/mod_ticket/assets/js/wpsg_order_view.js';
        
        order_view(wpsgSettings, <?php echo json_encode([
                'order_id' => $oOrder->getId(),
                'data' => $data,
                'ajax_url' => \admin_url('admin-ajax.php')
        ]); ?>);
        
</script>