@extends('header_new')

@section('main')

<style>
	.pepheader {
		background-color: #0F335A;
		color: #FFFFFF;
	}

	.pepheader {
		background-color: #0F335A;
		color: #FFFFFF;
	}

	.pepdata {
		text-align: center;
		color: #0F335A;
		font-size: 14px;
		padding-bottom: 8px;
	}

	.pepbox-neg {
		width: 100%;
		font-size: 20px;
		font-weight: bold;
		color: #FFFFFF;
		background-color: #63b68c;
		text-align: center;
		padding-top: 2px; padding-bottom: 2px;
	}

	.pepbox-rel {
		width: 100%;
		font-size: 20px;
		font-weight: bold;
		color: #FFFFFF;
		background-color: #FFB81C;
		text-align: center;
		padding-top: 2px; padding-bottom: 2px;
	}

	.pepbox-pep {
		width: 100%;
		font-size: 20px;
		font-weight: bold;
		color: #FFFFFF;
		background-color: #FF5C1C;
		text-align: center;
		padding-top: 2px; padding-bottom: 2px;
	}

	.pepbox-pos {
		width: 100%;
		font-size: 20px;
		font-weight: bold;
		color: #FFFFFF;
		background-color: #A72B2A;
		text-align: center;
		padding-top: 2px; padding-bottom: 2px;
	}

	.pepbox-so {
		width: 100%;
		font-size: 20px;
		font-weight: bold;
		color: #FFFFFF;
		background-color: #4A8AF0;
		text-align: center;
		padding-top: 2px; padding-bottom: 2px;
	}

</style>

