{
    "customFields": {
        "form": [{
            "key": "name",
            "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
            "placeholder": "Full name"
            }, {
            "key": "nic",
            "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
            "placeholder": "Identity card number or passport number"
            }, {
            "key": "email",
            "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
            "placeholder": "Email address"
            },{
            "key": "to_meet",
            "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
            "placeholder": "Name of the person to meet"
          }],
        "schema": {
            "type": "object",
            "properties": {
              "name": {
                "title": "Name",
                "type": "string",
                "required":true
              },
              "nic": {
                "title": "ID",
                "type": "string",
                "required":true
              },
              "email":{
                "title": "Email",
                "type": "string",
                "pattern": "^\\S+@\\S+$",
                "validationMessage": "Not a vlid email address",
                "required":true
              },
              "to_meet": {
                 "title": "To meet",
                "type": "string",
                "required":true
              }
            },
            "required": [
              "name",
              "nic",
              "email",
              "to_meet"
            ]}
    },
    "onLoad": "if (scope.visitor != null ) { scope.customModel.nic =scope.visitor.employeeCode; var names = []; if(scope.visitor.firstName.length > 0) names.push(scope.visitor.firstName); if(scope.visitor.lastName.length > 0) names.push(scope.visitor.lastName); scope.customModel.name = names.length > 0 ? names.join(\" \") : \"\"; }; ",
    "beforeSubmit": "scope.defaultModel.employeeCode =scope.customModel.nic.toString(); var names = scope.customModel.name.split(\" \")\n            if(names.length > 0) {\n                if(names[0]) {\n                    scope.defaultModel.firstName = names[0]\n                    names.shift()\n                }\n            }\n            if(names.length > 0){\n                scope.defaultModel.lastName = names.join(\" \")\n            }else{scope.defaultModel.lastName =\"\"}\n  scope.defaultModel.email=scope.customModel.email \nconsole.log('Before submit:',scope.defaultModel)"
}