fixed display submissions bug
This commit is contained in:
parent
6ef2c500dc
commit
a72306c846
|
@ -146,7 +146,6 @@ exports.listSubmissions = function(req, res) {
|
|||
var _form = req.form;
|
||||
var _user = req.user;
|
||||
console.log('listSubmissions');
|
||||
// console.log(_form);
|
||||
|
||||
FormSubmission.find({ form: _form._id }).exec(function(err, _submissions) {
|
||||
if (err) {
|
||||
|
|
|
@ -205,13 +205,13 @@ FormSubmissionSchema.pre('save', function (next) {
|
|||
|
||||
//Check for IP Address of submitting person
|
||||
FormSubmissionSchema.pre('save', function (next){
|
||||
var that = this;
|
||||
var self = this;
|
||||
if(this.ipAddr){
|
||||
if(this.isModified('ipAddr')){
|
||||
satelize.satelize({ip: this.ipAddr}, function(err, geoData){
|
||||
if (err) next( new Error(err.message) );
|
||||
|
||||
that.geoLocation = JSON.parse(geoData);
|
||||
self.geoLocation = JSON.parse(geoData);
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
@ -222,23 +222,23 @@ FormSubmissionSchema.pre('save', function (next){
|
|||
//Generate autofilled PDF if flags are set
|
||||
FormSubmissionSchema.pre('save', function (next) {
|
||||
var fdfData, dest_filename, dest_path,
|
||||
that = this,
|
||||
self = this,
|
||||
_form = this.form;
|
||||
|
||||
|
||||
if(this.pdf && this.pdf.path){
|
||||
dest_filename = that.title.replace(/ /g,'')+'_submission_'+Date.now()+'.pdf';
|
||||
dest_filename = self.title.replace(/ /g,'')+'_submission_'+Date.now()+'.pdf';
|
||||
var __path = this.pdf.path.split('/').slice(0,this.pdf.path.split('/').length-1).join('/');
|
||||
dest_path = path.join(__path, dest_filename);
|
||||
|
||||
that.pdfFilePath = dest_path;
|
||||
self.pdfFilePath = dest_path;
|
||||
|
||||
pdfFiller.fillForm(that.pdf.path, dest_path, that.fdfData, function(err){
|
||||
pdfFiller.fillForm(self.pdf.path, dest_path, self.fdfData, function(err){
|
||||
if(err) {
|
||||
console.log('\n err.message: '+err.message);
|
||||
next( new Error(err.message) );
|
||||
}
|
||||
console.log('Field data from Form: '+that.title.replace(/ /g,'')+' outputed to new PDF: '+dest_path);
|
||||
console.log('Field data from Form: '+self.title.replace(/ /g,'')+' outputed to new PDF: '+dest_path);
|
||||
next();
|
||||
});
|
||||
} else {
|
||||
|
|
758
docs/example_submission_data.json
Normal file
758
docs/example_submission_data.json
Normal file
|
@ -0,0 +1,758 @@
|
|||
[
|
||||
{
|
||||
"_id": "56450d120761e9d7d68d3543",
|
||||
"lastModified": "2015-11-12T22:05:06.380Z",
|
||||
"fdfData": null,
|
||||
"admin": "55d270df2749c1ceb47c0f8b",
|
||||
"form": "5644dde5507b2572635dcd50",
|
||||
"title": "Sample Form",
|
||||
"timeElapsed": 11.925,
|
||||
"percentageComplete": 75,
|
||||
"__v": 0,
|
||||
"created": "2015-11-12T22:05:06.378Z",
|
||||
"form_fields": [
|
||||
{
|
||||
"_id": "5644e0d5507b2572635dcd56",
|
||||
"fieldValue": "",
|
||||
"fieldType": "statement",
|
||||
"title": "Statement2",
|
||||
"lastModified": "2015-11-12T18:56:21.730Z",
|
||||
"created": "2015-11-12T18:56:21.660Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": true,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.769Z",
|
||||
"title": "Short Text2",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "first",
|
||||
"_id": "5644dde7507b2572635dcd51",
|
||||
"created": "2015-11-12T18:43:51.290Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.770Z",
|
||||
"title": "Short Text3",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "first",
|
||||
"_id": "5644dde7507b2572635dcd52",
|
||||
"created": "2015-11-12T18:43:51.977Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Paragraph Text2",
|
||||
"fieldType": "textarea",
|
||||
"fieldValue": "first",
|
||||
"_id": "5644ddea507b2572635dcd54",
|
||||
"created": "2015-11-12T18:43:54.594Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Rating2",
|
||||
"fieldType": "rating",
|
||||
"fieldValue": 1,
|
||||
"_id": "5644e0d4507b2572635dcd55",
|
||||
"created": "2015-11-12T18:56:20.324Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "56450d1d0761e9d7d68d3544",
|
||||
"lastModified": "2015-11-12T22:05:17.806Z",
|
||||
"fdfData": null,
|
||||
"admin": "55d270df2749c1ceb47c0f8b",
|
||||
"form": "5644dde5507b2572635dcd50",
|
||||
"title": "Sample Form",
|
||||
"timeElapsed": 10.301,
|
||||
"percentageComplete": 75,
|
||||
"__v": 0,
|
||||
"created": "2015-11-12T22:05:17.805Z",
|
||||
"form_fields": [
|
||||
{
|
||||
"_id": "5644e0d5507b2572635dcd56",
|
||||
"fieldValue": "",
|
||||
"fieldType": "statement",
|
||||
"title": "Statement2",
|
||||
"lastModified": "2015-11-12T18:56:21.730Z",
|
||||
"created": "2015-11-12T18:56:21.660Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": true,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.769Z",
|
||||
"title": "Short Text2",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "second",
|
||||
"_id": "5644dde7507b2572635dcd51",
|
||||
"created": "2015-11-12T18:43:51.290Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.770Z",
|
||||
"title": "Short Text3",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "second",
|
||||
"_id": "5644dde7507b2572635dcd52",
|
||||
"created": "2015-11-12T18:43:51.977Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Paragraph Text2",
|
||||
"fieldType": "textarea",
|
||||
"fieldValue": "second",
|
||||
"_id": "5644ddea507b2572635dcd54",
|
||||
"created": "2015-11-12T18:43:54.594Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Rating2",
|
||||
"fieldType": "rating",
|
||||
"fieldValue": 3,
|
||||
"_id": "5644e0d4507b2572635dcd55",
|
||||
"created": "2015-11-12T18:56:20.324Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "56450d260761e9d7d68d3545",
|
||||
"lastModified": "2015-11-12T22:05:26.874Z",
|
||||
"fdfData": null,
|
||||
"admin": "55d270df2749c1ceb47c0f8b",
|
||||
"form": "5644dde5507b2572635dcd50",
|
||||
"title": "Sample Form",
|
||||
"timeElapsed": 7.975,
|
||||
"percentageComplete": 75,
|
||||
"__v": 0,
|
||||
"created": "2015-11-12T22:05:26.874Z",
|
||||
"form_fields": [
|
||||
{
|
||||
"_id": "5644e0d5507b2572635dcd56",
|
||||
"fieldValue": "",
|
||||
"fieldType": "statement",
|
||||
"title": "Statement2",
|
||||
"lastModified": "2015-11-12T18:56:21.730Z",
|
||||
"created": "2015-11-12T18:56:21.660Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": true,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.769Z",
|
||||
"title": "Short Text2",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "third",
|
||||
"_id": "5644dde7507b2572635dcd51",
|
||||
"created": "2015-11-12T18:43:51.290Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.770Z",
|
||||
"title": "Short Text3",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "third",
|
||||
"_id": "5644dde7507b2572635dcd52",
|
||||
"created": "2015-11-12T18:43:51.977Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Paragraph Text2",
|
||||
"fieldType": "textarea",
|
||||
"fieldValue": "third",
|
||||
"_id": "5644ddea507b2572635dcd54",
|
||||
"created": "2015-11-12T18:43:54.594Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Rating2",
|
||||
"fieldType": "rating",
|
||||
"fieldValue": 2,
|
||||
"_id": "5644e0d4507b2572635dcd55",
|
||||
"created": "2015-11-12T18:56:20.324Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"_id": "56450d320761e9d7d68d3546",
|
||||
"lastModified": "2015-11-12T22:05:38.717Z",
|
||||
"fdfData": null,
|
||||
"admin": "55d270df2749c1ceb47c0f8b",
|
||||
"form": "5644dde5507b2572635dcd50",
|
||||
"title": "Sample Form",
|
||||
"timeElapsed": 10.47,
|
||||
"percentageComplete": 75,
|
||||
"__v": 0,
|
||||
"created": "2015-11-12T22:05:38.716Z",
|
||||
"form_fields": [
|
||||
{
|
||||
"_id": "5644e0d5507b2572635dcd56",
|
||||
"fieldValue": "",
|
||||
"fieldType": "statement",
|
||||
"title": "Statement2",
|
||||
"lastModified": "2015-11-12T18:56:21.730Z",
|
||||
"created": "2015-11-12T18:56:21.660Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": true,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.769Z",
|
||||
"title": "Short Text2",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "fourth",
|
||||
"_id": "5644dde7507b2572635dcd51",
|
||||
"created": "2015-11-12T18:43:51.290Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.770Z",
|
||||
"title": "Short Text3",
|
||||
"fieldType": "textfield",
|
||||
"fieldValue": "fourth",
|
||||
"_id": "5644dde7507b2572635dcd52",
|
||||
"created": "2015-11-12T18:43:51.977Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Paragraph Text2",
|
||||
"fieldType": "textarea",
|
||||
"fieldValue": "fourth",
|
||||
"_id": "5644ddea507b2572635dcd54",
|
||||
"created": "2015-11-12T18:43:54.594Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"lastModified": "2015-11-12T21:30:20.771Z",
|
||||
"title": "Rating2",
|
||||
"fieldType": "rating",
|
||||
"fieldValue": 2,
|
||||
"_id": "5644e0d4507b2572635dcd55",
|
||||
"created": "2015-11-12T18:56:20.324Z",
|
||||
"validFieldTypes": [
|
||||
"textfield",
|
||||
"date",
|
||||
"email",
|
||||
"link",
|
||||
"legal",
|
||||
"url",
|
||||
"textarea",
|
||||
"statement",
|
||||
"welcome",
|
||||
"thankyou",
|
||||
"file",
|
||||
"dropdown",
|
||||
"scale",
|
||||
"rating",
|
||||
"radio",
|
||||
"checkbox",
|
||||
"hidden",
|
||||
"yes_no",
|
||||
"natural",
|
||||
"number"
|
||||
],
|
||||
"deletePreserved": false,
|
||||
"disabled": false,
|
||||
"required": true,
|
||||
"fieldOptions": [],
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$http', 'Upload', '$timeout', 'TimeCounter', 'Auth', 'FormFields', 'CurrentForm',
|
||||
function ($rootScope, $http, Upload, $timeout, TimeCounter, Auth, FormFields, CurrentForm) {
|
||||
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$http', 'Upload', 'CurrentForm',
|
||||
function ($rootScope, $http, Upload, CurrentForm) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/views/directiveViews/form/configure-form.client.view.html',
|
||||
restrict: 'E',
|
||||
|
@ -52,7 +52,6 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
|
|||
console.log(files)
|
||||
|
||||
if (files && files.length) {
|
||||
// for (var i = 0; i < files.length; i++) {
|
||||
var file = files[0];
|
||||
console.log(file);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$http', '$timeout', 'TimeCounter', 'Auth', 'FormFields',
|
||||
function ($rootScope, $q, $http, $timeout, TimeCounter, Auth, FormFields) {
|
||||
angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormFields',
|
||||
function ($rootScope, FormFields) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/views/directiveViews/form/edit-form.client.view.html',
|
||||
restrict: 'E',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', '$http', 'Upload', '$timeout', 'TimeCounter', 'Auth', 'FormFields',
|
||||
function ($rootScope, $http, Upload, $timeout, TimeCounter, Auth, FormFields) {
|
||||
angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope', '$http',
|
||||
function ($rootScope, $http) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/views/directiveViews/form/edit-submissions-form.client.view.html',
|
||||
restrict: 'E',
|
||||
|
@ -48,13 +48,18 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
var _tmpSubFormFields,
|
||||
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
||||
|
||||
// console.log('before textField2: '+data[0].form_fields[1].fieldValue);
|
||||
|
||||
//Iterate through form's submissions
|
||||
for(var i=0; i<data.length; i++){
|
||||
_tmpSubFormFields = _.merge(defaultFormFields, data[i].form_fields);
|
||||
data[i].form_fields = _tmpSubFormFields;
|
||||
for(var x=0; x<data[i].form_fields; x++){
|
||||
oldValue = data[i].form_fields[x].fieldValue || '';
|
||||
data[i].form_fields[x] = _.merge(defaultFormFields, data[i].form_fields);
|
||||
data[i].form_fields[x].fieldValue = oldValue;
|
||||
}
|
||||
data[i].selected = false;
|
||||
}
|
||||
console.log(data);
|
||||
// console.log('after textField2: '+data[0].form_fields[1].fieldValue);
|
||||
|
||||
$scope.table.rows = data;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('fieldIconDirective', function($http, $compile) {
|
||||
angular.module('forms').directive('fieldIconDirective', function() {
|
||||
|
||||
return {
|
||||
template: '<i class="{{typeIcon}}"></i>',
|
||||
|
@ -29,6 +29,5 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
|
|||
};
|
||||
$scope.typeIcon = iconTypeMap[$scope.typeName];
|
||||
},
|
||||
|
||||
};
|
||||
});
|
|
@ -8,8 +8,8 @@ var __indexOf = [].indexOf || function(item) {
|
|||
return -1;
|
||||
};
|
||||
|
||||
angular.module('forms').directive('fieldDirective', ['$templateCache', '$http', '$compile', '$rootScope',
|
||||
function($templateCache, $http, $compile, $rootScope) {
|
||||
angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope',
|
||||
function($http, $compile, $rootScope) {
|
||||
|
||||
|
||||
var getTemplateUrl = function(field) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', 'TimeCounter', 'Auth', '$filter', '$rootScope',
|
||||
function ($http, $timeout, TimeCounter, Auth, $filter, $rootScope) {
|
||||
angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth',
|
||||
function ($http, TimeCounter, $filter, $rootScope, Auth) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/views/directiveViews/form/submit-form.client.view.html',
|
||||
restrict: 'E',
|
||||
|
|
Loading…
Reference in a new issue