#
#		ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:		dquermfile_showChildCallCat.txt
#	DESCRIPTION:	DQUERY definition for CCDB DQUERY "showChildCallCat"
#
@querytitle
		Anzeige bekannter Anrufkategorien
@querydescription
		Zeigt alle Anruf-Kategorien im Regelwerk an, die der als Parameter angegebenen Top-Kategorie direkt untergeordnet sind
@group
		SVCLSLSTATSTAT
@paramnames
		topcat:callcat
@querytype
		dbselect
@sql	select	prw.RWPARENT as TopParent, cat.RWPARENT as Parent, cat.RWNAME as ID, cat.RWVALUE as Kategorie,
				(select GROUP_CONCAT(CONCAT(rcat.RWPARENT,'=>',rcat.RWNAME) separator '###') from CCRW rcat 
				  where	rcat.RWVALUE=cat.RWVALUE and
						rcat.RWNAME!=cat.RWNAME) as Andere_Ids_mit_demselben_Text
		  from CCRW cat 
			join CCRW prw on prw.RWTYP='SUPCAT' and prw.RWNAME=::topcat::
		 where cat.RWTYP='SUPCAT' and cat.RWPARENT=::topcat::	
		 order by cat.RWPARENT, cat.RWNAME asc
@decoration.decorate_colcell.0.hyperlink.href
		/dquery?dataname=showChildCallCat&topcat=@@celldata@@
@decoration.decorate_colcell.0.hyperlink.title
		Zeige Sub-Kategorien von @@celldata@@
@decoration.decorate_colcell.2.hyperlink.href
		/dquery?dataname=showChildCallCat&topcat=@@celldata@@
@decoration.decorate_colcell.2.hyperlink.title
		Zeige Sub-Kategorien von @@celldata@@
@decoration.decorate_colcell.4.rawhtml
		@@#jsexpr:$dcc3@@
@toptext
	<h3>Weitere Aktionen</h3>
	<ul>
	<li><a href="/dquery?dataname=showChildCallCat&topcat=[[topparentid]]">Übergeordnete Kategorie anzeigen</a></li>
	</ul>
@post_query
	if (that.result.getRowCount()>0) {
		that.result.topparentid = that.result.getCellValue(0,0);
	} else {
		that.result.topparentid = 'SUPPORTCATEGORIES';
	}
@dcc3
	let htt = "<table>";
	htt += "<tr><th>&Uuml;bergeordnet</th><th>ID</th></tr>";	
	let apids = ctxobj.celldata.split("###");
	let apfs;	
	for (var i=0; i<apids.length; i++) {	
	  apfs = apids[i].split("=>");
	  htt += "<tr><td>"+apfs[0]+"</td><td>"+apfs[1]+"</td></tr>";	
	}	
	htt += "</table>";	
	(htt)
@title
	Unterkategorien von {{topcat}}
