<script id="clientsTpl" type="text/html">

	<table id="list_header" class="layout-fixed top">
		<thead class="sticked--top">
		<tr class="header_contaner">
			<th class="w30 hidden-ipad div-center"><input type="checkbox" name="che" id="che"></th>
			<th class="w40 hidden-ipad"></th>

			{{#head}}
				<th class="{{clas}} text-left {{#width}}w{{width}}{{/width}} drag--accept" id="{{id}}" title="{{title}}">
					<div class="divhead ellipsis {{#sort}}hand{{/sort}}" title="{{title}}" {{#sort}}onclick="changesort('{{sort}}')"{{/sort}}>
						{{#sort}}
							<div class="sort" id="x-{{sort}}">
								<i class="icon icon-angle-{{desc}}"></i>
							</div>
						{{/sort}}
						{{^icon}}<b>{{title}}</b>{{/icon}}
						{{#icon}}{{{icon}}}{{/icon}}
					</div>
					<div class="thandler" title="Переместить колонку"></div>
				</th>
			{{/head}}

			<th class="w5 text-center"></th>
		</tr>
		</thead>
		<tbody>
		{{#client}}

			<tr class="ha th50" id="client{{did}}" data-type="row">
				<td class="w30 hidden-ipad div-center">
					<input name="ch[]" type="checkbox" class="mc" id="ch[]" value="{{clid}}">
				</td>
				<td class="hidden-ipad text-center relativ hand" onclick="openClient('{{clid}}')" title="Открыть карточку">
					<i class="{{icon}} broun"></i>{{^change}}<i class="icon-lock broun sup"></i>{{/change}}{{{dostup}}}
				</td>

				{{#columns}}

					{{#isString}}
					<td class="{{clas}}">
						{{#title}}
						{{^isSum}}<div class="ellipsis {{class}}" title="{{tooltip}}">{{{title}}}</div>{{/isSum}}
						{{#isSum}}
						<div class="{{class}} text-right" title="{{tooltip}}">
							{{{title}}}
							{{#subtitle}} из <span class="Bold gray" title="{{subtooltip}}">{{subtitle}}</span>{{/subtitle}}
						</div>
						{{/isSum}}
						{{/title}}
					</td>
					{{/isString}}

					{{#isTitle}}
					<td class="{{clas}} min100">
						{{#task}}
							<a href="javascript:void(0)" onclick="viewTaskList('','{{clid}}','');" class="hidden-ipad" title="Список дел"><i class="icon-calendar-1 green"></i></a>
						{{/task}}
						{{^task}}
							<i class="icon-calendar-2 gray list hidden-ipad" title="Нет напоминаний"></i>
						{{/task}}
						<div class="ellipsis hand" onclick="viewClient('{{clid}}')" title="Просмотр: {{title}}">
							<b class="fs-11">{{title}}</b>
						</div>
						{{#sub}}
						{{#person}}
							<br>
							<div class="ellipsis paddtop5" title="{{person}}">
								<a href="javascript:void(0)" onclick="viewPerson('{{pid}}')" class="gray"><i class="icon-user-1 gray"></i>&nbsp;{{person}}</a>
							</div>
						{{/person}}
						{{/sub}}
					</td>
					{{/isTitle}}

					{{#isPerson}}
					<td class="{{clas}}">
						<div class="ellipsis" title="{{title}}">
							{{#id}}
								<a href="javascript:void(0)" onclick="openPerson('{{id}}')"><i class="icon-user-1 blue"></i>{{title}}</a>
							{{/id}}
						</div>
					</td>
					{{/isPerson}}

					{{#isHistory}}
					<td class="{{clas}}">
						{{#title}}
						<div class="ellipsis {{class}}" title="{{title}}">{{title}}</div>
						{{#comment}}
						<br>
						<div class="ellipsis blue" title="{{{comment}}}">{{{comment}}}</div>
						{{/comment}}
						{{/title}}
					</td>
					{{/isHistory}}

					{{#isLastHistory}}
					<td class="{{clas}}">
						{{#title}}
						<div class="ellipsis {{class}}" title="{{title}}">{{title}}</div>
						{{#comment}}
						<br>
						<div class="ellipsis blue" title="{{{comment}}}">{{{comment}}}</div>
						{{/comment}}
						{{/title}}
					</td>
					{{/isLastHistory}}

					{{#isRelation}}
					<td class="{{clas}}" {{#change}}onclick="editClient('{{clid}}','change.relation')"{{/change}}>
						<div class="tip_rel hand" style="background:{{color}}" title="{{tooltip}}">{{title}}</div>
					</td>
					{{/isRelation}}

				{{/columns}}

				<td>
					{{#change}}
					<div class="action--container">
						<div class="action--block">
							<a href="javascript:void(0)" onclick="editClient('{{clid}}','edit');" title="Изменить" class="gray blue"><i class="icon-pencil blue"></i></a>&nbsp;<a href="javascript:void(0)" onclick="addTask('','{{clid}}');" title="Добавить напоминание" class="gray green"><i class="icon-calendar-1 green"></i></a>&nbsp;<a href="javascript:void(0)" onclick="addHistory('','{{clid}}');" class="gray brounbg2"><i class="icon-clock broun" title="Добавить активность"></i></a>&nbsp;
							{{#profile}}<a href="javascript:void(0)" onclick="viewProfile('{{clid}}');" title="Профиль" class="gray orange"><i class="icon-info-circled blue"></i></a>&nbsp;{{/profile}}
							{{{deal}}}
						</div>
					</div>
					{{/change}}
				</td>
			</tr>

		{{/client}}
		</tbody>
	</table>

	<div class="space-40"></div>

</script>