cambia al fecha del historial

This commit is contained in:
Felipe
2024-04-29 14:41:39 -05:00
parent 09050275c2
commit 82710bf517
4 changed files with 35 additions and 5 deletions
+15 -1
View File
@@ -277,7 +277,11 @@ class ShowPlanes extends Component
{
$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);
@@ -289,6 +293,8 @@ class ShowPlanes extends Component
'estado' => $this->estado,
]);
$historial->delete();
Log_historial::create([
'user_id' => Auth::user()->id,
'detalle' => 'El usuario ha renovado y liberado la cuenta ' . $cuenta_renovar->correo
@@ -313,6 +319,14 @@ class ShowPlanes extends Component
'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);
Log_historial::create([
+3 -1
View File
@@ -331,12 +331,14 @@ class ShowPromociones extends Component
'confirmButtonText' => 'Sí, comprar.',
]);
}
} else {
$descuento = Saldo::where('usuario_id', Auth::user()->id)->first();
$saldo_anterior = $descuento->valor;
$nuevo_saldo = $saldo_anterior - ($this->precioAhora * $this->cantidad_comprarPromo);
$cobro = $descuento->update(['valor' => $nuevo_saldo]);
if ($cobro) {
$historial->update(['estado' => 'activo']);
$this->modalComprarPromo = false;
+15 -1
View File
@@ -225,6 +225,20 @@ class ShowServicios extends Component
{
$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;
$total_valor = (int) $this->valor_tarjetaPlan * (int) $this->cantidad_tarjetaPlan;
$utilidad_total = (int) $this->utilidad * (int) $this->cantidad_tarjetaPlan;
@@ -352,7 +366,7 @@ class ShowServicios extends Component
$this->credenciales($historial);
} 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!', [
'position' => 'top'
]);
@@ -260,10 +260,10 @@
@endif
<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 class="pl-[2rem]">
{{ \Carbon\Carbon::parse($consulta_verUsuarios->vencimiento)->format('d/m/Y') }}
{{ \Carbon\Carbon::parse($verUsuarios->fecha_final)->format('d/m/Y') }}
</td>
@php