done
This commit is contained in:
parent
d4170a12d9
commit
26533eb6df
|
@ -178,6 +178,10 @@ const propertySchema = mongoose.Schema({
|
|||
type: Number,
|
||||
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);
|
||||
|
|
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">
|
||||
</head>
|
||||
|
||||
|
|
|
@ -585,7 +585,8 @@ const Addproperty = () => {
|
|||
formData.extwall &&
|
||||
formData.roofing &&
|
||||
formData.totalSqft &&
|
||||
formData.totalcashsurplus
|
||||
formData.totalcashsurplus &&
|
||||
formData.sellpricebtoc
|
||||
) {
|
||||
const totalCostsAtoB = calculateTotalCosts();
|
||||
const totalCostsAtoBaftercredits = calculateTotalCostsWithCredits();
|
||||
|
@ -1593,21 +1594,41 @@ const Addproperty = () => {
|
|||
/>
|
||||
</div>
|
||||
<div className="col-md-4">
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
value={formData.purchaseCost}
|
||||
onChange={(e) =>
|
||||
setFormData({
|
||||
...formData,
|
||||
purchaseCost: e.target.value,
|
||||
})
|
||||
}
|
||||
placeholder="Enter Purchase Cost"
|
||||
style={{ textAlign: "right" }}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
type="text"
|
||||
className={`form-control ${formData.isPurchaseCostInvalid ? "is-invalid" : ""}`}
|
||||
value={formData.purchaseCost}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
const isValid = /^\d*\.?\d*$/.test(value); // Regex to allow only numbers and decimal points
|
||||
setFormData({
|
||||
...formData,
|
||||
purchaseCost: value,
|
||||
isPurchaseCostInvalid: !isValid, // Set isPurchaseCostInvalid to true if the value is not a valid number
|
||||
});
|
||||
}}
|
||||
onKeyPress={(e) => {
|
||||
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>
|
||||
<hr
|
||||
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