Viewing file: index.blade.php (22.14 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
@extends('layouts.customer')
@section('title','Settings')
@section('extra-css') <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" /> <style> #toast-container .toast-success{ background: var(--primary) !important; } </style> @endsection
@section('content') <section class="content-header">
</section> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-12 mx-auto col-sm-10"> <!-- Custom Tabs --> <div class="card"> <input type="hidden" value="{{request()->get('type')}}" id="url-type"> <div class="card-header d-flex p-0"> <div class="row"> <h2 class="card-title p-3"><a href="{{route('customer.settings.index')}}">{{trans('customer.settings')}}</a></h2> <ul class="nav nav-pills ml-auto p-2"> <li class="nav-item"><a class="nav-link active" href="#profile_tab" data-toggle="tab">{{trans('customer.profile')}}</a> </li> <li class="nav-item"><a class="nav-link" href="#password_tab" data-toggle="tab">{{trans('customer.password')}}</a> </li>
<li class="nav-item"><a class="nav-link" href="#notification_tab" data-toggle="tab">{{trans('customer.general')}}</a></li>
<li class="nav-item"><a class="nav-link" href="#application_tab" data-toggle="tab">@lang('admin.settings.application')</a></li> <li class="nav-item"><a class="nav-link" href="#smtp_tab" data-toggle="tab">@lang('admin.settings.smtp')</a></li> <li class="nav-item"><a class="nav-link local_setting_tab" href="#local_setting_tab" data-toggle="tab">{{trans('admin.settings.local_setting')}}</a> </li>
<li class="nav-item"><a class="nav-link" href="{{url('translations')}}" target="_blank">{{trans('admin.settings.translations')}}</a> </li> <li class="nav-item"><a class="nav-link cronjob" href="#cronjob" data-toggle="tab">{{trans('admin.settings.cronjob')}}</a> </li> </ul> </div> </div><!-- /.card-header --> <div class="card-body"> <div class="tab-content"> <div class="tab-pane active" id="profile_tab"> <form method="post" role="form" id="profile_form" action="{{route('customer.settings.profile_update')}}" enctype="multipart/form-data"> @csrf @include('customer.settings.profile_form')
<button type="submit" class="btn btn-primary">{{trans('customer.submit')}}</button> </form> </div>
<div class="tab-pane" id="password_tab"> <form method="post" role="form" id="password_form" action="{{route('customer.settings.password_update')}}"> @csrf @include('customer.settings.password_form')
<button type="submit" class="btn btn-primary">{{trans('customer.submit')}}</button> </form> </div>
@if(auth('customer')->user()->otp_status=='active') <div class="tab-pane" id="otp_tab"> <form method="post" role="form" action="{{route('customer.opt.settings')}}"> @csrf
<div class="row pb-3"> <div class="col-md-12 text-right"> <button class="btn btn-primary btn-sm" type="button" id="checkOtpSend"> {{trans('Test')}} </button> </div> <div class="form-group col-md-6"> <label for="otpFromType">From Type</label> <select name="from_type" class="form-control" id="otpFromType"> <option {{isset($otp_setting->from_type) && $otp_setting->from_type=='number'?'selected':''}} value="number">{{trans('Number')}}</option> <option {{isset($otp_setting->from_type) && $otp_setting->from_type=='sender_id'?'selected':''}} value="sender_id">{{trans('Sender-ID')}}</option> </select> </div> @php $fromNumbers = auth('customer')->user()->numbers()->where('expire_date','>', now())->get() @endphp
<div class="form-group col-md-6 number_section otp_section" style="display: {{isset($otp_setting->from_type) && $otp_setting->from_type=='number'?'block':'none'}}"> <label for="">From Number</label> <select name="phone_number" class="form-control" id=""> @foreach($fromNumbers as $key=>$number) <option value="{{$number->number_id}}" {{isset($otp_setting->phone_number) && $otp_setting->phone_number==$number->number_id?'selected':''}}>{{$number->number}}</option> @endforeach </select> </div>
@php $senderIds = auth('customer')->user()->sender_ids()->where('expire_date','>', now())->where('is_paid', 'yes')->get() @endphp <div class="form-group col-md-6 sender_id_section otp_section" style="display:{{isset($otp_setting->from_type) && $otp_setting->from_type=='sender_id'?'block':'none'}}"> <label for="">Sender-ID</label> <select name="sender_id" class="form-control" id=""> @foreach($senderIds as $key=>$sender_id) <option {{isset($otp_setting->sender_id) && $otp_setting->sender_id==$sender_id->id?'selected':''}} value="{{$sender_id->id}}">{{$sender_id->sender_id}}</option> @endforeach </select> </div>
<div class="col-md-12 mt-2"> <label for="">{{trans('Status')}}</label> <select name="status" class="form-control" id=""> <option {{isset($otp_setting->status) && $otp_setting->status=='inactive'?'selected':''}} value="inactive">{{trans('Inactive')}}</option> <option {{isset($otp_setting->status) && $otp_setting->status=='active'?'selected':''}} value="active">{{trans('Active')}}</option> </select> </div>
</div>
<button type="submit" class="btn btn-primary">{{trans('customer.submit')}}</button> </form> </div> @endif
<div class="tab-pane" id="notification_tab"> <div class="row"> <div class="col-sm-10 ml-2">
@include('customer.settings.notification_form')
</div> </div> </div>
<div class="tab-pane" id="application_tab"> <form method="post" role="form" id="application_form" action="{{route('customer.settings.app_update')}}" enctype="multipart/form-data"> @csrf @include('customer.settings.app_update_form')
<button type="submit" class="btn btn-primary">@lang('admin.form.button.submit')</button> </form> </div>
<div class="tab-pane" id="local_setting_tab"> <form method="post" role="form" id="local_setting_form" action="{{route('customer.settings.local.setting')}}" enctype="multipart/form-data"> @csrf <div class="alert alert-primary" role="alert"> Configure local settings by setup language, timezone. </div>
@include('customer.settings.local_setting_form')
<button type="submit" class="btn btn-primary">@lang('admin.form.button.submit')</button> </form> </div>
<div class="tab-pane" id="cronjob"> <div class="row"> <div class="col-sm-10 ml-2"> <table class="w-100"> <tr> <td><label for="">{{trans('admin.settings.cronjob')}}</label></td> <td> <div class="form-group m-0 text-center line-break-anywhere">{{route('cron.job')}} <i class="fa fa-copy ml-3 text-primary c-pointer copyCornJob"></i> </div> <input type="hidden" class="form-control" id="cronJobUrl" value="{{route('cron.job')}}"> </td> <td> @if(cache()->get('cronjob') && cache()->get('cronjob') == 'true') <i class="fa fa-check ml-3 text-primary"></i> <span class="ml-1"> {{trans('admin.configured')}}</span> @else <i class="fa fa-times ml-3 text-danger"></i> <span class="ml-1">{{trans('admin.not_configured')}}</span> @endif </td> </tr> </table>
</div> </div>
</div> <div class="tab-pane" id="smtp_tab"> <form method="post" role="form" id="smtp_form" action="{{route('customer.settings.smtp_update')}}" enctype="multipart/form-data"> @csrf
@include('customer.settings.smtp_form')
<button type="submit" class="btn btn-primary">@lang('admin.form.button.submit')</button> </form> </div>
</div>
</div> <!-- /.tab-content --> </div><!-- /.card-body --> </div> <!-- ./card -->
</div> <!-- /.card --> </div> <!-- /.col --> </div> <!-- /.row --> </section> <!-- /.content -->
<!-- Modal --> <div class="modal fade" id="sendOtpModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">OTP Testing</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="form-group"> <label for="">{{trans('To Number')}}</label> <input type="text" class="form-control" name="to_number" placeholder="Enter Number With Country Code"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary send_otp_request">Send</button> </div> </div> </div> </div>
@endsection
@section('extra-scripts') <script src="{{asset('plugins/jquery-validation/jquery.validate.min.js')}}"></script>
<script src="{{asset('plugins/bs-custom-file-input/bs-custom-file-input.js')}}"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js" ></script> <script !src=""> "use strict"; let $validate; $validate = $('#profile_form').validate({ rules: { email: { required: true, email: true, }, first_name: { required: true }, last_name: { required: true }, }, messages: { email: { required: "Please enter a email address", email: "Please enter a vaild email address" }, password: { required: "Please provide a password", minlength: "Your password must be at least 5 characters long" }, first_name: {required: "Please provide first name"}, last_name: {required: "Please provide last name"} }, errorElement: 'span', errorPlacement: function (error, element) { error.addClass('invalid-feedback'); element.closest('.form-group').append(error); }, highlight: function (element, errorClass, validClass) { $(element).addClass('is-invalid'); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass('is-invalid'); } }); $('#notification_switch').on('change',function(e){ const isChecked=$(this).is(':checked'); $.ajax({ method:'post', url:'{{route('customer.settings.notification_update')}}', data:{_token:'{{csrf_token()}}',isChecked}, success:function(res){ notify('success',res.message); } }) });
$(document).ready(function () { bsCustomFileInput.init(); }); $('#templateForm').validate({ rules: { title: { required: true, }, body: { required: true }, status: { required: true }, }, messages: { title: { required: "Please enter template title", }, body: { required: "Please enter template body", }, status: {required: "Please select template status"}, }, errorElement: 'span', errorPlacement: function (error, element) { error.addClass('invalid-feedback'); element.closest('.form-group').append(error); }, highlight: function (element, errorClass, validClass) { $(element).addClass('is-invalid'); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass('is-invalid'); } });
$('.add_tool').on('click', function (e) { var curPos = document.getElementById("template_body").selectionStart;
let x = $("#template_body").val(); let text_to_insert = $(this).attr('data-name'); $("#template_body").val( x.slice(0, curPos) + text_to_insert + x.slice(curPos));
});
$(document).on('keyup or click', '#template_body', function (e){ const character = $(this).val().length;
var messageValue = $(this).val(); var div = parseInt(parseInt(messageValue.length - 1) / 160) + 1; if (div <= 1) { $("#count").text("Characters left: " + (160 - messageValue.length)); } else $("#count").text("Characters left: " + (160 * div - messageValue.length) + "/" + div); });
$('#webhookSubmit').on('click',function(e){ const type = $('#webhook_type').val(); const url = $('#webhook_url').val();
$.ajax({ method:'post', url:'{{route('customer.settings.webhook_update')}}', data:{_token:'{{csrf_token()}}',type:type, url:url}, success:function(res){ notify('success',res.message); } }) })
$('#dataPostIngSubmit').on('click',function(e){ const type = $('#data_posting_type').val(); const url = $('#data_posting_url').val();
$.ajax({ method:'post', url:'{{route('customer.settings.data_posting')}}', data:{_token:'{{csrf_token()}}',type:type, url:url}, success:function(res){ notify('success',res.message); } }) })
@if(Module::has('PaymentGateway')) $('#resellerGatewaysBtn').on('click', function (e) { e.preventDefault(); const form = $('#resellerGatewaysForm'); const formData=form.serialize(); const url=form.attr('action'); $.ajax({ method: 'post', url: url, data: formData, success: function (res) { if (res.status == 'success') { notify('success', res.message); } } }) }); @endif
$(document).on('click', '#editDomain', function(e){ $('#editDomainModal').modal('show'); }) $(document).on('change', '#otpFromType', function(e){ const type=$(this).val();
$('.otp_section').hide(); $('.'+type+'_section').show(); })
let rnd = (Math.random() + 1).toString(36).substring(7);
@if(isset($authorizationToken->access_token)) $('.send_otp_request').on('click',function(e){ const to = $('input[name=to_number]').val(); $('.send_otp_request').attr('disabled', 'disabled') $.ajax({ method:'GET', url:'{{route('otp.message')}}', data:{ number:to, api_key:'{{$authorizationToken->access_token}}', code:rnd }, success:function(res){ notify('success', res.message); $('.send_otp_request').removeAttr('disabled') $('#sendOtpModal').modal('hide'); $('input[name=to_number]').val('') } }) }); @endif
$('#checkOtpSend').on('click',function(e){ $('#sendOtpModal').modal('show'); });
$(document).on('click', '.confirmEdit', function(e){ $('#editDomain').addClass('d-none'); $('input[name=domain_name]').removeAttr('readonly'); $('#editDomainModal').modal('hide'); }); $('#timezone').select2();
$(document).on('click', '.copyCornJob', function (e){ // Get the text field var copyText = document.getElementById("cronJobUrl"); // Copy the text inside the text field navigator.clipboard.writeText(copyText.value); toastr.success('URL successfully copied','Copied!', {timeOut: 2200}) }) </script> @endsection
|