mirror of
https://github.com/lucaspalomodevelop/eventcally.git
synced 2026-03-13 00:07:22 +00:00
Organisation einladen: Name auf Eindeutigkeit prüfen #311
This commit is contained in:
parent
73d3ca439b
commit
a023679920
@ -67,7 +67,7 @@ const CustomTypeahead = {
|
||||
vm.suggestions = response.data.items
|
||||
})
|
||||
},
|
||||
fetchDataDebounced: _.debounce(function(query) { this.fetchData(query) }, 200),
|
||||
fetchDataDebounced: _.debounce(function(query) { this.fetchData(query) }, 1000),
|
||||
onInput() {
|
||||
this.selected = null;
|
||||
this.fetchDataDebounced(this.query)
|
||||
|
||||
@ -16,7 +16,8 @@ const OrganizationOrganizationInvitationCreate = {
|
||||
:label="$t('shared.models.adminUnitInvitation.organizationName')"
|
||||
name="organizationName"
|
||||
v-model="form.organization_name"
|
||||
rules="required" />
|
||||
rules="required|uniqueOrganizationName"
|
||||
:debounce="1000" />
|
||||
<validated-switch
|
||||
v-if="adminUnit.can_verify_other"
|
||||
:label="$t('shared.models.adminUnitInvitation.relationVerify')"
|
||||
|
||||
@ -11,7 +11,8 @@ const OrganizationOrganizationInvitationUpdate = {
|
||||
:label="$t('shared.models.adminUnitInvitation.organizationName')"
|
||||
name="organizationName"
|
||||
v-model="form.organization_name"
|
||||
rules="required" />
|
||||
rules="required|uniqueOrganizationName"
|
||||
:debounce="1000" />
|
||||
<validated-switch
|
||||
v-if="adminUnit.can_verify_other"
|
||||
:label="$t('shared.models.adminUnitInvitation.relationVerify')"
|
||||
|
||||
@ -125,6 +125,7 @@
|
||||
required: "The {_field_} field is required",
|
||||
size: "The {_field_} field size must be less than {size}KB",
|
||||
double: "The {_field_} field must be a valid decimal",
|
||||
uniqueOrganizationName: "Name is already taken",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -203,6 +204,7 @@
|
||||
required_if: "{_field_} ist ein Pflichtfeld",
|
||||
size: "{_field_} muss kleiner als {size}KB sein",
|
||||
double: "Das Feld {_field_} muss eine gültige Dezimalzahl sein",
|
||||
uniqueOrganizationName: "Der Name ist bereits vergeben",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -223,6 +225,23 @@
|
||||
VeeValidate.extend(rule, VeeValidate.Rules[rule]);
|
||||
});
|
||||
|
||||
VeeValidate.extend('uniqueOrganizationName', {
|
||||
validate: async value => {
|
||||
try {
|
||||
const response = await axios.get(
|
||||
`/api/v1/organizations?keyword=${value}`, {
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
return !response.data.items.some(o => o.name == value);
|
||||
} catch (err) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
immediate: false
|
||||
});
|
||||
|
||||
{% block vue_routes %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user