This commit is contained in:
Felipe
2023-07-27 10:47:39 -05:00
parent 25914187f5
commit 91589bed85
2 changed files with 128 additions and 107 deletions
+28 -16
View File
@@ -48,7 +48,8 @@ class ShowClientes extends Component
public function render() public function render()
{ $fechaHoy = Carbon::now(); {
$fechaHoy = Carbon::now();
$this->fechaActual = date('d/m/Y'); $this->fechaActual = date('d/m/Y');
$fechaVencimiento = Carbon::now()->subDay(30); $fechaVencimiento = Carbon::now()->subDay(30);
@@ -152,7 +153,8 @@ class ShowClientes extends Component
]); ]);
} }
public function notSMSpromo($id){ public function notSMSpromo($id)
{
$consulta_historial = Historiale::where('id', $id)->with('promocion', 'cliente')->first(); $consulta_historial = Historiale::where('id', $id)->with('promocion', 'cliente')->first();
$user = User::find($consulta_historial->cliente); $user = User::find($consulta_historial->cliente);
@@ -166,11 +168,10 @@ class ShowClientes extends Component
$recipients = '+57' . $consulta_historial->cliente->celular; $recipients = '+57' . $consulta_historial->cliente->celular;
$this->sendMessage($message, $recipients); $this->sendMessage($message, $recipients);
} }
public function notSMS($id){ public function notSMS($id)
{
$consulta_historial = Historiale::where('id', $id)->with('tarifa', 'cliente')->first(); $consulta_historial = Historiale::where('id', $id)->with('tarifa', 'cliente')->first();
$user = User::find($consulta_historial->cliente); $user = User::find($consulta_historial->cliente);
@@ -183,8 +184,6 @@ class ShowClientes extends Component
$recipients = '+57' . $consulta_historial->cliente->celular; $recipients = '+57' . $consulta_historial->cliente->celular;
$this->sendMessage($message, $recipients); $this->sendMessage($message, $recipients);
} }
public function sendMessage($message, $recipients) public function sendMessage($message, $recipients)
@@ -240,7 +239,6 @@ class ShowClientes extends Component
$this->alert('warning', 'Error enviando SMS!' . $err, [ $this->alert('warning', 'Error enviando SMS!' . $err, [
'position' => 'top' 'position' => 'top'
]); ]);
} else { } else {
//dd($response); //dd($response);
if (!empty(json_decode($response)->subid)) { if (!empty(json_decode($response)->subid)) {
@@ -252,13 +250,10 @@ class ShowClientes extends Component
'position' => 'top' 'position' => 'top'
]); ]);
} }
} }
} }
public function cerrar(){ public function cerrar()
{
$this->configuracion = User::where('id', Auth::user()->id)->update(['visto' => true]); $this->configuracion = User::where('id', Auth::user()->id)->update(['visto' => true]);
@@ -266,13 +261,30 @@ class ShowClientes extends Component
$this->visto = true; $this->visto = true;
$this->vencidosHoy = false; $this->vencidosHoy = false;
} }
public function renovar(){ public function renovar($id)
{
$historiale = Historiale::with('tarifa')->find($id);
if (!$historiale) {
return;
} }
$newFechaInicio = Carbon::parse($historiale->fecha_inicio)->addDays($historiale->tarifa->dias);
$newFechaFinal = Carbon::parse($historiale->fecha_final)->addDays($historiale->tarifa->dias);
$historiale->fecha_inicio = $newFechaInicio;
$historiale->fecha_final = $newFechaFinal;
$historiale->save();
$this->alert('success', 'Registro renovado con éxito. Nuevas fechas aplicadas.', [
'position' => 'top'
]);
}
public function saldoSuficiente()
{
}
} }
@@ -126,6 +126,8 @@
</td> </td>
@endif @endif
{{$cliente->tarifa->valor}}
@if (!empty($cliente->tarifa_id)) @if (!empty($cliente->tarifa_id))
<td class=" w-[1rem]"> <td class=" w-[1rem]">
<button <button
@@ -160,11 +162,18 @@
@if (!empty($cliente->cuentas->first()->estado)) @if (!empty($cliente->cuentas->first()->estado))
@if ($cliente->cuentas->first()->estado == 'pendiente' && $cliente->tarifa->servicio->renovacion == true) @if ($cliente->cuentas->first()->estado == 'pendiente' && $cliente->tarifa->servicio->renovacion == true)
{{-- renovar --}} {{-- renovar --}}
@if (Auth::user()->saldo->valor >= $cliente->tarifa->valor)
<button x-on:click="openOption=!openOption" <button x-on:click="openOption=!openOption"
wire:click="renovar({{ $cliente->id }})" wire:click="renovar({{ $cliente->id }})"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 hover:rounded-t-[1rem]">Renovar</button> class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300">Renovar</button>
@else
<button
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 active:bg-red-500 active:text-white cursor-not-allowed">Renovar</button>
@endif @endif
@endif @endif
@endif
{{-- whatsapp --}} {{-- whatsapp --}}
<a x-on:click="openOption=!openOption" target="_blank" <a x-on:click="openOption=!openOption" target="_blank"
href="https://wa.me/57{{ $cliente->cliente->celular ?? '' }}?text=Hola *{{ $cliente->cliente->name ?? '' }}* tu servicio de *{{ $cliente->tarifa->servicio->nombre }} de {{ $cliente->tarifa->pantallas }} pantallas * vence el *{{ $cliente->fecha_final }}*" href="https://wa.me/57{{ $cliente->cliente->celular ?? '' }}?text=Hola *{{ $cliente->cliente->name ?? '' }}* tu servicio de *{{ $cliente->tarifa->servicio->nombre }} de {{ $cliente->tarifa->pantallas }} pantallas * vence el *{{ $cliente->fecha_final }}*"