Skip to content

Commit

Permalink
Support date input on added fields
Browse files Browse the repository at this point in the history
Duet double fires and creates duplicates, hiding those using CSS; only the last one actually works.
  • Loading branch information
joedolson committed Dec 18, 2023
1 parent 8d088de commit c1be5db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/css/my-tickets.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
padding: 0;
}

td duet-date-picker .duet-date:not(:last-of-type) {
display: none;
}

.mt-move-tickets {
position: relative;
display: none;
Expand Down
5 changes: 3 additions & 2 deletions src/mt-processing.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,11 @@ function mt_prices_table( $registration = array() ) {
$available = "<input type='hidden' name='mt_tickets[]' id='mt_tickets_$label' value='inherit' />";
}
if ( $label ) {
$date = ( '' !== $options['label'] ) ? $options['label'] : date( 'Y-m-d' );
$args = array(
'id' => "mt_label_$label",
'name' => 'mt_label[]',
'value' => gmdate( 'Y-m-d', strtotime( $options['label'] ) ),
'value' => gmdate( 'Y-m-d', strtotime( $date ) ),
);
$label_field = ( 'event' === $counting ) ? '<div class="mt-date-time-picker">' . mt_datepicker_html( $args ) . '<label for="mt_label_picker_time_' . $label . '" class="screen-reader-text">' . __( 'Time', 'my-tickets' ) . '</label><input type="time" name="mt_label_time[]" id="mt_label_picker_time_' . $label . '"></div>' : '';
$label_class = ( 'event' === $counting ) ? 'duet-fallback' : '';
Expand Down Expand Up @@ -472,7 +473,7 @@ function mt_prices_table( $registration = array() ) {
$return .= "
<tr class='clonedPrice' id='price1'>
<td></td>
<td><input type='text' name='mt_label[]' id='mt_label' /></td>
<td>$label_field<input type='text' class='" . $label_class . "' name='mt_label[]' id='mt_label' /></td>
<td><input type='text' name='mt_price[]' id='mt_price' step='0.01' size='8' /></td>
<td>$available_empty</td>
<td></td>
Expand Down

0 comments on commit c1be5db

Please sign in to comment.