/* ------------------------------------------------------------------------------

*

*  # JS for post page

*

*  Specific JS code additions for ./post page

*

*  Version: 1.0

*  Latest update: April, 14 2016

*

* ---------------------------------------------------------------------------- */
$(function() {



    $('.export-pdf').on('click', function() {

        var doc = new jsPDF('p', 'pt', 'a4');

        // You can use html:

        doc.setFontSize(14);


        let bentuk_pendidikan = $('#detailpdb').data('tingkat');
        let text = "Profil Peserta Didik Baru "+bentuk_pendidikan+" Alazka Tahun Pelajaran 2019-2020";

        let xOffset = (doc.internal.pageSize.width / 2) - (doc.getStringUnitWidth(text) * doc.internal.getFontSize() / 2);

        doc.text(text, xOffset, 45);



        doc.autoTable({

            html: '#detailpdb',

            didParseCell: function(data) {

                if (data.row.index === 0 || data.row.index === 10 || data.row.index === 18 || data.row.index === 22 || data.row.index === 32) {

                    data.cell.styles.fillColor = [40, 170, 100];

                    data.cell.styles.textColor = 255;

                    data.cell.styles.fontStyle = 'bold';

                }

            },

            startY: 60

        });

        // doc.save(nama_pd+'.pdf');

        doc.output('dataurlnewwindow')

    })



    function headRows() {

        return [{
            info: 'Info',
            description: 'Deskripsi'
        }];

    }



});