Modificado el sistema Toast por el popErrorAlert() que integramos

This commit is contained in:
imnavajas
2024-01-07 09:45:40 +01:00
parent 9c110ca6f2
commit 5d60b930ff
4 changed files with 65 additions and 19 deletions

2
.idea/php.xml generated
View File

@ -10,7 +10,7 @@
<option name="highlightLevel" value="WARNING" /> <option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0"> <component name="PhpProjectSharedConfiguration" php_language_level="7.3">
<option name="suggestChangeDefaultLanguageLevel" value="false" /> <option name="suggestChangeDefaultLanguageLevel" value="false" />
</component> </component>
<component name="PhpStanOptionsConfiguration"> <component name="PhpStanOptionsConfiguration">

10
.idea/phpunit.xml generated Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PHPUnit">
<option name="directories">
<list>
<option value="$PROJECT_DIR$/ci4/tests" />
</list>
</option>
</component>
</project>

View File

@ -17,20 +17,59 @@ class Test extends BaseController
public function index() public function index()
{ {
$model = model('App\Models\Clientes\ClientePreciosModel') ;
echo '<pre>'; $this->asignar_tarifa_defecto_todos_usuarios();
var_dump($model->update_from_plantilla(5));
echo '</pre>'; }
/*
echo '<pre>'; private function asignar_tarifa_defecto_todos_usuarios()
$model = model('App\Models\Clientes\ClientePreciosModel'); {
$configuracion = (object)[
'tipo' => 'interior', // Previo a ejecutar, vaciar la tabla clientes_precios (ojo si hay customizaciones)
'tipo_maquina' => 'inkjet',
'tipo_impresion' => 'color' $db = \Config\Database::connect();
]; $builder = $db->table('cliente_precios');
var_dump($model->get_precio_hora(999,$configuracion, 1.5));
echo '</pre>';*/ $plantillaDefectoId = 5;
$clienteModel = model('App\Models\Clientes\ClienteModel');
$platillaModel = model('App\Models\Clientes\ClientePlantillaPreciosLineasModel');
$plantillaDefecto = $platillaModel->getResource($plantillaDefectoId)->get()->getResultObject();
$clientes = $clienteModel->getResource()->get()->getResultObject();
foreach ($clientes as $cliente){
foreach ($plantillaDefecto as $plantillaDefectoLinea){
$data = [
'plantilla_id' => $plantillaDefectoId,
'cliente_id' => $cliente->id,
'tipo' => $plantillaDefectoLinea->tipo,
'tipo_maquina' => $plantillaDefectoLinea->tipo_maquina,
'tipo_impresion' => $plantillaDefectoLinea->tipo_impresion,
'tiempo_min' => $plantillaDefectoLinea->tiempo_min,
'tiempo_max' => $plantillaDefectoLinea->tiempo_max,
'precio_hora' => $plantillaDefectoLinea->precio_hora,
'margen' => $plantillaDefectoLinea->margen,
'user_created_id' => 2,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
];
/*echo '<pre>';
var_dump($data);
echo '</pre>';*/
$builder->insert($data);
}
//break;
}
} }

View File

@ -118,10 +118,7 @@
$('.dataTables_processing').hide(); $('.dataTables_processing').hide();
const theData = jqXHR.responseJSON; const theData = jqXHR.responseJSON;
drawCallback(theData); drawCallback(theData);
Toast.fire({ popErrorAlert(jqXHR.responseJSON.messages.error)
icon: 'error',
title: errorThrown,
});
} }
}); });
} else { } else {