├── README.md ├── backend ├── backend │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── settings.cpython-38.pyc │ │ ├── urls.cpython-38.pyc │ │ └── wsgi.cpython-38.pyc │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── list │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── admin.cpython-38.pyc │ │ ├── apps.cpython-38.pyc │ │ ├── models.cpython-38.pyc │ │ ├── serializers.cpython-38.pyc │ │ └── views.cpython-38.pyc │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_rename_dirección_list_direccion.py │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ ├── 0001_initial.cpython-38.pyc │ │ │ ├── 0002_rename_dirección_list_direccion.cpython-38.pyc │ │ │ └── __init__.cpython-38.pyc │ ├── models.py │ ├── serializers.py │ ├── tests.py │ └── views.py ├── manage.py └── requirements.txt └── front └── frontend ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt └── src ├── App.css ├── App.js ├── App.test.js ├── components └── Modal.js ├── index.css ├── index.js ├── logo.svg ├── reportWebVitals.js └── setupTests.js /README.md: -------------------------------------------------------------------------------- 1 | # Started with React 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /backend/backend/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/backend/__init__.py -------------------------------------------------------------------------------- /backend/backend/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/backend/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /backend/backend/__pycache__/settings.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/backend/__pycache__/settings.cpython-38.pyc -------------------------------------------------------------------------------- /backend/backend/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/backend/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /backend/backend/__pycache__/wsgi.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/backend/__pycache__/wsgi.cpython-38.pyc -------------------------------------------------------------------------------- /backend/backend/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for backend project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /backend/backend/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for backend project. 3 | 4 | Generated by 'django-admin startproject' using Django 4.0.2. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/4.0/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-l@r4qpdzb#vk$e04!hp)4&dl*d*9*x5%2^spkxr4cx_l3*p_2i' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'corsheaders', 41 | 'rest_framework', 42 | 'list', 43 | ] 44 | 45 | MIDDLEWARE = [ 46 | 'django.middleware.security.SecurityMiddleware', 47 | 'django.contrib.sessions.middleware.SessionMiddleware', 48 | 'django.middleware.common.CommonMiddleware', 49 | 'django.middleware.csrf.CsrfViewMiddleware', 50 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 51 | 'django.contrib.messages.middleware.MessageMiddleware', 52 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 53 | 'corsheaders.middleware.CorsMiddleware', 54 | 55 | ] 56 | 57 | ROOT_URLCONF = 'backend.urls' 58 | 59 | TEMPLATES = [ 60 | { 61 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 62 | 'DIRS': [], 63 | 'APP_DIRS': True, 64 | 'OPTIONS': { 65 | 'context_processors': [ 66 | 'django.template.context_processors.debug', 67 | 'django.template.context_processors.request', 68 | 'django.contrib.auth.context_processors.auth', 69 | 'django.contrib.messages.context_processors.messages', 70 | ], 71 | }, 72 | }, 73 | ] 74 | 75 | WSGI_APPLICATION = 'backend.wsgi.application' 76 | 77 | 78 | # Database 79 | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases 80 | 81 | DATABASES = { 82 | 'default':{ 83 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 84 | 'NAME': 'khpigeaivk', 85 | 'PASSWORD': 'X6YDF35Y62FJ51V6$', 86 | 'HOST': 'localhost', 87 | 'PORT':'', 88 | } 89 | } 90 | 91 | 92 | # Password validation 93 | # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators 94 | 95 | AUTH_PASSWORD_VALIDATORS = [ 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 101 | }, 102 | { 103 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 104 | }, 105 | { 106 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 107 | }, 108 | ] 109 | 110 | 111 | # Internationalization 112 | # https://docs.djangoproject.com/en/4.0/topics/i18n/ 113 | 114 | LANGUAGE_CODE = 'en-us' 115 | 116 | TIME_ZONE = 'UTC' 117 | 118 | USE_I18N = True 119 | 120 | USE_TZ = True 121 | 122 | 123 | # Static files (CSS, JavaScript, Images) 124 | # https://docs.djangoproject.com/en/4.0/howto/static-files/ 125 | 126 | STATIC_URL = 'static/' 127 | 128 | # Default primary key field type 129 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field 130 | 131 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 132 | 133 | CORS_ORIGIN_WHITELIST = [ 134 | 'http://localhost:3000' 135 | ] -------------------------------------------------------------------------------- /backend/backend/urls.py: -------------------------------------------------------------------------------- 1 | """backend URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/4.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from rest_framework import routers 19 | from list import views 20 | 21 | router = routers.DefaultRouter() 22 | router.register(r'list', views.ListView, 'list') 23 | 24 | urlpatterns = [ 25 | path('admin/', admin.site.urls), 26 | path('api/', include(router.urls)), 27 | ] 28 | -------------------------------------------------------------------------------- /backend/backend/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for backend project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /backend/list/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__init__.py -------------------------------------------------------------------------------- /backend/list/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/__pycache__/apps.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__pycache__/apps.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/__pycache__/serializers.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__pycache__/serializers.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import List 3 | 4 | class ListAdmin(admin.ModelAdmin): 5 | list_display = ('name', 'direccion', 'nit', 'tel') 6 | 7 | # Register your models here. 8 | 9 | admin.site.register(List, ListAdmin) 10 | 11 | -------------------------------------------------------------------------------- /backend/list/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ListConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'list' 7 | -------------------------------------------------------------------------------- /backend/list/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.2 on 2022-03-01 00:55 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='List', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=300, unique=True)), 19 | ('dirección', models.CharField(max_length=300)), 20 | ('nit', models.CharField(max_length=300, unique=True)), 21 | ('tel', models.CharField(max_length=15, unique=True)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /backend/list/migrations/0002_rename_dirección_list_direccion.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.2 on 2022-03-01 00:58 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('list', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='list', 15 | old_name='dirección', 16 | new_name='direccion', 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /backend/list/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/migrations/__init__.py -------------------------------------------------------------------------------- /backend/list/migrations/__pycache__/0001_initial.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/migrations/__pycache__/0001_initial.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/migrations/__pycache__/0002_rename_dirección_list_direccion.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/migrations/__pycache__/0002_rename_dirección_list_direccion.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/backend/list/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /backend/list/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | '''creando un modelo que indica como se deben definir los elementos''' 6 | 7 | class List(models.Model): 8 | '''users models''' 9 | name = models.CharField(max_length=300, unique=True) 10 | direccion = models.CharField(max_length=300) 11 | nit = models.CharField(max_length=300, unique=True) 12 | tel = models.CharField(max_length=15, unique=True) 13 | def _str_(self): 14 | return self.name -------------------------------------------------------------------------------- /backend/list/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | from .models import List 3 | 4 | class ListSerializer(serializers.ModelSerializer): 5 | class Meta: 6 | model = List 7 | fields = ('id', 'name', 'direccion', 'nit', 'tel') -------------------------------------------------------------------------------- /backend/list/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /backend/list/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from rest_framework import viewsets 3 | from .serializers import ListSerializer 4 | from .models import List 5 | 6 | # Create your views here. 7 | 8 | class ListView(viewsets.ModelViewSet): 9 | serializer_class = ListSerializer 10 | queryset = List.objects.all() -------------------------------------------------------------------------------- /backend/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /backend/requirements.txt: -------------------------------------------------------------------------------- 1 | apturl==0.5.2 2 | asgiref==3.5.0 3 | backports.zoneinfo==0.2.1 4 | blinker==1.4 5 | Brlapi==0.7.0 6 | certifi==2019.11.28 7 | chardet==3.0.4 8 | Click==7.0 9 | colorama==0.4.3 10 | command-not-found==0.3 11 | cryptography==2.8 12 | cupshelpers==1.0 13 | dbus-python==1.2.16 14 | defer==1.0.6 15 | distlib==0.3.4 16 | distro==1.4.0 17 | distro-info===0.23ubuntu1 18 | Django==4.0.2 19 | django-cors-headers==3.11.0 20 | djangorestframework==3.13.1 21 | entrypoints==0.3 22 | filelock==3.6.0 23 | httplib2==0.14.0 24 | idna==2.8 25 | keyring==18.0.1 26 | 27 | 28 | virtualenv==20.13.2 29 | virtualenv-clone==0.5.7 30 | 31 | -------------------------------------------------------------------------------- /front/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontend", 3 | "version": "0.1.0", 4 | "private": true, 5 | "proxy": "http://localhost:8000", 6 | "dependencies": { 7 | "@testing-library/jest-dom": "^5.16.2", 8 | "@testing-library/react": "^12.1.3", 9 | "@testing-library/user-event": "^13.5.0", 10 | "axios": "^0.21.1", 11 | "react": "^17.0.2", 12 | "react-dom": "^17.0.2", 13 | "react-scripts": "5.0.0", 14 | "web-vitals": "^2.1.4" 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "test": "react-scripts test", 20 | "eject": "react-scripts eject" 21 | }, 22 | "eslintConfig": { 23 | "extends": [ 24 | "react-app", 25 | "react-app/jest" 26 | ] 27 | }, 28 | "browserslist": { 29 | "production": [ 30 | ">0.2%", 31 | "not dead", 32 | "not op_mini all" 33 | ], 34 | "development": [ 35 | "last 1 chrome version", 36 | "last 1 firefox version", 37 | "last 1 safari version" 38 | ] 39 | }, 40 | "devDependencies": { 41 | "@babel/core": "^7.17.5", 42 | "@babel/preset-env": "^7.16.11", 43 | "@babel/preset-react": "^7.16.7", 44 | "babel-loader": "^8.2.3", 45 | "bootstrap": "^4.6.0", 46 | "clean-webpack-plugin": "^4.0.0", 47 | "css-loader": "^6.6.0", 48 | "css-minimizer-webpack-plugin": "^3.4.1", 49 | "html-loader": "^3.1.0", 50 | "html-webpack-plugin": "^5.5.0", 51 | "mini-css-extract-plugin": "^2.5.3", 52 | "reactstrap": "^8.10.1", 53 | "style-loader": "^3.3.1", 54 | "terser-webpack-plugin": "^5.3.1", 55 | "webpack-cli": "^4.9.2", 56 | "webpack-dev-server": "^4.7.4" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /front/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/front/frontend/public/favicon.ico -------------------------------------------------------------------------------- /front/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /front/frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/front/frontend/public/logo192.png -------------------------------------------------------------------------------- /front/frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/blais3pasc4l/React-Django-API/cf7eefd3e5a8a0f7dec8c3473b0c751e3bfa1f54/front/frontend/public/logo512.png -------------------------------------------------------------------------------- /front/frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /front/frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /front/frontend/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /front/frontend/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import Modal from "./components/Modal"; 3 | import axios from "axios"; 4 | 5 | class App extends Component { 6 | constructor(props) { 7 | super(props); 8 | this.state = { 9 | listList: [], 10 | activeItem: { 11 | id: "", 12 | name: "", 13 | direccion: "", 14 | nit: "", 15 | tel: "", 16 | }, 17 | }; 18 | } 19 | 20 | componentDidMount() { 21 | this.refreshList(); 22 | } 23 | 24 | refreshList = () => { 25 | axios 26 | .get("/api/list/") 27 | .then((res) => this.setState({ listList: res.data })) 28 | .catch((err) => console.log(err)); 29 | }; 30 | 31 | toggle = () => { 32 | this.setState({ modal: !this.state.modal }); 33 | }; 34 | 35 | handleSubmit = (item) => { 36 | this.toggle(); 37 | 38 | if (item.id) { 39 | axios 40 | .put(`/api/list/${item.id}/`, item) 41 | .then((res) => this.refreshList()); 42 | return; 43 | } 44 | axios 45 | .post("/api/list/", item) 46 | .then((res) => this.refreshList()); 47 | }; 48 | 49 | handleDelete = (item) => { 50 | axios 51 | .delete(`/api/list/${item.id}/`) 52 | .then((res) => this.refreshList()); 53 | }; 54 | 55 | createItem = () => { 56 | const item = { nombre: "", direccion: "", nit: "", tel: ""}; 57 | 58 | this.setState({ activeItem: item, modal: !this.state.modal }); 59 | }; 60 | 61 | 62 | displayCompleted = (status) => { 63 | if (status) { 64 | return this.setState({ viewCompleted: true }); 65 | } 66 | 67 | return this.setState({ viewCompleted: false }); 68 | }; 69 | 70 | renderTabList = () => { 71 | return ( 72 |
73 | 76 | registered 77 | 78 |
79 | ); 80 | }; 81 | 82 | renderItems = () => { 83 | const { viewCompleted } = this.state; 84 | const newItems = this.state.listList.filter( 85 | (item) => item.completed === viewCompleted 86 | ); 87 | 88 | return newItems.map((item) => ( 89 |
  • 92 | 93 | {item.name} 94 | 95 | 96 |
  • 97 | )); 98 | }; 99 | 100 | render() { 101 | return ( 102 |
    103 |

    List Enterprise

    104 |
    105 |
    106 |
    107 |
    108 | 114 |
    115 | {this.renderTabList()} 116 |
      117 | {this.renderItems()} 118 |
    119 |
    120 |
    121 |
    122 | {this.state.modal ? ( 123 | 128 | ) : null} 129 |
    130 | ); 131 | } 132 | } 133 | 134 | export default App; 135 | -------------------------------------------------------------------------------- /front/frontend/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /front/frontend/src/components/Modal.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { 3 | Button, 4 | Modal, 5 | ModalHeader, 6 | ModalBody, 7 | ModalFooter, 8 | Form, 9 | FormGroup, 10 | Input, 11 | Label, 12 | } from "reactstrap"; 13 | 14 | export default class CustomModal extends Component { 15 | constructor(props) { 16 | super(props); 17 | this.state = { 18 | activeItem: this.props.activeItem, 19 | }; 20 | } 21 | 22 | 23 | 24 | 25 | handleChange = (e) => { 26 | let { name, direccion,nit, tel, value} = e.target; 27 | 28 | 29 | const activeItem = { ...this.state.activeItem, [name]: value , [direccion]: direccion,[nit]:nit, [tel]:tel} 30 | 31 | this.setState({ activeItem }); 32 | }; 33 | 34 | render() { 35 | const { toggle, onSave } = this.props; 36 | 37 | return ( 38 | 39 | Item 40 | 41 |
    42 | 43 | 44 | 52 | 53 | 54 | 55 | 63 | 64 | 65 | 66 | 74 | 75 | 76 | 77 | 85 | 86 |
    87 |
    88 | 89 | 95 | 96 |
    97 | ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /front/frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /front/frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import 'bootstrap/dist/css/bootstrap.css'; 4 | import './index.css'; 5 | import App from './App'; 6 | import reportWebVitals from './reportWebVitals'; 7 | import listList from './App' 8 | 9 | ReactDOM.render( 10 | 11 | 12 | , 13 | document.getElementById('root') 14 | 15 | ); 16 | 17 | // If you want to start measuring performance in your app, pass a function 18 | // to log results (for example: reportWebVitals(console.log)) 19 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 20 | reportWebVitals(); 21 | -------------------------------------------------------------------------------- /front/frontend/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /front/frontend/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /front/frontend/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------