<div class="container-fluid mt-5 pt-5">
	@include('blue/info_cliente_abm')
    <!-- -->
	<div class="container-fluid ">
		<div class="row justify-content-between">
			<div class="col text-fidelitas">
				<h6>Fidecheck Manual</h6>
				<h6>Contraparte: {{$contrap->nombre_persona}} - {{$contrap->abreviatura}} N°: {{$contrap->numero}} ({{$contrap->country_name}})</h6>
			</div>
			<div class="col text-end">
				<button type="button" data-title="Contraparte" data-cuit="{{$contrap->numero}}"  data-nombre="{{$contrap->nombre_persona}}" title="Ver Brief"  class="btn btn-fidelitas briefbtn btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck"><i class="bi bi-newspaper no-data"></i>&nbsp;Brief</button>
				<button type="button" class="btn btn-fidelitas btnedit btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-id="0" data-seccion="P" data-contraparte="{{$contrap->contraparte}}">&nbsp;Fidechek</button>
				<button type="button" class="btn btn-fidelitas btnver btn-sm" data-cuit="{{$propio->tax_id}}" data-nombre="{{$propio->nombre}}" data-fidecheck="{{$propio->fidecheck}}" data-fecha="{{$propio->fecha}}" data-detalle="{{$propio->detalle}}"><i class="bi bi-eye"></i>Ver</button>
			</div>
		</div>
	</div>
    <!-- -->
	<div class="container-fluid">
		<div class="row mt-4">
			<div class="col-md-10">
				<h5>Socios / Accionistas</h5>
			</div>
			<div class="col-md-2 text-end"><button type="button" class="btn btn-fidelitas btnadd btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-seccion="S" data-contraparte="{{$contrap->contraparte}}"><i class="bi bi-plus-lg"></i> Agregar</button></div>
		</div>
		<!-- -->
		<table class="table table-condensed table-striped table-hover my-5" id="tablaSocios">
			<thead>
				<tr class="pepheader">
					<th class="text-center">Nombre y apellido / Razón social</th>
					<th class="text-center">Nacionalidad o país de origen</th>
					<th class="text-center">Tax ID</th>
					<th class="text-center">%</th>
					<th class="text-center">Fuente</th>
					<th class="text-center">Estado</th>
					<th class="text-center">Acción</th>
				</tr>
			</thead>
			<tbody>
				@foreach ($socios as $socio)
				<tr>
					<td>{{$socio->nombre}}</td>
					<td class="text-center">{{$socio->nacionalidad}}</td>
					<td class="text-center">{{$socio->tax_id}}</td>
					<td class="text-end">{{$socio->porcentaje}}&nbsp;&nbsp;&nbsp;</td>
					<td class="text-start">{{$socio->detalle}}</td>
					<td class="text-center">
						<svg height="20" width="20"><circle cx="10" cy="10" r="9" stroke="black" stroke-width="0" @if ($socio->fidecheck == 'N') fill="#63b68c" @elseif ($socio->fidecheck == 'E') fill="#FF5C1C" @elseif ($socio->fidecheck == 'R'/* || $socio->fidecheck == 'S'*/) fill="#FFB81C" @elseif ($socio->fidecheck == 'S')  fill="#4A8AF0"  @elseif ($socio->fidecheck == 'P') fill="#A72B2A" @endif /></svg>
					</td>
					<td class="text-center" nowrap="nowrap">
						<button type="button" class="btn btn-fidelitas btnedit" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-id="{{$socio->id_fidecheck}}" data-seccion="{{$socio->nombre_seccion}}" data-contraparte="{{$contrap->contraparte}}"><i class="bi bi-pencil-square"></i></button>
						<button type="button" class="btn btn-fidelitas btndelete" data-id="{{$socio->id_fidecheck}}" data-seccion="{{$socio->nombre_seccion}}"><i class="bi bi-trash"></i></button>
						<button type="button" class="btn btn-fidelitas btnver" data-cuit="{{$socio->tax_id}}" data-nombre="{{$socio->nombre}}" data-fidecheck="{{$socio->fidecheck}}" data-fecha="{{$socio->fecha}}" data-detalle="{{$socio->detalle}}"><i class="bi bi-eye"></i> Ver</button>
						<button type="button" data-title="Socios / Accionistas" data-cuit="{{$socio->tax_id}}" data-nombre="{{$socio->nombre}}" title="Ver Brief" class="btn btn-fidelitas briefbtn" data-bs-toggle="modal" data-bs-target="#modalFidecheck"><i class="bi bi-newspaper no-data"></i>&nbsp;Brief</button>
					</td>
				</tr>
				@endforeach
			</tbody>
		</table>
		<!-- -->
		<div class="row mt-5">
			<div class="col-md-10">
				<h5>Vinculaciones / Empresas relacionadas</h5>
			</div>
			<div class="col-md-2 text-end"><button type="button" class="btn btn-fidelitas btnadd btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-seccion="R" data-contraparte="{{$contrap->contraparte}}"><i class="bi bi-plus-lg"></i> Agregar</button></div>
		</div>
		<!-- -->
		<table class="table table-condensed table-striped table-hover my-5" id="tablaVinculaciones">
			<thead class="table-header-fidelitas">
				<tr class="pepheader">
					<th class="text-center">N&deg;</th>
					<th class="text-center">Razón social</th>
					<th class="text-center">Nacionalidad o país de origen</th>
					<th class="text-center">Tax ID</th>
					<th class="text-center">Tipo de relación</th>
					<th class="text-center">Fuente</th>
					<th class="text-center">Estado</th>
					<th class="text-center">Acción</th>
				</tr>
			</thead>
			<tbody>
				@foreach ($relac as $relacionada)
				<tr>
					<td class="text-center">{{$relacionada->orden}}</td>
					<td>{{$relacionada->nombre}}</td>
					<td class="text-center">{{$relacionada->nacionalidad}}</td>
					<td class="text-center">{{$relacionada->tax_id}}</td>
					<td class="text-center">{{$relacionada->tipo_relacion}}</td>
					<td class="text-start">{{$relacionada->detalle}}</td>
					<td class="text-center">
						<svg height="20" width="20"><circle cx="10" cy="10" r="9" stroke="black" stroke-width="0" @if ($relacionada->fidecheck == 'N') fill="#63b68c" @elseif ($relacionada->fidecheck == 'E') fill="#FF5C1C" @elseif ($relacionada->fidecheck == 'R' /*|| $relacionada->fidecheck == 'S'*/) fill="#FFB81C" @elseif ($relacionada->fidecheck == 'S')  fill="#4A8AF0"  @elseif ($relacionada->fidecheck == 'P') fill="#A72B2A" @endif /></svg>
					</td>
					<td class="text-center" nowrap="nowrap">				
						<button type="button" class="btn btn-fidelitas btnmove" data-id="{{$relacionada->id_fidecheck}}" data-move="up"><i class="bi bi-arrow-up"></i></button>
						<button type="button" class="btn btn-fidelitas btnmove" data-id="{{$relacionada->id_fidecheck}}" data-move="down"><i class="bi bi-arrow-down"></i></button>
						<button type="button" class="btn btn-fidelitas btnedit" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-id="{{$relacionada->id_fidecheck}}" data-seccion="{{$relacionada->nombre_seccion}}" data-contraparte="{{$contrap->contraparte}}"><i class="bi bi-pencil-square"></i></button>
						<button type="button" class="btn btn-fidelitas btndelete" data-id="{{$relacionada->id_fidecheck}}" data-seccion="{{$relacionada->nombre_seccion}}"><i class="bi bi-trash"></i></button>
						<button type="button" class="btn btn-fidelitas btnver" data-cuit="{{$relacionada->tax_id}}" data-nombre="{{$relacionada->nombre}}" data-fidecheck="{{$relacionada->fidecheck}}" data-fecha="{{$relacionada->fecha}}" data-detalle="{{$relacionada->detalle}}"><i class="bi bi-eye"></i> Ver</button>
						<button type="button" data-title="Vinculaciones / Empresas relacionadas" data-cuit="{{$relacionada->tax_id}}"  data-nombre="{{$relacionada->nombre}}"  title="Ver Brief" class="btn btn-fidelitas briefbtn" data-bs-toggle="modal" data-bs-target="#modalFidecheck"><i class="bi bi-newspaper no-data"></i>&nbsp;Brief</button>
					</td>
				</tr>
				@endforeach
			</tbody>
		</table>
		<!-- -->
		<div class="row mt-5">
			<div class="col-md-10">
				<h5>Directivos</h5>
			</div>
			<div class="col-md-2 text-end"><button type="button" class="btn btn-fidelitas btnadd btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-seccion="D" data-contraparte="{{$contrap->contraparte}}"><i class="bi bi-plus-lg"></i> Agregar</button></div>
		</div>
		<!-- -->
		<table class="table table-condensed table-striped table-hover my-5" id="tablaDirectivos">
			<thead class="table-header-fidelitas">
				<tr class="pepheader">
					<th class="text-center">Nombre y apellido</th>
					<th class="text-center">Nacionalidad o país de origen</th>
					<th class="text-center">Tax ID</th>
					<th class="text-center">Cargo</th>
					<th class="text-center">Fuente</th>
					<th class="text-center">Estado</th>
					<th class="text-center">Acción</th>
				</tr>
			</thead>
			<tbody>
				@foreach ($direct as $directivo)
				<tr>
					<td>{{$directivo->nombre}}</td>
					<td class="text-center">{{$directivo->nacionalidad}}</td>
					<td class="text-center">{{$directivo->tax_id}}</td>
					<td class="text-center">{{$directivo->cargo}}</td>
					<td class="text-start">{{$directivo->detalle}}</td>
					<td class="text-center">
						<svg height="20" width="20"><circle cx="10" cy="10" r="9" stroke="black" stroke-width="0" @if ($directivo->fidecheck == 'N') fill="#63b68c" @elseif ($directivo->fidecheck == 'E') fill="#FF5C1C" @elseif ($directivo->fidecheck == 'R' /*|| $directivo->fidecheck == 'S'*/)   fill="#FFB81C"  @elseif ($directivo->fidecheck == 'S')  fill="#4A8AF0"  @elseif ($directivo->fidecheck == 'P') fill="#A72B2A" @endif /></svg>
					</td>
					<td class="text-center" nowrap="nowrap">
						<button type="button" class="btn btn-fidelitas btnedit btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck" data-id="{{$directivo->id_fidecheck}}" data-seccion="{{$directivo->nombre_seccion}}" data-contraparte="{{$contrap->contraparte}}"><i class="bi bi-pencil-square"></i></button>
						<button type="button" class="btn btn-fidelitas btndelete btn-sm" data-id="{{$directivo->id_fidecheck}}" data-seccion="{{$directivo->nombre_seccion}}"><i class="bi bi-trash"></i></button>
						<button type="button" class="btn btn-fidelitas btnver btn-sm" data-cuit="{{$directivo->tax_id}}" data-nombre="{{$directivo->nombre}}" data-fidecheck="{{$directivo->fidecheck}}" data-fecha="{{$directivo->fecha}}" data-detalle="{{$directivo->detalle}}"><i class="bi bi-eye"></i> Ver</button>
						<button type="button" data-title="Directivos" data-cuit="{{$directivo->tax_id}}"  data-nombre="{{$directivo->nombre}}" title="Ver Brief" class="btn btn-fidelitas briefbtn btn-sm" data-bs-toggle="modal" data-bs-target="#modalFidecheck"><i class="bi bi-newspaper no-data"></i>&nbsp;Brief</button>
					</td>
				</tr>
				@endforeach
			</tbody>
		</table>
	</div>
