Fix: Filtro Fecha Tiradas
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 5m10s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 5m10s
This commit is contained in:
@@ -14,7 +14,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Configura SSH
|
# Configura SSH (sin cambios)
|
||||||
apt-get update -qq && apt-get install -y openssh-client git
|
apt-get update -qq && apt-get install -y openssh-client git
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "${{ secrets.PROD_SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
|
echo "${{ secrets.PROD_SERVER_SSH_KEY }}" > ~/.ssh/id_rsa
|
||||||
@@ -26,6 +26,12 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
echo "--- INICIO DEL DESPLIEGUE OPTIMIZADO ---"
|
echo "--- INICIO DEL DESPLIEGUE OPTIMIZADO ---"
|
||||||
|
|
||||||
|
# --- Asegurar que el Stack de la Base de Datos esté corriendo ---
|
||||||
|
echo "Asegurando que el stack de la base de datos esté activo..."
|
||||||
|
cd /opt/shared-services/database
|
||||||
|
# El comando 'up -d' es idempotente. Si ya está corriendo, no hace nada.
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
# 1. Preparar entorno
|
# 1. Preparar entorno
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
REPO_OWNER="dmolinari"
|
REPO_OWNER="dmolinari"
|
||||||
@@ -37,7 +43,7 @@ jobs:
|
|||||||
cd "$TEMP_DIR"
|
cd "$TEMP_DIR"
|
||||||
git checkout "${{ gitea.sha }}"
|
git checkout "${{ gitea.sha }}"
|
||||||
|
|
||||||
# 2. Construcción paralela con Docker nativo (más rápido y fiable)
|
# 2. Construcción paralela
|
||||||
build_image() {
|
build_image() {
|
||||||
local dockerfile=$1
|
local dockerfile=$1
|
||||||
local image_name=$2
|
local image_name=$2
|
||||||
@@ -59,7 +65,7 @@ jobs:
|
|||||||
cd /opt/gestion-integral
|
cd /opt/gestion-integral
|
||||||
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
|
export DB_SA_PASSWORD='${{ secrets.DB_SA_PASSWORD_SECRET }}'
|
||||||
|
|
||||||
echo "Recreando servicios..."
|
echo "Recreando servicios de la aplicación..."
|
||||||
docker compose up -d --force-recreate
|
docker compose up -d --force-recreate
|
||||||
|
|
||||||
# 4. Limpieza
|
# 4. Limpieza
|
||||||
@@ -68,5 +74,4 @@ jobs:
|
|||||||
docker image prune -f --filter "dangling=true"
|
docker image prune -f --filter "dangling=true"
|
||||||
|
|
||||||
echo "--- DESPLIEGUE COMPLETADO CON ÉXITO ---"
|
echo "--- DESPLIEGUE COMPLETADO CON ÉXITO ---"
|
||||||
echo "Tiempo total: $(($SECONDS / 60)) minutos y $(($SECONDS % 60)) segundos"
|
|
||||||
EOSSH
|
EOSSH
|
||||||
@@ -25,6 +25,13 @@ import TiradaFormModal from '../../components/Modals/Impresion/TiradaFormModal';
|
|||||||
import { usePermissions } from '../../hooks/usePermissions';
|
import { usePermissions } from '../../hooks/usePermissions';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const toLocalDateString = (date: Date): string => {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const day = date.getDate().toString().padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
};
|
||||||
|
|
||||||
const GestionarTiradasPage: React.FC = () => {
|
const GestionarTiradasPage: React.FC = () => {
|
||||||
const [tiradas, setTiradas] = useState<TiradaDto[]>([]);
|
const [tiradas, setTiradas] = useState<TiradaDto[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -32,7 +39,7 @@ const GestionarTiradasPage: React.FC = () => {
|
|||||||
const [apiErrorMessage, setApiErrorMessage] = useState<string | null>(null);
|
const [apiErrorMessage, setApiErrorMessage] = useState<string | null>(null);
|
||||||
|
|
||||||
// Filtros
|
// Filtros
|
||||||
const [filtroFecha, setFiltroFecha] = useState<string>(new Date().toISOString().split('T')[0]);
|
const [filtroFecha, setFiltroFecha] = useState<string>(toLocalDateString(new Date()));
|
||||||
const [filtroIdPublicacion, setFiltroIdPublicacion] = useState<number | string>('');
|
const [filtroIdPublicacion, setFiltroIdPublicacion] = useState<number | string>('');
|
||||||
const [filtroIdPlanta, setFiltroIdPlanta] = useState<number | string>('');
|
const [filtroIdPlanta, setFiltroIdPlanta] = useState<number | string>('');
|
||||||
|
|
||||||
@@ -118,7 +125,10 @@ const GestionarTiradasPage: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (dateString?: string | null) => dateString ? new Date(dateString + 'T00:00:00Z').toLocaleDateString('es-AR') : '-';
|
const formatDate = (dateString?: string | null) => {
|
||||||
|
if (!dateString) return '-';
|
||||||
|
return new Date(dateString).toLocaleDateString('es-AR', { timeZone: 'UTC' });
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!loading && !puedeVer && !loadingFiltersDropdown) return <Box sx={{ p: 2 }}><Alert severity="error">{error || "Acceso denegado."}</Alert></Box>;
|
if (!loading && !puedeVer && !loadingFiltersDropdown) return <Box sx={{ p: 2 }}><Alert severity="error">{error || "Acceso denegado."}</Alert></Box>;
|
||||||
@@ -127,17 +137,25 @@ const GestionarTiradasPage: React.FC = () => {
|
|||||||
<Box sx={{ p: 1 }}>
|
<Box sx={{ p: 1 }}>
|
||||||
<Typography variant="h5" gutterBottom>Gestión de Tiradas</Typography>
|
<Typography variant="h5" gutterBottom>Gestión de Tiradas</Typography>
|
||||||
<Paper sx={{ p: 2, mb: 2 }}>
|
<Paper sx={{ p: 2, mb: 2 }}>
|
||||||
<Typography variant="h6" gutterBottom>Filtros <FilterListIcon fontSize="small"/></Typography>
|
<Typography variant="h6" gutterBottom>Filtros <FilterListIcon fontSize="small" /></Typography>
|
||||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 2, alignItems: 'center', mb: 2}}>
|
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 2, alignItems: 'center', mb: 2 }}>
|
||||||
<TextField label="Fecha" type="date" size="small" value={filtroFecha} onChange={(e) => setFiltroFecha(e.target.value)} InputLabelProps={{ shrink: true }} sx={{minWidth: 170}}/>
|
<TextField
|
||||||
<FormControl size="small" sx={{minWidth: 200, flexGrow: 1}} disabled={loadingFiltersDropdown}>
|
label="Fecha"
|
||||||
|
type="date"
|
||||||
|
size="small"
|
||||||
|
value={filtroFecha}
|
||||||
|
onChange={(e) => setFiltroFecha(e.target.value)}
|
||||||
|
InputLabelProps={{ shrink: true }}
|
||||||
|
sx={{ minWidth: 170 }}
|
||||||
|
/>
|
||||||
|
<FormControl size="small" sx={{ minWidth: 200, flexGrow: 1 }} disabled={loadingFiltersDropdown}>
|
||||||
<InputLabel>Publicación</InputLabel>
|
<InputLabel>Publicación</InputLabel>
|
||||||
<Select value={filtroIdPublicacion} label="Publicación" onChange={(e) => setFiltroIdPublicacion(e.target.value as number | string)}>
|
<Select value={filtroIdPublicacion} label="Publicación" onChange={(e) => setFiltroIdPublicacion(e.target.value as number | string)}>
|
||||||
<MenuItem value=""><em>Todas</em></MenuItem>
|
<MenuItem value=""><em>Todas</em></MenuItem>
|
||||||
{publicaciones.map(p => <MenuItem key={p.idPublicacion} value={p.idPublicacion}>{p.nombre} ({p.nombreEmpresa})</MenuItem>)}
|
{publicaciones.map(p => <MenuItem key={p.idPublicacion} value={p.idPublicacion}>{p.nombre} ({p.nombreEmpresa})</MenuItem>)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl size="small" sx={{minWidth: 180, flexGrow: 1}} disabled={loadingFiltersDropdown}>
|
<FormControl size="small" sx={{ minWidth: 180, flexGrow: 1 }} disabled={loadingFiltersDropdown}>
|
||||||
<InputLabel>Planta</InputLabel>
|
<InputLabel>Planta</InputLabel>
|
||||||
<Select value={filtroIdPlanta} label="Planta" onChange={(e) => setFiltroIdPlanta(e.target.value as number | string)}>
|
<Select value={filtroIdPlanta} label="Planta" onChange={(e) => setFiltroIdPlanta(e.target.value as number | string)}>
|
||||||
<MenuItem value=""><em>Todas</em></MenuItem>
|
<MenuItem value=""><em>Todas</em></MenuItem>
|
||||||
@@ -150,25 +168,25 @@ const GestionarTiradasPage: React.FC = () => {
|
|||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
{loading && <Box sx={{ display: 'flex', justifyContent: 'center', my: 2 }}><CircularProgress /></Box>}
|
{loading && <Box sx={{ display: 'flex', justifyContent: 'center', my: 2 }}><CircularProgress /></Box>}
|
||||||
{error && !loading && <Alert severity="error" sx={{my: 2}}>{error}</Alert>}
|
{error && !loading && <Alert severity="error" sx={{ my: 2 }}>{error}</Alert>}
|
||||||
{apiErrorMessage && <Alert severity="error" sx={{my: 2}}>{apiErrorMessage}</Alert>}
|
{apiErrorMessage && <Alert severity="error" sx={{ my: 2 }}>{apiErrorMessage}</Alert>}
|
||||||
|
|
||||||
{!loading && !error && puedeVer && (
|
{!loading && !error && puedeVer && (
|
||||||
<Box>
|
<Box>
|
||||||
{tiradas.length === 0 ? (
|
{tiradas.length === 0 ? (
|
||||||
<Typography sx={{mt:2, textAlign:'center'}}>No se encontraron tiradas con los filtros aplicados.</Typography>
|
<Typography sx={{ mt: 2, textAlign: 'center' }}>No se encontraron tiradas con los filtros aplicados.</Typography>
|
||||||
) : (
|
) : (
|
||||||
tiradas.map((tirada) => (
|
tiradas.map((tirada) => (
|
||||||
<Accordion key={tirada.idRegistroTirada} sx={{mb:1}}>
|
<Accordion key={tirada.idRegistroTirada} sx={{ mb: 1 }}>
|
||||||
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
|
||||||
<Box sx={{display: 'flex', justifyContent: 'space-between', width: '100%', alignItems: 'center'}}>
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', width: '100%', alignItems: 'center' }}>
|
||||||
<Typography sx={{fontWeight:'bold'}}>{formatDate(tirada.fecha)} - {tirada.nombrePublicacion} ({tirada.nombrePlanta})</Typography>
|
<Typography sx={{ fontWeight: 'bold' }}>{formatDate(tirada.fecha)} - {tirada.nombrePublicacion} ({tirada.nombrePlanta})</Typography>
|
||||||
<Box>
|
<Box>
|
||||||
<Chip label={`${tirada.ejemplares} ej.`} color="primary" size="small" sx={{mr:1}}/>
|
<Chip label={`${tirada.ejemplares} ej.`} color="primary" size="small" sx={{ mr: 1 }} />
|
||||||
<Chip label={`${tirada.totalPaginasSumadas} pág.`} size="small" />
|
<Chip label={`${tirada.totalPaginasSumadas} pág.`} size="small" />
|
||||||
{puedeEliminar && (
|
{puedeEliminar && (
|
||||||
<IconButton size="small" onClick={(e) => { e.stopPropagation(); handleDeleteTirada(tirada);}} sx={{ml:1}}>
|
<IconButton size="small" onClick={(e) => { e.stopPropagation(); handleDeleteTirada(tirada); }} sx={{ ml: 1 }}>
|
||||||
<DeleteIcon color="error"/>
|
<DeleteIcon color="error" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user