-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3a703 admin edit submission #305
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c1bcfc6
wip: admin submission edit feature
madassdev b0f2e37
wip: refresh form submission after update
madassdev 3e8a429
wip: connect submissions page data to store
madassdev 504fef7
Fixed the submission loading issue
JhumanJ 7fb2d57
test: admin edit submission feature test
madassdev 582b893
Merge branch '3a703-admin-edit-submission' of https://github.com/Jhum…
madassdev 2104285
Merge branch 'main' into 3a703-admin-edit-submission
JhumanJ 4bc742e
Fix pending submission, editabe submission & more (#306)
JhumanJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware\Form; | ||
|
||
use App\Models\Forms\Form; | ||
use Closure; | ||
use Illuminate\Http\Request; | ||
|
||
class ResolveFormMiddleware | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next | ||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse | ||
*/ | ||
public function handle(Request $request, Closure $next, string $routeParamName = "id") | ||
{ | ||
$form = Form::where($routeParamName,$request->route($routeParamName))->firstOrFail(); | ||
$request->merge([ | ||
'form' => $form, | ||
]); | ||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template> | ||
<modal :show="show" max-width="lg" @close="emit('close')"> | ||
<open-form :theme="theme" :loading="false" :show-hidden="true" :form="form" :fields="form.properties" @submit="updateForm" :default-data-form="submission"> | ||
<template #submit-btn="{submitForm}"> | ||
<v-button :loading="loading" class="mt-2 px-8 mx-1" @click.prevent="submitForm"> | ||
Update Submission | ||
</v-button> | ||
</template> | ||
</open-form> | ||
</modal> | ||
</template> | ||
<script setup> | ||
import {ref, defineProps, defineEmits, onMounted } from 'vue' | ||
import OpenForm from '../forms/OpenForm.vue'; | ||
import { themes } from '~/lib/forms/form-themes.js' | ||
const props = defineProps({ | ||
show: { type: Boolean, required: true }, | ||
form: { type: Object, required: true }, | ||
theme:{type:Object, default:themes.default}, | ||
submission:{type:Object} | ||
}) | ||
|
||
let loading = ref(false) | ||
|
||
const emit = defineEmits(['close', 'updated']) | ||
const updateForm = (form, onFailure) =>{ | ||
loading.value = true | ||
form.put('/open/forms/' + props.form.id + '/submissions/'+props.submission.id).then((res) => { | ||
useAlert().success(res.message) | ||
loading.value = false | ||
emit('close') | ||
emit('updated', res.data.data) | ||
|
||
}).catch((error) => { | ||
console.error(error) | ||
loading.value = false | ||
onFailure() | ||
}) | ||
|
||
} | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of the
defaultDataForm
prop with an empty object as the default value is a good practice for Vue components, ensuring that the prop has a default state if not provided by the parent component. However, it's important to specify the type of the prop for better type checking and to avoid potential issues with unexpected prop types.Committable suggestion