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

Hotfix Answer admin + amélioration btn validation

parent 576775f9
......@@ -8,4 +8,32 @@ class ValidateAction extends CAction
$res = Answer::validate($_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
$idFs[] = $keyF;
}
$res = Form::getBySourceAndId($controller->costum["slug"]);
//Rest::json($res); exit;
$searchParams = $_POST;
$searchParams["count"] = true;
$answers=Answer::globalAutocomplete($res["form"], $searchParams);
......
......@@ -108,6 +108,7 @@ class Answer{
}
public static function globalAutocomplete($form, $searchParams){
//var_dump($form);
$searchParams["indexMin"] = (isset($searchParams["indexMin"])) ? $searchParams["indexMin"] : 0;
$searchParams["indexStep"] = (isset($searchParams["indexStep"])) ? $searchParams["indexStep"] : 100;
$mappingData=(isset($form["mapping"])) ? $form["mapping"] : array("name"=>"name", "address"=>"address");
......@@ -149,7 +150,7 @@ class Answer{
$query = Search::searchFilters($searchParams['filters'], $query);
}
$res= array();
//var_dump($query);exit;
//Rest::json($query);exit;
$res["results"] = PHDB::findAndLimitAndIndex ( self::COLLECTION , $query, $searchParams["indexStep"], $searchParams["indexMin"]);
if(isset($searchParams["count"]))
$res["count"][self::COLLECTION] = PHDB::count( self::COLLECTION , $query);
......
......@@ -184,10 +184,12 @@ class Form {
}
$res["form"]=PHDB::findOne( Form::COLLECTION, $queryForm );
$res["forms"] = [];
foreach ($res["form"]["subForms"] as $ix => $formId) {
$f = PHDB::findOne(Form::COLLECTION, ["id"=>$formId]);
$res["forms"][$formId] = $f;
}
if(!empty($res["form"]["subForms"])){
foreach ($res["form"]["subForms"] as $ix => $formId) {
$f = PHDB::findOne(Form::COLLECTION, ["id"=>$formId]);
$res["forms"][$formId] = $f;
}
}
return $res;
}
public static function getById($parentForm, $fields=array()){
......
......@@ -168,9 +168,10 @@ $paramsData = [
"validation" => [
"text" => "texte",
"number" => "Nombre",
"email" => "adresse mail"
"email" => "adresse mail",
"unique" => [ "siret" ]
]
];
];
if($saveOneByOne)
......
<?php
var_dump($input);
if($mode != "pdf"){
var_dump($input);
?>
<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">
<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>
......@@ -13,8 +14,8 @@ if($mode != "pdf"){
var paramsInput = <?php echo json_encode($input); ?>;
jQuery(document).ready(function() {
mylog.log("render form input","/modules/costum/views/tpls/forms/cplx/validate.php");
$("#validation<?php echo $kunik ?>").click(function(){
var params = {
$("#question<?php echo $key ?> #validation<?php echo $kunik ?>").off().click(function(){
var paramsValidate = {
answerId : answerId,
answer : answerObj.answers,
input : paramsInput
......@@ -23,7 +24,7 @@ if($mode != "pdf"){
ajaxPost(
null,
baseUrl+"/survey/answer/validate",
params,
paramsValidate,
function(data){
toastr.success("Le formulaire à été soumis");
},
......@@ -34,9 +35,5 @@ if($mode != "pdf"){
});
});
</script>
<?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