29.06.2023 changes : Venkateshwaran

This commit is contained in:
venkateswaran ubuntu 2023-06-30 09:56:13 +05:30
parent 01bc88453f
commit f6ea139cb7
2 changed files with 60 additions and 6 deletions

View File

@ -124,7 +124,7 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Name</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_name" name="relation_name" value="<?php if(isset($editData)) { echo $editData->relation_name; } ?>" class="form-control ">
<input type="text" id="relation_name" name="relation_name" value="<?php if(isset($editData)) { echo $editData->relation_name; } ?>" onkeypress="validateKeyPress(event)" class="form-control ">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Relationship</label>
@ -138,12 +138,12 @@
<label class="control-label col-md-1 col-sm-1 " for="first-name"> Mobile</label>
<div class="col-md-5 col-sm-5 ">
<input type="text" id="relation_mobile" name="relation_mobile" value="<?php if(isset($editData)) { echo $editData->relation_mobile; } ?>" class="form-control ">
<input type="text" id="relation_mobile" name="relation_mobile" value="<?php if(isset($editData)) { echo $editData->relation_mobile; } ?>" class="form-control " onkeypress = "return matchnum(event)" required="required" class="form-control" type="tel" pattern="[6-9][0-9]{9}" minlength="10" maxlength="10" oninvalid="setCustomValidity('cant start with number other than 6,7,8,9 or length must be 10.')" oninput="setCustomValidity('')">
</div>
<label class="control-label col-md-1 col-sm-1 " for="email"> Home Tel</label>
<div class="col-md-5 col-sm-5 ">
<input id="relation_tel" name="relation_tel" value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>" class="form-control" type="text" >
<input id="relation_tel" name="relation_tel" value="<?php if(isset($editData)) { echo $editData->relation_tel; } ?>" onkeypress = "return matchnum(event)" class="form-control" type="text" >
</div>
</div>
@ -177,7 +177,7 @@
<label class="control-label col-md-1 col-sm-1 " for="email"> Pincode</label>
<div class="col-md-5 col-sm-5 ">
<input id="pincode" name="pincode" value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" class="form-control" type="text" >
<input id="pincode" name="pincode" value="<?php if(isset($editData)) { echo $editData->pincode; } ?>" onkeypress = "return matchnum(event)" class="form-control" type="text" >
</div>
</div>
@ -275,6 +275,28 @@
</div>
</div>
<script>
function matchnum(event)
{
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true; //only numbers
return false;
}
function validateKeyPress(event) {
var key = event.key;
var allowedCharacters = /^[A-Za-z.]$/;
if (!allowedCharacters.test(key)) {
event.preventDefault();
}
}
$(document).on('change','#image',function(){
const file = this.files[0];

View File

@ -24,6 +24,14 @@
border-radius: 5px;
margin-left: 500px;
}
.hide-arrow {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: none;
</style>
<div class="clearfix"></div>
@ -57,7 +65,7 @@
<label class="control-label col-md-2 col-sm-2 " for="last-name">Expense Requisted For</label>
<div class="col-md-5 col-sm-5 ">
<input type="radio" name="created_by" value="self(<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
<input type="radio" name="created_by" value="self (<?php echo user()->id;?>)"style="margin:10px;"checked /><b>Self</b>
<input type="radio" name="created_by" value="<?php echo user()->name;?> (<?php echo user()->id;?>)" style="margin: 10px;" /><b>Others</b>
@ -148,6 +156,29 @@
</div>
<!-- /Body page content -->
<script>
// hide the dropdown arrow
$(document).ready(function() {
$("#user_dropdown").addClass("hide-arrow");
$("input[name='created_by']").on("change", function() {
var inputValue = $(this).val();
if (inputValue === "<?php echo user()->name;?> (<?php echo user()->id;?>)") {
$("#user_dropdown").removeClass("hide-arrow");
} else {
$("#user_dropdown").addClass("hide-arrow");
}
});
})
</script>
<script>
function validateFile(input) {
const file = input.files[0];
@ -222,8 +253,9 @@ function matchnum(event)
});
$('input[type="radio"][name="created_by"]').change(function() {
var selectedValue = $(this).val();
var $userDropdown = $('#user_dropdown');