This commit is contained in:
2026-05-06 23:16:47 +02:00
parent ea77c8ea35
commit c4a485e530
23 changed files with 2141 additions and 1772 deletions

View File

@@ -11,12 +11,9 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Get yacht data
$title = $yacht ? $yacht->post_title : '';
$content = $yacht ? $yacht->post_content : '';
$gcal_id = $yacht ? \YachtBooking\Yacht::get_gcal_id( $yacht->ID ) : '';
$ical_import_url = $yacht ? \YachtBooking\Integrations\ICal\ICal_Import::get_import_url( $yacht->ID ) : '';
$ical_feed_url = $yacht ? \YachtBooking\Integrations\ICal\ICal_Feed::get_feed_url( $yacht->ID ) : '';
$ical_last_import = $yacht ? \YachtBooking\Integrations\ICal\ICal_Import::get_last_import_time( $yacht->ID ) : '';
$title = $yacht ? $yacht->post_title : '';
$content = $yacht ? $yacht->post_content : '';
$gcal_alias = $yacht ? \YachtBooking\Yacht::get_gcal_alias( $yacht->ID ) : '';
$page_title = $yacht ? __( 'Edytuj Jacht', 'yacht-booking' ) : __( 'Dodaj Jacht', 'yacht-booking' );
?>
@@ -89,100 +86,28 @@ $page_title = $yacht ? __( 'Edytuj Jacht', 'yacht-booking' ) : __( 'Dodaj Jacht'
</td>
</tr>
<!-- Google Calendar ID -->
<!-- Alias dla globalnej synchronizacji iCal -->
<tr>
<th scope="row">
<label for="yacht_gcal_id">
<?php esc_html_e( 'Google Calendar ID', 'yacht-booking' ); ?>
<label for="yacht_gcal_alias">
<?php esc_html_e( 'Alias dla Google Calendar', 'yacht-booking' ); ?>
</label>
</th>
<td>
<input
type="text"
name="yacht_gcal_id"
id="yacht_gcal_id"
value="<?php echo esc_attr( $gcal_id ); ?>"
class="regular-text code"
placeholder="nazwa@group.calendar.google.com"
name="yacht_gcal_alias"
id="yacht_gcal_alias"
value="<?php echo esc_attr( $gcal_alias ); ?>"
class="regular-text"
placeholder="<?php echo esc_attr( $title ); ?>"
/>
<p class="description">
<?php
echo wp_kses_post(
sprintf(
/* translators: %s: link to Google Calendar settings */
__( 'ID kalendarza Google do synchronizacji rezerwacji. <a href="%s" target="_blank">Jak znaleźć Calendar ID?</a>', 'yacht-booking' ),
'https://docs.simplecalendar.io/find-google-calendar-id/'
)
);
?>
<?php esc_html_e( 'Opcjonalny krótki alias używany w tytule eventu Google Calendar (np. "Maja" zamiast "Marina Maja Sailing 35"). Plugin rozpoznaje jacht po prefiksie tytułu eventu w formacie "Alias - opis". Jeśli puste — używana jest pełna nazwa jachtu.', 'yacht-booking' ); ?>
</p>
<?php if ( $gcal_id ) : ?>
<p class="gcal-status connected">
<span class="dashicons dashicons-yes-alt"></span>
<?php esc_html_e( 'Połączony z Google Calendar', 'yacht-booking' ); ?>
</p>
<?php endif; ?>
</td>
</tr>
<!-- iCal Import URL -->
<tr>
<th scope="row">
<label for="yacht_ical_import_url">
<?php esc_html_e( 'Import iCal (URL)', 'yacht-booking' ); ?>
</label>
</th>
<td>
<input
type="url"
name="yacht_ical_import_url"
id="yacht_ical_import_url"
value="<?php echo esc_attr( $ical_import_url ); ?>"
class="large-text code"
placeholder="https://calendar.google.com/calendar/ical/...basic.ics"
/>
<p class="description">
<?php esc_html_e( 'Wklej adres URL pliku .ics z Google Calendar (lub innego kalendarza). Wydarzenia zostaną zaimportowane jako zablokowane terminy (synchronizacja co godzinę).', 'yacht-booking' ); ?>
</p>
<p class="description">
<strong><?php esc_html_e( 'Jak uzyskać link iCal z Google Calendar:', 'yacht-booking' ); ?></strong>
<?php esc_html_e( 'Google Calendar → Ustawienia → Wybierz kalendarz → „Tajny adres w formacie iCal" → Skopiuj link.', 'yacht-booking' ); ?>
</p>
<?php if ( $ical_last_import ) : ?>
<p>
<span class="dashicons dashicons-update" style="color: #2271b1;"></span>
<?php
printf(
/* translators: %s: date/time */
esc_html__( 'Ostatni import: %s', 'yacht-booking' ),
esc_html( $ical_last_import )
);
?>
</p>
<?php endif; ?>
</td>
</tr>
<?php if ( $yacht ) : ?>
<!-- iCal Export Feed URL -->
<tr>
<th scope="row">
<?php esc_html_e( 'Eksport iCal (feed)', 'yacht-booking' ); ?>
</th>
<td>
<input
type="text"
value="<?php echo esc_attr( $ical_feed_url ); ?>"
class="large-text code"
readonly
onclick="this.select();"
/>
<p class="description">
<?php esc_html_e( 'Skopiuj ten link i dodaj go w Google Calendar (Inne kalendarze → Z adresu URL), aby rezerwacje z tego systemu pojawiły się w Twoim kalendarzu.', 'yacht-booking' ); ?>
</p>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>