<div id="pickup-rate-wrap">
    <div class="one-fourth first">
        <div class="section-content">
            <h3><?php esc_html_e('Rate Form', 'wpcargo-shipment-rate' ); ?></h3>
            <form id="pickup-rate-form" action="">
                <table class="form-table wpcsr_add_table">
					<tr>
                        <th><label for="name"><?php esc_html_e('Pickup Name', 'wpcargo-shipment-rate' ); ?>:</label></th>
                        <td><input type="text" id="name" name="name" value="" placeholder="<?php esc_html_e('Pickup Name', 'wpcargo-shipment-rate' ); ?>" required="required"></td>
                    </tr>
                    <tr>
                        <th><label for="warehouse"><?php esc_html_e('Warehouse', 'wpcargo-shipment-rate' ); ?>:</label></th>
                        <td>
                            <select id="warehouse" name="warehouse" required="required">
                                <option value=""><?php esc_html_e('Select Warehouse', 'wpcargo-shipment-rate' ); ?></option>
                                <?php
                                    foreach ( $warehouses as $warehouse ) {
                                        ?><option value="<?php echo  $warehouse['name']; ?>"><?php echo  $warehouse['name']; ?></option><?php
                                    }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th><label for="pickup_zone"><?php esc_html_e('Pickup Zone', 'wpcargo-shipment-rate' ); ?>:</label></th>
                        <td>
                            <select id="pickup_zone" name="pickup_zone" required="required">
                                <option value=""><?php esc_html_e('Select pickup zone', 'wpcargo-shipment-rate' ); ?></option>
                                <?php
                                    foreach ( $locations as $location ) {
                                        ?><option value="<?php echo  $location->location; ?>"><?php echo  $location->location; ?></option><?php
                                    }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th><label ><?php esc_html_e('Weight Range', 'wpcargo-shipment-rate' ); ?>:</label></th>
                        <td>
                            <input type="text" id="min_weight" class="number" name="min_weight" value="" placeholder="<?php esc_html_e('Min. Weight', 'wpcargo-shipment-rate' ); ?>" required="required"> - <input type="text" id="max_weight" class="number" name="max_weight" value="" placeholder="<?php esc_html_e('Max. Weight', 'wpcargo-shipment-rate' ); ?>" required="required">
                        </td>
                    </tr>
                    <tr>
                        <th><label for="price" ><?php esc_html_e('Price', 'wpcargo-shipment-rate' ); ?>:</label></th>
                        <td>
                            <input type="text" id="price" class="number" name="price" value="" placeholder="<?php esc_html_e('Price', 'wpcargo-shipment-rate' ); ?>" required="required">
                        </td>
                    </tr>
                    <tr>
                        <th>&nbsp;</th>
                        <td> <input type="submit" class="button button-primary button-large" name="submit-pickup-rate" value="<?php esc_html_e('Save Rate', 'wpcargo-shipment-rate' ); ?>"></td>
                    </tr>
                </table>               
            </form>
        </div>
    </div>
    <div class="three-fourths">
        <div class="section-content">
            <h3><?php esc_html_e('Rates List', 'wpcargo-shipment-rate' ); ?></h3>
            <?php wpcsr_pagination( $pagelink, $page_count, $page ); ?>
            <a href="#" data-section="pickup-rate" class="wpcsrate-bulk-delete delete-btn button button-medium"><?php esc_html_e('Bulk Delete', 'wpcargo-shipment-rate' ); ?></a>
            <table class="wpcsr-table list-table">
                <tr>
                    <th class="tbl-head bulk-action"><input id="checkall" type="checkbox"></th>
                    <th ><?php esc_html_e('Name', 'wpcargo-shipment-rate' ); ?></th>
                    <th ><?php esc_html_e('Warehouse', 'wpcargo-shipment-rate' ); ?></th>
                    <th ><?php esc_html_e('Pickup Zone', 'wpcargo-shipment-rate' ); ?></th>
                    <th ><?php esc_html_e('Weight Range', 'wpcargo-shipment-rate' ); ?></th>
                    <th ><?php esc_html_e('Price', 'wpcargo-shipment-rate' ); ?></th>
                    <th ><?php esc_html_e('Actions', 'wpcargo-shipment-rate' ); ?></th>
                </tr> 
                <?php if( !empty( $pickup_rates ) ): foreach( $pickup_rates as $rate ):  ?>   
                <tr class="tbl-data">
                    <td><input type="checkbox" class="bulk_id" name="rate_bulk_action[]" value="<?php echo $rate->id;?>"></td>
                    <td><?php echo $rate->name; ?></td>
                    <td><?php echo $rate->warehouse; ?></td>
                    <td><?php echo $rate->zone; ?></td>
                    <td><?php echo $rate->min_weight.' - '.$rate->max_weight; ?></td>
                    <td><?php echo $rate->price; ?></td>
                    <td>
                        <span class="dashicons dashicons-edit edit-pickup-rate" data-section="pickup-rate" data-id="<?php echo $rate->id;?>"></span>
						<span class="dashicons dashicons-trash wpcsr-delete" data-section="pickup-rate" data-id="<?php echo $rate->id;?>"></span>
                    </td>
                </tr>
                <?php endforeach; else: ?>
                <tr><td colspan="7"><?php esc_html_e('No rates found!', 'wpcargo-shipment-rate' ); ?></td></tr> 
                <?php endif; ?>                    
            </table>
            <a href="#" data-section="pickup-rate" class="wpcsrate-bulk-delete delete-btn button button-medium"><?php esc_html_e('Bulk Delete', 'wpcargo-shipment-rate' ); ?></a>
            <?php wpcsr_pagination( $pagelink, $page_count, $page ); ?>
        </div>
    </div>
</div>
<div id="wpcsr-pickup-rate-edit" class="modal">
    <div class="modal-content">
        <div class="modal-title">
            <p><?php esc_html_e('Update Pickup Rate', 'wpcargo-shipment-rate' ); ?>
            <span class="close-btn">&times;</span></p>
        </div>
        <div class="modal-body">
            <form id="update-pickup-rate" class="wpcsr-form">
            </form>
        </div>
    </div>
</div>