Liberacion
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
|
#archvi .env#
|
||||||
|
.env
|
||||||
# Django #
|
# Django #
|
||||||
*.log
|
*.log
|
||||||
*.pot
|
*.pot
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from django.core.files.storage import FileSystemStorage
|
|||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.shortcuts import render,redirect
|
from django.shortcuts import render,redirect
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.http import HttpResponse,JsonResponse,QueryDict
|
from django.http import HttpResponse,JsonResponse
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@@ -207,11 +207,8 @@ def index(request):
|
|||||||
clientes_list =pageFunc(page,clientes_list,50)
|
clientes_list =pageFunc(page,clientes_list,50)
|
||||||
current_query_dict = request.GET.copy()
|
current_query_dict = request.GET.copy()
|
||||||
current_query_dict.pop('page', None)
|
current_query_dict.pop('page', None)
|
||||||
|
|
||||||
current_query_params = current_query_dict.urlencode()
|
|
||||||
|
|
||||||
|
current_query_params = current_query_dict.urlencode()
|
||||||
|
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
'lista':clientes_list,
|
'lista':clientes_list,
|
||||||
|
|||||||
@@ -78,16 +78,16 @@ class Suspension_Modulos_Permisos_ClienteAdmin(admin.ModelAdmin):
|
|||||||
super().save_model(request, obj, form, change)
|
super().save_model(request, obj, form, change)
|
||||||
|
|
||||||
for modulo in obj.suspensionmodulo_set.all():
|
for modulo in obj.suspensionmodulo_set.all():
|
||||||
print(modulo, 'permisos',modulo.modulo.permisos.all())
|
#print(modulo, 'permisos',modulo.modulo.permisos.all())
|
||||||
for permiso in modulo.modulo.permisos.all():
|
for permiso in modulo.modulo.permisos.all():
|
||||||
print('borrar?',permiso.delete)
|
#print('borrar?',permiso.delete)
|
||||||
|
|
||||||
permObj,created=SuspensionPermiso.objects.get_or_create(
|
permObj,created=SuspensionPermiso.objects.get_or_create(
|
||||||
supension_modPermP=obj,
|
supension_modPermP=obj,
|
||||||
suspension_modulo=modulo.modulo,
|
suspension_modulo=modulo.modulo,
|
||||||
permiso=permiso,
|
permiso=permiso,
|
||||||
)
|
)
|
||||||
print(permObj,created)
|
#print(permObj,created)
|
||||||
if permiso.delete:
|
if permiso.delete:
|
||||||
print('borrar')
|
print('borrar')
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ from django import forms
|
|||||||
from django.forms import inlineformset_factory
|
from django.forms import inlineformset_factory
|
||||||
from .models import ClientesA24, Suspension_Modulos_Permisos_Cliente,SuspensionModulo,SuspensionPermiso,Modulo
|
from .models import ClientesA24, Suspension_Modulos_Permisos_Cliente,SuspensionModulo,SuspensionPermiso,Modulo
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from django.utils.html import format_html
|
||||||
|
|
||||||
|
|
||||||
class ClienteForm_IMMEX(forms.ModelForm):
|
class ClienteForm_IMMEX(forms.ModelForm):
|
||||||
fecha_baja = forms.DateField(
|
fecha_baja = forms.DateField(
|
||||||
@@ -21,10 +23,16 @@ class ClienteForm_IMMEX(forms.ModelForm):
|
|||||||
fecha_baja = self.cleaned_data.get("fecha_baja")
|
fecha_baja = self.cleaned_data.get("fecha_baja")
|
||||||
|
|
||||||
if Activo and fecha_baja:
|
if Activo and fecha_baja:
|
||||||
self._errors['fecha_baja'] = self.error_class(["El parametro activo no puede estar seleccionado si hay fecha de baja"])
|
self.errors['fecha_baja'] = self.error_class(["El parametro activo no puede estar seleccionado si hay fecha de baja"])
|
||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
|
||||||
|
|
||||||
class SuspensionModulosPermisosClienteForm(forms.ModelForm):
|
class SuspensionModulosPermisosClienteForm(forms.ModelForm):
|
||||||
|
button_field = forms.CharField(
|
||||||
|
widget=forms.TextInput(attrs={'id':'add-sistema-cliente','type': 'button', 'value': 'Agregar Sistema-Cliente', "class":"btn btn-info"}),
|
||||||
|
required=False,
|
||||||
|
label=''
|
||||||
|
)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Suspension_Modulos_Permisos_Cliente
|
model = Suspension_Modulos_Permisos_Cliente
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
@@ -47,7 +55,7 @@ SuspensionModuloFormSet = inlineformset_factory(
|
|||||||
SuspensionModulo,
|
SuspensionModulo,
|
||||||
form=SuspensionModuloForm,
|
form=SuspensionModuloForm,
|
||||||
extra=5,
|
extra=5,
|
||||||
can_delete=False,
|
can_delete=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
#se usa "SuspensionModuloFormSet2" en el UpdateView para pasar el Extra igual a cero
|
#se usa "SuspensionModuloFormSet2" en el UpdateView para pasar el Extra igual a cero
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ router.register(r'modulos',views.ModulosListCreateAPIView)
|
|||||||
router.register(r'permisosA24',views.Permisos_A24_ModelViewSet)
|
router.register(r'permisosA24',views.Permisos_A24_ModelViewSet)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.Sistemas_xCliente_IMMEX_ListView.as_view(), name='sistemasXcli_IMMEX'),
|
path('lista/', views.Sistemas_xCliente_IMMEX_ListView.as_view(), name='sistemasXcli_IMMEX'),
|
||||||
path('create_sistema/',views.Sistemas_xCliente_IMMEX_CreateView.as_view(), name='create_sistemaIMMEX'),
|
path('create_sistema/',views.Sistemas_xCliente_IMMEX_CreateView.as_view(), name='create_sistemaIMMEX'),
|
||||||
path('create_Cliente/', views.ClientesIMMEX_CreateView.as_view(), name='ClientesIMMEX_Create'),
|
path('create_Cliente/', views.ClientesIMMEX_CreateView.as_view(), name='ClientesIMMEX_Create'),
|
||||||
path('checkRfcA24/', views.Check_IMMEX_RFC.as_view(), name='checkRfcA24' ),
|
path('checkRfcA24/', views.Check_IMMEX_RFC.as_view(), name='checkRfcA24' ),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Imports de Django
|
# Imports de Django
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import Http404
|
from django.http import Http404,JsonResponse
|
||||||
from django.urls import reverse_lazy, reverse
|
from django.urls import reverse_lazy, reverse
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic.edit import CreateView
|
||||||
@@ -72,6 +72,29 @@ class Sistemas_xCliente_IMMEX_CreateView(UserPassesTestMixin,LoginRequiredMixin,
|
|||||||
if not res:
|
if not res:
|
||||||
messages.error(self.request, 'Lo sentimos. La página que buscas no está disponible o no cuentas con los permisos.')
|
messages.error(self.request, 'Lo sentimos. La página que buscas no está disponible o no cuentas con los permisos.')
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
response = super().form_valid(form)
|
||||||
|
if self.request.headers.get('X-Requested-With') == 'XMLHttpRequest':
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'id':self.object.id,
|
||||||
|
'nombre':self.object.id_sistema.nombre_sistema,
|
||||||
|
'cliente':self.object.cliente.Nombre,
|
||||||
|
'version':self.object.id_sistema.version
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonResponse(data,status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
def form_invalid(self,form):
|
||||||
|
response = super().form_invalid(form)
|
||||||
|
if self.request.headers.get('X-Requested-With') == 'XMLHttpRequest':
|
||||||
|
errors = form.errors.as_text()
|
||||||
|
return JsonResponse({'errors':f'{errors}'},status=200,content_type='application/json')
|
||||||
|
else:
|
||||||
|
return response
|
||||||
|
|
||||||
class ClientesIMMEX_CreateView(CreateView):
|
class ClientesIMMEX_CreateView(CreateView):
|
||||||
model = ClientesA24
|
model = ClientesA24
|
||||||
|
|||||||
@@ -64,8 +64,7 @@ class SuspensionPermisosClienteCreateView(LoginRequiredMixin,UserPassesTestMixin
|
|||||||
context = self.get_context_data()
|
context = self.get_context_data()
|
||||||
modulo_formset = context['modulo_formset']
|
modulo_formset = context['modulo_formset']
|
||||||
permiso_formset = context['permiso_formset']
|
permiso_formset = context['permiso_formset']
|
||||||
|
|
||||||
|
|
||||||
if modulo_formset.is_valid() and permiso_formset.is_valid():
|
if modulo_formset.is_valid() and permiso_formset.is_valid():
|
||||||
self.object = form.save() # Guardamos el objeto principal
|
self.object = form.save() # Guardamos el objeto principal
|
||||||
|
|
||||||
@@ -79,24 +78,7 @@ class SuspensionPermisosClienteCreateView(LoginRequiredMixin,UserPassesTestMixin
|
|||||||
supension_modPermP=self.object,
|
supension_modPermP=self.object,
|
||||||
suspension_modulo=modulo.modulo,
|
suspension_modulo=modulo.modulo,
|
||||||
permiso=permiso,
|
permiso=permiso,
|
||||||
)
|
)
|
||||||
|
|
||||||
# permiso_formset.instance= self.object
|
|
||||||
# permiso_formset.save()
|
|
||||||
|
|
||||||
# for permiso in self.object.suspensionpermiso_set.all():
|
|
||||||
# # print(permiso.permiso,'iud',permiso.supension_modPermP.id)
|
|
||||||
# # print(permiso.supension_modPermP,permiso.suspension_modulo)
|
|
||||||
# suspension_modulo = self.object.suspensionmodulo_set.filter(
|
|
||||||
# supension_modPerm_id=self.object,
|
|
||||||
# # suspension_modulo = SuspensionModulo.objects.filter(supension_modPerm_id=self.object,
|
|
||||||
# modulo__permisos__in=[permiso.permiso]
|
|
||||||
# ).first()
|
|
||||||
# #print('suspMod',(suspension_modulo))
|
|
||||||
|
|
||||||
# permiso.suspension_modulo=suspension_modulo.modulo
|
|
||||||
# permiso.save()
|
|
||||||
|
|
||||||
|
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
else:
|
else:
|
||||||
@@ -119,54 +101,62 @@ class SuspensionPermisosCliente_UpdateView(LoginRequiredMixin,UserPassesTestMixi
|
|||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
if self.request.POST:
|
if self.request.POST:
|
||||||
context['modulo_formset'] = SuspensionModuloFormSet(self.request.POST, instance=self.object)
|
context['modulo_formset'] = SuspensionModuloFormSet(self.request.POST, instance=self.object)
|
||||||
context['permiso_formset'] = SuspensionPermisoFormSet(self.request.POST,instance=self.object)
|
context['permiso_formset'] = SuspensionPermisoFormSet(self.request.POST,instance=self.object)
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
context['modulo_formset'] = SuspensionModuloFormSet2(instance=self.object)
|
context['modulo_formset'] = SuspensionModuloFormSet2(instance=self.object)
|
||||||
|
|
||||||
|
|
||||||
context['permiso_formset'] = SuspensionPermisoFormSet(instance=self.object)
|
context['permiso_formset'] = SuspensionPermisoFormSet(instance=self.object)
|
||||||
for form in context['permiso_formset'].forms:
|
|
||||||
form.fields['modulo_extra'].widget = forms.HiddenInput()
|
|
||||||
form.fields['modulo_extra'].queryset = SuspensionModulo.objects.none()
|
for permiso_formset in context['permiso_formset'].forms:
|
||||||
form.fields['suspension_modulo'].queryset = Modulo.objects.all()
|
permiso_formset.fields['modulo_extra'].widget = forms.HiddenInput()
|
||||||
#form.fields['suspension_modulo'].widget = forms.HiddenInput()
|
permiso_formset.fields['modulo_extra'].queryset = SuspensionModulo.objects.none()
|
||||||
#form.fields['permiso'].widget.attrs['disabled'] = True
|
permiso_formset.fields['suspension_modulo'].queryset = Modulo.objects.all()
|
||||||
|
#permiso_formset.fields['suspension_modulo'].widget = forms.HiddenInput()
|
||||||
|
#permiso_formset.fields['permiso'].widget.attrs['disabled'] = True
|
||||||
|
|
||||||
|
|
||||||
|
context['form'].fields['sistema_cliente'].widget = forms.HiddenInput()
|
||||||
|
context['form'].fields['button_field'].widget = forms.HiddenInput()
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
context = self.get_context_data()
|
context = self.get_context_data()
|
||||||
modulo_formset = context['modulo_formset']
|
modulo_formset = context['modulo_formset']
|
||||||
permiso_formset = context['permiso_formset']
|
permiso_formset = context['permiso_formset']
|
||||||
print('permiupdate',permiso_formset.is_valid())
|
#print('permiupdate',permiso_formset.is_valid())
|
||||||
if form.is_valid() and modulo_formset.is_valid() and permiso_formset.is_valid():
|
if form.is_valid() and modulo_formset.is_valid() and permiso_formset.is_valid():
|
||||||
self.object = form.save()
|
self.object = form.save()
|
||||||
modulo_formset.instance = self.object
|
|
||||||
|
|
||||||
modulo_formset.save()
|
|
||||||
print('MODULOS',self.object.suspensionmodulo_set.all().values())
|
|
||||||
|
|
||||||
|
modulo_formset.instance = self.object
|
||||||
|
modulo_formset.save()
|
||||||
|
|
||||||
|
#print('MODULOS',(modulo_formset.instance.suspensionmodulo_set.all()))
|
||||||
|
#Guardamos SuspensionModulo
|
||||||
permiso_formset.instance= self.object
|
permiso_formset.instance= self.object
|
||||||
permiso_formset.save()
|
permiso_formset.save()
|
||||||
for permiso in self.object.suspensionpermiso_set.all():
|
|
||||||
print('permiso:',permiso.permiso,'iud',permiso.supension_modPermP.id)
|
modulos_a_eliminar = [form1.cleaned_data['modulo'] for form1 in modulo_formset.forms \
|
||||||
print('MODULO PERMISO:',permiso.suspension_modulo)
|
if hasattr(form1, 'cleaned_data') and form1.cleaned_data.get('DELETE')
|
||||||
suspension_modulo = self.object.suspensionmodulo_set.filter(
|
]
|
||||||
supension_modPerm_id=self.object,
|
#print('modulos_a_eliminar',modulos_a_eliminar)
|
||||||
# suspension_modulo = SuspensionModulo.objects.filter(supension_modPerm_id=self.object,
|
modulos_a_mantener = modulo_formset.instance.suspensionmodulo_set.exclude(modulo__in=modulos_a_eliminar)
|
||||||
modulo__permisos__in=[permiso.permiso]
|
|
||||||
).first()
|
#print('modulos_a_mantener',modulos_a_mantener)
|
||||||
if not suspension_modulo == None:
|
for modulo in modulos_a_mantener:
|
||||||
print('suspMod',(suspension_modulo))
|
for permiso in modulo.modulo.permisos.all():
|
||||||
print()
|
permObj,created=SuspensionPermiso.objects.get_or_create(
|
||||||
permiso.suspension_modulo=suspension_modulo.modulo
|
supension_modPermP=self.object,
|
||||||
permiso.save()
|
suspension_modulo=modulo.modulo,
|
||||||
else:
|
permiso=permiso,
|
||||||
permiso.delete()
|
)
|
||||||
|
|
||||||
|
# Eliminamos los permisos asociados a los módulos que se van a eliminar
|
||||||
|
if modulos_a_eliminar:
|
||||||
|
permisos_a_eliminar = SuspensionPermiso.objects.filter(suspension_modulo__in=modulos_a_eliminar)
|
||||||
|
permisos_a_eliminar.delete()
|
||||||
|
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
else:
|
else:
|
||||||
return self.render_to_response(self.get_context_data(form=form))
|
return self.render_to_response(self.get_context_data(form=form))
|
||||||
|
|
||||||
32
Templates/IMMEX/modulos/add_SistemaXCliente_Script.html
Normal file
32
Templates/IMMEX/modulos/add_SistemaXCliente_Script.html
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", ()=>{
|
||||||
|
document.querySelector('#add-sistema-cliente').addEventListener('click', function() {
|
||||||
|
let parentWidth = window.innerWidth;
|
||||||
|
let parentHeight = window.innerHeight;
|
||||||
|
|
||||||
|
let childWidth = 800;
|
||||||
|
let childHeight = 600;
|
||||||
|
let left =(parentWidth - childWidth);
|
||||||
|
let top = (parentHeight - childHeight);
|
||||||
|
|
||||||
|
let popupWin = window.open("{% url 'create_sistemaIMMEX' %}", "createSistemaXCliente_popup", "width=" + childWidth + ",height=" + childHeight + ",left=" + left + ",top=" + top);
|
||||||
|
popupWin.focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
window.addEventListener('message', (event)=>{
|
||||||
|
let response = event.data.data;
|
||||||
|
let windowName = event.data.windowName;
|
||||||
|
|
||||||
|
if(windowName==='createSistemaXCliente'){
|
||||||
|
|
||||||
|
let option = '<option value="' + response.id + '" selected>'+response.cliente+', ' + response.nombre + '</option>';
|
||||||
|
document.querySelector('#id_sistema_cliente').insertAdjacentHTML('beforeend', option);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -4,7 +4,9 @@
|
|||||||
{% block title %}Add Cliente IMMEX {% endblock title %}
|
{% block title %}Add Cliente IMMEX {% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Crear Módulo/Permisos</h2>
|
<h2>Editar Módulo/Permisos</h2>
|
||||||
|
<p><strong>Cliente:</strong>{{object.sistema_cliente}}</p>
|
||||||
|
<hr>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
@@ -36,4 +38,7 @@
|
|||||||
|
|
||||||
<button type="submit" class="btn btn-outline-success">Guardar</button>
|
<button type="submit" class="btn btn-outline-success">Guardar</button>
|
||||||
</form>
|
</form>
|
||||||
|
{% endblock %}
|
||||||
|
{% block scripts %}
|
||||||
|
{% include 'IMMEX/modulos/add_SistemaXCliente_Script.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -33,4 +33,11 @@
|
|||||||
|
|
||||||
<button type="submit" class="btn btn-outline-success">Guardar</button>
|
<button type="submit" class="btn btn-outline-success">Guardar</button>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
{% include 'IMMEX/modulos/add_SistemaXCliente_Script.html' %}
|
||||||
|
|
||||||
|
{% endblock scripts %}
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", ()=>{
|
document.addEventListener("DOMContentLoaded", ()=>{
|
||||||
|
console.log('edit_cliente.html',window.name)
|
||||||
if(window.name ==='popupWin')
|
if(window.name ==='popupWin')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Create a new Sistema IMMEX por cliente</h1>
|
<h1>Create a new Sistema IMMEX por cliente</h1>
|
||||||
<form method="post">
|
<form method="post" id="sistemaXCliente-form">
|
||||||
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if form.non_field_errors %}
|
{% if form.non_field_errors %}
|
||||||
@@ -63,6 +63,43 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
console.log('SISTEMA X CLIENTE', window.name);
|
||||||
|
|
||||||
|
if(window.name==='createSistemaXCliente_popup'){
|
||||||
|
document.querySelector('#sistemaXCliente-form').addEventListener('submit',(event)=>{
|
||||||
|
event.preventDefault();
|
||||||
|
let form = event.target;
|
||||||
|
let url = `{% url 'create_sistemaIMMEX' %}`;
|
||||||
|
let data = new FormData(form);
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('POST',url);
|
||||||
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||||
|
xhr.onreadystatechange = ()=>{
|
||||||
|
if(xhr.readyState===XMLHttpRequest.DONE){
|
||||||
|
if(xhr.status===200){
|
||||||
|
let response = JSON.parse(xhr.responseText);
|
||||||
|
if(response.errors){
|
||||||
|
alert(response.errors);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
window.opener.postMessage({data:response, windowName:'createSistemaXCliente'}, window.location.origin);
|
||||||
|
|
||||||
|
window.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
console.error('Request error', xhr.statusText);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send(data);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*add Sistema*/
|
/*add Sistema*/
|
||||||
document.querySelector('#add-sistema-btn').addEventListener('click', function() {
|
document.querySelector('#add-sistema-btn').addEventListener('click', function() {
|
||||||
let parentWidth = window.innerWidth;
|
let parentWidth = window.innerWidth;
|
||||||
@@ -92,11 +129,12 @@
|
|||||||
popupWin.focus();
|
popupWin.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('message', function(event) {
|
window.addEventListener('message', function(event) {
|
||||||
let response = event.data.data;
|
let response = event.data.data;
|
||||||
|
|
||||||
let windowName = event.data.windowName;
|
let windowName = event.data.windowName;
|
||||||
|
|
||||||
if(windowName==='clientWindow'){
|
if(windowName==='clientWindow'){
|
||||||
let id_cliente = response.id;
|
let id_cliente = response.id;
|
||||||
let Nombre = response.Nombre;
|
let Nombre = response.Nombre;
|
||||||
|
|||||||
@@ -10,61 +10,48 @@
|
|||||||
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
|
<div class="collapse navbar-collapse" id="navbarTogglerDemo03">
|
||||||
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
|
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
|
||||||
|
|
||||||
<li class="nav-item dropdown {% if request_path == '/' %}active{% endif %}">
|
<li class="nav-item dropdown {% if 'cliente' in request_path or request_path == '/' %}active border py-1 px-1 {% endif %}">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
Timbres/Clientes
|
Timbres/Clientes
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||||
<a class="dropdown-item" href="/">Timbres x Cliente</a>
|
<a class="dropdown-item" href="/">Timbres x Cliente</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item" href="{% url 'add_cliente' %}">Agregar Cliente</a>
|
<a class="dropdown-item" href="{% url 'add_cliente' %}">Agregar Cliente</a>
|
||||||
|
|
||||||
<a class="dropdown-item" href="#">---</a>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% comment %}
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">Contacts</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">List</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">#</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">List</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="#">List</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link disabled" href="#">Disabled</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
<li class="nav-item {% if 'sistemas' in request_path %}active border{% endif %}">
|
<li class="nav-item {% if 'sistemas' in request_path %}active border{% endif %}">
|
||||||
<a class="nav-link" href="/sistemas" >Sistemas CFDI</a>
|
<a class="nav-link" href="/sistemas" >Sistemas CFDI</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item {% if 'IMMEX/' in request_path %}active border{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'sistemasXcli_IMMEX' %}" >Sistemas IMMEX</a>
|
<li class="nav-item dropdown {% if 'IMMEX' in request_path %}active border py-1 px-1 {% endif %}">
|
||||||
</li>
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
IMMEX
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||||
|
|
||||||
|
<a class="dropdown-item" href="{% url 'sistemasXcli_IMMEX' %}">Sistemas</a>
|
||||||
|
<div class="dropdown-divider"></div>
|
||||||
|
{% for group in request.user.groups.all %}
|
||||||
|
{% if group.name == 'admin_soft' %}
|
||||||
|
<a class="dropdown-item" href="{% url 'permisos-clientesModulos' %}">Modulos - Permisos</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% for group in request.user.groups.all %}
|
|
||||||
{% if group.name == 'admin_soft' %}
|
|
||||||
<li class="nav-item {% if 'IMMEX/permisos-clientes' in request_path %}active border{% endif %}">
|
|
||||||
<a class="nav-link" href="{% url 'permisos-clientesModulos' %}" >Modulos-Permisos</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/admin" target="_blank">Admin site</a>
|
<a class="nav-link" href="/admin" target="_blank">Admin site</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% include "partials/search_form.html" %}
|
{% include "partials/search_form.html" %}
|
||||||
|
|
||||||
<li class="navbar-text mr-2 nav-item dropdown">
|
<li class="navbar-text mr-2 nav-item dropdown">
|
||||||
@@ -73,8 +60,7 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu dropleft" aria-labelledby="navbarDropdown">
|
<div class="dropdown-menu dropleft" aria-labelledby="navbarDropdown">
|
||||||
<form method="post" action="{% url 'account_logout' %}">
|
<form method="post" action="{% url 'account_logout' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
<button type="submit" class="dropdown-item">Cerrar sesión</button>
|
<button type="submit" class="dropdown-item">Cerrar sesión</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user