fix notes
This commit is contained in:
parent
24cbabeaf0
commit
418c7e1d9e
|
@ -732,6 +732,9 @@ class GetAddNotes(APIView):
|
||||||
if not _has_perm_on_agent(request.user, agent.agent_id):
|
if not _has_perm_on_agent(request.user, agent.agent_id):
|
||||||
raise PermissionDenied()
|
raise PermissionDenied()
|
||||||
|
|
||||||
|
if "note" not in request.data.keys():
|
||||||
|
return notify_error("Cannot add an empty note")
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"note": request.data["note"],
|
"note": request.data["note"],
|
||||||
"agent": agent.pk,
|
"agent": agent.pk,
|
||||||
|
|
|
@ -111,6 +111,7 @@ export default {
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
// notes tab logic
|
// notes tab logic
|
||||||
|
const noteText = ref("");
|
||||||
const notes = ref([]);
|
const notes = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
|
@ -126,17 +127,21 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNote() {
|
function addNote() {
|
||||||
|
noteText.value = "";
|
||||||
$q.dialog({
|
$q.dialog({
|
||||||
title: "Add Note",
|
title: "Add Note",
|
||||||
prompt: {
|
prompt: {
|
||||||
|
model: noteText,
|
||||||
type: "textarea",
|
type: "textarea",
|
||||||
|
isValid: val => !!val,
|
||||||
},
|
},
|
||||||
style: "width: 30vw; max-width: 50vw;",
|
style: "width: 30vw; max-width: 50vw;",
|
||||||
ok: { label: "Add" },
|
ok: { label: "Add" },
|
||||||
}).onOk(async data => {
|
cancel: true,
|
||||||
|
}).onOk(async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const result = await saveAgentNote({ agent_id: selectedAgent.value, note: data });
|
const result = await saveAgentNote({ agent_id: selectedAgent.value, note: noteText.value });
|
||||||
notifySuccess(result);
|
notifySuccess(result);
|
||||||
await getNotes();
|
await getNotes();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -152,6 +157,7 @@ export default {
|
||||||
prompt: {
|
prompt: {
|
||||||
model: note.note,
|
model: note.note,
|
||||||
type: "textarea",
|
type: "textarea",
|
||||||
|
isValid: val => !!val,
|
||||||
},
|
},
|
||||||
style: "width: 30vw; max-width: 50vw;",
|
style: "width: 30vw; max-width: 50vw;",
|
||||||
ok: { label: "Save" },
|
ok: { label: "Save" },
|
||||||
|
@ -204,6 +210,7 @@ export default {
|
||||||
pagination,
|
pagination,
|
||||||
selectedAgent,
|
selectedAgent,
|
||||||
tabHeight,
|
tabHeight,
|
||||||
|
noteText,
|
||||||
|
|
||||||
// non-reactive data
|
// non-reactive data
|
||||||
columns,
|
columns,
|
||||||
|
|
Loading…
Reference in New Issue