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:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user