|
Lines 21-44
Link Here
|
| 21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 22 |
|
22 |
|
| 23 |
use Modern::Perl; |
23 |
use Modern::Perl; |
| 24 |
use Koha::DateUtils qw( flatpickr_date_format ); |
|
|
| 25 |
|
| 26 |
my $builder = sub { |
24 |
my $builder = sub { |
| 27 |
my ( $params ) = @_; |
25 |
my ( $params ) = @_; |
| 28 |
my $function_name = $params->{id}; |
26 |
my $function_name = $params->{id}; |
| 29 |
|
27 |
|
| 30 |
my $dateformat = flatpickr_date_format(); |
|
|
| 31 |
|
| 32 |
my $res = <<END_OF_JS; |
28 |
my $res = <<END_OF_JS; |
| 33 |
<script> |
29 |
<script> |
| 34 |
/* from: cataloguing/value_builder/dateaccessioned.pl */ |
30 |
/* from: cataloguing/value_builder/dateaccessioned.pl */ |
| 35 |
|
31 |
|
| 36 |
\$(document).ready(function(){ |
32 |
\$(document).ready(function(){ |
| 37 |
\$("#$function_name").flatpickr({ |
33 |
\$("#$function_name").flatpickr({ |
| 38 |
altInput: true, |
34 |
onOpen: function(selectedDates, dateStr, instance) { |
| 39 |
altFormat: "$dateformat", |
35 |
if (dateStr == '') { |
| 40 |
altInputClass: "input_marceditor flatpickr-input", |
36 |
instance.setDate(new Date()); |
| 41 |
dateFormat: "Y-m-d" |
37 |
} |
|
|
38 |
} |
| 42 |
}); |
39 |
}); |
| 43 |
}); |
40 |
}); |
| 44 |
|
41 |
|
| 45 |
- |
|
|