This commit is contained in:
Bob 2023-05-05 23:16:08 +03:00
parent 08e081bead
commit e348d39de5
8 changed files with 281 additions and 0 deletions

7
base/forms.py Normal file
View File

@ -0,0 +1,7 @@
from django.forms import ModelForm
from .models import VendorsData
class VendorEditForm(ModelForm):
class Meta:
model = VendorsData
fields = ['vendorCoverAmount', 'vendorPaidNotification', 'vendorSkipScreen', 'vendorPayWindow', 'vendorWebName', 'vendorWebAddr']

5
base/functions.py Normal file
View File

@ -0,0 +1,5 @@
import string
import random
def vendor_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2 on 2023-04-29 14:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0004_vendorsdata_vendoruuid'),
]
operations = [
migrations.AlterField(
model_name='vendorsdata',
name='vendorIsActive',
field=models.BooleanField(default=1),
),
]

View File

@ -0,0 +1,33 @@
# Generated by Django 4.2 on 2023-04-29 14:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0005_alter_vendorsdata_vendorisactive'),
]
operations = [
migrations.AlterField(
model_name='vendorsdata',
name='vendorDeleted',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='vendorsdata',
name='vendorPaidNotification',
field=models.BooleanField(default=True),
),
migrations.AlterField(
model_name='vendorsdata',
name='vendorPayWindow',
field=models.BooleanField(default=True),
),
migrations.AlterField(
model_name='vendorsdata',
name='vendorSkipScreen',
field=models.BooleanField(default=False),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 4.2 on 2023-04-29 17:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0006_alter_vendorsdata_vendordeleted_and_more'),
]
operations = [
migrations.AddField(
model_name='vendorsdata',
name='vendorUpdated',
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name='vendorsdata',
name='vendorAddDelete',
field=models.DateTimeField(auto_now_add=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2 on 2023-05-02 12:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0007_vendorsdata_vendorupdated_and_more'),
]
operations = [
migrations.AlterField(
model_name='vendorsdata',
name='vendorWebAddr',
field=models.URLField(max_length=250),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2 on 2023-05-02 15:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0008_alter_vendorsdata_vendorwebaddr'),
]
operations = [
migrations.AlterField(
model_name='vendorsdata',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
]

View File

@ -0,0 +1,159 @@
{% extends "partials/base.html" %}
{% load static %}
{% block title %}Vendor Edit Page{% endblock title %}
{% block content %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
<!-- ============================================================== -->
<!-- Start right Content here -->
<!-- ============================================================== -->
<!-- Main content -->
<div class="h-screen flex-grow-1 overflow-y-lg-auto">
<!-- Header -->
<header class="bg-surface-primary border-bottom pt-6">
<div class="container-fluid">
<div class="mb-npx">
<div class="row align-items-center">
<div class="col-sm-6 col-12 mb-4 mb-sm-0">
<!-- Title -->
<h1 class="h2 mb-0 ls-tight mb-3"> Edit page</h1>
</div>
<!-- Actions -->
</div>
<!-- Nav -->
</div>
</div>
</header>
<!-- Main -->
<main class="py-6 bg-surface-secondary">
<div class="container-fluid">
<!-- Card stats -->
<div class="card shadow border-1 mb-10">
<div class="card-header">
<h5 class="mb-0">{% block vendor_title %} {{vendor_title}} {% endblock vendor_title %} </h5>
</div>
<div class="mt-3 mb-3 ml-3 mr-3">
<form method="POST" action="">
{% csrf_token %}
{{ form.non_field_errors }}
<div class="form-group row">
<label for="{{ form.vendorWebName.id_for_label}}" class="col-4 col-form-label">Website Name</label>
<div class="col-4">
<div class="input-group">
<div class="input-group-addon ">
<i class="fa fa-align-justify"></i>
</div>
<input id="vendorWebName" name="vendorWebName"
{% if not vendors.vendorWebName %} placeholder="Website Name" {% else %} value="{{vendors.vendorWebName}}" {% endif %} type="text" aria-describedby="vendorWebNameHelpBlock" class="form-control">
</div>
<span id="vendorWebNameHelpBlock" class="form-text text-muted">Shown on invoice page</span>
{% if form.vendorWebName.errors %}
{% for error in form.vendorWebName.errors %}
<span id="vendorWebNameHelpBlock" class="text-danger">{{ error|escape }}</span>
{% endfor %}
{% endif %}
</div>
</div>
<div class="form-group row">
<label for="vendorWebAddr" class="col-4 col-form-label">Website URL</label>
<div class="col-4">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-anchor"></i>
</div>
<input id="vendorWebAddr" name="vendorWebAddr"
{% if not vendors.vendorWebAddr %} placeholder="Website URL" {% else %} value="{{vendors.vendorWebAddr}}" {% endif %} type="text" aria-describedby="vendorWebAddrHelpBlock" class="form-control">
</div>
<span id="vendorWebNameHelpBlock" class="form-text text-muted">Shown on invoice page</span>
</div>
</div>
<div class="form-group row">
<label for="vendorSkipScreen" class="col-4 col-form-label">Skip First Screen</label>
<div class="col-8">
<select id="vendorSkipScreen" name="vendorSkipScreen" class="custom-select" aria-describedby="vendorSkipScreenHelpBlock">
<option value="true" {% if vendors.vendorSkipScreen == True %} selected="selected" {% endif %}>Yes</option>
<option value="false" {% if vendors.vendorSkipScreen == False %} selected="selected" {% endif %}>No</option>
</select>
<span id="vendorSkipScreenHelpBlock" class="form-text text-muted">Skip the How-to screen on invoice page?</span>
</div>
</div>
<div class="form-group row">
<label for="vendorPaidNotification" class="col-4 col-form-label">Get Payment Notifications</label>
<div class="col-8">
<select id="vendorPaidNotification" name="vendorPaidNotification" class="custom-select" aria-describedby="vendorPaidNotificationHelpBlock">
<option value="true" {% if vendors.vendorPaidNotification == True %} selected="selected" {% endif %}>Yes</option>
<option value="false" {% if vendors.vendorPaidNotification == False %} selected="selected" {% endif %}>No</option>
</select>
<span id="vendorPaidNotificationHelpBlock" class="form-text text-muted">Get notifid by email for each payment received?</span>
</div>
</div>
<div class="form-group row">
<label for="vendorCoverAmount" class="col-4 col-form-label">Cover Amount</label>
<div class="col-8">
<select id="vendorCoverAmount" name="vendorCoverAmount" class="custom-select" aria-describedby="vendorCoverAmountHelpBlock">
<option value="0" {% if vendors.vendorCoverAmount == 0 %} selected="selected" {% endif %}>0%</option>
<option value="1" {% if vendors.vendorCoverAmount == 1 %} selected="selected" {% endif %}>1%</option>
<option value="2" {% if vendors.vendorCoverAmount == 2 %} selected="selected" {% endif %}>2%</option>
<option value="3" {% if vendors.vendorCoverAmount == 3 %} selected="selected" {% endif %}>3%</option>
<option value="4" {% if vendors.vendorCoverAmount == 4 %} selected="selected" {% endif %}>4%</option>
<option value="5" {% if vendors.vendorCoverAmount == 5 %} selected="selected" {% endif %}>5%</option>
<option value="6" {% if vendors.vendorCoverAmount == 6 %} selected="selected" {% endif %}>6%</option>
<option value="7" {% if vendors.vendorCoverAmount == 7 %} selected="selected" {% endif %}>7%</option>
<option value="8" {% if vendors.vendorCoverAmount == 8 %} selected="selected" {% endif %}>8%</option>
<option value="9" {% if vendors.vendorCoverAmount == 9 %} selected="selected" {% endif %}>9%</option>
<option value="10" {% if vendors.vendorCoverAmount == 10 %} selected="selected" {% endif %}>10%</option>
</select>
<span id="vendorCoverAmountHelpBlock" class="form-text text-muted">Amount covered by you in case the buyer sends less than required</span>
</div>
</div>
<div class="form-group row">
<label for="vendorPayWindow" class="col-4 col-form-label">Payment</label>
<div class="col-8">
<select id="vendorPayWindow" name="vendorPayWindow" class="custom-select" aria-describedby="vendorPayWindowHelpBlock">
<option value="true" {% if vendors.vendorPayWindow == 1 %} selected="selected" {% endif %}>Hourly</option>
<option value="false" {% if vendors.vendorPayWindow == 0 %} selected="selected" {% endif %}>Daily</option>
</select>
<span id="vendorPayWindowHelpBlock" class="form-text text-muted">When should we send you your payments?</span>
</div>
</div>
<div class="form-group row">
<div class="offset-4 col-8">
<input name="submit" type="submit" class="btn btn-primary" value="Submit" />
</div>
</div>
</form>
</div>
{% if messages %}
<ul class="messages text-center">
{% for message in messages %}
<p{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</p>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</main>
</div>
</div>
<!-- Dashboard -->
<!-- End Page-content -->
<div>
{% block footer %}
{% include "partials/footer.html" %}
{% endblock footer %}
</div>
<!-- end main content-->
{% endblock content %}