Add candidate and employer templates, application form, and new password functionality
- Created 'dla-kandydata.php' template for candidates with job offers and registration options. - Developed 'dla-pracodawcy.php' template for employers detailing how Globelus works and registration for new employers. - Implemented 'advert-apply.php' for job applications, including form validation and file upload for CVs. - Added 'new-password.php' for users to set a new password with validation for password strength and matching.
This commit is contained in:
@@ -253,7 +253,9 @@
|
||||
Zdjęcie nad ogłoszeniem
|
||||
<br>
|
||||
<span>
|
||||
<small>Ważna informacja: jeśli chcesz, aby ta grafika była widoczna jednocześnie we wszystkich ogłoszeniach publikowanych z tego profilu dodaj ją w Profilu Pracodawcy.</small>
|
||||
<small>
|
||||
<strong>Uwaga! Jest to grafika dodatkowa, NIE logo, jeśli chcesz, aby ta grafika była widoczna jednocześnie we wszystkich Twoich ogłoszeniach dodaj ją w Profilu Pracodawcy. Zalecany rozmiar 730px x 200px.</strong>
|
||||
</small>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -267,9 +269,11 @@
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="advert-img-top">
|
||||
<? if (file_exists(\front\factory\GlobelusFirms::advert_add_img_top_url($this->advert['id']))) :?>
|
||||
<? if ( file_exists(\front\factory\GlobelusFirms::advert_add_img_top_url($this->advert['id']))) :?>
|
||||
<img src="/advert_add_img_top/<?= $this->advert['id']; ?>/<?= \S::get_token(); ?>" style="max-width: 200px;">
|
||||
<a class="btn btn-danger advert-img-top_delete" href="#">Usuń zdjęcie</a>
|
||||
<? elseif ( file_exists(\front\factory\GlobelusFirms::img_top_url( $this -> user['id'] ) ) ):?>
|
||||
<img src="/img_header/<?= $this-> user['id'];?>/<?= \S::get_token();?>" style="max-width: 200px;">
|
||||
<? endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -280,7 +284,9 @@
|
||||
Zdjęcie pod ogłoszeniem
|
||||
<br>
|
||||
<span>
|
||||
<small>Ważna informacja: jeśli chcesz, aby ta grafika była widoczna jednocześnie we wszystkich ogłoszeniach publikowanych z tego profilu dodaj ją w Profilu Pracodawcy.</small>
|
||||
<small>
|
||||
<strong>Uwaga! Jest to grafika dodatkowa, NIE logo, jeśli chcesz, aby ta grafika była widoczna jednocześnie we wszystkich Twoich ogłoszeniach dodaj ją w Profilu Pracodawcy. Zalecany rozmiar 730px x 200px.</strong>
|
||||
</small>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -297,6 +303,8 @@
|
||||
<? if (file_exists(\front\factory\GlobelusFirms::advert_add_img_bottom_url($this->advert['id']))) :?>
|
||||
<img src="/advert_add_img_bottom/<?= $this->advert['id']; ?>/<?= \S::get_token(); ?>" style="max-width: 200px;">
|
||||
<a class="btn btn-danger advert-img-bottom_delete" href="#">Usuń zdjęcie</a>
|
||||
<? elseif (file_exists(\front\factory\GlobelusFirms::img_bottom_url($this->user['id']))) :?>
|
||||
<img src="/img_bottom/<?= $this->user['id']; ?>/<?= \S::get_token(); ?>" style="max-width: 200px;">
|
||||
<? endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -356,38 +364,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-group row">
|
||||
<label form="contact_person2" class="col-12 col-sm-4"><?= ucfirst($lang['osoba-do-kontaktu']); ?>:</label>
|
||||
<div class="col-12 col-sm-8">
|
||||
<input type="text" class="form-control" name="contact_person2" value="<?= $this->advert['id'] ? htmlspecialchars($this->advert['contact_person2']) : htmlspecialchars($this->user['contact_person_2']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-group row">
|
||||
<label form="email2" class="col-12 col-sm-4"><?= ucfirst($lang['email']); ?>:</label>
|
||||
<div class="col-12 col-sm-8">
|
||||
<input type="text" class="form-control" name="email2" value="<?= $this->advert['id'] ? htmlspecialchars($this->advert['email2']) : htmlspecialchars($this->user['email_2']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="form-group row">
|
||||
<label form="phone2" class="col-12 col-sm-4"><?= ucfirst($lang['telefon']); ?>:</label>
|
||||
<div class="col-12 col-sm-8">
|
||||
<input type="text" class="form-control" name="phone2" value="<?= $this->advert['id'] ? htmlspecialchars($this->advert['phone2']) : htmlspecialchars($this->user['phone_2']); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
@@ -453,31 +429,125 @@
|
||||
});
|
||||
|
||||
$('body').on('submit', '#advert-add', function(e) {
|
||||
var text = $("#text").summernote('code');
|
||||
e.preventDefault();
|
||||
if (document.activeElement) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
var text = $('#text').summernote('code');
|
||||
text = text.replace(/(<([^>]+)>)/ig, '');
|
||||
text = text.replace(/ /g, '');
|
||||
|
||||
if ($.trim(text) === '') {
|
||||
$('#text').parent('.col-12').children('.note-editor').addClass('error');
|
||||
$('#text').parent('.col-12').children('.editor-error').removeClass('hidden');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#text').parent('.col-12').children('.note-editor').offset().top
|
||||
scrollTop: $('#text').parent('.col-12').children('.note-editor').offset().top - 100
|
||||
}, 100);
|
||||
e.preventDefault();
|
||||
return;
|
||||
} else {
|
||||
$('#text').parent('.col-12').children('.note-editor').removeClass('error');
|
||||
$('#text').parent('.col-12').children('.editor-error').addClass('hidden');
|
||||
}
|
||||
|
||||
var work_type = $( 'select[name="work_type"]' ).val();
|
||||
if ( work_type == 0 )
|
||||
{
|
||||
$( 'select[name="work_type"]' ).addClass( 'error' );
|
||||
$( 'select[name="work_type"]' ).focus();
|
||||
e.preventDefault();
|
||||
var work_type = $('select[name="work_type"]').val();
|
||||
if (work_type == 0) {
|
||||
$('select[name="work_type"]').addClass('error').focus();
|
||||
return;
|
||||
} else {
|
||||
$('select[name="work_type"]').removeClass('error');
|
||||
}
|
||||
else
|
||||
{
|
||||
$( 'select[name="work_type"]' ).removeClass( 'error' );
|
||||
|
||||
const headerInput = $('#advert-img-top')[0];
|
||||
const bottomInput = $('#advert-img-bottom')[0];
|
||||
const imageChecks = [];
|
||||
|
||||
if (headerInput && headerInput.files && headerInput.files.length) {
|
||||
imageChecks.push(getImageSize(headerInput.files[0]).then(size => {
|
||||
if (!isValidRatio(size)) {
|
||||
throw new Error('header');
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
if (bottomInput && bottomInput.files && bottomInput.files.length) {
|
||||
imageChecks.push(getImageSize(bottomInput.files[0]).then(size => {
|
||||
if (!isValidRatio(size)) {
|
||||
throw new Error('bottom');
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Promise.allSettled(imageChecks).then(results => {
|
||||
const rejected = results.find(r => r.status === 'rejected');
|
||||
if (rejected) {
|
||||
let scrollTarget;
|
||||
let label;
|
||||
|
||||
if (rejected.reason.message === 'header') {
|
||||
scrollTarget = $('#advert-img-top');
|
||||
label = 'górny';
|
||||
} else if (rejected.reason.message === 'bottom') {
|
||||
scrollTarget = $('#advert-img-bottom');
|
||||
label = 'dolny';
|
||||
}
|
||||
|
||||
if (scrollTarget && scrollTarget.length) {
|
||||
$('html, body').animate({
|
||||
scrollTop: scrollTarget.offset().top - 100
|
||||
}, 200);
|
||||
}
|
||||
|
||||
showAlert(`Obrazek ${label} ma nieprawidłowe proporcje. Dozwolony zakres to 2.66:1 do 8:1.`);
|
||||
return;
|
||||
}
|
||||
|
||||
e.target.submit();
|
||||
});
|
||||
|
||||
function isValidRatio({ width, height }) {
|
||||
const ratio = width / height;
|
||||
return ratio >= 2.6667 && ratio <= 8.0;
|
||||
}
|
||||
|
||||
function getImageSize(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = function () {
|
||||
resolve({ width: this.naturalWidth, height: this.naturalHeight });
|
||||
};
|
||||
img.onerror = () => reject(new Error('invalid-image'));
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = function (e) {
|
||||
img.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
}
|
||||
|
||||
function showAlert(message) {
|
||||
$.alert({
|
||||
title: 'Błąd',
|
||||
icon: 'fa fa-exclamation',
|
||||
content: message,
|
||||
type: 'blue',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
autoClose: 'confirm|10000',
|
||||
columnClass: 'large',
|
||||
theme: 'modern',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Zamknij',
|
||||
btnClass: 'btn-blue',
|
||||
keys: ['enter'],
|
||||
action: function () {}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user