Signed-off-by: Shea Levy <shea@shealevy.com>
VZX6HJ3I35NVK6L4FP7ASLNAMLMGPAESPQAAYZEUCXYKFUA6HTAQC
NIX2TKYVRRIQNW447RY2HKV6LMGWJIROXBWPMGAY744PI4OTST6AC
K3HODXGHZ47WWSTEKUFCAPRJYCM564XF6YVE2QM37HPR5RQMFCWQC
ODNCGFQ5FPKFI624BVMLW7PJ2EFJOR3TY66OCZM42UNNTWBCF2TQC
ZFEN2MAOJRRQEIORSK2N6PNAWGBEN2WNAWA6IWUVOHP5I5PQC6JAC
3HZY24CX4U2TO74HOY4YX3LBJIYF4DLXHCIY7J2RASAC4COMSMZAC
RQI3GRC6NSTPQMBTTOM37ITBZQIROTIGAIPDCVZ672TSEJVECB2AC
TQVKZQUGCFYNH5P56LXMXRXZNTD56MH5T5GX2BMQ5YSRPGHAUYMAC
OX6NYJDVCDX2UCJ4QQMTRJVZ535NOMCJGYCHDLCADJPQI7RMCXPQC
foreach my $param (keys %{$c->stash->{params}}) {
next unless $param =~ /^input-(\w+)-name$/;
my $baseName = $1;
next if $baseName eq "template";
my $name = $c->stash->{params}->{$param};
my $type = $c->stash->{params}->{"input-$baseName-type"};
my $values = $c->stash->{params}->{"input-$baseName-values"};
foreach my $name (keys %{$c->stash->{params}->{inputs}}) {
my $inputData = $c->stash->{params}->{inputs}->{$name};
my $type = $inputData->{type};
my $values = $inputData->{values};
my $emailresponsible = defined $inputData->{emailresponsible} ? 1 : 0;
var formElements = $(this).parents("form").serializeArray();
var data = { 'inputs': {} };
var inputs = {};
for (var i = 0; i < formElements.length; i++) {
var elem = formElements[i];
var match = elem.name.match(/^input-(\w+)-(\w+)$/);
if (match === null) {
data[elem.name] = elem.value;
} else {
var baseName = match[1];
var param = match[2];
if (baseName === "template") {
continue;
}
if (!(baseName in inputs)) {
inputs[baseName] = {};
}
if (param === "name") {
data.inputs[elem.value] = inputs[baseName];
} else {
inputs[baseName][param] = elem.value;
}
}
}