@extends('template.layout')
@section('styles')
    <link href="{{ asset('css/pricing.css') }}" rel="stylesheet" type="text/css">
@endsection
@section('content')
    <h1 class="page-title">
        Bolsa de trabajo
    </h1>
    <div class="portlet light portlet-fit portlet-datatable bordered">

        <div class="portlet-body">

            <div class="portlet light portlet-fit portlet-form bordered">
                <div class="portlet-title col-lg-12 col-xs-12" style="padding: 25px 25px 25px 25px;">
                    <div class="caption">
                        <span class="caption-subject font-green sbold uppercase"> Mis Ofertas laborales </span>
                    </div>
                    <div class="actions">
                        <a class="btn green btn-sm btn-outline" href="{{url('gestionbolsa/ofertas/agregar')}}">
                            <i class="glyphicon glyphicon-plus"></i>
                            Agregar Nueva Oferta
                        </a>
                    </div>

                </div>

                <div class="pricing-content-1">
                    @if(count($ofertas) >= 1)
                        <div class="row" style="padding-bottom: 10px; padding-left: 10px; padding-right: 10px;">
                            @foreach($ofertas as $item)
                                <div class="col-md-3" style="padding-bottom: 10px;">
                                    <div class="price-column-container border-active">
                                        <div class="price-table-head bg-blue">
                                            <h2 class="no-margin">{{$item->nombre_puesto}}</h2>
                                        </div>
                                        <div class="arrow-down border-top-blue"></div>
                                        <div class="price-table-pricing">
                                            <h3>
                                                <sup class="price-sign">S/.</sup>{{$item->sueldo}}
                                            </h3>
                                            <p>por mes</p>
                                        </div>
                                        <div class="price-table-content">
                                            <div class="row mobile-padding">
                                                <div class="col-xs-3 text-right mobile-padding">
                                                    <i class="fa fa-industry"></i>
                                                </div>
                                                <div class="col-xs-9 text-left mobile-padding">{{$item->nombre_organizacion}}</div>
                                            </div>
                                            <div class="row mobile-padding">
                                                <div class="col-xs-3 text-right mobile-padding">
                                                    <i class="fa fa-hourglass"></i>
                                                </div>
                                                <div class="col-xs-9 text-left mobile-padding">
                                                    Disponibilidad {{$item->disponibilidad}}</div>
                                            </div>
                                            <div class="row mobile-padding">
                                                <div class="col-xs-3 text-right mobile-padding">
                                                    <i class="fa fa-sitemap"></i>
                                                </div>
                                                <div class="col-xs-9 text-left mobile-padding">Área
                                                    de {{$item->area}}</div>
                                            </div>
                                            <div class="row mobile-padding">
                                                <div class="col-xs-3 text-right mobile-padding">
                                                    <i class="fa fa-map-pin"></i>
                                                </div>
                                                <div class="col-xs-9 text-left mobile-padding">{{$item->direccion}}</div>
                                            </div>
                                        </div>
                                        <div class="arrow-down arrow-grey"></div>
                                        <div class="price-table-footer">
                                            <a type="button"
                                               href="{{ url('bolsatrabajo/oferta/detalle',['id' => $item->id ]) }}"
                                               class="btn green featured-price sbold uppercase price-button">
                                                Ver Detalle
                                            </a>
                                            <a type="button"
                                               href="{{ url('bolsatrabajo/oferta/editar',['id' => $item->id ]) }}"
                                               class="btn blue featured-price sbold uppercase price-button">
                                                Editar
                                            </a>
                                            <button type="button"
                                                    onclick="elimar({{ $item->id}})"
                                                    class="btn red featured-price sbold uppercase price-button">
                                                Eliminar
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            @endforeach

                            <div class="row margin-bottom-20 stories-cont" style="margin-left: 20px;">
                                {{ $ofertas->links() }}
                            </div>
                        </div>
                    @else
                        <div class="row"></div>
                        <div class="portlet-body">
                            <div class="well" style="text-align: center;"> No se encontraron ofertas registradas</div>
                        </div>
                    @endif
                </div>

            </div>

        </div>

    </div>

    <script>
        function elimar(ofertaid) {

            swal({
                    title: "Está seguro de eliminarlo?",
                    text: "Está oferta no se podra recuperar una vez eliminada",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "Si",
                    cancelButtonText: "No",
                    closeOnConfirm: false,
                    closeOnCancel: false
                },
                function (isConfirm) {
                    if (isConfirm) {
                        window.location.href = "{{url('bolsatrabajo/oferta/elimar')}}" + "/" + ofertaid;
                    } else {
                        swal("Cancelado", "Tú oferta esta a salvo.", "error");
                    }
                });

        }
    </script>
@endsection