bbone/application/modules/Asset/views/asset_value_form.php
2024-03-23 16:51:12 +05:30

79 lines
4.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="modal-dialog modal-lm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel2"><?php echo $heading; ?></h4>
<button type="button" id="close-form" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
</div>
<form data-parsley-validate class="form-horizontal form-label-left" method="post" action="<?php echo base_url();?>Asset/add_or_edit_asset_value" >
<div class="modal-body">
<div class="x_content">
<br />
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name();?>" value="<?php echo $this->security->get_csrf_hash();?>">
<input type="hidden" name="id" value="<?php if(isset($assetValueData)) { echo $assetValueData->id; } ?>">
<input type="hidden" name="asset_id" value="<?php if(isset($assetValueData)) { echo $assetValueData->asset_id; } ?>">
<input type="hidden" name="business_id" value="<?php if(isset($assetValueData)) { echo $assetValueData->business_id; } ?>">
<input type="hidden" name="asset_id_for_add" value="<?php if(isset($asset_id)) { echo $asset_id; } ?>">
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Type</label>
<div class="col-md-9 col-sm-9 ">
<select id="type" name="type" required="required" class="form-control" >
<option value="<?php if(isset($assetValueData)) { echo $assetValueData->type; } ?>"><?php if(isset($assetValueData)) { echo $assetValueData->type; } ?></option>
<option value="Depreciation">Depreciation</option>
<option value="Upgrade">Upgrade</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Name</label>
<div class="col-md-9 col-sm-9 ">
<input type="text" class="form-control" name="name" value="<?php if(isset($assetValueData)) { echo $assetValueData->name; } ?>">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Value</label>
<div class="col-md-9 col-sm-9 ">
<input type="text" class="form-control" name="value" value="<?php if(isset($assetValueData)) { echo $assetValueData->value; } ?>">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Percentage</label>
<div class="col-md-9 col-sm-9 ">
<input type="text" class="form-control" name="percentage" value="<?php if(isset($assetValueData)) { echo $assetValueData->percentage; } ?>">
</div>
</div>
<div class="form-group row">
<label class="col-form-label col-md-3 col-sm-3 ">Description</label>
<div class="col-md-9 col-sm-9 ">
<input type="text" class="form-control" name="description" value="<?php if(isset($assetValueData)) { echo $assetValueData->description; } ?>">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="close-form">Close</button>
<button type="submit" class="btn btn-primary"><?php echo $submit_button_title; ?></button>
</div>
</form>
</div>
</div>
<script>
document.querySelector('form').addEventListener('submit', function(event) {
var form = event.target;
var submitBtn = form.querySelector('button[type="submit"]');
if (!form.checkValidity()) {
form.reportValidity(); // Display validation error messages
event.preventDefault(); // Prevent form submission if it's not valid
submitBtn.disabled = false;
} else {
submitBtn.disabled = true;
}
});
</script>