
<?= $this->element('page_top', array('title' => __('Reply Feedback'), 'permissions' => $user_permission)); ?>
    <div class="box box-primary">
        <!-- /.box-header -->
        <div class="box-body">
            <div class="row">
                <div class="col-md-6">
                    <?= $this->Form->create($feedback, ['id' => 'reply_form', 'class'=> 'input-form-section']) ?>
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th> <span><?= __('Name') ?></span> </th>
                            <th> <?= h($feedback->name)?> </th>

                        </tr>
                        <tr>
                            <th> <span><?= __('Email') ?></span> </th>
                            <th> <?= h($feedback->email)?> </th>

                        </tr>

                        <tr>
                            <th> <span><?= __('Phone Number') ?></span></th>
                            <th>   <span><?= h($feedback->phone_number)?></span></th>
                        </tr>
                        <tr>
                            <th> <span><?= __('Subject') ?></span></th>
                            <th>   <span><?= h($feedback->subject )?></span></th>
                        </tr>
                        <tr>
                            <th> <span><?= __('Inquiry Date') ?></span></th>
                            <th>   <span><?= h($feedback->inquiry_date )?></span></th>
                        </tr>
                        <tr>
                            <th> <span><?= __('Message') ?></span></th>
                            <th>   <span><?= h($feedback->message )?></span></th>
                        </tr>

                            <tr>

                                <th colspan="2">
                                    <label for="response_text" class="control-label">Response<span
                                                class="text-danger">*</span></label>
                                    <div class="form-group">
                                        <input required type="text" name="response_text" id="response_text"
                                               class="form-control" placeholder="Response Text" value="<?= $feedback->response_text ?>">

                                    </div>
                                </th>
                            </tr>

                        <tr>
                            <th> <span><?= __('Status') ?></span></th>
                            <th>
                                <select required name="status" id="status" class="form-control">
                                    <option selected="" disabled="" value="">Select Status</option>
                                    <?php foreach (json_decode(FEED_BACK_STATUS) as $key => $value): ?>
                                        <option value="<?= h($key) ?>" <?= $feedback->status == $key ? 'selected' : '' ?>><?= h($value) ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </th>
                        </tr>
                        </thead>

                    </table>
                </div>

            </div>
            <!-- /.row -->
        </div>
        <!-- /.box-body -->
        <div class="box-footer">
            <?= $this->Form->button(__('Submit'), ['class' => 'btn btn-primary pull-left']) ?>
            <a href="<?php echo $this->Url->build('/feed-back'); ?>"  class="btn btn-default tab3Save pull-left btn-grid btn-flat btn-orange-color" id="default-btn">
                <?php echo __('Back'); ?>
            </a>
        </div>
        <?= $this->Form->end() ?>
    </div>


<style type="text/css">

    .error-message {
        color: #ff0000;
    }


</style>

<script>

    $('#reply_form').validate({
        rules:{
            'response_text':'required',
            'status': 'required'
        },
        messages: {
            'response_text':{
                required: "Please enter response"
            },
            'status':{
                required: "Please select status"
            }

        },
        highlight: function(element) {
            $(element).parent().addClass("has-error");
        },
        submitHandler: function(form) {
            form.submit();
        }
    });

</script>