</div>
<!-- -->
<div id="modalFidecheck" class="modal fade">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
				<h3 class="modal-title" id="fidecheck_title"></h3>
                <h4 class="modal-title" id="fidecheck_title2"></h4>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true"></button>
            </div>
            <div class="modal-body" id="fidecheck_body"></div>
        </div>
    </div>
</div>
<!-- Certificado -->
<div id="Pep_certificado" class="modal fade">
	<div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true"></button>
            </div>
            <div class="p-1 mx-2 my-4" style="border: 10px #0f335a solid;">
                <div class="modal-body" id="fidecheck_body" style="width:100%; border: 4px #0f335a solid;	">
                    <h4 id="pepsearch" class="text-center">SEARCH CRITERIA</h4>
                    <div id="pepdata" class="pepdata"></div>
                    <div id="pepdata2" class="pepdata"></div>
                    <div id="peprespuesta" class="text-center"></div>
                    <div id="peptexto" class="text-center">
                        Sources checked: List of worldwide politicians and government controlled entities (also known as PEPs, for politically exposed persons); profiles
                        of persons who hold political office, their immediate family members, close associates, and companies under their control; Crime - Global Enforcement List, Profiles of entities
                        listed worldwide; Reputation - Global Foreign Officials List, SDN and Financial Intelligence Units, following the FATF (Financial Action Task Force) recommendations.
                    </div>
                </div>
			</div>
	    </div>
	</div>
