[%- USE LxERP -%][%- USE HTML -%][%- USE L -%]
[%- BLOCK text_blocks %]
 [%- IF blocks.size %]
     
      [%- title %]:
      
       [%- FOREACH block = blocks %]
        - [%- HTML.escape(block.title) %]
 
       [%- END %]
      
     
 [%- END %]
[%- END %]
[%- IF !TEMPLATES.size %]
[%- LxERP.t8("No requirement spec templates have been created yet.") %]
[%- ELSE %]
 
  | [%- LxERP.t8("Detail view") %] | 
  [%- LxERP.t8("Paste template") %] | 
  [%- LxERP.t8("Title") %] | 
  [%- LxERP.t8("Type") %] | 
  [%- LxERP.t8("Last modification") %] | 
 
[%- FOREACH template = TEMPLATES %]
 
  | 
   
    [+]
    [-]
   
   | 
  [%- LxERP.t8("Paste template") %] | 
  [%- HTML.escape(template.title) %] | 
  [%- HTML.escape(template.type.description) %] | 
  [% template.mtime ? template.mtime.to_kivitendo(precision='minute') : template.itime.to_kivitendo(precision='minute') %] | 
 
 
  [% SET front    = template.text_blocks_sorted(output_position=0) %]
  [% SET sections = template.sections_sorted %]
  [% SET back     = template.text_blocks_sorted(output_position=1) %]
  
   [%- LxERP.t8("What this template contains") %]: 
   
    [% PROCESS text_blocks blocks=front title=LxERP.t8("#1 text block(s) front", front.size) %]
    [%- IF sections.size %]
    - [%- LxERP.t8("#1 section(s)", sections.size) %]:
     
      [%- FOREACH section = sections %]
       - [%- HTML.escape(section.fb_number) %]: [%- HTML.escape(section.title) %]
 
      [%- END %]
      
     
    [%- END %]
    [% PROCESS text_blocks blocks=back  title=LxERP.t8("#1 text block(s) back",  back.size)  %]
    
   | 
 
[%- END %]
[%- END %]
[%- LxERP.t8("Abort") %]