cambia al fecha del historial
This commit is contained in:
@@ -277,7 +277,11 @@ class ShowPlanes extends Component
|
|||||||
{
|
{
|
||||||
$id = $this->id_cuentaVer;
|
$id = $this->id_cuentaVer;
|
||||||
|
|
||||||
Historial_cuenta::where('cuenta_id', $id)->delete();
|
$historial = Historial_cuenta::where('cuenta_id', $id)->first();
|
||||||
|
|
||||||
|
Historiale::where('id', $historial->historiale_id)->update([
|
||||||
|
'fecha_final' => date('Y-m-d', strtotime(strval($this->fecha_final_renovar))),
|
||||||
|
]);
|
||||||
|
|
||||||
$cuenta_renovar = Cuentas::find($id);
|
$cuenta_renovar = Cuentas::find($id);
|
||||||
|
|
||||||
@@ -289,6 +293,8 @@ class ShowPlanes extends Component
|
|||||||
'estado' => $this->estado,
|
'estado' => $this->estado,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$historial->delete();
|
||||||
|
|
||||||
Log_historial::create([
|
Log_historial::create([
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
|
||||||
@@ -313,6 +319,14 @@ class ShowPlanes extends Component
|
|||||||
'estado' => $this->estado,
|
'estado' => $this->estado,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$historial = Historial_cuenta::where('cuenta_id', $id)->first();
|
||||||
|
|
||||||
|
if ($historial) {
|
||||||
|
Historiale::where('id', $historial->historial_id)->update([
|
||||||
|
'fecha_final' => date('Y-m-d', strtotime(strval($this->fecha_final_renovar))),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$cuenta_renovar = Cuentas::find($id);
|
$cuenta_renovar = Cuentas::find($id);
|
||||||
|
|
||||||
Log_historial::create([
|
Log_historial::create([
|
||||||
|
|||||||
@@ -331,12 +331,14 @@ class ShowPromociones extends Component
|
|||||||
'confirmButtonText' => 'Sí, comprar.',
|
'confirmButtonText' => 'Sí, comprar.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
|
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
|
||||||
$saldo_anterior = $descuento->valor;
|
$saldo_anterior = $descuento->valor;
|
||||||
$nuevo_saldo = $saldo_anterior - ($this->precioAhora * $this->cantidad_comprarPromo);
|
$nuevo_saldo = $saldo_anterior - ($this->precioAhora * $this->cantidad_comprarPromo);
|
||||||
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
|
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
|
||||||
|
|
||||||
if ($cobro) {
|
if ($cobro) {
|
||||||
$historial->update(['estado' => 'activo']);
|
$historial->update(['estado' => 'activo']);
|
||||||
$this->modalComprarPromo = false;
|
$this->modalComprarPromo = false;
|
||||||
|
|||||||
@@ -225,6 +225,20 @@ class ShowServicios extends Component
|
|||||||
{
|
{
|
||||||
$this->validate();
|
$this->validate();
|
||||||
|
|
||||||
|
if ($this->cantidad_tarjetaPlan == 0) {
|
||||||
|
$this->alert('error', 'La cantidad debe ser mayor a 0', [
|
||||||
|
'position' => 'top'
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auth()->user()->saldo->valor < $this->valor_tarjetaPlan * $this->cantidad_tarjetaPlan) {
|
||||||
|
$this->alert('error', 'Saldo insuficiente', [
|
||||||
|
'position' => 'top'
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$cantidad_solicitada = (int) $this->cantidad_tarjetaPlan * (int) $this->pantallas_tarjetaPlan;
|
$cantidad_solicitada = (int) $this->cantidad_tarjetaPlan * (int) $this->pantallas_tarjetaPlan;
|
||||||
$total_valor = (int) $this->valor_tarjetaPlan * (int) $this->cantidad_tarjetaPlan;
|
$total_valor = (int) $this->valor_tarjetaPlan * (int) $this->cantidad_tarjetaPlan;
|
||||||
$utilidad_total = (int) $this->utilidad * (int) $this->cantidad_tarjetaPlan;
|
$utilidad_total = (int) $this->utilidad * (int) $this->cantidad_tarjetaPlan;
|
||||||
@@ -352,7 +366,7 @@ class ShowServicios extends Component
|
|||||||
|
|
||||||
$this->credenciales($historial);
|
$this->credenciales($historial);
|
||||||
} else {
|
} else {
|
||||||
$eliminar = Historial_cuenta::where('historial_id',$historial->id)->delete();
|
$eliminar = Historial_cuenta::where('historial_id', $historial->id)->delete();
|
||||||
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
|
$this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [
|
||||||
'position' => 'top'
|
'position' => 'top'
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -260,10 +260,10 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<td class="pl-[2rem]">
|
<td class="pl-[2rem]">
|
||||||
{{ \Carbon\Carbon::parse($consulta_verUsuarios->inicio)->format('d/m/Y') }}
|
{{ \Carbon\Carbon::parse($verUsuarios->fecha_inicio)->format('d/m/Y') }}
|
||||||
</td>
|
</td>
|
||||||
<td class="pl-[2rem]">
|
<td class="pl-[2rem]">
|
||||||
{{ \Carbon\Carbon::parse($consulta_verUsuarios->vencimiento)->format('d/m/Y') }}
|
{{ \Carbon\Carbon::parse($verUsuarios->fecha_final)->format('d/m/Y') }}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
|
|||||||
Reference in New Issue
Block a user