Commit b7509a7e authored by Simonas's avatar Simonas

Contact forms complete, small fixes

parent 339b5796
......@@ -17,7 +17,7 @@
### DB backup
- `C:\web\dev.biuro> docker exec -i dev-biuro-mysql mysqldump -udev_user -pY6V6bFkD6@GyD!wTShgFmWz! --default-character-set=utf8 dev_biuro > docker/mariadb/data-004.sql`
- `sudo docker exec -i biuro-staging-mysql mysqldump -ustaging_user -p'qzl8pMNV^gZ&c1!7ebVsXqQh' --default-character-set=utf8 staging_biuro > docker/mariadb/data-008.sql`
- `sudo docker exec -i biuro-staging-mysql mysqldump -ustaging_user -p'qzl8pMNV^gZ&c1!7ebVsXqQh' --default-character-set=utf8 staging_biuro > docker/mariadb/data-010.sql`
### DB restore
- `C:\web\dev.biuro> docker exec -i dev-biuro-mysql mysql -udev_user -pY6V6bFkD6@GyD!wTShgFmWz! --default-character-set=utf8 dev_biuro < docker/mariadb/data-004.sql`
......@@ -112,10 +112,10 @@ Can't share C drive
- docker load --input ourdemo.tar
- docker build -t biuro/web:0.0.16 .
- docker build -t biuro/web:0.0.17 .
- docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs
- sudo docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs
- docker push biuro/web:0.0.16
- docker push biuro/web:0.0.17
- sudo chown -R www-data:www-data wordpress/wp-content/plugins
......
......@@ -86,7 +86,7 @@ class Biuro_Contacts_Activator {
add_option( 'biuro-contacts_db_version', $plugin_name_db_version );
}
}
public static function create_db_employers() {
global $wpdb;
......@@ -107,6 +107,7 @@ class Biuro_Contacts_Activator {
updated datetime DEFAULT '0000-00-00 00:00:00',
confirm tinyint DEFAULT 0,
referer varchar(255) DEFAULT null,
lead_id int DEFAULT null,
PRIMARY KEY (id)
) $charset_collate;";
......@@ -120,8 +121,8 @@ class Biuro_Contacts_Activator {
dbDelta( $sql );
add_option( 'biuro-employers_db_version', $plugin_name_db_version );
}
}
}
}
......@@ -43,7 +43,7 @@ class Biuro_Contacts_Public {
const FIELDS = [
'employees' => ['name', 'phone', 'email', 'agree'],
'employers' => ['name', 'phone', 'email', 'agree'],
'position' => ['name', 'phone', 'email', 'agree', 'city', 'city_id', 'message', 'confirm', 'job_id'],
'position' => ['name', 'phone', 'email', 'agree', 'city', 'city_id', 'message', 'confirm', 'job_id', 'cv'],
];
const DB_NAMES = [
......@@ -150,8 +150,6 @@ class Biuro_Contacts_Public {
$success = ['status' => 'success', 'message' => ''];
$required = ['status' => 'error', 'message' => __('This field is required', 'biuro-contacts')];
// if ($str == 'employees' || $str == 'position'):
switch($key) {
case 'name':
......@@ -210,17 +208,16 @@ class Biuro_Contacts_Public {
return $success;
case 'cv':
case 'city':
case 'city_id':
case 'message':
case 'confirm':
case 'job_id':
//?case 'company':
case 'company':
return $empty;
}
// endif;
return $success;
}
......@@ -422,18 +419,24 @@ class Biuro_Contacts_Public {
}
if ($canSubmit):
$data['referer'] = ($_SESSION['referer'] !== null) ? $_SESSION['referer'] : null;
$insert_id = static::insert_row_to_db($data, array( '%s', '%s', '%s', '%s', '%s' ), 'biuro_employers');
static::sendEmail( static::emailContent($data['name'], 'Biuro Lithuania', $data['phone'], $data['email']), $data['name']);
$return = static::sendPost($data['name'], 'Biuro Lithuania', $data['phone'], $data['email']);
if ($return['LEAD_ID']):
static::update_row_in_db(['lead_id' => $return['LEAD_ID']], $insert_id, ['%d'] , 'biuro_employers');
endif;
$_SESSION[$str . '--step'] = 2;
$_SESSION[$str . '--id'] = $insert_id;
$_SESSION['employers--s'] = 1;
endif;
// static::set_sessions('employers', $_POST);
elseif ($_POST['s'] == "2"):
$data = [
......@@ -445,15 +448,20 @@ class Biuro_Contacts_Public {
$data['referer'] = ($_SESSION['referer'] !== null) ? $_SESSION['referer'] : null;
static::update_row_in_db($data, $_SESSION['employers--id'], ['%s', '%s', '%d', '%s', '%s'] , 'biuro_employers');
$employerData = static::fetchRow($_SESSION['employers--id'], 'biuro_employers');
static::sendEmail( static::emailContent($employerData['name'], 'Biuro Lithuania', $employerData['phone'], $employerData['email'], $data['company'], $data['message']), $employerData['name'] );
if ($employerData['lead_id']):
$return = static::curlPut($employerData['lead_id'], $employerData['name'], 'Biuro Lithuania', $employerData['phone'], $employerData['email'], $data['company'], $data['message']);
endif;
$_SESSION['employers--s'] = 2;
# isvalom klaidos teksta;
unset($_SESSION[$str.'file_error']);
//debug($data);
//exit();
endif;
......@@ -461,6 +469,128 @@ class Biuro_Contacts_Public {
exit;
}
public static function curlPut($leadId, $firstName, $lastName, $phone, $email, $organization, $comment) {
$service_url = 'https://api.insight.ly/v2.2/Leads';
$ch = curl_init($service_url);
$firstName =$firstName;
$lastName = $lastName;
$organization = $organization;
$comment = $comment;
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode('db7f06b9-1d5d-433b-8811-bf32fc614c79')
));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$data = '{
"LEAD_ID": "'.$leadId.'",
"FIRST_NAME": "'.$firstName.'",
"LAST_NAME": "'.$lastName.'",
"organization_name": "'.$organization.'",
"mobile_phone_number": "'.$phone.'",
"email_address": "'.$email.'",
"Service_Country_L__c": "'.$lastName.'",
"CUSTOMFIELDS": [ {
"CUSTOM_FIELD_ID": "Service_Country_L__c",
"FIELD_VALUE": "'.$lastName.'"
},
{
"CUSTOM_FIELD_ID": "Comments_L__c",
"FIELD_VALUE": "'.$comment.'"
},
]
}';
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$return = curl_exec($ch);
$err = curl_errno($ch);
$msg = curl_error($ch);
curl_close($ch);
return json_decode($return, true);
}
public static function sendPost($firstName, $lastName, $phone, $email) {
$service_url = 'https://api.insight.ly/v2.2/Leads';
$ch = curl_init($service_url);
$firstName = $firstName;
$lastName = $lastName;
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Basic ' . base64_encode('db7f06b9-1d5d-433b-8811-bf32fc614c79')
));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
$data = '{
"FIRST_NAME": "'.$firstName.'",
"LAST_NAME": "'.$lastName.'",
"mobile_phone_number": "'.$phone.'",
"email_address": "'.$email.'",
"Service_Country_L__c": "'.$lastName.'",
"CUSTOMFIELDS": [ {
"CUSTOM_FIELD_ID": "Service_Country_L__c",
"FIELD_VALUE": "'.$lastName.'"
}
]
}';
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$return = curl_exec($ch);
$err = curl_errno($ch);
$msg = curl_error($ch);
curl_close($ch);
return json_decode($return, true);
}
public static function sendEmail($message, $name) {
$to = 'pardavimai@biuro.lt';
$subject = 'Biuro employers contact form';
$headers = "From: Biuro <no-reply@biuro.lt>" . "\r\n";
try {
wp_mail( $to, $subject, $message, $headers );
} catch (Exception $e) {
debug($e);
}
}
public static function emailContent($firstName, $lastName, $phone, $email, $organization = null, $comment = null) {
$message = '';
$message .= 'Firstname: ' . $firstName . "\r\n";
$message .= 'Lastname: ' . $lastName . "\r\n";
$message .= 'Phone no.: ' . $phone . "\r\n";
$message .= 'Email: ' . $email . "\r\n";
if ($organization || $comment):
$message .= 'Company: ' . $organization . "\r\n";
$message .= 'Message: ' . $comment . "\r\n";
endif;
return $message;
}
/* --------------------------- position ---------------------------
/**
......@@ -553,7 +683,7 @@ class Biuro_Contacts_Public {
if ( $movefile && ! isset( $movefile['error'] ) ) {
$data['cv'] = static::getValue('cv', $movefile['url']);
} else {
$_SESSION['position_file_error'] = $movefile['error'];
$_SESSION['position--cv-error'] = $movefile['error'];
//po klaidos setinimo reikia redirecto?
}
}
......
......@@ -24,11 +24,23 @@ if ( ! defined( 'WPINC' ) ) die;
$nameValue = $_SESSION['employees--name-value'];
$nameStatus = $_SESSION['employees--name-status'];
$nameMessage = $_SESSION['employees--name-message'];
$phoneValue = $_SESSION['employees--phone-value'];
$phoneStatus = $_SESSION['employees--phone-status'];
$phoneMessage = $_SESSION['employees--phone-message'];
$emailValue = $_SESSION['employees--email-value'];
$emailStatus = $_SESSION['employees--email-status'];
$emailMessage = $_SESSION['employees--email-message'];
$agreeValue = $_SESSION['employees--agree-value'];
$agreeStatus = $_SESSION['employees--agree-status'];
$agreeMessage = $_SESSION['employees--agree-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error' || $phoneStatus != 'error' && $agreeStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
......@@ -37,11 +49,6 @@ if ( ! defined( 'WPINC' ) ) die;
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = $_SESSION['employees--phone-value'];
$phoneStatus = $_SESSION['employees--phone-status'];
$phoneMessage = $_SESSION['employees--phone-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone"><?php _e('Phone no.', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
......@@ -54,11 +61,6 @@ if ( ! defined( 'WPINC' ) ) die;
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = $_SESSION['employees--email-value'];
$emailStatus = $_SESSION['employees--email-status'];
$emailMessage = $_SESSION['employees--email-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email"><?php _e('Email address', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
......@@ -77,11 +79,6 @@ if ( ! defined( 'WPINC' ) ) die;
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = $_SESSION['employees--agree-value'];
$agreeStatus = $_SESSION['employees--agree-status'];
$agreeMessage = $_SESSION['employees--agree-message'];
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
......
......@@ -24,11 +24,23 @@ if ( ! defined( 'WPINC' ) ) die;
$nameValue = $_SESSION['employers--name-value'];
$nameStatus = $_SESSION['employers--name-status'];
$nameMessage = $_SESSION['employers--name-message'];
$phoneValue = $_SESSION['employers--phone-value'];
$phoneStatus = $_SESSION['employers--phone-status'];
$phoneMessage = $_SESSION['employers--phone-message'];
$emailValue = $_SESSION['employers--email-value'];
$emailStatus = $_SESSION['employers--email-status'];
$emailMessage = $_SESSION['employers--email-message'];
$agreeValue = $_SESSION['employers--agree-value'];
$agreeStatus = $_SESSION['employers--agree-status'];
$agreeMessage = $_SESSION['employers--agree-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name"><?php _e('Name, surname', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" <?php if ($nameStatus == 'error' || $phoneStatus != 'error' && $agreeStatus == 'error'): ?> autofocus="autofocus" <?php endif; ?>>
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
......@@ -37,11 +49,6 @@ if ( ! defined( 'WPINC' ) ) die;
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = $_SESSION['employers--phone-value'];
$phoneStatus = $_SESSION['employers--phone-status'];
$phoneMessage = $_SESSION['employers--phone-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone"><?php _e('Phone no.', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
......@@ -54,11 +61,6 @@ if ( ! defined( 'WPINC' ) ) die;
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = $_SESSION['employers--email-value'];
$emailStatus = $_SESSION['employers--email-status'];
$emailMessage = $_SESSION['employers--email-message'];
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email"><?php _e('Email address', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
......@@ -77,11 +79,6 @@ if ( ! defined( 'WPINC' ) ) die;
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = $_SESSION['employers--agree-value'];
$agreeStatus = $_SESSION['employers--agree-status'];
$agreeMessage = $_SESSION['employers--agree-message'];
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
......
......@@ -35,6 +35,16 @@ if ( ! defined( 'WPINC' ) ) die;
$emailStatus = $_SESSION['position--email-status'];
$emailMessage = $_SESSION['position--email-message'];
$agreeValue = $_SESSION['position--agree-value'];
$agreeStatus = $_SESSION['position--agree-status'];
$agreeMessage = $_SESSION['position--agree-message'];
$cvValue = $_SESSION['position--cv-value'];
$cityValue = $_SESSION['position--city-value'];
$cityIDValue = $_SESSION['position--city_id-value'];
$messageValue = $_SESSION['position--message-value'];
$confirmValue = $_SESSION['position--confirm-value'];
if(is_numeric($_SESSION['employees--id']) && $_SESSION['position--s'] === 1) {
$employeeData = Biuro_Contacts_Public::fetchRow($_SESSION['employees--id']);
......@@ -87,14 +97,14 @@ if ( ! defined( 'WPINC' ) ) die;
<div class="c-form--row">
<label class="c-form--label" for="form-city"><?php _e('City', 'biuro-contacts'); ?></label>
<div class="c-form--input-wrap">
<input type="text" class="c-form--input" id="form-city" name="city" value="">
<input type="text" class="c-form--input" id="form-city" name="city" value="<?php echo $cityValue; ?>">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-message"><?php _e('Message', 'biuro-contacts'); ?></label>
<div class="c-form--textarea-wrap">
<textarea name="message" id="form-message" cols="30" rows="3" class="c-form--textarea"></textarea>
<textarea name="message" id="form-message" cols="30" rows="3" class="c-form--textarea"><?php echo $messageValue; ?></textarea>
</div>
</div><!-- .c-form--row -->
......@@ -105,11 +115,6 @@ if ( ! defined( 'WPINC' ) ) die;
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = $_SESSION['position--agree-value'];
$agreeStatus = $_SESSION['position--agree-status'];
$agreeMessage = $_SESSION['position--agree-message'];
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
......@@ -124,7 +129,7 @@ if ( ! defined( 'WPINC' ) ) die;
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-confirm" type="checkbox" class="c-form--checkbox" name="confirm" value="1">
<input id="form-confirm" type="checkbox" class="c-form--checkbox" name="confirm" value="1" <?php if ($confirmValue): ?> checked="checked"<?php endif; ?>>
<label class="c-form--label-checkbox" for="form-confirm"><?php _e('Noster apster lorem ipsum dolor sit amet, consectetur adipisicing elit?', 'biuro-contacts'); ?></label>
</div>
</div><!-- .c-form--row -->
......
......@@ -4,7 +4,9 @@
.c-divisions { display: flex; flex-wrap: wrap; }
.c-division { flex: 0 0 auto; height: 30px; margin: 0 10px 10px 0; padding: 0 20px; border-radius: 3px; background-color: #E8F0FF; color: #004ED4; font-weight: 500; line-height: 30px; white-space: nowrap; text-decoration: none; }
.c-division { flex: 0 0 auto; height: 30px; margin: 0 10px 10px 0; padding: 0 20px; border-radius: 3px; background-color: #E8F0FF; color: #004ED4; font-weight: 500; line-height: 30px; white-space: nowrap; text-decoration: none; cursor: pointer;
&:hover { background-color: #DDE6F5; }
}
/*a.c-division { color: #004ED4; }*/
......
......@@ -66,6 +66,9 @@
dynamic_sidebar( 'append_area' );
endif;
?>
<script>
!function(n){"use strict";n.loadCSS||(n.loadCSS=function(){});var o=loadCSS.relpreload={};if(o.support=function(){var e;try{e=n.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),o.bindMediaToggle=function(t){var e=t.media||"all";function a(){t.addEventListener?t.removeEventListener("load",a):t.attachEvent&&t.detachEvent("onload",a),t.setAttribute("onload",null),t.media=e}t.addEventListener?t.addEventListener("load",a):t.attachEvent&&t.attachEvent("onload",a),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(a,3e3)},o.poly=function(){if(!o.support())for(var t=n.document.getElementsByTagName("link"),e=0;e<t.length;e++){var a=t[e];"preload"!==a.rel||"style"!==a.getAttribute("as")||a.getAttribute("data-loadcss")||(a.setAttribute("data-loadcss",!0),o.bindMediaToggle(a))}},!o.support()){o.poly();var t=n.setInterval(o.poly,500);n.addEventListener?n.addEventListener("load",function(){o.poly(),n.clearInterval(t)}):n.attachEvent&&n.attachEvent("onload",function(){o.poly(),n.clearInterval(t)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:n.loadCSS=loadCSS}("undefined"!=typeof global?global:this);
</script>
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-THF42F"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
......@@ -76,7 +79,7 @@
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-THF42F');</script>
<script src="/wp-content/themes/biuro/js/main-7a54fac0.min.js" async></script>
<script src="/wp-content/themes/biuro/js/main-166a52d0.min.js" async></script>
<?php wp_footer(); ?>
</body>
</html>
......@@ -459,10 +459,10 @@ function start_session() {
if(!session_id()) {
session_start();
}
if(!isset($_SESSION['referer']) && $_SERVER['HTTP_REFERER'] != null) {
$_SESSION['referer'] = $_SERVER['HTTP_REFERER'];
}
}
}
......@@ -538,3 +538,17 @@ add_action( 'rest_api_init', function () {
));
});
function setup_mailer( PHPMailer $phpmailer ) {
$phpmailer->Host = 'smtp.office365.com';
$phpmailer->Port = 587; // could be different
$phpmailer->Username = 'no-reply@biuro.lt'; // if required
$phpmailer->Password = 'Fubu7972'; // if required
$phpmailer->SMTPAuth = true; // if required
$phpmailer->SMTPSecure = 'tls'; // enable if required, 'tls' is another possible value
$phpmailer->CharSet = 'UTF-8';
$phpmailer->IsSMTP();
}
add_action( 'phpmailer_init', 'setup_mailer' );
......@@ -32,7 +32,7 @@ define('cityID', $cityID);
?>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<style><?php include 'css/core-8f41b1f6cc.min.css'; ?></style>
<style><?php include 'css/core-bde31b4cd1.min.css'; ?></style>
<link rel="preload" href="/wp-content/themes/biuro/css/main-10660ecc9b.min.css" as="style" onload="this.rel='stylesheet'">
......@@ -113,14 +113,43 @@ global $post;
</svg> +370 649 02392
</a>
<?php
// employees-contacts
if ( get_post_meta( $post->ID, 'section', true) == 'employers'):
?>
<a href="/darbdaviams/kontaktai-darbdaviams/" class="o-btn c-btn--main c-btn--header"><?php _e('Get an offer', 'biuro'); ?></a> <!-- Gaukite pasiūlymą -->
<?php
$contactsPage = new WP_Query( array(
'numberposts' => 1,
'post_type' => 'page',
'meta_key' => 'page',
'meta_value' => 'employers-contacts'
) );
if ( $contactsPage->have_posts() ) :
while( $contactsPage->have_posts() ) :
$contactsPage->the_post();
?>
<a href="<?php echo get_the_permalink(); ?>" class="o-btn c-btn--main c-btn--header"><?php _e('Get an offer', 'biuro'); ?></a>
<?php
endwhile;
endif;
else:
?>
<a href="/darbuotojams/kontaktai/" class="o-btn c-btn--main c-btn--header"><?php _e('Get a job offer', 'biuro'); ?></a> <!-- Gaukite darbo pasiūlymą -->
<?php
$contactsPage = new WP_Query( array(
'numberposts' => 1,
'post_type' => 'page',
'meta_key' => 'page',
'meta_value' => 'employees-contacts'
) );
if ( $contactsPage->have_posts() ) :
while( $contactsPage->have_posts() ) :
$contactsPage->the_post();
?>
<a href="<?php echo get_the_permalink(); ?>" class="o-btn c-btn--main c-btn--header"><?php _e('Get a job offer', 'biuro'); ?></a>
<?php
endwhile;
endif;
endif;
?>
<div class="c-nav--lang-wrap">
......
......@@ -185,19 +185,24 @@ function initDivisionsMap (node, data) {
let divisions = [];
const region = document.querySelector('.js-active-region');
const ID = (region && region.dataset.id) ? region.dataset.id : '';
if (data[ID]) {
divisions = data[ID];
} else {
Object.keys(data).forEach((key) => {
const division = data[key];
if (key.substr(0, 4) === 'city') {
divisions = divisions.concat(division);
Object.keys(data).forEach((key) => {
const division = data[key];
if (key.substr(0, 4) === 'city') {
divisions = divisions.concat(division);
}
});
document.querySelectorAll('.js-division').forEach((node) => {
node.addEventListener('click', () => {
const ID = (node && node.dataset.id) ? node.dataset.id : '';
if (data[ID]) {
setMarkers(map, data[ID].filter((d) => { return d.lat && d.lng; }));
} else {
setMarkers(map, divisions.filter((d) => { return d.lat && d.lng; }));
}
});
}
});
setMarkers(map, divisions.filter((d) => { return d.lat && d.lng; }));
}
......
......@@ -49,12 +49,12 @@ get_header(); ?>
<div class="c-divisions">
<?php
if ( 1 < $divisions->total() ):
/*
$divisionsPage = new WP_Query( array(
'numberposts' => 1,
'post_type' => 'page',
'meta_key' => 'divisions-page',
'meta_value' => 'master'
'meta_key' => 'page',
'meta_value' => 'employees-contacts'
) );
if ( $divisionsPage->have_posts() ) :
......@@ -65,10 +65,13 @@ get_header(); ?>
<?php
endwhile;
else:
*/
?>
<span class="c-division"><?php _e('All', 'biuro'); ?></span>
<span class="js-division c-division"><?php _e('All', 'biuro'); ?></span>
<?php
/*
endif;
*/
wp_reset_query();
endif;
......@@ -77,6 +80,7 @@ get_header(); ?>
$slug = $divisions->display( 'city.slug' );
if ( !in_array($slug, $cities) && $divisions->display( 'name' ) ) :
/*
$page = $divisions->field( 'page-id' );
if ( !empty( $page ) ):
......@@ -84,11 +88,13 @@ get_header(); ?>
<a class="js-division c-division <?php if ( $pageID == $page['ID'] ) { echo 'c-division--active'; } ?>" data-id="<?php echo $slug; ?>" href="<?php echo esc_url( get_permalink( $page['ID'] ) ); ?>"><?php echo $divisions->display( 'city' ); ?></a>
<?php
else:
*/
?>
<span class="c-division"><?php echo $divisions->display( 'city' ); ?></span>
<span class="js-division c-division" data-id="<?php echo $slug; ?>"><?php echo $divisions->display( 'city' ); ?></span>
<?php
/*
endif;
*/
array_push($cities, $slug);
endif;
endwhile;
......
......@@ -42,6 +42,8 @@
<div class="c-share">
<p class="c-share--heading"><?php _e('Suggest a friend', 'biuro'); ?></p>
<div class="c-share--options">
<?php
/*
<a target="_blank" href="https://www.facebook.com/dialog/share?href=<?php echo $requestURL; ?>&redirect_uri=<?php echo $requestURL; ?>&app_id=483299728358858" class="c-share--option c-share--option-facebook">
<svg width="9px" height="18px" class="c-ico--share-facebook">
<use xlink:href="#ico--job-facebook"></use>
......@@ -52,6 +54,8 @@
<use xlink:href="#ico--job-messenger"></use>
</svg>
</a>
*/
?>
<a href="<?php echo $mailto; ?>" class="c-share--option c-share--option-email">
<svg width="17px" height="13px" class="c-ico--share-email">
<use xlink:href="#ico--job-email"></use>
......@@ -63,11 +67,15 @@
<use xlink:href="#ico--job-copy"></use>
</svg>
</a>
<?php
/*
<a href="https://wa.me/whatsappphonenumber/?text=<?php echo urlencode($pod->field( 'title' )); ?>" class="c-share--option c-share--option-phone">
<svg width="17px" height="18px" class="c-ico--share-whatsapp">
<use xlink:href="#ico--job-whatsapp"></use>
</svg>
</a>
*/
?>
</div>
</div>
......
......@@ -17,7 +17,7 @@
return true;
endif;
return ( get_post_meta( $childID, 'divisions-page', true ) && pods( 'division' )->find( array( 'limit' => 1, 'where'=>"page-id.ID = " . $ID ) )->total() ) ? true : false;
return ( get_post_meta( $childID, 'page', true ) == "employees-contacts" && pods( 'division' )->find( array( 'limit' => 1, 'where'=>"page-id.ID = " . $ID ) )->total() ) ? true : false;
}
foreach( $menu_items as $menu_item ):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment