<?php

declare(strict_types=1);

namespace prj\mockup\controllers\bills;

class notices_ctrl {
  public $page_output;  
    
  public function late_payment() {
    $view_as_pdf = true;
    $output = \prj\mockup\outputs\bills\notices_out::late_rent($view_as_pdf);
    
    $html = new \tts\html_document();
    
    $view = new \tts\view();
    if (! $view_as_pdf) {
      $view->set('html', $html);
      $view->set_template('main');
    }
    $view->set('view_as_pdf', $view_as_pdf);
    $view->set('template_assigns', $output);
    $view->set('font_url', TTS_PROJECT_BASE_REF . 'assets/fonts/JennaSue.ttf');
    if (! $view_as_pdf) {   
      $view->add_view('bills/notice_of_late_payment_css.php');
    }
    $view->add_view('bills/notice_of_late_payment_pdf.tpl');
    $html_code = $view->fetch($this);
    
    if (! $view_as_pdf) {
      echo $html_code; 
      exit;
    }
    
    // Makes PDF output
    \prj\mockup\outputs\bills\notices_out::gen_pdf_for_late_payment($html_code);
  }

}
