05444 save content of form in browser storage if not submitted (#26)
* Save content of form in browser storage if not submitted * Rename key form + fix tests
This commit is contained in:
@@ -58,7 +58,8 @@ class FormResource extends JsonResource
|
||||
'is_closed' => $this->is_closed,
|
||||
'is_password_protected' => false,
|
||||
'has_password' => $this->has_password,
|
||||
'max_number_of_submissions_reached' => $this->max_number_of_submissions_reached
|
||||
'max_number_of_submissions_reached' => $this->max_number_of_submissions_reached,
|
||||
'form_pending_submission_key' => $this->form_pending_submission_key
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,14 @@ class Form extends Model
|
||||
return ($this->closes_at && now()->gt($this->closes_at));
|
||||
}
|
||||
|
||||
public function getFormPendingSubmissionKeyAttribute()
|
||||
{
|
||||
if ($this->updated_at?->timestamp) {
|
||||
return "openform-" . $this->id . "-pending-submission-" . substr($this->updated_at?->timestamp, -6);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getMaxNumberOfSubmissionsReachedAttribute()
|
||||
{
|
||||
return ($this->max_submissions_count && $this->max_submissions_count <= $this->submissions_count);
|
||||
|
||||
Reference in New Issue
Block a user