@extends('layouts.master')

@section('title', 'IV Media - Increase your popularity')
@section('content')
<!-- Start content -->
<div class="content">
    <div class="container-fluid">

        <div class="row">
            <div class="col-xl-12">
                <div class="page-title-box">
                    <h4 class="page-title float-left">Dashboard</h4>

                    <ol class="breadcrumb float-right">
                        <li class="breadcrumb-item"><a href="{{ url('/') }}">{!! \App\Helper::panelName() !!}</a>
                        </li>
                        <li class="breadcrumb-item active">Dashboard</li>
                    </ol>

                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
        <!-- end row -->


        <div class="row">
            @if ($flash = session('message'))
              <div class="col-md-12">
                <div class="alert alert-success" role="alert">
                  <ul style="margin-bottom:0;">
                  @foreach ($flash as $key => $val)
                    <li>{{$key.' => '.$val}}</li>
                  @endforeach
                  </ul>
                </div>
              </div>
            @endif
            <div class="col-xs-12 col-md-6">
                <div class="card-box">
                    <h4 class="header-title m-t-0 m-b-30">Register User</h4>
                    <div class="row">
                        <div class="col-12">
                            <form action="{{ url('user/register') }}" method="POST">
                                {{ csrf_field() }}

                                <fieldset class="form-group">
                                    <label for="url">Saldo Sekarang</label>
                                    <input type="text" class="form-control" value="Rp. {{ number_format(auth()->user()->saldo, 0) }}" readonly>
                                </fieldset>

                                <fieldset class="form-group">
                                    <label for="username">Username</label>
                                    <input type="text" class="form-control {{ $errors->has('username') ? ' parsley-error' : '' }}" id="username" name="username" value="{{ old('username') }}">
                                    @if ($errors->has('username'))
                                        <span class="help-block">
                                            <ul class="parsley-errors-list filled"><li class="parsley-required">{{ $errors->first('username') }}</li></ul>
                                        </span>
                                    @endif
                                </fieldset>

                                <fieldset class="form-group">
                                    <label for="password">Password</label>
                                    <input type="text" class="form-control {{ $errors->has('password') ? ' parsley-error' : '' }}" id="password" name="password" value="{{ old('password') }}">
                                    @if ($errors->has('password'))
                                        <span class="help-block">
                                            <ul class="parsley-errors-list filled"><li class="parsley-required">{{ $errors->first('password') }}</li></ul>
                                        </span>
                                    @endif
                                </fieldset>

                                <fieldset class="form-group">
                                    <label for="password_confirmation">Confirm Password</label>
                                    <input type="text" class="form-control {{ $errors->has('password_confirmation') ? ' parsley-error' : '' }}" id="password_confirmation" name="password_confirmation" value="{{ old('password_confirmation') }}">
                                    @if ($errors->has('password_confirmation'))
                                        <span class="help-block">
                                            <ul class="parsley-errors-list filled"><li class="parsley-required">{{ $errors->first('password_confirmation') }}</li></ul>
                                        </span>
                                    @endif
                                </fieldset>

                                <fieldset class="form-group">
                                    <label for="level">Level</label>
                                    <select class="form-control" id="level" name="level">
                                        <option value="member">Member</option>
                                        @if (auth()->user()->level == 'admin')
                                        <option value="reseller">Reseller</option>
                                        <option value="priority">Priority</option>
                                        @endif
                                    </select>
                                    @if ($errors->has('level'))
                                        <span class="help-block">
                                            <ul class="parsley-errors-list filled"><li class="parsley-required">This value is required.</li></ul>
                                        </span>
                                    @endif
                                </fieldset>

                                <fieldset class="form-group">
                                    <label for="durasi">Durasi</label>
                                    <select class="form-control" id="durasi" name="durasi">
                                      @if (auth()->user()->level == 'admin')
                                      <option value="1">1 Hari</option>
                                      @endif
                                      <option value="3">3 Hari</option>
                                      <option value="7">1 Minggu</option>
                                      <option value="14">2 Minggu</option>
                                      <option value="30">1 Bulan</option>
                                    </select>
                                    @if ($errors->has('durasi'))
                                        <span class="help-block">
                                            <ul class="parsley-errors-list filled"><li class="parsley-required">This value is required.</li></ul>
                                        </span>
                                    @endif
                                </fieldset>

                                <button type="submit" class="btn btn-primary btn-block">Save</button>

                            </form>
                        </div>
                    </div><!-- end row -->
                </div>
            </div>
            <div class="col-md-6 col-xs-12">
                <div class="card-box">
                    <h4 class="header-title m-t-0 m-b-30"><span class="label label-primary">{{ auth()->user()->level }}</span> {!! \App\Helper::panelName() !!} TAMBAH MEMBER</h4>
                    <ul class="list-group">
                      <li class="list-group-item">Selamat Datang Di {!! \App\Helper::panelName() !!} PANEL</li>
                      <li class="list-group-item">Jika ingin menambah user, silahkan isi seluruh data</li>
                      <li class="list-group-item">
                        Setiap pendaftaran member , saldo akan berkurang :<br>
                        <strong>
                        @if (auth()->user()->level == 'admin')
                        1 Hari : Rp 7.000 Saldo<br>
                        @endif
                        3 Hari : Rp 15.000 Saldo<br>
                        1 Minggu : Rp 30.000 Saldo<br>
                        2 Minggu : Rp 55.000 Saldo<br>
                        1 Bulan : Rp 100.000 Saldo
                        </strong>
                      </li>
                    </ul>
                </div>
                @if($data = session('data'))
                <div class="card-box">
                    <h4 class="header-title m-t-0 m-b-30">Success add <span class="label label-primary">{{ $data['level'] }}</span></h4>
                    <ul class="list-group">
                      <li class="list-group-item">Uplink: {{ auth()->user()->username }}</li>
                      <li class="list-group-item">Username: {{ $data['username'] }}</li>
                      <li class="list-group-item">Password: {{ session('userPassword') }}</li>
                      <li class="list-group-item">Durasi: {{ $data['durasi'] }} hari</li>
                      <li class="list-group-item">Tanggal Transaksi: {{ date('d M Y H:i') }}</li>
                      <li class="list-group-item">Expired: {{ date('d M Y H:i', strtotime(session('expired'))) }}</li>
                      <li class="list-group-item">Link: {{ url('/') }}</li>
                    </ul>
                </div>
                @endif
            </div>
        </div>
        <!-- end row -->
    </div>
    <!-- container -->

</div>
<!-- content -->
@endsection

@section('js')
<script>
  var resizefunc = [];
</script>
@endsection
