feat(08-02): render additional work sections and Sonstiges in form

- Added render_additional_work_sections() method to loop through all sections
- Added render_additional_work_section() to render individual sections with correct field types
- Added render_sonstiges_field() for free text textarea
- Added get_field_key() helper to generate field keys from field names
- Field types: checkbox, abbau_aufbau (radio), checkbox_anzahl, text
- All fields use additional_work[section][key] naming pattern
- Added CSS styling for additional work sections and Sonstiges textarea

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 22:59:42 +09:00
parent 94958ae7bb
commit d0edef9c00
2 changed files with 172 additions and 0 deletions

View File

@@ -323,3 +323,39 @@
.umzugsliste-wrapper .captcha-widget {
margin-bottom: 1rem;
}
/* Additional Work Sections */
.umzugsliste-wrapper .additional-work-section {
margin-bottom: 1.25rem;
padding: 0 0.9375rem;
}
.umzugsliste-wrapper .additional-work-section .row {
margin-bottom: 0.5rem;
align-items: center;
}
.umzugsliste-wrapper .additional-work-section input[type="checkbox"] {
margin-right: 0.5rem;
}
.umzugsliste-wrapper .additional-work-section input[type="text"] {
margin-bottom: 0;
height: 2rem;
}
.umzugsliste-wrapper .additional-work-section label {
display: inline;
margin-bottom: 0;
}
/* Sonstiges */
.umzugsliste-wrapper .sonstiges-textarea {
width: 100%;
padding: 0.5rem;
border: 1px solid #ccc;
font-size: 0.875rem;
margin-bottom: 1rem;
resize: vertical;
min-height: 100px;
}

View File

@@ -32,6 +32,8 @@ class Umzugsliste_Form_Renderer {
self::render_date_selector();
self::render_customer_info();
self::render_all_rooms();
self::render_additional_work_sections();
self::render_sonstiges_field();
self::render_grand_totals();
self::render_submit_section();
?>
@@ -371,4 +373,138 @@ class Umzugsliste_Form_Renderer {
</div>
<?php
}
/**
* Render all additional work sections
*/
private static function render_additional_work_sections() {
$sections = Umzugsliste_Furniture_Data::get_additional_work();
foreach ( $sections as $section_key => $section_data ) {
self::render_additional_work_section( $section_key, $section_data );
}
}
/**
* Render single additional work section
*
* @param string $section_key Section key
* @param array $section_data Section data with label and fields
*/
private static function render_additional_work_section( $section_key, $section_data ) {
?>
<div class="row">
<div class="large-12 columns">
<div class="panel">
<h3><?php echo esc_html( $section_data['label'] ); ?></h3>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div class="additional-work-section" data-section="<?php echo esc_attr( $section_key ); ?>">
<?php
foreach ( $section_data['fields'] as $field ) {
$field_key = self::get_field_key( $field );
$field_name = 'additional_work[' . $section_key . '][' . $field_key . ']';
switch ( $field['type'] ) {
case 'checkbox':
?>
<div class="row">
<div class="small-9 columns">
<label><?php echo esc_html( $field['name'] ); ?></label>
</div>
<div class="small-3 columns">
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="ja">
</div>
</div>
<?php
break;
case 'abbau_aufbau':
?>
<div class="row">
<div class="small-4 columns">
<label><?php echo esc_html( $field['name'] ); ?></label>
</div>
<div class="small-8 columns">
<input type="radio" name="<?php echo esc_attr( $field_name ); ?>" value="Abbau" id="<?php echo esc_attr( $field_key . '_abbau' ); ?>"><label for="<?php echo esc_attr( $field_key . '_abbau' ); ?>">Abbau</label>
<input type="radio" name="<?php echo esc_attr( $field_name ); ?>" value="Aufbau" id="<?php echo esc_attr( $field_key . '_aufbau' ); ?>"><label for="<?php echo esc_attr( $field_key . '_aufbau' ); ?>">Aufbau</label>
<input type="radio" name="<?php echo esc_attr( $field_name ); ?>" value="Beides" id="<?php echo esc_attr( $field_key . '_beides' ); ?>"><label for="<?php echo esc_attr( $field_key . '_beides' ); ?>">Beides</label>
</div>
</div>
<?php
break;
case 'checkbox_anzahl':
?>
<div class="row">
<div class="small-1 columns">
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" value="ja">
</div>
<div class="small-8 columns">
<label><?php echo esc_html( $field['name'] ); ?></label>
</div>
<div class="small-3 columns">
<input type="text" name="<?php echo esc_attr( $field_name . '_anzahl' ); ?>" size="4" placeholder="Anz.">
</div>
</div>
<?php
break;
case 'text':
?>
<div class="row">
<div class="small-9 columns">
<label><?php echo esc_html( $field['name'] ); ?></label>
</div>
<div class="small-3 columns">
<input type="text" name="<?php echo esc_attr( $field_name ); ?>" size="6">
</div>
</div>
<?php
break;
}
}
?>
</div>
</div>
</div>
<?php
}
/**
* Render Sonstiges free text field
*/
private static function render_sonstiges_field() {
?>
<div class="row">
<div class="large-12 columns">
<div class="panel">
<h3>Sonstiges</h3>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<label for="sonstiges">Weitere Hinweise oder Wuensche:</label>
<textarea name="sonstiges" id="sonstiges" rows="5" class="sonstiges-textarea" placeholder="Weitere Hinweise oder Wuensche..."></textarea>
</div>
</div>
<?php
}
/**
* Get field key for form field name
*
* @param array $field Field data
* @return string Field key
*/
private static function get_field_key( $field ) {
if ( ! empty( $field['key'] ) ) {
return $field['key'];
}
return sanitize_title( $field['name'] );
}
}