done
This commit is contained in:
parent
ff5192bb80
commit
992a358b6f
|
@ -98,6 +98,10 @@ const propertySchema = mongoose.Schema({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
totalcredits:{
|
||||||
|
type: Number,
|
||||||
|
required: true, // Set to true if this field is mandatory
|
||||||
|
},
|
||||||
totalCostsAtoBaftercredits: {
|
totalCostsAtoBaftercredits: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true, // Set to true if this field is mandatory
|
required: true, // Set to true if this field is mandatory
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-ZCzzzmuO.js"></script>
|
<script type="module" crossorigin src="/assets/index-m-bZKZ3O.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,14 @@ const Addproperty = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const calculateTotalCredits = () => {
|
||||||
|
return formData.credits.reduce((total, credits) => {
|
||||||
|
const price = parseFloat(credits.price);
|
||||||
|
return total + (isNaN(price) ? 0 : price); // Ensure only valid numbers are added
|
||||||
|
}, 0);
|
||||||
|
};
|
||||||
|
|
||||||
const calculateTotalCostsWithCredits = () => {
|
const calculateTotalCostsWithCredits = () => {
|
||||||
// Calculate total from costPaidAtoB array
|
// Calculate total from costPaidAtoB array
|
||||||
const totalCostsFromArray = formData.costPaidAtoB.reduce((total, cost) => {
|
const totalCostsFromArray = formData.costPaidAtoB.reduce((total, cost) => {
|
||||||
|
@ -324,6 +332,7 @@ const Addproperty = () => {
|
||||||
const totalCostsAtoB = calculateTotalCosts();
|
const totalCostsAtoB = calculateTotalCosts();
|
||||||
const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits();
|
const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits();
|
||||||
const totalincidentalCost = calculateTotalincidentalCost();
|
const totalincidentalCost = calculateTotalincidentalCost();
|
||||||
|
const totalcredits= calculateTotalCredits();
|
||||||
|
|
||||||
// Add user info to formData, including the propertyTaxInfo array
|
// Add user info to formData, including the propertyTaxInfo array
|
||||||
const formDataWithUserInfo = {
|
const formDataWithUserInfo = {
|
||||||
|
@ -335,6 +344,7 @@ const Addproperty = () => {
|
||||||
useremail: user?.result?.email,
|
useremail: user?.result?.email,
|
||||||
userId: user?.result?.userId,
|
userId: user?.result?.userId,
|
||||||
totalCostsAtoB: totalCostsAtoB,
|
totalCostsAtoB: totalCostsAtoB,
|
||||||
|
totalcredits:totalcredits,
|
||||||
totalCostsAtoBaftercredits: totalCostsAtoBaftercredits,
|
totalCostsAtoBaftercredits: totalCostsAtoBaftercredits,
|
||||||
totalincidentalCost:totalincidentalCost,
|
totalincidentalCost:totalincidentalCost,
|
||||||
};
|
};
|
||||||
|
@ -1312,7 +1322,7 @@ const Addproperty = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<hr />
|
||||||
|
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
|
@ -1414,6 +1424,7 @@ const Addproperty = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
|
@ -1487,6 +1498,39 @@ const Addproperty = () => {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div className="row gy-3 align-items-center">
|
||||||
|
<span
|
||||||
|
className="col-md-4"
|
||||||
|
style={{
|
||||||
|
color: "#fda417",
|
||||||
|
fontSize: "14px",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Total credits
|
||||||
|
</span>
|
||||||
|
<div className="col-md-4">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
name="totalcredits"
|
||||||
|
value={calculateTotalCredits()}
|
||||||
|
readOnly
|
||||||
|
style={{
|
||||||
|
borderColor: "#fda417", // Custom border color for the input field
|
||||||
|
color: "#fda417", // Optionally apply text color to the input text
|
||||||
|
textAlign: "right",
|
||||||
|
}}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div className="row gy-3 align-items-center">
|
<div className="row gy-3 align-items-center">
|
||||||
<span
|
<span
|
||||||
className="col-md-4"
|
className="col-md-4"
|
||||||
|
@ -1619,8 +1663,10 @@ const Addproperty = () => {
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
|
|
Loading…
Reference in New Issue