Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
TreyWW committed Jan 31, 2024
2 parents 0bd3f4c + 524ee37 commit c867b38
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 108 deletions.
17 changes: 17 additions & 0 deletions backend/migrations/0009_alter_invoice_sort_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.1.7 on 2024-01-31 08:15

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("backend", "0008_receiptdownloadtoken"),
]

operations = [
migrations.AlterField(
model_name="invoice",
name="sort_code",
field=models.CharField(blank=True, max_length=8, null=True),
),
]
10 changes: 6 additions & 4 deletions backend/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import smtplib
from django.utils import timezone
from uuid import uuid4

from django.contrib import messages
from django.contrib.auth.models import User, UserManager, AbstractUser
from django.core.mail import EmailMessage
from django.db import models
from settings import settings
from django.utils import timezone
from django.utils.crypto import get_random_string
from shortuuid.django_fields import ShortUUIDField
from uuid import uuid4

from settings import settings


class CustomUserManager(UserManager):
Expand Down Expand Up @@ -203,7 +205,7 @@ class Invoice(models.Model):
self_county = models.CharField(max_length=100, blank=True, null=True)
self_country = models.CharField(max_length=100, blank=True, null=True)

sort_code = models.CharField(max_length=100, blank=True, null=True)
sort_code = models.CharField(max_length=8, blank=True, null=True) # 12-34-56
account_holder_name = models.CharField(max_length=100, blank=True, null=True)
account_number = models.CharField(max_length=100, blank=True, null=True)
reference = models.CharField(max_length=100, blank=True, null=True)
Expand Down
104 changes: 9 additions & 95 deletions frontend/static/src/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -1572,20 +1572,6 @@ html {
padding: 1rem;
}

.indicator {
position: relative;
display: inline-flex;
width: -moz-max-content;
width: max-content;
}

.indicator :where(.indicator-item) {
z-index: 1;
position: absolute;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
white-space: nowrap;
}

.input {
flex-shrink: 1;
-webkit-appearance: none;
Expand Down Expand Up @@ -3624,78 +3610,6 @@ html {
visibility: visible;
}

.indicator :where(.indicator-item) {
bottom: auto;
inset-inline-end: 0px;
inset-inline-start: auto;
top: 0px;
--tw-translate-y: -50%;
--tw-translate-x: 50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

:is([dir="rtl"] .indicator :where(.indicator-item)) {
--tw-translate-x: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.indicator :where(.indicator-item.indicator-start) {
inset-inline-end: auto;
inset-inline-start: 0px;
--tw-translate-x: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

:is([dir="rtl"] .indicator :where(.indicator-item.indicator-start)) {
--tw-translate-x: 50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.indicator :where(.indicator-item.indicator-center) {
inset-inline-end: 50%;
inset-inline-start: 50%;
--tw-translate-x: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

:is([dir="rtl"] .indicator :where(.indicator-item.indicator-center)) {
--tw-translate-x: 50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.indicator :where(.indicator-item.indicator-end) {
inset-inline-end: 0px;
inset-inline-start: auto;
--tw-translate-x: 50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

:is([dir="rtl"] .indicator :where(.indicator-item.indicator-end)) {
--tw-translate-x: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.indicator :where(.indicator-item.indicator-bottom) {
bottom: 0px;
top: auto;
--tw-translate-y: 50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.indicator :where(.indicator-item.indicator-middle) {
bottom: 50%;
top: 50%;
--tw-translate-y: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.indicator :where(.indicator-item.indicator-top) {
bottom: auto;
top: 0px;
--tw-translate-y: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.join.join-vertical {
flex-direction: column;
}
Expand Down Expand Up @@ -4468,7 +4382,7 @@ html {
}

.w-1\/3 {
width: 33.333333%;
width: 33.333333%;
}

.w-10 {
Expand All @@ -4488,7 +4402,7 @@ html {
}

.w-2\/3 {
width: 66.666667%;
width: 66.666667%;
}

.w-3 {
Expand Down Expand Up @@ -4540,7 +4454,7 @@ html {
}

.w-\[100\%\] {
width: 100%;
width: 100%;
}

.w-\[150px\] {
Expand All @@ -4556,7 +4470,7 @@ html {
}

.w-\[50\%\] {
width: 50%;
width: 50%;
}

.w-\[60\%\] {
Expand Down Expand Up @@ -4740,13 +4654,13 @@ html {
column-gap: 0.75rem;
}

.gap-y-1 {
row-gap: 0.25rem;
.gap-x-4 {
-moz-column-gap: 1rem;
column-gap: 1rem;
}

.gap-x-4 {
-moz-column-gap: 1rem;
column-gap: 1rem;
.gap-y-1 {
row-gap: 0.25rem;
}

.space-x-4 > :not([hidden]) ~ :not([hidden]) {
Expand Down
18 changes: 9 additions & 9 deletions frontend/templates/pages/invoices/create/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ <h3 class="text-sm text-natural font-semibold hidden lg:block text-end me-6">To<
<div class="card-body">
<div class="form-control w-full max-w-xs">
<label class="label">Sort Code</label>
<input onkeyup="this.value = validate_sort_code(this.value);" pattern="[0-9]{3}-[0-9]{3}-[0-9]{3}"
name="sort_code" name="sort_code" placeholder="1234-1234-1234" type="text"
<input onkeyup="this.value = validate_sort_code(this.value);" pattern="[0-9]{2}-[0-9]{2}-[0-9]{2}"
name="sort_code" name="sort_code" placeholder="12-34-56" type="text"
class="peer input-bordered input input-block">
<label class="label peer-[&amp;:not(:placeholder-shown):not(:focus):invalid]:block hidden ">
<span class="label-text-alt text-error">Please enter a valid sort code.</span>
Expand Down Expand Up @@ -182,16 +182,16 @@ <h3 class="text-sm text-natural font-semibold hidden lg:block text-end me-6">To<
value = value.replace(/\D/g, '');

// Ensure the value is no longer than 9 characters (123-123-123)
if (value.length > 9) {
value = value.slice(0, 9);
if (value.length > 6) {
value = value.slice(0, 6);
}

// Format the value as "123-123-123"
if (value.length >= 3) {
value = value.slice(0, 3) + "-" + value.slice(3);
// Format the value as "12-34-56"
if (value.length >= 2) {
value = value.slice(0, 2) + "-" + value.slice(2);
}
if (value.length >= 7) {
value = value.slice(0, 7) + "-" + value.slice(7);
if (value.length >= 5) {
value = value.slice(0, 5) + "-" + value.slice(5);
}

return value;
Expand Down

0 comments on commit c867b38

Please sign in to comment.