@extends('app')

@section('page_title')
    Send Bulk Voice
@endsection

@push('styles')
    <link rel="stylesheet" href="{{asset('assets/examples/css/pages/profile.min3f0d.css?v2.2.0')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('css/DateTimePicker.min.css')}}" />
    <!--[if lt IE 9]>
        <link rel="stylesheet" type="text/css" href="{{asset('css/DateTimePicker-ltie9.min.css')}}" />
        <script type="text/javascript" src="{{asset('js/DateTimePicker-ltie9.min.js')}}"></script>
    <![endif]-->
@endpush

@section('page_content')
    <div class="page-content container-fluid">
        <div class="row">
            @include('includes.side_profile')

            <div class="col-md-9">
                <!-- Panel Wizard Form -->
                <div class="panel" id="exampleWizardForm">
                    <div class="panel-heading">
                        <h3 class="panel-title">Send Bulk Voice</h3>
                    </div>
                    <div class="panel-body">
                        <!-- Steps -->
                        @if(session('success'))
                            <div style="height: 350px;">
                                <div class="alert alert-success">
                                    <ul>
                                        <li>{{ session('success') }}</li>
                                    </ul>
                                </div>
                                @if(session('alert') && !empty(session('alert')))
                                    <div class="alert alert-danger">
                                        <ul>
                                            @foreach(session('alert') as $error)
                                                <li>{{$error}}</li>
                                            @endforeach
                                        </ul>
                                    </div>
                                @endif
                            </div>
                        @else
                        <div class="steps steps-sm row" data-plugin="matchHeight" data-by-row="true" role="tablist">
                            <div class="step col-md-6 {{$step===1?'current':''}}" data-target="#voice_details" role="tab">
                                <span class="step-number">1</span>
                                <div class="step-desc">
                                    <span class="step-title">Bulk Voice</span>
                                    <p>Voice Message Details</p>
                                </div>
                            </div>

                            <div class="step col-md-6 {{$step===2?'current':''}}" data-target="#confirmation" role="tab">
                                <span class="step-number">2</span>
                                <div class="step-desc">
                                    <span class="step-title">Confirmation</span>
                                    <p>Confirm the Voice details</p>
                                </div>
                            </div>
                        </div>
                        <!-- End Steps -->

                        <!-- Wizard Content -->
                        <div class="wizard-content">
                            @if($step===1)
                            <div class="wizard-pane {{("$step"==="1") ? 'active' : ''}}" id="voice_details" role="tabpanel">
                                <form method="post" id="voice_details_form" enctype="multipart/form-data">
                                    @if(count($errors)>0)
                                        <div class="alert alert-danger">
                                            <ul>
                                                @foreach($errors->all() as $error)
                                                    <li>{{$error}}</li>
                                                @endforeach
                                            </ul>
                                        </div>
                                    @endif
                                        @csrf
                                    <div class="form-group">
                                        <label class="control-label" for="name">Campaign Name</label>
                                        <input type="text" class="form-control round" id="name" name="name" value="{{!empty(old('name')) ? old('name') : session('bulk_voice_data')['name']}}">
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="file_upload">Upload Contacts (We support the following file formats: .CSV, .TXT, .XLSX, .XLS) </label>
                                        <input type="file" class="form-control round" id="file_upload" name="file_upload" >
                                    </div>
                                    <input type="hidden" name="step" value="{{$step}}">
                                    <div class="form-group">
                                        <label class="control-label" for="schedule_date">Schedule Delivery</label>
                                        <input type="text" class="form-control round pick-me" id="sendschedule_dateer_id" name="schedule_date" value="{{!empty(old('schedule_date')) ? old('schedule_date') : isset(session('bulk_voice_data')['schedule_date']) ? session('bulk_voice_data')['schedule_date'] : ''}}" readonly>
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="image_upload">Audio Content</label>
                                        <input type="file" class="form-control round" id="audio_upload" name="audio_upload" >
                                        <p>Supported file formats are .mp3, .wav, max file size 5 MB, max duration 60 seconds</p>
                                    </div>
                                        <div class="form-group">
                                            <div class="col-md-4 col-md-offset-8">
                                                <label><input checked="checked" type="checkbox" name="remove_duplicate" value="1"> Remove Duplicate</label>
                                            </div>
                                        </div>
                                            <div class="form-group">
                                        <div class="col-md-6">
                                        </div>
                                        <div class="col-md-6">
                                            <input type="submit" name="next" class="btn btn-primary btn-block" value="NEXT &raquo;">
                                        </div>
                                    </div>
                                </form>
                            </div>

                            @elseif($step===2)

                                <div class="wizard-pane {{("$step"==="2") ? 'active' : ''}}" id="confirmation" role="tabpanel">
                                    <form method="post" id="confirmation_form">
                                        @if(count($errors)>0)
                                            <div class="alert alert-danger">
                                                <ul>
                                                    @foreach($errors->all() as $error)
                                                        <li>{{$error}}</li>
                                                    @endforeach
                                                </ul>
                                            </div>
                                        @endif
                                    <input type="hidden" name="step" value="{{$step}}">
                                    @csrf
                                        <div style="font-size: 15px; text-align: center;">
                                            We are about to process your campaign
                                            <b>{{session('bulk_voice_data')['name']}}</b>
                                             with the following details</b><br /><br />
                                        </div>
                                            <div class="row">
                                                <div class="col-md-3">
                                                <span>
                                                    <img style="width: 50%" src="{{asset('img/calendar.png')}}">
                                                </span><br />
                                                    <div style="font-weight: bold; text-decoration: underline; color: green">
                                                        Schedule date
                                                    </div>
                                                    <b>{{empty(session('bulk_voice_data')['schedule_date']) ? 'Send Now' : session('bulk_voice_data')['schedule_date']}}</b>
                                                </div>
                                                <div class="col-md-3">
                                                   <span>
                                                        <img style="width: 50%" src="{{asset('img/contact.png')}}">
                                                    </span><br />
                                                    <div style="font-weight: bold; text-decoration: underline; color: green">
                                                        Total Recipients
                                                    </div>
                                                    <b>{{session('bulk_voice_data')['recipients']}} Recipients</b>
                                                </div>
                                                <div class="col-md-3">
                                                <span>
                                                    <img style="width: 50%" src="{{asset('img/wallet.png')}}">
                                                </span><br />
                                                    <div style="font-weight: bold; text-decoration: underline; color: green">
                                                        Credit Available
                                                    </div>
                                                    <b> {{session('bulk_voice_data')['credit_available']}} {{auth()->user()->currency}}</b>
                                                </div>
                                            </div>

                                        <br />
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div style="font-weight: bold; text-decoration: underline; color: green">
                                                    Audio File Path:
                                                </div>
                                                <div style="width: 70%">
                                                    <b>{{session('bulk_voice_data')['audioFile']}}</b>
                                                </div>
                                            </div>
                                        </div>
                                        <br />

                                    <div class="form-group">
                                        <div class="col-md-6">
                                            <input type="submit" name="back" class="btn btn-warning btn-block" value="&laquo; BACK">
                                        </div>
                                        <div class="col-md-6">
                                            <input type="submit" name="submit" class="btn btn-primary btn-block" value="SUBMIT">
                                        </div>
                                    </div>
                                    </form>
                                </div>
                            @endif
                        </div>

                        <!-- End Wizard Content -->
                    @endif
                    </div>
                </div>
                <!-- End Panel Wizard One Form -->
            </div>

        </div>
    </div>
@endsection

@push('scripts')
    <script type="text/javascript" src="{{asset('js/DateTimePicker.min.js')}}"></script>
@endpush

