summaryrefslogtreecommitdiff
path: root/templates/view_component.tpl
blob: 770005afbc57c0bcfc4beb229108f3d1742e950d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{strip}
{if empty($liberty_preview)}
	{include file="bitpackage:stock/assembly_nav.tpl"}
{/if}

<div class="display stock">
	{formfeedback hash=$feedback}
	<div class="header">
		{if empty($liberty_preview)}
		<div class="floaticon">
			{if $gContent->hasUpdatePermission()}
				<a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Component"}</a>
				<a title="{tr}Delete{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}&amp;delete=1">{biticon ipackage="icons" iname="user-trash" iexplain="Delete Component"}</a>
			{/if}
		</div>
		{/if}
		<h1>{$gContent->getTitle()|escape}</h1>
	</div>

	<div class="body">
		{if $gContent->mInfo.data ne ''}
			<p class="description">{$gContent->mInfo.parsed_data}</p>
		{/if}

		{jstabs}
			{if $gXrefInfo->mGroups}
				{assign var=klGroup value=null}
				{assign var=sgGroup value=null}
				{foreach $gXrefInfo->mGroups as $xrefGroup}
					{if $xrefGroup->mXGroup eq 'kitlocker'}
						{assign var=klGroup value=$xrefGroup}
					{elseif $xrefGroup->mXGroup eq 'stgrp'}
						{assign var=sgGroup value=$xrefGroup}
					{else}
						{include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate)
							xrefGroup=$xrefGroup allow_edit=false}
					{/if}
				{/foreach}
				{if $isKitlocker && $klGroup}
					{include file=$gContent->getXrefListTemplate($klGroup->mTemplate)
						xrefGroup=$klGroup allow_edit=false}
				{/if}
				{if $isKitlocker && $sgGroup}
					{include file=$gContent->getXrefListTemplate($sgGroup->mTemplate)
						xrefGroup=$sgGroup allow_edit=false}
				{/if}
			{/if}

			{jstab title="{tr}Stock{/tr}"}
			<table class="table table-condensed">
				<thead>
					<tr>
						<th>{tr}Type{/tr}</th>
						<th class="text-right">{tr}Level{/tr}</th>
					</tr>
				</thead>
				<tbody>
					{if $componentStockLevels}
						{foreach from=$componentStockLevels key=qtype item=level}
						<tr{if $level < 0} class="danger"{elseif $level == 0} class="warning"{/if}>
							<td>{$qtype|escape}</td>
							<td class="text-right">{if $qtype eq 'PCK' && $packSize > 0}{math equation="l/p" l=$level p=$packSize format="%.2f"}{elseif $qtype eq 'SHT'}{$level|string_format:"%.2f"}{else}{$level|string_format:"%.0f"}{/if}</td>
						</tr>
						{/foreach}
					{else}
						<tr class="norecords"><td colspan="2">{tr}No stock movements recorded{/tr}</td></tr>
					{/if}
				</tbody>
			</table>
			<a class="btn btn-default btn-xs" href="{$smarty.const.STOCK_PKG_URL}list_movements.php?component_content_id={$gContent->mContentId}">{tr}Stock history{/tr}</a>
			{/jstab}
		{/jstabs}
	</div><!-- end .body -->

	{if $gGallery && $gGallery->isCommentable()}
		{include file="bitpackage:liberty/comments.tpl"}
	{/if}

</div><!-- end .stock -->
{/strip}