first commit
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Yacht Booking Admin Styles
|
||||
*
|
||||
* @package YachtBooking
|
||||
*/
|
||||
|
||||
/* General Admin Page */
|
||||
.yacht-bookings-page {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Yacht List Table */
|
||||
.wp-list-table.yachts {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.wp-list-table.yachts th {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wp-list-table.yachts .row-title {
|
||||
font-weight: 600;
|
||||
color: #2271b1;
|
||||
}
|
||||
|
||||
.wp-list-table.yachts .row-title:hover {
|
||||
color: #135e96;
|
||||
}
|
||||
|
||||
/* Google Calendar Status */
|
||||
.gcal-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.gcal-status.connected {
|
||||
color: #28a745;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.gcal-status.disconnected {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.gcal-status .dashicons {
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
/* Yacht Edit Form */
|
||||
.yacht-edit-form {
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.yacht-edit-form .form-table th {
|
||||
width: 200px;
|
||||
padding: 20px 10px 20px 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.yacht-edit-form .form-table td {
|
||||
padding: 15px 10px;
|
||||
}
|
||||
|
||||
.yacht-edit-form .description {
|
||||
color: #646970;
|
||||
font-size: 13px;
|
||||
font-style: normal;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.yacht-edit-form .description a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.yacht-edit-form .description a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.yacht-edit-form input[type="text"].code {
|
||||
font-family: Consolas, Monaco, monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.yacht-edit-form .gcal-status.connected {
|
||||
margin-top: 10px;
|
||||
padding: 8px 12px;
|
||||
background: #d4edda;
|
||||
border: 1px solid #c3e6cb;
|
||||
border-radius: 4px;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
/* Submit Button */
|
||||
.yacht-edit-form .submit {
|
||||
padding: 0;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.yacht-edit-form .button.button-primary.button-large {
|
||||
height: 36px;
|
||||
padding: 0 24px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* Delete Button */
|
||||
.button-link-delete {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button-link-delete:hover {
|
||||
color: #a00 !important;
|
||||
}
|
||||
|
||||
/* Booking Status Badges */
|
||||
.booking-status {
|
||||
display: inline-block;
|
||||
padding: 4px 12px;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.booking-status.pending {
|
||||
background: #fef3cd;
|
||||
color: #856404;
|
||||
border: 1px solid #ffeeba;
|
||||
}
|
||||
|
||||
.booking-status.confirmed {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
border: 1px solid #c3e6cb;
|
||||
}
|
||||
|
||||
.booking-status.cancelled {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
|
||||
/* Settings Tabs */
|
||||
.nav-tab-wrapper {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Form Sections */
|
||||
.yacht-form-section {
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.yacht-form-section h3 {
|
||||
margin-top: 0;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* Notices */
|
||||
.notice {
|
||||
margin: 15px 0 20px;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media screen and (max-width: 782px) {
|
||||
.yacht-edit-form .form-table th {
|
||||
width: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.yacht-edit-form .form-table td {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Yacht Booking Admin JavaScript
|
||||
*
|
||||
* @package YachtBooking
|
||||
*/
|
||||
|
||||
;(function($) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Admin functionality
|
||||
*/
|
||||
const YachtBookingAdmin = {
|
||||
init: function() {
|
||||
this.bindEvents();
|
||||
},
|
||||
|
||||
bindEvents: function() {
|
||||
// Manual sync button
|
||||
$(document).on('click', '#yacht-booking-manual-sync', this.handleManualSync.bind(this));
|
||||
},
|
||||
|
||||
handleManualSync: function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const $button = $(e.currentTarget);
|
||||
const $status = $('#yacht-booking-sync-status');
|
||||
const $result = $('#yacht-booking-sync-result');
|
||||
const nonce = $button.data('nonce');
|
||||
const originalText = $button.text();
|
||||
|
||||
// Disable button and show loading
|
||||
$button.prop('disabled', true).text('Synchronizowanie...');
|
||||
$status.html('<span class="spinner is-active" style="float: none; margin: 0;"></span>');
|
||||
$result.empty();
|
||||
|
||||
// AJAX call
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'yacht_booking_manual_sync',
|
||||
nonce: nonce
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
$result.html(
|
||||
'<div class="notice notice-success inline"><p>' +
|
||||
response.data.message +
|
||||
'</p></div>'
|
||||
);
|
||||
} else {
|
||||
$result.html(
|
||||
'<div class="notice notice-error inline"><p>' +
|
||||
response.data.message +
|
||||
'</p></div>'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$result.html(
|
||||
'<div class="notice notice-error inline"><p>' +
|
||||
'Błąd połączenia: ' + error +
|
||||
'</p></div>'
|
||||
);
|
||||
},
|
||||
complete: function() {
|
||||
// Re-enable button
|
||||
$button.prop('disabled', false).text(originalText);
|
||||
$status.empty();
|
||||
|
||||
// Auto-hide success message after 5 seconds
|
||||
setTimeout(function() {
|
||||
$result.find('.notice-success').fadeOut();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Document ready
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
YachtBookingAdmin.init();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user