<div id="idMFOTMErrorHolder" class="hide" data-pss-message-prefixes="psx.htmlc.idmFOTM">
    <div id="idMErrorDialog">
        <div data-ng-if="ctrlData.entry.timeData.firstTime.getTime() != ctrlData.entry.timeData.useTime.getTime()" class="idm_errorMessage">
            <p class="feedback-alert">
                The scan was actually run at {{ctrlData.entry.timeData.firstTime.toLocaleTimeString()}} but the time was updated to {{ctrlData.entry.timeData.useTime.toLocaleTimeString()}}
            </p>
            <p class="feedback-info idm_errorDetails" data-ng-if="ctrlData.args.exceptionNoClass != '' && ctrlData.entry.exceptedValidations.includes('noClass')">This may have been because of a configured exception when scanning outside of a period</p>
        </div>
        <div data-ng-repeat="currentError in ctrlData.currentErrors" class="idm_errorMessage" data-ng-if="ctrlData.errorCodes && ctrlData.errorCodes.length > 0">
            <p class="feedback-error">{{currentError.message}}</p>
            <p class="feedback-info idm_errorDetails" data-ng-if="currentError.details">{{currentError.details}}</p>
        </div>
        <table class="grid" data-ng-show="ctrlData.entry.schedule.length > 0">
            <tr>
                <th colspan="6">{{'psx.htmlc.idmFOTM.error_resolution_schedule'|translate}} {{ctrlData.entry.timeData.att_date}}</th>
            </tr>
            <tr data-ng-repeat="enrollment in ctrlData.entry.schedule" data-ng-class="{'feedback-active': ctrlData.entry.currentClasses.includes(enrollment)}">
                <td class="idm_activeEnrollmentAlert">
                    <span data-ng-show="ctrlData.entry.currentClasses.includes(enrollment)">
                        <i class="fa fa-{{evalSectionState(entry, ctrlData.errorCodes, enrollment)}}-circle"></i>
                    </span>
                </td>
                <td>{{enrollment.external_expression}}</td>
                <td>{{enrollment.course_name}}</td>
                <td>{{enrollment.teacher}}</td>
                <td>{{enrollment.start_timeObj.toLocaleTimeString()}}-{{enrollment.end_timeObj.toLocaleTimeString()}}</td>
                <td data-ng-if="_.compact(_.pluck(ctrlData.entry.currentClasses, 'att_code')).length > 0 || _.compact(_.pluck(ctrlData.entry.currentClasses, 'att_comment')).length > 0">{{enrollment.att_code}}<span data-ng-show="enrollment.att_code && enrollment.att_comment"> - </span>{{enrollment.att_comment}}</td>
            </tr>
        </table>
        <hr>
        <table class="grid idMErrorResolution">
            <tr>
                <th colspan="3">{{'psx.htmlc.idmFOTM.error_resolution_how'|translate}}</th>
            </tr>
            <tr data-ng-if="!localValidationsOnly && ctrlData.entry.attType == 'Meeting'">
                <td data-ng-click="toggleErrorFix('editTime')">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('editTime')">
                </td>
                <td data-ng-click="toggleErrorFix('editTime')">{{'psx.htmlc.idmFOTM.error_resolution_manual_time'|translate}}</td>
                <td>
                    <input type="text" class="psDateWidget" data-ng-disabled="!ctrlData.errorFix.includes('editTime')" data-ng-model="ctrlData.manualTime.manualDateEntry_override">
                    @
                    <input type="text" class="timeEntry" data-ng-disabled="!ctrlData.errorFix.includes('editTime')" data-ng-model="ctrlData.manualTime.manualTimeEntry_override">
                </td>
            </tr>
            <tr>
                <td data-ng-click="toggleErrorFix('editStudent')">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('editStudent')">
                </td>
                <td data-ng-click="toggleErrorFix('editStudent')">{{'psx.htmlc.idmFOTM.error_resolution_change_student'|translate}}</td>
                <td>
                    <input type="text" data-ng-disabled="!ctrlData.errorFix.includes('editStudent')" data-ng-model="ctrlData.entry.studentIdentifier_override" id="studentIdentifierOverride" data-ng-blur="identifierPlaceholder()" data-ng-focus="identifierPlaceholder()" placeholder="{{placeholderText}}">
                </td>
            </tr>
            <tr data-ng-if="!localValidationsOnly">
                <td data-ng-click="toggleErrorFix('changeCode')">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('changeCode')">
                </td>
                <td data-ng-click="toggleErrorFix('changeCode')">{{'psx.htmlc.idmFOTM.error_resolution_change_code'|translate}}</td>
                <td>
                    <select data-ng-disabled="!ctrlData.errorFix.includes('changeCode')" data-ng-model="ctrlData.entry.attendanceCode_override" data-ng-options="attCode as attCode.label for attCode in ctrlData.args.attCodes" data-ng-change="ctrlData.entry.printTardySlip = attService.checkTardySlip()"></select>
                </td>
            </tr>
            <tr data-ng-if="!localValidationsOnly && ctrlData.entry.attType == 'Meeting'" data-ng-class="{'disabled': _.intersection(independentFixes['saveDaily'], ctrlData.errorFix).length > 0}">
                <td data-ng-click="toggleErrorFix('saveDaily')" data-ng-disabled="_.intersection(independentFixes['saveDaily'], ctrlData.errorFix).length > 0">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('saveDaily')" data-ng-disabled="_.intersection(independentFixes['saveDaily'], ctrlData.errorFix).length > 0">
                </td>
                <td colspan="2" data-ng-click="toggleErrorFix('saveDaily')" data-ng-disabled="_.intersection(independentFixes['saveDaily'], ctrlData.errorFix).length > 0">{{'psx.htmlc.idmFOTM.error_resolution_save_daily'|translate}}</td>
            </tr>
            <tr data-ng-if="ctrlData.errorCodes.includes('existingCode')">
                <td data-ng-click="toggleErrorFix('submitExisting')">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('submitExisting')">
                </td>
                <td colspan="2" data-ng-click="toggleErrorFix('submitExisting')">{{'psx.htmlc.idmFOTM.error_resolution_submit_existing'|translate}}</td>
            </tr>
            <tr data-ng-if="ctrlData.errorCodes.includes('overlap')" data-ng-class="{'disabled': _.intersection(independentFixes['allPeriods'], ctrlData.errorFix).length > 0}">
                <td data-ng-click="toggleErrorFix('allPeriods')" data-ng-disabled="_.intersection(independentFixes['allPeriods'], ctrlData.errorFix).length > 0">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('allPeriods')" data-ng-disabled="_.intersection(independentFixes['allPeriods'], ctrlData.errorFix).length > 0">
                </td>
                <td data-ng-click="toggleErrorFix('allPeriods')" colspan="2" data-ng-disabled="_.intersection(independentFixes['allPeriods'], ctrlData.errorFix).length > 0">
                    Save to All Active Periods
                </td>
            </tr>
            <tr data-ng-if="ctrlData.errorCodes.includes('overlap')" data-ng-class="{'disabled': _.intersection(independentFixes['specificPeriods'], ctrlData.errorFix).length > 0}">
                <td data-ng-click="toggleErrorFix('specificPeriods')" data-ng-disabled="_.intersection(independentFixes['specificPeriods'], ctrlData.errorFix).length > 0">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('specificPeriods')" data-ng-disabled="_.intersection(independentFixes['specificPeriods'], ctrlData.errorFix).length > 0">
                </td>
                <td data-ng-click="toggleErrorFix('specificPeriods')" data-ng-disabled="_.intersection(independentFixes['specificPeriods'], ctrlData.errorFix).length > 0">
                    Save to Specific Periods
                </td>
                <td>
                    <select multiple data-ng-disabled="!ctrlData.errorFix.includes('specificPeriods')" data-ng-model="ctrlData.entry.specificPeriods" data-ng-options="period.period_number as period.description for period in ctrlData.entry.currentPeriods"></select>
                </td>
            </tr>
            <tr data-ng-if="ctrlData.errorCodes.includes('multiSection')" data-ng-class="{'disabled': _.intersection(independentFixes['allSections'], ctrlData.errorFix).length > 0}">
                <td data-ng-click="toggleErrorFix('allSections')" data-ng-disabled="_.intersection(independentFixes['allSections'], ctrlData.errorFix).length > 0">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('allSections')" data-ng-disabled="_.intersection(independentFixes['allSections'], ctrlData.errorFix).length > 0">
                </td>
                <td data-ng-click="toggleErrorFix('allSections')" colspan="2" data-ng-disabled="_.intersection(independentFixes['allSections'], ctrlData.errorFix).length > 0">
                    Save to All Active Sections <span data-ng-show="(ctrlData.entry.specificPeriods && ctrlData.entry.specificPeriods.length > 0 && (ctrlData.errorFix.includes('specificPeriods') || !ctrlData.errorCodes.includes('overlap'))) || (ctrlData.errorCodes.includes('overlap') && !ctrlData.errorFix.includes('specificPeriods'))">in Period(s): <span data-ng-if="(ctrlData.entry.specificPeriods && ctrlData.entry.specificPeriods.length > 0 && (ctrlData.errorFix.includes('specificPeriods') || !ctrlData.errorCodes.includes('overlap')))">{{ctrlData.entry.specificPeriods.join(",")}}</span><span data-ng-if="ctrlData.errorCodes.includes('overlap') && !ctrlData.errorFix.includes('specificPeriods')">{{_.pluck(ctrlData.entry.currentPeriods, "period_number").join(",")}}</span></span>
                </td>
            </tr>
            <tr data-ng-if="ctrlData.errorCodes.includes('overlap') || ctrlData.errorCodes.includes('multiSection')" data-ng-class="{'disabled': _.intersection(independentFixes['specificSections'], ctrlData.errorFix).length > 0}">
                <td data-ng-click="toggleErrorFix('specificSections')" data-ng-disabled="_.intersection(independentFixes['specificSections'], ctrlData.errorFix).length > 0">
                    <input type="checkbox" data-ng-checked="ctrlData.errorFix.includes('specificSections')" data-ng-disabled="_.intersection(independentFixes['specificSections'], ctrlData.errorFix).length > 0">
                </td>
                <td data-ng-click="toggleErrorFix('specificSections')" data-ng-disabled="_.intersection(independentFixes['specificSections'], ctrlData.errorFix).length > 0">
                    Save to Specific Sections
                </td>
                <td>
                    <select multiple data-ng-disabled="!ctrlData.errorFix.includes('specificSections')" data-ng-model="ctrlData.entry.specificSections">
                        <option data-ng-repeat="section in ctrlData.entry.currentClasses" data-ng-value="section.ccid" data-ng-show="
                        (ctrlData.errorCodes.includes('overlap') && !ctrlData.errorFix.includes('specificPeriods')) ||
                        !ctrlData.entry.specificPeriods ||
                        ctrlData.entry.specificPeriods.length == 0 ||
                        (ctrlData.entry.specificPeriods.includes(section.period_number) && (!ctrlData.entry.multiSection || ctrlData.errorFix.includes('specificPeriods'))) ||
                        (ctrlData.entry.multiSection && ctrlData.entry.multiSection[section.period_number] && !ctrlData.errorFix.includes('specificPeriods'))"
                        >{{section.label}}</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
</div>