diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index 5a76bf5..10601bd 100644 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -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 diff --git a/app/Http/Livewire/ShowPromociones.php b/app/Http/Livewire/ShowPromociones.php index acb7756..8aab527 100644 --- a/app/Http/Livewire/ShowPromociones.php +++ b/app/Http/Livewire/ShowPromociones.php @@ -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; diff --git a/app/Models/Historiale.php b/app/Models/Historiale.php index 49aae21..cdbcd9e 100644 --- a/app/Models/Historiale.php +++ b/app/Models/Historiale.php @@ -12,6 +12,7 @@ class Historiale extends Model 'fecha_inicio', 'fecha_final', 'valor', + 'utilidad', 'tipo_pago', 'estado', 'vendedor_id', diff --git a/app/Models/Promociones.php b/app/Models/Promociones.php index e4a83ee..b5594f1 100644 --- a/app/Models/Promociones.php +++ b/app/Models/Promociones.php @@ -10,6 +10,7 @@ class Promociones extends Model use HasFactory; protected $fillable = [ 'precio', + 'utilidad', 'img_publicidad', 'fecha_limite', 'visible', diff --git a/app/Models/Tarifas.php b/app/Models/Tarifas.php index e16098c..5a0716e 100644 --- a/app/Models/Tarifas.php +++ b/app/Models/Tarifas.php @@ -12,6 +12,7 @@ class Tarifas extends Model 'pantallas', 'dias', 'valor', + 'utilidad', 'estado', 'servicio_id', 'rol_id' diff --git a/app/Models/Usuario_promo.php b/app/Models/Usuario_promo.php index cbee675..81559d8 100644 --- a/app/Models/Usuario_promo.php +++ b/app/Models/Usuario_promo.php @@ -12,6 +12,7 @@ class Usuario_promo extends Model 'usuario_id', 'promocion_id', 'precio', + 'utilidad', 'visible', ]; diff --git a/app/Models/Usuario_tarifa.php b/app/Models/Usuario_tarifa.php index ba7beff..48d80a5 100644 --- a/app/Models/Usuario_tarifa.php +++ b/app/Models/Usuario_tarifa.php @@ -12,6 +12,7 @@ class Usuario_tarifa extends Model 'usuario_id', 'tarifa_id', 'precio', + 'utilidad', 'visible', ]; diff --git a/database/migrations/2023_10_09_101523_add_precio_compra_to_promociones.php b/database/migrations/2023_10_09_121545_add_utilidad_to_promociones.php similarity index 85% rename from database/migrations/2023_10_09_101523_add_precio_compra_to_promociones.php rename to database/migrations/2023_10_09_121545_add_utilidad_to_promociones.php index c0e49de..f3e873d 100644 --- a/database/migrations/2023_10_09_101523_add_precio_compra_to_promociones.php +++ b/database/migrations/2023_10_09_121545_add_utilidad_to_promociones.php @@ -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'); }); } }; diff --git a/database/migrations/2023_10_09_142140_add_utilidad_to_usuario_tarifas.php b/database/migrations/2023_10_09_142140_add_utilidad_to_usuario_tarifas.php new file mode 100644 index 0000000..e069871 --- /dev/null +++ b/database/migrations/2023_10_09_142140_add_utilidad_to_usuario_tarifas.php @@ -0,0 +1,32 @@ +string('utilidad')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('usuario_tarifas', function (Blueprint $table) { + $table->dropColumn('utilidad'); + }); + } +}; diff --git a/database/migrations/2023_10_09_142227_add_utilidad_to_usuario_promos.php b/database/migrations/2023_10_09_142227_add_utilidad_to_usuario_promos.php new file mode 100644 index 0000000..9b7e116 --- /dev/null +++ b/database/migrations/2023_10_09_142227_add_utilidad_to_usuario_promos.php @@ -0,0 +1,32 @@ +string('utilidad')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('usuario_promos', function (Blueprint $table) { + $table->dropColumn('utilidad'); + }); + } +}; diff --git a/database/migrations/2023_10_09_143904_add_utilidad_to_historiales.php b/database/migrations/2023_10_09_143904_add_utilidad_to_historiales.php new file mode 100644 index 0000000..dc79ee1 --- /dev/null +++ b/database/migrations/2023_10_09_143904_add_utilidad_to_historiales.php @@ -0,0 +1,32 @@ +string('utilidad')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('historiales', function (Blueprint $table) { + $table->dropColumn('utilidad'); + }); + } +}; diff --git a/database/migrations/2023_10_09_145454_add_utilidad_to_tarifas.php b/database/migrations/2023_10_09_145454_add_utilidad_to_tarifas.php new file mode 100644 index 0000000..b47db1b --- /dev/null +++ b/database/migrations/2023_10_09_145454_add_utilidad_to_tarifas.php @@ -0,0 +1,32 @@ +string('utilidad')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('tarifas', function (Blueprint $table) { + $table->dropColumn('utilidad'); + }); + } +}; diff --git a/resources/views/livewire/show-index.blade.php b/resources/views/livewire/show-index.blade.php index 20cbc51..84f329a 100644 --- a/resources/views/livewire/show-index.blade.php +++ b/resources/views/livewire/show-index.blade.php @@ -19,7 +19,7 @@

Planes

-
+ -
@@ -769,10 +773,10 @@ - + --}} @endforeach @endif diff --git a/resources/views/livewire/show-promociones.blade.php b/resources/views/livewire/show-promociones.blade.php index 970ae9f..9467906 100644 --- a/resources/views/livewire/show-promociones.blade.php +++ b/resources/views/livewire/show-promociones.blade.php @@ -303,9 +303,9 @@
- -
{{ $tarifa->valor ?? '' }} {{ $tarifa->dias ?? '' }}