Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

56 nella pagina di riepilogo mensile degli orari le timbrature sono cliccabili anche se non è possibile modificarle per lutente #65

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions components/stampings/modal/absence/absenceModalTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const AbsenceModalTab: React.FC<AbsenceModalTabProps> = ({
showFindCodeTab,
showForceInsert
}) => {
const [selectedTab, setSelectedTab] = useState<string | null | any>(tabName);
const [selectedTab, setSelectedTab] = useState<string | null | any>(null);
const [activeTab,setActiveTab] = useState<string | null | any>(null);
const [visibleTabs, setVisibleTabs] = useState(Object.values(tabsVisible));
const [dataTab, setDataTab] = useState(data);
const [simDataTab, setSimDataTab] = useState(simData);
Expand All @@ -48,7 +49,9 @@ const AbsenceModalTab: React.FC<AbsenceModalTabProps> = ({

newParams['id'] = parameters.id;
newParams['from'] = parameters.from;
newParams['category'] = selectedTab;
if (selectedTab){
newParams['category'] = selectedTab;
}
newParams['switchGroup'] = false;

if (!('groupAbsenceTypeName' in element) && dataTab.groupSelected) {
Expand Down Expand Up @@ -88,6 +91,7 @@ const AbsenceModalTab: React.FC<AbsenceModalTabProps> = ({
params['category'] = selectedTab;
var dataAbs = await fetchDataAbsence(params, false);
setDataTab(dataAbs.data);
setActiveTab(dataAbs.data.categoryTabSelected.name);
}
getData();
}
Expand Down Expand Up @@ -118,7 +122,7 @@ const AbsenceModalTab: React.FC<AbsenceModalTabProps> = ({
return (
<>
<Tabs
activeKey={selectedTab}
activeKey={activeTab}
id="absenceTabs"
className="mb-3"
onSelect={(k) => handleTabChange(k)}
Expand Down
24 changes: 13 additions & 11 deletions components/stampings/stampingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ const StampingsTable: React.FC<StampingsTableProps> = ({
};

const personId = monthRecap.personId;
console.log("personId ", personId);
console.log("monthRecap ", monthRecap);

useEffect(() => {
setMonthRecapData(monthRecap);
}, [monthRecap]);

useEffect(() => {
let isMounted = true; // Flag per sapere se il componente è ancora montato
Expand Down Expand Up @@ -130,13 +132,11 @@ const StampingsTable: React.FC<StampingsTableProps> = ({
const url = `/api/rest/v4?endpoint=monthrecaps&${parameters}`;
async function getData() {
var res = await fetchData(url, "", null);
console.log('Dati recuperati:', res);
setMonthRecapData(res.data);
}
getData();
}
}, [refreshStampingModal, personId,year,month]);
console.log('monthRecapData.canEditStampings---+', monthRecapData.canEditStampings);
}, [refreshStampingModal, personId, year, month]);
return (<>
<AbsenceModal
title={titleAbsenceModal}
Expand Down Expand Up @@ -164,7 +164,8 @@ const StampingsTable: React.FC<StampingsTableProps> = ({
</React.Fragment>
))
}
{showInsertStamping ? <th className="group-single">Inserisci<br/>timbratura</th>: <th className="invisible"></th>}
{showInsertStamping && !pdr.personDay.future ?
(<th className="group-single">Inserisci<br/>timbratura</th>): ''}
<th className="invisible"></th>
<th className="group-single">Tempo<br />lavoro</th>
<th className="group-single">Diffe-<br />renza</th>
Expand Down Expand Up @@ -203,16 +204,17 @@ const StampingsTable: React.FC<StampingsTableProps> = ({
)}
</td>

<StampingsTemplate personDayRecap={pdr} setEditModalParam={setEditModalParam} canEditStampings={showEditStamping} />
<td>
<StampingsTemplate personDayRecap={pdr}
setEditModalParam={setEditModalParam}
canEditStampings={showEditStamping} />
{
showInsertStamping && !pdr.personDay.future ?
(
<td>
<a id="new-stamping" data-async-modal="#defaultModal" href="#" onClick={() => setModalParam('Stamping',pdr)}>
+++
</a>):''
}
</td>
</a>
</td>):''}
<td className="invisible"></td>
<TimeAtWorkDifferenceProgressive personDayRecap={pdr} />
<td>{pdr.wttd?.workingTimeType?.description}</td>
Expand Down
2 changes: 1 addition & 1 deletion styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nav {
.navbar-brand {
font-family: 'Shadows Into Light', cursive !important;
font-size: 200% !important;
padding: 1px 15px !important;
/*padding: 1px 15px !important;*/
}

.nav-item {
Expand Down
5 changes: 2 additions & 3 deletions utils/secureCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ export const secureCheck = async (params: any) => {
}

const data = await response.json();
console.log("data securecheck ", data);
return data; // Restituisci i dati
} catch (error) {
console.error("unable to achieve this", error);
return false; // In caso di errore restituisci false
console.error("unable to achieve this", error);
return false; // In caso di errore restituisci false
}
};