-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1019 from pateljannat/issues-34
fix: misc issues
- Loading branch information
Showing
16 changed files
with
330 additions
and
83 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<template> | ||
<Dialog | ||
v-model="show" | ||
:options="{ | ||
title: __('Add an assessment'), | ||
size: 'sm', | ||
actions: [ | ||
{ | ||
label: __('Submit'), | ||
variant: 'solid', | ||
onClick: (close) => addAssessment(close), | ||
}, | ||
], | ||
}" | ||
> | ||
<template #body-content> | ||
<div class="space-y-4"> | ||
<FormControl | ||
type="select" | ||
:options="assessmentTypes" | ||
v-model="assessmentType" | ||
:label="__('Type')" | ||
/> | ||
<Link | ||
v-model="assessment" | ||
:doctype="assessmentType" | ||
:label="__('Assessment')" | ||
/> | ||
</div> | ||
</template> | ||
</Dialog> | ||
</template> | ||
<script setup> | ||
import { Dialog, FormControl, createResource } from 'frappe-ui' | ||
import Link from '@/components/Controls/Link.vue' | ||
import { computed, ref } from 'vue' | ||
import { showToast } from '@/utils' | ||
const show = defineModel() | ||
const assessmentType = ref(null) | ||
const assessment = ref(null) | ||
const assessments = defineModel('assessments') | ||
const props = defineProps({ | ||
batch: { | ||
type: String, | ||
default: null, | ||
}, | ||
}) | ||
const assessmentResource = createResource({ | ||
url: 'frappe.client.insert', | ||
makeParams(values) { | ||
return { | ||
doc: { | ||
doctype: 'LMS Assessment', | ||
parent: props.batch, | ||
parenttype: 'LMS Batch', | ||
parentfield: 'assessment', | ||
assessment_type: assessmentType.value, | ||
assessment_name: assessment.value, | ||
}, | ||
} | ||
}, | ||
}) | ||
const addAssessment = (close) => { | ||
assessmentResource.submit( | ||
{}, | ||
{ | ||
onSuccess(data) { | ||
assessments.value.reload() | ||
showToast(__('Success'), __('Assessment added successfully'), 'check') | ||
close() | ||
}, | ||
} | ||
) | ||
} | ||
const assessmentTypes = computed(() => { | ||
return [ | ||
{ label: 'Quiz', value: 'LMS Quiz' }, | ||
{ label: 'Assignment', value: 'LMS Assignment' }, | ||
] | ||
}) | ||
</script> |
Oops, something went wrong.