Feat: Purchase View
This commit is contained in:
		@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					<!doctype html>
 | 
				
			||||||
 | 
					<form action="{% url 'buy'%}" method="POST">
 | 
				
			||||||
 | 
					    {% csrf_token %}
 | 
				
			||||||
 | 
					    <fieldset>
 | 
				
			||||||
 | 
					        <legend>Purchase</legend>
 | 
				
			||||||
 | 
					        <label for="customer">Customer</label>:
 | 
				
			||||||
 | 
					        <input type="search" name="customer" id="customer"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <label for="date">Date</label>:
 | 
				
			||||||
 | 
					        <input type="date" name="date" id="date"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <label for="description">Description</label>:
 | 
				
			||||||
 | 
					        <input type="text" name="description" id="description"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <fieldset>
 | 
				
			||||||
 | 
					            <legend>Purchase Line</legend>
 | 
				
			||||||
 | 
					            <label for="product">Product</label>:
 | 
				
			||||||
 | 
					            <input type="search" name="product" id="product"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <label for="unit_price">Unit Price</label>:
 | 
				
			||||||
 | 
					            <input type="number" name="unit_price" min="0" id="unit_price"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <label for="quantity">Quantity</label>:
 | 
				
			||||||
 | 
					            <input type="number" name="quantity" min="0" id="quantity"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            <label for="subtotal">Subtotal</label>:
 | 
				
			||||||
 | 
					            <input type="number" name="subtotal" min="0" id="line_amount"/>
 | 
				
			||||||
 | 
					        </fieldset>
 | 
				
			||||||
 | 
					    </fieldset>
 | 
				
			||||||
 | 
					    <fieldset>
 | 
				
			||||||
 | 
					        <label for="total_amount">Total</label>:
 | 
				
			||||||
 | 
					        <input type="number" name="total_amount" min="0" id="total_amount"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <label for="Paid">Paid:</label>
 | 
				
			||||||
 | 
					        <select id="paid" name="paid">
 | 
				
			||||||
 | 
					            <option value="yes">Yes</option>
 | 
				
			||||||
 | 
					            <option value="no">No</option>
 | 
				
			||||||
 | 
					        </select>
 | 
				
			||||||
 | 
					    </fieldset>
 | 
				
			||||||
 | 
					    <div class="button-container">
 | 
				
			||||||
 | 
							<button name="form" type="submit">Enviar</button>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
 | 
					</form>
 | 
				
			||||||
@@ -10,7 +10,13 @@ def index(request):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def buy(request):
 | 
					def buy(request):
 | 
				
			||||||
    return HttpResponse("Nombre: ....")
 | 
					    context = {}
 | 
				
			||||||
 | 
					    if request.POST:
 | 
				
			||||||
 | 
					        raise Exception(request.POST)
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        raise Exception(request.POST)
 | 
				
			||||||
 | 
					    return render(
 | 
				
			||||||
 | 
					        request, 'don_confiao/purchase.html', context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def purchases(request):
 | 
					def purchases(request):
 | 
				
			||||||
@@ -36,4 +42,5 @@ def products(request):
 | 
				
			|||||||
            "category": "Cafes"
 | 
					            "category": "Cafes"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
    return JsonResponse(products, safe=False)
 | 
					    return JsonResponse(
 | 
				
			||||||
 | 
					        products, safe=False)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,9 @@ Including another URLconf
 | 
				
			|||||||
from django.contrib import admin
 | 
					from django.contrib import admin
 | 
				
			||||||
from django.urls import include, path
 | 
					from django.urls import include, path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					app_name = "don_confiao"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
urlpatterns = [
 | 
					urlpatterns = [
 | 
				
			||||||
    path("don_confiao/", include("don_confiao.urls")),
 | 
					    path("don_confiao/", include("don_confiao.urls")),
 | 
				
			||||||
    path('admin/', admin.site.urls),
 | 
					    path('admin/', admin.site.urls),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user