<h1>Edytuj element</h1>	
<script language="javascript" type="text/javascript">
urlStatic = '{$urlStatic}';
</script>

<form method="post" action="{url Product='Edit' idProduct=$idProduct idElement=$idStructure}" enctype="multipart/form-data">
	{if isset($objProduct)}
		<input type="hidden" name="idProduct" value="{$objProduct->GetId()}" />
	{/if}

	<div class="panelRightTop"></div>
	<div class="panelRightBody">
		<div class="paddedContent">
			{assign var="additionalTitle" value=""}

			{dropDownContainer title="Ogólne" additionalTitle=$additionalTitle}
				<table width="100%" cellspacing="0" cellpadding="5" border="0" class="commonTable">
					<tbody>
						<tr>
							<td>Nazwa:</td>
							<td>							
							{formField name='name' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='getName'}
							{if isset($error.name)}<div style="color: red;" id="actionError" class="validate">{$error.name}</div>{/if}
							</td>
						</tr>
						<tr>
							<td>Publikuj:</td>
							<td>{formField type='checkbox' name='publication' obj='objProduct' func='GetPublication'}</td>
						</tr>
						<tr>
					    <td class="noborder"><b>Data publikacji:</b></td>
					    <td class="noborder">
						<img src='{$urlStatic}/image/iconKalendarz.gif' alt='kalendarz' onclick="showKal(document.getElementById('datepub'));" />&nbsp;{formField type='input' name='datepublication'  errorClass='validate' obj='objProduct' func='GetDatePublicationWithoutTime' id='datepub'}
						{if isset($error.datepublication)}<div style="color: red;" id="actionError" class="validate">{$error.datepublication}</div>{/if}
						 </td>
					</tr>
					<tr>
					    <td><b>Godzina:</b></td>
					    <td>
						    {formField type='input' maxlength='2' errorClass='validate' name='timepublication' obj='objProduct' func='GetDatePublicationTime'}
						    <span class="grayText smallText">format (HH)</span>
						    
					    </td>
					</tr>	    
					<tr>
					    <td>Kolejność:</td>
					    <td>
						    {formField type='input' maxlength='2' class='inputWidth141'  errorClass='validate' name='weight' obj='objFile' func='GetWeight'}
						    
					    </td>
					</tr>
					</tbody>
				</table>
			{/dropDownContainer}
			{dropDownContainer title="Karta"}
			<div class="floatLeft" style="margin-left: 10px;">
					{if $objProduct->GetPictureMini()}<img src="{$objProduct->GetPictureMiniUrl()}" />{/if}
				</div>
				<div class="cb"></div>
				<div class="articlePreviewRight">
					<input type="file" name="filename" />
				</div>
				<div class="cb"></div>
				<div class="articlePreviewRight">
					<input type="checkbox" name="deletePhoto" > Usuń obrazek
				</div>				
				<div class="cb"></div>
			{/dropDownContainer}
			
			{dropDownContainer title="Plik"}
				<div>
				{if $objProduct->GetFile()}
				{assign var=objFile value=$objProduct->GetFile()}
				<img src="{$urlStatic}/image/fileIcon/pdf.gif " alt="" title="" style="float: left;" >
				<p>{$objFile->GetName()}</p>
				{/if}
				</div>
				<div class="clearBoth"></div>
				<br />
				<br />
				<br />
				<div class="articlePreviewRight">
					<input type="file" name="filename_pdf" >
				</div>
				<div class="clearBoth"></div>
			{/dropDownContainer}
			{dropDownContainer title="Treść"}

				<div class="center">
					{if isset($objProduct)}
						{assign var='tresc' value=$objProduct->GetDescription()}
					{else}
						{assign var='tresc' value=''}
					{/if}
					{insertCkEditor width='1020' height='380' name='tresc' toolbar='Formix' value=$tresc}
				</div>

			{/dropDownContainer}
			
			{dropDownContainer title="Opis dodatkowy"  isHidden=true}
				<div class="articlePreviewRight">
					{if isset($objProduct)}
						{assign var='zajawka' value=$objProduct->GetShortnote()}
					{else}
						{assign var='zajawka' value=''}
					{/if}
					{insertCkEditor width='1020' height='380' name='zajawka' toolbar='Basic' value=$zajawka}
					<div class="validate" id="shortnoteHiddenError"></div>
					{if isset($error.zajawka)}<div style="color: red;" id="actionError"  class="validate">{$error.zajawka}</div>{/if}
				</div>
				<div class="clearBoth"></div>
			{/dropDownContainer}
				
					
			{dropDownContainer title="Kategorie"  isHidden=true}
				<table cellspacing="0" cellpadding="0" border="0">
		
								<tr>
									<td>Kategorie:</td>
									<td class="left">
									{foreach from=$arrayStructureProductCategory item=productCategory key=idProductCategory}
									<input type="checkbox" value="1" name="prod_category_value[{$productCategory->GetId()}]" class="input"  {if $productCategory->GetChecked() || $objProduct->getIdMfProductCategory() == $productCategory->GetId()} checked{/if}  />{$productCategory->GetName()};</br>
									{if $productCategory->GetHaveChildren()}
										{foreach from=$productCategory->GetArrayChildren() item=subProductCategory key=idSubProductCategory}
										&nbsp;->&nbsp;<input type="checkbox" value="1" name="prod_category_value[{$subProductCategory->GetId()}]" class="input"  {if $subProductCategory->GetChecked()} checked{/if}  />{$subProductCategory->GetName()};</br>
										{/foreach}
									{/if}
									{/foreach}
									<p><br>
									
									</td>
								</tr>
								</table>
			{/dropDownContainer}
				
			{dropDownContainer title="Parametry"  isHidden=true}

			{foreach from=$arraySpecType item=specTypeName key=idSpecTypeName} 
				<table cellspacing="0" cellpadding="0" border="0">
					
							<th style="width: 20%">{$specTypeName}{*<div class="sort"><a class="ascendingAct" href="#">&nbsp;</a><a class="descending" href="#">&nbsp;</a></div>*}</th>
							
						</tr>
						<tr class="selAllRow" id="linkParam" style="display: none;">
								<td colspan="6">
																
								</td>
						</tr>
						<tr>
							<td class="id_spec_{$idSpecTypeName}" id="id_spec_{$idSpecTypeName}">	
							{assign var=x value=0}
							{foreach from=$arrayObjProductSpecification item=objProductSpecification}
							{assign var=x value=$x+1}
						
							{if $objProductSpecification->GetTyp() == $idSpecTypeName}
							<input type="checkbox" value="1" name="spec_value[{$objProductSpecification->GetId()}]" class="input"  {if $objProductSpecification->GetChecked()} checked{/if}  />{$objProductSpecification->GetValue()};
							{/if}
				
						
						{/foreach}
						
							</td>
						</tr>
						<tr>
							<td>lub dodaj nowy:
							<input type="text" name="spec_new_{$idSpecTypeName}" id="spec_new_{$idSpecTypeName}" style="width: 200px;" value="" /> <input type="button" value="dodaj" onclick="AddSpec('{url Product=AddSpecification type=$idSpecTypeName}', '#spec_new_{$idSpecTypeName}', '#id_spec_{$idSpecTypeName}')"/></td>
						</tr>
						</table>
				{/foreach}
			{/dropDownContainer}
			
			
			{dropDownContainer title="Parametry dla mieszkania"}
			<table width="100%" cellspacing="0" cellpadding="5" border="0" class="commonTable">
					<tbody>
					
						<tr>
								
									<td>Piętro:</td>
									<td class="left">
									<input type="hidden" name="idProductCategory" value="1" />
										<select name="idProductCategory">
										{foreach from=$arrayStructureProductCategory item=productCategory key=idProductCategory}
											<option value="{$productCategory->GetId()}" {if $productCategory->GetId() == $objProduct->getIdMfProductCategory()}selected{/if}>
												{$productCategory->GetName()}											
											</option>
											{if $productCategory->GetHaveChildren()}
											{foreach from=$productCategory->GetArrayChildren() item=subProductCategory key=idSubProductCategory}
											<option value="{$subProductCategory->GetId()}" {if $subProductCategory->GetId() == $objProduct->getIdMfProductCategory()}selected{/if}>
												&nbsp;->&nbsp;{$subProductCategory->GetName()}										
											</option>
											{/foreach}
											{/if}
											{/foreach}
										</select>
									</td>
								</tr>
					{*<tr>
							<td>Promocja:</td>
							<td>{formField type='checkbox' name='sale' obj='objProduct' func='GetSale'}</td>
						</tr>
						<tr>
							<td>Nowość:</td>
							<td>{formField type='checkbox' name='new' obj='objProduct' func='GetNew'}</td>
						</tr>*}
						<tr>
							<td>Status:</td>
							<td>
									<select name="available">
										
											<option value="0" {if 0 == $objProduct->GetAvailable()}selected{/if}>
												sprzedane	
											</option>
											<option value="1" {if 1 == $objProduct->GetAvailable()}selected{/if}>
												wolne		
											</option>
											<option value="2" {if 2 == $objProduct->GetAvailable()}selected{/if}>
												rezerwacja				
											</option>
										</select>
							</td>
						</tr>
						{*
						<tr>
							<td>Polecany:</td>
							<td>{formField type='checkbox' name='special' obj='objProduct' func='GetSpecial'}</td>
						</tr>*}					
						<tr>
							<td>Typ:</td>
							<td>							
							{formField name='type' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetType'}
							{if isset($error.type)}<div style="color: red;" id="actionError"  class="validate">{$error.type}</div>{/if}
							</td>
						</tr>
						<tr>
							<td>Numer:</td>
							<td>							
							{formField name='amount' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetAmount'}
							{if isset($error.amount)}<div style="color: red;" id="actionError"  class="validate">{$error.amount}</div>{/if}
							</td>
						</tr>
						<tr>
							<td>Cena:</td>
							<td>							
							{formField name='price' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetPrice'}
							{if isset($error.price)}<div style="color: red;" id="actionError"  class="validate">{$error.price}</div>{/if}
							</td>
						</tr>
						{*
						<tr>
							<td>Cena promocyjna:</td>
							<td>							
							{formField name='price_sale' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetPriceSale'}
							{if isset($error.price_sale)}<div style="color: red;" id="actionError"  class="validate">{$error.price_sale}</div>{/if}
							</td>
						</tr>
						*}
						
						<tr>
							<td>Powierzchnia:</td>
							<td>							
							{formField name='dimension' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetDimension'}
							{if isset($error.dimension)}<div style="color: red;" id="actionError"  class="validate">{$error.dimension}</div>{/if}
							</td>
						</tr>
						
						<tr>
							<td>Powierzchnia balkonu/tarasu/loggii:</td>
							<td>							
							{formField name='code' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetCode'}
							{if isset($error.code)}<div style="color: red;" id="actionError"  class="validate">{$error.code}</div>{/if}
							</td>
						</tr>
						<tr>
							<td>Powierzchnia balkonu/tarasu/loggii opis:</td>
							<td>							
							{formField name='zajawka' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetShortnote'}
							{if isset($error.zajawka)}<div style="color: red;" id="actionError"  class="validate">{$error.zajawka}</div>{/if}
							</td>
						</tr>
						<tr>
							<td>Liczba pokoi:</td>
							<td>							
							{formField name='bulb' class='inputWidth141 input100percent' errorClass='validate' type='text' obj='objProduct' func='GetBulb'}
							{if isset($error.bulb)}<div style="color: red;" id="actionError"  class="validate">{$error.bulb}</div>{/if}
							</td>
						</tr>
					</tbody>
				</table>
			
			{/dropDownContainer}
			
			
			{dropDownContainer title="Seria"  isHidden=true}
			<table width="100%" cellspacing="0" cellpadding="5" border="0" class="commonTable">
					<tbody>
						<tr>
							<td>Wybierz serię:</td>
							<td>
							<select id="id_series" name="id_series">
									<option value="">
																		
									</option>
									{foreach from=$arraySeries key=idSeries item=series}
									<option value="{$idSeries}" {if $idSeries == $objProduct->GetSeries()} selected{/if}>
										{$series}											
									</option>
									{/foreach}
								</select>
								</td>
						</tr>
						<tr>
							<td>lub dodaj nową:</td>
							<td><input type="text" name="series_new" id="series_new" style="width: 200px;" value="" /> <input type="button" value="dodaj" onclick="AddSeries('{url Product=AddSeries}', '#series_new')"/></td>
						</tr>
					</tbody>
				</table>
			
			{/dropDownContainer}
			
			{dropDownContainer title="Dodaj zdjecia" isHidden=true}
			<iframe name="PhotoUpload" id="PhotoUpload" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" height="70" width="625"	src="{url Image='Form'}">
			<noscript>
			Do wyświetlenia konieczne jest działanie ramek (iframe).
			</noscript>
			</iframe>
			{/dropDownContainer}
			{dropDownContainer title="Zdjecia" isHidden=true}
			<div >
			{foreach from=$arrayImage item=image name=photo key=key}
			<div id="image_{$image->GetId()}" style="float:left; text-align: center; border:1px solid #000000; margin-right:5px; margin-bottom: 5px"><img src="{$image->GetFullUrlMiniId($objProduct->GetId(), 'Product')}" alt="test" />
			<div>
				<a href="#" onclick="DeletePhotoJ('{url Image=DeleteImage}', '{$image->GetId()}'); return false;"><img src="{$urlStatic}/image/Admin/iconDelete.gif" alt="Usuń" title="Usuń" border="0"/></a>
			</div>
			</div> {/foreach}
			</div>
			<div class="clearBoth"></div>
			<div name="PhotoDisplay" id="PhotoDisplay" class="PhotoDisplay">
			{if isset($arrayPhoto)}
			{foreach from=$arrayPhoto item=file name=photo key=key}<div style="float:left; text-align: center; border:1px solid #000000; margin-right:5px; margin-bottom: 5px"><img src="{$urlStatic}/temp/{$file.th}" alt="test"/></div> {/foreach}
			{/if}
			</div>
			<div class="cb"></div>
			{/dropDownContainer}
		
		</div>
		</div>
	<div class="cb"></div>
		<div class="panelButtons">
		{if isset($idStructure)}
			<input type="button" value="Anuluj" class="cancel" onclick="document.location.href='{url label=editStructure id=$idStructure}'" />
			{else}
			<input type="button" value="Anuluj" class="cancel" onclick="document.location.href='{url _value=$controller,index}'"/>
			{/if}
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="submit" value="Zapisz" name="doProductEdit"/>
		</div>
	<input type="hidden" name="descriptionHidden" id="descriptionHidden" value="" />
<input type="hidden" name="shortnoteHidden" id="shortnoteHidden" value="" />
</form>
