This commit is contained in:
2020-09-29 21:48:13 +00:00
parent cb59cc910b
commit 0e6d902af6
3 changed files with 96 additions and 2 deletions

View File

@@ -9,12 +9,16 @@ todo: Joyce issue report:
ISSUE NOTICED if delete (the 2 or 0.5 etc) and attempt to leave blank when click on Save get error "Validation error Object did not pass validation"
(nothing is logged to the Server Log)
BUGBUG: decimal control displays blank even when value comes from server. It's ok when you manually enter but reverts to blank even though the value is there on open
todo: bizrule constrain 'scale' value on pdf options report designer to 1-0 range, currently can type anything in there
### SMALL QUICK ITEMS #####
todo: now as a desktop app it's trying to automatically go to index.html all of a sudden
https://stackoverflow.com/questions/45412014/how-do-i-set-the-start-url-of-a-manifest-json-to-be-the-root-of-the-site
todo: is notifynewcount request double sending? It seems like it appears twice at the same moment in the log
todo: new small log, old small to medium, old medium to large
todo: login button can be obscured by footer, this should not happen
todo: Joyce issue report:
can't delete second report template

View File

@@ -375,6 +375,89 @@ export default {
return err;
},
///////////////////////////////
// MAX VALUE
// Maximum numeric value
// maxValue is lt or eq
// empty is considered valid for this rule
//
maxValueValid(vm, ref, maxValue) {
if (vm.formState.loading) {
return true;
}
let ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
if (!isNumber(value)) {
return true;
}
//Ok, were here with a non empty number of some kind
if (value <= maxValue) {
return true;
}
// "ErrorFieldValueNumberGreaterThanMax": "Value must be less than XX"
let err = `${vm.$ay
.t("ErrorFieldValueNumberGreaterThanMax")
.replace("{0}", maxValue)} ${maxValue}`;
//Update the form status
this.setFormState({
vm: vm,
valid: false
});
return err;
},
///////////////////////////////
// MIN VALUE
// Minimum numeric value
// minValue is gt or eq
// empty is considered valid for this rule
//
minValueValid(vm, ref, minValue) {
if (vm.formState.loading) {
return true;
}
let ctrl = getControl(vm, ref);
if (typeof ctrl == "undefined") {
return true;
}
let value = getControlValue(ctrl);
if (isEmpty(value)) {
return true;
}
if (!isNumber(value)) {
return true;
}
//Ok, were here with a non empty number of some kind
//actual check
if (value >= minValue) {
return true;
}
// "ErrorFieldValueNumberLessThanMin": "Value must be more than XX"
let err = `${vm.$ay
.t("ErrorFieldValueNumberLessThanMin")
.replace("{0}", minValue)} ${minValue}`;
//Update the form status
this.setFormState({
vm: vm,
valid: false
});
return err;
},
///////////////////////////////
// EMAIL IS VALID-ish
//https://tylermcginnis.com/validate-email-address-javascript/
emailValid(vm, ref) {

View File

@@ -287,6 +287,7 @@
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
{{ obj.scale }}
<gz-decimal
v-model="obj.scale"
:readonly="formState.readOnly"
@@ -294,6 +295,12 @@
:clearable="!formState.readOnly"
@click:clear="fieldValueChanged('scale')"
:label="$ay.t('ReportScale')"
:rules="[
form().decimalValid(this, 'scale'),
form().required(this, 'scale'),
form().minValueValid(this, 'scale', 0.1),
form().maxValueValid(this, 'scale', 2)
]"
:error-messages="form().serverErrors(this, 'scale')"
ref="scale"
:data-cy="!!$ay.dev ? 'scale' : false"
@@ -522,7 +529,7 @@ Handlebars.registerHelper('loud', function (aString) {
pageRanges: null,
preferCSSPageSize: false,
printBackground: false,
scale: 1
scale: 1 //Defaults to 1. Scale amount must be between 0.1 and 2.
},
formState: {
ready: false,