diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 27978588..aa535fad 100644 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -103,6 +103,23 @@ class FormController extends Controller } } + public function ajaxsubmit(Request $request) { + $post = $request->except('_token'); + $formdata = $request->session()->get('formdata'); + if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') { + $post = $this->processformdata($formdata->form_id, $post); + $finfo = LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $post, 'entity_id' => $post['form_id'], 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]); + //Log::debug(print_r($finfo, true)); + if($finfo->status == 'success') { + return response()->json(['status' => 'success']); + } else { + return response()->json(['status' => 'failure']); + } + } else { + return response()->json(['status' => 'failure']); + } + } + protected function processformdata($form, $post) { switch($form) { case '1650365556-f06dde85-6138-4dae-9c23-5067e318c522': diff --git a/composer.json b/composer.json index 040c9fdf..ab8f8602 100755 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "require": { "php": "^7.3|^8.0", "arrilot/laravel-widgets": "^3.13", + "baopham/dynamodb": "^6.1", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", diff --git a/composer.lock b/composer.lock index b95028ec..2d8db565 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8769036ccc97e257ed44ee87f7e98df6", + "content-hash": "af3e22a28807021ab01a150a444be582", "packages": [ { "name": "arrilot/laravel-widgets", @@ -269,6 +269,63 @@ }, "time": "2022-01-14T19:29:33+00:00" }, + { + "name": "baopham/dynamodb", + "version": "6.1.3", + "source": { + "type": "git", + "url": "https://github.com/baopham/laravel-dynamodb.git", + "reference": "963811691313124e7562a02aefdcc31fdbd75e78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/baopham/laravel-dynamodb/zipball/963811691313124e7562a02aefdcc31fdbd75e78", + "reference": "963811691313124e7562a02aefdcc31fdbd75e78", + "shasum": "" + }, + "require": { + "aws/aws-sdk-php": "^3.0.0", + "illuminate/database": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0 || ^7.0 || ^8.0 || ^9.0", + "illuminate/support": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "orchestra/testbench": "~3.0 || ~5.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "BaoPham\\DynamoDb\\DynamoDbServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "BaoPham\\DynamoDb\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bao Pham", + "email": "gbaopham@gmail.com" + } + ], + "description": "Eloquent syntax for DynamoDB", + "keywords": [ + "aws", + "dynamodb", + "laravel" + ], + "support": { + "issues": "https://github.com/baopham/laravel-dynamodb/issues", + "source": "https://github.com/baopham/laravel-dynamodb/tree/6.1.3" + }, + "time": "2022-02-10T16:53:52+00:00" + }, { "name": "brick/math", "version": "0.9.2", diff --git a/config/app.php b/config/app.php index f8ca479a..6ba1111e 100755 --- a/config/app.php +++ b/config/app.php @@ -178,6 +178,7 @@ return [ App\Providers\RouteServiceProvider::class, Maatwebsite\Excel\ExcelServiceProvider::class, + BaoPham\DynamoDb\DynamoDbServiceProvider::class, ], diff --git a/resources/views/form/common.blade.php b/resources/views/form/common.blade.php index 4f20c86b..e160e66b 100644 --- a/resources/views/form/common.blade.php +++ b/resources/views/form/common.blade.php @@ -3,9 +3,10 @@
@include('layouts.shared/title-meta', ['title' => "Form"]) @include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? '']) + -