<script>
    $(function () {

        $('a.area-schedule-delete').click(function (ev) {
            $('#attr-area-schedule-id-delete').val($(this).data('id'));
            $("#attr-area-schedule-begin input, #attr-area-schedule-end input").prop('required', false);
            $("#attr-area-schedule-day").prop('required', false);
        });

        $('a.area-schedule-update-default').click(function (ev) {
            $("#attr-area-schedule-id-update").val($(this).data('id'));
            $("#attr-area-schedule-id").val($(this).data('id'));
            $("#attr-area-schedule-begin input", "#area-schedule-update").val($(this).data('begin'));
            $("#attr-area-schedule-end input", "#area-schedule-update").val($(this).data('end'));
            $('#attr-area-schedule-day option[value="' + $(this).data('day') + '"]', '#area-schedule-update').prop('selected', true);
            $("#attr-area-schedule-day").prop('required', true);
        });

        $('a.area-schedule-add').click(function (ev) {
            $("#attr-area-schedule-begin input, #attr-area-schedule-end input").prop('required', true);
            $("#attr-area-schedule-day").prop('required', true);
        });


        {$langcode = {lang attr="code"}|substr:0:2}
        $(document).ready(function () {
            $('.input-group.time').datetimepicker({
                locale: "{$langcode}",
                format: 'HH:mm',
                stepping: 15
            });
        });
        $(document).ready(function () {
            $('.input-group.date').datetimepicker({
                locale: "{$langcode}",
                format: 'YYYY-MM-DD'
            });
        });
    });
</script>
