

<?php $__env->startSection('title', 'SMS Information'); ?>

<?php $__env->startPush('css'); ?>
<link rel="stylesheet" href="<?php echo e(asset('backend/plugins/select2.min.css')); ?>">
    <style>
        .select2-container {
            width: 100%!important;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php $__env->startSection('content'); ?>
<div class="right_col" role="main">
	<div class="">
		<div class="clearfix"></div>
		<?php if(Session::has('success')): ?>
		<div class="alert alert-success">
			<?php echo e(Session::get('success')); ?>

		</div>
		<?php endif; ?>
		<?php if(Session::has('error')): ?>
		<div class="alert alert-danger">
			<?php echo e(Session::get('error')); ?>

		</div>
		<?php endif; ?>
		<div class="row">
			<div class="col-md-12 col-sm-12 col-xs-12">
				<div class="x_panel">
					<div class="x_title">
						<h2>SMS Information</h2>
						<ul class="nav navbar-right panel_toolbox">
							<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
							</li>
							<li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
								<ul class="dropdown-menu" role="menu">
									<li><a href="#">Settings 1</a>
									</li>
									<li><a href="#">Settings 2</a>
									</li>
								</ul>
							</li>
							<li><a class="close-link"><i class="fa fa-close"></i></a>
							</li>
						</ul>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">
						<div class="col-xs-3">
							<!-- required for floating -->
							<!-- Nav tabs -->
							<ul class="nav nav-tabs tabs-left">
								<li class="active"><a href="#home" data-toggle="tab" aria-expanded="true">Compose</a></li>
								<li class=""><a href="#messages" data-toggle="tab" aria-expanded="false">Messages</a></li>
								<li class=""><a href="#settings" data-toggle="tab" aria-expanded="false">Customer</a></li>
							</ul>
						</div>
						<div class="col-xs-9">
							<!-- Tab panes -->
							<div class="tab-content">
								<div class="tab-pane active" id="home">
									<form id="demo-form2" action="<?php echo e(route('sms.store')); ?>" method="post" data-parsley-validate class="form-horizontal form-label-left" >
										<?php echo e(csrf_field()); ?>

										<?php echo e(method_field('Post')); ?>

										<div class="control-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12">Phone Number <span class="required">*</span></label>
											<div class="col-md-7 col-sm-7 col-xs-12">
												<input id="tags_1" type="text" class="tags form-control" name="phone" value="<?php echo e(old('phone')); ?>" />
												<div id="suggestions-container" style="position: relative; float: left; width: 250px; margin: 10px;"></div>
												<p class="error-sms"><?php echo e($errors->first('phone')); ?></p>
											</div>
										</div>
										<div class="form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12">Message <span class="required">*</span></label>
											<div class="col-md-7 col-sm-7 col-xs-7">
												<textarea class="form-control" rows="6" name="message" id="word" ></textarea>
												<p class="error-sms"><?php echo e($errors->first('message')); ?></p>
												<p><span id="show"></span></p>
											</div>
										</div>
										<hr />
										<div class="form-group">
											<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-5">
												<a href="<?php echo e(route('sms.index')); ?>" class="btn btn-danger">Cancel</a>
												<button class="btn btn-warning" type="reset">Reset</button>
												<button type="submit" class="btn btn-success">Send</button>
											</div>
										</div>
									</form>
								</div>
								<div class="tab-pane" id="messages">

									<p><strong>SMS Balance : </strong> <span id="sms_balance"><?php echo e($sms->sms_balance); ?></span></p>
									<p><strong>Expirety Date : </strong> <span id="sms_expirety"><?php echo e(date('d-m-Y',strtotime($sms->expire_date))); ?></span></p>
								</div>
								<div class="tab-pane" id="settings">
								   <form id="demo-form3" action="<?php echo e(route('sms.sms_send')); ?>" method="post" data-parsley-validate class="form-horizontal form-label-left" >
										<?php echo e(csrf_field()); ?>

										<?php echo e(method_field('Post')); ?>

										<div class="control-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12">Customer Phone Number <span class="required">*</span></label>
											<div class="col-md-7 col-sm-7 col-xs-12">
												<select name="phone[]" class="form-control input-sm select2" multiple>
												    <option value="">Select Customer Phone</option>
												    <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
												        <option value="<?php echo e($customer->phone); ?>"><?php echo e($customer->name); ?>(<?php echo e($customer->phone); ?>)</option>
												    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
												</select>
												<p class="error-sms"><?php echo e($errors->first('phone')); ?></p>
											</div>
										</div>
										<div class="form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12">Message <span class="required">*</span></label>
											<div class="col-md-7 col-sm-7 col-xs-7">
												<textarea class="form-control" rows="6" name="message" id="word2" ></textarea>
												<p class="error-sms"><?php echo e($errors->first('message')); ?></p>
												<p><span id="show2"></span></p>
											</div>
										</div>
										<hr />
										<div class="form-group">
											<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-5">
												<a href="<?php echo e(route('sms.index')); ?>" class="btn btn-danger">Cancel</a>
												<button class="btn btn-warning" type="reset">Reset</button>
												<button type="submit" class="btn btn-success">Send</button>
											</div>
										</div>
									</form>

								</div>
							</div>
						</div>
						<div class="clearfix"></div>

					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>
    <script src="<?php echo e(asset('backend/plugins/select2.min.js')); ?>"></script>
    <!-- jQuery Tags Input -->
    <script src="<?php echo e(asset('backend/vendors/jquery.tagsinput/src/jquery.tagsinput.js')); ?>"></script>
<script>
	$(document).ready(function() {
	    /*-------------*/
	    $('.select2').select2();
	    /*----------------------*/
        $("#word").keyup(function(){
    	  $("#show").text("Message Length:"+$(this).val().length+" (" + (160 - $(this).val().length)+" Characters Remaining)");
    	});
    	$("#word2").keyup(function(){
    	  $("#show2").text("Message Length:"+$(this).val().length+" (" + (160 - $(this).val().length)+" Characters Remaining)");
    	});
    	var sms = "<?php 
					$url = 'http://api.greenweb.com.bd/g_api.php?token=7a787dd847f4650b1ba1adfb8771c733&expiry&rate&totalsms&balance';
					$ch = curl_init(); // Initialize cURL
                    curl_setopt($ch, CURLOPT_URL,$url);
                    curl_setopt($ch, CURLOPT_ENCODING, '');
                    //curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                    $smsresult = curl_exec($ch);
				    echo $smsresult;
				 ?>";
		var sms = sms.replaceAll("</br>", "/").split('/');
		console.log(sms);


		//$('#sms_expirety').html(sms['1']);
		//$('#sms_expirety').html('21-09-2022');
		//var smsb = sms['0'] / sms['2'];
		//$('#sms_balance').html(smsb.toFixed(2));
	})
</script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>