update utilidad de promocion
This commit is contained in:
@@ -15,6 +15,7 @@ use App\Models\Saldo;
|
||||
use App\Models\Servicio;
|
||||
use App\Models\Tarifas;
|
||||
use App\Models\User;
|
||||
use App\Models\Usuario_promo;
|
||||
use App\Notifications\compra;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -174,11 +175,19 @@ class ShowPromociones extends Component
|
||||
{
|
||||
$consulta_verpromocion = Promociones::with('tarifas')->where('id', $id)->first();
|
||||
|
||||
//Traer la tarifa personalizada del usuario para esta tarifa.
|
||||
$usuario_tarifa = Usuario_promo::where('usuario_id', auth()->user()->id)->where('tarifa_id', $id)->first();
|
||||
|
||||
$this->consulta = $consulta_verpromocion;
|
||||
//$this->precioAntes = $consulta_verpromocion->tarifas->first()->valor;
|
||||
|
||||
|
||||
//Si tiene tarifa personalizada toma el precio, si no tiene da el valor de la tarifa.
|
||||
$this->precioAhora = ($usuario_tarifa) ? $usuario_tarifa->precio : $consulta_verpromocion->precio;
|
||||
|
||||
//Si tiene tarifa personalizada toma la utilidad, si no tiene toma la utilidad de la tarifa.
|
||||
$this->utilidad = ($usuario_tarifa) ? $usuario_tarifa->utilidad : $consulta_verpromocion->utilidad;
|
||||
|
||||
|
||||
$this->precioAhora = $consulta_verpromocion->precio;
|
||||
$this->utilidad = $consulta_verpromocion->utilidad ?? '';
|
||||
$this->imagen = $consulta_verpromocion->img_publicidad;
|
||||
$this->fechaLimite = $consulta_verpromocion->fecha_limite;
|
||||
$this->nombrePromo = $consulta_verpromocion->nombre;
|
||||
@@ -238,7 +247,6 @@ class ShowPromociones extends Component
|
||||
|
||||
$usuario_id = $usuario->id;
|
||||
} else {
|
||||
|
||||
$usuario_id = $usuario_existe;
|
||||
}
|
||||
|
||||
@@ -258,6 +266,8 @@ class ShowPromociones extends Component
|
||||
|
||||
$utilidad_total = (int) $this->utilidad * (int) $this->cantidad_comprarPromo;
|
||||
|
||||
dd($utilidad_total);
|
||||
|
||||
$this->historial = $historial;
|
||||
|
||||
for ($p = 0; $p < (int) $this->cantidad_comprarPromo; $p++) {
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
@if (auth()->user()->subvendedor)
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('roles') }}">Gestión Roles</a>
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('usuarios') }}">Gestión Usuarios</a>
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('usuarios') }}">Log Comisiones</a>
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logs-comisiones') }}">Log Comisiones</a>
|
||||
@if ( auth()->user()->rol->nombre != 'super')
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('tarifas') }}">Gestión Tarifas</a>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user