<?php $__env->startSection('footer_js'); ?>

    <script type="text/javascript">
        $(document).ready(function () {
            $('#sidebar li').removeClass('active');
            $('#sidebar a').removeClass('active');
            $('#sidebar').find('#config').addClass('active');
            $('#sidebar').find('#address').addClass('active');

            $('.date-picker').datepicker({format: 'yyyy-mm-dd'});

            $('.delete-attachment').click(function (e) {
                e.preventDefault();
                $object = $(this);
                var id = $object.attr('id');
                swal({
                    title: 'Are you sure?',
                    text: "You are going to remove the attachment!",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes, remove it!'
                }).then(function () {
                    $.ajax({
                        type: "PUT",
                        url: "<?php echo e(url('/admin/content/page/remove/attachment/')); ?>",
                        data: {id: id},
                        dataType: 'json',
                        success: function (response) {
                            $object.parent('span').hide();
                            $('.fileupload-new img').attr('src', "<?php echo e(asset('uploads/noimage.jpg')); ?>");
                            swal("Deleted!", response.message, "success");
                        },
                        error: function (e) {
                            swal('Oops...', 'Something went wrong!', 'error');
                        }
                    });
                });
            });

            $('#pageEditForm').formValidation({
                framework: 'bootstrap',
                excluded: ':disabled',
                icon: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    address: {
                        validators: {
                            notEmpty: {
                                message: 'This field is required.'
                            }
                        }
                    }
                }
            }).on('blur', '[name="address"]', function (e) {
                $('#pageEditForm').formValidation('revalidateField', 'address');
            })
        });
    </script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('dynamicdata'); ?>

    <div class="row">
        <div class="col-md-12">

            <div data-collapsed="0" class="panel">
                <header class="panel-heading">
                    Edit Address
                </header>

                <div class="panel-body">

                    <?php echo $__env->make('layout.backend.alert', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                    <form id="pageEditForm" action="<?php echo e(route('admin.config.address.update', $address->id)); ?>" method="post">

                        <div class="form-group col-md-6 col-xs-11">
                            <label for="moduleSlug">Address *</label>
                             <textarea class="form-control" name="address" rows="3" placeholder="Enter Address"><?php echo e($address->address); ?></textarea>
                        </div>
                        <div class="form-group col-md-6 col-xs-11">
                            <label for="moduleSlug">Phone </label>
                            <input type="text" name="phone" value="<?php echo e($address->phone); ?>"
                                   class="form-control phone" placeholder="Enter Phone"/>
                        </div>
                        <div class="clearfix"></div>

                        <div class="form-group col-md-6 col-xs-11">
                            <label for="moduleSlug">Email </label>
                            <input type="email" name="email" value="<?php echo e($address->email); ?>"
                                   class="form-control email" placeholder="Enter Email"/>
                        </div>
                        <div class="form-group col-md-6 col-xs-11">
                            <label for="moduleSlug">PO Box # </label>
                            <input type="text" name="po_box" value="<?php echo e($address->po_box); ?>"
                                   class="form-control po_box" placeholder="Enter PO Box No."/>
                        </div>
                        <div class="clearfix"></div>
                        
                        <div class="form-group col-md-6 col-xs-11">
                            <label for="">Status</label>
                            <select name="is_active" class="form-control">
                                <option value="0" <?php echo ($address->is_active == '0')? 'selected="selected"' : ''; ?> >
                                    Unpublished
                                </option>
                                <option value="1" <?php echo ($address->is_active == '1' || $address->is_active == '')? 'selected="selected"' : ''; ?> >
                                    Published
                                </option>
                            </select>
                        </div>

                        <div class="clearfix"></div>

                        <?php echo csrf_field(); ?>

                        <button type="submit" class="btn btn-info">Submit</button>
                        <input type="hidden" name="_method" value="PUT"/>
                    </form>

                </div>

            </div>

        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.backend.containerform', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>