diff --git a/app/Http/Controllers/Forms/RecordController.php b/app/Http/Controllers/Forms/RecordController.php
new file mode 100644
index 0000000..2a20910
--- /dev/null
+++ b/app/Http/Controllers/Forms/RecordController.php
@@ -0,0 +1,24 @@
+authorize('delete', $form);
+
+ $record = $form->submissions()->where('id', $recordId)->firstOrFail();
+ $record->delete();
+
+ return $this->success([
+ 'message' => 'Record successfully removed.'
+ ]);
+ }
+
+}
diff --git a/app/Http/Resources/FormSubmissionResource.php b/app/Http/Resources/FormSubmissionResource.php
index 9c59516..e500dd1 100644
--- a/app/Http/Resources/FormSubmissionResource.php
+++ b/app/Http/Resources/FormSubmissionResource.php
@@ -16,7 +16,7 @@ class FormSubmissionResource extends JsonResource
public function toArray($request)
{
$this->generateFileLinks();
- $this->addTimestamp();
+ $this->addExtraData();
return [
'data' => $this->data,
@@ -25,10 +25,11 @@ class FormSubmissionResource extends JsonResource
];
}
- private function addTimestamp()
+ private function addExtraData()
{
$this->data = array_merge($this->data, [
- "created_at" => $this->created_at->toDateTimeString()
+ "created_at" => $this->created_at->toDateTimeString(),
+ 'id' => $this->id
]);
}
diff --git a/app/Service/OpenAi/Utils/JsonFixer.php b/app/Service/OpenAi/Utils/JsonFixer.php
index f65cfa8..aa54557 100644
--- a/app/Service/OpenAi/Utils/JsonFixer.php
+++ b/app/Service/OpenAi/Utils/JsonFixer.php
@@ -11,7 +11,7 @@ namespace App\Service\OpenAi\Utils;
* Licensed under MIT license.
*/
-use App\Exceptions\Coursework\InvalidJsonException;
+use Aws\Exception\InvalidJsonException;
/**
* Attempts to fix truncated JSON by padding contextual counterparts at the end.
diff --git a/resources/js/components/open/components/RecordOperations.vue b/resources/js/components/open/components/RecordOperations.vue
new file mode 100644
index 0000000..11de349
--- /dev/null
+++ b/resources/js/components/open/components/RecordOperations.vue
@@ -0,0 +1,65 @@
+
+
Actions
@@ -39,7 +39,7 @@
+ {{ form.views_count }} view{{ form.views_count > 0 ? 's' : '' }} + - {{ form.submissions_count }} submission{{ form.submissions_count > 0 ? 's' : '' }} -
This form stopped accepting submissions on the {{ @@ -208,7 +208,7 @@ export default { this.workingForm = new Form(this.form) } }, - + methods: { openCrisp() { window.$crisp.push(['do', 'chat:show']) diff --git a/routes/api.php b/routes/api.php index 29257b1..e588568 100644 --- a/routes/api.php +++ b/routes/api.php @@ -14,6 +14,7 @@ use App\Http\Controllers\Forms\FormStatsController; use App\Http\Controllers\Forms\PublicFormController; use App\Http\Controllers\Forms\FormSubmissionController; use App\Http\Controllers\Forms\FormController; +use App\Http\Controllers\Forms\RecordController; use App\Http\Controllers\WorkspaceController; use App\Http\Controllers\TemplateController; use App\Http\Controllers\Forms\Integration\FormZapierWebhookController; @@ -83,6 +84,9 @@ Route::group(['middleware' => 'auth:api'], function () { Route::get('/{id}/submissions', [FormSubmissionController::class, 'submissions'])->name('submissions'); Route::get('/{id}/submissions/export', [FormSubmissionController::class, 'export'])->name('submissions.export'); Route::get('/{id}/submissions/file/{filename}', [FormSubmissionController::class, 'submissionFile'])->name('submissions.file'); + + Route::delete('/{id}/records/{recordid}/delete', [RecordController::class, 'delete'])->name('records.delete'); + // Form Admin tool Route::put('/{id}/regenerate-link/{option}', [FormController::class, 'regenerateLink'])