@props([ // determines what type of datepicker to show. Available options: single, range 'type' => 'single', // name of the datepicker. This name is used when posting the form with the datepicker 'name' => 'bw-datepicker', // default date to fill in to the datepicker. Defaults to today. Set to blank to display no default 'default_date' => '', 'defaultDate' => '', // date format.. default is yyyy-mm-dd // accepted formats are yyyy-mm-dd, mm-dd-yyyy, dd-mm-yyyy, D d M, Y 'format' => config('bladewind.datepicker.format', 'yyyy-mm-dd'), // text to display in the label that identifies the input field 'label' => '', // placeholder text to display if datepicker is empty 'placeholder' => 'Select a date', // is the value of the date field required? used for form validation. default is false 'required' => false, //----------- used for range datepickers ---------------------------------- // what should be the default date for the from date 'default_date_from' => '', 'defaultDateFrom' => '', // what should be the default date for the to date 'default_date_to' => '', 'defaultDateTo' => '', // what label should be displayed for the from date. Default is 'From' 'date_from_label' => 'From', 'dateFromLabel' => 'From', // what label should be displayed for the to date. Default is 'To' 'date_to_label' => 'To', 'dateToLabel' => 'To', // what names should be used for the from date. Default is 'start_date' 'date_from_name' => 'start_date', 'dateFromName' => 'start_date', // what name should be displayed for the to date. Default is 'end_date' 'date_to_name' => 'end_date', 'dateToName' => 'end_date', // should validation be turned on for the range picker 'validate' => false, // should the error message be displayed inline instead of in the notification component // ensure you have the <-bladewind::notification /> component in your page if you do not // want to display the error inline 'show_error_inline' => false, // validation message to display if there is an error with the range picker selection 'validation_message' => 'Your end date cannot be less than your start date', // custom function to call when the datepicker loses focus 'onblur' => '', 'tabindex' => -1, // first day of the week 'week_starts' => 'sunday', // any extra classes for the datepicker 'class' => '', // should the datepicker use a placeholder instead of the labels when type="range" 'use_placeholder' => false, // show the range pickers be stacked vertically 'stacked' => false, // size of the input field 'size' => 'medium', 'min_date' => '', 'max_date' => '', ]) @php // reset variables for Laravel 8 support $default_date = $defaultDate; $default_date_from = $defaultDateFrom; $default_date_to = $defaultDateTo; $date_from_label = $dateFromLabel; $date_to_label = $dateToLabel; $date_from_name = $dateFromName; $date_to_name = $dateToName; $required = parseBladewindVariable($required); $validate = parseBladewindVariable($validate); $show_error_inline = parseBladewindVariable($show_error_inline); $use_placeholder = parseBladewindVariable($use_placeholder); $stacked = parseBladewindVariable($stacked); //-------------------------------------------------------- $name = preg_replace('/[\s-]/', '_', $name); $default_date = ($default_date != '') ? $default_date : ''; $js_function = ($validate) ? "compareDates('$date_from_name', '$date_to_name', '$validation_message', '$show_error_inline')" : $onblur; $week_starts = str_replace('day', '', ((in_array($week_starts, ['sun','sunday','mon','monday'])) ? $week_starts : 'sunday')); @endphp @if($type == 'single')
@else
@endif @once @endonce