Signature block (img) (#39)

* Signature block (img)

* Singature input UI changes

* Style the signature input

Co-authored-by: Julien Nahum <jhumanj@MacBook-Pro-de-Julien.local>
This commit is contained in:
Chirag
2022-12-22 16:23:33 +05:30
committed by GitHub
parent 9936cb3389
commit 07f44ec048
10 changed files with 141 additions and 1 deletions

View File

@@ -89,6 +89,11 @@ class StoreFormSubmissionJob implements ShouldQueue
}
}
}
// For Singrature
if($this->form->is_pro && $field['type'] == 'signature') {
$finalData[$field['id']] = $this->storeSignature($answerValue);
}
}
return $finalData;
@@ -130,6 +135,21 @@ class StoreFormSubmissionJob implements ShouldQueue
return $fileNameParser->getMovedFileName();
}
private function storeSignature(?string $value)
{
if ($value == null || !isset(explode(',', $value)[1])) {
return null;
}
$fileName = 'sign_'.(string) Str::uuid().'.png';
$newPath = Str::of(PublicFormController::FILE_UPLOAD_PATH)->replace('?', $this->form->id);
$completeNewFilename = $newPath.'/'.$fileName;
Storage::disk('s3')->put($completeNewFilename, base64_decode(explode(',', $value)[1]));
return $fileName;
}
/**
* Adds prefill from hidden fields
*