@extends('app')

@section('page_title')
    Profile
@endsection

@push('styles')
    <link rel="stylesheet" href="{{ asset('assets/examples/css/pages/profile.min3f0d.css?v2.2.0') }}">
@endpush

@section('page_content')
    <div class="page-content container-fluid" style="color: #000;">
        <div class="row">
            @include('includes.side_profile')

            <div class="col-md-9">
                <!-- Panel -->
                <div class="panel">
                    <div class="panel-body nav-tabs-animate nav-tabs-horizontal">
                        <ul class="nav nav-tabs nav-tabs-line" data-plugin="nav-tabs" role="tablist">
                            <li class="{{ empty($panel) ? 'active' : '' }}" role="presentation"><a data-toggle="tab"
                                    href="#profile" aria-controls="activities" role="tab" style="color: #000; font-size: 13px;">Profile</a></li>
                            <li role="presentation"><a data-toggle="tab" href="#pwd" aria-controls="messages"
                                    role="tab" style="color: #000; font-size: 13px;">Password</a></li>
                            <li role="presentation"><a data-toggle="tab" href="#balance_alert" aria-controls="messages"
                                    role="tab" style="color: #000; font-size: 13px;">Balance Threshold Alert</a></li>
                            <li class="{{ !empty($panel) && $panel == 'sender_id' ? 'active' : '' }}" role="presentation">
                                <a data-toggle="tab" href="#sender_id" aria-controls="messages" role="tab"
                                   style="color: #000; font-size: 13px;">Sender IDs</a>
                            </li>
                            <li class="{{ !empty($panel) && $panel == 'email' ? 'active' : '' }}" role="presentation"><a
                                    data-toggle="tab" href="#email_tab" aria-controls="messages" role="tab"
                                    style="color: #000; font-size: 13px;">Email IDs</a></li>
                            <li class="" role="presentation"><a
                                    data-toggle="tab" href="#policy_tab" aria-controls="messages" role="tab"
                                    style="color: #000; font-size: 13px;">Terms & conditions</a></li>
                            <li class="dropdown" role="presentation" style="display: none;">
                                <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                                    <span class="caret"></span>Menu </a>
                                <ul class="dropdown-menu" role="menu">
                                    <li role="presentation" style="display: none;"><a data-toggle="tab" href="#profile"
                                            aria-controls="activities" role="tab">Profile</a></li>
                                    <li role="presentation"><a data-toggle="tab" href="#pwd" aria-controls="messages"
                                            role="tab">Password</a></li>
                                    <li role="presentation"><a data-toggle="tab" href="#sender_id" aria-controls="messages"
                                            role="tab">Sender IDs</a></li>
                                </ul>
                            </li>
                        </ul>

                        <div class="tab-content">
                            <div class="tab-pane {{ empty($panel) ? 'active' : '' }} animation-slide-left" id="profile"
                                role="tabpanel">
                                <br />
                                <form method="post" id="profile_form" enctype="multipart/form-data">
                                    @include('account._notify')
                                    {{ csrf_field() }}
                                    <div class="form-group">
                                        <label class="control-label" for="first_name">Username</label>
                                        <input type="text" class="form-control round" id="username" name="username"
                                            value="{{ $user->username }}" disabled="disabled">
                                    </div>
                                    {{--                  <div class="form-group"> --}}
                                    {{--                    <label class="control-label" for="first_name">First Name</label> --}}
                                    {{--                    <input type="text" class="form-control round" id="first_name" name="first_name" value="{{empty(old('first_name')) ? $user->first_name : old('first_name')}}"> --}}
                                    {{--                  </div> --}}
                                    {{--                  <div class="form-group"> --}}
                                    {{--                    <label class="control-label" for="last_name">Last Name</label> --}}
                                    {{--                    <input type="text" class="form-control round" id="last_name" name="last_name" value="{{empty(old('last_name')) ? $user->last_name : old('last_name')}}"> --}}
                                    {{--                  </div> --}}
                                    <div class="form-group">
                                        <label class="control-label" for="organisation">Organisation</label>
                                        <input type="text" class="form-control round" id="organisation"
                                            name="organisation"
                                            value="{{ empty(old('organisation')) ? $user->organisation : old('organisation') }}">
                                    </div>
                                    {{--                  <div class="form-group"> --}}
                                    {{--                    <label class="control-label" for="picture">Picture/Logo</label> --}}
                                    {{--                    <input type="file" class="form-control round" id="picture" name="picture"> --}}
                                    {{--                  </div> --}}
                                    <div class="form-group">
                                        <label class="control-label" for="phone_number">Phone Number</label>
                                        <input type="text" class="form-control round" id="phone_number"
                                            name="phone_number"
                                            value="{{ empty(old('phone_number')) ? $user->phone_number : old('phone_number') }}">
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label" for="mobile_money_number">Mobile Money Number</label>
                                        <input type="text" class="form-control round" id="mobile_money_number"
                                            name="mobile_money_number"
                                            value="{{ empty(old('mobile_money_number')) ? $user->company->mobile_money_number : old('mobile_money_number') }}">
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="website_url">Website URL</label>
                                        <input type="text" class="form-control round" id="website_url"
                                            name="website_url"
                                            value="{{ empty(old('website_url')) ? $user->website_url : old('website_url') }}">
                                    </div>
                                    <div class="form-group">
                                        <input type="submit" name="btnSubmit" class="btn btn-primary btn-block"
                                            value="Save Changes" style="background-color: #ffcb05; color: #000;">
                                    </div>
                                </form>
                            </div>

                            <div class="tab-pane animation-slide-left" id="pwd" role="tabpanel">
                                <br />
                                <form method="post" id="password_form">
                                    @include('account._notify')
                                    {{ csrf_field() }}
                                    <div class="form-group">
                                        <label class="control-label" for="current_password">Current Password</label>
                                        <input type="password" class="form-control round" id="current_password"
                                            name="current_password" value="">
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="new_password">New Password</label>
                                        <input type="password" class="form-control round" id="new_password"
                                            name="new_password" value="">
                                    </div>
                                    <div class="form-group">
                                        <label class="control-label" for="confirm_password">Confirm New Password</label>
                                        <input type="password" class="form-control round" id="confirm_password"
                                            name="confirm_password" value="">
                                    </div>
                                    <div class="form-group">
                                        <input type="submit" name="btnPassword" class="btn btn-primary btn-block"
                                            value="Update" style="background-color: #ffcb05; color: #000;">
                                    </div>
                                </form>
                            </div>


                            <div class="tab-pane animation-slide-left" id="balance_alert" role="tabpanel">
                                <br />
                                <form method="post" id="balance_form">
                                    @if (count($errors) > 0)
                                        <div class="alert alert-danger">
                                            <ul>
                                                @foreach ($errors->all() as $error)
                                                    <li>{{ $error }}</li>
                                                @endforeach
                                            </ul>
                                        </div>
                                    @endif
                                    @if (session('success'))
                                        <div class="alert alert-success">
                                            <ul>
                                                <li>{{ session('success') }}</li>
                                            </ul>
                                        </div>
                                    @endif
                                    {{ csrf_field() }}

                                    <div class="form-group">
                                        <label class="control-label" for="phone_number">Phone Number for Alert <span
                                                class="text-danger">(required)</span></label>
                                        <input required type="text" class="form-control round" id="phone_number"
                                            name="phone_number"
                                            value="{{ $balance_threshold ? $balance_threshold->phone_number : old('phone_number') }}">
                                    </div>

                                    <div class="form-group">
                                        <label class="control-label" for="email">Email for Alert <span
                                                class="" style="color: #ffcb05;">(optional)</span></label>
                                        <input type="text" class="form-control round" id="email" name="email"
                                            value="{{ $balance_threshold ? $balance_threshold->email : old('email') }}">
                                    </div>

                                    <hr class=" border">
                                    <div class="mx-auto text-center tooltip-text-info" style="color: #ffcb05;"> Credit Threshold
                                        amount : (multiple alert amounts up to 3)</div>
                                    <hr class="border">

                                    <div class="row" style="">

                                        <div class="form-group col-md-4">
                                            <label class="control-label" for="credit_threshold">Credit Threshold amount
                                                <span class="text-danger">(required)</span></label>
                                            <input required type="number" min="0" step="0.000001"
                                                class="form-control round" id="credit_threshold"
                                                name="credit_threshold_1"
                                                value="{{ $balance_threshold ? $balance_threshold->credit_threshold_1 : old('credit_threshold_1') }}">
                                        </div>

                                        <div class="form-group col-md-4">
                                            <label class="control-label" for="credit_threshold">Credit Threshold amount
                                                <span class="" style="color: #ffcb05;">(optional)</span></label>
                                            <input type="number" min="0" step="0.000001"
                                                class="form-control round" id="credit_threshold"
                                                name="credit_threshold_2"
                                                value="{{ $balance_threshold ? $balance_threshold->credit_threshold_2 : old('credit_threshold_2') }}">
                                        </div>

                                        <div class="form-group col-md-4 border border-2">
                                            <label class="control-label" for="credit_threshold">Credit Threshold amount
                                                <span class="" style="color: #ffcb05;">(optional)</span></label>
                                            <input type="number" min="0" step="0.000001"
                                                class="form-control round" id="credit_threshold"
                                                name="credit_threshold_3"
                                                value="{{ $balance_threshold ? $balance_threshold->credit_threshold_3 : old('credit_threshold_3') }}">
                                        </div>
                                    </div>


                                    <div class="form-group">
                                        <input type="submit" name="set_threshold" class="btn btn-primary btn-block"
                                            value="Submit" style="background-color: #ffcb05; color: #000;">
                                    </div>
                                </form>
                            </div>

                            <div class="tab-pane animation-slide-left  {{ !empty($panel) && $panel == 'sender_id' ? 'active' : '' }}"
                                id="sender_id" role="tabpanel">

                                <br>
                                <form class="form-inline" method="post" action="{{ route('user.sender-id.submit') }}">
                                    @include('account._notify')
                                    {{ csrf_field() }}
                                    <label class="sr-only" for="inlineFormInputName2">Add New Sender Id </label>
                                    <input type="text" maxlength="11" class="form-control mb-2 mr-sm-2"
                                        id="inlineFormInputName2" name="sender_id" placeholder="Add New Sender Id"
                                        required>

                                    <button type="submit" class="btn btn-primary mb-2" style="background-color: #ffcb05; color: #000;">Submit</button>
                                </form>

                                <br>


                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>Sender_Id</th>
                                            <th>Status</th>
                                            <th>Comment</th>
                                            <th>Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach ($sender_ids as $ids)
                                            <form class="form-inline" method="post"
                                                action="{{ route('user.sender-id.edit', ['id' => $ids->id]) }}">
                                                {{ csrf_field() }}
                                                <tr>
                                                    <td><input type="text" maxlength="11"
                                                            class="form-control mb-2 mr-sm-2" name="sender_id"
                                                            value="{{ $ids->sender_id }}" required /></td>
                                                    <td><input type="text" class="form-control mb-2 mr-sm-2"
                                                            id=""
                                                            value="{{ $ids->status == false ? 'pending approval' : ($ids->status == 1 ? 'Approved' : 'Rejected') }}"
                                                            readonly></td>
                                                    <td>
                                                        <textarea type="text" class="form-control mb-2 mr-sm-2" readonly>{{ $ids->comment }}</textarea>
                                                    </td>
                                                    <td><button type="submit"
                                                            class="btn btn-sm btn-primary mb-2" style="background-color: #ffcb05; color: #000;">Save</button>
                                                        <a
                                                            style="background-color: #000; color: #ffcb05;"
                                                            type="submit"
                                                            href="{{ route('user.sender-id.destroy', ['id' => $ids->id]) }}"
                                                            onclick="return confirm('Do you want to delete this sender ID ?')"
                                                            class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></a>
                                                    </td>
                                                </tr>
                                            </form>
                                        @endforeach




                                    </tbody>
                                </table>
                            </div>

                            <div class="tab-pane animation-slide-left  {{ !empty($panel) && $panel == 'email' ? 'active' : '' }}"
                                id="email_tab" role="tabpanel">

                                <br>
                                <form class="form-inline" method="post" action="{{ route('setup.client.email') }}">
                                    {{ csrf_field() }}
                                    @if (count($errors) > 0)
                                        <div class="alert alert-danger">
                                            <ul>
                                                @foreach ($errors->all() as $error)
                                                    <li>{{ $error }}</li>
                                                @endforeach
                                            </ul>
                                        </div>
                                    @endif
                                    @if (session('success'))
                                        <div class="alert alert-success">
                                            <ul>
                                                <li>{{ session('success') }}</li>
                                            </ul>
                                        </div>
                                    @endif
                                    <label class="sr-only" for="inlineFormInputName2">Add Email Source </label>
                                    <input type="text" class="form-control mb-2 mr-sm-2" name="source_mail"
                                        placeholder="Add Email Source" required>

                                    <button type="submit" class="btn btn-primary mb-2" style="background-color: #ffcb05; color: #000;">Submit</button>
                                </form>

                                <br>


                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>Email</th>
                                            <th>Status</th>
                                            <th>Comment</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                        @foreach ($emails as $email)
                                            <form class="form-inline" method="post"
                                                action="{{ route('setup.client.edit', ['id' => $email->id]) }}">
                                                {{ csrf_field() }}
                                                <tr>
                                                    <td><input type="text" class="form-control mb-2 mr-sm-2"
                                                            name="source_mail" value="{{ $email->source_mail }}"
                                                            required /></td>
                                                    <td><input type="text" class="form-control mb-2 mr-sm-2"
                                                            id=""
                                                            value="{{ $email->status == false ? 'pending approval' : ($email->status == 1 ? 'Approved' : 'Rejected') }}"
                                                            readonly></td>
                                                    <td>
                                                        <textarea type="text" class="form-control mb-2 mr-sm-2" readonly>{{ $email->comment }}</textarea>
                                                    </td>
                                                    <td><button
                                                            style="background-color: #ffcb05; color: #000;"
                                                            type="submit"
                                                            class="btn btn-sm btn-primary mb-2">Save</button>
                                                        <a
                                                            style="background-color: #000; color: #ffcb05;"
                                                            type="submit"
                                                            href="{{ route('setup.client.delete', ['id' => $email->id]) }}"
                                                            onclick="return confirm('Do you want to delete this email ID ?')"
                                                            class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></a>
                                                    </td>
                                                </tr>
                                            </form>
                                        @endforeach

                                    </tbody>
                                </table>
                            </div>

                            <div class="tab-pane animation-slide-left" id="policy_tab" role="tabpanel">
                                <br>
                                <a type="button" href="#" data-toggle="modal" data-target="#conditions">View
                                    Terms & Agreement</a>
                            </div>

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

        </div>
    </div>



    <div class="modal fade" tabindex="-1" role="dialog" id="conditions">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header"
                    style="background: #485563;background: -webkit-linear-gradient(to bottom, #29323c, #485563);background: linear-gradient(to bottom, #29323c, #485563);">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true" style="color:#fff !important;">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel" style="color:#ffc107"><img
                            src="{{ asset('UI/mt2.png') }}" style="vertical-align: center;width:3em;">MTN MESSENGER -
                        <font style="color:#fff">TERMS AND CONDITIONS</font>
                    </h4>
                </div>
                <div class="modal-body">
                    <p style="line-height: 2em">
                    <h4>INTRODUCTION</h4>
                    <hr>
                    <p>
                        These Terms and Conditions, forms the basis of the legal relationship between Npontu Technologies
                        and all its clients who make use of this platform for both personal and professional reasons. It
                        also incorporates the provisions of our Privacy Policy.
                    </p>

                    <br>
                    <h4>INTERPRETATION</h4>
                    <hr>

                    <p>
                        App, Application or System - this refers to Npontu’s proprietary application that enables the
                        sending of messages via multiple channels.
                        Network Operator - means any party licensed to install, operate and maintain a cellular telephony
                        network;
                        Services - shall mean and include all products and services offered or provided to Users by BulkSMS,
                        Email, etc.
                        User - shall mean any natural or legal person who makes use of any of the Services or who uses or
                        visits the application
                        Privacy - means the protection of information that identifies and or concerns an individual or a
                        group

                    </p>

                    <br>
                    <h4>SERVICES</h4>
                    <hr>

                    <p>
                        <li>
                            Npontu shall endeavour to make available uninterrupted use of its system and and delivery of all
                            messages sent using its application. However, the delivery of messages in this case SMS
                            messaging is largely dependent on the effective functioning of Network Operators' cellular
                            networks, network coverage and the recipient's mobile handset. Npontu does not and cannot
                            guarantee the availability of any Service, the delivery of SMS messages or the compatibility
                            between any message or content format and any mobile handsets or mobile operating systems.
                        </li>


                        <li>
                            The various Network Operators may modify, enhance, develop or discontinue components of their
                            services at any time without prior notice to us, in which event Npontu shall in turn modify,
                            enhance, develop or discontinue with the affected Services to Users without notice.
                        </li>


                        <li>
                            Npontu shall always endeavour to inform users of any updates, upgrades or downtimes to be
                            experienced on its application in so far as it is reasonably practicable.
                        </li>

                        <li>
                            Messages shall be deemed to have been delivered when Npontu has transmitted the messages to the
                            appropriate network and has received feedback status on same,
                        </li>
                        <li>
                            Npontu shall have the right to withhold, terminate or suspend the provision of Services to a
                            User at any time if not doing so may affect the brand of Npontu or impact negatively on its
                            services. The user shall not be refunded any cash in the stead of unused credit. Users are
                            therefore cautioned against the below and others like it:
                        </li>

                        a)The sending of spam on the platform
                        b)The use of the system to terminate fraudulent messages
                        c)The use of the application for phishing

                        Users hereby indemnify Npontu against any fine imposed on Npontu or any damages suffered by Npontu
                        because of any act or omission of the User that amounts to a breach of any law or code of conduct to
                        which Npontu may be subject. Upon notification of any such fine or damages, Users agree to
                        immediately pay the amount of such fine or damages to Npontu. Any amount not paid to Npontu within
                        48 hours of notification thereof shall accrue interest at the prevailing commercial bank rate per
                        annum.
                    </p>
                    <br>
                    <h3>SECURITY</h3>
                    <hr>
                    <p>

                        <li>
                            To use the platform, a User is required to complete the registration process and must provide
                            Npontu with up to date, complete and accurate information as requested by Npontu. Failure to
                            provide accurate and complete information on registration may result in termination and deletion
                            of the Users account. A User may also be required to choose a Username and password. Users are
                            responsible for maintaining the confidentiality of their Usernames and passwords and Users
                            undertake not to divulge their Username and passwords to any other person. A User is entirely
                            responsible for all activities that occur in its account and shall be strictly liable to make
                            payment of all charges incurred under its account whether these charges are incurred by the User
                            or any other person, authorised or unauthorised, intentionally or unintentionally, or as a
                            result of any virus, hack or security breach.
                        </li>

                        <li>
                            Users agree to notify Npontu immediately of any unauthorized use of their account(s) or any
                            other breach of security.
                        </li>

                        <li>
                            In the event that a User wishes to replace the name, details, person/employee using a specific
                            Npontu account of the User, and wishes to prevent the individual or person from accessing the
                            account, the account holder shall inform Npontu in writing of this change and change all details
                            on the account accordingly. Npontu may refuse to act on the instructions of an account holder
                            where the account holder fails to provide sufficient proof of its identity as the account holder
                            and the authority of the person purporting to represent it in making such a request and Npontu
                            shall have no liability to the account holder or the individual person where it refuses to act
                            in the absence of such proof, nor where it acts in good faith reliance of any information
                            submitted to it in support of any such request made by any person purporting to represent the
                            account holder, including in respect of any claims for breach of privacy, security or
                            confidentiality.
                        </li>

                    </p>
                    <br>
                    <h4>PRIVACY POLICY</h4>
                    <hr>

                    <p class="text-justify">
                        <li>
                            Npontu will not intercept, monitor, copy or disclose any User messages or personal information
                            about the
                            User or the User's messaging account, phonebook or MSISDN's, other than in the normal course of
                            the use of
                            the Services, without the User's prior permission unless Npontu believes in good faith that such
                            action is
                            necessary to conform to legal requirements, to co-operate or comply with legal process,
                            investigations,
                            summonses, subpoenas and the like, to protect and defend the rights, property or legally
                            protectable
                            interest of Npontu, the User or other third party, to enforce any of the provisions of these
                            terms and
                            conditions or to protect Npontu's business or reputation. The User agrees that Npontu if
                            necessary may
                            access its account and message contents for the purposes described above without notice and to
                            respond to
                            service or technical issues the User may communicate from time to time.
                        </li>
                        <br>

                        <li>
                            A recipient of a message has the right to know the identity of the sender, and this will be
                            disclosed on request to the recipient.
                        </li>
                        <br>

                        <li>
                            Users agree that Npontu may make use of app visits and non-identifiable account usage data for
                            statistical, research and marketing purposes. In providing its services, Npontu shall not in its
                            ordinary business process or share any data that allows any third party to identify any
                            individual persons. In accepting these terms services, a user agrees that Npontu may use and
                            share de-personalised data for purposes set out above.
                        </li>
                        <br>
                        <li>
                            Users agree that they shall not violate any privacy laws, regulations or applicable codes of
                            conduct relating to the protection of personal information of End Users
                        </li>

                        <br>

                        <li>
                            Where, for the purpose of providing the Services to you, any Npontu Service acts as an
                            Application Programming Interface ("API") for the purpose of specifying how different software
                            systems should interact with each other, or where for that same purpose any Npontu Service
                            interacts with other API's, including third party API's, we may pass and retrieve data,
                            including personal information, between the different software systems and third parties that
                            interact via those API's.
                        </li>

                        <li>
                            We may communicate with User’s, resellers and other persons by email and other messaging
                            applications. You may opt out from promotional and marketing communications.
                        </li>

                        <br>

                        For more information on our data protection policy or to report a breach please send mail to
                        privacy@npontu.com
                    </p>
                </div>
                <div class="modal-footer radio">
                    <div>
                        {{--            <div class="radio"> --}}
                        {{--              <label> --}}
                        {{--                <input type="radio" name="optionsRadios" class="agree" value="yes" > --}}
                        {{--                Yes --}}
                        {{--              </label> --}}

                        {{--              <label> --}}
                        {{--                <input type="radio" name="optionsRadios" class="agree"  value="no" checked> --}}
                        {{--                No --}}
                        {{--              </label> --}}

                        {{--            </div> --}}
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@push('scripts')
    {{--  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"   integrity="sha256-3edrmyuQ0w65f8gfBsqowzjJe2iM6n0nKciPUp8y+7E="   crossorigin="anonymous"></script> --}}
    <script src="https://code.jquery.com/jquery-2.2.4.min.js"
        integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
    <script async defer crossorigin="anonymous"
        src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2&appId=2228953320687170&autoLogAppEvents=1">
    </script>
@endpush
