( type, getWidgetValue, owner, placeholder, isSignyourself )
| 656 | }; |
| 657 | |
| 658 | export const addWidgetSelfsignOptions = ( |
| 659 | type, |
| 660 | getWidgetValue, |
| 661 | owner, |
| 662 | placeholder, |
| 663 | isSignyourself |
| 664 | ) => { |
| 665 | let defaultOpt; |
| 666 | //condition to handle widgets name field |
| 667 | const id = generateId(6); |
| 668 | if (placeholder) { |
| 669 | const countSameWidget = placeholder?.reduce((count, page) => { |
| 670 | return count + page.pos.filter((item) => item.type === type).length; |
| 671 | }, 0); |
| 672 | const count = countSameWidget + 1; |
| 673 | defaultOpt = { name: `${type}-${id}-${count}`, status: "required" }; |
| 674 | } else { |
| 675 | defaultOpt = { name: `${type}-${id}-1`, status: "required" }; |
| 676 | } |
| 677 | switch (type) { |
| 678 | case "signature": |
| 679 | return defaultOpt; |
| 680 | case "stamp": |
| 681 | return defaultOpt; |
| 682 | case "checkbox": |
| 683 | return defaultOpt; |
| 684 | case textWidget: |
| 685 | return defaultOpt; |
| 686 | case cellsWidget: |
| 687 | return { |
| 688 | ...defaultOpt, |
| 689 | cellCount: 5, |
| 690 | defaultValue: "", |
| 691 | validation: { type: "", pattern: "" }, |
| 692 | isReadOnly: false |
| 693 | }; |
| 694 | case "initials": |
| 695 | return defaultOpt; |
| 696 | case "name": |
| 697 | return { |
| 698 | ...defaultOpt, |
| 699 | defaultValue: getWidgetValue(type), |
| 700 | validation: { type: "text", pattern: "" } |
| 701 | }; |
| 702 | case "company": |
| 703 | return { |
| 704 | ...defaultOpt, |
| 705 | defaultValue: getWidgetValue(type), |
| 706 | validation: { type: "text", pattern: "" } |
| 707 | }; |
| 708 | case "job title": |
| 709 | return { |
| 710 | ...defaultOpt, |
| 711 | defaultValue: getWidgetValue(type), |
| 712 | validation: { type: "text", pattern: "" } |
| 713 | }; |
| 714 | case "date": { |
| 715 | const dateFormat = owner?.DateFormat |
no test coverage detected