| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking - Libraries |
| 4 |
* @subpackage wordpress |
| 5 |
* @author E4J s.r.l. |
| 6 |
* @copyright Copyright (C) 2018 E4J s.r.l. All Rights Reserved. |
| 7 |
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
// No direct access |
| 12 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 13 |
|
| 14 |
$app = JFactory::getApplication(); |
| 15 |
|
| 16 |
VikBooking::loadPreferredColorStyles(); |
| 17 |
VikBooking::loadFontAwesome(true); |
| 18 |
|
| 19 |
$options = [ |
| 20 |
'version' => '1.0', |
| 21 |
]; |
| 22 |
|
| 23 |
JHtml::fetch('stylesheet', VBO_MODULES_URI . 'modules/mod_vikbooking_chat/assets/style.css', $options); |
| 24 |
|
| 25 |
$params = new JRegistry($app->input->get('attributes', [], 'array')); |
| 26 |
|
| 27 |
$faqs = []; |
| 28 |
|
| 29 |
// prepare FAQs |
| 30 |
for ($i = 1; $i <= 3; $i++) { |
| 31 |
$short = $params->get('faq_' . $i . '_short'); |
| 32 |
$long = $params->get('faq_' . $i . '_long'); |
| 33 |
|
| 34 |
if ($short && $long) { |
| 35 |
$faqs[] = (object) [ |
| 36 |
'summary' => $short, |
| 37 |
'question' => $long, |
| 38 |
]; |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
?> |
| 43 |
|
| 44 |
<style> |
| 45 |
.vbo-chat-session-widget { |
| 46 |
--vbo-chat-widget-btn-background: <?php echo $params->get('background'); ?>; |
| 47 |
--vbo-chat-widget-btn-color: <?php echo $params->get('color'); ?>; |
| 48 |
} |
| 49 |
.widget-block-preview { |
| 50 |
opacity: 0; |
| 51 |
} |
| 52 |
.widget-block-preview.fade-in { |
| 53 |
animation: fadeIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; |
| 54 |
} |
| 55 |
@keyframes fadeIn { |
| 56 |
0% { |
| 57 |
opacity: 0; |
| 58 |
} |
| 59 |
50% { |
| 60 |
opacity: 0; |
| 61 |
} |
| 62 |
100% { |
| 63 |
opacity: 1; |
| 64 |
} |
| 65 |
} |
| 66 |
.widget-block-preview .vbo-chat-session-widget .vbo-chat-widget-container .vbo-chat-widget-body .vbo-chat-session-placeholder { |
| 67 |
display: block !important; |
| 68 |
} |
| 69 |
.widget-block-preview .vbo-chat-widget-toggle { |
| 70 |
text-align: right; |
| 71 |
margin-top: 10px; |
| 72 |
} |
| 73 |
.widget-block-preview .vbo-chat-widget-toggle a { |
| 74 |
display: inline-flex; |
| 75 |
} |
| 76 |
.widget-block-preview .vbo-chat-session-widget .vbo-chat-wrapper .chat-input-footer { |
| 77 |
position: absolute; |
| 78 |
bottom: 0; |
| 79 |
left: 0; |
| 80 |
right: 0; |
| 81 |
padding: 10px; |
| 82 |
background: #fff; /* @todo */ |
| 83 |
} |
| 84 |
.widget-block-preview .vbo-chat-wrapper textarea { |
| 85 |
resize: none; |
| 86 |
height: 40px; |
| 87 |
margin: 0; |
| 88 |
border: 1px solid #999; |
| 89 |
border-radius: 20px; |
| 90 |
font-size: 14px; |
| 91 |
padding: 10px 40px 10px 12px; |
| 92 |
width: 100%; |
| 93 |
} |
| 94 |
</style> |
| 95 |
|
| 96 |
<div class="widget-block-preview fade-in"> |
| 97 |
|
| 98 |
<div class="vbo-chat-session-widget"> |
| 99 |
|
| 100 |
<div class="vbo-chat-widget-container slide-in"> |
| 101 |
|
| 102 |
<div class="vbo-chat-widget-head"> |
| 103 |
<span> |
| 104 |
<?php echo $params->get('title') ?: JText::translate('MOD_VIKBOOKING_CHAT_TITLE'); ?> |
| 105 |
</span> |
| 106 |
|
| 107 |
<a href="javascript:void(0)" onclick="document.getElementsByClassName('vbo-chat-widget-container')[0].classList.remove('slide-in')"> |
| 108 |
<?php VikBookingIcons::e('chevron-down'); ?> |
| 109 |
</a> |
| 110 |
</div> |
| 111 |
|
| 112 |
<div class="vbo-chat-widget-body"> |
| 113 |
|
| 114 |
<div class="vbo-chat-wrapper"> |
| 115 |
<div class="chat-conversation"> |
| 116 |
|
| 117 |
</div> |
| 118 |
<div class="chat-input-footer"> |
| 119 |
<textarea readonly placeholder="<?php echo htmlspecialchars(JText::translate('VBO_CHAT_TEXTAREA_PLACEHOLDER')); ?>"></textarea> |
| 120 |
</div> |
| 121 |
</div> |
| 122 |
|
| 123 |
<div class="vbo-chat-session-placeholder"> |
| 124 |
|
| 125 |
<div class="vbo-chat-session-placeholder-inner"> |
| 126 |
|
| 127 |
<div class="vbo-chat-placeholder-greetings"> |
| 128 |
<div class="greetings-title"> |
| 129 |
<?php echo $params->get('greetings_title') ?: JText::translate('MOD_VIKBOOKING_CHAT_GREETINGS_TITLE'); ?> |
| 130 |
</div> |
| 131 |
|
| 132 |
<div class="greetings-subtitle"> |
| 133 |
<?php echo $params->get('greetings_subtitle') ?: JText::translate('MOD_VIKBOOKING_CHAT_GREETINGS_SUBTITLE'); ?> |
| 134 |
</div> |
| 135 |
</div> |
| 136 |
|
| 137 |
<?php if ($faqs): ?> |
| 138 |
<div class="vbo-chat-placeholder-faqs slide-in"> |
| 139 |
<ul> |
| 140 |
<?php foreach ($faqs as $faq): ?> |
| 141 |
<li> |
| 142 |
<a href="javascript:void(0)" data-question="<?php echo htmlspecialchars($faq->question); ?>"> |
| 143 |
<?php VikBookingIcons::e('life-ring'); ?> |
| 144 |
<?php echo $faq->summary; ?> |
| 145 |
</a> |
| 146 |
</li> |
| 147 |
<?php endforeach; ?> |
| 148 |
</ul> |
| 149 |
</div> |
| 150 |
<?php endif; ?> |
| 151 |
|
| 152 |
</div> |
| 153 |
|
| 154 |
</div> |
| 155 |
|
| 156 |
</div> |
| 157 |
|
| 158 |
</div> |
| 159 |
|
| 160 |
<div class="vbo-chat-widget-toggle bounce-in"> |
| 161 |
<a href="javascript:void(0)" onclick="document.getElementsByClassName('vbo-chat-widget-container')[0].classList.add('slide-in')"> |
| 162 |
<?php VikBookingIcons::e('comment'); ?> |
| 163 |
</a> |
| 164 |
</div> |
| 165 |
|
| 166 |
</div> |
| 167 |
|
| 168 |
</div> |
| 169 |
|