Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/account/edit.php
	<!-- TinyMCE -->
	<script type="text/javascript" src="CMS/html/js/tiny_mce/tiny_mce.js"></script>
	<script type="text/javascript">
		tinyMCE.init({
			// General options
			mode : "textareas",
			theme : "advanced",
			plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

			// Theme options
			theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
			theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
			theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,

			// Example content CSS (should be your site CSS)
			content_css : "css/content.css",

			// Drop lists for link/image/media/template dialogs
			template_external_list_url : "lists/template_list.js",
			external_link_list_url : "lists/link_list.js",
			external_image_list_url : "lists/image_list.js",
			media_external_list_url : "lists/media_list.js",

			// Style formats
			style_formats : [
				{title : 'Bold text', inline : 'b'},
				{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
				{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
				{title : 'Example 1', inline : 'span', classes : 'example1'},
				{title : 'Example 2', inline : 'span', classes : 'example2'},
				{title : 'Table styles'},
				{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
			],

			// Replace values for the template plugin
			template_replace_values : {
				username : "Some User",
				staffid : "991234"
			}
		});
	</script>
	<!-- /TinyMCE -->
			<?php if (isset($message)):?>
					<div id="message-red" >
						<table border="0" width="100%" cellpadding="0" cellspacing="0">
							<tr>
								<td class="red-left">
									<?php echo $message;?>
								</td>
								<td class="red-right"><a class="close-red"><?php echo HTML::image('static/images/table/icon_close_red.gif');?></a></td>
							</tr>
						</table>
					</div>
			<?php endif;?>	
			<?php echo Message::render(); ?>
			
			<div class="wrapper">
			<?php echo aurora::partial('frontend_sider'); ?>
				<?php $company = ORM::Factory('company', $user->companies_id); ?>
				<div id="content">
				<h2><?php echo __t('Zarządzanie <span>profilem</span>'); ?>
			
				</h2>
				<?php echo aurora::partial('frontend_account_info'); ?>
				<p><?php echo __t('Witaj w strefie dostępnej dla użytkowników systemu'); ?></p>
				
				<br style="clear: both;"/>
				<a href="#" rel="account_edit_layer" class="button_gray button_gray_active"><?php echo __t('Edycja danych'); ?></a>
				<a href="#" rel="account_password_layer" class="button_gray"><?php echo __t('Zmiana hasła'); ?></a>
				<a href="#" rel="account_email_layer" class="button_gray"><?php echo __t('Zmiana e-mail'); ?></a>
				<?php if( $user->profile_id == 1 ) : ?>
				<a href="#" rel="account_about_layer" class="button_gray"><?php echo __t('Opis profilu'); ?></a>
				<a href="#" rel="account_allegro_layer" class="button_gray"><?php echo __t('Integracja Allegro'); ?></a>
				<a href="#" rel="account_abonament_layer" class="button_gray"><?php echo __t('Abonament'); ?></a>
				<?php endif; ?>
				<br style="clear: both;"/><br style="clear: both;"/><br style="clear: both;"/>
				
				<div class="account_abonament_layer layer_module">
				<h2>Weryfikacja <span>konta</span></h2>
			
				<p><?php echo __t('Dokonując wpłaty symbolicznej kwoty '.Kohana::$config->load('site.verifyAmount').'zł sprawisz iż twoje konto będzie miało status PREMIUM co sprawi, że zyskasz nowe możliwości.'); ?></p>
					<form method="post" action="https://dotpay.eu" name="form_edit6">
					<fieldset class="forms">
					
						
						<div>
						<div class="free_reg_btn">
								
								<input type="submit"  id="change_button6" class="toRight" value="Zapłać teraz"/>
							</div>
							
						</div>
						</fieldset>
					</form>
				</div>
					
				
				<div class="account_edit_layer layer_module">
				
				<h2><?php echo __t('Ustawienia systemu i dane <span>personalne</span>'); ?></h2>
				
					<form method="post" action="" name="form_edit_data">
					<fieldset class="forms small_fields">
					
			
			
					<input type="hidden" name="action" value="edit_data"/>
							
							<div>
								<label><?php echo __t('Użytkownik'); ?>:</label><br style="clear: both;"/><input type="text" id="username" name="username" value="<?php echo @$user->username; ?>"/>
							</div>
						
							<div>
								<label><?php echo __t('Firma'); ?>:</label><br style="clear: both;"/><input type="text" id="company" name="company" value="<?php echo @$company->title; ?>" readonly />
								
							</div>
							<div>
								<label><?php echo __t('NIP'); ?>:</label><br style="clear: both;"/><input type="text" id="nip" name="nip" value="<?php echo @$company->nip; ?>" readonly />
								
							</div>
							<div>
								<label><?php echo __t('Imię'); ?>:</label><br style="clear: both;"/><input type="text" id="firstname" name="firstname" value="<?php echo @$user->firstname; ?>"/>
								
							</div>
							<div>
								<label><?php echo __t('Nazwisko'); ?>:</label><br style="clear: both;"/><input type="text" id="lastname" name="lastname" value="<?php echo @$user->lastname; ?>"/>
								
							</div>
							
							<div>
								<label><?php echo __t('Ulica'); ?>:</label><br style="clear: both;"/><input type="text" id="street" name="street" value="<?php echo @$user->street; ?>"/>
								
							</div>
							<div>
								<label><?php echo __t('Kod pocztowy'); ?>:</label><br style="clear: both;"/><input type="text" id="postcode" name="postcode" value="<?php echo @$user->postcode; ?>"/>
								
							</div>
							
							<input type="hidden" id="zone_id" name="zone_id" value=""/>
								
							<div>
								<label><?php echo __t('Miejscowość'); ?>:</label><br style="clear: both;"/><input type="text" id="city" name="city" value="<?php echo @$user->city; ?>"/>
								
							</div>
							<div>
								<label><?php echo __t('Kraj'); ?>:</label><br style="clear: both;"/><input type="text" id="country_id" name="country_id" value="<?php echo @$user->country_id; ?>"/>
								
							</div>
							<input type="hidden" id="nip" name="nip" value="<?php echo @$user->nip; ?>"/>
							
							<input type="hidden" id="billing_bank" name="billing_bank" value="<?php echo @$user->billing_bank; ?>" readonly />
								
							<input type="hidden" id="billing_bank_account" name="billing_bank_account" value="<?php echo @$user->billing_bank_account; ?>" readonly />
								
							
							<input type="hidden" id="billing_payment_id" name="billing_payment_id" value="111"/>
								
							<input type="hidden" id="billing_payment_auth_key" name="billing_payment_auth_key" value="111"/>
							
							
							<br style="clear: both;"/>
							<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black"><?php echo __t('Anuluj'); ?></a>
							<input type="submit" onclick="validateForm_Data(); return false;" id="register_buttonData" value="<?php echo __t('Zastosuj'); ?>"/>
						
						</fieldset>
					</form>
			</div>
			
			<div class="account_about_layer layer_module">
			<h2><?php echo __t('Opis<span> konta'); ?></span></h2>
			<form method="post" action=""  enctype="multipart/form-data">
			<input type="hidden" name="description_tab" value="change_description_file"/>
			<fieldset class="forms" style="width: 100%;">
					<div style="width: 100%;">
						<label><?php echo __t('Opis'); ?>:</label><br style="clear: both;"/><textarea type="textarea" id="description" name="description"><?php echo @$user->description; ?></textarea>
								
					</div>
					<div>
								<label><?php echo __t('Obraz'); ?>:</label><br style="clear: both;"/><input type="file" id="logo" name="logo"/>
								<?php if( !empty( $user->logo ) ) : ?>
								<br style="clear: both;"/><br style="clear: both;"/>								
								<img src="/image.php/image-name.jpg?width=150&amp;image=/uploads/user/images/<?php echo $user->logo; ?>"/>
								<br style="clear: both;"/>				
								<?php endif; ?>
						
								
					</div>
					<br style="clear: both;"/>
				<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black">Anuluj</a>
				<input type="submit"  value="<?php echo __t('Zastosuj'); ?>"/>
					
							
						
						</fieldset>
					</form>
					
			</div>
							
							
			<div class="account_email_layer layer_module">
			<h2><?php echo __t('Zmień <span>e-mail</span>'); ?></h2>
			<form method="post" action="" name="form_edit_email">
					<fieldset class="forms" style="width: 100%;">
						<div>
							<label><?php echo __t('E-mail'); ?>:</label><br style="clear: both;"/><input type="text" id="_edit_email" name="email" value="<?php echo $user->email; ?>"/>
							
							<label><?php echo __t('Powtórz e-mail'); ?>:</label><br style="clear: both;"/><input type="text" id="_edit_email2" name="email2" value=""/>
							
							
						
						</div>
					
					
						<div>
							<div class="free_reg_btn">
								<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black"><?php echo __t('Anuluj'); ?></a>
								<input type="submit" onclick="validateFormEmail(); return false;" id="register_button" value="<?php echo __t('Zastosuj'); ?>"/>
							</div>
							
						</div>
						</fieldset>
					</form>
				</div>
				<div class="account_allegro_layer layer_module">
				<h2><?php echo __t('Integracja <span>Allegro</span>'); ?></h2>
					<form method="post" action="" name="form_edit5">
					<fieldset class="forms" style="width: 100%;">
					<input type="hidden" name="action" value="allegro"/>
						<div>
							<label><?php echo __t('Login allegro'); ?>:</label><br style="clear: both;"/><input id="_login_allegro" type="text" value="<?php echo @$user->login_allegro; ?>" name="login_allegro"/>
							
						</div>
						<div>
							<label><?php echo __t('Hasło allegro'); ?>:</label><br style="clear: both;"/><input id="_password_allegro" type="password" value="<?php echo @$user->password_allegro; ?>" name="password_allegro"/>
						</div>
						<div>
							<label><?php echo __t('Klucz webAPI'); ?>:</label><br style="clear: both;"/><input id="_webapi_key" type="text" value="<?php echo @$user->webapi_key; ?>" name="webapi_key"/>
							
						</div>
					
						<div>
						<div class="free_reg_btn">
								<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black"><?php echo __t('Anuluj'); ?></a>
								<input type="submit" id="change_button3" value="<?php echo __t('Zastosuj'); ?>"/>
							</div>
							
						</div>
						</fieldset>
					</form>
					</div>
				<div class="account_password_layer layer_module">
				<h2><?php echo __t('Zmień <span>hasło</span>'); ?></h2>
					<form method="post" action="" name="form_edit2">
					<fieldset class="forms" style="width: 100%;">
						<div>
							<label><?php echo __t('Stare hasło'); ?>:</label><br style="clear: both;"/><input id="_edit_oldpassword" type="password" name="oldpassword"/>
							
						</div>
						<div>
							<label><?php echo __t('Hasło'); ?>:</label><br style="clear: both;"/><input id="_edit_password" type="password" name="password"/>
						</div>
						<div>
							<label><?php echo __t('Powtórz hasło'); ?>:</label><br style="clear: both;"/><input id="_edit_re-password" type="password"/>
							
						</div>
					
						<div>
						<div class="free_reg_btn">
								<a href="http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" class="button_black"><?php echo __t('Anuluj'); ?></a>
								<input type="submit" onclick="validateForm2(); return false;" id="change_button" value="<?php echo __t('Zastosuj'); ?>"/>
							</div>
							
						</div>
						</fieldset>
					</form>
					</div>
				</div>
				
			</div>
		</div>

		<script>
$(window).ready( function() {
	$('#fv').click( function() {
		if( $('#fv:checked').length  ) {
			$('#fv_area').show();
		} else {
			$('#fv_area').hide();
		}
	});
});

function NIPIsValid(nip) {
        var weights = [6, 5, 7, 2, 3, 4, 5, 6, 7];
        nip = nip.replace(/[\s-]/g, '');
 
        if (nip.length == 10 && parseInt(nip, 10) > 0) {
                var sum = 0;
                for(var i = 0; i < 9; i++){
                        sum += nip[i] * weights[i];
                }                     
                return (sum % 11) == nip[9];
        }
        return false;           
}

	function validateForm_Data() {

		var error = 0;
		var form = document.forms['form_edit_data'];

	
		if( 1 == 1 ) {

			f = "#firstname";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#lastname";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#gallery_type";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			
			/*
			f = "#billing_bank_account";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#billing_bank";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			*/
		
			
			f = "#street";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#postcode";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			$(f).removeClass('input_error');
			if( $(f).val() == "" ) {
				$(f).addClass('input_error');
				error++;
			} else {
				if( $('#country_id').val() == 1 ) {	
					if (!$(f).val().match(/^[0-9]{2}[-][0-9]{3}$/)) {
					$(f).addClass('input_error');
					error++;
					}
				}
			}	
			
	
			f = "#city";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 
			
			<?php if( $user->profile_id != 3 AND $user->profile_id != 1 ) : ?>
			
			/*
			f = "#nip";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
		//	if( $('#country_id').val() == 1 ) {	
				if( !NIPIsValid( $(f).val() ) ) {

					$(f).addClass('input_error');
					error++;
				} 
		//	}
			*/
				
			
			f = "#company";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			
			if( $(f).val() == "" ) {

				$(f).addClass('input_error');
				error++;
			} 

			<?php endif; ?>
			
			
		} 

		if( error === 0 ) {
			form.submit();
		} else {
			alert('<?php echo __t('Błędnie wypełniony formularz'); ?>');
		}
	}
</script>
<script>
function validateForm2() {

		var error = 0;
		var form = document.forms['form_edit2'];


	
		field = "#_edit_password";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {

			$(field).addClass('input_error');
			error++;
		} 
		
		field = "#_edit_oldpassword";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {

			$(field).addClass('input_error');
			error++;

		} 
		
		field1 = "#_edit_password";
		field = "#_edit_re-password";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" || ($(field1).val() != $(field).val() ) ) {

			$(field).addClass('input_error');
			error++;
		} 

		if( error === 0 ) {
			form.submit();
		} else {
			alert('<?php echo __t('Błędnie wypełniony formularz'); ?>');
		}
	}
	
	function validateFormEmail() {

		var error = 0;
		var form = document.forms['form_edit_email'];

		field = "#_edit_email";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {
			$(field).addClass('input_error');
			error++;
		} else {
			if (!$(field).val().match(/^[0-9a-z_.-]+@([0-9a-z-]+.)+[a-z]{2,6}$/)) {
			$(field).addClass('input_error');
			error++;
			}
		}
		
		field0 = "#_edit_email";
		field = "#_edit_email2";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() != $(field0).val() ) {
			$(field).addClass('input_error');
			error++;
		}
	
		if( error === 0 ) {
			form.submit();
		} else {
			alert('<?php echo __t('Błędnie wypełniony formularz'); ?>');
		}
	}
</script>

				<script>
					$(window).ready( function() {
						$('.button_gray').click( function() {
							$('.button_gray').removeClass('button_gray_active');
							$(this).addClass('button_gray_active');
							var r = $(this).attr('rel');
							$('.layer_module').hide();
							$('.'+r).show();
							return false;
						});
					});
				</script>