$(
    function() {
        $('.date-picker').datepicker({
            orientation: 'left bottom',
            autoclose: !0,
            minViewMode: "days",
            maxViewMode: "days",
            language: "zh-TW",
            startDate: $("#install_date").data("dateStart"),
            endDate: $("#install_date").data("dateEnd"),
            datesDisabled: $("#install_date").data("dateBlocked").split("|"),
            templates: {
                leftArrow: '<i class="fa fa-chevron-left"></i>',
                rightArrow: '<i class="fa  fa-chevron-right"></i>'
            }
        });




        $('#selectNewNum').hide();
        $('#scenario').hide();
        $('#oldUser').hide();
        $('#prepaid').hide();

        $('#mobilenum').change(function() {
            if (this.options[this.selectedIndex].value == 'opt3') {
                $('#selectNewNum').show();
                $('#oldUser').hide();
                $('#prepaid').hide();
            } else if (this.options[this.selectedIndex].value == 'opt1') {
                $('#oldUser').show();
                $('#selectNewNum').hide();
                $('#prepaid').hide();
            } else if (this.options[this.selectedIndex].value == 'opt2') {
                $('#selectNewNum').hide();
                $('#oldUser').hide();
                $('#prepaid').show();
            } else if (this.options[this.selectedIndex].value == 'opt4') {
                $('#selectNewNum').hide();
                $('#oldUser').hide();
                $('#prepaid').hide();
            }
        });



        $('#selectUser').change(function() {
            if (this.options[this.selectedIndex].value == 'opt1') {
                $('#scenario').show();
                $('#lastnt').val("name1");
                $('#namet').val("name1");
            } else if (this.options[this.selectedIndex].value == 'opt2') {
                $('#scenario').show();
                $('#lastnt').val("");
                $('#namet').val("");
            }
        });


        $('.checklist input').iCheck({
            checkboxClass: 'icheckbox_square-orange',
            increaseArea: '20%'
        });

        $('#customerform').validate({
            rules: {

                'checkboxes[]': {
                    required: true,
                    minlength: 1
                }
            },
            messages: {

                'checkboxes[]': "請點選客戶聲明",

            },
            highlight: function(label) {
                $(label).closest('#checkbox').css("padding-bottom", 15);
            },
            success: function(label) {
                $(label).closest('#checkbox').css("padding-bottom", 0);
            }


        });

    }
)
