Files
globelus.pl/templates_user/globelus/candidates/profile-edit.php
Jacek Pyziak 43d74c60d5 Refactor profile-edit, candidate-profile, proposed-candidates, and registration forms
- Added a new div container in profile-edit.php for better layout structure.
- Removed the back button from candidate-profile.php to streamline navigation.
- Updated proposed-candidates.php to open candidate links in a new tab for improved user experience.
- Modified registration forms to make the profile visibility checkbox optional, enhancing user flexibility.
2025-06-12 00:35:15 +02:00

686 lines
35 KiB
PHP

<? global $lang;?>
<div id="user-panel">
<div class="mini-buttons" id="buttons">
<div class="btn active">
<?= $lang[ 'moj-profil' ];?>
</div>
<a href="/panel-kandydata/wyslane-aplikacje" class="btn">
<?= $lang[ 'wyslane-aplikacje' ];?>
</a>
<a href="/panel-kandydata/obserwowane-oferty" class="btn">
<?= $lang[ 'obserwowane-oferty-pracy' ];?>
</a>
<a href="/panel-kandydata/ustawienia-konta" class="btn">
<?= $lang[ 'ustawienia-konta' ];?>
</a>
</div>
<div class="mini-box fluid">
<div class="title">
<?= ucfirst( $lang[ 'edycja-profilu' ] );?>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="content profil">
<form method="POST" action="/globelusCandidates/data_save/" enctype="multipart/form-data">
<div class="step-title">
<?= ucfirst( $lang[ 'krok' ] );?> 1 - <span><?= $lang[ 'kandydat-profil-krok-1-opis' ];?></span>
</div>
<div class="row">
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="name" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'imie' ] );?>:</label>
<div class="col-12 col-sm-8">
<input type="text" id="name" name="name" class="form-control" value="<?= htmlspecialchars( $this -> g_user[ 'name' ] );?>">
</div>
</div>
</div>
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="surname" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'nazwisko' ] );?>:</label>
<div class="col-12 col-sm-8">
<input type="text" id="surname" name="surname" class="form-control" value="<?= htmlspecialchars( $this -> g_user[ 'surname' ] );?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="email" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'adres-email' ] );?>:</label>
<div class="col-12 col-sm-8 input-icon">
<input type="text" id="email" name="email" class="form-control" value="<?= htmlspecialchars( $this -> g_user[ 'email' ] );?>" readonly="readonly">
</div>
</div>
</div>
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="phone" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'telefon' ] );?>:</label>
<div class="col-12 col-sm-8">
<input type="text" id="phone" name="phone" class="form-control" value="<?= htmlspecialchars( $this -> g_user[ 'phone' ] );?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="date_of_birth" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'data-urodzenia' ] );?>:</label>
<div class="col-12 col-sm-8 input-icon date_of_birth">
<input type="text" id="date_of_birth" name="date_of_birth" class="form-control date-birth" value="<? if ( \front\factory\Globelus::validate_date( $this -> g_user[ 'date_of_birth' ] ) ) echo date( 'd.m.Y', strtotime( $this -> g_user[ 'date_of_birth' ] ) );?>">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="sex" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'plec' ] );?>:</label>
<div class="col-12 col-sm-8">
<select id="sex" name="sex" class="form-control">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( $this -> g_user[ 'sex' ] === '0' ):?>selected="selected"<? endif;?>><?= $lang[ 'kobieta' ];?></option>
<option value="1" <? if ( $this -> g_user[ 'sex' ] === '1' ):?>selected="selected"<? endif;?>><?= $lang[ 'mezczyzna' ];?></option>
</select>
</div>
</div>
</div>
</div>
<hr/>
<div class="step-title">
<?= ucfirst( $lang[ 'krok' ] );?> 2 - <span><?= $lang[ 'kandydat-profil-krok-2-opis' ];?></span>
</div>
<div class="row important">
<div class="col-12">
<div class="info">Wypełnij aby zwiększyć swoją szansę na znalezienie poszukiwanej pracy.</div>
<div class="form-group row">
<label form="positions" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'w-jakim-zawodzie-szukasz-pracy' ] );?></label>
<div class="col-12">
<? if ( is_array( $this -> g_user[ 'positions' ] ) ):?>
<? foreach ( $this -> g_user[ 'positions' ] as $position ):?>
<? $position_counter++;?>
<div class="row positions positions_<?= $position_counter;?>" counter="<?= $position_counter;?>">
<div class="col-12 col-md-6 mb5">
<select counter="<?= $position_counter;?>" name="positions[]" <? if ( $this -> g_user[ 'inexperience' ] ):?>readonly="readonly"<? endif;?> class="form-control positions" placeholder="wybierz stanowisko">
<option value="">--- <?= $lang['wybierz']; ?> ---</option>
<? if ( is_array( $this -> positions ) ): foreach ( $this -> positions as $position_single ):?>
<option value="<?= $position_single['id']; ?>" <? if ( $position_single['id'] == $position['id_position'] ):?>selected="selected" <? endif; ?>><?= htmlspecialchars( $position_single['name'] );?></option>
<? endforeach; endif;?>
</select>
</div>
<div class="col-12 col-md-6 mb5">
<select name="positions_experience[]" counter="<?= $position_counter;?>" <? if ( $this -> g_user[ 'inexperience' ] ):?>readonly="readonly"<? endif;?> class="form-control positions_experience">
<option value="">--- wybierz doświadczenie ---</option>
<?
$positions_experience = \front\factory\Globelus::positions_experience();
if ( is_array( $positions_experience ) ): foreach ( $positions_experience as $key => $val ):
?>
<option value="<?= $key;?>" <? if ( $position[ 'experience' ] == $key ):?>selected="selected"<? endif;?>><?= $val;?></option>
<?
endforeach;
endif;
?>
</select>
</div>
</div>
<? endforeach;?>
<? if ( $position_counter < 5 ):?>
<? $position_counter++;?>
<div class="row positions positions_<?= $position_counter;?>" counter="<?= $position_counter;?>">
<div class="col-12 col-md-6 mb5">
<select counter="<?= $position_counter;?>" name="positions[]" <? if ( $this -> g_user[ 'inexperience' ] ):?>readonly="readonly"<? endif;?> class="form-control positions" placeholder="wybierz stanowisko">
<option value="">--- <?= $lang['wybierz']; ?> ---</option>
<? if ( is_array( $this -> positions ) ): foreach ( $this -> positions as $position_single ):?>
<option value="<?= $position_single['id']; ?>"><?= htmlspecialchars( $position_single['name'] );?></option>
<? endforeach; endif;?>
</select>
</div>
<div class="col-12 col-md-6 mb5">
<select name="positions_experience[]" counter="<?= $position_counter;?>" <? if ( $this -> g_user[ 'inexperience' ] ):?>readonly="readonly"<? endif;?> class="form-control positions_experience">
<option value="">--- wybierz doświadczenie ---</option>
<?
$positions_experience = \front\factory\Globelus::positions_experience();
if ( is_array( $positions_experience ) ): foreach ( $positions_experience as $key => $val ):
?>
<option value="<?= $key;?>"><?= $val;?></option>
<?
endforeach;
endif;
?>
</select>
</div>
</div>
<? endif;?>
<? endif;?>
</div>
</div>
<div class="form-group row">
<div class="col-12">
<input type="checkbox" name="inexperience" id="inexperience" <? if ( $this -> g_user[ 'inexperience' ] ):?>checked="checked"<? endif;?>> <?= $lang[ 'nie-posiadam-doswiadczenia' ];?>
</div>
</div>
</div>
</div>
<div class="row options important">
<div class="col-12">
<div class="info">Wypełnij aby zwiększyć swoją szansę na znalezienie poszukiwanej pracy.</div>
<div class="form-group row">
<label form="categories" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'w-jakiej-branzy-szukasz-pracy' ] );?></label>
</div>
<? $i = 1;?>
<? if ( is_array( $this -> categories ) ): foreach ( $this -> categories as $category ):?>
<? $i++;?>
<? if ( $i % 2 == 0 ):?>
<div class="row">
<? endif;?>
<div class="col-12 col-sm-6">
<input type="checkbox" name="categories[]" <?
foreach ( $this -> g_user[ 'categories' ] as $user_category ): if ( $category[ 'id' ] == $user_category[ 'id' ] )
echo 'checked="checked"';
endforeach;
?> value="<?= $category[ 'id' ];?>"> <?= $category[ 'name' ];?>
</div>
<? if ( $i % 2 == 1 ):?>
</div>
<? endif;?>
<?
endforeach;
endif;
?>
</div>
</div>
<div class="col-12">
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="languages" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'jakie-znasz-jezyki' ] );?></label>
<div class="col-12">
<? if ( is_array( $this -> g_user[ 'languages' ] ) ):?>
<? foreach ( $this -> g_user[ 'languages' ] as $language ):?>
<? $j++;?>
<div class="row languages languages_<?= $j;?>" counter="<?= $j;?>">
<div class="col-12 col-md-6 mb5" <? if ( $j > 1 and!$language[ 'language' ] ):?>style="display: none;"<? endif;?>>
<input type="text" counter="<?= $j;?>" name="languages[]" class="form-control" placeholder="<?= $lang[ 'jezyk' ];?>" value="<?= htmlspecialchars( $language[ 'language' ] );?>">
</div>
<div class="col-12 col-md-6 mb5" <? if ( $j > 1 and!$language[ 'experience' ] ):?>style="display: none;"<? endif;?>>
<select name="languages_experience[]" counter="<?= $j;?>" class="form-control">
<option value="">--- <?= $lang[ 'wybierz' ];?> ---</option>
<?
$languages_experience = \front\factory\Globelus::languages_experience();
if ( is_array( $languages_experience ) ): foreach ( $languages_experience as $key => $val ):
?>
<option value="<?= $key;?>" <? if ( $language[ 'experience' ] == $key ):?>selected="selected"<? endif;?>><?= $val;?></option>
<?
endforeach;
endif;
?>
</select>
</div>
</div>
<? endforeach;?>
<? if ( $j < 3 ):?>
<? $j++;?>
<div class="row languages languages_<?= $j;?>" counter="<?= $j;?>">
<div class="col-12 col-md-6 mb5">
<input type="text" counter="<?= $j;?>" name="languages[]" class="form-control" placeholder="<?= $lang[ 'jezyk' ];?>" value="">
</div>
<div class="col-12 col-md-6 mb5" <? if ( $j > 1 and!$language[ 'experience' ] ):?>style="display: none;"<? endif;?>>
<select name="languages_experience[]" counter="<?= $j;?>" class="form-control">
<option value="">--- <?= $lang[ 'wybierz' ];?> ---</option>
<?
$languages_experience = \front\factory\Globelus::languages_experience();
if ( is_array( $languages_experience ) ): foreach ( $languages_experience as $key => $val ):
?>
<option value="<?= $key;?>"><?= $val;?></option>
<?
endforeach;
endif;
?>
</select>
</div>
</div>
<? endif;?>
<? endif;?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="countries" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'w-jakim-kraju-szukasz-pracy' ] );?> (max. 6)</label>
<div class="col-12">
<select name="countries[]" class="form-control countries" multiple placeholder="<?= $lang[ 'podaj-kraj' ];?>">
<?
$countries = \front\factory\Globelus::countries();
if ( is_array( $countries ) ): foreach ( $countries as $country ):
?>
<option value="<?= $country[ 'id' ];?>" <? if ( in_array( $country[ 'name' ], $this -> g_user[ 'countries' ] ) ):?>selected="selected"<? endif;?>><?= $country[ 'name' ];?></option>
<?
endforeach;
endif;
?>
</select>
</div>
</div>
</div>
</div>
<div class="row voivodeships">
<div class="col-12">
<div class="form-group row">
<label form="voivodeships" class="col-12 text-left text-bold">W jakim województwie szukasz pracy?</label>
<div class="col-12">
<select name="voivodeships[]" class="form-control voivodeships" multiple placeholder="--- wybierz województwo ---">
<? $voivodeships = \front\factory\Globelus::get_voivodeships_list(); if ( is_array( $voivodeships ) ): foreach ( $voivodeships as $voivodeship ):?>
<option value="<?= $voivodeship[ 'id' ];?>" <? if ( in_array( $voivodeship[ 'name' ], $this -> g_user[ 'voivodeships' ] ) ):?>selected="selected"<? endif;?>><?= $voivodeship[ 'name' ];?></option>
<? endforeach; endif;?>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="status_of_availability" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'dostepnosc' ] );?>:</label>
<div class="col-12 col-md-6">
<select name="status_of_availability" id="status_of_availability" class="form-control" placeholder="<?= $lang[ 'wybierz' ];?>">
<?
$status = \front\factory\Globelus::availability_status();
if ( is_array( $status ) ): foreach ( $status as $key => $val ):
?>
<option value="<?= $key;?>" <? if ( $this -> g_user[ 'status_of_availability' ] == $key ):?>selected="selected"<? endif;?>><?= $val;?></option>
<?
endforeach;
endif;
?>
</select>
</div>
<div class="col-12 col-md-6">
<div id="date-of-availability-content" <? if ( $this -> g_user[ 'status_of_availability' ] != 2 ):?>style="display: none;"<? endif;?>>
<div class="form-group row">
<div class="col-12 col-md-6 input-icon date_of_availability">
<input type="text" id="date_of_availability" name="date_of_availability" class="form-control date" value="<? if ( $this -> g_user[ 'date_of_availability' ] and $this -> g_user[ 'date_of_availability' ] != '0000-00-00' ) echo htmlspecialchars( $this -> g_user[ 'date_of_availability' ] );?>">
<i class="fa fa-calendar"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="experience_abroad" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'czy-masz-doswiadczenie-w-pracy-za-granica' ] );?></label>
<div class="col-12">
<select name="experience_abroad" class="form-control">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( $this -> g_user[ 'experience_abroad' ] === '0' ):?>selected="selected"<? endif;?>>nie</option>
<option value="1" <? if ( $this -> g_user[ 'experience_abroad' ] === '1' ):?>selected="selected"<? endif;?>>tak</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="accommodation" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'czy-potrzebujesz-zakwaterowania' ] );?></label>
<div class="col-12">
<select name="accommodation" class="form-control">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( $this -> g_user[ 'accommodation' ] === '0' ):?>selected="selected"<? endif;?>>nie</option>
<option value="1" <? if ( $this -> g_user[ 'accommodation' ] === '1' ):?>selected="selected"<? endif;?>>tak</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="driving_license" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'czy-posiadasz-prawo-jazdy' ] );?></label>
<div class="col-12">
<select name="driving_license" class="form-control">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( $this -> g_user[ 'driving_license' ] === '0' ):?>selected="selected"<? endif;?>>nie</option>
<option value="1" <? if ( $this -> g_user[ 'driving_license' ] === '1' ):?>selected="selected"<? endif;?>>tak</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="own_car" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'czy-dysponujesz-wlasnym-samochodem' ] );?></label>
<div class="col-12">
<select name="own_car" class="form-control">
<option value="">--- wybierz ---</option>
<option value="0" <? if ( $this -> g_user[ 'own_car' ] === '0' ):?>selected="selected"<? endif;?>>nie</option>
<option value="1" <? if ( $this -> g_user[ 'own_car' ] === '1' ):?>selected="selected"<? endif;?>>tak</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group row">
<label form="own_car" class="col-12 text-left text-bold"><?= ucfirst( $lang[ 'kandydat-edycja-inne' ] );?></label>
<div class="col-12">
<textarea name="other_information" id="other_information"><?= $this -> g_user[ 'other_information' ];?></textarea>
</div>
</div>
</div>
</div>
<hr/>
<div class="step-title">
<?= ucfirst( $lang[ 'krok' ] );?> 3 - <span><?= $lang[ 'kandydat-profil-krok-3-opis' ];?></span>
</div>
<div class="row">
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="cv" class="col-12 col-sm-4"><?= strtoupper( $lang[ 'cv' ] );?> (max. 5mb):</label>
<div class="col-12 col-sm-8 pt10">
<input type="file" id="cv" name="cv" <? if ( !file_exists( 'files/cv/' . $this -> g_user[ 'cv_hash' ]{0} . '/' . $this -> g_user[ 'cv_hash' ]{1} . '/' . $this -> g_user[ 'cv_hash' ] ) ):?>required<? endif;?>>
<? if ( file_exists( \front\factory\GlobelusCandidates::cv_url( $this -> g_user[ 'id' ] ) ) ):?><a href="/cv/<?= $this -> g_user[ 'id' ];?>/<?= \S::get_token();?>/" class="mt10 ib"><?= $lang[ 'zobacz-aktualne-cv' ];?></a><? endif;?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6">
<div class="form-group row">
<label form="avatar" class="col-12 col-sm-4"><?= ucfirst( $lang[ 'zdjecie' ] );?> (max. 1mb):</label>
<div class="col-12 col-sm-8 pt10">
<input type="file" id="avatar" name="avatar">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6">
<div class="form-group row">
<div class="col-12 mt20">
<a href="/panel-kandydata/profil" class="btn btn-danger mr15"><?= ucfirst( $lang[ 'anuluj' ] );?></a>
<input type="submit" value="<?= ucfirst( $lang[ 'zatwierdz-zmiany' ] );?>" class="btn btn-success">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<link class="footer" rel="stylesheet" type="text/css" href="/plugins/datepicker/css/bootstrap-datepicker.standalone.css">
<link class="footer" rel="stylesheet" type="text/css" href="/plugins/selectize/css/selectize.bootstrap3.css">
<link class="footer" rel="stylesheet" type="text/css" href="/plugins/summernote/summernote-lite.css">
<script class="footer" type="text/javascript" src="/plugins/summernote/summernote-lite.js"></script>
<script class="footer" type="text/javascript" src="/plugins/summernote/lang/summernote-pl-PL.js"></script>
<script class="footer" type="text/javascript" src="/libraries/framework/vendor/plugins/moment/moment.js"></script>
<script class="footer" type="text/javascript" src="/libraries/framework/vendor/plugins/moment/pl.js"></script>
<script class="footer" type="text/javascript" src="/plugins/datepicker/js/bootstrap-datepicker.js"></script>
<script class="footer" type="text/javascript" src="/plugins/datepicker/locales/bootstrap-datepicker.pl.min.js"></script>
<script class="footer" type="text/javascript" src="/plugins/selectize/js/selectize.js"></script>
<script class="footer" type="text/javascript" src="/plugins/jquery-validation/core.js"></script>
<script class="footer" type="text/javascript" src="/plugins/jquery-validation/localization/messages_pl.js"></script>
<script class="footer" type="text/javascript">
$( function ( )
{
<? for ( $z = 1; $z <= $position_counter; $z++ ):?>
$( '.positions_<?= $z;?> select.positions' ).selectize({
maxItems: 1
});
<? endfor;?>
$( 'body' ).on( 'change', '.countries', function()
{
if ( $.inArray( "1", $( this ).val() ) > -1 )
{
$( '.row.voivodeships' ).show();
}
else
{
$( '.row.voivodeships' ).hide();
}
});
$( '#other_information' ).summernote( {
height: 200,
lang: 'pl-PL',
toolbar: [
['font', ['bold', 'underline', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']]
]
} );
$( 'body' ).on( 'submit', '#user-panel form', function( e )
{
var validExtensions = [ "doc", "pdf", "docx", "rtf", "jpeg", "jpg", "png", "odt" ];
var extension = $( '#user-panel form #cv' ).val( ).split( '.' ).pop( );
if ( extension != '' && validExtensions.indexOf( extension ) == - 1 )
{
e.preventDefault( );
$.alert({
itle: '<?= ucfirst( $lang[ 'blad' ] );?>',
icon: 'fa fa-exclamation',
content: '<?= $lang[ 'cv-niedozwolony-format-pliku' ];?>',
type: 'blue',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons: {
confirm: {
text: '<?= $lang[ 'zamknij' ];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function( ) {}
}
}
});
}
if (
$( "#user-panel form #avatar" )[0].files.length
&&
$( '#user-panel form #avatar' )[0].files[0].type != 'image/jpeg'
&&
$( '#user-panel form #avatar' )[0].files[0].type != 'image/png' )
{
e.preventDefault( );
$.alert(
{
title: '<?= ucfirst( $lang[ 'blad' ] );?>',
icon: 'fa fa-exclamation',
content: '<?= $lang[ 'zdjecie-niedozwolony-format-pliku' ];?>',
type: 'blue',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
confirm:
{
text: '<?= $lang[ 'zamknij' ];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function( ) {}
}
}
} );
}
} );
$( 'body' ).on( click_event, '.input-icon .fa', function( )
{
$( this ).parent( ).children( 'input' ).focus( );
} );
$( 'body' ).on( click_event, '#inexperience', function( )
{
if ( $( this ).is( ':checked' ) )
$( '.positions select' ).attr( 'readonly', 'readonly' );
else
$( '.positions select' ).removeAttr( 'readonly' );
} );
/* dodaj kolejne stanowiska */
$( 'body' ).on( 'change', '.positions select', function( )
{
var counter = parseInt( $( this ).attr( 'counter' ) );
if ( counter < 5 && $( '.positions_' + counter + ' select.positions' ).val( ) !== '' && $( '.positions_' + counter + ' select.positions_experience' ).val( ) !== '' && !$( '.positions_' + ( counter + 1 ) ).length )
{
$( '.positions_' + counter ).after( '<div class="row positions_' + ( counter + 1 ) + ' positions" counter="' + ( counter + 1 ) + '">'
+ '<div class="col-12 col-md-6 mb5">'
+ '<select counter="' + ( counter + 1 ) + '" name="positions[]" class="form-control positions" placeholder="wybierz stanowisko">'
+ '<option value="">--- <?= $lang['wybierz']; ?> ---</option>'
<? if ( is_array( $this -> positions ) ): foreach ( $this -> positions as $position_single ):?>
+ '<option value="<?= $position_single['id']; ?>"><?= htmlspecialchars( $position_single['name'] );?><\/option>'
<? endforeach; endif;?>
+ '<\/select>'
+ '<\/div>'
+ '<div class="col-12 col-md-6 mb5">'
+ '<select name="positions_experience[]" counter="' + ( counter + 1 ) + '" class="form-control">'
+ '<option value="">--- <?= $lang[ 'wybierz' ];?> ---<\/option>'
<? $positions_experience = \front\factory\Globelus::positions_experience(); if ( is_array( $positions_experience ) ): foreach ( $positions_experience as $key => $val ):?>
+ '<option value="<?= $key;?>"><?= $val;?><\/option>'
<? endforeach; endif;?>
+ '<\/select>'
+ '<\/div>'
+ '<\/div>' );
$( '.positions_' + ( counter + 1 ) + ' select.positions' ).selectize({
maxItems: 1
});
};
} );
$( 'body' ).on( 'change', '.languages input, .languages select', function( )
{
var counter = parseInt( $( this ).attr( 'counter' ) );
if (
counter < 3
&&
$( '.languages_' + counter + ' input' ).val( ) !== ''
&&
$( '.languages_' + counter + ' select' ).val( ) !== ''
&&
!$( '.languages_' + ( counter + 1 ) ).length )
{
$( '.languages_' + counter ).after( '<div class="row languages_' + ( counter + 1 ) + ' languages" counter="' + ( counter + 1 ) + '">'
+ '<div class="col-12 col-md-6 mb5">'
+ '<input type="text" counter="' + ( counter + 1 ) + '" name="languages[]" class="form-control" placeholder="<?= $lang[ 'jezyk' ];?>" value="">'
+ '<\/div>'
+ '<div class="col-12 col-md-6 mb5">'
+ '<select name="languages_experience[]" counter="' + ( counter + 1 ) + '" class="form-control">'
+ '<option value="">--- <?= $lang[ 'wybierz' ];?> ---</option>'
<?
$languages_experience = \front\factory\Globelus::languages_experience();
if ( is_array( $languages_experience ) ): foreach ( $languages_experience as $key => $val ):
?>
+ '<option value="<?= $key;?>"><?= $val;?></option>'
<?
endforeach;
endif;
?>
+ '<\/select>'
+ '<\/div>'
+ '<\/div>' );
};
} );
jQuery.validator.addMethod( "customphone", function( phone_number, element ) {
return this.optional( element ) || phone_number.match( /^(\+[0-9]{2}|)( |)(([0-9]{9})|([0-9]{3} [0-9]{3} [0-9]{3}))$/ );
}, "Podaj prawidłowy numer telefonu" );
$( "#user-panel form" ).validate( {
focusInvalid: false,
invalidHandler: function( form, validator ) {
if ( !validator.numberOfInvalids( ) )
return;
$( 'html, body' ).animate( {
scrollTop: $( validator.errorList[0].element ).offset( ).top
}, 500 );
},
errorPlacement: function( error, element ) {
$( element )
.closest( "div" )
.append( error );
},
errorElement: "span",
rules: {
'name': { required: true },
'surname': { required: true },
'categories[]': { required: true },
'positions[]': { required: {
depends: function( elem ) {
return !$( '#inexperience' ).is( ':checked' );
}
} },
'positions_experience[]': { required: {
depends: function( elem ) {
return !$( '#inexperience' ).is( ':checked' );
}
} },
'cv': { required: {
depends: function( elem ) {
return $( '#cv' ).attr( 'required' ) ? true : false;
}
}
}
},
messages: {
'categories[]': { required: 'Wybierz co najmniej jedną branżę' },
}
} );
$( 'input[type="text"].date-birth' ).datepicker( {
format: "dd.mm.yyyy",
language: 'pl'
} );
$( 'input[type="text"].date' ).datepicker( {
format: "yyyy-mm-dd",
language: 'pl'
} );
$( 'body' ).on( click_event, '.date_of_birth .fa-calendar', function( e ){
e.preventDefault( );
return false;
} );
$( 'body' ).on( click_event, '.date_of_availability .fa-calendar', function( e ){
e.preventDefault( );
return false;
} );
$( '.countries' ).selectize( {
maxItems: 6
} );
$( 'select.voivodeships' ).selectize();
$( 'body' ).on( 'change', '#status_of_availability', function( )
{
var status = $( this ).val( );
if ( status != 2 )
$( '#date-of-availability-content' ).hide( );
else
$( '#date-of-availability-content' ).show( );
} );
if ( $.inArray( "1", $( '.countries' ).val() ) > -1 )
{
$( '.row.voivodeships' ).show();
}
else
{
$( '.row.voivodeships' ).hide();
}
} );
</script>