|
125 | 125 | <?php endif; ?> |
126 | 126 | </div> |
127 | 127 |
|
128 | | - <div class="misc-pub-section curtime"> |
129 | | - <?php |
| 128 | + <?php if ( SubscriptionStatus::CANCELLED !== $subscription->get_status() ) : ?> |
130 | 129 |
|
131 | | - $next_payment_date = $subscription->get_next_payment_date(); |
| 130 | + <div class="misc-pub-section curtime"> |
| 131 | + <?php |
132 | 132 |
|
133 | | - ?> |
| 133 | + $next_payment_date = $subscription->get_next_payment_date(); |
134 | 134 |
|
135 | | - <span id="timestamp"> |
136 | | - <?php echo esc_html( __( 'Next payment:', 'pronamic_ideal' ) ); ?> |
137 | | - </span> |
| 135 | + ?> |
138 | 136 |
|
139 | | - <span id="pronamic-pay-next-payment-date-display"><?php echo esc_html( null === $next_payment_date ? '—' : $next_payment_date->format_i18n( \__( 'D j M Y', 'pronamic_ideal' ) ) ); ?></span> |
| 137 | + <span id="timestamp"> |
| 138 | + <?php echo esc_html( __( 'Next payment:', 'pronamic_ideal' ) ); ?> |
| 139 | + </span> |
140 | 140 |
|
141 | | - <?php if ( 'woocommerce' !== $subscription->get_source() ) : ?> |
| 141 | + <span id="pronamic-pay-next-payment-date-display"><?php echo esc_html( null === $next_payment_date ? '—' : $next_payment_date->format_i18n( \__( 'D j M Y', 'pronamic_ideal' ) ) ); ?></span> |
142 | 142 |
|
143 | | - <a href="#pronamic-pay-next-payment-date" class="edit-pronamic-pay-next-payment-date hide-if-no-js" role="button"> |
144 | | - <span aria-hidden="true"><?php esc_html_e( 'Edit', 'pronamic_ideal' ); ?></span> |
145 | | - <span class="screen-reader-text"><?php esc_html_e( 'Edit next payment date', 'pronamic_ideal' ); ?></span> |
146 | | - </a> |
| 143 | + <?php if ( 'woocommerce' !== $subscription->get_source() ) : ?> |
147 | 144 |
|
148 | | - <?php endif; ?> |
| 145 | + <a href="#pronamic-pay-next-payment-date" class="edit-pronamic-pay-next-payment-date hide-if-no-js" role="button"> |
| 146 | + <span aria-hidden="true"><?php esc_html_e( 'Edit', 'pronamic_ideal' ); ?></span> |
| 147 | + <span class="screen-reader-text"><?php esc_html_e( 'Edit next payment date', 'pronamic_ideal' ); ?></span> |
| 148 | + </a> |
149 | 149 |
|
150 | | - <div id="pronamic-pay-next-payment-date-input" class="hide-if-js"> |
151 | | - <input type="hidden" name="hidden_pronamic_pay_next_payment_date" id="hidden_pronamic_pay_next_payment_date" value="<?php echo \esc_attr( null === $next_payment_date ? '' : $next_payment_date->format( 'Y-m-d' ) ); ?>" /> |
152 | | - <label for="pronamic-pay-next-payment-date" class="screen-reader-text"><?php esc_html_e( 'Set date', 'pronamic_ideal' ); ?></label> |
| 150 | + <?php endif; ?> |
153 | 151 |
|
154 | | - <?php |
| 152 | + <div id="pronamic-pay-next-payment-date-input" class="hide-if-js"> |
| 153 | + <input type="hidden" name="hidden_pronamic_pay_next_payment_date" id="hidden_pronamic_pay_next_payment_date" value="<?php echo \esc_attr( null === $next_payment_date ? '' : $next_payment_date->format( 'Y-m-d' ) ); ?>" /> |
| 154 | + <label for="pronamic-pay-next-payment-date" class="screen-reader-text"><?php esc_html_e( 'Set date', 'pronamic_ideal' ); ?></label> |
155 | 155 |
|
156 | | - $element = new Element( |
157 | | - 'input', |
158 | | - [ |
159 | | - 'id' => 'pronamic-pay-next-payment-date', |
160 | | - 'name' => 'pronamic_subscription_next_payment_date', |
161 | | - 'type' => 'date', |
162 | | - 'value' => null === $next_payment_date ? '' : $next_payment_date->format( 'Y-m-d' ), |
163 | | - 'data-min' => ( new DateTimeImmutable( 'tomorrow' ) )->format( 'Y-m-d' ), |
164 | | - ] |
165 | | - ); |
| 156 | + <?php |
166 | 157 |
|
167 | | - $element->output(); |
| 158 | + $element = new Element( |
| 159 | + 'input', |
| 160 | + [ |
| 161 | + 'id' => 'pronamic-pay-next-payment-date', |
| 162 | + 'name' => 'pronamic_subscription_next_payment_date', |
| 163 | + 'type' => 'date', |
| 164 | + 'value' => null === $next_payment_date ? '' : $next_payment_date->format( 'Y-m-d' ), |
| 165 | + 'data-min' => ( new DateTimeImmutable( 'tomorrow' ) )->format( 'Y-m-d' ), |
| 166 | + ] |
| 167 | + ); |
168 | 168 |
|
169 | | - ?> |
| 169 | + $element->output(); |
170 | 170 |
|
171 | | - <a href="#pronamic-pay-next-payment-date" class="save-pronamic-pay-next-payment-date hide-if-no-js button"><?php esc_html_e( 'OK', 'pronamic_ideal' ); ?></a> |
172 | | - <a href="#pronamic-pay-next-payment-date" class="cancel-pronamic-pay-next-payment-date hide-if-no-js button-cancel"><?php esc_html_e( 'Cancel', 'pronamic_ideal' ); ?></a> |
173 | | - </div> |
| 171 | + ?> |
174 | 172 |
|
175 | | - <?php |
| 173 | + <a href="#pronamic-pay-next-payment-date" class="save-pronamic-pay-next-payment-date hide-if-no-js button"><?php esc_html_e( 'OK', 'pronamic_ideal' ); ?></a> |
| 174 | + <a href="#pronamic-pay-next-payment-date" class="cancel-pronamic-pay-next-payment-date hide-if-no-js button-cancel"><?php esc_html_e( 'Cancel', 'pronamic_ideal' ); ?></a> |
| 175 | + </div> |
| 176 | + |
| 177 | + <?php |
176 | 178 |
|
177 | | - $today = new DateTimeImmutable( 'today midnight', new DateTimeZone( Plugin::TIMEZONE ) ); |
| 179 | + $today = new DateTimeImmutable( 'today midnight', new DateTimeZone( Plugin::TIMEZONE ) ); |
178 | 180 |
|
179 | | - if ( SubscriptionStatus::ACTIVE === $subscription->get_status() && null !== $next_payment_date && $next_payment_date < $today ) : |
180 | | - ?> |
| 181 | + if ( SubscriptionStatus::ACTIVE === $subscription->get_status() && null !== $next_payment_date && $next_payment_date < $today ) : |
| 182 | + ?> |
181 | 183 |
|
182 | | - <div id="pronamic-pay-next-payment-date-error" class="error inline"> |
183 | | - <p><?php echo esc_html( __( 'Set the next payment date to a future date to continue payments for this subscription.', 'pronamic_ideal' ) ); ?></p> |
184 | | - </div> |
| 184 | + <div id="pronamic-pay-next-payment-date-error" class="error inline"> |
| 185 | + <p><?php echo esc_html( __( 'Set the next payment date to a future date to continue payments for this subscription.', 'pronamic_ideal' ) ); ?></p> |
| 186 | + </div> |
185 | 187 |
|
186 | | - <?php endif; ?> |
| 188 | + <?php endif; ?> |
187 | 189 |
|
188 | | - <div id="pronamic-pay-next-payment-date-min-error" class="hidden error inline"> |
189 | | - <p><?php echo esc_html( __( 'Please select a future date.', 'pronamic_ideal' ) ); ?></p> |
190 | | - </div> |
| 190 | + <div id="pronamic-pay-next-payment-date-min-error" class="hidden error inline"> |
| 191 | + <p><?php echo esc_html( __( 'Please select a future date.', 'pronamic_ideal' ) ); ?></p> |
| 192 | + </div> |
191 | 193 |
|
192 | | - <div id="pronamic-pay-next-payment-date-notice" class="hidden notice inline"> |
193 | | - <p> |
194 | | - <?php |
| 194 | + <div id="pronamic-pay-next-payment-date-notice" class="hidden notice inline"> |
| 195 | + <p> |
| 196 | + <?php |
195 | 197 |
|
196 | | - \printf( |
197 | | - /* translators: %s subscription source description */ |
198 | | - \esc_html( \__( 'Editing the next payment date does not affect the current status or validity of %s.', 'pronamic_ideal' ) ), |
199 | | - \wp_kses( |
200 | | - $subscription->get_source_text(), |
201 | | - [ |
202 | | - 'a' => [ |
203 | | - 'href' => true, |
204 | | - ], |
205 | | - ] |
206 | | - ) |
207 | | - ); |
| 198 | + \printf( |
| 199 | + /* translators: %s subscription source description */ |
| 200 | + \esc_html( \__( 'Editing the next payment date does not affect the current status or validity of %s.', 'pronamic_ideal' ) ), |
| 201 | + \wp_kses( |
| 202 | + $subscription->get_source_text(), |
| 203 | + [ |
| 204 | + 'a' => [ |
| 205 | + 'href' => true, |
| 206 | + ], |
| 207 | + ] |
| 208 | + ) |
| 209 | + ); |
208 | 210 |
|
209 | | - ?> |
210 | | - </p> |
| 211 | + ?> |
| 212 | + </p> |
| 213 | + </div> |
211 | 214 | </div> |
212 | | - </div> |
| 215 | + |
| 216 | + <?php endif; ?> |
213 | 217 | </div> |
214 | 218 | </div> |
215 | 219 |
|
|
0 commit comments