@(parts: org.squeryl.Query[Part], maxColumn:Int, key:String, page:Int)(implicit lang: Lang)
@import models.Part

@*******************************************
* Helper generating navigation links *
*******************************************@
@link(newPage: Int) = @{
	routes.PartsMasterController.list(newPage, key)
}
@main("Parts Master by Play 2.1") {
	<h3>@Messages("title6")</h3>

    <a href="/partCreate">@Messages("list.link1")</a>
    &nbsp
    <a href="/single_partslist?page=0&key=&relationKey="">@Messages("title4")</a>
    &nbsp
    <a href="/projectlist?page=0&key=">@Messages("title12")</a>
    &nbsp
    <a href="/userList?page=0&key=">@Messages("title13")</a>
    &nbsp
    <a href="/">@Messages("link.title1")</a>
	
	<div id="action">
		@helper.form(action=routes.PartsMasterController.list(page, key)) {
			<input type="search" id="searchbox" name="key" value="@key" placeholder="fill by the parts name">
			<input type="hidden" name="page" value="0">
			<input type="submit" id="search submit" value=@Messages("btn.label1") class="btn primary">
		}
	</div>
		<table class="computers zebra-striped">
			<thead>
				<tr>
					<th>@Messages("list.header4")</th>
					<th>@Messages("list.header2")</th>
					<th>@Messages("list.header5")</th>
					<th>@Messages("list.header6")</th>
					<th>@Messages("list.header7")</th>
				</tr>
			</thead>
			<tbody>
				@for(part <- parts) {
					<tr><td><a href="/relationCreate?parent=@part.name">@part.id</a></td>
					<td><a href="/partModify?id=@part.id">@part.name</a></td>
					@if(part.atachs){
						<td><table>
						@for(atach <- part.atachs) {
							<tr><td><a href="/showAtach?id=@atach.id">@atach.fileName</a></td></tr>
						}
						</table></td>
					} else {
						<td></td>
					}
					<td><a href="/projectModify?id=@part.project.assign(part.project.head).id">@part.project.assign(part.project.head).name</a></td>
					<td><a href="/userModify?id=@part.project.assign(part.project.head).users.head.id">@part.project.assign(part.project.head).users.head.email</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)">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)">next</a></li>
		    	}
	    	</ul>
	    </div>
	    <br />
	    <a href="/partCreate">@Messages("list.link1")</a>
	    &nbsp
	    <a href="/single_partslist?page=0&key=&relationKey="">@Messages("title4")</a>
	    &nbsp
	    <a href="/projectlist?page=0&key=">@Messages("title12")</a>
	    &nbsp
	    <a href="/userList?page=0&key=">@Messages("title13")</a>
	    &nbsp
	    <a href="/">@Messages("link.title1")</a>

}