</div>
<!-- -->
<form id="frmMove" method="post" action="/blue/servicios-contratados-contrapartes/fidecheck/acciones">
	{{csrf_field()}}	
	<input type="hidden" name="id_fidecheck" value="" id="_fidecheck">
	<input type="hidden" name="move" value="" id="_move">
	<input type="hidden" name="accion" value="mover">
</form>
<!-- -->
<form id="frmDelete" method="post" action="/blue/servicios-contratados-contrapartes/fidecheck/acciones">
	{{csrf_field()}}	
	<input type="hidden" name="id_fidecheck" value="" id="_fidecheck2">
	<input type="hidden" name="accion" value="borrar">
</form>
<!-- -->
<form id="frmRedireccionar" method="POST" @if( $desde_contraparte_generico ) action="/blue/contraparte-edit" @else action="/blue/servicios-contratados-contrapartes" @endif>
	{{  csrf_field() }}
	<!-- -->
	<input type="hidden" name="contraparte" value="{{$contrap->contraparte}}">
	<!-- -->
	@if ( $desde_contraparte_generico )
		<input type="hidden" name="cliente" value="{{$cliente->cliente}}">
		<input type="hidden" name="tieneApi" value="{{$datos_redireccion->tieneApi}}">
		<input type="hidden" name="producto" value="{{$servicio}}">
		<input type="hidden" name="nombre_producto" value="{{$datos_redireccion->nombre_servicio}}">
		<input type="hidden" name="contraparte" value="{{$contrap->contraparte}}">
        <input type="hidden" name="id_padron" value="{{$contrap->id_padron}}">
        <input type="hidden" name="cliente_nombre" value="{{$cliente->nombre_cliente}}">
        <input type="hidden" name="cli_codigo" value="{{$cliente->cli_codigo}}">
        <input type="hidden" name="cli_cuit" value="{{$cliente->cuit}}">
	@else
		<input type="hidden" name="cli_codigo" value="{{$cliente->cli_codigo}}">
		<input type="hidden" name="cliente" value="{{$cliente->cliente}}">
		<input type="hidden" name="producto_fidelitas" value="{{$servicio}}">
		<input type="hidden" name="tipo_paquete_cliente" value="{{$datos_redireccion->tipo_paquete}}">
		<input type="hidden" name="prod_nombre_cliente" value="{{$datos_redireccion->nombre_producto}}">
		<input type="hidden" name="limite_consumo_cliente" value="{{$datos_redireccion->limite}}">
		<input type="hidden" name="fecha_desde" value="{{$datos_redireccion->desde}}">
		<input type="hidden" name="fecha_hasta" value="{{$datos_redireccion->hasta}}">
		<input type="hidden" name="estado_bloquea_cliente" value="{{$datos_redireccion->bloquea}}">
		<input type="hidden" name="estado_producto_cliente" value="{{$datos_redireccion->estado_producto}}">
		<input type="hidden" name="modalidad_de_pago" value="{{$datos_redireccion->modalidad_de_pago}}">
		<input type="hidden" name="impe_acceso" value="{{$datos_redireccion->impe_acceso}}">
        <input type="hidden" name="impe_doc" value="{{$datos_redireccion->impe_doc}}">
		<input type="hidden" name="desde_panel_clientes" value="{{$datos_redireccion->desde_panel_clientes}}">
	@endif
</form>
<!-- -->
<input type="hidden" id="ruta_recarga" value="/blue/servicios-contratados-contrapartes/fidecheck/manual">
<input type="hidden" id="apikey_brief" value="{{$_ENV['APIKEY_BRIEF']}}">
@endsection

@section('funcionesJs')
    <script src="{{ asset('/Libreria_CA/Js/funciones_servicios_contratados.js') }}"></script>
    <script>
        $(document).ready(function(){
            llamadaFidecheckManual();
        });
    </script>
@endsection