| 83 | }; |
| 84 | |
| 85 | const handleAddCondition = (index: number, type: string) => { |
| 86 | const condition: ICondition = { |
| 87 | id: uuidv4(), |
| 88 | type: type, |
| 89 | subject: type === SEGMENT_TYPE ? intl.formatMessage({id: 'common.user.text'}) : '', |
| 90 | predicate: '', |
| 91 | }; |
| 92 | |
| 93 | if (type === DATETIME_TYPE) { |
| 94 | condition.datetime = moment().format().slice(0, 19); |
| 95 | condition.timezone = moment().format().slice(-6); |
| 96 | } |
| 97 | rules[index].conditions.push(condition); |
| 98 | |
| 99 | saveRules([...rules]); |
| 100 | }; |
| 101 | |
| 102 | const handleDeleteCondition = (ruleIndex: number, conditionIndex: number) => { |
| 103 | rules[ruleIndex].conditions.splice(conditionIndex, 1); |