add-building-level-account.component.ts 2.58 KB
import { Component, AfterViewInit, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { ApplicationService } from '../services/application.service';

declare var jQuery: any;

//const jqueryJs = './scripts/jquery-1.11.3.min.js';
//const bootstrapJs = './scripts/bootstrap.js';
//const dateTimePickerJs = './scripts/bootstrap-datetimepicker.min.js';
//const sortableTableJs = 'https://meetselva.github.io/fixed-table-rows-cols/js/sortable_table.js';
//const fixedTableRCJS = './scripts/fixed_table_rc.js';

@Component({
    templateUrl: './app/components/add-building-level-account.component.html'
})
export class AddBuildingLevelAccountComponent implements AfterViewInit, OnInit {


    constructor(private application: ApplicationService, private router: Router) {

    }

    ngAfterViewInit(): void {
        this.initializeUIElements();

        //this.loadScript(jqueryJs);
        //this.loadScript(bootstrapJs);
        //this.loadScript(dateTimePickerJs);
        //this.loadScript(sortableTableJs);
        //this.loadScript(fixedTableRCJS);

        jQuery(function () {
            jQuery('#datetimepicker1, #datetimepicker2').datetimepicker({
                //language: 'pt-BR'
            });
        });

        jQuery(function () {
            jQuery('#fixed_hdr2').fxdHdrCol({
                fixedCols: 0,
                width: "100%",
                height: 330,
                colModal: [
                    { width: 200, align: 'center' },
                    { width: 200, align: 'center' },
                    { width: 200, align: 'Center' },
                    { width: 200, align: 'Center' },
                    { width: 250, align: 'Center' },
                    { width: 200, align: 'Center' },
                    { width: 200, align: 'Center' },
                    { width: 200, align: 'Center' },
                    { width: 200, align: 'Center' },
                ],
                sort: true
            });
        });
    }

    initializeUIElements(): void {



    }

    ngOnInit(): void {
        /*if (this.application.currentUser == null) {
            this.router.navigate(['/login']);
        }*/
    }

    showAlert(id: string): void {
        jQuery('#' + id).modal('show');
    }

    public loadScript(url: string) {
        console.log('preparing to load...')
        let node = document.createElement('script');
        node.src = url;
        node.type = 'text/javascript';
        node.async = true;
        node.charset = 'utf-8';
        document.getElementsByTagName('head')[0].appendChild(node);
    }
}