// Module pour la vue des notes

import {notes} from './notes.js';

export function vue(model) {
    const body = document.body;
    body.innerHTML = "";

    for (let i = 0; i < model.data.length; i++ ) {
        const n = document.createElement( "div" );
        n.textContent = model.data[ i ];
        body.appendChild( n );

        const supp = document.createElement( "button" );
        supp.textContent = "Supprimer";
        supp.addEventListener( "click", function() {
            notes.supprimerItem( i );
        } );
        body.appendChild( supp );
    }

    const ajout = document.createElement( "button" );
    ajout.textContent = "[+]";
    ajout.addEventListener( "click", function() {
        notes.ajouterItem();
    } );
     
    body.appendChild( ajout );

};
    
