**Pricing Table Variable References** - Pricing Table Variable which is used anywhere in document
## User Story 1
https://pandadoc.atlassian.net/browse/PD-8323
Role: Document Sender === User
As a user I want to get Pricing Table Variables when adding new Pricing Table for using anywhere in document.
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
* After adding the Pricing Table we can see following System Variables:
```[PricingTableName.Quantity] - total quantity
[PricingTableName.Subtotal] - subtotal formatted as "currency sign + value with 2 decimals"
[PricingTableName.Total] - total amount formatted as "currency sign + value with 2 decimals"
[PricingTableName.Discount] - the total amount of discount for the pricing table formatted as currency
[PricingTableName.Tax] - the total amount of tax for the pricing table formatted as currency
```
* After adding the Pricing Table we can see following Table Properties:
```[PricingTableName.Quantity] - total quantity
[PricingTableName.Subtotal] - subtotal formatted as "currency sign + value with 2 decimals"
[PricingTableName.Total] - total amount formatted as "currency sign + value with 2 decimals"
[PricingTableName.Discount] - the total amount of discount for the pricing table formatted as currency
[PricingTableName.Tax] - the total amount of tax for the pricing table formatted as currency
```
* Duplicating the Pricing Table
* insert CLI with PT
## User Story 2
https://pandadoc.atlassian.net/browse/PD-8324
Role: Document Sender === User
As a user I want to place this Variable anywhere in document for business use cases.
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
* When copy from System Variables and paste in document elements (Table, Text, ...) [add link to desription how to work now], usage counter is updated
* When copy from Table Properties and paste in document text, usage counter is updated
* When writing anywhere in document and choose Variable from dropdown [PricingTable.Variable], usage counter is updated
* When writing anywhere in document [PricingTable.Variable], usage counter is updated
## User Story 3
https://pandadoc.atlassian.net/browse/PD-8326
Role: Document Sender === User
As a user I want Pricing Table Variables references to be automatically updated when the value of Variable is changed and values should be consistent.
??and all values should be up to date??
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
* When User changes Pricing Table line so that the attributes change, Pricing Table Variables references are updated.
* When User adds new line to the Pricing Table manually so that the attributes change, Pricing Table Variables references are updated.
* When User adds new line to the Pricing Table from CRM so that the attributes change, Pricing Table Variables references are updated.
* When User removes Pricing Table line so that the attributes change, Pricing Table Variables references are updated.
* When User removes Pricing Table section so that the attributes change, Pricing Table Variables references are updated.
* When User changes Pricing Table attributes manually, Pricing Table Variables references are updated.
* When User checks/unchecks "Optional item" checkbox of a Pricing Table line so that the attributes change, Pricing Table Variables references are updated.
* Дописать про случай с изменением типа скидки
## User Story 4
https://pandadoc.atlassian.net/browse/PD-8345
Role: Document Recipient === User
As a user I want Pricing Table Variables references to be automatically updated when the value of Variable is changed.
Acceptance criteria:
* When Optional Item checkbox is changed
* When quantity is changed
## User Story 5
https://pandadoc.atlassian.net/browse/PD-8346
Role: Document Sender === User
> Pricing Table Variable References - Pricing Table Variable which is used anywhere in document
As a user I want to save Pricing Table Variable References when I delete Pricing Table or corresponding Pricing Table attribute.
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
* When we delete Pricing Table, we moved this Variable to Custom Variables
* When we delete page with Pricing Table, we moved this Variable to Custom Variables
* When we delete Pricing Table Attribute, we moved this Variable to Custom Variables
атрибут - это элемент футера прайсинг таблицы
## User Story 6
https://pandadoc.atlassian.net/browse/PD-8347
Role: Document Sender === User
As a user I want all Pricing Table Variables without references in document to be removed when I remove Pricing Table to avoid using these Variables.
Acceptance criteria:
* When we delete Pricing Table, we remove corresponding System Variables
* When we delete page with Pricing Table, we remove corresponding System Variables
* When we delete Pricing Table Attribute, we remove corresponding System Variable
## User Story 7
https://pandadoc.atlassian.net/browse/PD-8350
Role: Document Sender === User
As a user I want Custom Variable to become Pricing Table Variable if the names match for consistency.
Acceptance criteria:
* When we add Pricing Table
* When we rename Pricing Table
* When we Undo deleting Pricing Table
* Usage counter is up to date
## User Story 8? перенесла это в аксептанс критерии изменения PT
Role: Document Sender === User
As a user I want Document Value to be updated when we update Pricing Table Total
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
@marina те которые связаны с тотал
## User Story 9
https://pandadoc.atlassian.net/browse/PD-8351
Role: Document Sender === User
As a user I want Pricing Table Values references to be automatically updated when I change Pricing Table currency.
Acceptance criteria:
* attributes are automatically updated
* Pricing Table Values references are automatically updated
## User Story 10
https://pandadoc.atlassian.net/browse/PD-8352
Role: Document Sender === User
As a user I want the Variable to be excluded from the footer while saving all the functionality when I hide the corresponding Pricing Table attribute.
Acceptance criteria:
* дополнить из сторей выше
## User Story 11
https://pandadoc.atlassian.net/browse/PD-8353
Role: Document Sender === User
As a user I want to get new Pricing Table Variable when I add new attribute.
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
* расписать 6 атрибутов, counter
## User Story 12
https://pandadoc.atlassian.net/browse/PD-8354
Role: Document Sender === User
As a user I want all variables to be automatically renamed when I rename the Pricing Table.
[Figma](https://www.figma.com/file/SgRgUXcfDHC5DGcmLvcd8b/%5BPricing-table%5D-Variables?node-id=0%3A1)
Acceptance criteria:
* дописать формат
* при переименовании аттрибута переменные не изменяются
## User Story 13
https://pandadoc.atlassian.net/browse/PD-8355
Role: Document Sender === User
As a user I want all previously created EV2 documents to have PTV functionality.
Acceptance criteria:
* для существующих PT существуют переменные для всех атрибутов
* для референсов заполнены значения
## !!!! User Story 14
Role: Admin === User
As a user I want to have PTV functionality when I convert EV1 document?CLI?Template to EV2 format.
Acceptance criteria:
* для существующих PT существуют переменные для всех атрибутов
* when migrating whole workspace
* when migrating a template
* when migrating&verifying a template
## E2E - покрыть существующую сторю?
еще описать:
- валюта
- аспект про hidden (что можно скрывать атрибуты)
- добавление нового атрибута в футере - создание новой переменной (или предыдущий пункт про это же?)
- добавление таблицы из CLI
- переименование таблицы = переименование всех переменных и референсов
- переименование аттрибутов
- миграция
- конвертация
- аналитика?
- e2e тесты?
Миграция
посмотреть, чтобы токены не конфликтовали по группам