feat: bolierplate layout samba and ldap
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-05-25 10:37:52 +02:00
parent 889263bfb8
commit d46b906020
6 changed files with 124 additions and 164 deletions

View File

@ -29,7 +29,6 @@ const newAccountForm = reactive({
url-create="Entries" url-create="Entries"
model="account" model="account"
:form-initial-data="newAccountForm" :form-initial-data="newAccountForm"
@on-data-saved="redirectToAccountBasicData"
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router'; import { useRoute } from 'vue-router';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
@ -17,7 +17,6 @@ import { toDate } from 'src/filters';
const state = useState(); const state = useState();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const router = useRouter();
const stateStore = useStateStore(); const stateStore = useStateStore();
const user = state.getUser(); const user = state.getUser();
@ -29,10 +28,6 @@ const newAccountForm = reactive({
const suppliersOptions = ref([]); const suppliersOptions = ref([]);
const travelsOptions = ref([]); const travelsOptions = ref([]);
const companiesOptions = ref([]); const companiesOptions = ref([]);
const redirectToAccountBasicData = (_, { id }) => {
router.push({ name: 'AccountBasicData', params: { id } });
};
</script> </script>
<template> <template>
@ -75,7 +70,6 @@ const redirectToAccountBasicData = (_, { id }) => {
url-create="Entries" url-create="Entries"
model="account" model="account"
:form-initial-data="newAccountForm" :form-initial-data="newAccountForm"
@on-data-saved="redirectToAccountBasicData"
> >
<template #form="{ data, validate }"> <template #form="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">

View File

@ -1,16 +1,12 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
const newAccountForm = reactive({ const newAccountForm = reactive({
@ -22,89 +18,47 @@ const newAccountForm = reactive({
<template> <template>
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar> </VnSubToolbar>
<pre>TODO <b>LDAP</b></pre> <pre>TODO <b>LDAP</b></pre>
<FormModel <FormModel
url-create="Entries" url-create="Entries"
model="account" model="account"
:form-initial-data="newAccountForm" :form-initial-data="newAccountForm"
@on-data-saved="redirectToAccountBasicData"
> >
<template #form="{ data, validate }"> <template #moreActions>
<QBtnGroup push class="q-gutter-x-sm">
<QBtn round flat color="primary" :label="t('ldap.testConnection')">
<QTooltip>
{{ t('ldap.testConnection') }}
</QTooltip>
</QBtn>
</QBtnGroup>
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelect <QCheckbox
:label="t('Supplier')" :label="t('ldap.enableSync')"
class="full-width" v-model="data.enableSync"
v-model="data.supplierFk"
:options="suppliersOptions"
option-value="id"
option-label="nickname"
hide-selected
:required="true"
:rules="validate('account.supplierFk')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.nickname }}</QItemLabel>
<QItemLabel caption>
#{{ scope.opt?.id }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelect
:label="t('Travel')"
class="full-width"
v-model="data.travelFk"
:options="travelsOptions"
option-value="id"
option-label="warehouseInName"
map-options
hide-selected
:required="true"
:rules="validate('account.travelFk')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
>{{ scope.opt?.agencyModeName }} -
{{ scope.opt?.warehouseInName }} ({{
toDate(scope.opt?.shipped)
}}) &#x2192;
{{ scope.opt?.warehouseOutName }} ({{
toDate(scope.opt?.landed)
}})</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelect
:label="t('Company')"
class="full-width"
v-model="data.companyFk"
:options="companiesOptions"
option-value="id"
option-label="code"
map-options
hide-selected
:required="true"
:rules="validate('account.companyFk')"
/> />
</div> </div>
</VnRow> </VnRow>
<template v-if="data.enableSync">
<VnInput :label="t('ldap.server')" clearable v-model="data.server" />
<VnInput :label="t('ldap.rdn')" clearable v-model="data.rdn" />
<VnInput
:label="t('ldap.passwordAD')"
clearable
type="password"
v-model="data.passwordAD"
/>
<VnInput :label="t('ldap.userDN')" clearable v-model="data.userDN" />
<VnInput
:label="t('ldap.groupDN')"
clearable
v-model="data.groupDN"
/>
</template>
</template> </template>
</FormModel> </FormModel>
</QPage> </QPage>

View File

@ -1,16 +1,12 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnInput from 'src/components/common/VnInput.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'src/filters';
const { t } = useI18n(); const { t } = useI18n();
const newAccountForm = reactive({ const newAccountForm = reactive({
@ -22,89 +18,64 @@ const newAccountForm = reactive({
<template> <template>
<QPage> <QPage>
<VnSubToolbar /> <VnSubToolbar></VnSubToolbar>
<pre>TODO <b>SAMBA</b></pre> <pre>TODO <b>SAMBA</b></pre>
<FormModel <FormModel
url-create="Entries" url-create="Entries"
model="account" model="account"
:form-initial-data="newAccountForm" :form-initial-data="newAccountForm"
@on-data-saved="redirectToAccountBasicData"
> >
<template #form="{ data, validate }"> <template #moreActions>
<QBtn round flat color="primary" :label="t('samba.testConnection')">
<QTooltip>
{{ t('samba.testConnection') }}
</QTooltip>
</QBtn>
<QBtn round flat color="primary" :label="t('samba.verifyCertificate')">
<QTooltip>
{{ t('samba.verifyCertificate') }}
</QTooltip>
</QBtn>
</template>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelect <QCheckbox
:label="t('Supplier')" :label="t('samba.enableSync')"
class="full-width" v-model="data.enableSync"
v-model="data.supplierFk"
:options="suppliersOptions"
option-value="id"
option-label="nickname"
hide-selected
:required="true"
:rules="validate('account.supplierFk')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.nickname }}</QItemLabel>
<QItemLabel caption>
#{{ scope.opt?.id }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelect
:label="t('Travel')"
class="full-width"
v-model="data.travelFk"
:options="travelsOptions"
option-value="id"
option-label="warehouseInName"
map-options
hide-selected
:required="true"
:rules="validate('account.travelFk')"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel
>{{ scope.opt?.agencyModeName }} -
{{ scope.opt?.warehouseInName }} ({{
toDate(scope.opt?.shipped)
}}) &#x2192;
{{ scope.opt?.warehouseOutName }} ({{
toDate(scope.opt?.landed)
}})</QItemLabel
>
</QItemSection>
</QItem>
</template>
</VnSelect>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelect
:label="t('Company')"
class="full-width"
v-model="data.companyFk"
:options="companiesOptions"
option-value="id"
option-label="code"
map-options
hide-selected
:required="true"
:rules="validate('account.companyFk')"
/> />
</div> </div>
</VnRow> </VnRow>
<template v-if="data.enableSync">
<VnInput
:label="t('samba.domainController')"
clearable
v-model="data.domainController"
/>
<VnInput
:label="t('samba.domainAD')"
clearable
v-model="data.domainAD"
/>
<VnInput
:label="t('samba.groupDN')"
clearable
v-model="data.groupDN"
/>
<VnInput :label="t('samba.userAD')" clearable v-model="data.userAD" />
<VnInput
:label="t('samba.passwordAD')"
clearable
type="password"
v-model="data.passwordAD"
/>
<VnInput
:label="t('samba.domainPart')"
clearable
v-model="data.domainPart"
/>
</template>
</template> </template>
</FormModel> </FormModel>
</QPage> </QPage>

View File

@ -41,3 +41,24 @@ role:
description: Description description: Description
id: Id id: Id
name: Name name: Name
ldap:
enableSync: Enable synchronization
server: Server
rdn: RDN
userDN: User DN
filter: Filter
groupDN: Group DN
testConnection: Test connection
success: LDAP connection established!
samba:
enableSync: Enable synchronization
domainController: Domain controller
domainAD: AD domain
userAD: AD user
groupDN: Group DN
passwordAD: AD password
domainPart: User DN (without domain part)
verifyCertificate: Verify certificate
testConnection: Test connection
success: Samba connection established!

View File

@ -51,3 +51,24 @@ role:
description: Descripción description: Descripción
id: Idd id: Idd
name: Nombre name: Nombre
ldap:
enableSync: Habilitar sincronización
server: Servidor
rdn: RDN
userDN: DN usuarios
filter: Filtro
groupDN: DN grupos
testConnection: Probar conexión
success: ¡Conexión con LDAP establecida!
samba:
enableSync: Habilitar sincronización
domainController: Controlador de dominio
domainAD: Dominio AD
groupDN: DN grupos
userAD: Usuario AD
passwordAD: Contraseña AD
domainPart: DN usuarios (sin la parte del dominio)
Verify certificate: Verificar certificado
testConnection: Probar conexión
success: ¡Conexión con Samba establecida!