This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnapp/views/field/date.php

38 lines
1.2 KiB
PHP
Raw Normal View History

<!-- field = field_name -->
<!-- text = field_text -->
<!-- value = value -->
<!-- enddate = js value -->
<div class="form-group">
<label for="<?php echo $data['field']; ?>_label" class="col-md-2 control-label"><?php echo $data['text']; ?></label>
<div class="input-group col-md-2">
<input type="text" id="<?php echo $data['field']; ?>_label" value="<?php echo Site::date($data['value']); ?>" class="form-control" placeholder="<?php echo $data['text']; ?>">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
<input type="hidden" name="<?php echo $data['field']; ?>" value="<?php echo $data['value']; ?>">
</div>
<?php
Script::factory()
->type('file')
->data('media/theme/bootstrap/js/bootstrap.datepicker.js');
Style::factory()
->type('file')
->data('media/theme/bootstrap/css/bootstrap.datepicker.css');
Script::factory()
->type('stdin')
->data('
$(document).ready(function() {
$("#'.$data['field'].'_label").datepicker({
autoclose : true,
'.($data['enddate'] ? 'endDate : '.$data['enddate'].',' : '').'
todayHighlight: true,
format : "dd-M-yyyy",
todayBtn : true,
}).on("hide",function(ev) {
$("input[name='.$data['field'].']").val(ev.date.valueOf()/1000);
});
});');
?>