<!-- Parish modal -->
<div class="modal fade" id="modal-parish">
    <div class="modal-dialog">
        <div class="modal-content">
        <div class="modal-header">
            <h4 class="modal-title">Manage Parish</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            <div id="parish-ajax-result"></div>
        <form action="#" id="form-parish">
            
            <input type="hidden" value="" name="parish_id"/>
            <div class="mb-3">
                <label class="form-label">Name</label>
                <input class="form-control form-control-lg" type="text" name="parish_name"  required />
            </div>
            <div class="mb-3">
                <label class="form-label">District</label>
                <select class="form-control select2" data-placeholder="Select a district" id="district-select" name="district_id" >
                <option value="">Select District</option>
                <?php if($districts): ?>
                    <?php foreach($districts as $district): ?>
                    <option value="<?= $district['district_id'] ?>"><?= $district['district_name'] ?></option>
                    <?php endforeach; ?>
                    
                    <?php endif; ?>
                </select>
            </div>

            <div class="mb-3">
                <label class="form-label">County</label>
                <select class="form-control select2" data-placeholder="Select a county" id="county-select" name="county_id" required>
                    <option value="">Select County</option>
                </select>
            </div>

            <div class="mb-3">
                <label class="form-label">Sub-County</label>
                <select class="form-control select2" data-placeholder="Select a subcounty" id="subcounty-select" name="subcounty_id" required>
                    <option value="">Select SubCounty</option>
                </select>
            </div>
        </form>
        </div>
        <div class="modal-footer justify-content-between">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary" onclick="save_parish()">Save</button>
        </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /Parish modal -->