<div id="generatePdfModal" class="modal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <form id="generatePdfModalForm" action="<?php echo URL_APP; ?>/selections/src/generate-pdf.php" method="POST" name="generatePdfModalForm">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 id="generatePdfModalTitle" class="modal-title">Finish Schedule</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body" id="generatePdfModalBody">
                    <h6>Options</h6>
                    <div class="row">
                        <div class="col-12 col-md-6">
                            <input id="optionShowGroupDescription" class="form-check-input" type="checkbox" name="optionShowGroupDescription" value="group['description']" checked>
                            <label class="form-check-label" for="optionShowGroupDescription">
                                <span class="small">Show Group Description</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemImage" class="form-check-input" type="checkbox" name="optionShowItemImage" value="image" checked>
                            <label class="form-check-label" for="optionShowItemImage">
                                <span class="small">Show Item Image</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemVendor" class="form-check-input" type="checkbox" name="optionShowItemVendor" value="vendor" checked>
                            <label class="form-check-label" for="optionShowItemVendor">
                                <span class="small">Show Item Vendor</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemDescription" class="form-check-input" type="checkbox" name="optionShowItemDescription" value="description" checked>
                            <label class="form-check-label" for="optionShowItemDescription">
                                <span class="small">Show Item Description</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemQuantity" class="form-check-input" type="checkbox" name="optionShowItemQuantity" value="quantity" checked>
                            <label class="form-check-label" for="optionShowItemQuantity">
                                <span class="small">Show Item Quantity</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemCostPer" class="form-check-input" type="checkbox" name="optionShowItemCostPer" value="cost" checked>
                            <label class="form-check-label" for="optionShowItemCostPer">
                                <span class="small">Show Item Cost Per Unit</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemUnit" class="form-check-input" type="checkbox" name="optionShowItemUnit" value="unit" checked>
                            <label class="form-check-label" for="optionShowItemUnit">
                                <span class="small">Show Item Unit</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowItemTotalCost" class="form-check-input" type="checkbox" name="optionShowItemTotalCost" value="totalCost" checked>
                            <label class="form-check-label" for="optionShowItemTotalCost">
                                <span class="small">Show Item Total Cost</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowGroupTotalCost" class="form-check-input" type="checkbox" name="optionShowGroupTotalCost" value="groupTotalCost" checked>
                            <label class="form-check-label" for="optionShowGroupTotalCost">
                                <span class="small">Show Group Total Cost</span>
                            </label>
                        </div>
                        <div class="col-12 col-md-6">
                            <input id="optionShowCoverPage" class="form-check-input" type="checkbox" name="optionShowCoverPage" value="coverPage" checked>
                            <label class="form-check-label" for="optionShowCoverPage">
                                <span class="small">Show Cover Page</span>
                            </label>
                        </div>
                    </div>

                    <hr>

                    <h6>Select Group(s)</h6>
                    <div class="row">
                        <?php 
                            $i = 0;
                            foreach ( $groups as $group ) :
                                $checked = ( count($group['selections']) > 0 )
                                    ? 'checked'
                                    : ''
                                ;
                        ?>
                                <div class="col-12 col-md-6 text-nowrap overflow-hidden">
                                    <input id="groupCheck-<?php echo $group['id']; ?>" class="form-check-input groupCheck" type="checkbox" name="groupCheck[<?php echo $group['id']; ?>]" value="<?php echo $group['id']; ?>" <?php echo $checked; ?>>
                                    <label class="form-check-label" for="groupCheck-<?php echo $group['id']; ?>">
                                        <div class="small"><?php echo htmlspecialchars($group['title']); ?></div>
                                    </label>
                                </div>
                        <?php
                                $i++;
                            endforeach;
                        ?>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                    <button id="generatePdfButton" type="submit" class="btn btn-danger">Go</button>
                </div>
            </div>
            <input type="hidden" name="projectId" value="<?php echo $pid; ?>">
        </form>
    </div>
</div>  