qualityfolio/bug-list.sql

              SELECT 'dynamic' AS component, sqlpage.run_sql('shell/shell.sql') AS properties;
              -- not including breadcrumbs from sqlpage_aide_navigation
              -- not including page title from sqlpage_aide_navigation
              

              SELECT 'html' as component,
'<style>
    
    tr td.Statealign-middle {
        color: blue !important; /* Default to blue */
    }
    tr.rowClass-Completed td.state {
        color: green !important; /* Default to blue */
    }
     tr.rowClass-Rejected td.state {
        color: red !important; /* Default to blue */
    }
     tr.rowClass-Completed td.Statealign-middle {
        color: green !important; /* Default to blue */
    }
     tr.rowClass-Rejected td.Statealign-middle {
        color: red !important; /* Default to blue */
    }

}
</style>' as html;
 select
'breadcrumb' as component;
select
'Home' as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/' as link;
select
'Test Management System' as title,
  sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/index.sql' as link; 
select 'Bug List' as title;  

SET total_rows = (SELECT COUNT(*) FROM bug_report WHERE ($status IS NULL OR status = $status));
SET limit = COALESCE($limit, 50);
SET offset = COALESCE($offset, 0);
SET total_pages = ($total_rows + $limit - 1) / $limit;
SET current_page = ($offset / $limit) + 1;

 SELECT 'table' as component,
  TRUE AS sort,
    TRUE AS search,
      'URL' AS align_left,
        'title' AS align_left,
          'group' as markdown,
          'id' as markdown,
          "status_new" as markdown,
          'count' as markdown;
SELECT
'[' || id || '](' || sqlpage.environment_variable('SQLPAGE_SITE_PREFIX') || '/qualityfolio/bug-detail.sql?id='|| id || ')' as id,
  title,
  strftime('%d-%m-%Y', created_at) as "Created At",
  assigned,
  status as "State",
  'rowClass-'||status as _sqlpage_css_class
 FROM bug_report t WHERE ($status IS NULL OR lower(status) = $status) LIMIT $limit OFFSET $offset;

SELECT 'text' AS component,
    (SELECT CASE WHEN CAST($current_page AS INTEGER) > 1 THEN '[Previous](?limit=' || $limit || '&offset=' || ($offset - $limit) || COALESCE('&status=' || replace($status, ' ', '%20'), '') || ')' ELSE '' END)
    || ' '
    || '(Page ' || $current_page || ' of ' || $total_pages || ") "
    || (SELECT CASE WHEN CAST($current_page AS INTEGER) < CAST($total_pages AS INTEGER) THEN '[Next](?limit=' || $limit || '&offset=' || ($offset + $limit) || COALESCE('&status=' || replace($status, ' ', '%20'), '') || ')' ELSE '' END)
    AS contents_md
;
        ;
            

;