Fomr

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 5

@* <div class="auth-page-wrapper">

<div class="auth-page-content">
<div class="container">
<div class="row justify-content-center mt-5">
<div class="col-md-7 col-lg-5 col-xl-4">
<div class="card mt-3">
<div class="card-body p-5">
<div class="text-center">
<div style="margin-bottom: 2.6rem">
<img src="~/assets/images/logos/logo-
dark.svg" alt="" width="110">
</div>
</div>
<div class="mt-4">
<form class="frm-login">
<div class="mb-4">
<input type="text" class="form-control"
name="f_login_username" placeholder="Usuario o correo electrónico" maxlength="120"
tabindex="1" autofocus="" autocomplete="off">
</div>
<div class="mb-4">
<div class="position-relative auth-
pass-inputgroup mb-3">
<input type="password" class="form-
control pe-5" name="f_login_password" placeholder="Contraseña" tabindex="2"
autocomplete="off">
<button class="btn btn-link
position-absolute end-0 top-0 text-decoration-none text-muted password-addon"
type="button"><i class="ri-eye-fill align-middle"></i></button>
</div>
</div>
<div class="mt-3">
<button class="btn btn-primary w-100
btn-load btn-login" type="button" tabindex="3">Iniciar sesión</button>
</div>

<div class="mt-4 text-center">


<div class="signin-other-title">
<h5 class="fs-13 mb-4 title"><a
href="javascript:void(0)" class="text-muted">¿Olvidó su contraseña?</a></h5>
</div>
<div>
<button type="button" class="btn
btn-light btn-icon waves-effect waves-light w-100">Afiliarse</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="text-center">
<p class="mb-0 text-muted">
<script>
document.write(new Date().getFullYear());
</script>
&copy;
POS Fácil
</p>
</div>
</div>
</div>
</div>
</footer>
</div> *@

function bodyGenericFormUser(data, remplace) {

$('.' + remplace).empty().html(data.view).ready(function () {

processformuser = 1;

validateForms();

$('select[name="frm_user_reference"]').prop('disabled', true);

$('.password-addon').on('click', function () { var t = $


('input[name="frm_user_password"]'); 'password' === t.attr('type') ? t.attr('type',
'text') : t.attr('type', 'password') });

fillSelect('select[name="frm_user_search"]', "", 7, true).then(function ()


{

initSelect2('select[name="frm_user_search"]', 'Buscar por', '-1', '',


true, false, null);

});

fillSelect('select[name="frm_user_role"]', "", 6, true).then(function () {

initSelect2('select[name="frm_user_role"]', 'Seleccionar', '', '',


true, false, null);

});

$('select[name="frm_user_search"]').change(function () {

$('select[name="frm_user_reference"]').removeClass('s2company
s2seller');

if (this.value) {

$('select[name="frm_user_reference"]').prop('disabled', false);
let option = $('select[name="frm_user_search"]
option:selected').data('int1');

let valMapping = {
2: { class: 's2company', placeholder: 'Seleccionar empresa...',
val: 10 },
3: { class: 's2seller', placeholder: 'Seleccionar vendedor...',
val: 30 }
};

let valObj = valMapping[option] || { val: 0 };


$('select[name="frm_user_reference"]').addClass(valObj.class);
fillSelect('select[name="frm_user_reference"]', '', valObj.val,
true).then(function () {
initSelect2('select[name="frm_user_reference"]',
valObj.placeholder, '', '', true, false, '.' + remplace);
});

} else {

$('select[name="frm_user_reference"]').empty().prop('disabled',
true);

initSelect2('select[name="frm_user_reference"]', '', '', '', true,


false, '.'+ remplace);

});

$('select[name="frm_user_reference"]').change(function () {

if (this.value) {

$('input[name="frm_user_names"]').val($
('select[name="frm_user_search"] option:selected').data('int1') == 2 ? $
('select[name="frm_user_reference"] option:selected').data('text3') : $
('select[name="frm_user_reference"] option:selected').text());

$('input[name="frm_user_email"]').val($
('select[name="frm_user_reference"] option:selected').data('text4'));
$('input[name="frm_user_names"]').valid(); $
('input[name="frm_user_email"]').valid();
}
else {
$('input[name="frm_user_names"],
input[name="frm_user_email"]').val('');

}
$(this).valid();

});

$('select[name="frm_user_role"]').change(function () {

if (this.value) {

var userRoleValue = $('select[name="frm_user_role"]


option:selected').data('int1')
if (userRoleValue != 1) {

$('select[name="frm_user_reference"]').rules("add", {
required: true
});

} else {
$('select[name="frm_user_reference"]').rules("remove",
"required");
}
$('select[name="frm_user_reference"]').valid();

$(this).valid();
}

});

$('.btn-user-add').on('click', function (e) {

if ($('select[name="frm_user_search"]').val() != '') {

let option = $('select[name="frm_user_search"]


option:selected').data('int1');

switch (option) {
case 2:

partialView('/webui/configuration/companies/companies-
form', {})
.then(function (data) {

bodyGenericFormCompany(data, 'modal-body-s');

})
.catch(function (error) {
console.log('Error:', error);
});

break;
case 3:
partialView('/webui/configuration/sellers/sellers-form',
{})
.then(function (data) {

bodyGenericFormSeller(data, 'modal-body-s');

})
.catch(function (error) {
console.log('Error:', error);
});

break;

}
e.preventDefault();
}
});

});

initModal(remplace == 'modal-body-p' ? 'modal-p' : 'modal-s', 'Nuevo usuario',


'modal-dialog-centered', 'Guardar', '', function () { saveGenericFormUser(); });

You might also like