zalsaeed / cgav

Certificate Generation and Verification
GNU General Public License v3.0
3 stars 1 forks source link

Load All Certificates button in certificates.html #9

Closed SalmanSaleh1 closed 7 months ago

SalmanSaleh1 commented 7 months ago

rectify the "load_all_certificates" route in the app.py file and adjust the corresponding JavaScript code in the certificates.html file. The objective is to ensure that when the user clicks the "Loud all certificates" button, all certificates are added with removing the three most recent certificates.

SalmanSaleh1 commented 7 months ago

These changes ensure that when the "Load All Certificates" button is clicked, the existing cards for the latest certificates are removed, and new cards for all certificates (excluding the latest ones) are added:

 # Fetch all certificates from the database excluding the latest ones
    latest_certificates_count = 3
    all_certificates = db_classes.addCertificate.query.offset(latest_certificates_count).all()

      loadAllCertificatesBtn.addEventListener('click', function () {
        // Remove existing cards for the latest certificates
        const latestCertificates = document.querySelectorAll('.latest-certificate');
        latestCertificates.forEach(card => card.remove());