admin-calendar-app-buttons.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. $appt_id = intval($appt_id);
  3. $appointment = Booked_WC_Appointment::get($appt_id);
  4. $post_status = $appointment->post->post_status;
  5. $awaiting_status = BOOKED_WC_PLUGIN_PREFIX . 'awaiting';
  6. if ( !$appointment->order_id || $appointment->order_id == 'manual' ): ?>
  7. <a href="#" class="delete" <?php echo $calendar_id ? ' data-calendar-id="'.$calendar_id.'"' : '' ?> ><i class="booked-icon booked-icon-close"></i></a>
  8. <?php endif; ?>
  9. <?php if ($post_status != 'publish' && $post_status != 'future'): ?>
  10. <button data-appt-id="<?php echo $appt_id ?>" class="approve button button-primary"><?php echo __('Approve Appointment', 'booked-woocommerce-payments') ?></button>
  11. <?php endif; ?>
  12. <?php if ( !$appointment->is_paid): ?>
  13. <span class="booked-wc_status-text awaiting">
  14. <?php
  15. if ( $appointment->order_id ) {
  16. if (current_user_can('manage_booked_options')) :
  17. echo '<button data-appt-id="'.$appt_id.'" class="mark-paid button">'.__('Mark as Paid', 'booked-woocommerce-payments').'</button>';
  18. echo '<a target="_blank" href="' . admin_url('/post.php?post=' . $appointment->order_id . '&action=edit') . '">' . $appointment->payment_status_text . '</a>';
  19. else :
  20. echo '<span>' . $appointment->payment_status_text . '</span>';
  21. endif;
  22. } else {
  23. if (current_user_can('manage_booked_options')) :
  24. echo '<button data-appt-id="'.$appt_id.'" class="mark-paid button">'.__('Mark as Paid', 'booked-woocommerce-payments').'</button>';
  25. endif;
  26. echo '<span>' . __('Awaiting Payment', 'booked-woocommerce-payments') . '</span>';
  27. }
  28. ?>
  29. </span>
  30. <?php else:
  31. echo '<span class="booked-wc_status-text paid">';
  32. if (current_user_can('manage_booked_options') && $appointment->order_id != 'manual') :
  33. echo '<a target="_blank" href="' . admin_url('/post.php?post=' . $appointment->order_id . '&action=edit') . '"><i class="booked-icon booked-icon-pencil"></i>&nbsp;&nbsp;' . __('Paid', 'booked-woocommerce-payments') . '</a>';
  34. else :
  35. echo '<span>' . __('Paid', 'booked-woocommerce-payments') . '</span>';
  36. endif;
  37. echo '</span>';
  38. endif;