@(partsLists: scala.collection.immutable.Seq[beans.PartsListShowBean], opt:Int, page:Int, maxColumn:Int, key:String, totalCost:Long, relationKey:String)(implicit lang: Lang)
@import beans.PartsListBean
@import org.squeryl.PrimitiveTypeMode._

@*******************************************
* Helper generating navigation links *
*******************************************@
@link(newPage: Int, relationKey:String) = @{
	routes.PartsListController.index(opt, newPage, key, relationKey)
}
@main("Parts List by Play 2.1") {
	<h3>@Messages("title4")</h3>

    <a href="/partCreate">@Messages("list.link1")</a>
    &nbsp
    <a href="/list?page=0&key=">@Messages("title6")</a>
    &nbsp
	<a href="single_partslist?page=0&key=model1&relationKey=">@Messages("title4")</a>
    &nbsp
	<a href="/multi_partslist?key=model1&page=0&relationKey=">@Messages("list.link8")</a>
    &nbsp
	<a href="/cost_partslist?page=0&key=model1&relationKey=">@Messages("list.link9")</a>
    &nbsp
	<a href="/unit_partslist?page=0&key=model1&relationKey=">@Messages("list.link10")</a>
    &nbsp
	<a href="single_uppartslist?key=model1&page=0">@Messages("list.link11")</a>
    &nbsp
	<a href="multi_uppartslist?key=model1&page=0">@Messages("list.link12")</a>
    &nbsp
	<a href="top_uppartslist?key=model1&page=0">@Messages("list.link13")</a>
	<br />
	<a href="matrix_partslists?project=">@Messages("list.link24")</a>
    &nbsp
    <a href="/">@Messages("link.title1")</a>
	
	<div id="action">
		@helper.form(action=routes.PartsListController.index(opt, page, key, relationKey)) {
			<input type="search" id="searchbox" name="key" value="@key" placeholder="fill by the model name">
			<input type="search" id="searchbox" name="relationKey" value="@relationKey" placeholder="fill by the key word">
			<input type="hidden" name="page" value="0">
			<input type="submit" id="search submit" value=@Messages("btn.label1") class="btn primary">
		}
	</div>
	@if(opt==2) {
		@Messages("title26"):&yen@totalCost
	}
		<table class="computers zebra-striped">
			<thread>
				<tr>
					<th>@Messages("list.header1")</th>
					<th>@Messages("list.header2")</th>
					<th>@Messages("list.header5")</th>
					<th>@Messages("list.header3")</th>
					<th>@Messages("list.header12")</th>
					@if(opt==2) {
						<th>@Messages("list.header11")</th>
					}
					<th></th>
				</tr>
			</thead>
			<tbody>
				@for(relation <- partsLists) {
					<tr><td><a href="/relationCreate?parent=@relation.parent&child=&project=">@relation.parent</a></td>
@*					<td><a href="/relationUpdate?parent=@relation.parent&child=@relation.child.name&project=">@relation.child.name</a></td>*@
					<td><a href="/matrix_partslists?project=@relation.child.project.head.name" target="i_sample2">@relation.child.name</a></td>
					@inTransaction {
						@if(relation.child.atachs){
							<td><table>
							@for(atach <- relation.child.atachs) {
								<tr><td><a href="/showAtach?id=@atach.id">@atach.fileName</a></td></tr>
							}
							</table></td>
						} else {
							<td></td>
						}
					}
					<td><a href="/relationUpdate?parent=@relation.parent&child=@relation.child.name&project=">@relation.quantity</a></td>
					<td><a href="/relationUpdate?parent=@relation.parent&child=@relation.child.name&project=">@relation.relationKey</a></td>
					@if(opt==2) {
						<td>@relation.cost</td>
					}
					<td><a href="/designChangeForm?parentName=@relation.parent&childName=@relation.child.name&relationKey=@relation.relationKey">@Messages("title21")</a>&nbsp<a href="/designChangeForm?parentName=@relation.parent&childName=&relationKey=">@Messages("list.link21")</a></td></tr>
				}
			</tbody>
	    </table>
	    
	    <div id="pagination" class="pagination">
	    	<ul>
	    		@if(page-1 < 0) {
		    		<li class="prev disabled">&larr; prev</li>	    		
	    		} else {
		    		<li class="prev"><a href="@link(page-1, relationKey)">prev</a></li>	    		
	    		}
	    		<li class="current">current page:@(page+1)</li>
	    		@if((page+1)*(Integer.decode(Messages("list.row"))) >= maxColumn) {
		    		<li class="next disabled">next &rarr;</li>
	    		} else {
		    		<li class="next"><a href="@link(page+1, relationKey)">next</a></li>
		    	}
	    	</ul>
	    </div>
	    
	    <a href="/partCreate">@Messages("list.link1")</a>
	    &nbsp
	    <a href="/list?page=0&key=">@Messages("title6")</a>
	    &nbsp
		<a href="single_partslist?page=0&key=model1&relationKey=">@Messages("title4")</a>
	    &nbsp
		<a href="/multi_partslist?key=model1&page=0&relationKey=">@Messages("list.link8")</a>
	    &nbsp
		<a href="/cost_partslist?page=0&key=model1&relationKey=">@Messages("list.link9")</a>
	    &nbsp
		<a href="/unit_partslist?page=0&key=model1&relationKey=">@Messages("list.link10")</a>
	    &nbsp
		<a href="single_uppartslist?key=model1&page=0">@Messages("list.link11")</a>
	    &nbsp
		<a href="multi_uppartslist?key=model1&page=0">@Messages("list.link12")</a>
	    &nbsp
		<a href="top_uppartslist?key=model1&page=0">@Messages("list.link13")</a>
		<br />
		<a href="matrix_partslists?project=">@Messages("list.link24")</a>
	    &nbsp
	    <a href="/">@Messages("link.title1")</a>

}
