PageSourceSearch

https://1lo.suwalki.pl/znamky/pics/jsw/certificates.js

js 1lo.suwalki.pl collected 2026-09-28 13:48:33 UTC 108,943 bytes, 1,805 lines download raw bytes

1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.cert_getSubjectRow = exports.certShowMultiEdit = exports.CertDochadzkaRenderer = exports.CertGradeRenderer = exports.DateWithTypeEditor = exports.VysvedcenieGenerateDialog = exports.ZnamkyDocsRenderer = exports.CertifcatesList = exports.CertificatesMain = void 0;
4var tslib_1 = require("tslib");
5var React = require("react");
6var AppReactUtils_1 = require("../../../app/pics/jsw/utils/AppReactUtils");
7var AppTabs_1 = require("../../../app/pics/jsw/components/AppTabs");
8var ViewLoadingContainer_1 = require("../../../app/pics/jsw/components/ViewLoadingContainer");
9var egovfilterbar_1 = require("../../../egov/pics/jsw/components/egovfilterbar");
10var table_1 = require("../../../egov/pics/jsw/components/table");
11var dbi_react_1 = require("../../../rpr/dbi_react");
12var AppRprReactUtils_1 = require("../../../app/pics/jsw/utils/AppRprReactUtils");
13var AscHttp_1 = require("../../../app/pics/jsw/utils/AscHttp");
14var certifcatesoverview_1 = require("./certifcatesoverview");
15var skdviewbtn_1 = require("../../../skd/pics/jsw/skdviewbtn");
16var generalmultiedit_1 = require("../../../egov/pics/jsw/views/dialogs/generalmultiedit");
17var certificatesbeforegenerate_1 = require("./certificatesbeforegenerate");
18var certificatespublish_1 = require("./certificatespublish");
19var dropdown_1 = require("../../../egov/pics/jsw/components/dropdown");
20var edurequest_1 = require("../../../asc/edurequest");
21var classificationutils_1 = require("./classificationutils");
22var certificateutils_1 = require("./certificateutils");
23importCss('/znamky/pics/css/znamky.css');
24importCss('/app/pics/css/znamky.css');
25importCss('/egov/pics/css/egov.css');
26importCss('/elearning/pics/css/etest.css');
27importCss('/app/pics/css/mobileApp.css');
28importCss('/diplomy/pics/css/diplomy.css');
29importCss('/skd/pics/css/officialletters.css');
30importCss('/znamky/pics/css/znamkyexams.css');
31importCss('/znamky/pics/css/poznamky.css');
32importCss('/agenda/pics/online.css');
33importLegacyJsLib('/znamky/pics/js/utilsZnamky.js');
34function CertificatesMain(props) {
35    var mainElemRef = React.useRef(null);
36    var _a = AppReactUtils_1.AppReactUtils.useRefStateWithSessionStorage(props.view || 'list', 'CertificatesMainView'), view = _a[0], setView = _a[1];
37    var _b = React.useState({
38        triedaid: props.triedaid || "",
39        predmetid: props.predmetid || "",
40        planid: props.planid || "",
41        obdobie: props.obdobie || ""
42    }), md = _b[0], setMd = _b[1];
43    React.useEffect(function () {
44        barRefreshPage($(mainElemRef.current).find('.znamkyExams-viewBtn'));
45        if (edubar && edubar.initCoursesToolbar) {
46            edubar.initCoursesToolbar({
47                courseid: '',
48                courserow: null
49            });
50        }
51        barSelectEdubarModule(props.mod == 'docs' ? 'docs' : 'znamky');
52    }, [md]);
53    function changeView(val) {
54        setView(val);
55    }
56    function onCourseChange(nv) {
57        setMd($.extend({}, md, nv));
58    }
59    function switchToAutoYear() {
60        if (edubar && edubar.switchSchoolYear) {
61            edubar.switchSchoolYear(props.autoYear);
62        }
63    }
64    return (React.createElement("div", { ref: mainElemRef, className: "poznamky-outer-bg wminMax" },
65        React.createElement("div", { className: "poznamky-toolbar certificates-lsticky-bar-outer " + view + (props.mod == 'docs' ? ' dark' : ''), style: { gap: '25px', justifyContent: 'flex-start' } },
66            React.createElement("div", { style: { display: 'flex', flexFlow: 'row nowrap', gap: '25px', justifyContent: 'flex-start', width: 'auto', marginRight: 'auto' }, className: "certificates-lsticky-bar" },
67                props.mod == 'docs'
68                    ? (React.createElement(skdviewbtn_1.SkdViewBtn, tslib_1.__assign({}, props, { mod: "certificates", mod0: "docs" })))
69                    : React.createElement("div", { className: "znamkyExams-viewBtn ", dangerouslySetInnerHTML: { __html: EdubarUtils.getZnamkyPohladBtn('certificates', md === null || md === void 0 ? void 0 : md.triedaid, md === null || md === void 0 ? void 0 : md.predmetid, md === null || md === void 0 ? void 0 : md.planid, md === null || md === void 0 ? void 0 : md.obdobie, { ecourseMode: true }) } }),
70                React.createElement("div", { className: "", style: { al
70ignSelf: 'flex-end' } },
71                    React.createElement("a", { className: "app-link-button inheritColor normalCase normalWeight", target: "_blank", href: "https://help.edupage.org/?p=u1/u111/u4109", style: { padding: '12px' } },
72                        React.createElement("i", { className: "fa fa-fw fa-question-circle-o" }),
73                        " ",
74                        ls(1077)),
75                    false && React.createElement(AppTabs_1.AppTabs, { className: "light", selectedTab: view, tabs: [
76                            { id: 'list', name: 'List' },
77                            { id: 'statistics', name: 'Overview' },
78                        ], onChangeTab: changeView })))),
79        EdubarUtils.getSelectedSchoolYear() < 2022 && false
80            ? (React.createElement("div", { style: { padding: '30px 20px', background: '#eee', fontSize: '16px' } },
81                React.createElement("i", { className: "fa fa-fw fa-info" }),
82                " ",
83                ls(12608),
84                React.createElement("div", { style: { margin: '12px 0 12px 25px' } },
85                    React.createElement("input", { type: "button", className: "flat-button flat-button-blue", value: ls(12609), onClick: switchToAutoYear }))))
86            : view == 'list'
87                ? (md.triedaid
88                    ? React.createElement(CertifcatesList, tslib_1.__assign({}, props, md, { onCourseChange: onCourseChange }))
89                    : React.createElement(certifcatesoverview_1.CertifcatesOverview, tslib_1.__assign({}, props, md, { onCourseChange: onCourseChange })))
90                : ""));
91}
92exports.CertificatesMain = CertificatesMain;
93function CertifcatesList(props) {
94    var _this = this;
95    var _a, _b, _c, _d, _e;
96    var mainElemRef = React.useRef(null);
97    var selectedYear = EdubarUtils.getSelectedSchoolYear();
98    var _f = AppReactUtils_1.AppReactUtils.useRefState({
99        triedaid: props.triedaid,
100        obdobie: props.obdobie,
101        odborid: ''
102    }), filterData = _f[0], setFilterData = _f[1];
103    var selectedItemsRef = React.useRef(null);
104    var dbi = certificateutils_1.CertificateUtils.useCertificatesDbi(selectedYear);
105    var _g = AppRprReactUtils_1.AppRprReactUtils.useOnlineDataWithChangeEvents('/znamky/?what=Certificates&akcia=getData', { triedaid: filterData.triedaid, obdobie: filterData.obdobie, mod: props.mod, znamky_yearid: props.year || EdubarUtils.getSelectedSchoolYear(), znamky_yearid_ns: '1' }, props, function (data) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
106        return tslib_1.__generator(this, function (_a) {
107            Znamky.initZnamkovanieSettings(data.znamkovanieSettings);
108            if (window.history.replaceState && !props.embedded) {
109                window.history.replaceState(null, null, barEncLink(data.formurl));
110            }
111            return [2, data];
112        });
113    }); }), data = _g[0], reload = _g[1], md0 = _g[2];
114    React.useEffect(function () {
115        barShowSchoolYearSelector();
116        if (props.embedded) {
117            $(mainElemRef.current).closest('.ui-dialog').toggleClass('grayTitleDialog noPadding autoCenteredDialog', true).toggleClass('whiteDialog', false);
118            $(mainElemRef.current).closest('.ui-dialog-content').dialog('option', 'width', $(window).width() * 0.95);
119            barSetDialogTitle(mainElemRef.current, ls(12110) + ' ' + EduSettings.getNazovSkolskehoRoku(props.year || EdubarUtils.getSelectedSchoolYear()));
120        }
121    }, []);
122    React.useEffect(function () {
123        barRefreshPage($(mainElemRef.current));
124        function refresh() {
125            reload();
126        }
127        function recomputeCerts() {
128            var s = '';
129            s += '<div style="max-width:600px;font-weight: normal;"><b>' + lset(2315) + ':</b> ' + lset(13115) + '</div>';
130            s += '<div style="margin-top:8px"><a class="app-link-button normalCase">' + lset(12585) + '</a></div>';
131            barShowMessage(s, 15000, '', function () {
132                dogenerateCertificates(null);
133            });
134        }
135        $(window).on('certificatesRefreshView', refresh);
136        $(window).on('recomputeCertsWarning', recomputeCerts);
137        return function () {
138            $(window).off('certificatesRefreshView', refresh);
139            $(window).off('recomputeCertsWarning', recomputeCerts);
140        };
141    }, [md0, data]);
142    var md = React.useMemo(function () {
143        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
144        var studenti = (md0 === null || md0 === void 0 ? void 0 : md0.studenti) || [];
145        var poznamky = (md0 === null || md0 === void 0 ? void 0 : md0.poznamky) || [];
146        var znamkydocs = (md0 === null || md0 === void 0 ? void 0 : md0.znamkydocs) || {};
147        var poznamkyByStudent = {};
148        var jeMs = (md0 === null || md0 === void 0 ? void 0 : md0.jeMs) || false;
149        for (var _i = 0, poznamky_1 = poznamky; _i < poznamky_1.length; _i++) {
150            var r = poznamky_1[_i];
151            if (!poznamkyByStudent[r.StudentID])
152                continue;
153            poznamkyByStudent[r.StudentID].push(r);
154        }
155        var dochadzkaStlpce = [
156            'teoria_excused', 'teoria_unexcused', 'prax_excused', 'prax_unexcused', 'excused', 'unexcused'
157        ];
158        var dochadzkaEtk = md0 === null || md0 === void 0 ? void 0 : md0.dochadzkaEtk;
159        var half = (md0 === null || md0 === void 0 ? void 0 : md0.half) || 1;
160        var subjectcolids = (md0 === null || md0 === void 0 ? void 0 : md0.subjectcolids) || [];
161        var numGrades = 0;
162        var numGradesNotPublished = 0;
163        var numNevygenerovane = 0;
164        var numStarePdf = 0;
165        var numNotPublished = 0;
166        var rows = [];
167        var rowsById = {};
168        var numPdfs = 0;
169        var max_numberinclass = 0;
170        var examType = (md0 === null || md0 === void 0 ? void 0 : md0.examType) || "";
171        var definedClassSubjects = (_b = (_a = dbi.rowData('classes', filterData.triedaid)) === null || _a === void 0 ? void 0 : _a.subjects) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.subjectid; });
172        definedClassSubjects === null || definedClassSubjects === void 0 ? void 0 : definedClassSubjects.push('1');
173        var coursesBySubject = {};
174        for (var _w = 0, _x = dbi.tableData('groupsubjects'); _w < _x.length; _w++) {
175            var r_1 = _x[_w];
176            if (EdubarUtils.indexOf(r_1.classids, filterData.triedaid) < 0)
177                continue;
178            if (r_1.entireclass) {
179                for (var _y = 0, studenti_1 = studenti; _y < studenti_1.length; _y++) {
180                    var sr = studenti_1[_y];
181                    var skid_1 = sr.StudentID + ':' + sr.Kopia;
182                    if (!coursesBySubject[skid_1])
183                        coursesBySubject[skid_1] = {};
184                    coursesBySubject[skid_1][r_1.subjectid] = true;
185                }
186            }
187            else if (r_1.studentkopiaids) {
188                for (var _z = 0, _0 = r_1.studentkopiaids; _z < _0.length; _z++) {
189                    var skid_2 = _0[_z];
190                    if (!coursesBySubject[skid_2])
191                        coursesBySubject[skid_2] = {};
192                    coursesBySubject[skid_2][r_1.subjectid] = true;
193                }
194            }
195            else {
196            }
197        }
198        var mamOdbory = {};
199        var usedDocTypes = {};
200        var mamSkids = {};
201        for (var _1 = 0, studenti_2 = studenti; _1 < studenti_2.length; _1++) {
202            var r = studenti_2[_1];
203            var skid = r.StudentID + ':' + r.Kopia;
204            var cr = md0 === null || md0 === void 0 ? void 0 : md0.certificates[skid];
205            var sr = dbi.rowData('studentkopias', skid);
206            if (!sr)
207                continue;
208            var odborid = sr.odborid || ((_c = dbi.rowData('classes', sr.classid)) === null || _c === void 0 ? void 0 : _c.odborid);
209            if (odborid) {
210                mamOdbory[odborid] = true;
211            }
212            mamSkids[skid] = true;
213            var item = {
214                skid: skid,
215                studentid: r.StudentID,
216                kopia: r.Kopia,
217                preskrtnuty: r.preskrtnuty,
218                preskrtnutyPreco: r.preskrtnutyPreco,
219                name: EdubarUtils.getUserRowName(r),
220                numberinclass: r.p_cislo_katalogu,
221                classid: r.TriedaID,
222                znamkydocs: [],
223                generated: cr === null || cr === void 0 ? void 0 : cr.generated,
224                date: cr === null || cr === void 0 ? void 0 : cr.date,
225                dateval: cr === null || cr === void 0 ? void 0 : cr.date,
226                gradesVisibility: ((_d = md0 === null || md0 === void 0 ? void 0 : md0.gradesVisibility) === null || _d === void 0 ? void 0 : _d[r.StudentID]) === false || ((_e = md0 === null || md0 === void 0 ? void 0 : md0.gradesVisibility) === null || _e === void 0 ? void 0 : _e[r.StudentID]) === true
227                    ? (_f = md0 === null || md0 === void 0 ? void 0 : md0.gradesVisibility) === null || _f === void 0 ? void 0 : _f[r.StudentID]
228                    : !!(md0 === null || md0 === void 0 ? void 0 : md0.admin_zobrazovat_znamky),
229                numGrades: 0,
230                maVysvedcenie: true,
231                odborid: odborid,
232                odbor_name: dbi.rowName('odbors', odborid),
233                exclude_subjectids: r.exclude_subjectids,
234                in_courses: (_g = coursesBySubject[skid]) !== null && _g !== void 0 ? _g : null,
235                studentRow0: r
236            };
237            if (!(cr === null || cr === void 0 ? void 0 : cr.generated) && !r.preskrtnuty) {
238                numNevygenerovane++;
239            }
240            if (!item.gradesVisibility) {
241                numGradesNotPublished++;
242            }
243            for (var f in cr) {
244                item[f] = cr[f];
245                if (((_h = cr[f]) === null || _h === void 0 ? void 0 : _h.z) || ((_j = cr[f]) === null || _j === void 0 ? void 0 : _j.z_t)) {
246                    numGrades++;
247                    item.numGrades++;
248                }
249            }
250            if (item.numberinclass * 1 > max_numberinclass)
251                max_numberinclass = item.numberinclass * 1;
252            var docs = znamkydocs[skid] || [];
253            var jeOk = false;
254            for (var _2 = 0, docs_1 = docs; _2 < docs_1.length; _2++) {
255                var d = docs_1[_2];
256                if (!Znamky.isCertificatesDocType(d.type))
257                    continue;
258                if (md0 === null || md0 === void 0 ? void 0 : md0.useKenyaExamReporting) {
259                    if (!examType && d.subtype)
260                        continue;
261                    if (examType && d.subtype != examType)
262                        continue;
263                }
264                usedDocTypes[d.type] = true;
265                item.znamkydocs.push(d);
266                if (!item["znamkydocs" + d.type])
267                    item["znamkydocs" + d.type] = [];
268                item["znamkydocs" + d.type].push(d);
269                if (jeMs || ((cr === null || cr === void 0 ? void 0 : cr.generated) && d.time_added >= (cr === null || cr === void 0 ? void 0 : cr.generated))) {
270                    jeOk = true;
271                }
272                if (d.student_visibility != 'visible') {
273                    numNotPublished++;
274                }
275                numPdfs++;
276            }
277            if (!jeOk && !r.preskrtnuty)
278                numStarePdf++;
279            for (var _3 = 0, subjectcolids_1 = subjectcolids; _3 < subjectcolids_1.length; _3++) {
280                var colid = subjectcolids_1[_3];
281                var val_1 = item[colid];
282                if (!val_1)
283                    continue;
284                var ref = (val_1 === null || val_1 === void 0 ? void 0 : val_1.k) || (val_1 === null || val_1 === void 0 ? void 0 : val_1.z) || (val_1 === null || val_1 === void 0 ? void 0 : val_1.r) || "";
285                var v = (val_1 === null || val_1 === void 0 ? void 0 : val_1.v) || "";
286                if (v != ref) {
287                    numNevygenerovane++;
288                }
289            }
290            for (var _4 = 0, dochadzkaStlpce_1 = dochadzkaStlpce; _4 < dochadzkaStlpce_1.length; _4++) {
291                var f = dochadzkaStlpce_1[_4];
292                var val = item[f];
293                var etkVal = (_k = dochadzkaEtk === null || dochadzkaEtk === void 0 ? void 0 : dochadzkaEtk[item.studentid]) === null || _k === void 0 ? void 0 : _k[f];
294                var dochSource = (_m = (_l = dochadzkaEtk === null || dochadzkaEtk === void 0 ? void 0 : dochadzkaEtk[item.studentid]) === null || _l === void 0 ? void 0 : _l["vysved_doch_" + half]) === null || _m === void 0 ? void 0 : _m.src;
295                var isEq = !(etkVal || etkVal === 0) || val == etkVal;
296                if (!isEq && dochSource != 'manual') {
297                }
298            }
299            item["dateval"] = item["date"];
300            if (!(((_o = item['modified']) === null || _o === void 0 ? void 0 : _o.indexOf('date')) >= 0) && !item["dateval"]) {
301                item["dateval"] = item["date_computed"];
302            }
303            else if ((((_p = item['modified']) === null || _p === void 0 ? void 0 : _p.indexOf('date')) >= 0) && !item["date"]) {
304                item.maVysvedcenie = false;
305            }
306            if ((cr === null || cr === void 0 ? void 0 : cr.valuetype) != (cr === null || cr === void 0 ? void 0 : cr.valuetype_cur))
307                numNevygenerovane++;
308            if (!(cr === null || cr === void 0 ? void 0 : cr.generated))
309                numNevygenerovane++;
310            rows.push(item);
311            rowsById[skid] = item;
312        }
313        var showOdbor = Object.keys(mamOdbory).length > 1;
314        var filterOdborid = filterData.odborid;
315        if (filterData.odborid && !mamOdbory[filterData.odborid]) {
316            filterOdborid = '';
317            filterData.odborid = filterOdborid;
318        }
319        if (showOdbor && filterOdborid) {
320            rows = rows.filter(function (r) { return r.odborid == filterOdborid; });
321        }
322        var fields = [
323            {
324                id: 'name',
325                name: ls(2870),
326                headerClassName: 'valign-bottom',
327                cellClassName: 'valign-center certificates-ajked-nema',
328                moreSortFields: showOdbor ? [{ id: 'odbor_name', name: ls(6297) }] : null,
329                renderer: function (val, r) {
330                    return (React.createElement(React.Fragment, null,
331                        r.preskrtnuty
332                            ? React.createElement("del", { title: r.preskrtnutyPreco }, val)
333                            : val,
334                        showOdbor && (React.createElement("div", { className: 'egov-subtitle small certificates-odbor-singleline', title: dbi.rowName('odbors', r.odborid) }, dbi.rowName('odbors', r.odborid)))));
335                }
336            },
337        ];
338        if (!jeMs && !examType) {
339            fields.push({
340                id: 'grades',
341                name: ls(3419),
342                headerClassName: 'valign-bottom',
343                headerColSpan: '1',
344                cellClassName: 'nopadding  valign-center calign',
345                renderer: function (val, r) {
346                    return (React.createElement("a", { className: 'app-link-button  normalCase normalWeight ' + (r.gradesVisibility && r.numGrades > 0 ? 'certificates-ok-color' : (r.numGrades > 0 ? 'certificates-warning-color' : 'inheritColor')), "data-skid": r.skid, title: (r.gradesVisibility ? ls(13024) : ls(13025)) + ' (' + ls(1090) + ')', onClick: publishGradesClick },
347                        r.numGrades || '-',
348                        r.numGrades == 0
349                            ? ''
350                            : r.gradesVisibility
351                                ? React.createElement("i", { className: 'fa fa-fw fa-eye' })
352                                : React.createElement("i", { className: 'fa fa-fw fa-eye-slash' })));
353                }
354            });
355        }
356        var usedDocTypesArr = [];
357        for (var _5 = 0, _6 = Znamky.getCertificateDocTypes(); _5 < _6.length; _5++) {
358            var dt = _6[_5];
359            if (!usedDocTypes[dt])
360                continue;
361            usedDocTypesArr.push({ id: dt, name: ((_q = Znamky.getDocTypeInfo(dt)) === null || _q === void 0 ? void 0 : _q.short) || ((_r = Znamky.getDocTypeInfo(dt)) === null || _r === void 0 ? void 0 : _r.name) || "", filterType: dt });
362        }
363        if (usedDocTypesArr.length == 0) {
364            usedDocTypesArr.push({
365                id: '',
366                name: jeMs ? ls(12398) : ls(12408),
367                filterType: ''
368            });
369        }
370        var i = 0;
371        for (var _7 = 0, usedDocTypesArr_1 = usedDocTypesArr; _7 < usedDocTypesArr_1.length; _7++) {
372            var dt = usedDocTypesArr_1[_7];
373            fields.push({
374                id: 'znamkydocs' + (dt.id || ''),
375                name: dt.name,
376                headerClassName: 'valign-bottom' + (true ? ' noRBorder' : ''),
377                headerColSpan: '1',
378                cellClassName: 'nopadding  valign-center' + (true ? ' lightRBorder' : ''),
379                footerClassName: 'noRBorder',
380                renderer: function (val, r) {
381                    return (React.createElement("div", { className: "certificates-polroky-zvlast-split" },
382                        React.createElement(ZnamkyDocsRenderer, { value: val, row: r, createDocClick: createDocClick, showDocClick: showDocClick, show: { doc: true, atts: true, add: false } }),
383                        r.cz_polroky_zvlast && (React.createElement("div", { className: "certificates-polroky-zvlast", title: ls(ls(13440)) + '\n' + ls(13441) },
384                            React.createElement("i", { className: 'fa  fa-file-text-o' }),
385                            React.createElement("i", { className: 'fa  fa-file-text-o' })))));
386                }
387            });
388            i++;
389        }
390        fields.push({
391            id: 'znamkydocsadd',
392            name: '',
393            headerClassName: 'valign-bottom certificates-znamkydocsaddCell thickRBorder',
394            headerColSpan: '1',
395            cellClassName: 'nopadding  valign-center certificates-znamkydocsaddCell thickRBorder',
396            renderer: function (val, r) {
397                return (React.createElement("a", { className: "app-link-button normalCase normalWeight inheritColor", "data-skid": r.skid, onClick: createDocClick, style: { color: "#FF7043" }, title: ls(12577) },
398                    React.createElement("i", { className: "fa fa-fw fa-plus" })));
399            }
400        });
401        var subjCols = [];
402        var _loop_1 = function () {
403            var _16 = colid.split(':'), xx = _16[0], subjectid = _16[1], subjectType = _16[2];
404            var sr = cert_getSubjectRow(subjectid, dbi);
405            if (!sr)
406                return "continue";
407            subjCols.push(colid);
408            if (!jeMs) {
409                fields.push({
410                    id: colid,
411                    subjectid: subjectid,
412                    name: React.createElement("span", { title: sr["name"] }, sr["short"] || (sr["name"] || "??").substr(0, 3)),
413                    headerTooltip: sr["name"],
414                    headerClassName: 'valign-bottom',
415                    cellClassName: 'calign valign-center nopadding',
416                    cellClassNameFunc: function (val, r) {
417                        var isIfailing = false;
418                        if (val === null || val === void 0 ? void 0 : val.v) {
419                            var pz = Znamky.getParamsHodnoty(val === null || val === void 0 ? void 0 : val.v);
420                            isIfailing = pz === null || pz === void 0 ? void 0 : pz.isFailing;
421                        }
422                        var ret = 'calign valign-center ' + (isIfailing ? ' certificates-failed-val' : '');
423                        var sr0 = r.studentRow0;
424                        if (subjectid == 1) {
425                        }
426                        else if ((subjectid == 2 && !(sr0 === null || sr0 === void 0 ? void 0 : sr0.p_hlavny_predmet)) || (subjectid == 3 && !(sr0 === null || sr0 === void 0 ? void 0 : sr0.p_obligatny_nastroj)) || (subjectid == 4 && !(sr0 === null || sr0 === void 0 ? void 0 : sr0.p_volitelny_nastroj))) {
427                            ret += ' certificates-excluded-subject';
428                        }
429                        else if (r.exclude_subjectids && EdubarUtils.indexOf(r.exclude_subjectids, subjectid) != -1) {
430                            ret += ' certificates-excluded-subject';
431                        }
432                        else if (r.in_courses && !r.in_courses[subjectid]) {
433                            ret += ' certificates-nocourse-subject';
434                        }
435                        return ret;
436                    },
437                    headerRenderer: function (fid, f) {
438                        var isUndefinedClassSubject = false;
439                        if (definedClassSubjects && EdubarUtils.indexOf(definedClassSubjects, f.subjectid) < 0) {
440                            isUndefinedClassSubject = true;
441                        }
442                        var sr = cert_getSubjectRow(f.subjectid, dbi);
443                        return (React.createElement(React.Fragment, null,
444                            sr["not_in_grades"]
445                                ? React.createElement("i", { className: "fa fa-ban fa-fw certificates-undefined-subject", title: edurequest_1.client_req.ails('sk:Predmet je neklasifikovaný, t.j. nepočíta do prospechu') })
446                                : sr["sk_neratatdoprospechu"] || (f.subjectid == '1' && EdubarUtils.indexOf(['sk', 'cz'], EdubarUtils.getSchoolCountry()) >= 0)
447                                    ? React.createElement("i", { className: "fa fa-ban fa-fw certificates-undefined-subject", title: edurequest_1.client_req.ails('sk:Predmet sa nepočíta do prospechu') })
448                                    : null,
449                            isUndefinedClassSubject ? React.createElement("i", { className: "fa fa-warning fa-fw certificates-undefined-subject", title: ls(12610) }) : null));
450                    },
451                    renderer: function (val, r, fid, f) {
452                        return React.createElement(CertGradeRenderer, { val: val, r: r, fid: fid, f: f, clickFunc: dolozkaClick, oid: md0 === null || md0 === void 0 ? void 0 : md0.obdobie });
453                    }
454                });
455            }
456        };
457        for (var _8 = 0, subjectcolids_2 = subjectcolids; _8 < subjectcolids_2.length; _8++) {
458            var colid = subjectcolids_2[_8];
459            _loop_1();
460        }
461        if (!jeMs) {
462            fields.push({
463                id: 'average',
464                name: ls(2872),
465                headerClassName: 'valign-bottom ofl-averageCell',
466                cellClassName: 'ralign valign-center ofl-averageCell',
467                renderer: function (val, r) {
468                    if (val) {
469                        return parseFloat(val).toFixed(2);
470                    }
471                    return null;
472                }
473            });
474            if (Znamky.certificatesUseComputation()) {
475                fields.push({
476                    id: 'value',
477                    name: ls(6318),
478                    cellClassName: 'valign-center calign nopadding',
479                    cellClassNameFunc: function (value, r) {
480                        return 'valign-center calign nopadding ' + (r.valueid_failed ? '	certificates-failed-val' : '');
481                    },
482                    renderer: function (val, r) {
483                        var _a, _b, _c;
484                        var className = "app-link-button normalCase normalWeight inheritColor " + (((_a = r.modified) === null || _a === void 0 ? void 0 : _a.indexOf('value')) >= 0 ? 'certificates-modified-val' : '');
485                        var ref = val;
486                        if (((_b = r.modified) === null || _b === void 0 ? void 0 : _b.indexOf('value')) >= 0 && !val) {
487                            val = '-';
488                        }
489                        else if (!val) {
490                            val = r["value_computed"];
491                        }
492                        var title = '';
493                        var boloTitlePrepocitaj = false;
494                        if (!(((_c = r.modified) === null || _c === void 0 ? void 0 : _c.indexOf('value')) >= 0)) {
495                            ref = r.value_computed;
496                            if (val != ref) {
497                                className += ' certificates-not-equal';
498                                title += ls(13110) + ': ' + ref;
499                                title += '\n\n' + ls(12612) + '!';
500                                boloTitlePrepocitaj = true;
501                            }
502                        }
503                        if (r.valuetype != r.valuetype_cur) {
504                            if (title)
505                                title += '\n\n';
506                            title += ls(2115) + ' - ' + ls(12613) + ':  ' + r.valuetype_cur_text + '\n';
507                            if (!boloTitlePrepocitaj)
508                                title += '\n\n' + ls(12612) + '!';
509                        }
510                        return (React.createElement("a", { title: ls(12613) + ': ' + r.valuetype_text + (title ? "\n\n" + title : ''), onClick: changeProspechClick, className: className, "data-id": r.skid }, val || "-"));
511                    }
512                });
513            }
514        }
515        var dochadzkaRenderer = function (val, r, fid, f) {
516            return React.createElement(CertDochadzkaRenderer, { dochadzkaEtk: dochadzkaEtk, studentid: r.studentid, fid: fid, val: val, half: half, r: r });
517        };
518        if (!examType) {
519            if (md0 === null || md0 === void 0 ? void 0 : md0.prax_je) {
520                fields.push({ id: 'teoria_excused', name: React.createElement(React.Fragment, null,
521                        ls(3127).substr(0, 4),
522                        ".",
523                        React.createElement("br", null),
524                        ls(4647)), title: ls(3127) + ' - ' + ls(4647), headerClassName: 'calign', cellClassName: 'ralign valign-center nopadding', renderer: dochadzkaRenderer });
525                fields.push({ id: 'teoria_unexcused', name: React.createElement(React.Fragment, null,
526                        ls(3128).substr(0, 4),
527                        ".",
528                        React.createElement("br", null),
529                        ls(4647)), title: ls(3128) + ' - ' + ls(4647), headerClassName: 'calign', cellClassName: 'ralign valign-center nopadding', renderer: dochadzkaRenderer });
530                fields.push({ id: 'prax_excused', name: React.createElement(React.Fragment, null,
531                        ls(3127).substr(0, 4),
532                        ".",
533                        React.createElement("br", null),
534                        ls(4648)), title: ls(3127) + ' - ' + ls(4648), headerClassName: 'calign', cellClassName: 'ralign valign-center nopadding', renderer: dochadzkaRenderer });
535                fields.push({ id: 'prax_unexcused', name: React.createElement(React.Fragment, null,
536                        ls(3128).substr(0, 4),
537                        ".",
538                        React.createElement("br", null),
539                        ls(4648)), title: ls(3128) + ' - ' + ls(4648), headerClassName: 'calign', cellClassName: 'ralign valign-center nopadding', renderer: dochadzkaRenderer });
540            }
541            else {
542                fields.push({ id: 'excused', name: ls(3127).substr(0, 4) + '.', title: ls(3127), cellClassName: 'ralign valign-center nopadding', renderer: dochadzkaRenderer });
543                fields.push({ id: 'unexcused', name: ls(3128).substr(0, 4) + '.', title: ls(3128), cellClassName: 'ralign valign-center nopadding', renderer: dochadzkaRenderer });
544            }
545            if (false) {
546                fields.push({
547                    id: 'slovnehodnotenie',
548                    name: ls(9867),
549                    cellClassName: 'nopadding valign-center',
550                    renderer: function (val, r) {
551                        var m = Znamky.getObdobieVysvedcenia(md0 === null || md0 === void 0 ? void 0 : md0.obdobie);
552                        var str = '';
553                        if (EdubarUtils.getSchoolCountry() == 'sk') {
554                            if (m == "V1" && r['p_vysvedcenie_hodnotenie1']) {
555                                str += Znamky.stripTags(r['p_vysvedcenie_hodnotenie1']);
556                            }
557                            if (m == "V2" && r['p_vysvedcenie_hodnotenie2']) {
558                                str += Znamky.stripTags(r['p_vysvedcenie_hodnotenie2']);
559                            }
560                        }
561                        return (React.createElement("a", { className: "app-link-button normalCase inheritColor normalWeight certificates-dolozka-btn", onClick: dolozkaClick, "data-studentid": r.studentid, "data-kopia": r.kopia, "data-verbeval": "1" },
562                            React.createElement("div", { className: "certificates-restricted-width-span", dangerouslySetInnerHTML: { __html: et2(str) } }),
563                            React.createElement("i", { className: "fa fa-fw fa-pencil", style: { opacity: 0.5 } })));
564                    }
565                });
566            }
567            fields.push({
568                id: 'p_vysvedeniedolozka',
569                name: ls(4898),
570                cellClassName: 'nopadding valign-center',
571                renderer: function (val, r) {
572                    var m = Znamky.getObdobieVysvedcenia(md0 === null || md0 === void 0 ? void 0 : md0.obdobie);
573                    var str = Znamky.joinDolozkaItems(Znamky.getDolozkaItems(r.p_vysvedeniedolozka || "", md0 === null || md0 === void 0 ? void 0 : md0.dolozkyFields, m), true);
574                    if (EdubarUtils.getSelectedSchoolYear() < 2023) {
575                        if (m == "V1" && r['p_vysvedcenie_hodnotenie1']) {
576                            str += '; ' + Znamky.stripTags(r['p_vysvedcenie_hodnotenie1']);
577                        }
578                        if (m == "V2" && r['p_vysvedcenie_hodnotenie2']) {
579                            str += '; ' + Znamky.stripTags(r['p_vysvedcenie_hodnotenie2']);
580                        }
581                    }
582                    return (React.createElement("a", { className: "app-link-button 
582normalCase inheritColor normalWeight certificates-dolozka-btn", onClick: dolozkaClick, "data-studentid": r.studentid, "data-kopia": r.kopia },
583                        React.createElement("div", { className: "certificates-restricted-width-span", dangerouslySetInnerHTML: { __html: et2(str) } }),
584                        React.createElement("i", { className: "fa fa-fw fa-pencil", style: { opacity: 0.5 } })));
585                }
586            });
587            fields.push({
588                id: 'dateval',
589                name: ls(1251),
590                cellClassName: 'valign-center nopadding calign certificates-ajked-nema',
591                renderer: function (val, r) {
592                    var _a, _b, _c;
593                    var ref = val;
594                    var className = "app-link-button normalCase normalWeight inheritColor " + (((_a = r.modified) === null || _a === void 0 ? void 0 : _a.indexOf('date')) >= 0 ? 'certificates-modified-val' : '');
595                    if (((_b = r.modified) === null || _b === void 0 ? void 0 : _b.indexOf('date')) >= 0 && !val) {
596                        val = '-';
597                    }
598                    else if (!val) {
599                        val = r["date_computed"];
600                    }
601                    var title = '';
602                    if (!(((_c = r.modified) === null || _c === void 0 ? void 0 : _c.indexOf('date')) >= 0)) {
603                        ref = r.date_computed;
604                        if (val != ref) {
605                            className += ' certificates-not-equal';
606                            title += ls(13110) + ': ' + (ref ? Date.fromDbString(ref).format('d.m.Y') : '-');
607                            title += '\n\n' + ls(12612) + '!';
608                        }
609                    }
610                    return (val
611                        ? (React.createElement("a", { className: className, onClick: changeDateClick, "data-id": r.skid, title: title }, val == '-' || !val ? ls(13109) : Date.fromDbString(val).format('d.m.Y')))
612                        : '');
613                }
614            });
615        }
616        var sums = {};
617        for (var _9 = 0, rows_1 = rows; _9 < rows_1.length; _9++) {
618            var r = rows_1[_9];
619            if (!r.numberinclass) {
620                max_numberinclass++;
621                r.numberinclass = max_numberinclass;
622            }
623            for (var _10 = 0, _11 = ['excused', 'unexcused', 'prax_excused', 'prax_unexcused', 'teoria_excused', 'teoria_unexcused']; _10 < _11.length; _10++) {
624                var f_1 = _11[_10];
625                if (!r[f_1] && r[f_1] !== 0)
626                    continue;
627                if (!Znamky.isNumeric(r[f_1]))
628                    continue;
629                if (!sums[f_1])
630                    sums[f_1] = 0;
631                sums[f_1] += parseFloat(r[f_1]);
632            }
633            for (var _12 = 0, subjCols_1 = subjCols; _12 < subjCols_1.length; _12++) {
634                var f_2 = subjCols_1[_12];
635                var val_2 = r[f_2];
636                var z = (val_2 === null || val_2 === void 0 ? void 0 : val_2.z) || "";
637                var k = (val_2 === null || val_2 === void 0 ? void 0 : val_2.k) || "";
638                var v0 = (val_2 === null || val_2 === void 0 ? void 0 : val_2.v) || "";
639                var v = v0 || k || z;
640                if (!v && v !== 0)
641                    continue;
642                if (!Znamky.isNumeric(v)) {
643                    v = Znamky.getValueZnamky(v);
644                }
645                if (!Znamky.isNumeric(v))
646                    continue;
647                if (!sums[f_2 + "_sum"])
648                    sums[f_2 + "_sum"] = 0;
649                sums[f_2 + "_sum"] += v * 1;
650                if (!sums[f_2 + "_cnt"])
651                    sums[f_2 + "_cnt"] = 0;
652                sums[f_2 + "_cnt"]++;
653            }
654            if (r['average']) {
655                if (!sums["average_sum"])
656                    sums["average_sum"] = 0;
657                sums["average_sum"] += parseFloat(r['average']);
658                if (!sums["average_cnt"])
659                    sums["average_cnt"] = 0;
660                sums["average_cnt"]++;
661            }
662        }
663        for (var _13 = 0, subjCols_2 = subjCols; _13 < subjCols_2.length; _13++) {
664            var f_3 = subjCols_2[_13];
665            sums[f_3] = sums[f_3 + "_cnt"] ? (sums[f_3 + "_sum"] / sums[f_3 + "_cnt"]).toFixed(2) : '0.0';
666        }
667        for (var _14 = 0, _15 = ['excused', 'unexcused', 'prax_excused', 'prax_unexcused', 'teoria_excused', 'teoria_unexcused']; _14 < _15.length; _14++) {
668            var f_4 = _15[_14];
669            sums[f_4] = (sums[f_4] || 0).toFixed(1).replace('.0', '');
670        }
671        sums['average'] = sums["average_cnt"] ? (sums["average_sum"] / sums["average_cnt"]).toFixed(2) : '0.0';
672        var obdobia = classificationutils_1.ClassificationUtils.fillTermsStartEndDates((md0 === null || md0 === void 0 ? void 0 : md0.obdobia) || [], dbi, { skids: mamSkids });
673        var o = obdobia.find(function (r) { return r.id == filterData.obdobie; });
674        return {
675            rows: rows,
676            showOdbor: showOdbor,
677            mamOdbory: mamOdbory,
678            filterOdborid: filterOdborid,
679            sums: sums,
680            fields: fields,
681            usporiadaneTriedy: Znamky.sortTriedy((md0 === null || md0 === void 0 ? void 0 : md0.triedy) || {}),
682            obdobia: obdobia,
683            rowsById: rowsById,
684            hasClassSubjects: ((_t = (_s = dbi === null || dbi === void 0 ? void 0 : dbi.rowData('classes', filterData.triedaid)) === null || _s === void 0 ? void 0 : _s.subjects) === null || _t === void 0 ? void 0 : _t.length) ? true : false,
685            hasGrades: numGrades > 0,
686            numGrades: numGrades,
687            needPublishgrades: numGradesNotPublished > 0,
688            needGenerate: numNevygenerovane > 0,
689            needNewPdf: numStarePdf > 0,
690            needPublish: numNotPublished > 0,
691            numPdfs: numPdfs,
692            jeMs: jeMs,
693            schoolYear_dates: (md0 === null || md0 === void 0 ? void 0 : md0.schoolYear_dates) || {},
694            half: half,
695            examType: examType,
696            useKenyaExamReporting: (md0 === null || md0 === void 0 ? void 0 : md0.useKenyaExamReporting) || false,
697            grade: (_v = (_u = dbi.rowData('classes', filterData.triedaid)) === null || _u === void 0 ? void 0 : _u.grade) !== null && _v !== void 0 ? _v : "",
698            dochadzkaInfo: o ? {
699                datefrom: o.od_str,
700                dateto: o.do_str
701            } : null,
702        };
703    }, [md0, dbi, filterData.odborid]);
704    var mdRef = React.useRef(md);
705    mdRef.current = md;
706    function filterValueChange(vals) {
707        var nd = $.extend({}, filterData, vals);
708        if (vals["triedaid"] != filterData["triedaid"]) {
709            nd["odborid"] = '';
710        }
711        setFilterData(nd);
712        if (props.onCourseChange) {
713            props.onCourseChange({ triedaid: nd.triedaid, obdobie: nd.obdobie });
714        }
715    }
716    function getContextActions(checkedItems, clearSelectedFunc) {
717        var _a, _b, _c, _d;
718        var ret = [];
719        var checkedids = Object.keys(checkedItems);
720        var numToGenerateVypis = 0;
721        var toPublish = [];
722        var toUnpublish = [];
723        var toPublishGrades = [];
724        var toUnpublishGrades = [];
725        var toRemoveVypis = [];
726        var toPrintCloudids = [];
727        var allRows = [];
728        for (var _i = 0, checkedids_1 = checkedids; _i < checkedids_1.length; _i++) {
729            var id = checkedids_1[_i];
730            var r = (_a = md === null || md === void 0 ? void 0 : md.rowsById) === null || _a === void 0 ? void 0 : _a[id];
731            if (!r)
732                continue;
733            if ((_b = r.znamkydocs) === null || _b === void 0 ? void 0 : _b.length) {
734                for (var _e = 0, _f = r.znamkydocs; _e < _f.length; _e++) {
735                    var d = _f[_e];
736                    if (d.student_visibility == 'visible') {
737                        toUnpublish.push(d);
738                    }
739                    else {
740                        toPublish.push(d);
741                    }
742                    toRemoveVypis.push(d);
743                    if ((_c = d === null || d === void 0 ? void 0 : d.data) === null || _c === void 0 ? void 0 : _c.attachments) {
744                        for (var _g = 0, _h = (_d = d === null || d === void 0 ? void 0 : d.data) === null || _d === void 0 ? void 0 : _d.attachments; _g < _h.length; _g++) {
745                            var a = _h[_g];
746                            if (a.cloudid) {
747                                toPrintCloudids.push(a.cloudid);
748                            }
749                        }
750                    }
751                }
752            }
753            if (r.gradesVisibility) {
754                toUnpublishGrades.push(r.skid);
755            }
756            else {
757                toPublishGrades.push(r.skid);
758            }
759            allRows.push(r);
760            numToGenerateVypis++;
761        }
762        if (toPublish.length || toPublishGrades.length) {
763            ret.push({
764                icon: 'fa-globe',
765                title: ls(3817).naDvaRiadky("\n"),
766                onClick: function () {
767                    publishItemsDialog(checkedids, 'publish');
768                }
769            });
770        }
771        if (toUnpublish.length || toUnpublishGrades.length) {
772            ret.push({
773                icon: 'fa-eye-slash',
774                title: ls(3988),
775                onClick: function () {
776                    publishItemsDialog(checkedids, 'unpublish');
777                }
778            });
779        }
780        if (toPrintCloudids.length > 0) {
781            ret.push({
782                icon: 'fa-print',
783                title: ls(1638) + (toPrintCloudids.length != checkedids.length ? ' (' + toPrintCloudids.length + ')' : ''),
784                onClick: function () {
785                    printAllPdf0(checkedItems);
786                }
787            });
788            ret.push({
789                icon: 'fa-file-zip-o',
790                inMoreActions: true,
791                title: ls(1701) + ': ZIP ' + (toPrintCloudids.length != checkedids.length ? ' (' + toPrintCloudids.length + ')' : ''),
792                onClick: function () {
793                    printAllPdf0(checkedItems, 'zip');
794                }
795            });
796        }
797        if (numToGenerateVypis > 0) {
798            ret.push({
799                icon: 'fa-file-pdf-o',
800                title: ls(12586).naDvaRiadky("\n") + (numToGenerateVypis != checkedids.length ? ' (' + numToGenerateVypis + ')' : ''),
801                onClick: function () {
802                    printReport(checkedids);
803                }
804            });
805        }
806        if (toRemoveVypis.length) {
807            ret.push({
808                icon: 'fa-trash',
809                title: ls(12615).naDvaRiadky("\n") + (toRemoveVypis.length != checkedids.length ? ' (' + toRemoveVypis.length + ')' : ''),
810                onClick: function () {
811                    barShowMessageBox(ls(7544), 'fa-warning', {
812                        confirm: function () {
813                            AscHttp_1.AscHttp.post('/znamky/?what=ZnamkyDocsEditor&akcia=removeDoc', { docid: toRemoveVypis.map(function (d) { return d.docid; }).join(';') }, function (data) {
814                                barShowMessage(ls(10414));
815                                reload();
816                            }, 'json');
817                        }
818                    });
819                }
820            });
821        }
822        if (!(md === null || md === void 0 ? void 0 : md.examType)) {
823            ret.push({
824                icon: 'fa-edit',
825                title: ls(12590).naDvaRiadky("\n"),
826                onClick: function () {
827                    showMultiEdit(allRows, { date: true });
828                }
829            });
830        }
831        if (!md.jeMs && !(md === null || md === void 0 ? void 0 : md.examType)) {
832            if (Znamky.certificatesUseComputation()) {
833                ret.push({
834                    icon: 'fa-edit',
835                    title: ls(12616),
836                    inMoreActions: true,
837                    onClick: function () {
838                        showMultiEdit(allRows, { valueid: true });
839                    }
840                });
841            }
842        }
843        if (Znamky.certificatesUseComputation()) {
844            ret.push({
845                icon: 'fa-calculator',
846                title: ls(12585),
847                inMoreActions: true,
848                onClick: function () {
849                    dogenerateCertificates(checkedids);
850                }
851            });
852        }
853        if (!md.jeMs && !(md === null || md === void 0 ? void 0 : md.examType)) {
854            ret.push({
855                icon: 'fa-window-close-o',
856                title: ls(13108),
857                inMoreActions: true,
858                onClick: function () {
859                    showMultiEdit(allRows, { date: true }, {
860                        forceDateValue: '!',
861                        dateOnly: true
862                    });
863                }
864            });
865        }
866        return ret;
867    }
868    function changeDateClick(e) {
869        var id = $(e.currentTarget).attr('data-id');
870        var r = md === null || md === void 0 ? void 0 : md.rowsById[id];
871        if (!r)
872            return;
873        showMultiEdit([r], { date: true });
874    }
875    function changeProspechClick(e) {
876        var id = $(e.currentTarget).attr('data-id');
877        var r = md === null || md === void 0 ? void 0 : md.rowsById[id];
878        if (!r)
879            return;
880        showMultiEdit([r], { valueid: true });
881    }
882    function showMultiEdit(rows, selectedFields, options) {
883        if (!options)
884            options = {};
885        certShowMultiEdit(rows, md.half, selectedFields, tslib_1.__assign(tslib_1.__assign({}, options), { schoolYear_dates: md.schoolYear_dates, jeMs: md.jeMs, prospech_znamky: md0 === null || md0 === void 0 ? void 0 : md0.prospech_znamky, prospech_typid: md0 === null || md0 === void 0 ? void 0 : md0.prospech_typid, reload: reload }));
886    }
887    function itemClick(id) {
888        barNewReactSourceDlg('/znamky/pics/jsw/certificatesstudent.js', 'CertificatesStudentDlg', {
889            skid: id,
890            year: selectedYear
891        });
892    }
893    function publishItemsDialog(checkedids, defaultValue) {
894        barNewReactDlg(React.createElement(certificatespublish_1.CertificatesPublishDialog, { obdobie: md0 === null || md0 === void 0 ? void 0 : md0.obdobie, examType: md0 === null || md0 === void 0 ? void 0 : md0.examType, defaultValue: defaultValue || "", skids: checkedids, triedaid: md0.triedaid, returnFunc: function () { return reload(); }, znamkydocs: md0 === null || md0 === void 0 ? void 0 : md0.znamkydocs, admin_zobrazovat_znamky: md0 === null || md0 === void 0 ? void 0 : md0.admin_zobrazovat_znamky, gradesVisibility: md0 === null || md0 === void 0 ? void 0 : md0.gradesVisibility, jeMs: md.jeMs }), {});
895    }
896    function dolozkaClick(e) {
897        var studentid = $(e.currentTarget).attr('data-studentid');
898        var kopia = $(e.currentTarget).attr('data-kopia');
899        var subjectid = $(e.currentTarget).attr('data-subjectid');
900        var showVerbEval = $(e.currentTarget).attr('data-verbeval') == '1';
901        if (md0.dolozkaVerbeval) {
902            var wasSaved = false;
903            barNewReactSourceDlg('/znamky/pics/jsw/verbalevaluation.js', 'VerbalEvaluationMain', {
904                triedaid: md0.triedaid,
905                predmetid: "vsetky",
906                planid: "",
907                obdobie: Znamky.getNadobdobie(md0.obdobie),
908                asDialog: true,
909                filterPredmetid: showVerbEval ? (subjectid || '') : 'dolozka',
910                forceShowStudentid: studentid ? studentid + ':' + kopia : "",
911                wasSavedFunc: function () {
912                    wasSaved = true;
913                }
914            }, {
915                dialogClass: 'whiteDialog noPadding verbeval-fullscreenDlg autoCenteredDialog',
916                width: $(window).width() - 24,
917                height: $(window).height() - 24,
918                returnFunc: function () {
919                    reload();
920                },
921                close: function () {
922                    if (wasSaved) {
923                        reload();
924                    }
925                }
926            });
927        }
928        else {
929            barNewDialog({
930                'source': '/znamky/?what=VysvedcenieDolozka&studentids=' + studentid + '%2F' + kopia + '&obdobie=' + (md0 === null || md0 === void 0 ? void 0 : md0.obdobie),
931                'returnFunc': function () {
932                    reload();
933                }
934            });
935        }
936    }
937    function createDocClick(e) {
938        printReport([$(e.currentTarget).attr('data-skid')]);
939    }
940    function printReport(skids) {
941        barNewDialog({
942            source: '/reports/?cmd=SelectReport',
943            postData: {
944                module: 'certificates',
945                reportData: JSON.stringify({
946                    examType: md === null || md === void 0 ? void 0 : md.examType,
947                    selection: {
948                        cert_term: (md0 === null || md0 === void 0 ? void 0 : md0.obdobie) || "",
949                        studentkopiaids: skids,
950                        classids: [md0 === null || md0 === void 0 ? void 0 : md0.triedaid],
951                        gradeids: [md === null || md === void 0 ? void 0 : md.grade],
952                        examName: (md === null || md === void 0 ? void 0 : md.examType) == 'oe'
953                            ? 'Opening Exam'
954                            : (md === null || md === void 0 ? void 0 : md.examType) == 'me'
955                                ? 'Mid-Term Exam'
956                                : "End of Term Exam"
957                    }
958                })
959            },
960            dialogData: {
961                confirmSelectReportFunc: function (reportid, r, continueFunc, reportParams) {
962                    barNewReactDlg(React.createElement(certificatesbeforegenerate_1.CertificatesBeforeGenerate, { skids: skids, reportid: reportid, obdobie: (filterData === null || filterData === void 0 ? void 0 : filterData.obdobie) || "", continueFunc: continueFunc, reportParams: reportParams }), {});
963                }
964            },
965            returnFunc: function () {
966                reload();
967            }
968        });
969    }
970    function showDocClick(e) {
971        var $elem = $(e.currentTarget);
972        var studentid = $elem.attr('data-skid');
973        var type = $elem.attr('data-type');
974        var term = $elem.attr('data-term');
975        barNewReactSourceDlg('/znamky/pics/jsw/ZnamkyDocsEditor.js', 'ZnamkyDocsEditor', {
976            studentid: studentid,
977            type: type,
978            term: term,
979            subtype: $elem.attr('data-subtype') || "",
980            returnFunc: function () {
981                reload();
982            }
983        });
984    }
985    function publishGradesClick(e) {
986        publishItemsDialog([$(e.currentTarget).attr('data-skid')], 'nochange');
987    }
988    function publishAllGradesClick(e) {
989        var _a;
990        var checkedids = selectedItemsRef.current;
991        var type = $(e.currentTarget).attr('data-type');
992        if (!checkedids || checkedids.length == 0) {
993            checkedids = (_a = md.rows) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.skid; });
994        }
995        publishItemsDialog(checkedids, type == 'docs' ? (md.needPublish ? 'publish' : 'nochange') : (md.needPublishgrades ? 'publish' : 'nochange'));
996    }
997    function generateClick(e) {
998        var _a;
999        dogenerateCertificates(((_a = selectedItemsRef.current) === null || _a === void 0 ? void 0 : _a.length) ? selectedItemsRef.current : null);
1000    }
1001    function dogenerateCertificates(skids) {
1002        var _a, _b;
1003        if (EdubarUtils.isAdmin() || dbi.req.hasRight('agenda') || dbi.req.hasRight('certificates') || ((_b = (_a = dbi.rowData('global_settings', '1')) === null || _a === void 0 ? void 0 : _a.agenda) === null || _b === void 0 ? void 0 : _b.ct_certificates_generate)) {
1004            barNewReactDlg(React.createElement(VysvedcenieGenerateDialog, { classids: [md0 === null || md0 === void 0 ? void 0 : md0.triedaid], skids: skids, returnFunc: function () { reload(); }, half: (md0 === null || md0 === void 0 ? void 0 : md0.half) || 1, obdobia: md.obdobia }));
1005        }
1006        else {
1007            var s = ls(12139);
1008            s += '<br><br><a href="https://help.edupage.org/?p=u1/u196/e2534" target="_blank">' + lset(1553) + '</a>';
1009            barShowMessageBox(s);
1010        }
1011    }
1012    function setupSubjectsClick() {
1013        $.post((md0 === null || md0 === void 0 ? void 0 : md0.formurl) + '&akcia=setupSubjectsDlg', {}, function () {
1014        }, 'script');
1015    }
1016    function generateAllPdf() {
1017        var _a, _b;
1018        if (!((_a = selectedItemsRef.current) === null || _a === void 0 ? void 0 : _a.length)) {
1019            var skids = ((_b = md === null || md === void 0 ? void 0 : md.rows) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.skid; })) || [];
1020            if (skids.length === 0) {
1021                barShowMessage(ls(1419));
1022                return;
1023            }
1024            printReport(skids);
1025        }
1026        else {
1027            printReport(selectedItemsRef.current);
1028        }
1029    }
1030    function printAllPdf() {
1031        printAllPdf0();
1032    }
1033    function printAllPdf0(checkedItems, zip) {
1034        printAllPdf1(checkedItems, zip);
1035    }
1036    function printAllPdf1(checkedItems, zip) {
1037        var _a, _b, _c;
1038        var toPrintCloudids = [];
1039        var toPrintSkids = {};
1040        var docTypes = {};
1041        var numTotal = 0;
1042        for (var _i = 0, _d = md === null || md === void 0 ? void 0 : md.rows; _i < _d.length; _i++) {
1043            var r = _d[_i];
1044            if (checkedItems && !checkedItems[r.skid])
1045                continue;
1046            numTotal++;
1047            if ((_a = r.znamkydocs) === null || _a === void 0 ? void 0 : _a.length) {
1048                for (var _e = 0, _f = r.znamkydocs; _e < _f.length; _e++) {
1049                    var d = _f[_e];
1050                    if ((_b = d === null || d === void 0 ? void 0 : d.data) === null || _b === void 0 ? void 0 : _b.attachments) {
1051                        for (var _g = 0, _h = (_c = d === null || d === void 0 ? void 0 : d.data) === null || _c === void 0 ? void 0 : _c.attachments; _g < _h.length; _g++) {
1052                            var a = _h[_g];
1053                            if (a.cloudid) {
1054                                toPrintCloudids.push({ cloudid: a.cloudid, skid: r.skid, type: d.type });
1055                                toPrintSkids[r.skid] = true;
1056                                if (!docTypes[d.type]) {
1057                                    docTypes[d.type] = {
1058                                        cloudids: [],
1059                                        skids: {},
1060                                        name: d.typeName
1061                                    };
1062                                }
1063                                docTypes[d.type].cloudids.push({ cloudid: a.cloudid, skid: r.skid, type: d.type });
1064                                docTypes[d.type].skids[r.skid] = true;
1065                            }
1066                        }
1067                    }
1068                }
1069            }
1070        }
1071        if (toPrintCloudids.length == 0) {
1072            barShowMessage(ls(12592));
1073            return;
1074        }
1075        var s = ls(12593) + '<br><br>';
1076        if (Object.keys(toPrintSkids).length < numTotal) {
1077            s += ls(12594) + '<br><br>';
1078        }
1079        s += ls(6360);
1080        if (toPrintCloudids.length > 1) {
1081            s += '<label class="egov-block-label-check" style="margin:12px 0" >';
1082            s += '<input type="checkbox" name="pagePadEven" value="1" class="pagePadEvenCheck" ' + et(sessionStorage.getItem('certificatesPagePadEven') ? 'checked' : '') + '> ';
1083            s += lset(12327);
1084            s += '</label>';
1085        }
1086        var buttons = null;
1087        if (Object.keys(docTypes).length > 1) {
1088            buttons = [
1089                { label: ls(12683) + ' (' + et(toPrintCloudids.length.toString()) + ')', cssClass: 'button-green etest-btn-fw-confirm', cloudids: toPrintCloudids }
1090            ];
1091            for (var type in docTypes) {
1092                var r = docTypes[type];
1093                buttons.push({ label: ls(12684) + ': ' + r.name + ' (' + et(r.cloudids.length.toString()) + ')', cssClass: 'button-green etest-btn-fw-confirm', cloudids: r.cloudids });
1094            }
1095            buttons.push({
1096                label: ls(1038),
1097                cssClass: 'button-gray etest-btn-fw-confirm',
1098                action: 'cancel'
1099            });
1100        }
1101        s = renderS(s, {
1102            numMissing: numTotal - Object.keys(toPrintSkids).length,
1103            numToPrint: Object.keys(toPrintSkids).length,
1104            numRowsLength: numTotal
1105        });
1106        var dlg = barShowMessageBox(zip ? ls(12998) : s, 'fa-question', {
1107            okLbl: ls(12595),
1108            buttons: buttons,
1109            buttonClick: function (ind) {
1110                var btn = buttons[ind];
1111                if (btn.cloudids) {
1112                    sessionStorage.setItem('certificatesPagePadEven', dlg.find('.pagePadEvenCheck').is(':checked') ? '1' : '0');
1113                    barNewDialog({
1114                        source: '/reports/?cmd=MergePdfs',
1115                        postData: zip
1116                            ? {
1117                                items: JSON.stringify(btn.cloudids),
1118                                zip: 'certs'
1119                            }
1120                            : {
1121                                cloudids: btn.cloudids.map(function (a) { return a.cloudid; }).join(';'),
1122                                watermark: '',
1123                                pagePadEven: dlg.find('.pagePadEvenCheck').is(':checked') ? '1' : ''
1124                            },
1125                        title: zip ? ls(6226) : ls(11580) + '...',
1126                        width: 400
1127                    });
1128                }
1129            },
1130            confirm: function () {
1131                sessionStorage.setItem('certificatesPagePadEven', dlg.find('.pagePadEvenCheck').is(':checked') ? '1' : '0');
1132                barNewDialog({
1133                    source: '/reports/?cmd=MergePdfs',
1134                    postData: zip
1135                        ? {
1136                            items: JSON.stringify(toPrintCloudids),
1137                            zip: 'certs'
1138                        }
1139                        : {
1140                            cloudids: toPrintCloudids.map(function (a) { return a.cloudid; }).join(';'),
1141                            watermark: '',
1142                            pagePadEven: dlg.find('.pagePadEvenCheck').is(':checked') ? '1' : ''
1143                        },
1144                    title: zip ? ls(6226) : ls(11580) + '...',
1145                    width: 400
1146                });
1147            }
1148        });
1149    }
1150    function publishAllPdf() {
1151        var _a;
1152        var toPublish = [];
1153        var toUnpublish = [];
1154        for (var _i = 0, _b = md === null || md === void 0 ? void 0 : md.rows; _i < _b.length; _i++) {
1155            var r = _b[_i];
1156            if ((_a = r.znamkydocs) === null || _a === void 0 ? void 0 : _a.length) {
1157                for (var _c = 0, _d = r.znamkydocs; _c < _d.length; _c++) {
1158                    var d = _d[_c];
1159                    if (d.student_visibility == 'visible') {
1160                        toUnpublish.push(d);
1161                    }
1162                    else {
1163                        toPublish.push(d);
1164                    }
1165                }
1166            }
1167        }
1168        if (toPublish.length == 0) {
1169            barShowMessage(toUnpublish.length > 0 ? ls(12596) : ls(12597));
1170            return;
1171        }
1172        barShowMessageBox(ls(12588) + ' (' + toPublish.length + ')', 'fa-warning', {
1173            confirm: function () {
1174                AscHttp_1.AscHttp.post('/znamky/?what=ZnamkyDocsEditor&akcia=publishDocids', { docids: toPublish.map(function (d) { return d.docid; }).join(';'), visibility: 'visible' }, function (data) {
1175                    barShowMessage(ls(10428));
1176                    reload();
1177                }, 'json');
1178            }
1179        });
1180    }
1181    function close() {
1182        barCloseDialog($(mainElemRef.current));
1183    }
1184    function smartLinkClick(e) {
1185        e.preventDefault();
1186        barSmartLoadPage($(e.currentTarget).attr('href'));
1187    }
1188    function getRowClassName(r) {
1189        return r.maVysvedcenie === false ? ' certificates-nema-vysvedcenie' : '';
1190    }
1191    return (React.createElement("div", { ref: mainElemRef },
1192        React.createElement(ViewLoadingContainer_1.OnlineDataStatusContainer, { data: data, dbi: dbi },
1193            false && props.embedded && (React.createElement("div", { className: "poznamky-toolbar certificates-lsticky-bar-outer ", style: { gap: '25px', justifyContent: 'flex-start', paddingLeft: '8px' } },
1194                React.createElement("div", { className: "certificates-lsticky-bar" }))),
1195            !props.embedded && (React.createElement("div", { className: "egov-hero infg " + (props.mod == 'docs' ? 'dark' : 'light') },
1196                React.createElement("div", { className: "egov-hero-inner certificates-hero-padding certificates-lsticky-bar" },
1197                    React.createElement("div", { className: "" },
1198                        React.createElement("h1", { style: { margin: 0 } }, (_a = md === null || md === void 0 ? void 0 : md.usporiadaneTriedy.find(function (r) { return r.TriedaID == props.triedaid; })) === null || _a === void 0 ? void 0 : _a.Meno),
1199                        React.createElement("div", { className: "egov-hero-subtitle" }, ls(12601)))))),
1200            React.createElement(egovfilterbar_1.EGovFilterBar, { onChange: filterValueChange, filterData: filterData, className: "light poznamky-filter-bar certificates-lsticky-bar " + (props.mod == 'docs' ? 'dark' : ''), items: [
1201                    {
1202                        id: 'triedaid',
1203                        title: ls(1263),
1204                        values: (props.embedded ? [] : [{ id: '', name: '--- ' + ls(12123) + ' ---' }]).concat(md === null || md === void 0 ? void 0 : md.usporiadaneTriedy.map(function (r) { return { id: r.TriedaID, name: r["Meno"] }; }))
1205                    },
1206                    md.showOdbor ? {
1207                        id: 'odborid',
1208                        title: ls(6297),
1209                        values: [{ id: '', name: '--- ' + ls(4276) + ' ---' }].concat(dbi.tableData('odbors').filter(function (o) { return !!md.mamOdbory[o.id]; }).map(function (r) { return { id: r.id, name: r.code + ' ' + r.name }; }))
1210                    } : null,
1211                    {
1212                        id: 'obdobie',
1213                        title: ls(3515),
1214                        values: (_b = md === null || md === void 0 ? void 0 : md.obdobia) === null || _b === void 0 ? void 0 : _b.map(function (r) {
1215                            return {
1216                                id: r.id,
1217                                name: r.nazov + ' (' + r.od_str + ' - ' + r.do_str + ') ',
1218                                group: r.group
1219                            };
1220                        })
1221                    }
1222                ].filter(function (r) { return r !== null; }), reloadFunc: reload, tableid: "skdstudents", lContent: props.embedded ? (React.createElement("a", { className: "app-link-button inheritColor normalCase normalWeight", onClick: close, style: { padding: '12px', flex: 'auto 0 0' } },
1223                    React.createElement("i", { className: "fa fa-fw fa-arrow-left", style: { fontSize: '18px' } }))) : null, rContent: (React.createElement(React.Fragment, null,
1224                    React.createElement("div", { className: "egov-filter-field egov-filter-btns", style: { display: 'flex', flexFlow: 'row nowrap' } },
1225                        React.createElement("a", { className: "egov-filter-btn egov-filter-btn-flex", onClick: smartLinkClick, href: barEncLink("/znamky/?what=zobraztriedu&m=" + Znamky.getObdobieVysvedcenia(filterData === null || filterData === void 0 ? void 0 : filterData.obdobie) + "&t=" + (filterData === null || filterData === void 0 ? void 0 : filterData.triedaid) + "&p=vsetky"), style: { flex: 'auto 0 0' } },
1226                            React.createElement("i", { className: "fa fa-fw fa-edit", style: { opacity: 0.5 } }),
1227                            React.createElement("span", null, ls(1131))),
1228                        React.createElement("a", { className: "egov-filter-btn egov-filter-btn-flex", onClick: smartLinkClick, href: barEncLink("/znamky/?what=zobraztriedu&m=" + Znamky.getObdobieVysvedcenia(filterData === null || filterData === void 0 ? void 0 : filterData.obdobie) + "&t=" + (filterData === null || filterData === void 0 ? void 0 : filterData.triedaid) + "&p=1"), style: { flex: 'auto 0 0' } },
1229                            React.createElement("i", { className: "fa fa-fw fa-edit", style: { opacity: 0.5 } }),
1230                            React.createElement("span", null, ls(2899)))),
1231                    EdubarUtils.indexOf(['sk', 'cz'], EdubarUtils.getSchoolCountry()) < 0 ? null : (React.createElement("div", { style: { flex: 'auto 0 0', marginRight: '', alignSelf: 'center' } },
1232                        React.createElement(dropdown_1.EGovDropDown, { title: React.createElement("i", { className: 'fa fa-fw fa-wrench' }), className: "top-right", buttonClassName: 'flat-button  withShadow flat-button-blue', showIcons: true, items: [
1233                                {
1234                                    id: 'znamkykomis',
1235                                    icon: '/app/pics/icons/sidemenu/grades.svg',
1236                                    name: ls(13211),
1237                                    onClick: function () {
1238                                        var _a;
1239                                        barNewReactSourceDlg('/skd/pics/jsw/znamkycreatekomisionalne.js', 'ZnamkyCreateKomisionalneDlg', {
1240                                            half: (_a = filterData.obdobie) === null || _a === void 0 ? void 0 : _a.replace(/[^0-9]/g, ''),
1241                                            classid: filterData.triedaid
1242                                        });
1243                                    }
1244                                }
1245                            ] }))))) }),
1246            React.createElement("div", null,
1247                React.createElement("div", { className: "certificates-flex-content " + (props.embedded ? 'embeddedfs' : '') },
1248                    React.createElement("div", { className: "egov-table-outer" },
1249                        React.createElement("div", { style: { minHeight: 'calc(100vh - 270px)' } },
1250                            React.createElement(table_1.EGovTable, { key: filterData.triedaid, id: 'certificates', className: "certificates-table-whitebg ", rowNumberField: "numberinclass", idfield: 'skid', filterData: filterData, getContextActionsFunc: getContextActions, stickyHeader: props.embedded ? "top0" : "underToolbar", stickyLeftCells: props.embedded ? "to0" : "tosidebar", getRowClassName: getRowClassName, defaultSortBy: 'name', defaultSortDir: 'asc', usePagination: false, groupBy: null, fields: md === null || md === void 0 ? void 0 : md.fields, itemClick: itemClick, rows: md === null || md === void 0 ? void 0 : md.rows, selectedItemsChange: function (val) { return selectedItemsRef.current = val; }, customTFoot: React.createElement("tfoot", null,
1251                                    React.createElement("tr", { className: "footerRow" },
1252                                        React.createElement("td", null), (_c = md === null || md === void 0 ? void 0 : md.fields) === null || _c === void 0 ? void 0 :
1253                                        _c.map(function (r) {
1254                                            return (React.createElement("td", { className: "ralign " + (r.footerClassName || ""), key: r.id }, (md === null || md === void 0 ? void 0 : md.sums[r.id]) || (md === null || md === void 0 ? void 0 : md.sums[r.id]) === 0 ? md === null || md === void 0 ? void 0 : md.sums[r.id] : ''));
1255                                        }))), filterFunc: function (r, filterData) {
1256                                    return true;
1257                                } })),
1258                        (md === null || md === void 0 ? void 0 : md.dochadzk
1258aInfo) && (React.createElement("div", { className: 'egov-subtitle small', style: { marginTop: '32px', opacity: 0.3 } },
1259                            ls(2899),
1260                            ":",
1261                            React.createElement("ul", { className: 'circles' },
1262                                React.createElement("li", null,
1263                                    ls(4636),
1264                                    ": ", (_d = md === null || md === void 0 ? void 0 : md.dochadzkaInfo) === null || _d === void 0 ? void 0 :
1265                                    _d.datefrom),
1266                                React.createElement("li", null,
1267                                    ls(1886),
1268                                    ": ", (_e = md === null || md === void 0 ? void 0 : md.dochadzkaInfo) === null || _e === void 0 ? void 0 :
1269                                    _e.dateto))))),
1270                    React.createElement("div", { className: "certificates-postup sticky-t1" },
1271                        React.createElement("b", null,
1272                            ls(11410),
1273                            ":"),
1274                        md.jeMs
1275                            ? (React.createElement("ol", { className: "certificates-postup-list" },
1276                                Znamky.certificatesUseComputation() && (React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.needGenerate) ? 'not-done' : 'is-done' },
1277                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: generateClick }, ls(14328)))),
1278                                React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.needNewPdf) ? 'not-done' : 'is-done' },
1279                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: generateAllPdf }, ls(12621))),
1280                                React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.numPdfs) == 0 ? 'just-point gray' : (md === null || md === void 0 ? void 0 : md.needPublish) ? 'not-done' : 'is-done' },
1281                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: publishAllPdf }, ls(12622))),
1282                                React.createElement("li", { className: 'just-point ' + ((md === null || md === void 0 ? void 0 : md.numPdfs) == 0 ? 'gray' : '') },
1283                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: printAllPdf }, ls(12623)))))
1284                            : (React.createElement("ol", { className: "certificates-postup-list" },
1285                                React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.hasClassSubjects) ? 'is-done' : 'not-done' },
1286                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: setupSubjectsClick }, ls(12602))),
1287                                React.createElement("li", { className: !(md === null || md === void 0 ? void 0 : md.hasClassSubjects) ? 'just-point gray' : (md === null || md === void 0 ? void 0 : md.hasGrades) ? 'is-done' : 'not-done' },
1288                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", href: barEncLink("/znamky/?what=zobraztriedu&m=" + Znamky.getObdobieVysvedcenia(filterData === null || filterData === void 0 ? void 0 : filterData.obdobie) + "&t=" + (filterData === null || filterData === void 0 ? void 0 : filterData.triedaid) + "&p=vsetky") }, ls(12603))),
1289                                !(md === null || md === void 0 ? void 0 : md.examType) && (React.createElement("li", { className: !(md === null || md === void 0 ? void 0 : md.hasClassSubjects) ? 'just-point gray' : false ? 'is-done' : 'just-point gray' },
1290                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: dolozkaClick, "data-verbeval": "1" }, ls(13107)))),
1291                                Znamky.certificatesUseComputation() && (React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.needGenerate) ? 'not-d
1291one' : 'is-done' },
1292                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: generateClick }, ls(12604)))),
1293                                React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.needNewPdf) ? 'not-done' : 'is-done' },
1294                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: generateAllPdf }, ls(12605))),
1295                                !(md === null || md === void 0 ? void 0 : md.examType) && (React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.numGrades) == 0 ? 'just-point gray' : (md === null || md === void 0 ? void 0 : md.needPublishgrades) ? 'not-done' : 'is-done' },
1296                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: publishAllGradesClick, "data-type": "grades" }, ls(13023)))),
1297                                React.createElement("li", { className: (md === null || md === void 0 ? void 0 : md.numPdfs) == 0 ? 'just-point gray' : (md === null || md === void 0 ? void 0 : md.needPublish) ? 'not-done' : 'is-done' },
1298                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: publishAllGradesClick, "data-type": "docs" }, ls(12606))),
1299                                React.createElement("li", { className: 'just-point ' + ((md === null || md === void 0 ? void 0 : md.numPdfs) == 0 ? 'gray' : '') },
1300                                    React.createElement("a", { className: "app-link-button normalCase normalWeight", onClick: printAllPdf }, ls(12607)))))))),
1301            false && props.embedded && (React.createElement("div", { className: "barDialogActionButtons", style: { padding: '12px', position: 'sticky', bottom: '0', left: '0', background: '#eee', zIndex: 3, margin: 0 } },
1302                React.createElement("input", { type: "button", value: ls(1567), className: "button-gray", onClick: close }))))));
1303}
1304exports.CertifcatesList = CertifcatesList;
1305function ZnamkyDocsRenderer(props) {
1306    var _a, _b, _c, _d, _e, _f, _g;
1307    var r = props.row;
1308    var value = props.value;
1309    var docs = props.value || [];
1310    function getAttachementUrl(r, doc) {
1311        return barEncLink('/znamky/znamkydoc?jwgc=ZnamkyDocsFileViewerWidget&docid=' + ((doc === null || doc === void 0 ? void 0 : doc.docid) || (docs === null || docs === void 0 ? void 0 : docs[0].docid)) + '&z=' + encodeURIComponent(r.src));
1312    }
1313    function showDocClick(e) {
1314        var $elem = $(e.currentTarget);
1315        var studentid = $elem.attr('data-skid');
1316        var type = $elem.attr('data-type');
1317        var term = $elem.attr('data-term');
1318        var subtype = $elem.attr('data-subtype') || "";
1319        barNewReactSourceDlg('/znamky/pics/jsw/ZnamkyDocsEditor.js', 'ZnamkyDocsEditor', {
1320            studentid: studentid,
1321            type: type,
1322            term: term,
1323            subtype: subtype,
1324            returnFunc: function () {
1325                var _a;
1326                (_a = props.reload) === null || _a === void 0 ? void 0 : _a.call(props);
1327            }
1328        });
1329    }
1330    return (React.createElement("div", { className: 'certificates-zdocsrenderer' }, docs.length == 0
1331        ? (((_a = props.show) === null || _a === void 0 ? void 0 : _a.doc) && ((_b = props.show) === null || _b === void 0 ? void 0 : _b.add) !== false
1332            ? (React.createElement("a", { className: "app-link-button normalCase normalWeight inheritColor", "data-skid": r.skid, "data-term": props.term, onClick: props.createDocClick, "data-oid": props.oid || "", style: { color: "#FF7043" }, title: ls(12577) }, ((_c = props.show) === null || _c === void 0 ? void 0 : _c.seenStatus) === false || ((_d = props.show) === null || _d === void 0 ? void 0 : _d.fullText)
1333                ? ls(1783)
1334                : React.createElement("i", { className: "fa fa-fw fa-plus" })))
1335            : '')
1336        : (React.createElement(React.Fragment, null,
1337            docs.map(function (d) {
1338                var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1339                var title = '';
1340                var time_added = d.time_added ? Date.fromDbString(d.time_added, true).format(((_a = props.show) === null || _a === void 0 ? void 0 : _a.fullDate) ? 'd.m.Y H:i' : 'd.m.') : '';
1341                var time_published = d.time_published ? Date.fromDbString(d.time_published, true).format('d.m.') : '';
1342                var time_signed = d.seen_data && d.seen_data.parent_signed ? Date.fromDbString(d.seen_data && d.seen_data.parent_signed, true).format('d.m.') : '';
1343                if (((_b = props.show) === null || _b === void 0 ? void 0 : _b.seenStatus) === false) {
1344                    title += d.typeName;
1345                }
1346                else {
1347                    title += d.typeName + ' · ';
1348                    title += (d.student_visibility == 'visible'
1349                        ? ls(3279) + (': ' + Date.fromDbString(d.time_published, true).format('d.m.Y H:i:s'))
1350                        : ls(7190)) + "\n" + (d.seen_data && d.seen_data.parent_signed ? ls(10088) + ': ' + Date.fromDbString(d.seen_data && d.seen_data.parent_signed, true).format('d.m.Y H:i:s') : '');
1351                    if ((r.generated > d.time_added)) {
1352                        title += "\n" + ls(12624);
1353                        title += '\n' + ls(12625) + ': ' + d.time_added;
1354                        title += '\n' + ls(12626) + ': ' + r.generated;
1355                    }
1356                }
1357                var atts = ((_c = d === null || d === void 0 ? void 0 : d.data) === null || _c === void 0 ? void 0 : _c.attachments) || [];
1358                var skid = d.studentid + ':' + d.kopiaid;
1359                if (d.studentid.toString().startsWith('Trieda') || d.studentid.toString().startsWith('Skola')) {
1360                    skid = d.studentid;
1361                }
1362                return (React.createElement(React.Fragment, { key: d.docid },
1363                    ((_d = props.show) === null || _d === void 0 ? void 0 : _d.doc) && (React.createElement("a", { className: "app-link-button normalCase normalWeight " + (((_e = d.seen_data) === null || _e === void 0 ? void 0 : _e.parent_signed) ? 'smallVPadding' : '') + ' ' + ((false && r.generated > d.time_added) ? 'ofl-doc-notactual' : d.student_visibility == 'visible' ? 'ofl-doc-published' : 'ofl-doc-notpublished'), key: d.docid, "data-skid": skid, "data-docid": d.docid, onClick: props.showDocClick || showDocClick, "data-type": d.type, "data-term": d.term, "data-subtype": d.subtype, style: { whiteSpace: 'nowrap' }, title: title }, ((_f = props.show) === null || _f === void 0 ? void 0 : _f.seenStatus) === false
1364                        ? React.createElement("div", { className: "ofl-doc-btn-info" },
1365                            ((_g = props.show) === null || _g === void 0 ? void 0 : _g.subtype) ? d.subtype + ' (' + time_added + ')' : time_added,
1366                            " ")
1367                        : (React.createElement(React.Fragment, null,
1368                            ((_h = props.show) === null || _h === void 0 ? void 0 : _h.subtype) ? React.createElement("div", null, d.subtype) : null,
1369                            React.createElement("div", { className: "ofl-doc-btn-info " + (((_j = props.show) === null || _j === void 0 ? void 0 : _j.subtype) ? ' egov-subtitle small' : '') }, (d.student_visibility == 'visible')
1370                                ? React.createElement(React.Fragment, null,
1371                                    time_published,
1372                                    " ",
1373                                    React.createElement("i", { className: "fa fa-globe" }))
1374                                : React.createElement(React.Fragment, null,
1375                                    time_added,
1376                                    " ",
1377                                    React.createElement("i", { className: "fa fa-eye-slash" }))),
1378                            d.seen_data && d.seen_data.parent_signed && !((_k = props.show) === null || _k === void 0 ? void 0 : _k.subtype)
1379                                ? React.createElement("div", { className: "ofl-doc-btn-info" },
1380                                    time_signed,
1381                                    " ",
1382                                    React.createElement("i", { className: "fa fa-pencil" }))
1383                                : '')))),
1384                    ((_l = props.show) === null || _l === void 0 ? void 0 : _l.atts) && (React.createElement(React.Fragment, null, atts.map(function (a, ind) {
1385                        return (React.createElement("a", { className: "app-link-button normalCase normalWeight inheritColor", target: "_blank", style: { color: '#F44336', padding: '8px 4px' }, href: getAttachementUrl(a, d), title: d.typeName + ' - ' + ls(3644), key: ind },
1386                            React.createElement("i", { className: "fa fa-fw fa-file-pdf-o" })));
1387                    })))));
1388            }),
1389            ((_e = props.show) === null || _e === void 0 ? void 0 : _e.showRegenerate) && (React.createElement("a", { className: "app-link-button normalCase normalWeight", "data-skid": r.skid, "data-term": props.term, onClick: props.createDocClick, "data-oid": props.oid || "", title: ls(12577), style: ((_f = props.show) === null || _f === void 0 ? void 0 : _f.showRegenerate) == 'inline' ? null : { position: 'absolute', right: '0', top: '0' } },
1390                React.createElement("i", { className: "fa fa-fw " + (((_g = props.show) === null || _g === void 0 ? void 0 : _g.showRegenerate) == 'plus' ? 'fa-plus' : 'fa-refresh') })))))));
1391}
1392exports.ZnamkyDocsRenderer = ZnamkyDocsRenderer;
1393function VysvedcenieGenerateDialog(props) {
1394    var _this = this;
1395    var _a, _b;
1396    var mainElemRef = React.useRef(null);
1397    var _c = React.useState(false), forceOverwriteManualDochadzka = _c[0], setForceOverwriteManualDochadzka = _c[1];
1398    var _d = React.useState(false), forceRemoveManualDochadzka = _d[0], setForceRemoveManualDochadzka = _d[1];
1399    var _e = React.useState(''), status = _e[0], setStatus = _e[1];
1400    var _f = React.useState(null), problems = _f[0], setProblems = _f[1];
1401    var _g = React.useState([props.half]), checkedHalves = _g[0], setCheckedHalves = _g[1];
1402    var loadingXhrRef = React.useRef(null);
1403    var selectedYear = props.selectedYear || props["year"] || EdubarUtils.getSelectedSchoolYear();
1404    var mamManual = [];
1405    var dbi = (0, dbi_react_1.useMainDBI)(selectedYear, {
1406        needed_part: {
1407            studentkopias: ['firstname', 'lastname', '__name', 'classid', 'grade'],
1408            subjects: ["name", 'short', 'not_in_grades', 'sk_neratatdoprospechu'],
1409            teachers: ['firstname', 'lastname', '__name'],
1410            classes: ['name', '__name', 'grade', 'teacher2id', 'teacherid', 'subjects'],
1411            global_settings: ['agenda']
1412        }
1413    });
1414    var md = AppReactUtils_1.AppReactUtils.useAsyncMemo(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1415        return tslib_1.__generator(this, function (_a) {
1416            return [2, AscHttp_1.AscHttp.asyncRpc('/znamky/?what=Certificates', 'getManualDochadzka', { classids: props.classids, skids: props.skids, znamky_yearid: selectedYear, znamky_yearid_ns: '1' })];
1417        });
1418    }); }, [], null);
1419    React.useEffect(function () {
1420        $(mainElemRef.current).closest('.ui-dialog').toggleClass('grayTitleDialog noPadding autoCenteredDialog', true).toggleClass('whiteDialog', false);
1421        $(mainElemRef.current).closest('.ui-dialog-content').dialog('option', 'width', '500').dialog('option', 'title', ls(12585));
1422    }, []);
1423    function close() {
1424        if (loadingXhrRef.current)
1425            loadingXhrRef.current.abort();
1426        barCloseDialog($(mainElemRef.current));
1427    }
1428    function generateClick() {
1429        if (forceRemoveManualDochadzka && (mamManual === null || mamManual === void 0 ? void 0 : mamManual.length) > 0) {
1430            barShowMessageBox(ls(13404), 'fa-warning', {
1431                confirm: function () {
1432                    generateClick0();
1433                }
1434            });
1435        }
1436        else {
1437            generateClick0();
1438        }
1439    }
1440    function generateClick0() {
1441        var postData = {
1442            half: props.half,
1443            halves: checkedHalves,
1444            classids: props.classids,
1445            skids: props.skids || null,
1446            forceOverwriteManualDochadzka: forceOverwriteManualDochadzka,
1447            forceRemoveManualDochadzka: (mamManual === null || mamManual === void 0 ? void 0 : mamManual.length) > 0 ? forceRemoveManualDochadzka : false,
1448            znamky_yearid: selectedYear,
1449            znamky_yearid_ns: '1'
1450        };
1451        setStatus('loading');
1452        loadingXhrRef.current = AscHttp_1.AscHttp.rpc('/znamky/?what=Certificates', 'generate', postData, function (res) {
1453            var _a, _b, _c;
1454            loadingXhrRef.current = null;
1455            if (((_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.problems) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1456                setProblems(res.data.problems || []);
1457                setStatus('problems');
1458            }
1459            else {
1460                barShowMessage(ls(12627) + ' (' + et(res.data.count) + ')');
1461                close();
1462            }
1463            (_c = props.returnFunc) === null || _c === void 0 ? void 0 : _c.call(props);
1464        }, function (e) {
1465            loadingXhrRef.current = null;
1466            setStatus('');
1467            return false;
1468        });
1469    }
1470    function cancelClick() {
1471        barShowMessageBox(ls(12628), 'fa-question', {
1472            confirm: function () {
1473                close();
1474            }
1475        });
1476    }
1477    function halvesChange(e) {
1478        var v = [];
1479        $(mainElemRef.current).find('.halfCheck').each(function () {
1480            if (this.checked) {
1481                v.push(this.value);
1482            }
1483        });
1484        setCheckedHalves(v);
1485    }
1486    for (var _i = 0, checkedHalves_1 = checkedHalves; _i < checkedHalves_1.length; _i++) {
1487        var half = checkedHalves_1[_i];
1488        if (!(md === null || md === void 0 ? void 0 : md[half]))
1489            continue;
1490        for (var skid in md === null || md === void 0 ? void 0 : md[half]) {
1491            var sr = dbi.rowData('studentkopias', skid);
1492            if (!sr)
1493                continue;
1494            mamManual.push(dbi.rowName("studentkopias", skid));
1495        }
1496    }
1497    return (React.createElement("div", { ref: mainElemRef }, status == 'loading'
1498        ? (React.createElement("div", null,
1499            React.createElement("div", { className: "egov-sending-status flexrow" },
1500                React.createElement("div", null,
1501                    React.createElement("i", { className: "fa fa-spinner fa-spin statusIndicator" })),
1502                React.createElement("div", null,
1503                    React.createElement("div", { style: { margin: '0 0 24px 0' } },
1504                        ls(12629),
1505                        "..."),
1506                    React.createElement("div", null,
1507                        React.createElement("input", { type: "button", className: "button-gray", value: ls(1038), onClick: cancelClick }))))))
1508        : status == 'problems'
1509            ? (React.createElement("div", null,
1510                React.createElement("div", { style: { padding: '12px', overflow: 'auto', maxHeight: 'calc(100vh - 120px)' } },
1511                    React.createElement("b", null,
1512                        ls(12630),
1513                        ":"),
1514                    React.createElement("ul", { className: "circles", style: { marginTop: '12px' } }, problems === null || problems === void 0 ? void 0 : problems.map(function (r) {
1515                        return (React.createElement("li", { key: r.id },
1516                            React.createElement("b", null,
1517                                r.name,
1518                                " (",
1519                                r.classname,
1520                                ")"),
1521                            ":",
1522                            React.createElement("ul", { className: "circles" }, r.problems.map(function (p, ind) {
1523                                return (React.createElement("li", { key: ind },
1524                                    p.half,
1525                                    ". ",
1526                                    ls(2696),
1527                                    " - ",
1528                                    p.msg));
1529                            }))));
1530                    }))),
1531                React.createElement("div", { className: "barDialogActionButtons", style: { padding: '12px' } },
1532                    React.createElement("input", { type: "button", className: "button-green", value: ls(9180), onClick: close }))))
1533            : (React.createElement(React.Fragment, null,
1534                React.createElement("div", { style: { padding: '12px' } },
1535                    ls(12631),
1536                    React.createElement("ul", { className: "circles" },
1537                        React.createElement("li", null,
1538                            ls(9492),
1539                            ": ",
1540                            props.classids.length,
1541                            " \u00B7 ",
1542                            dbi.rowNames('classes', props.classids)),
1543                        ((_a = props.skids) === null || _a === void 0 ? void 0 : _a.length) && (React.createElement("li", null,
1544                            ls(6253),
1545                            ": ", (_b = props.skids) === null || _b === void 0 ? void 0 :
1546                            _b.length)))),
1547                React.createElement("div", { style: { padding: '12px' } },
1548                    ls(12632),
1549                    ":",
1550                    props.obdobia.map(function (r) {
1551                        return (React.createElement("div", { key: r.id, style: { margin: '3px 3px 3px 6px' } },
1552                            React.createElement("label", { className: "egov-block-label-check" },
1553                                React.createElement("input", { className: "halfCheck", type: "checkbox", value: r.half, name: "halves", checked: EdubarUtils.indexOf(checkedHalves, r.half) >= 0, onChange: halvesChange, disabled: props.half == r.half }),
1554                                r.nazov)));
1555                    })),
1556                edurequest_1.client_req.isAgenda()
1557                    ? (React.createElement("div", { style: { padding: '12px' } },
1558                        React.createElement("label", { className: "egov-block-label-check" },
1559                            React.createElement("input", { type: "checkbox", name: "forceOverwriteManualDocha
1559dzka", value: "1", checked: forceOverwriteManualDochadzka, onChange: function (e) { return setForceOverwriteManualDochadzka(e.currentTarget.checked); } }),
1560                            ls(12141))))
1561                    : '',
1562                !edurequest_1.client_req.isAgenda() && (mamManual === null || mamManual === void 0 ? void 0 : mamManual.length) > 0
1563                    ? (React.createElement("div", { style: { padding: '12px' } },
1564                        React.createElement("label", { className: "egov-block-label-check" },
1565                            React.createElement("input", { type: "checkbox", name: "forceRemoveManualDochadzka", value: "1", checked: forceRemoveManualDochadzka, onChange: function (e) { return setForceRemoveManualDochadzka(e.currentTarget.checked); } }),
1566                            ls(13403),
1567                            React.createElement("div", { className: 'egov-subtitle' }, mamManual.length <= 5
1568                                ? '(' + mamManual.join(', ') + ')'
1569                                : '(' + ls(1264) + ': ' + mamManual.length + ')'))))
1570                    : null,
1571                React.createElement("div", { className: "barDialogActionButtons", style: { padding: '12px' } },
1572                    React.createElement("input", { type: "button", className: "button-green", value: ls(12574).ucfirst(), onClick: generateClick }),
1573                    React.createElement("input", { type: "button", className: "button-gray", value: ls(1038), onClick: close }))))));
1574}
1575exports.VysvedcenieGenerateDialog = VysvedcenieGenerateDialog;
1576function DateWithTypeEditor(props) {
1577    var mainElemRef = React.useRef(null);
1578    var f = props.field;
1579    var formData = props.formData;
1580    var formDataRef = React.useRef(null);
1581    formDataRef.current = formData;
1582    function fieldChange(e) {
1583        var nf = $.extend({}, formDataRef.current);
1584        nf[e.currentTarget.name] = e.currentTarget.value;
1585        props.onChange(nf);
1586    }
1587    return (React.createElement("div", { ref: mainElemRef },
1588        React.createElement("select", { name: f.id + '_type', value: formData[f.id + '_type'] ? formData[f.id + "_type"] : "", onChange: fieldChange, className: "egov-formField", disabled: !!props.readonly || !!props.disabled },
1589            React.createElement("option", { value: "" },
1590                "-- ",
1591                ls(1215),
1592                f.autoDateStr ? ' - ' + f.autoDateStr + ' ' : f.autoDate ? ' - ' + Date.fromDbString(f.autoDate).format('d.m.Y') + ' ' : "",
1593                "--"),
1594            React.createElement("option", { value: "!" },
1595                "-- ",
1596                ls(7597) + ' (' + ls(13108) + ')',
1597                " -- "),
1598            React.createElement("option", { value: "manual" }, ls(9922))),
1599        formData[f.id + '_type'] == 'manual' && (React.createElement("input", { type: "date", name: f.id, value: (formData[f.id] || "").substr(0, 10), onChange: fieldChange, className: "egov-formField", placeholder: f.emptyPlaceholder, readOnly: !!props.readonly, disabled: !!props.disabled }))));
1600}
1601exports.DateWithTypeEditor = DateWithTypeEditor;
1602function CertGradeRenderer(props) {
1603    var _a, _b;
1604    var clickFunc = props.clickFunc, oid = props.oid, val = props.val, r = props.r, fid = props.fid, f = props.f, showTextValues = props.showTextValues;
1605    var rv = showTextValues ? ((val === null || val === void 0 ? void 0 : val.r_text) || (val === null || val === void 0 ? void 0 : val.r) || "") : ((val === null || val === void 0 ? void 0 : val.r) || "");
1606    var z = showTextValues ? ((val === null || val === void 0 ? void 0 : val.z_text) || (val === null || val === void 0 ? void 0 : val.z) || "") : ((val === null || val === void 0 ? void 0 : val.z) || "");
1607    var k = showTextValues ? ((val === null || val === void 0 ? void 0 : val.k_text) || (val === null || val === void 0 ? void 0 : val.k) || "") : ((val === null || val === void 0 ? void 0 : val.k) || "");
1608    var v = showTextValues ? ((val === null || val === void 0 ? void 0 : val.v_text) || (val === null || val === void 0 ? void 0 : val.v) || "") : ((val === null || val === void 0 ? void 0 : val.v) || "");
1609    var slovneHodnotenie = val === null || val === void 0 ? void 0 : val.z_t;
1610    var ref = k || z || rv;
1611    if (!Znamky.certificatesUseComputation()) {
1612        v = ref;
1613    }
1614    var txt = v;
1615    var title = '';
1616    if ((_a = val === null || val === void 0 ? void 0 : val.src_subject) === null || _a === void 0 ? void 0 : _a.name) {
1617        title += ((_b = val.src_subject) === null || _b === void 0 ? void 0 : _b.name) + '\n';
1618    }
1619    if (rv) {
1620        title += renderS('{#11814}: {r} {rtext}\n', {
1621            r: rv || "-",
1622            rtext: (val === null || val === void 0 ? void 0 : val.r_text) ? ' · ' + val.r_text : ''
1623        });
1624    }
1625    title += renderS('{#1131}: {z}{z_from_half}\n{#4695}: {k}\n{#12611}: {v}', {
1626        k: k || "-",
1627        z: z || "-",
1628        v: v ? v + ((val === null || val === void 0 ? void 0 : val.v_text) ? ' · ' + val.v_text : '') : "-",
1629        z_from_half: (val === null || val === void 0 ? void 0 : val.z_from_half) ? ' (' + ((val === null || val === void 0 ? void 0 : val.z_from_half) == 1 ? ls(3412) : ls(3515) + ': ' + (val === null || val === void 0 ? void 0 : val.z_from_half)) + ')' : ''
1630    });
1631    var prevVal = (val === null || val === void 0 ? void 0 : val.v_prev) || (val === null || val === void 0 ? void 0 : val.k_prev) || (val === null || val === void 0 ? void 0 : val.z_prev) || (val === null || val === void 0 ? void 0 : val.r_prev) || "";
1632    if (slovneHodnotenie) {
1633        title += '\n\n' + ls(9867) + ':\n' + slovneHodnotenie;
1634    }
1635    var classes = ['certificates-znamka-cell app-link-button normalCase normalWeight'];
1636    var usedPrevVal = false;
1637    if (!v && !prevVal) {
1638        txt = ref;
1639        classes.push('not-generated');
1640    }
1641    else if (!v && prevVal) {
1642        txt = prevVal;
1643        ref = prevVal;
1644        v = prevVal;
1645        classes.push('prev-half');
1646        usedPrevVal = true;
1647    }
1648    if (v != ref) {
1649        classes.push('not-equal');
1650    }
1651    if (ref && (!v || v != ref)) {
1652        title += '\n\n' + ls(12612) + '!';
1653    }
1654    return (React.createElement("a", { title: title, className: classes.join(' '), "data-subjectid": f.subjectid || r.subjectid, "data-studentid": props.studentid || r.studentid, "data-kopia": props.kopia || r.kopia, onClick: clickFunc, "data-verbeval": "1", "data-oid": oid },
1655        txt,
1656        txt != ref ? React.createElement(React.Fragment, null,
1657            ' ',
1658            "\u2192",
1659            ' ',
1660            ref) : "",
1661        slovneHodnotenie && (React.createElement("i", { className: "fa fa-fw fa-commenting-o certificates-verbeval-icon" })),
1662        !v && txt
1663            ? React.createElement("i", { className: "fa fa-fw fa-warning" })
1664            : '',
1665        (val === null || val === void 0 ? void 0 : val.z_from_half)
1666            ? React.createElement("i", { className: "fa fa-fw fa-history certificates-prevterm-icon" })
1667            : ''));
1668}
1669exports.CertGradeRenderer = CertGradeRenderer;
1670function CertDochadzkaRenderer(props) {
1671    var _a, _b, _c, _d, _e, _f, _g, _h;
1672    var val = props.val;
1673    var studentid = props.studentid;
1674    var dochadzkaEtk = props.dochadzkaEtk;
1675    var f = props.fid;
1676    var half = props.half;
1677    var useComputation = Znamky.certificatesUseComputation();
1678    var etkVal = (_a = dochadzkaEtk === null || dochadzkaEtk === void 0 ? void 0 : dochadzkaEtk[studentid]) === null || _a === void 0 ? void 0 : _a[f];
1679    var dochSource = (_c = (_b = dochadzkaEtk === null || dochadzkaEtk === void 0 ? void 0 : dochadzkaEtk[studentid]) === null || _b === void 0 ? void 0 : _b["vysved_doch_" + half]) === null || _c === void 0 ? void 0 : _c.src;
1680    var manualData = (_d = dochadzkaEtk === null || dochadzkaEtk === void 0 ? void 0 : dochadzkaEtk[studentid]) === null || _d === void 0 ? void 0 : _d["manual_data_" + half];
1681    if (etkVal) {
1682        etkVal = (Math.round(etkVal * 100) / 100).toFixed(1).replace('.0', '');
1683    }
1684    var isEq = !(etkVal || etkVal === 0) || val == etkVal;
1685    var dochTitle = ls(12143);
1686    if (!isEq && useComputation) {
1687        dochTitle += '\n' + ls(12144);
1688    }
1689    if (!(manualData === null || manualData === void 0 ? void 0 : manualData[f]) && (manualData === null || manualData === void 0 ? void 0 : manualData[f]) !== 0) {
1690        dochSource = '';
1691    }
1692    var valTitle = dochSource == 'manual' ? ls(12145) : ls(12614);
1693    var manualVal = (manualData === null || manualData === void 0 ? void 0 : manualData[f]) || (manualData === null || manualData === void 0 ? void 0 : manualData[f]) === 0 ? manualData === null || manualData === void 0 ? void 0 : manualData[f] : null;
1694    if (manualVal !== null)
1695        dochSource = 'manual';
1696    if (dochSource == 'manual') {
1697        isEq = true;
1698    }
1699    if (manualVal !== null && manualVal != val) {
1700        val = manualVal;
1701        isEq = false;
1702    }
1703    if (EdubarUtils.indexOf(['slovak22', 'slovak23'], (_e = props.r) === null || _e === void 0 ? void 0 : _e.valuetype_cur) >= 0) {
1704        val = '-';
1705        valTitle = 'Typ prospechu bez dochádzky: ' + (props.r.valuetype_cur_text);
1706        isEq = ((_f = props.r) === null || _f === void 0 ? void 0 : _f.valuetype_cur) == ((_g = props.r) === null || _g === void 0 ? void 0 : _g.valuetype);
1707        dochSource = '';
1708    }
1709    else if (EdubarUtils.indexOf(['slovak22', 'slovak23'], (_h = props.r) === null || _h === void 0 ? void 0 : _h.valuetype) >= 0) {
1710        isEq = false;
1711    }
1712    if (!isEq && useComputation) {
1713        valTitle += '\n' + ls(12583);
1714    }
1715    return (React.createElement("div", { className: "zndoch-flex zndoch-flex-b" }, useComputation || dochSource == 'manual'
1716        ? (React.createElement(React.Fragment, null,
1717            React.createElement("span", { className: "certificates-znamka-cell " + (!isEq ? 'not-generated' : ''), title: valTitle }, val),
1718            dochSource == 'manual' && (React.createElement("span", { className: "zndoch-etk-manual-info", title: lset(12145) },
1719                React.createElement("i", { className: "fa fa-fw fa-exclamation" }))),
1720            (etkVal || etkVal === 0) && (React.createElement("span", { className: "zndoch-etk-val-b", title: dochTitle },
1721                "(",
1722                etkVal,
1723                ")"))))
1724        : (React.createElement(React.Fragment, null,
1725            React.createElement("span", { className: "certificates-znamka-cell ", title: ls(12143) }, etkVal)))));
1726}
1727exports.CertDochadzkaRenderer = CertDochadzkaRenderer;
1728function certShowMultiEdit(rows, half, selectedFields, options) {
1729    var _this = this;
1730    if (!options)
1731        options = {};
1732    var df = {};
1733    var autoDate = '';
1734    var autoValue = '';
1735    var rows0 = rows.map(function (r) {
1736        var _a, _b, _c, _d;
1737        var r0 = tslib_1.__assign({}, r);
1738        if (r0.date_computed && rows.length <= 1) {
1739            autoDate = r0.date_computed;
1740        }
1741        if (r0.value_computed && rows.length <= 1) {
1742            autoValue = r0.value_computed;
1743        }
1744        r0.valueid = r0.valueid ? r0.valueid : (((_a = r.modified) === null || _a === void 0 ? void 0 : _a.indexOf('value')) >= 0 ? '!' : '');
1745        r0.date_type = ((_b = r.modified) === null || _b === void 0 ? void 0 : _b.indexOf('date')) >= 0 && !r0.date
1746            ? '!'
1747            : (((_c = r.modified) === null || _c === void 0 ? void 0 : _c.indexOf('date')) >= 0 ? 'manual' : '');
1748        if (!df.hasOwnProperty('date_type')) {
1749            df["date_type"] = r0.date_type;
1750        }
1751        if (((_d = r.modified) === null || _d === void 0 ? void 0 : _d.indexOf('value')) >= 0) {
1752        }
1753        else {
1754            r0.valueid = '';
1755        }
1756        return r0;
1757    });
1758    if (options.forceDateValue) {
1759        rows0.forEach(function (r) {
1760            r.date = '';
1761        });
1762        df["date_type"] = options.forceDateValue;
1763    }
1764    barNewReactDlg(React.createElement(generalmultiedit_1.GeneralMultiEditDialog, { itemids: rows.map(function (r) { return r.id; }), defaultFormData: df, items: rows0, fields: [
1765            { id: 'date', type: 'date', 'name': ls(12584), customEditor: DateWithTypeEditor, autoDate: autoDate || (options === null || options === void 0 ? void 0 : options.schoolYear_dates["cert_half" + half]) || "" },
1766            (options === null || options === void 0 ? void 0 : options.jeMs) || options.dateOnly ? null : { id: 'valueid', type: 'select', 'name': ls(6318), emptyPlaceholder: '--- ' + ls(1215) + (autoValue ? ' (' + autoValue + ')' : '') + ' --- ', values: [{ id: '!', name: '--- ' + ls(7597) + ' ---' }].concat(((options === null || options === void 0 ? void 0 : options.prospech_znamky) || []).map(function (p) { return { id: p.id, name: p.text }; })) },
1767        ].filter(function (r) { return r !== null; }), allowSelect: true, selectedFields: selectedFields, saveFunc: function (fd, itemids, fd0) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
1768            var postData;
1769            return tslib_1.__generator(this, function (_a) {
1770                if (fd.hasOwnProperty('date')) {
1771                    fd["date_type"] = fd0["date_type"];
1772                }
1773                if (options === null || options === void 0 ? void 0 : options.prospech_typid) {
1774                    fd["prospech_typid"] = options.prospech_typid;
1775                }
1776                postData = {
1777                    half: half || 1,
1778                    skids: itemids,
1779                    fd: fd
1780                };
1781                return [2, new Promise(function (resolve, reject) {
1782                        AscHttp_1.AscHttp.rpc('/znamky/?what=Certificates', 'saveMulti', postData, function () {
1783                            var _a;
1784                            (_a = options === null || options === void 0 ? void 0 : options.reload) === null || _a === void 0 ? void 0 : _a.call(options);
1785                            barShowMessage(ls(1310));
1786                            resolve(true);
1787                        }, function (e) {
1788                            reject('save failed');
1789                        });
1790                    })];
1791            });
1792        }); } }));
1793}
1794exports.certShowMultiEdit = certShowMultiEdit;
1795function cert_getSubjectRow(subjectid, dbi) {
1796    var sr = subjectid == '2'
1797        ? { id: subjectid, name: 'Hlavný predmet', short: 'HP' }
1798        : subjectid == '3'
1799            ? { id: subjectid, name: 'Obligátny nástroj', short: 'ON' }
1800            : subjectid == '4'
1801                ? { id: subjectid, name: 'Voliteľný nástroj', short: 'VN' }
1802                : dbi === null || dbi === void 0 ? void 0 : dbi.rowData("subjects", subjectid);
1803    return sr;
1804}
1805exports.cert_getSubjectRow = cert_getSubjectRow;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.