Skip to content

Commit

Permalink
Dev- Calculation Module (#1321)
Browse files Browse the repository at this point in the history
* Added - Calculation addon into module

* Added - Ignore adding smart tag for calculation compatibility

* Added - Smarttag supporting for calculation and format tag

* Fix - Save calculation formula formated way

* Added - Url support in calculation

* Added - Show error message when user doesnot change all formula into new version

* Added - Not supporting operator error message

* Merge pre-develop

* Added - codemirror file

* Added - codemirror file
  • Loading branch information
NirajChaudhary143 committed Sep 9, 2024
1 parent 91487ff commit 5efa798
Show file tree
Hide file tree
Showing 9 changed files with 514 additions and 25 deletions.
1 change: 1 addition & 0 deletions assets/css/code-mirror/show-hint.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions assets/extensions-json/sections/all_extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,23 +254,6 @@
"demo_video_url": "Q1-dja7m3Sc",
"popular_rank": 15
},
{
"title": "Calculations",
"slug": "everest-forms-calculations",
"name": "Everest Forms Calculations",
"image": "extensions-json/sections/images/calculations.png",
"excerpt": "Calculations add-on allows you to perform calculations on the number/range fields within the form.",
"link": "https://docs.everestforms.net/docs/calculations/?utm_source=dashboard-all-feature&utm_medium=card-documentation-link",
"released_date": "29/03/2022",
"plan": [
"personal",
"agency",
"themegrill agency"
],
"setting_url": "",
"demo_video_url": "WCsHC7NQ2QQ",
"popular_rank": 16
},
{
"title": "Post Submissions",
"slug": "everest-forms-post-submissions",
Expand Down Expand Up @@ -869,6 +852,23 @@
],
"setting_url": "admin.php?page=evf-settings&tab=integration&section=aweber",
"demo_video_url": ""
},
{
"title": "Calculations",
"slug": "everest-forms-calculations",
"name": "Everest Forms Calculations",
"image": "extensions-json/sections/images/calculations.png",
"excerpt": "Calculations add-on allows you to perform calculations on the number/range fields within the form.",
"link": "https://docs.everestforms.net/docs/calculations/?utm_source=dashboard-all-feature&utm_medium=card-documentation-link",
"released_date": "29/03/2022",
"plan": [
"personal",
"agency",
"themegrill agency"
],
"setting_url": "",
"demo_video_url": "WCsHC7NQ2QQ",
"popular_rank": 16
}
]
}
30 changes: 23 additions & 7 deletions assets/js/admin/form-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3618,12 +3618,19 @@ jQuery( function ( $ ) {

$( document.body ).on('click', '.smart-tag-field', function(e) {

var field_id = $( this ).data('field_id'),
field_label = $( this ).text(),
type = $( this ).data('type'),
$parent = $ ( this ).parent().parent().parent(),
$input = $parent.find('input[type=text]'),
$textarea = $parent.find('textarea');
var field_id = $( this ).data('field_id'),
field_label = $( this ).text(),
type = $( this ).data('type'),
$parent = $ ( this ).parent().parent().parent(),
$input = $parent.find('input[type=text]'),
$textarea = $parent.find('textarea'),
$calculationCodeMirror = $parent.find( '.CodeMirror');

//Return when calculation smart tag is clicked because we use codeMirror
if( 0 != $calculationCodeMirror.length ){
return;
}

if ( field_id !== 'fullname' && field_id !== 'email' && field_id !== 'subject' && field_id !== 'message' && 'other' !== type ) {
field_label = field_label.split(/[\s-_]/);
for(var i = 0 ; i < field_label.length ; i++){
Expand Down Expand Up @@ -3879,10 +3886,19 @@ jQuery( function ( $ ) {
"range-slider",
"payment-checkbox",
"payment-multiple",
"select",
"payment-total",
"radio",
'first-name',
'text',
'last-name',
'email',
'url'
];
$(document).find('.everest-forms-field').each(function() {
$fieldId = $(this).attr('data-field-id').split("-");
if( calculations.includes($(this).attr('data-field-type')) && $(el).parents('.everest-forms-field-option-row-calculation_field').attr('data-field-id') !== $(this).attr('data-field-id')) {
$(el).parent().find('.evf-smart-tag-lists .calculations').append('<li class = "smart-tag-field" data-type="field" data-field_id="'+$(this).attr('data-field-id')+'">'+$(this).find('.label-title .text').text()+'</li>');
$(el).parent().find('.evf-smart-tag-lists .calculations').append('<li class = "smart-tag-field" data-type="field" data-field_id="'+ $fieldId[1] +'">'+$(this).find('.label-title .text').text()+'</li>');
}
})
}
Expand Down
Loading

0 comments on commit 5efa798

Please sign in to comment.