Remove unnecessary console logs and improve code readability across multiple components
This commit is contained in:
@@ -85,8 +85,6 @@
|
||||
try {
|
||||
const response = await permissionsAPI.list();
|
||||
allPermissions = response.items || [];
|
||||
console.log('Total permissions loaded:', allPermissions.length);
|
||||
console.log('Unique permission IDs:', new Set(allPermissions.map(p => p.id)).size);
|
||||
if (selectedRole) {
|
||||
updateAvailablePermissions();
|
||||
}
|
||||
@@ -118,17 +116,12 @@
|
||||
const assignedIds = rolePermissions.map((rp) => rp.permission_id);
|
||||
availablePermissions = allPermissions.filter((p) => !assignedIds.includes(p.id));
|
||||
|
||||
console.log('Available permissions:', availablePermissions.length);
|
||||
console.log('Unique available IDs:', new Set(availablePermissions.map(p => p.id)).size);
|
||||
|
||||
updatePermissionsByModule();
|
||||
}
|
||||
|
||||
function updatePermissionsByModule() {
|
||||
const grouped = new Map<string, Permission[]>();
|
||||
|
||||
console.log('Grouping permissions:', availablePermissions.length);
|
||||
|
||||
// Filtrar por búsqueda
|
||||
const filtered = availablePermissions.filter((p) => {
|
||||
if (!permissionSearchQuery.trim()) return true;
|
||||
@@ -147,8 +140,6 @@
|
||||
grouped.get(p.module)!.push(p);
|
||||
});
|
||||
|
||||
console.log('Grouped by module:', Array.from(grouped.entries()).map(([k, v]) => `${k}: ${v.length}`));
|
||||
|
||||
permissionsByModule = grouped;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,13 +115,10 @@
|
||||
const currentId = $page.params.id;
|
||||
const companyId = companyStore.activeCompany?.id;
|
||||
|
||||
console.log('DEBUG: Effect triggered', { currentId, companyId });
|
||||
|
||||
if (currentId && companyId) {
|
||||
console.log('DEBUG: Calling loadDoda with', currentId);
|
||||
loadDoda(Number(currentId));
|
||||
} else if (!currentId) {
|
||||
console.log('DEBUG: No ID, resetting form');
|
||||
formData = getEmptyForm();
|
||||
error = null;
|
||||
}
|
||||
@@ -131,15 +128,8 @@
|
||||
loading = true;
|
||||
try {
|
||||
const companyId = companyStore.activeCompany?.id;
|
||||
console.log('DEBUG: loadDoda executing', { dodaId, companyId });
|
||||
|
||||
if (!companyId) {
|
||||
console.error('DEBUG: No company ID available in loadDoda');
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await getDoda(dodaId, companyId);
|
||||
console.log('DEBUG: getDoda response', data);
|
||||
|
||||
if (data) {
|
||||
formData = {
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
cantidad_guias_embarque: null,
|
||||
destino_origen: '',
|
||||
puerto_entrada: '',
|
||||
vehicle_data: '',
|
||||
fue_revisado_equipo: false,
|
||||
sub_division: false,
|
||||
funge_como_cd: false,
|
||||
@@ -191,7 +192,16 @@
|
||||
semaforo_verde_aduana_mexicana: false,
|
||||
semaforo_verde_aduana_americana: false,
|
||||
semaforo_rojo_aduana_mexicana: false,
|
||||
semaforo_rojo_aduana_americana: false
|
||||
semaforo_rojo_aduana_americana: false,
|
||||
// Export fields
|
||||
is_mixed: false,
|
||||
reason_export: '1',
|
||||
purchase_order: '',
|
||||
payment_terms: '',
|
||||
handling_fees: 0,
|
||||
cfdi_uuid: '',
|
||||
path_pdf: '',
|
||||
path_xml: ''
|
||||
};
|
||||
|
||||
function ensureItemsFormData(initial?: any) {
|
||||
|
||||
@@ -85,15 +85,7 @@
|
||||
|
||||
function handleRowClick(pedimento: Pedimento) {
|
||||
// Toggle: si ya está seleccionado, deseleccionar; si no, seleccionar
|
||||
selectedId = selectedId === pedimento.id ? null : pedimento.id;
|
||||
console.log(
|
||||
'🔘 Row clicked, pedimento.id:',
|
||||
pedimento.id,
|
||||
'selectedId:',
|
||||
selectedId,
|
||||
'hasSelection:',
|
||||
hasSelection
|
||||
);
|
||||
selectedId = selectedId === pedimento.id ? null : pedimento.id;
|
||||
}
|
||||
|
||||
function handleEditSelected() {
|
||||
|
||||
Reference in New Issue
Block a user