Viewing file: 8a96efa0c130e5cb2351a25c964e3519668506bc.php (24.22 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $__env->startSection('title','Compose | SmsBox'); ?>
<?php $__env->startSection('extra-css'); ?>
<link rel="stylesheet" href="<?php echo e(asset('plugins/select2/css/select2.min.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('plugins/daterangepicker/daterangepicker.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('plugins/icheck-bootstrap/icheck-bootstrap.min.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('css/msg_overview.css')); ?>">
<style>
#select2-toNumbers-results, #select2-fromNumber-results {
overflow-y: auto;
max-height: 200px;
}
.iphone {
width: 300px;
height: 609px;
background-size: 100% 100%;
margin: 0 auto;
position: relative;
}
.user-chat-profile {
font-size: 30px;
padding: 20px 5px;
}
.chat-box-text-sec {
color: #fff;
margin-left: auto;
background-color: #00a9de;
}
.chat-message-content {
font-size: 18px;
padding: 10px 20px;
border-radius: 25px;
color: #fff;
background-color: #00a9de;
max-width: 600px;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
position: relative;
margin: 15px 10px;
word-break: break-all;
direction: ltr;
}
.chat-curve-reply:after {
content: "";
width: 20px;
height: 12px;
display: block;
background-image: url("https://stageviewcincyshakes.firebaseapp.com/icon-gray-message.e6296433d6a72d473ed4.png");
background-repeat: no-repeat;
background-position: center;
background-size: contain;
position: absolute;
bottom: -2px;
left: -5px;
}
.chat-message-content:after {
width: 19px;
height: 13px;
left: inherit;
right: -5px;
background-image: url("https://stageviewcincyshakes.firebaseapp.com/icon-blue-message.2be55af0d98ee2864e29.png");
}
.chat-application-sec {
display: flex;
justify-content: flex-end;
align-items: flex-end;
overflow-y: hidden;
}
.chat-date-time {
font-size: 8px;
margin: 5px 0px;
}
.chat-text-area {
font-size: 13px;
}
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<!-- Content Header (Page header) -->
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1><?php echo e(trans('customer.quick_send')); ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a
href="<?php echo e(route('customer.smsbox.overview')); ?>"><?php echo e(trans('customer.smsbox')); ?></a></li>
<li class="breadcrumb-item active"><?php echo e(trans('customer.quick_send')); ?></li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<!-- /.col -->
<div class="col-lg-8 col-md-7 mx-auto">
<div class="card card-primary card-outline">
<form id="compose_form" action="<?php echo e(route('customer.smsbox.compose.sent')); ?>" method="post"
enctype="multipart/form-data">
<?php echo csrf_field(); ?>
<div class="card-header">
<h3 class="card-title"><?php echo e(trans('customer.compose_new_message')); ?></h3>
</div>
<!-- /.card-header -->
<div class="card-body">
<div class="form-group">
<label for="device_id">Select Device</label>
<select name="device_id" class="form-control select2" id="device_id">
<option value="">Choose a device</option>
<?php $__currentLoopData = $devices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $device): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option data-sim-info="<?php echo e($device->sim_info); ?>" device_name="<?php echo e($device->name); ?>"
value="<?php echo e($device->id); ?>"><?php echo e($device->name); ?> (<?php echo e($device->model); ?>)
</option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
</div>
<div class="form-group">
<label for="sim_id">Select SIM</label>
<select name="subscriber_id" class="form-control select2" id="sim_id">
</select>
</div>
<div id="pre_draft">
<?php if(isset($draft)): ?>
<input type='hidden' id='draft_id' name='draft_id' value='<?php echo e($draft->id); ?>'/>
<?php endif; ?>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-12">
<label for="toNumbers">Select Recipient</label>
<select name="to_numbers[]" id="toNumbers" class="select2 compose-select"
multiple="multiple"
data-placeholder="<?php echo e(trans('customer.recipient')); ?>:">
<?php if(isset($draft) && $draft->formatted_number_to): ?>
<?php $__currentLoopData = $draft->formatted_number_to_array; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $to): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option selected value="<?php echo e($to); ?>"><?php echo e($to); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>
<?php if(isset($users_to_contacts)): ?>
<optgroup label="Contacts">
<?php $__currentLoopData = $users_to_contacts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $to): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e(json_encode($to)); ?>"><?php echo e($to['value']); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</optgroup>
<?php endif; ?>
<?php if(isset($users_to_groups)): ?>
<optgroup label="Groups">
<?php $__currentLoopData = $users_to_groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $to): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e(json_encode($to)); ?>"><?php echo e($to['value']); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</optgroup>
<?php endif; ?>
</select>
</div>
</div>
</div>
<div class="form-group">
<textarea name="body" id="compose-textarea" class="form-control compose-body"
placeholder="<?php echo e(trans('customer.enter_message')); ?>"><?php echo e(isset($draft)?$draft->body:''); ?></textarea>
<div class="text-right">
<b id="smsCount"></b> SMS (<b id="smsLength"></b>) Characters left
</div>
</div>
<div class="form-group d-none">
<label for="mms_files"><?php echo e(trans('customer.choose_file')); ?>:</label>
<input type="file" accept="image/*" id="mms_files" class="form-control"
name="mms_files[]" multiple>
</div>
<div class="form-group">
<div class="icheck-success d-inline">
<input <?php echo e(isset($draft) && $draft->schedule_datetime?'checked':''); ?> name="isSchedule"
type="checkbox" id="isScheduled">
<label for="isScheduled">
<?php echo e(trans('customer.schedule')); ?>
</label>
</div>
<input style="display: <?php echo e(isset($draft) && $draft->schedule_datetime?'block':'none'); ?>"
name="schedule"
value="<?php echo e(isset($draft) && $draft->schedule_datetime?$draft->schedule_datetime->format('m/d/Y h:i A'):''); ?>"
id="schedule" type='text'
class="form-control"/>
</div>
</div>
<!-- /.card-body -->
<div class="card-footer">
<div class="float-right">
<button id="draft" type="button" class="btn btn-default"><i
class="fas fa-pencil-alt"></i> <?php echo e(trans('customer.draft')); ?>
</button>
<button type="submit" class="btn btn-primary"><i
class="far fa-envelope"></i> <?php echo e(trans('customer.send')); ?>
</button>
</div>
<button id="reset" type="button" class="btn btn-default"><i
class="fas fa-times"></i> <?php echo e(trans('customer.reset')); ?>
</button>
</div>
<!-- /.card-footer -->
</form>
</div>
<!-- /.card -->
</div>
<div class="col-md-4 col-4" id="mobileVersion">
<div class="iphone"
style="background-image: url('<?php echo e(asset('images/iphone6.png')); ?>')">
<div class="border">
<div class="responsive-html5-chat">
<form class="chat">
<span></span>
<div class="messages">
<div class="message">
</div>
</div>
<input type="text" placeholder="Your message" disabled="">
<input type="submit" value="Send" disabled="">
</form>
<div class="chat-application-sec chat-box-sec d-flex">
<div class="chat-box-wrapper">
<div class="chat-box-text-sec chat-message-content chat-curve-reply">
<div class="text-sec" id="msg_mobaile_view">
</div>
</div>
</div>
<div class="user-icon-sec">
<i class="fa fa-user-circle user-chat-profile" aria-hidden="true"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
</section>
<!-- /.content -->
<input type="hidden" id="meg-time">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('extra-scripts'); ?>
<script src="<?php echo e(asset('plugins/select2/js/select2.full.min.js')); ?>"></script>
<script src="<?php echo e(asset('plugins/daterangepicker/moment.min.js')); ?>"></script>
<script src="<?php echo e(asset('plugins/daterangepicker/daterangepicker.js')); ?>"></script>
<script !src="">
"use strict";
var select2 = $('#toNumbers').select2({
minimumInputLength: 1,
tags: true,
tokenSeparators: [",", " "],
})
$('#fromNumber').select2({
theme: 'bootstrap4'
});
$('#from_number').select2({
multiple: false,
placeholder: 'Select a from number',
});
$(function () {
"use strict";
$('#schedule').daterangepicker({
autoUpdateInput: true,
singleDatePicker: true,
timePicker: true,
locale: {
format: 'MM/DD/YYYY hh:mm A'
}
});
});
$('#isScheduled').on('change', function (e) {
const checked = $(this).is(':checked');
if (checked) {
$('#schedule').show();
} else {
$('#schedule').hide();
}
})
$('#reset').on('click', function (e) {
e.preventDefault();
$(select2).val('').trigger('change');
$("#compose-textarea").val('');
let checked = $("#isScheduled").is(':checked');
if (checked) {
$('#isScheduled').click().prop("checked", false);
}
})
$('#draft').on('click', function (e) {
e.preventDefault();
const from = $('#device_id').val();
const to = $('#toNumbers').val();
const body = $('#compose-textarea').val();
const checked = $("#isScheduled").is(':checked');
const draft_id = $("#draft_id").val();
let schedule = '';
if (checked) {
schedule = $('#schedule').val();
}
$.ajax({
method: 'post',
url: '<?php echo e(route('customer.smsbox.draft.store')); ?>',
data: {_token: '<?php echo e(csrf_token()); ?>', from, to, body, checked, schedule, draft_id},
success: function (res) {
if (res.status == 'success') {
notify('success', res.message);
var id = res.data.id;
$('#pre_draft').html("<input type='hidden' id='draft_id' name='draft_id' value='" + id + "'/>");
} else {
notify('danger', res.message);
}
}
})
})
$("#compose-textarea").on("keyup change", function (e) {
e.preventDefault()
const checked = $("#isScheduled").is(':checked');
let dateTime = '';
if (checked) {
dateTime = $('#schedule').val();
} else {
dateTime = $('#meg-time').val()
}
let data = $('#compose-textarea').val();
let compose = data.replace(/\n/g, "<br />");
$("#msg_mobaile_view").html(`<div class="chat-text-area"> ${compose} <div>`);
});
$('#schedule').on('change', function (e) {
e.preventDefault()
let data = $('#compose-textarea').val();
let compose = data.replace(/\n/g, "<br />");
const checked = $("#isScheduled").is(':checked');
let dateTime = '';
if (checked) {
dateTime = $('#schedule').val();
} else {
dateTime = $('#meg-time').val()
}
if (compose) {
$("#msg_mobaile_view").html(`<div class="chat-date-time">${dateTime}</div>
<div class="chat-text-area"> ${compose}</div>`);
}
});
$('#isScheduled').on('change', function (e) {
e.preventDefault()
let data = $('#compose-textarea').val();
let compose = data.replace(/\n/g, "<br />");
const checked = $("#isScheduled").is(':checked');
let dateTime = '';
if (checked) {
dateTime = $('#schedule').val();
} else {
dateTime = $('#meg-time').val()
}
if (compose) {
$("#msg_mobaile_view").html(`<div class="chat-date-time">${dateTime}</div>
<div class="chat-text-area"> ${compose}</div>`);
}
});
$('#phone_number').trigger('change');
</script>
<script>
const myDate = new Date();
let daysList = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
let monthsList = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Aug', 'Oct', 'Nov', 'Dec'];
let date = myDate.getDate();
let month = monthsList[myDate.getMonth()];
let year = myDate.getFullYear();
let day = daysList[myDate.getDay()];
let today = `${date} ${month} ${year}, ${day}`;
let amOrPm;
let twelveHours = function () {
if (myDate.getHours() > 12) {
amOrPm = 'PM';
let twentyFourHourTime = myDate.getHours();
let conversion = twentyFourHourTime - 12;
return `${conversion}`
} else {
amOrPm = 'AM';
return `${myDate.getHours()}`
}
};
let hours = twelveHours();
let minutes = myDate.getMinutes();
let currentTime = `${hours}:${minutes} ${amOrPm}`;
$('#meg-time').val(today + ' ' + currentTime)
$('#device_id').on('change', function (e) {
e.preventDefault();
$('#sim_id').html('');
let simInfo = $('option:selected', this).attr('data-sim-info');
if (simInfo) {
simInfo = JSON.parse(simInfo);
if (simInfo && typeof simInfo == 'object') {
let options = '';
for (let sim of simInfo) {
let singleSimInfo = sim.split(':');
options += `<option value="${singleSimInfo[1]}">${singleSimInfo[2]} (SIM ${parseInt(singleSimInfo[0])+1})</option>`
}
$('#sim_id').html(options);
}
}
})
</script>
<script>
(function($){
$.fn.smsArea = function(options){
//Generate Ascii Character Array
var maxCh = 1000;
var minCh = 0;
var arrAscii = [];
for(minCh =1; minCh < maxCh; minCh++){
arrAscii.push(minCh * 160);
}
//End
//Generate Unicode Character Array
var unMaxCh = 1000;
var unMinCh = 0;
var arrUnicode = [];
for(unMinCh =1; unMinCh < unMaxCh; unMinCh++){
arrUnicode.push(unMinCh * 70);
}
//End
var
e = this,
cutStrLength = 0,
s = $.extend({
cut: true,
maxSmsNum: 1000,
interval: 5,
counters: {
message: $('#smsCount'),
character: $('#smsLength')
},
lengths: {
ascii: arrAscii,
unicode: arrUnicode
}
}, options);
e.keyup(function(){
clearTimeout(this.timeout);
this.timeout = setTimeout(function(){
var
smsType,
smsLength = 0,
smsCount = -1,
charsLeft = 0,
text = e.val(),
isUnicode = false;
for(var charPos = 0; charPos < text.length; charPos++){
switch(text[charPos]){
case "\n":
case "[":
case "]":
case "\\":
case "^":
case "{":
case "}":
case "|":
case "€":
smsLength += 2;
break;
default:
smsLength += 1;
}
//!isUnicode && text.charCodeAt(charPos) > 127 && text[charPos] != "€" && (isUnicode = true)
if(text.charCodeAt(charPos) > 127 && text[charPos] != "€")
isUnicode = true;
}
if(isUnicode) smsType = s.lengths.unicode;
else smsType = s.lengths.ascii;
for(var sCount = 0; sCount < s.maxSmsNum; sCount++){
cutStrLength = smsType[sCount];
if(smsLength <= smsType[sCount]){
smsCount = sCount + 1;
charsLeft = smsType[sCount] - smsLength;
break
}
console.log(sCount, s.maxSmsNum);
}
if(s.cut) e.val(text.substring(0, cutStrLength));
smsCount == -1 && (smsCount = s.maxSmsNum, charsLeft = 0);
s.counters.message.html(smsCount);
s.counters.character.html(charsLeft);
}, s.interval)
}).keyup();
}}(jQuery));
//Start
$(function(){
$('#compose-textarea').smsArea();
})
$('#fromType').trigger('change');
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.customer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/picotech/domains/gateway.picotech.app/public_html/resources/views/customer/smsbox/compose.blade.php ENDPATH**/ ?>
|