Browse Source

Don't save table rows if all values are empty (or $0.00). Fix css errors.

pull/160/head
ariannedee 5 years ago
parent
commit
ebc0c4f460
3 changed files with 15 additions and 8 deletions
  1. +1
    -1
      edivorce/apps/core/static/css/main.css
  2. +3
    -2
      edivorce/apps/core/static/css/main.scss
  3. +11
    -5
      edivorce/apps/core/static/js/main.js

+ 1
- 1
edivorce/apps/core/static/css/main.css
File diff suppressed because it is too large
View File


+ 3
- 2
edivorce/apps/core/static/css/main.scss View File

@ -115,8 +115,9 @@ a {
&:hover { &:hover {
color: darken( $brand-links, 10% ); color: darken( $brand-links, 10% );
text-decoration: underline; text-decoration: underline;
-webkit-transition: all 0.1s eease-in-out;
transition: all 0.1s eease-in-out;
outline: none;
-webkit-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out;
} }
} }


+ 11
- 5
edivorce/apps/core/static/js/main.js View File

@ -450,7 +450,7 @@ $(function () {
$('#claimant_children').find('tbody:first').find('tr:gt(0)').each(function () { $('#claimant_children').find('tbody:first').find('tr:gt(0)').each(function () {
var childData = {}; var childData = {};
$(this).find('.child-field').each(function () { $(this).find('.child-field').each(function () {
childData[$(this).attr('data-target-form-field')] = $(this).text();
childData[$(this).attr('data-target-form-field')] = $(this).text().trim();
}); });
childrenData.push(childData); childrenData.push(childData);
}); });
@ -497,7 +497,7 @@ $(function () {
questionWell.find('.required').hide(); questionWell.find('.required').hide();
$(inputField).removeClass('error'); $(inputField).removeClass('error');
if (inputField.type === 'text') { if (inputField.type === 'text') {
if (inputField.value === '') {
if (inputField.value.trim() === '') {
isNotEmpty = false; isNotEmpty = false;
$(inputField).addClass('error'); $(inputField).addClass('error');
questionWell.addClass('error'); questionWell.addClass('error');
@ -960,10 +960,17 @@ var saveListControlRow = function(tableId) {
tableRows.each(function() { tableRows.each(function() {
var item = {}; var item = {};
var hasVal = false;
$(this).find(saveSelector).each(function() { $(this).find(saveSelector).each(function() {
item[$(this).prop('name')] = $(this).val();
var val = $(this).val().trim();
item[$(this).prop('name')] = val;
if (val !== "" && val !== '0.00') {
hasVal = true;
}
}); });
payload.push(item);
if (hasVal) {
payload.push(item);
}
}); });
var jsonPayload = JSON.stringify(payload); var jsonPayload = JSON.stringify(payload);
@ -971,7 +978,6 @@ var saveListControlRow = function(tableId) {
}; };
var replaceSuffix = function(str, suffix) { var replaceSuffix = function(str, suffix) {
if (str !== undefined && str.lastIndexOf('_') !== -1) { if (str !== undefined && str.lastIndexOf('_') !== -1) {
str = str.substr(0, str.lastIndexOf('_')); str = str.substr(0, str.lastIndexOf('_'));


Loading…
Cancel
Save