diff --git a/app/Http/Livewire/ShowPromociones.php b/app/Http/Livewire/ShowPromociones.php index 39fc5ca..34ed63c 100644 --- a/app/Http/Livewire/ShowPromociones.php +++ b/app/Http/Livewire/ShowPromociones.php @@ -47,6 +47,7 @@ class ShowPromociones extends Component public $nombre_promocion; public $descripcion_promocion; public $valor_promocion; + public $valor_compra_promocion; public $estado_promocion; public $fecha_limite_promocion; public $categoria_id_promocion; @@ -447,6 +448,7 @@ class ShowPromociones extends Component $this->validate([ 'nombre_promocion' => 'required', 'descripcion_promocion' => 'required', + 'valor_compra_promocion' => 'required', 'valor_promocion' => 'required', 'estado_promocion' => 'required', 'fecha_limite_promocion' => 'required', @@ -476,6 +478,7 @@ class ShowPromociones extends Component $nueva_promocion->nombre = $this->nombre_promocion; $nueva_promocion->descripcion = $this->descripcion_promocion; $nueva_promocion->precio = $this->valor_promocion; + $nueva_promocion->precio_compra = $this->valor_compra_promocion; $nueva_promocion->visible = $this->estado_promocion; $nueva_promocion->fecha_limite = $this->fecha_limite_promocion; $nueva_promocion->categoria_id = $this->categoria_id_promocion; diff --git a/database/migrations/2023_10_09_101523_add_precio_compra_to_promociones.php b/database/migrations/2023_10_09_101523_add_precio_compra_to_promociones.php new file mode 100644 index 0000000..c0e49de --- /dev/null +++ b/database/migrations/2023_10_09_101523_add_precio_compra_to_promociones.php @@ -0,0 +1,32 @@ +string('precio_compra')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('promociones', function (Blueprint $table) { + // + }); + } +}; diff --git a/resources/views/livewire/show-promociones.blade.php b/resources/views/livewire/show-promociones.blade.php index 99c8237..970ae9f 100644 --- a/resources/views/livewire/show-promociones.blade.php +++ b/resources/views/livewire/show-promociones.blade.php @@ -5,15 +5,16 @@ verPromo: @entangle('verPromo'), categorian: @entangle('categorian'), editarPromo: @entangle('editarPromo'), - credenciales : @entangle('credenciales'), - verPro:false, - copiar:'' + credenciales: @entangle('credenciales'), + verPro: false, + copiar: '' }" class="h-full w-full md:my-2"> -
+
- +

Cargando

@@ -35,21 +36,21 @@ Promociones
- @if (auth()->user()->rol->nombre == "super" || auth()->user()->rol->nombre == "administrador") - Nueva - promoción - - - - + @if (auth()->user()->rol->nombre == 'super' || auth()->user()->rol->nombre == 'administrador') + Nueva + promoción + + + + @endif
- {{-- --}} -
+

Seleccione una categoria:

@@ -84,13 +86,13 @@ @foreach ($categorias as $categoria1) @endforeach @@ -119,12 +121,14 @@ - +
@if ($categorian) -
+

Seleccione una promocion:

@@ -133,78 +137,84 @@ @foreach ($categorias->where('nombre', $categorian)->first()->promociones as $promocion) @if ($promocion->visible == 'true') - @if (empty($usuario=$promocion->usuario_promos->where('usuario_id', Auth::user()->id)->first())) -
- - - - -
- - -
- - -
- @if ( auth()->user()->rol->nombre != "editor") - - @endif - @if (auth()->user()->rol->nombre == "super" || auth()->user()->rol->nombre == "administrador") - - - @endif -
- - -
- @else - - @if ($usuario->visible == 'true') - + @if (empty(($usuario = $promocion->usuario_promos->where('usuario_id', Auth::user()->id)->first())))
- - + x-data="{ openOption: false }"> + + - -
- - -
- - -
- @if ( auth()->user()->rol->nombre != "editor") - - @endif - @if (auth()->user()->rol->nombre == "super" || auth()->user()->rol->nombre == "administrador") - - - @endif -
- - -
- @endif - - @endif - +
+ + +
+ + +
+ @if (auth()->user()->rol->nombre != 'editor') + + @endif + @if (auth()->user()->rol->nombre == 'super' || auth()->user()->rol->nombre == 'administrador') + + + @endif +
+ + +
+ @else + @if ($usuario->visible == 'true') +
+ + + + +
+ + +
+ + +
+ @if (auth()->user()->rol->nombre != 'editor') + + @endif + @if (auth()->user()->rol->nombre == 'super' || auth()->user()->rol->nombre == 'administrador') + + + @endif +
+ + +
+ @endif + @endif @endif @endforeach @@ -213,192 +223,220 @@ @endif
- {{-- Modal agregar promocion--}} -
-
-
-
-
- - -
-
- @if ($photo) - - @error('photo') Obligatorio* @enderror - @else - - @error('photo') Obligatorio* @enderror - @endif -
-
- -
- - - @error('nombre_promocion') Obligatorio* @enderror -
- -
- - - @error('descripcion_promocion') Obligatorio* @enderror + {{-- Modal agregar promocion --}} +
+
+
+
+
+ + +
+
+ @if ($photo) + + @error('photo') + Obligatorio* + @enderror + @else + + @error('photo') + Obligatorio* + @enderror + @endif +
- - + + + @error('nombre_promocion') + Obligatorio* + @enderror +
+ +
+ + + @error('descripcion_promocion') + Obligatorio* + @enderror +
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+ + + +
+ +
+
+ + + @error('fecha_limite_promocion') + Obligatorio* + @enderror
-
-
- - -
-
- - -
-
+
+ + -
-
- - - @error('fecha_limite_promocion') Obligatorio* @enderror -
- -
- - - - - + + + +
+
- -
- -
- + + @foreach ($tarifas as $tarifa) + - @endforeach - -
- + @endforeach + +
+ +
-
- @error('list') Obligatorio* @enderror -
-
-
- - imagen de {{ $categoria1->nombre}} - + + imagen de {{ $categoria1->nombre }} +
- - - - - - - - @if (!empty($list)) - @php - $n = 0; - @endphp - @foreach ($list as $tarifaServicios) - - - - - + @error('list') + Obligatorio* + @enderror +
+
- {{ $tarifaServicios['nombre'] ?? '' }} - - - @if( $tarifaServicios['nombre'] == 'Youtube Premium' || $tarifaServicios['nombre'] =='Spotify Premium') - {{ $tarifaServicios['dias'] ?? '' }} Dias. - @else - {{ $tarifaServicios['cantidad'] ?? '' }} P. - @endif - - -
+ + + + + + + + @if (!empty($list)) @php - $n++; + $n = 0; @endphp - @endforeach - @endif - -
-
+ @foreach ($list as $tarifaServicios) + + + {{ $tarifaServicios['nombre'] ?? '' }} - + + @if ($tarifaServicios['nombre'] == 'Youtube Premium' || $tarifaServicios['nombre'] == 'Spotify Premium') + {{ $tarifaServicios['dias'] ?? '' }} Dias. + @else + {{ $tarifaServicios['cantidad'] ?? '' }} P. + @endif + + + + + + + @php + $n++; + @endphp + @endforeach + @endif + + +
-
- - - - - - +
+ + + + + + +
- - {{-- Modal agregar categoria --}} - {{--
- --}} + --}} - {{-- Modal ver promno --}} -
-
-
- {{-- PHOTO --}} -
- -
+ {{-- Modal ver promno --}} +
+
+
+ {{-- PHOTO --}} +
-
- -
-
-
-

{{$nombrePromo}}

-
-
-

${{number_format($precioAhora)}}

-
-
-
-

{{$descripcionPromo}}

-
-
- - - - - - +
+ +
+
+
+

{{ $nombrePromo }}

+
+
+

+

${{ number_format($precioAhora) }}

+

+
+
+
+

{{ $descripcionPromo }}

+
+
+ +
+ + + + + + +
-
- {{-- Modal editar promo --}} -
-
-
-
-
- - -
-
- @if ($photo) - - @else - - @endif -
-
- -
- -
-
- - -
- -
- - -
-
- - -
- -
+ {{-- Modal editar promo --}} +
+
+
+
- - -
+ + +
- - + @if ($photo) + + @else + + @endif
-
-
- - - - +
+ +
+
+ +
- -
- - -
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + + + +
+ +
+ + + -
-
-
-
- + + @foreach ($tarifas as $tarifa) + + @endforeach + +
+ +
+
+ @error('list') + Obligatorio* + @enderror +
+ + + + + + + + + @if (!empty($list2)) + @php + $n = 0; + @endphp + @foreach ($list2 as $lista) + + - @else - {{ $tarifa->pantallas ?? '' }} {{ $tarifa->pantallas == 1 ? 'pantalla' : 'pantallas' }} - {{ $tarifa->dias ?? '' }} {{ $tarifa->dias == 1 ? 'día' : 'días' }} - - @endif - - @endforeach - -
- +
+ + @php + $n++; + @endphp + @endforeach + @endif + +
+ {{ $lista['nombre'] ?? '' }} - + {{ $lista['cantidad'] ?? '' }} P. - + {{ $lista['dias'] ?? '' }} D. + + +
+
- @error('list') Obligatorio* @enderror -
- - - - - - - - - @if (!empty($list2)) - @php - $n = 0; - @endphp - @foreach ($list2 as $lista) - - - - - - @php - $n++; - @endphp - @endforeach - @endif - -
- {{ $lista['nombre'] ?? '' }} - {{ $lista['cantidad'] ?? '' }} P. - {{ $lista['dias'] ?? '' }} D. - - -
-
-
-
- -
-
- - - - - - -
-
-
-
- {{-- Modal comprar promo --}} -
-
-
-
-

- {{$nombrePromo}} -

-
-

- {{$dias}} Dias -

-

- ${{number_format($precioAhora)}} -

-
- -
-
-

- Información del cliente: -

-

- Ingrese los datos del cliente final. -

-
- -
-
- - - @error('nombre_comprarPromo') Requerido* @enderror -
-
- - - @error('celular_comprarPromo') Requerido* @enderror -
-
-
-
- - - @error('email_comprarPromo') Requerido* @enderror -
- - -
- - - @error('cantidad_comprarPromo') Requerido* @enderror -
-
-
-

- Este servicio vencerá el {{$fechaFinal}} en {{$dias_comprarPromo}} Dias -

-
-
-
- El valor de ${{number_format($total=((int)$precioAhora*(int)$cantidad_comprarPromo))}} será descontado de su saldo. -
- @if ($total > auth()->user()->saldo->valor) -
-

No tiene fondo suficientes para esta compra, recargue su cuenta.

-
- @endif -
-
- + - +
-
-
+
-
- - {{-- Modal credenciales --}} -
-
-
-
-

- {{$this->nombrePromo}} -

-
-

- {{$this->dias }} Dias -

-

- ${{number_format($this->precioAhora)}} -

-
-
- -
-
-
- {!!$mensaje_servicio!!} -
- {!!$msj->msj_compra!!} + {{-- Modal comprar promo --}} +
+
+
+
+

+ {{ $nombrePromo }} +

+
+

+ {{ $dias }} Dias +

+

+ ${{ number_format($precioAhora) }} +

+
-
-

- Información de cuentas: -

-
-
- @php - $n=0; - @endphp - @if ($cuentas) - @foreach ($cuentas->cuentas->unique() as $cuenta) - @php - $n++; - @endphp +
+
+

+ Información del cliente: +

+

+ Ingrese los datos del cliente final. +

+
-
-
-

-
{{ $cuenta->servicio->nombre }} :
- @if (!empty($cuenta->servicio->ver_url)) - - URL: {{ $cuenta->servicio->url}} - @else +
+
+ + + @error('nombre_comprarPromo') + Requerido* + @enderror +
+
+ + + @error('celular_comprarPromo') + Requerido* + @enderror +
+
+
+
+ + + @error('email_comprarPromo') + Requerido* + @enderror +
- @foreach ($cuenta->perfil as $perfil) - @if ($cuentas->id == $perfil->historial_id) - - Perfil {{ $perfil->perfil }} - @if (!empty($cuenta->servicio->perfiles)) - @switch( $perfil->perfil) - - @case(1) - : {{ $msj->clave_1 }} - @break - @case(2) - : {{ $msj->clave_2 }} - @break - @case(3) - : {{ $msj->clave_3 }} - @break - @case(4) - : {{ $msj->clave_4 }} - @break - @case(5) - : {{ $msj->clave_5 }} - @break - @case(6) - : {{ $msj->clave_6 }} - @break - @default - - @endswitch - @endif - @endif - @endforeach - @endif - -

- -

- Usuario:

{{ $cuenta->correo }}

-

-

- Contraseña:

{{ $cuenta->password }} -

-

+
+ + + @error('cantidad_comprarPromo') + Requerido* + @enderror +
+
+
+

+ Este servicio vencerá el {{ $fechaFinal }} en {{ $dias_comprarPromo }} Dias +

+
+
+
+ El valor de + ${{ number_format($total = (int) $precioAhora * (int) $cantidad_comprarPromo) }} será + descontado de su saldo. + + + + + + +
+ @if ($total > auth()->user()->saldo->valor) +
+

No tiene fondo suficientes para esta compra, recargue su cuenta. +

-
- -
- - -
- - @endforeach + @endif +
- -
- +
+ +
+ +

+ Este servicio vencerá el

+ {{ Carbon\Carbon::parse($cuentas->fecha_final)->format('Y/m/d') ?? '' }} +

+

+ + @endif + + +
+ +
+ +
- -

- Este servicio vencerá el

- {{ Carbon\Carbon::parse($cuentas->fecha_final)->format('Y/m/d') ?? ''}}

-

- @endif - -
+
-
- -
-
+ + + +
- -
- - - - -
+
-
- -
-
-
- - {{-- Modal ver promociones --}} -
-
- -
- - - @foreach ($categorias as $categoria1) - -
- - - - -
- - @endforeach - - - - +
+ + {{-- Modal ver promociones --}} +
+
+ +
+ + + @foreach ($categorias as $categoria1) +
+ + + + +
+ @endforeach + + + + +
+
+
+ + +
- - - -