"Enhance Add Customer button logic in POS mobile popup: require specific fields to be filled and update conditions for rendering. Simplify input field classes by removing redundant validation styling."

This commit is contained in:
Jeppe Bundgaard
2025-11-19 13:35:47 +01:00
parent b139e606d1
commit d3870b2d0d
@@ -123,7 +123,10 @@ watch([cvr, companyPhone, invoiceEmail, contactEmail, contactPhone], (newValues)
popups.get().actionButtons.splice(index, 1);
}
// Add the "Add Customer" button if all fields are filled
if (newValues.every((value) => value !== "")) {
const requiredFields = [cvr, companyPhone, contactPhone];
if (searchResult.value !== null &&
searchResult.value.name !== "Ikke fundet" &&
requiredFields.every((field) => field.value !== "")) {
popups.get().actionButtons.push({
label: "Tilføj kunde",
onClick: () => {
@@ -197,14 +200,14 @@ watch([cvr, companyPhone, invoiceEmail, contactEmail, contactPhone], (newValues)
<div class="field">
<label class="label"><small>Faktura email</small></label>
<div class="control">
<input v-model="invoiceEmail" class="input" type="text" placeholder="Faktura email" :disabled="searchResult === null" :class="{'is-danger': searchResult !== null && invoiceEmail === ''}"/>
<input v-model="invoiceEmail" class="input" type="text" placeholder="Faktura email" :disabled="searchResult === null"/>
</div>
</div>
<!-- Contact email -->
<div class="field">
<label class="label"><small>Kontakt email</small></label>
<div class="control">
<input v-model="contactEmail" class="input" type="text" placeholder="Kontakt email" :disabled="searchResult === null" :class="{'is-danger': searchResult !== null && contactEmail === ''}"/>
<input v-model="contactEmail" class="input" type="text" placeholder="Kontakt email" :disabled="searchResult === null"/>
</div>
</div>
<!-- Contact phone -->