Files
vivespos-landing/modules/backend/widgets/table/assets/js/table.validator.base.js
avives 1f72193a64
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
- Base: wintercms/winter branch 1.2 (full framework)
- Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS
- Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication
- Partials: hero (offline-first), features, modes (offline/nube toggle),
  screenshots, pricing (3 planes), comparison, FAQ, CTA
- Plugin VivesPOS.Site with ContactForm
- Dockerfile: PHP 8.2 Apache, port 80, healthcheck
- Added winter/wn-pages, blog, sitemap, seo plugins
- Active theme set to vivespos
2026-08-21 19:29:00 -06:00

77 lines
2.1 KiB
JavaScript

/*
* Base class for the table validators.
*/
+function ($) { "use strict";
// VALIDATOR NAMESPACES
// ============================
if ($.wn.table === undefined)
throw new Error("The $.wn.table namespace is not defined. Make sure that the table.js script is loaded.");
if ($.wn.table.validator === undefined)
$.wn.table.validator = {}
// CLASS DEFINITION
// ============================
var Base = function(options) {
//
// State properties
//
this.options = options
}
/*
* Validates a value and returns the error message. If there
* are no errors, returns undefined.
* The rowData parameter is an object containing all values in the
* target row.
*/
Base.prototype.validate = function(value, rowData) {
if (this.options.requiredWith !== undefined && !this.rowHasValue(this.options.requiredWith, rowData))
return
return this.validateValue(value, rowData)
}
/*
* Validates a value and returns the error message. If there
* are no errors, returns undefined. This method should be redefined
* in descendant classes.
* The rowData parameter is an object containing all values in the
* target row.
*/
Base.prototype.validateValue = function(value, rowData) {
}
Base.prototype.trim = function(value) {
if (String.prototype.trim)
return value.trim()
return value.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')
}
Base.prototype.getMessage = function(defaultValue) {
if (this.options.message !== undefined)
return this.options.message
return defaultValue
}
Base.prototype.rowHasValue = function(columnName, rowData) {
if (rowData[columnName] === undefined)
return false
if (typeof rowData[columnName] == 'boolean')
return rowData[columnName]
var value = this.trim(String(rowData[columnName]))
return value.length > 0
}
$.wn.table.validator.base = Base;
}(window.jQuery);