Current File : /home/users/barii/public_html/finansenl.com.pl/wodki/application/views/account/item.php
			<?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'); ?>
		
				<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;"/><br style="clear: both;"/>
				
					
					<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'item'  AND Request::current()->param('act') == '' ) echo 'button_gray_active'; ?>" href="account/item"><?php echo __t('Twoje kody'); ?></a></li>
					<a class="button_gray <?php if( Request::current()->controller() == 'Account' AND  Request::current()->action() == 'item'  AND Request::current()->param('act') == 'edit') echo 'button_gray_active'; ?>" href="account/item/edit"><?php echo __t('Dodaj kod'); ?></a></li>
					
				<br style="clear: both;"/><br style="clear: both;"/><br style="clear: both;"/>
				<h3><?php echo __t('Sortowanie'); ?></h3><br style="clear: both;"/>
				<form action="" method="get">
					<fieldset>
						<label for="f1"></label>
						<select name="sort" onchange="this.form.submit();">
						<option value="date" <?php if( !empty( $sort ) AND $sort == 'id') echo 'SELECTED="SELECTED"'; ?>><?php echo __t('By ID'); ?></option>
						<option value="date" <?php if( !empty( $sort ) AND $sort == 'date') echo 'SELECTED="SELECTED"'; ?>><?php echo __t('By date'); ?></option>
					
						</select>
						<input type="submit" style="display: none;" value="<?php echo __t('Sortuj'); ?>"/>
					</fieldset>
				</form>
				<br style="clear: both;"/>
				<h2><?php echo __t('Kody <span>użytkownika</span>'); ?></h2>
					<table class="dataTable" id="listing">
					<thead>
						<tr>
							<th width="20">ID</th>
							
							<th width="600"><?php echo __t('Kod'); ?></th>
							<th><?php echo __t('Akcja'); ?></th>
						</tr>
					</thead>
					<tbody>
						<?php $i=0; foreach( $item as $row ) : $i++; ?>
						<tr class="<?php echo $i%2==0 ? 'even' : ''; ?>">
							<td><?php echo $row->id; ?></td>
							
							<td><?php echo $row->title; ?> </td>
							<td>
								<a href="account/item/edit/<?php echo $row->id; ?>"><img src="html/images/action_edit.gif" alt="<?php echo __t('Edytuj'); ?>" title="<?php echo __t('Edytuj'); ?>"/></a>
								<a href="account/item/delete/<?php echo $row->id; ?>"><img src="html/images/action_delete.gif" alt="<?php echo __t('Usuń'); ?>" title="<?php echo __t('Usuń'); ?>"/></a>
							</td>
						</tr>
						
						<?php endforeach; ?>
					</table>
			
				</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 = "#company";
			$(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++;
					}
				}
			}	
	
			if( $(f).val() == "" ) {

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

				$(f).addClass('input_error');
				error++;
			} 
			
			f = "#nip";
			$(f).removeClass('input_error');
			$('.input_error_text').remove();
			if( $('#country_id').val() == 1 ) {	
				if( !NIPIsValid( $(f).val() ) ) {

					$(f).addClass('input_error');
					error++;
				} 
			} else {
				if( $(f).val() == "" ) {

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

		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 = "#password";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( $(field).val() == "" ) {

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

			$(field).addClass('input_error');
			error++;
		} 
		
		field1 = "#password";
		field = "#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 validateForm() {

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

		field = "#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++;
			}
		}
		/*
		field = "#newsletter";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( !$(field).is(':checked') ) {
			$(field).addClass('input_error');
			error++;
			alert('Zaakceptuj otrzymywanie newslettera');
		}
		
		field = "#newsletter2";
		$(field).removeClass('input_error');
		$('.input_error_text').remove();
		
		if( !$(field).is(':checked') ) {
			$(field).addClass('input_error');
			error++;
			alert('Zaakceptuj zgodę na otrzymywanie newslettera o nowych wersjach zakupionych skryptów');
		}
		*/
		field0 = "#email";
		field = "#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>