Commit 6b9474f3 authored by Raph El's avatar Raph El
Browse files

Hotfix Answer admin + amélioration btn validation

parent 576775f9
...@@ -8,4 +8,32 @@ class ValidateAction extends CAction ...@@ -8,4 +8,32 @@ class ValidateAction extends CAction
$res = Answer::validate($_POST); $res = Answer::validate($_POST);
Rest::json($_POST); Rest::json($_POST);
} }
} }
\ No newline at end of file
"organizations" : [
{
"from" : "aressForm1.multitextvalidationaressForm110",
"to" : "name"
},
{
"from" : "aressForm1.multitextvalidationaressForm111",
"to" : "sigle"
},
{
"from" : "aressForm1.multitextvalidationaressForm112",
"to" : "siren"
},
{
"from" : "aressForm1.multitextvalidationaressForm19",
"to" : "email"
},
{
"from" : "aressForm1.multitextvalidationaressForm113",
"to" : "WALDEC_RNA
"
},
{
"from" : "aressForm1.multitextvalidationaressForm113",
"to" : "siren"
}
]
\ No newline at end of file
...@@ -24,7 +24,6 @@ class DirectoryAction extends CAction ...@@ -24,7 +24,6 @@ class DirectoryAction extends CAction
$idFs[] = $keyF; $idFs[] = $keyF;
} }
$res = Form::getBySourceAndId($controller->costum["slug"]); $res = Form::getBySourceAndId($controller->costum["slug"]);
//Rest::json($res); exit;
$searchParams = $_POST; $searchParams = $_POST;
$searchParams["count"] = true; $searchParams["count"] = true;
$answers=Answer::globalAutocomplete($res["form"], $searchParams); $answers=Answer::globalAutocomplete($res["form"], $searchParams);
......
...@@ -108,6 +108,7 @@ class Answer{ ...@@ -108,6 +108,7 @@ class Answer{
} }
public static function globalAutocomplete($form, $searchParams){ public static function globalAutocomplete($form, $searchParams){
//var_dump($form);
$searchParams["indexMin"] = (isset($searchParams["indexMin"])) ? $searchParams["indexMin"] : 0; $searchParams["indexMin"] = (isset($searchParams["indexMin"])) ? $searchParams["indexMin"] : 0;
$searchParams["indexStep"] = (isset($searchParams["indexStep"])) ? $searchParams["indexStep"] : 100; $searchParams["indexStep"] = (isset($searchParams["indexStep"])) ? $searchParams["indexStep"] : 100;
$mappingData=(isset($form["mapping"])) ? $form["mapping"] : array("name"=>"name", "address"=>"address"); $mappingData=(isset($form["mapping"])) ? $form["mapping"] : array("name"=>"name", "address"=>"address");
...@@ -149,7 +150,7 @@ class Answer{ ...@@ -149,7 +150,7 @@ class Answer{
$query = Search::searchFilters($searchParams['filters'], $query); $query = Search::searchFilters($searchParams['filters'], $query);
} }
$res= array(); $res= array();
//var_dump($query);exit; //Rest::json($query);exit;
$res["results"] = PHDB::findAndLimitAndIndex ( self::COLLECTION , $query, $searchParams["indexStep"], $searchParams["indexMin"]); $res["results"] = PHDB::findAndLimitAndIndex ( self::COLLECTION , $query, $searchParams["indexStep"], $searchParams["indexMin"]);
if(isset($searchParams["count"])) if(isset($searchParams["count"]))
$res["count"][self::COLLECTION] = PHDB::count( self::COLLECTION , $query); $res["count"][self::COLLECTION] = PHDB::count( self::COLLECTION , $query);
......
...@@ -184,10 +184,12 @@ class Form { ...@@ -184,10 +184,12 @@ class Form {
} }
$res["form"]=PHDB::findOne( Form::COLLECTION, $queryForm ); $res["form"]=PHDB::findOne( Form::COLLECTION, $queryForm );
$res["forms"] = []; $res["forms"] = [];
foreach ($res["form"]["subForms"] as $ix => $formId) { if(!empty($res["form"]["subForms"])){
$f = PHDB::findOne(Form::COLLECTION, ["id"=>$formId]); foreach ($res["form"]["subForms"] as $ix => $formId) {
$res["forms"][$formId] = $f; $f = PHDB::findOne(Form::COLLECTION, ["id"=>$formId]);
} $res["forms"][$formId] = $f;
}
}
return $res; return $res;
} }
public static function getById($parentForm, $fields=array()){ public static function getById($parentForm, $fields=array()){
......
...@@ -168,9 +168,10 @@ $paramsData = [ ...@@ -168,9 +168,10 @@ $paramsData = [
"validation" => [ "validation" => [
"text" => "texte", "text" => "texte",
"number" => "Nombre", "number" => "Nombre",
"email" => "adresse mail" "email" => "adresse mail",
"unique" => [ "siret" ]
] ]
]; ];
if($saveOneByOne) if($saveOneByOne)
......
<?php <?php
var_dump($input);
if($mode != "pdf"){ if($mode != "pdf"){
var_dump($input);
?> ?>
<div class=""> <div class="">
<label for="<?php echo $key ?>"><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn ?></h4></label> <label for="validation<?php echo $kunik ?>"><h4 style="color:<?php echo ($titleColor) ? $titleColor : "black"; ?>"><?php echo $label.$editQuestionBtn ?></h4></label>
<div class="text-center"> <div class="text-center">
<button class="btn btn-primary" id="validation<?php echo $kunik ?>">Validation</button> <a href="javascript:;" class="btn btn-primary" id="validation<?php echo $kunik ?>">Validation</a>
</div> </div>
</div> </div>
...@@ -13,8 +14,8 @@ if($mode != "pdf"){ ...@@ -13,8 +14,8 @@ if($mode != "pdf"){
var paramsInput = <?php echo json_encode($input); ?>; var paramsInput = <?php echo json_encode($input); ?>;
jQuery(document).ready(function() { jQuery(document).ready(function() {
mylog.log("render form input","/modules/costum/views/tpls/forms/cplx/validate.php"); mylog.log("render form input","/modules/costum/views/tpls/forms/cplx/validate.php");
$("#validation<?php echo $kunik ?>").click(function(){ $("#question<?php echo $key ?> #validation<?php echo $kunik ?>").off().click(function(){
var params = { var paramsValidate = {
answerId : answerId, answerId : answerId,
answer : answerObj.answers, answer : answerObj.answers,
input : paramsInput input : paramsInput
...@@ -23,7 +24,7 @@ if($mode != "pdf"){ ...@@ -23,7 +24,7 @@ if($mode != "pdf"){
ajaxPost( ajaxPost(
null, null,
baseUrl+"/survey/answer/validate", baseUrl+"/survey/answer/validate",
params, paramsValidate,
function(data){ function(data){
toastr.success("Le formulaire à été soumis"); toastr.success("Le formulaire à été soumis");
}, },
...@@ -34,9 +35,5 @@ if($mode != "pdf"){ ...@@ -34,9 +35,5 @@ if($mode != "pdf"){
}); });
}); });
</script> </script>
<?php } ?> <?php } ?>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment