<script>
{literal}
$(document).ready(function(){
    $("#select_all").click(function(){
      var checked_status = this.checked;
      $("input[name='users[]']").each(function(){
        this.checked = checked_status;
      });
    });
  });
  
function checkthis(){
	var error=0
	 $("input[name='users[]']").each(function(){
		
	        if($( this ).is( ':checked' )){
	        	error=1;
	        }
	      });
	if(error==1){
		return true;
	} else {
		alert('Zaznacz choć jedną firmę');
		return false;
	}
}  
  {/literal}
</script>
<style>
{literal}
.text-left {
	text-align: left;
}
.text-right {
	text-align: right !important;
}
.account_name {
	background:rgba(0,0,0,0);
	border:none;
	text-color: black;
}
{/literal}
</style>
{if $added==1}
<h3><span style="color:green;">Produkty zostały udostępnione</span></h3>
<br><br>{/if}
<h3>Udostępnij firmie</h3>
<form action="index.php" method="POST" name="SendEmail" id="SendEmail" enctype="multipart/form-data">
<input type="hidden" name="action" value="share">
<input type="hidden" name="module" value="EcmProducts">
<input type="hidden" name="uid" value="{$uid}">
<table class="list view" width="100%" cellspacing="0" cellpadding="0" border="0" id="transactions_table">
	<thead>
		<tr>
			<th scope="col" nowrap="nowrap" width="10%"><div style="white-space: nowrap;" width="100%" align="left">
			<input type="checkbox" name="select_all" id="select_all" value=""></div></th>
			<th scope="col" nowrap="nowrap" width="90%">
			<div style="white-space: nowrap;" width="100%" align="left">Firma</div></th>
		</tr>
		<thead>
			<tbody>
			{foreach from=$users item=row key=k}
				<tr class="evenListRowS1" row-number="">
					<td class="text-left"><input type="checkbox" name="users[]" value="{$row.dbasename}">
					</td>
					<td class="text-left">{$row.name}</td>
				


				</tr>
			{/foreach}

			</tbody>	
		</table>

<br>
<br>
<h3>Wybrane produkty</h3>

<table class="list view" width="100%" cellspacing="0" cellpadding="0" border="0" id="transactions_table">
	<thead>
		<tr>
			<th scope="col" nowrap="nowrap" width="100%">
			<div style="white-space: nowrap;" width="100%" align="left">Produkt</div></th>
		</tr>
		<thead>
			<tbody>
			{foreach from=$account_list item=row key=k}
				<tr class="evenListRowS1" row-number="">

					<td class="text-left">{$row.name}</td>
				


				</tr>
			{/foreach}

			</tbody>	
		</table>

<br>
<br>
<input class="button primary" type="submit" value="Udostępnij" name="submit" onclick='return checkthis();' accesskey="S" title="Zapisz [Alt+S]">
</form>