#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File    :   filter_page_locator.py
@Time    :   2024/11/21 14:51:52
@Author  :   dulip3ng
@Version :   1.0
@Desc    :   None
'''

class FilterPageLocator:

    ALL_ORG_GET_CHECK_STATE_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@data-kdid, '_Filter-FPANEL3_top')]//label[text() = '所有组织']/preceding-sibling::input";
    ALL_ORG_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@data-kdid, '_Filter-FPANEL3_top')]//label[text() = '所有组织']";
    ORG_ARROW_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@data-kdid, '_Filter-FPANEL3_top')]//span[@class = 'k-icon k-i-arrow-s' and text() = 'select']";
    ORG_MULTI_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]/descendant::button[contains(text(), '%s')]";
    ORG_SELECT_OK_BTN_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]/descendant::div[text() = '确定']";
    ENTITY_CHECKBOX_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@data-kdid, '_Filter-FPANEL3_fill')]//label[contains(@id, '_checkbox') and text() = '%s']";
    TOOL_BAR_BTN_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//li[text() = '%s']";
    FILTER_OK_BUTTON_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FBTNOK')]/a";
    FILTER_CONDITION_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[contains(@id, '_row_Add_PART_Fileds_P')]//input[contains(@class, 'k-input defaultQuikerRowEmptyShow')]";

    #过滤页面条件行相关定位，条件行使用35px的倍数确定第几行，如0px=第一行，35px=第二行
    CONDITION_ITEM_ARGS_LOC = "//div[@class= 'k-animation-container']//div[@class='k-list-scroller']/ul[@aria-hidden='false']//li/span[substring-after(text(), '.')='' and contains(text(), '%s')]";
    COMPARE_TYPE_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[contains(@id, '_row_Add_PPART_CompareType_P')]";
    COMPARE_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]/div/div[2]/ul/li[text() = '%s']";
    CONDITION_TEXT_FIELD_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']//input[@class='k-textbox']";
    CONDITION_DATE_FIELD_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']//input[@class='k-input' and @type = 'text']";
    CONDITION_SELECT_FIELD_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']//span[@class='k-input']";
    CONDITION_TEXTAREA_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']//textarea[@class='k-textbox']";
    CONDITION_BASE_FIELD_SPAN_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']//span[@class = 'k-select kd-editor-btn']/following-sibling::input[@class='k-input']/following-sibling::span"
    CONDITION_BASE_FIELD_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']//span[@class = 'k-select kd-editor-btn']/following-sibling::input[@class='k-input']"
    CONDITION_SELECT_ITEM_ARGS_LOC = "//div[@class='k-animation-container' and contains(@style, 'display: block')]//ul[@class='k-list k-reset']//li/span[text()='%s']";
    CONDITION_BASE_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block')]//table[@class = 'k-selectable']/descendant::td[text() = '%s']";
    LOGIC_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[contains(@id, '_row_Add_PART_Logic_P')]";

    PARSE_CONDITION_VALUE_FIELD_TYPE_ARGS_LOC = "//div[@class= 'k-widget k-window' and @data-role='draggable' and not(contains(@style, 'display: none'))]//div[contains(@id, '_Filter-FTAB_c-') and @class='k-content k-state-active']//div[contains(@id, '_row_Add') and contains(@style, '; top: %dpx')]//td[@valign='top']/div/div"