Asignar campo utilidad
This commit is contained in:
@@ -34,6 +34,7 @@ class ShowPlanes extends Component
|
||||
public $roles_modTarifas;
|
||||
public $pantallas_modTarifas;
|
||||
public $precio_modTarifas = 0;
|
||||
public $utilidad = 0;
|
||||
|
||||
public $estadoTarifa = true;
|
||||
public $diasTarifa = '30';
|
||||
@@ -370,11 +371,16 @@ class ShowPlanes extends Component
|
||||
$this->alert('warning', '¡Coloque un precio!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
} elseif (empty($this->utilidad)) {
|
||||
$this->alert('warning', '¡Coloque la utilidad!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
} else {
|
||||
$tarifa = new Tarifas;
|
||||
$tarifa->pantallas = $this->pantallas_modTarifas;
|
||||
$tarifa->dias = $this->diasTarifa;
|
||||
$tarifa->valor = $this->precio_modTarifas;
|
||||
$tarifa->utilidad = $this->utilidad;
|
||||
$tarifa->estado = $this->estadoTarifa ? 'activo' : 'inactivo';
|
||||
$tarifa->servicio_id = $this->servicio_modTarifas;
|
||||
$tarifa->rol_id = $this->roles_modTarifas;
|
||||
@@ -512,6 +518,7 @@ class ShowPlanes extends Component
|
||||
$this->roles_modTarifas = $tarifa['rol_id'];
|
||||
$this->pantallas_modTarifas = $tarifa['pantallas'];
|
||||
$this->precio_modTarifas = $tarifa['valor'];
|
||||
$this->utilidad = $tarifa['utilidad'];
|
||||
$this->diasTarifa = $tarifa['dias'];
|
||||
$this->estadoTarifa = $tarifa['estado'];
|
||||
$this->servicio_modTarifas = $tarifa['servicio_id'];
|
||||
@@ -523,6 +530,7 @@ class ShowPlanes extends Component
|
||||
'roles_modTarifas'=> 'required',
|
||||
'pantallas_modTarifas' => 'required',
|
||||
'precio_modTarifas'=> 'required',
|
||||
'utilidad'=> 'required',
|
||||
'diasTarifa' => 'required',
|
||||
'estadoTarifa'=> 'required'
|
||||
]);
|
||||
@@ -530,6 +538,7 @@ class ShowPlanes extends Component
|
||||
'pantallas' => $this->pantallas_modTarifas,
|
||||
'dias' => $this->diasTarifa,
|
||||
'valor'=> $this->precio_modTarifas,
|
||||
'utilidad'=> $this->utilidad,
|
||||
'estado'=> $this->estadoTarifa,
|
||||
'rol_id' => $this->roles_modTarifas,
|
||||
'servicio_id' => $this->servicio_modTarifas
|
||||
|
||||
@@ -47,10 +47,10 @@ 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;
|
||||
public $utilidad;
|
||||
|
||||
public $fechaFinal;
|
||||
|
||||
@@ -94,10 +94,7 @@ class ShowPromociones extends Component
|
||||
public $cuentas;
|
||||
public $img_ver;
|
||||
public $fecha_editarPromo;
|
||||
public $mensaje_servicio;
|
||||
|
||||
public $utilidad;
|
||||
|
||||
public $mensaje_servicio;
|
||||
|
||||
public $categoria_photo;
|
||||
|
||||
@@ -452,7 +449,7 @@ class ShowPromociones extends Component
|
||||
$this->validate([
|
||||
'nombre_promocion' => 'required',
|
||||
'descripcion_promocion' => 'required',
|
||||
'valor_compra_promocion' => 'required',
|
||||
'utilidad' => 'required',
|
||||
'valor_promocion' => 'required',
|
||||
'estado_promocion' => 'required',
|
||||
'fecha_limite_promocion' => 'required',
|
||||
@@ -482,7 +479,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->utilidad = $this->utilidad;
|
||||
$nueva_promocion->visible = $this->estado_promocion;
|
||||
$nueva_promocion->fecha_limite = $this->fecha_limite_promocion;
|
||||
$nueva_promocion->categoria_id = $this->categoria_id_promocion;
|
||||
@@ -668,6 +665,7 @@ class ShowPromociones extends Component
|
||||
$this->nombre_promocion = '';
|
||||
$this->descripcion_promocion = '';
|
||||
$this->valor_promocion = '';
|
||||
$this->utilidad = '';
|
||||
$this->estado_promocion = null;
|
||||
$this->fecha_limite_promocion = null;
|
||||
$this->categoria_id_promocion = null;
|
||||
|
||||
@@ -12,6 +12,7 @@ class Historiale extends Model
|
||||
'fecha_inicio',
|
||||
'fecha_final',
|
||||
'valor',
|
||||
'utilidad',
|
||||
'tipo_pago',
|
||||
'estado',
|
||||
'vendedor_id',
|
||||
|
||||
@@ -10,6 +10,7 @@ class Promociones extends Model
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'precio',
|
||||
'utilidad',
|
||||
'img_publicidad',
|
||||
'fecha_limite',
|
||||
'visible',
|
||||
|
||||
@@ -12,6 +12,7 @@ class Tarifas extends Model
|
||||
'pantallas',
|
||||
'dias',
|
||||
'valor',
|
||||
'utilidad',
|
||||
'estado',
|
||||
'servicio_id',
|
||||
'rol_id'
|
||||
|
||||
@@ -12,6 +12,7 @@ class Usuario_promo extends Model
|
||||
'usuario_id',
|
||||
'promocion_id',
|
||||
'precio',
|
||||
'utilidad',
|
||||
'visible',
|
||||
|
||||
];
|
||||
|
||||
@@ -12,6 +12,7 @@ class Usuario_tarifa extends Model
|
||||
'usuario_id',
|
||||
'tarifa_id',
|
||||
'precio',
|
||||
'utilidad',
|
||||
'visible',
|
||||
|
||||
];
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ return new class extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::table('promociones', function (Blueprint $table) {
|
||||
$table->string('precio_compra')->nullable();
|
||||
$table->string('utilidad')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ return new class extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::table('promociones', function (Blueprint $table) {
|
||||
//
|
||||
$table->dropColumn('utilidad');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('usuario_tarifas', function (Blueprint $table) {
|
||||
$table->string('utilidad')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('usuario_tarifas', function (Blueprint $table) {
|
||||
$table->dropColumn('utilidad');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('usuario_promos', function (Blueprint $table) {
|
||||
$table->string('utilidad')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('usuario_promos', function (Blueprint $table) {
|
||||
$table->dropColumn('utilidad');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('historiales', function (Blueprint $table) {
|
||||
$table->string('utilidad')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('historiales', function (Blueprint $table) {
|
||||
$table->dropColumn('utilidad');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tarifas', function (Blueprint $table) {
|
||||
$table->string('utilidad')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tarifas', function (Blueprint $table) {
|
||||
$table->dropColumn('utilidad');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<div class="mb-10" id="planes">
|
||||
<h1 class="text-gray-600 text-center text-lg my-8">Planes</h1>
|
||||
<div class="mt-4 grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 xl:grid-cols-5 justify-items-center gap-y-8">
|
||||
<div class="mt-4 grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 xl:grid-cols-5 justify-items-center gap-y-8 pb-12">
|
||||
@foreach ($planes as $plan)
|
||||
@if (!empty($plan->tarifas->first()->pantallas))
|
||||
<a href="/single?servicio={{$plan->id}}" class="rounded-xl mb-2 bg-white shadow-lg">
|
||||
|
||||
@@ -703,7 +703,7 @@
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 text-sm font-bold mb-2">Pantallas:</label>
|
||||
<div class="grid grid-cols-3 gap-2 text-left mb-4">
|
||||
<div class="grid grid-cols-4 gap-2 text-left mb-4">
|
||||
<div class="w-[6rem]">
|
||||
<label class="text-gray-500 text-sm">Rol</label>
|
||||
<select name="roles" id="roles" wire:model.debounce.500ms="roles_modTarifas"
|
||||
@@ -724,6 +724,11 @@
|
||||
<input type="number" id="precio_modTarifas" wire:model="precio_modTarifas" min="0"
|
||||
class="w-full border-2 border-neutral-200 rounded-[0.8rem] focus:ring-0 shadow apperance-none focus:border-neutral-300 py-2 pl-2 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
|
||||
</div>
|
||||
<div class="w-[6rem]">
|
||||
<label class="text-gray-500 text-sm">Utilidad</label>
|
||||
<input type="number" id="utilidad" wire:model="utilidad" min="0"
|
||||
class="w-full border-2 border-neutral-200 rounded-[0.8rem] focus:ring-0 shadow apperance-none focus:border-neutral-300 py-2 pl-2 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 grid grid-cols-3">
|
||||
@@ -744,9 +749,8 @@
|
||||
class="inline-flex justify-center w-full md:w-auto rounded-md border border-transparent px-4 py-1 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Añadir</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="overflow-y-auto max-h-48">
|
||||
<table class="w-full sm-w-[20rem] text-center mt-4 border-separate border-spacing-y-2 mb-4">
|
||||
@@ -769,10 +773,10 @@
|
||||
<td class="pl-[1rem]">{{ $tarifa->valor ?? '' }}</td>
|
||||
<td class="pl-[1rem]">{{ $tarifa->dias ?? '' }}</td>
|
||||
<td class="pl-[1rem]"><button wire:click="editar({{$tarifa}})" class="justify-center flex px-3 py-2 rounded-lg text-xs cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">Editar</button></td>
|
||||
<!--td class="pl-[1rem]">
|
||||
{{-- <!--td class="pl-[1rem]">
|
||||
<svg wire:click="eliminarModTarifa({{ $tarifa->id ?? ''}})" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" class="w-6 cursor-pointer" x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><g id="Flat_Color" data-name="Flat Color"><circle cx="12" cy="12" fill="#e63946" r="10" data-original="#e63946" class=""></circle><path d="m13.41 12 2.3-2.29a1 1 0 0 0 -1.42-1.42l-2.29 2.3-2.29-2.3a1 1 0 0 0 -1.42 1.42l2.3 2.29-2.3 2.29a1 1 0 0 0 0 1.42 1 1 0 0 0 1.42 0l2.29-2.3 2.29 2.3a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42z" fill="#edebea" data-original="#edebea" class=""></path></g></g>
|
||||
</svg>
|
||||
</td-->
|
||||
</td> --}}
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@@ -303,9 +303,9 @@
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="valor_compra_promocion"
|
||||
<label for="utilidad"
|
||||
class="block text-gray-700 text-sm font-bold mb-2">Valor de compra:</label>
|
||||
<input name="valor_compra_promocion" wire:model="valor_compra_promocion" type="number" min="0"
|
||||
<input name="utilidad" wire:model="utilidad" type="number" min="0"
|
||||
placeholder="$0"
|
||||
class="w-full border-2 border-neutral-200 shadow rounded-[0.8rem] px-4 py-2 text-gray-900 sm:text-sm focus:border-neutral-300 focus:outline-none focus:shadow-outline focus:ring-0 block datepicker-input">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user