done
This commit is contained in:
parent
d4170a12d9
commit
26533eb6df
|
@ -178,6 +178,10 @@ const propertySchema = mongoose.Schema({
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true, // Set to true if this field is mandatory
|
required: true, // Set to true if this field is mandatory
|
||||||
},
|
},
|
||||||
|
sellpricebtoc:{
|
||||||
|
type: Number,
|
||||||
|
required: true, // Set to true if this field is mandatory
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const PropertyModal = mongoose.model("property", propertySchema);
|
const PropertyModal = mongoose.model("property", propertySchema);
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-P2J43GlO.js"></script>
|
<script type="module" crossorigin src="/assets/index-CfFcG7AV.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-iEl-il0E.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -585,7 +585,8 @@ const Addproperty = () => {
|
||||||
formData.extwall &&
|
formData.extwall &&
|
||||||
formData.roofing &&
|
formData.roofing &&
|
||||||
formData.totalSqft &&
|
formData.totalSqft &&
|
||||||
formData.totalcashsurplus
|
formData.totalcashsurplus &&
|
||||||
|
formData.sellpricebtoc
|
||||||
) {
|
) {
|
||||||
const totalCostsAtoB = calculateTotalCosts();
|
const totalCostsAtoB = calculateTotalCosts();
|
||||||
const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits();
|
const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits();
|
||||||
|
@ -1593,21 +1594,41 @@ const Addproperty = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-4">
|
<div className="col-md-4">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="form-control"
|
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""}`}
|
||||||
value={formData.purchaseCost}
|
value={formData.purchaseCost}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
setFormData({
|
const value = e.target.value;
|
||||||
...formData,
|
const isValid = /^\d*\.?\d*$/.test(value); // Regex to allow only numbers and decimal points
|
||||||
purchaseCost: e.target.value,
|
setFormData({
|
||||||
})
|
...formData,
|
||||||
}
|
purchaseCost: value,
|
||||||
placeholder="Enter Purchase Cost"
|
isPurchaseCostInvalid: !isValid, // Set isPurchaseCostInvalid to true if the value is not a valid number
|
||||||
style={{ textAlign: "right" }}
|
});
|
||||||
required
|
}}
|
||||||
/>
|
onKeyPress={(e) => {
|
||||||
</div>
|
const charCode = e.charCode;
|
||||||
|
// Allow only numbers and decimal points
|
||||||
|
if ((charCode < 48 || charCode > 57) && charCode !== 46) {
|
||||||
|
e.preventDefault(); // Prevent non-numeric input
|
||||||
|
setFormData({
|
||||||
|
...formData,
|
||||||
|
isPurchaseCostInvalid: true, // Set isPurchaseCostInvalid to true to show the alert
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
placeholder="Enter Purchase Cost"
|
||||||
|
style={{ textAlign: "right" }}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
{formData.isPurchaseCostInvalid && (
|
||||||
|
<div className="invalid-feedback">
|
||||||
|
Please enter a valid number.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<hr
|
<hr
|
||||||
style={{
|
style={{
|
||||||
|
@ -2421,6 +2442,69 @@ const Addproperty = () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<div className="row gy-3 align-items-center">
|
||||||
|
<span
|
||||||
|
className="col-md-4"
|
||||||
|
style={{
|
||||||
|
color: "#fda417",
|
||||||
|
fontSize: "14px",
|
||||||
|
fontWeight: "bold",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Selling Price B to C
|
||||||
|
</span>
|
||||||
|
<div className="col-md-4">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className={`form-control ${formData.isInvalid ? "is-invalid" : ""}`}
|
||||||
|
name="sellpricebtoc"
|
||||||
|
value={formData.sellpricebtoc}
|
||||||
|
onChange={(e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
const isValid = /^\d*\.?\d*$/.test(value); // Allow only numbers and decimal points
|
||||||
|
setFormData({
|
||||||
|
...formData,
|
||||||
|
sellpricebtoc: value,
|
||||||
|
isInvalid: !isValid, // Set isInvalid to true if the value is not a valid number
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
onKeyPress={(e) => {
|
||||||
|
const charCode = e.charCode;
|
||||||
|
// Allow only numbers and decimal point
|
||||||
|
if ((charCode < 48 || charCode > 57) && charCode !== 46) {
|
||||||
|
e.preventDefault(); // Prevent non-numeric input
|
||||||
|
setFormData({
|
||||||
|
...formData,
|
||||||
|
isInvalid: true, // Set isInvalid to true to show the alert
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
placeholder="Selling Price B to C"
|
||||||
|
style={{ textAlign: "right" }}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
{formData.isInvalid && (
|
||||||
|
<div className="invalid-feedback">
|
||||||
|
Please enter a valid number.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr
|
||||||
|
style={{
|
||||||
|
borderColor: "#fda417", // Set the color of the line
|
||||||
|
borderWidth: "1px", // Optional: Adjust the thickness of the line
|
||||||
|
backgroundColor: "#fda417", // Optional: Apply color if using for background
|
||||||
|
height: "1px", // Optional: Set height to match the border width
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue