@extends('reseller.layouts.master')

@section('page_title')
    Update Account Data
@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')}}" />
    <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>


    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.css"/>
    <link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid-theme.min.css"/>
    <link rel="stylesheet" href="{{asset('assets/examples/css/pages/profile.min3f0d.css?v2.2.0')}}">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css"/>
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
    <style>
        label {
            color: black;
            font-weight: normal;
            font-size: medium;
            font-family: 'Lato', sans-serif;
        }

        .lato {
            font-family: 'Lato', sans-serif;
        }
    </style>

    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Roboto:300,400,500,300italic'>
    <script src="{{asset('js/modernizr.min.js')}}"></script>
@endpush

@section('page_content')
    <div class="page-content container">
        <div class="row">

            @include('includes.side_profile')

            <div class="col-md-9">
                <div class="panel">
                    <div class="panel-body nav-tabs-animate nav-tabs-horizontal">


                        @if(count($errors)>0)
                            <div class="alert alert-danger">
                                <ul>
                                    @foreach($errors->all() as $error)
                                        <li>
                                            {{$error}}
                                        </li>
                                    @endforeach
                                </ul>
                            </div>
                        @endif
                            <form method="post" enctype="multipart/form-data" class="registration lato">
                                @if(session('success'))
                                    <div class="alert alert-success">
                                        <ul>
                                            <li>{{ session('success') }}</li>
                                        </ul>
                                    </div>
                                @endif

                                @csrf
                                <div class="row">
                                    <div class="col-md-12 text-center">
                                        <h3><em>Update Account Details </em></h3>
                                        <hr>
                                    </div>
                                    <div class="col-md-12 text-center">
                                        <a id="terms" class="btn btn-sm" style="background-color: #CC0000; color: white"><i class="fa"></i> TERMS & CONDITIONS</a>
                                    </div>

                                </div>

                                <hr>

                                <div class="form-group col-md-12 text-center {{ $errors->has('register_as') ? ' has-error' : '' }}">
                                    <label for="inputEmail4"><strong>Register As</strong> <em
                                            class="text-danger">*</em></label>
                                    <div class="row">
                                        <div class="col-md-4 col-md-offset-4">
                                            @php $var = old('register_as') @endphp
                                            <select class="form-control" required name="register_as">
                                                <option value="reseller" selected>Reseller</option>
                                            </select>
                                            @if ($errors->has('register_as'))
                                                <span class="text-danger help-block">
                                        		<strong>{{ $errors->first('register_as') }} </strong>
                                    		</span>
                                            @endif
                                        </div>
                                    </div>
                                </div>

                                <div class="row">

                                    <div class="form-group col-md-6 {{ $errors->has('name') ? 'has-error' : '' }}">
                                        <label for="inputEmail4">Name Of Company / Individual <em class="text-danger">*</em></label>
                                        <input type="text" class="form-control" value="{{old('name')}}" name="name"
                                               placeholder="" required>
                                        @if ($errors->has('name'))
                                            <strong class="text-danger">{{ $errors->first('name') }} </strong>
                                        @endif
                                    </div>

                                    <div class="form-group {{ $errors->has('nature_of_business') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputAddress">Nature Of Business <em class="text-danger">*</em></label>
                                        {{--                                    <input type="text" class="form-control" value="{{old('nature_of_business')}}" name="nature_of_business" placeholder="nature of business" required>--}}
                                        <select class="field-group" name="nature_of_business">
                                            <option></option>
                                            <option value="Arts, entertainment and recreation ">Arts, entertainment and recreation </option>
                                            <option value="Banking & finance">Banking & finance </option>
                                            <option value="Beauty industry">Beauty industry  </option>
                                            <option value="Educational services">Educational services</option>
                                            <option value="Health care and social assistance">Health care and social assistance </option>
                                            <option value="Information and cultural industries">Information and cultural industries</option>
                                            <option value="Information Technology">Information Technology</option>
                                            <option value="Insurance">Insurance</option>
                                            <option value="Manufacturing">Manufacturing</option>
                                            <option value="Mining, quarrying, and oil and gas ">Mining, quarrying, and oil and gas </option>
                                            <option value="Non-Governmental Organisations">Non-Governmental Organisations </option>
                                            <option value="Other services ">Other services </option>
                                            <option value="Public administration">Public administration</option>
                                            <option value="Real estate, rental and leasing">Real estate, rental and leasing </option>
                                            <option value="Religious Organisations">Religious Organisations </option>
                                            <option value="Retail trade ">Retail trade  </option>
                                            <option value="Transportation and warehousing">Transportation and warehousing  </option>
                                            <option value="Utilities">Utilities</option>
                                            <option value="Waste management">Waste management</option>
                                            <option value="Wholesale trade">Wholesale trade</option>

                                        </select>

                                        @if ($errors->has('nature_of_business'))
                                            <strong class="text-danger">{{ $errors->first('nature_of_business') }} </strong>
                                        @endif
                                    </div>

                                    <div class="form-group {{ $errors->has('physical_address') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputCity">Business Location <em class="text-danger"></em></label>
                                        <input type="text" class="form-control" value="{{old('physical_address')}}"
                                               name="physical_address" placeholder="Location, Region" required>
                                        @if ($errors->has('physical_address'))
                                            <strong class="text-danger">{{ $errors->first('physical_address') }} </strong>
                                        @endif
                                    </div>

                                    <div class="form-group {{ $errors->has('company_phone_number') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputState">Company / Individual Phone number <em class="text-danger"></em></label>
                                        <input type="text" class="form-control company-phone" name="company_phone_number" value="{{old('company_phone_number')}}" placeholder="Registered MTN, AIRTELTIGO, VODAFONE, GLO">
                                        <span class="text-danger" id="mm-phone"><em></em></span>
                                        <span class="badge badge-danger company-alert"></span>
                                        @if ($errors->has('company_phone_number'))
                                            <strong class="text-danger">{{ $errors->first('company_phone_number') }} </strong>
                                        @endif
                                    </div>

                                    <div class="form-group {{ $errors->has('mobile_money_number') ? 'has-error' : '' }} col-md-6">
                                        <label for="mobile_money_number">Mobile Money Number <em class="text-danger"></em></label>
                                        <input id="mobile_money_number" type="text" class="form-control " name="mobile_money_number" value="{{old('mobile_money_number')}}" placeholder="Mobile Money Number">
                                        <span class="text-danger" id="mm-phone"><small>(Credit purchase can be done on this number or changed upon credit purchasing)</small></span>

                                        @if ($errors->has('mobile_money_number'))
                                            <strong class="text-danger">{{ $errors->first('mobile_money_number') }} </strong>
                                        @endif
                                    </div>

                                    <hr>

                                    <div class="form-group {{ $errors->has('business_logo') ? 'has-error' : '' }} col-md-6">
                                        <label for="mobile_money_number">Business Registration Logo <em class="text-danger"></em></label>
                                        <input type="file"  accept="image/*"  class="form-control " name="business_logo" value="{{old('business_logo')}}">

                                        @if ($errors->has('business_logo'))
                                            <strong class="text-danger">{{ $errors->first('business_logo') }} </strong>
                                        @endif
                                    </div>

                                </div>

                                <hr>


                                <h4>Contact Person Information <em class="text-danger">*</em></h4>
                                <hr>

                                <div class="row">
                                    <div class="form-group {{ $errors->has('contact_person') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputState">Name <em class="text-danger">*</em></label>
                                        <input type="text" class="form-control" value="{{old('contact_person',auth()->user()->full_name)}}"
                                               name="contact_person" placeholder="Contact Person's name" required>

                                        @if ($errors->has('contact_person'))
                                            <strong class="text-danger">{{ $errors->first('contact_person') }} </strong>
                                        @endif
                                    </div>

                                    <div class="form-group {{ $errors->has('contact_person_email') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputState">Email <em class="text-danger">*</em></label>
                                        <input type="text" class="form-control email"
                                               value="{{old('contact_person_email',auth()->user()->email)}}" name="contact_person_email"
                                               placeholder="Contact Person's email" required>
                                        <span class="badge badge-danger email-alert"></span>

                                        @if ($errors->has('contact_person_email'))
                                            <strong class="text-danger">{{ $errors->first('contact_person_email') }} </strong>
                                        @endif
                                    </div>
                                </div>
                                <div class="row">

                                    <div class="form-group {{ $errors->has('contact_person_phone') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputState">Phone Number <em class="text-danger">*</em></label>
                                        <input type="text" class="form-control" id="contact_person_phone" value="{{old('contact_person_phone')}}" name="contact_person_phone"  placeholder="Contact Person's phone" required>
                                        <span class="text-danger"><em>(All OTPs for verification will be sent to this number)</em></span>

                                        @if ($errors->has('contact_person_phone'))
                                            <strong class="text-danger">{{ $errors->first('contact_person_phone') }} </strong>
                                        @endif
                                    </div>


                                    <div class="form-group {{ $errors->has('contact_person_id') ? 'has-error' : '' }} col-md-6">
                                        <label for="inputState">ID <em class="text-danger"></em></label>
                                        <input type="file" class="form-control" value="{{old('contact_person_id')}}" name="contact_person_id" placeholder="Contact Person  Id">

                                        @if ($errors->has('contact_person_id'))
                                            <strong class="text-danger">{{ $errors->first('contact_person_id') }} </strong>
                                        @endif
                                    </div>
                                </div>


                                <hr>

                                <div class="form-row text-center">
                                    <div class="col-md-12">
                                        <button type="submit" class="btn then-submit" style="background-color: #4285F4; color: white"><i class="fa fa-plus-circle"></i> Register</button>
                                    </div>
                                </div>
                            </form>

                    </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;">Deywuro <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>
                        11.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">
                    {{--				<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">Close</button>--}}
                    <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://stackpath.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>--}}
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.js"></script>
    <script>
        $(function () {
            $('.pick-me').daterangepicker({
                singleDatePicker: true,
                showDropdowns: true,
                minYear: 1901,
                maxYear: parseInt(moment().format('YYYY'), 10)
            }, function (start, end, label) {
                const years = moment().diff(start, 'years');
            });
        });
        //
        // $(document).ready(function () {
        //     $('#register-btn').on('click', function (t) {
        //         t.preventDefault();
        //         $('#conditions').modal('toggle');
        //         $('.agree').on('click', function () {
        //             let value = $(this).val();
        //             if (value === 'yes') {
        //                 $('#conditions').modal('toggle');
        //                 $('.registration').submit();
        //             }
        //         })
        //
        //     })
        //
        // });

        $("#directors").jsGrid({
            width: "100%",
            height: "250px",

            inserting: true,
            editing: true,
            sorting: true,
            paging: true,

            data: [],

            fields: [
                {name: "Name", type: "text", width: 50, validate: "required"},
                {name: "Designation", type: "text", width: 50},
                {type: "control"}
            ]
        });

        $("#sender-ids").jsGrid({
            width: "100%",
            height: "250px",

            inserting: true,
            editing: true,
            sorting: true,
            paging: true,

            data: [],

            fields: [
                {
                    name: "Name", type: "text", width: 50, validate: "required", _createTextBox: function () {
                        const $input = jsGrid.fields.text.prototype._createTextBox.call(this);
                        return $input.attr("maxlength", 11);
                    }
                },
                {type: "control"}
            ]
        });


        $('.registration').on('submit', function () {
           const grid = $("#directors").jsGrid("option", "data"),
            grid2 = $("#sender-ids").jsGrid("option", "data");
            $('#items').val(JSON.stringify(grid));
            $('#sender_ids').val(JSON.stringify(grid2));
        });

        $(".email").keyup(function () {

            let value = $(this).val();
            let contents = value.indexOf('@');

            if (contents === -1) {
                $('.email-alert').html('Please enter a valid email');
                // $('#register-btn').prop('disabled',true);
            } else {
                $('.email-alert').html("");
                // $('#register-btn').prop('disabled',false);
            }


        });

        $('.company-phone').keyup(function () {
            let value = $(this).val();
            let count = value.length;
            let contents = $.isNumeric(value);

            if (contents && count > 9) {
                $('.company-alert').html('');
                // $('#register-btn').prop('disabled',false);
            } else {
                $('.company-alert').html('Please enter a valid phone number');
                // $('#register-btn').prop('disabled',true);
            }


        });

        $('.con-phone').keyup(function () {
            let value = $(this).val();
            let count = value.length;
            let contents = $.isNumeric(value);
            console.log(count);

            if (contents && count > 9) {
                $('.contact-phone').html('');
                // $('#register-btn').prop('disabled',false);

            } else {
                $('.contact-phone').html('Please enter a valid phone number');
                // $('#register-btn').prop('disabled', true);
            }

        });

        $('#mobile_money_number').keyup(function () {
            let value = $(this).val();
            let count = value.length;
            let contents = $.isNumeric(value);
            console.log(count);

            if (contents && count > 9) {
                $('#mm-phone').html('');
                // $('#register-btn').prop('disabled',false);

            } else {
                $('#mm-phone').html('Please enter a valid phone number');
                // $('#register-btn').prop('disabled', true);
            }

        });

    </script>
@endpush
