def _getStatusBlock(self, operation):
     if not operation.isUnlocked():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_DOPREVOPERATION
                 ),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif operation.isFullCompleted():
         block = formatters.packAlignedTextBlockData(
             text=text_styles.concatStylesWithSpace(
                 icons.doubleCheckmark(1),
                 text_styles.bonusAppliedText(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_EXCELLENTDONE)
             ),
             align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
             padding=formatters.packPadding(top=-5, bottom=12))
     elif operation.isAwardAchieved():
         data = [
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.checkmark(-2),
                     text_styles.bonusAppliedText(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_DONE)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5))
         ]
         currentCount = operation.getFreeTokensCount()
         totalCount = operation.getFreeTokensTotalCount()
         if currentCount < totalCount:
             data.append(
                 formatters.packAlignedTextBlockData(
                     text=text_styles.concatStylesToSingleLine(
                         text_styles.main(
                             TOOLTIPS.
                             PERSONALMISSIONS_OPERATION_FOOTER_DESCR_FREESHEETS
                         ), missions_helper.AWARD_SHEET_ICON,
                         text_styles.bonusAppliedText(currentCount),
                         text_styles.main(' / %s' % totalCount)),
                     align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                     padding=formatters.packPadding(bottom=14)))
         else:
             currentCount = len(operation.getFullCompletedQuests(True))
             totalCount = operation.getQuestsCount()
             data.append(
                 formatters.packAlignedTextBlockData(
                     text=text_styles.concatStylesToSingleLine(
                         text_styles.main(
                             TOOLTIPS.
                             PERSONALMISSIONS_OPERATION_FOOTER_DESCR_QUESTSFULLYDONE
                         ), text_styles.bonusAppliedText(currentCount),
                         text_styles.main(' / %s' % totalCount)),
                     align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                     padding=formatters.packPadding(bottom=14)))
         block = formatters.packBuildUpBlockData(data)
     elif operation.isInProgress():
         currentCount, totalCount = operation.getTokensCount()
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.inProgress(-1),
                     text_styles.neutral(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_INPROGRESS)
                 ),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesToSingleLine(
                     text_styles.main(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_DESCR_COMPLETIONTOKENS
                     ), text_styles.bonusAppliedText(currentCount),
                     text_styles.main(' / %s' % totalCount)),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     elif not operation.hasRequiredVehicles():
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.concatStylesWithSpace(
                     icons.markerBlocked(-2),
                     text_styles.error(
                         TOOLTIPS.
                         PERSONALMISSIONS_OPERATION_FOOTER_TITLE_NOTAVAILABLE
                     )),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_NOVEHICLE),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     else:
         block = formatters.packBuildUpBlockData([
             formatters.packAlignedTextBlockData(
                 text=text_styles.stats(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_TITLE_AVAILABLE),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(top=-5)),
             formatters.packAlignedTextBlockData(
                 text=text_styles.main(
                     TOOLTIPS.
                     PERSONALMISSIONS_OPERATION_FOOTER_DESCR_SELECTQUEST),
                 align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER,
                 padding=formatters.packPadding(bottom=14))
         ])
     return block
    def __updateFooter(self):
        chainState = self.__getChainState(self.getChain())
        isQuestInProgress = False
        btnVisible = False
        btnEnabled = False
        btnLabel = ''
        descr = ''
        currentOperation = self.getOperation()
        chainClassifier = currentOperation.getChainClassifier(
            self.getChainID())
        vehicleClass = getTypeShortUserName(chainClassifier.classificationAttr)
        pm = self._eventsCache.getPersonalMissions()
        branch = self.getBranch()
        freeSheets = pm.getFreeTokensCount(branch)
        pawnedSheets = pm.getPawnedTokensCount(branch)
        if not chainState.hasUnlocked:
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(PERSONAL_MISSIONS.STATUSPANEL_STATUS_LOCKED))
        elif chainState.questInProgress is not None:
            quest = chainState.questInProgress
            if quest.isOnPause:
                status = text_styles.concatStylesWithSpace(
                    icons.makeImageTag(RES_ICONS.MAPS_ICONS_LIBRARY_ONPAUSE,
                                       16, 16, -3, 8),
                    text_styles.playerOnline(quest.getUserName()))
            else:
                isQuestInProgress = True
                status = text_styles.concatStylesWithSpace(
                    icons.inProgress(),
                    text_styles.tutorial(quest.getUserName()))
            if quest.areTokensPawned():
                descr = text_styles.neutral(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_PAWNED,
                        count=quest.getPawnCost(),
                        icon=getHtmlAwardSheetIcon(quest.getQuestBranch())))
            elif quest.isMainCompleted():
                descr = text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_IMPROVE)
            elif quest.canBePawned() and not quest.isDisabled():
                btnVisible = True
                pawnCost = quest.getPawnCost()
                btnLabel = _ms(
                    PERSONAL_MISSIONS.STATUSPANEL_FREESHEETBTN_LABEL,
                    count=pawnCost,
                    icon=getHtmlAwardSheetIcon(quest.getQuestBranch()))
                if pawnCost <= freeSheets:
                    btnEnabled = True
        elif chainState.isFullCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.doubleCheckmark(1),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLEXCELLENTDONE,
                        vehicleClass=vehicleClass)))
        elif chainState.isCompleted:
            status = text_styles.concatStylesWithSpace(
                icons.checkmark(-2),
                text_styles.bonusAppliedText(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_STATUS_ALLDONE,
                        vehicleClass=vehicleClass)))
        elif not chainState.hasVehicle:
            if self.getBranch() == PM_BRANCH.PERSONAL_MISSION_2:
                template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_PM2
            else:
                template = PERSONAL_MISSIONS.OPERATIONTITLE_LABEL_NOVEHICLE_REGULAR
            vehData = getChainVehRequirements(currentOperation,
                                              self.getChainID(),
                                              useIcons=False)
            status = text_styles.concatStylesWithSpace(
                icons.markerBlocked(),
                text_styles.error(_ms(template, vehData=vehData)))
        else:
            status = text_styles.concatStylesWithSpace(
                icons.makeImageTag(
                    RES_ICONS.MAPS_ICONS_LIBRARY_ATTENTIONICONFILLED, 16, 16,
                    -2),
                text_styles.neutral(
                    PERSONAL_MISSIONS.STATUSPANEL_STATUS_SELECTTASK))
        tankwomanQuests = []
        for operation in pm.getAllOperations().itervalues():
            tankwomanQuests.extend(
                operation.getQuestsByFilter(
                    PersonalMission.needToGetTankWoman).itervalues())

        counterText = ''
        tankwomanVisible = False
        if tankwomanQuests:
            counterText = text_styles.highlightText('x%s' %
                                                    len(tankwomanQuests))
            tankwomanVisible = True
        self.as_setStatusDataS({
            'statusText': status,
            'descrText': descr,
            'btnVisible': btnVisible,
            'btnEnabled': btnEnabled,
            'btnLabel': btnLabel,
            'sheetsBlockData': {
                'freeSheetsIcon':
                AwardSheetPresenter.getIcon(AwardSheetPresenter.Size.MID),
                'freeSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_FREESHEETS,
                        count=text_styles.highlightText(freeSheets))),
                'pawnedSheetsText':
                text_styles.main(
                    _ms(PERSONAL_MISSIONS.STATUSPANEL_PAWNEDSHEETS,
                        count=text_styles.highlightText(pawnedSheets))),
                'tooltipData': {
                    'isSpecial':
                    True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.FREE_SHEET_RETURN if freeSheets
                    or pawnedSheets else TOOLTIPS_CONSTANTS.FREE_SHEET,
                    'specialArgs': [currentOperation.getCampaignID()]
                },
                'popover':
                PERSONAL_MISSIONS_ALIASES.FREE_SHEET_POPOVER,
                'popoverData': {
                    'branch': branch
                }
            },
            'tankgirlsBlockData': {
                'counterText': counterText,
                'visible': tankwomanVisible,
                'tooltipData': {
                    'isSpecial': True,
                    'specialAlias':
                    TOOLTIPS_CONSTANTS.PERSONAL_MISSIONS_TANKWOMAN,
                    'specialArgs': []
                },
                'popover': PERSONAL_MISSIONS_ALIASES.TANK_GIRLS_POPOVER
            },
            'tooltip': None,
            'isQuestInProgress': isQuestInProgress
        })
        return