<?php
$attributes = '';
if ($args['id']) {
    $attributes .= ' id="' . $args['id'] . '" ';
}

if ($args['name']) {
    $attributes .= ' name="' . $args['name'] . '" ';
}

if ($args['placeholder']) {
    $attributes .= ' placeholder="' . $args['placeholder'] . '" ';
}

if ($args['class']) {
    $attributes .= ' class="' . $args['class'] . '" ';
} else {
    $attributes .= ' class="regular-text" ';
}

if ($args['style']) {
    $attributes .= ' style="' . $args['style'] . '" ';
}
if ($args['required']) {
    $attributes .= ' required';
}

$attributes .= ' value="' . $args['value'] . '"';

if (isset($args['min'])) {
    $attributes .= ' min="' . $args['min'] . '"';
}
if ($args['max']) {
    $attributes .= ' max="' . $args['max'] . '"';
}

$conditional = salesloo_field_get_conditional_data($args);

?>
<div class="salesloo-field <?php echo $args['direction']; ?>" <?php echo implode(' ', $conditional); ?>>
    <div class="salesloo-field-label">
        <label><?php echo $args['label']; ?></label>
    </div>
    <div class="salesloo-field-input">
        <div class="salesloo-field__number">
            <?php echo $args['before']; ?>
            <input type="number" <?php echo $attributes; ?>>
            <?php echo $args['after']; ?>
        </div>
        <p class="description"><?php echo $args['description']; ?></p>
    </div>
</div>