<cfset this_looper = incrementvalue(attributes.looper)>

<cfquery name="check_for_children" datasource="#application.datasource#">
	SELECT	    ItemName, ItemPrice, ItemID, ItemIsCheckedByDefault, ItemIsCollapsible
    FROM	    Items
	WHERE		ItemParentItemID = #attributes.sending_ItemID#
					AND
				ItemIsActive = 1
	ORDER BY	ItemSortOrder DESC
</cfquery>

<cfif check_for_children.recordcount gt 0>

	<cfoutput query="check_for_children">
	
		<cfif check_for_children.ItemIsCollapsible eq 1>
		
			<cfloop index="this_many_spaces" from="1" to="#this_looper+1#" step="1">&nbsp;&nbsp;&nbsp;</cfloop><a data-bs-toggle="collapse" href="##multiCollapseExample#check_for_children.ItemID#" role="button" aria-expanded="false" aria-controls="multiCollapseExample#check_for_children.ItemID#">+</a>&nbsp;#check_for_children.ItemName#<cfif check_for_children.ItemIsCheckedByDefault eq 1> (default)</cfif><cfif ItemPrice gt 0> - #dollarformat(ItemPrice)#</cfif>
				
			<div class="row">
				
				<div class="col">
					
					<div class="collapse multi-collapse" id="multiCollapseExample#check_for_children.ItemID#">
				
					<script language="JavaScript">
						function submitformedit#check_for_children.ItemID#()
						{
						document.myformedit#check_for_children.ItemID#.submit();
						}
					</script>
					
						<cfloop index="this_many_spaces" from="1" to="#this_looper+1#" step="1">&nbsp;&nbsp;&nbsp;</cfloop><font color="FFFFFF">+</font>&nbsp;<form action="index.cfm" method="post" name="myformedit#check_for_children.ItemID#" id="myformedit#check_for_children.ItemID#" style="display:inline;">
						
						<a href="javascript: submitformedit#check_for_children.ItemID#()">edit</a>
						
						<input type="hidden" name="item_form_submitted" value="0">
						<input type="hidden" name="mode" value="items">
						<input type="hidden" name="submode" value="edit">
						<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
					
					</form>&nbsp; &nbsp;
						
					<script language="JavaScript">
						function submitformflipcoll#check_for_children.ItemID#()
						{
						document.myformflipcoll#check_for_children.ItemID#.submit();
						}
					</script>
					
					<form action="index.cfm" method="post" name="myformflipcoll#check_for_children.ItemID#" id="myformflipcoll#check_for_children.ItemID#" style="display:inline;">
						
						<a href="javascript: submitformflipcoll#check_for_children.ItemID#()"><cfif check_for_children.ItemIsCollapsible eq 1>no </cfif>coll</a>
						
						<input type="hidden" name="item_form_submitted" value="0">
						<input type="hidden" name="mode" value="items">
						<input type="hidden" name="submode" value="flipcoll">
						<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
					
					</form>&nbsp; &nbsp;
					
					<script language="JavaScript">
						function submitformdelitem#check_for_children.ItemID#()
						{
						document.myformdelitem#check_for_children.ItemID#.submit();
						}
					</script>
					
					<form action="#request.cgiPath#" method="post" name="myformdelitem#check_for_children.ItemID#" id="myformdelitem#check_for_children.ItemID#" style="display:inline;">
						
						<a href="javascript: submitformdelitem#check_for_children.ItemID#()">delete</a>
						
						<input type="hidden" name="mode" value="viewmenu">
						<input type="hidden" name="submode" value="delitem">
						<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
					
					</form>&nbsp; &nbsp;
					
					<script language="JavaScript">
						function submitformcloneitem#check_for_children.ItemID#()
						{
						document.myformcloneitem#check_for_children.ItemID#.submit();
						}
					</script>
					
					<form action="#request.cgiPath#" method="post" name="myformcloneitem#check_for_children.ItemID#" id="myformcloneitem#check_for_children.ItemID#" style="display:inline;">
						
						<a href="javascript: submitformcloneitem#check_for_children.ItemID#()">clone</a><br>
						
						<input type="hidden" name="mode" value="cloneitem">
						<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
					
					</form>
			
					<script language="JavaScript">
						function submitforminsertchild#check_for_children.ItemID#()
						{
						document.myforminsertchild#check_for_children.ItemID#.submit();
						}
					</script>
					
					<form action="#request.cgiPath#" method="post" name="myforminsertchild#check_for_children.ItemID#" id="myforminsertchild#check_for_children.ItemID#" style="display:inline;">
						
						<cfloop index="this_many_spaces" from="1" to="#this_looper+1#" step="1">&nbsp;&nbsp;&nbsp;</cfloop> Name:<input name="ItemName" size="6"> Price:<input name="ItemPrice" value="0" size="2"> Default?<input type="checkbox" name="ItemIsCheckedByDefault" value="1"> <a href="javascript: submitforminsertchild#check_for_children.ItemID#()">add child here</a>
						
						<input type="hidden" name="mode" value="viewmenu">
						<input type="hidden" name="submode" value="insert">
						<input type="hidden" name="ItemCategoryID" value="#attributes.sending_ItemCategoryID#">
						<input type="hidden" name="ParentItemID" value="#check_for_children.ItemID#">
						<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
					
					</form><br>
				
					<cfmodule template="#application.wwwrootprefix#modules/get_children_of_item_id_with_add.cfm" sending_ItemID=#check_for_children.ItemID# sending_ItemCategoryID=#attributes.sending_ItemCategoryID# looper=#this_looper#>
			
					</div>
					
				</div>
			
			</div>
				
		<cfelse>
		
			<cfloop index="this_many_spaces" from="1" to="#this_looper#" step="1">&nbsp;&nbsp;&nbsp;</cfloop><font color="FFFFFF">+</font>&nbsp;#check_for_children.ItemName#<cfif check_for_children.ItemIsCheckedByDefault eq 1> (default)</cfif><cfif ItemPrice gt 0> - #dollarformat(ItemPrice)#</cfif><br>
				
			<script language="JavaScript">
				function submitformedit#check_for_children.ItemID#()
				{
				document.myformedit#check_for_children.ItemID#.submit();
				}
			</script>
			
			<cfloop index="this_many_spaces" from="1" to="#this_looper+1#" step="1">&nbsp;&nbsp;&nbsp;</cfloop><font color="FFFFFF">+</font>&nbsp;<form action="index.cfm" method="post" name="myformedit#check_for_children.ItemID#" id="myformedit#check_for_children.ItemID#" style="display:inline;">
				
				<a href="javascript: submitformedit#check_for_children.ItemID#()">edit</a>
				
				<input type="hidden" name="item_form_submitted" value="0">
				<input type="hidden" name="mode" value="items">
				<input type="hidden" name="submode" value="edit">
				<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
			
			</form>&nbsp; &nbsp;
					
				<script language="JavaScript">
					function submitformflipcoll#check_for_children.ItemID#()
					{
					document.myformflipcoll#check_for_children.ItemID#.submit();
					}
				</script>
				
				<form action="index.cfm" method="post" name="myformflipcoll#check_for_children.ItemID#" id="myformflipcoll#check_for_children.ItemID#" style="display:inline;">
					
					<a href="javascript: submitformflipcoll#check_for_children.ItemID#()"><cfif check_for_children.ItemIsCollapsible eq 1>no </cfif>coll</a>
					
					<input type="hidden" name="item_form_submitted" value="0">
					<input type="hidden" name="mode" value="items">
					<input type="hidden" name="submode" value="flipcoll">
					<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
				
				</form>&nbsp; &nbsp;
			
			<script language="JavaScript">
				function submitformdelitem#check_for_children.ItemID#()
				{
				document.myformdelitem#check_for_children.ItemID#.submit();
				}
			</script>
			
			<form action="#request.cgiPath#" method="post" name="myformdelitem#check_for_children.ItemID#" id="myformdelitem#check_for_children.ItemID#" style="display:inline;">
				
				<a href="javascript: submitformdelitem#check_for_children.ItemID#()">delete</a>
				
				<input type="hidden" name="mode" value="viewmenu">
				<input type="hidden" name="submode" value="delitem">
				<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
			
			</form>&nbsp; &nbsp;
			
			<script language="JavaScript">
				function submitformcloneitem#check_for_children.ItemID#()
				{
				document.myformcloneitem#check_for_children.ItemID#.submit();
				}
			</script>
			
			<form action="#request.cgiPath#" method="post" name="myformcloneitem#check_for_children.ItemID#" id="myformcloneitem#check_for_children.ItemID#" style="display:inline;">
				
				<a href="javascript: submitformcloneitem#check_for_children.ItemID#()">clone</a><br>
				
				<input type="hidden" name="mode" value="cloneitem">
				<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
			
			</form>
	
			<script language="JavaScript">
				function submitforminsertchild#check_for_children.ItemID#()
				{
				document.myforminsertchild#check_for_children.ItemID#.submit();
				}
			</script>
			
			<form action="#request.cgiPath#" method="post" name="myforminsertchild#check_for_children.ItemID#" id="myforminsertchild#check_for_children.ItemID#" style="display:inline;">
				
				<cfloop index="this_many_spaces" from="1" to="#this_looper+1#" step="1">&nbsp;&nbsp;&nbsp;</cfloop> Name:<input name="ItemName" size="6"> Price:<input name="ItemPrice" value="0" size="2"> Default?<input type="checkbox" name="ItemIsCheckedByDefault" value="1"> <a href="javascript: submitforminsertchild#check_for_children.ItemID#()">add child here</a>
				
				<input type="hidden" name="mode" value="viewmenu">
				<input type="hidden" name="submode" value="insert">
				<input type="hidden" name="ItemCategoryID" value="#attributes.sending_ItemCategoryID#">
				<input type="hidden" name="ParentItemID" value="#check_for_children.ItemID#">
				<input type="hidden" name="ItemID" value="#check_for_children.ItemID#">
			
			</form><br>
		
			<cfmodule template="#application.wwwrootprefix#modules/get_children_of_item_id_with_add.cfm" sending_ItemID=#check_for_children.ItemID# sending_ItemCategoryID=#attributes.sending_ItemCategoryID# looper=#this_looper#>
								
		</cfif>
					
	</cfoutput>
	
</cfif>