def view_reserve_photo(update: Update, context: CallbackContext,
                       user: Operator):
    cur_deal_index = user.florist_order.cur_deal_index
    deals = user.florist_order.deals_list

    d = deals[cur_deal_index]

    with BW.OAUTH_LOCK:
        access_token = context.bot_data[cfg.BOT_ACCESS_TOKEN_PERSISTENT_KEY]

        deal_photos_links = [
            creds.BITRIX_MAIN_PAGE +
            el.replace('auth=', 'auth=' + access_token)
            for el in d.order_reserve
        ]

        msg_text = Txt.RESERVE_VIEWER_TEXT
        if d.reserve_desc:
            msg_text += d.reserve_desc + '\n'

        media_list = [InputMediaPhoto(media=el) for el in deal_photos_links]
        keyboard = [[
            InlineKeyboardButton(text=Txt.EQUIP_BUTTON_TEXT,
                                 callback_data=Txt.EQUIP_BUTTON_CB)
        ],
                    [
                        InlineKeyboardButton(
                            text=Txt.BACK_TO_ORDER_BUTTON_TEXT,
                            callback_data=Txt.BACK_TO_ORDER_BUTTON_CB)
                    ]]

        TgCommons.send_media_group(update.effective_user, media_list)
        TgCommons.send_mdv2(update.effective_user, msg_text, keyboard)
def render_cur_deal(update, context, user):
    deal_id = user.deal_data.deal_id
    d = user.data.get_deal(deal_id)

    deal_terminal = Txt.DEAL_TERMINAL_ELT if d.terminal_needed else ''
    deal_change_sum = Txt.DEAL_CHANGE_ELT.format(
        d.change_sum) if d.change_sum is not None else ''
    deal_to_pay = Txt.DEAL_TO_PAY_ELT.format(
        d.to_pay) if d.to_pay is not None else ''

    message = Txt.DEAL_VIEW_TEMPLATE.format(
        deal_id, d.time, d.date, d.address,
        Txt.ADDRESS_RESOLUTION_LINK + Utils.escape_mdv2_textlink(d.address),
        d.flat, d.recipient_name, d.recipient_phone, d.recipient_phone,
        d.district, d.delivery_comment, d.incognito, deal_terminal,
        deal_change_sum, deal_to_pay, d.subdivision, d.sender, d.source,
        d.contact_phone, d.contact_phone)

    keyboard = [[
        InlineKeyboardButton(Txt.ORDER_CONTENT_BUTTON_TEXT,
                             callback_data=Txt.ORDER_CONTENT_BUTTON_CB)
    ]]

    if user.data.deals_type == UserData.DealsType.DELIVERS_TODAY:
        keyboard.extend(
            [[
                InlineKeyboardButton(Txt.FINISH_DEAL_BUTTON_TEXT,
                                     callback_data=Txt.FINISH_DEAL_BUTTON_CB)
            ],
             [
                 InlineKeyboardButton(
                     Txt.WAREHOUSE_RETURN_DEAL_BUTTON_TEXT,
                     callback_data=Txt.WAREHOUSE_RETURN_DEAL_BUTTON_CB)
             ]])

    keyboard.append([
        InlineKeyboardButton(
            Txt.BACK_TO_CUR_DEALS_LIST_BUTTON_TEXT,
            callback_data=Txt.BACK_TO_CUR_DEALS_LIST_BUTTON_CB)
    ])

    with BW.OAUTH_LOCK:
        access_token = context.bot_data[cfg.BOT_ACCESS_TOKEN_PERSISTENT_KEY]

        deal_photos_links = [
            creds.BITRIX_MAIN_PAGE +
            el.replace('auth=', 'auth=' + access_token)
            for el in d.order_big_photos
        ]

        media_list = [InputMediaPhoto(media=el) for el in deal_photos_links]

        if media_list:
            TgCommons.send_media_group(update.effective_user, media_list)

        TgCommons.send_mdv2(update.effective_user, message, keyboard)