Skip to content

Commit 8aada2e

Browse files
authored
Merge pull request #24 from takielias/10.x-dev
Fix Datepicker
2 parents 3d5bfcb + 8621b8e commit 8aada2e

File tree

2 files changed

+25
-34
lines changed

2 files changed

+25
-34
lines changed

resources/views/components/forms/inputs/flat-picker.blade.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@
66
@if($value) value="{{ $value }}" @endif
77
{{ $attributes->merge(['class' => config('tablar-kit.default-class'). ' flatpickr']) }}
88
/>
9-
10-
@once
11-
@push('js')
12-
<script type="module">
13-
document.addEventListener('DOMContentLoaded', function () {
14-
window.flatpickr(".flatpickr");
15-
});
16-
</script>
17-
@endpush
18-
@push('css')
19-
<style>
20-
21-
</style>
22-
@endpush
23-
@endonce
9+
@push('js')
10+
<script type="module">
11+
document.addEventListener('DOMContentLoaded', function () {
12+
window.flatpickr("#{{$id}}", {!! $jsonOptions() !!})
13+
});
14+
</script>
15+
@endpush

resources/views/components/forms/inputs/lite-picker.blade.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,23 @@
77
{{ $attributes->merge(['class' => config('tablar-kit.default-class'). ' litepickr']) }}
88
/>
99

10-
@once
11-
@push('js')
12-
<script type="module">
13-
document.addEventListener('DOMContentLoaded', () => {
14-
const optional_config = {};
15-
if (window.Litepicker) {
16-
new Litepicker({
17-
element: document.getElementById('{{ $id }}'),
18-
buttonText: {
19-
previousMonth: `<!-- Download SVG icon from http://tabler-icons.io/i/chevron-left -->
10+
@push('js')
11+
<script type="module">
12+
document.addEventListener('DOMContentLoaded', () => {
13+
const optional_config = {!! $jsonOptions() !!};
14+
if (window.Litepicker) {
15+
const default_config = {
16+
element: document.getElementById('{{ $id }}'),
17+
buttonText: {
18+
previousMonth: `<!-- Download SVG icon from http://tabler-icons.io/i/chevron-left -->
2019
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 6l-6 6l6 6" /></svg>`,
21-
nextMonth: `<!-- Download SVG icon from http://tabler-icons.io/i/chevron-right -->
20+
nextMonth: `<!-- Download SVG icon from http://tabler-icons.io/i/chevron-right -->
2221
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l6 6l-6 6" /></svg>`,
23-
},
24-
});
25-
}
26-
});
27-
</script>
28-
29-
@endpush
30-
@endonce
22+
},
23+
};
24+
const config = Object.assign({}, default_config, optional_config);
25+
new Litepicker(config);
26+
}
27+
});
28+
</script>
29+
@endpush

0 commit comments

Comments
 (0)