<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
use Bookly\Backend\Components\Controls\Buttons;
use Bookly\Backend\Components\Controls\Inputs;
use Bookly\Backend\Modules\Staff\Proxy;
/** @var Bookly\Lib\Entities\Staff $staff */
?>
<div class="panel">
    <div class="bookly-flexbox bookly-margin-bottom-md">
        <div class="bookly-flex-cell bookly-vertical-middle" style="width: 1%">
            <div id="bookly-js-staff-avatar" class="bookly-thumb bookly-thumb-lg bookly-margin-right-lg">
                <div class="bookly-flex-cell" style="width: 100%">
                    <div class="form-group">
                        <?php $img = wp_get_attachment_image_src( $staff->getAttachmentId(), 'thumbnail' ) ?>

                        <div class="bookly-js-image bookly-thumb bookly-thumb-lg bookly-margin-right-lg"
                            <?php echo $img ? 'style="background-image: url(' . $img[0] . '); background-size: cover;"' : '' ?>
                        >
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="bookly-flex-cell bookly-vertical-top"><h1 class="bookly-js-staff-name-<?php echo $staff->getId() ?>"><?php echo esc_html( $staff->getFullName() ) ?></h1></div>
    </div>

    <div id="bookly-details-container">
        <form class="bookly-js-staff-details">
            <div class="form-group">
                <label for="bookly-full-name"><?php _e( 'Full name', 'bookly' ) ?></label>
                <input type="text" class="form-control" id="bookly-full-name" name="full_name" value="<?php echo esc_attr( $staff->getFullName() ) ?>"/>
            </div>

            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label for="bookly-email"><?php _e( 'Email', 'bookly' ) ?></label>
                        <input class="form-control" id="bookly-email" name="email"
                               value="<?php echo esc_attr( $staff->getEmail() ) ?>"
                               type="text"/>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label for="bookly-phone"><?php _e( 'Phone', 'bookly' ) ?></label>
                        <input class="form-control" id="bookly-phone"
                               value="<?php echo esc_attr( $staff->getPhone() ) ?>"
                               type="text"/>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="bookly-info"><?php _e( 'Info', 'bookly' ) ?></label>
                <p class="help-block">
                    <?php _e( 'This text can be inserted into notifications to customers by Administrator.', 'bookly' ) ?>
                </p>
                <textarea id="bookly-info" name="info" rows="3" class="form-control"><?php echo esc_textarea( $staff->getInfo() ) ?></textarea>
            </div>
            <?php if ( ! in_array( 'visibility', $hide ) ) : ?>
                <div class="form-group">
                    <label for="bookly-visibility"><?php _e( 'Visibility', 'bookly' ) ?></label>
                    <p class="help-block">
                        <?php _e( 'If you want to become invisible to your customers set the visibility to "Private".', 'bookly' ) ?>
                    </p>
                    <select name="visibility" class="form-control" id="bookly-visibility">
                        <option value="public" <?php selected( $staff->getVisibility(), 'public' ) ?>><?php _e( 'Public', 'bookly' ) ?></option>
                        <option value="private" <?php selected( $staff->getVisibility(), 'private' ) ?>><?php _e( 'Private', 'bookly' ) ?></option>
                    </select>
                </div>
            <?php endif ?>
            <?php Proxy\Shared::renderStaffForm( $staff ) ?>

            <input type="hidden" name="id" value="<?php echo $staff->getId() ?>">
            <input type="hidden" name="staff_cabinet" value="1">
            <?php Inputs::renderCsrf() ?>

            <div class="panel-footer">
                <?php Buttons::renderSubmit( 'bookly-details-save' ) ?>
                <?php Buttons::renderReset() ?>
            </div>
        </form>
    </div>
</div>