mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'refactor/messages-view' into feat/ordenes-trabajo
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CheckWebClientesPapeles extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'show_in_client' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class ModifyNullableComercialSoporte extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->modifyColumn('clientes', [
|
||||
'comercial_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => true, // Permitir valores NULL
|
||||
],
|
||||
'soporte_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => true, // Permitir valores NULL
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->modifyColumn('clientes', [
|
||||
'comercial_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => false,
|
||||
],
|
||||
'soporte_id' => [
|
||||
'type' => 'int(10) unsigned',
|
||||
'null' => false,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class TicksPapeles extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'show_in_client_special' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_generico', $fields);
|
||||
|
||||
$fields = [
|
||||
'show_in_client_special' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_generico', 'show_in_client_special');
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client_special');
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class CambiarTicksPapelImpresion extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'use_in_client' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client');
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'show_in_client_special');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$fields = [
|
||||
'show_in_client_special' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
'show_in_client' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'use_in_client');
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddTickInteriorPapelImpresion extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'interior' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'interior');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddTickTapaDuraPapelImp extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$fields = [
|
||||
'use_for_tapa_dura' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
$this->forge->addColumn('lg_papel_impresion', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropColumn('lg_papel_impresion', 'use_for_tapa_dura');
|
||||
}
|
||||
}
|
||||
52
ci4/app/Database/Seeds/MessageSeeder.php
Normal file
52
ci4/app/Database/Seeds/MessageSeeder.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use App\Models\Chat\ChatDeparmentModel;
|
||||
use App\Models\Chat\ChatDeparmentUserModel;
|
||||
use App\Models\Chat\ChatMessageModel;
|
||||
use App\Models\Chat\ChatModel;
|
||||
use App\Models\ChatNotification;
|
||||
use CodeIgniter\Database\Seeder;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
|
||||
class MessageSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
|
||||
$data = [
|
||||
"title" => "Message Test",
|
||||
"messages" => [
|
||||
[
|
||||
"sender_id" => 1,
|
||||
"receiver_id" => 127,
|
||||
],
|
||||
[
|
||||
"sender_id" => 127,
|
||||
"receiver_id" => 1,
|
||||
]
|
||||
]
|
||||
];
|
||||
$chatModel = model(ChatModel::class);
|
||||
$chatMessageModel = model(ChatMessageModel::class);
|
||||
$chatNotificationModel = model(ChatNotification::class);
|
||||
$userModel = model(UserModel::class);
|
||||
foreach (range(1,100) as $key => $value) {
|
||||
$chat_id = $chatModel->insert(["title" => $data["title"]." ".$value]);
|
||||
foreach ($data["messages"] as $key => $value) {
|
||||
$first_name = $userModel->find($value["receiver_id"])?->first_name;
|
||||
$chat_message_id = $chatMessageModel->insert([
|
||||
"chat_id" => $chat_id,
|
||||
"sender_id" => $value["sender_id"],
|
||||
"receiver_id" => $value["receiver_id"],
|
||||
"message" => "Hola"." ".$first_name
|
||||
]);
|
||||
$chatNotificationModel->insert([
|
||||
"chat_message_id" => $chat_message_id,
|
||||
"user_id" => $value["receiver_id"]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user