BBnepal-Accounts/application/views/admin/setting.php
Sampanna Rimal 9cd05ef3cb commitall
2024-07-10 18:28:19 +05:45

674 lines
35 KiB
PHP

<style>
.register-row {
position: relative;
display: flex;
justify-content: space-between;
}
.passwrd-icon1 {
position: absolute;
top: 5px !important;
right: 8px;
cursor: pointer;
}
.upload-doc-btn-wrap {
position: relative;
}
.error {
color: red;
padding-top: 5px;
}
.upload-doc .upload-btn {
background-color: #032da1;
color: white;
}
</style>
<div class="wraper responsive-width">
<?php $cur_sym = $result['currency'] . '-' . $result['currency_symbol']; ?>
<main class="container" id="main">
<div class="admin_tempblock">
<div class="admin_tempsec">
<div class="admin_sec">
<form id="addSchoolSetting" method="post" action="<?php echo base_url(); ?>admin/AddEditSchoolSetting" enctype="multipart/form-data">
<div class="register-form">
<div class="row">
<div class="col-md-12">
<div class="subject_lhead">
<h3>
<?php echo $title; ?>
</h3>
</div>
</div>
</div>
<br>
<?php
if (!empty($this->session->flashdata('success'))) { ?>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Success!</strong> <?php echo $this->session->flashdata('success'); ?>
</div>
<?php
}
if (!empty($this->session->flashdata('danger'))) {
?>
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert">&times;</a>
<strong>Failed!</strong> <?php echo $this->session->flashdata('danger'); ?>
</div>
<?php } ?>
<?php
// echo '<pre>';
// print_r($result);
?>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-9 row">
<div class="col-md-6">
<label>School Name <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="text" name="sname" class="sname form-control" id="sname" placeholder="" value="<?php echo $result['school_name']; ?>" />
</div>
<label id="sname-error" class="error" for="sname"></label>
</div>
<div class="col-md-6">
<label>Established Year</label>
<div class="register-row">
<input type="text" name="scode" class="scode form-control" id="scode" placeholder="" value="<?php echo $result['school_code']; ?>" />
</div>
<label id="scode-error" class="error" for="scode"></label>
</div>
<div class="col-md-6">
<label>Email <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="text" name="semail" id="semail" class="semail form-control" placeholder="" value="<?php echo $result['email']; ?>">
</div>
<label id="semail-error" class="error" for="semail"></label>
</div>
<div class="col-md-6">
<label>Phone <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="text" name="scontact" class="scontact form-control" id="scontact" placeholder="" value="<?php echo $result['phone']; ?>">
</div>
<label id="scontact-error" class="error" for="scontact"></label>
</div>
<div class="col-md-6">
<label>Address <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="text" name="saddress" class="saddress2 form-control" id="saddress" placeholder=" " value="<?php echo $result['address']; ?>">
</div>
<label id="saddress-error" class="error" for="saddress"></label>
</div>
<div class="col-md-6">
<label>Website Link </label>
<div class="register-row">
<input type="text" name="swebsite" class="swebsite form-control" id="swebsite" placeholder=" " value="<?php echo $result['website_link']; ?>">
</div>
<label id="swebsite-error" class="error" for="swebsite"></label>
</div>
<div class="col-md-6">
<label>Twitter Link </label>
<div class="register-row">
<input type="text" name="stwitter" class="stwitter form-control" id="stwitter" placeholder=" " value="<?php echo $result['twitter']; ?>">
</div>
<label id="stwitter-error" class="error" for="stwitter"></label>
</div>
<div class="col-md-6">
<label>Instagram Link </label>
<div class="register-row">
<input type="text" name="sinstagram" class="sinstagram form-control" id="sinstagram" placeholder value="<?php echo $result['instagram']; ?>">
</div>
<label id="sinstagram-error" class="error" for="sinstagram"></label>
</div>
<div class="col-md-6">
<label>Facebook Link </label>
<div class="register-row">
<input type="text" name="sfacebook" class="sfacebook form-control" id="sfacebook" placeholder="" value="<?php echo $result['facebook']; ?>">
</div>
<label id="sfacebook-error" class="error" for="sfacebook"></label>
</div>
<div class="col-md-6">
<label>Date Format </label>
<div class="register-row">
<select name="sdateformat" class="sdateformat form-control" id="sdateformat">
<option value="">Select Date Format</option>
<option value="d-m-Y"> d-m-Y</option>
</select>
</div>
<label id="sdateformat-error" class="error" for="sdateformat"></label>
</div>
<div class="col-md-6">
<label>Select Batch <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<select name="sbatch" class="sbatch form-control" id="sbatch">
<option value="">Select Batch</option>
<?php
foreach ($batch as $c) {
if ($c['id'] == $result['batch_id']) {
?>
<option value="<?= $c['id'] ?>" selected><?= $c['b_name'] ?></option>
<!-- <option value="<?= $c['id'] ?>" selected><?= batchdateFormatTo($c['b_from'], $c['b_end']); ?></option> -->
<?php } else { ?>
<option value="<?= $c['id'] ?>"><?= $c['b_name'] ?></option>
<!-- <option value="<?= $c['id'] ?>"><?= batchdateFormatTo($c['b_from'], $c['b_end']); ?></option> -->
<?php }
} ?>
</select>
</div>
<label id="sbatch-error" class="error" for="sbatch"></label>
</div>
<div class="col-md-6">
<label>Currency Symbol <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<select name="scurrency" class="scurrency form-control" id="scurrency">
<option value="">Select Currency</option>
<?php foreach ($currency as $key => $value) {
if ($value == $cur_sym) { ?>
<option value="<?php echo $value ?>" selected><?php echo $value ?></option>
<?php } else { ?>
<option value="<?php echo $value ?>"><?php echo $value ?></option>
<?php }
} ?>
</select>
</div>
<label id="scurrency-error" class="error" for="scurrency"></label>
</div>
<div class="col-md-6">
<label>PAN Number <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="text" name="span" class="span form-control" id="span" placeholder="" value="<?php echo $result['pan']; ?>" style="text-transform:uppercase" maxlength="10">
</div>
<label id="span-error" class="error" for="span"></label>
</div>
<div class="col-md-6">
<label>School Prefix <span class="text-danger">(For Student,Staff,Parent ID)</span></label>
<div class="register-row">
<input type="text" name="school_prefix_id" class="sprefix form-control" id="school_prefix_id" placeholder="Please enter School Prefix" value="<?php echo $result['school_prefix_id']; ?>" style="text-transform:uppercase" minlength="2" maxlength="5">
</div>
<label id="school_prefix_id-error" class="error" for="school_prefix_id"></label>
</div>
<div class="col-md-6">
<label>Invoice/Bill Prefix <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="text" name="invoice_prefix" class="span form-control" id="sinvoice_prefix" placeholder="Please Enter Inovice / Bill prefix" value="<?php echo $result['invoice_prefix']; ?>" style="text-transform:uppercase" maxlength="6">
</div>
<label id="invoice_prefix-error" class="error" for="invoice_prefix"></label>
</div>
<div class="col-md-6">
<label>Invoice/Bill Start No. <b class="text-danger" style=" font-size: 16px;">*</b></label>
<div class="register-row">
<input type="number" name="invoice_sno" class="span form-control" id="invoice_sno" placeholder="Please Enter Bill Start From" value="<?php echo set_value('invoice_sno', $result['invoice_sno']); ?>" min="0" maxlength="10">
</div>
<label id="invoice_sno-error" class="error" for="invoice_sno"></label>
</div>
<div class="col-md-12">
<label class="mr-3">Invoice Prefix <b class="text-danger" style=" font-size: 16px;">*</b></label>
<label for=""><input type="radio" name="invoice_prefix_status" value="1" <?php echo ($result['invoice_prefix_status'] == 1) ? "checked" : "" ?>> &nbsp; Enabled</label> &nbsp;&nbsp;
<label for=""><input type="radio" name="invoice_prefix_status" value="0" <?php echo ($result['invoice_prefix_status'] == 0) ? "checked" : "" ?>> &nbsp; Disabled</label>
</div>
</div>
</div>
</div>
<div class="col-md-12 pt-4">
<div class="row">
<div class="col-md-12">
<label for=""> Image Type <span style="font-size:13px">(png)</span>
<div class="mt-1">
<label class="text-danger" style="font-size: 12px;font-weight: 500;">Image Size should be 210 * 55 px</label>
</div>
</label>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<div class="upload-doc">
<label>Authorized Signature</label>
<!-- <span id="uploaded-file">&nbsp</span> -->
<div class="upload-doc-btn-wrap">
<input type="file" name="ssigniture" id="ssigniture" accept=".png" value="" />
<label for="ssigniture" class="upload-btn" id="uploadBtn1">Upload</label>
<label for="ssigniture" class="upload-btn re-upload-btn" id="uploadBtn2">Upload</label>
</div>
</div>
</div>
<div class="col-md-6">
<img src="<?php echo (!empty($school_info['authorized_signature'])) ? base_url('common_assets/') . $school_info['authorized_signature'] : base_url('common_assets/No-Image.jpg'); ?>" style="max-width: 299px; max-height: 55px;">
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<div class="upload-doc">
<label>White Logo<b class="text-danger" style=" font-size: 16px;">*</b></label>
<!-- <span id="uploaded-file">&nbsp</span> -->
<div class="upload-doc-btn-wrap">
<input type="file" name="swhiteLogo" id="swhiteLogo" accept=".png" value="" />
<label for="swhiteLogo" class="upload-btn" id="uploadBtn3">Upload</label>
<label for="swhiteLogo" class="upload-btn re-upload-btn" id="uploadBtn4">Upload</label>
</div>
</div>
</div>
<div class="col-md-6">
<img src="<?php echo (!empty($school_info['logo'])) ? base_url('common_assets/') . $school_info['logo'] : base_url('common_assets/No-Image.jpg'); ?>" class="p-2" style="background-color: #032da1;" style="max-width: 299px; max-height: 55px;">
</div>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<div class="upload-doc">
<label>Color Logo <b class="text-danger" style=" font-size: 16px;">*</b></label>
<!-- <span id="uploaded-file">&nbsp</span> -->
<div class="upload-doc-btn-wrap">
<input type="file" name="scolorLogo" id="scolorLogo" accept=".png" value="" />
<label for="scolorLogo" class="upload-btn" id="uploadBtn5">Upload</label>
<label for="scolorLogo" class="upload-btn re-upload-btn" id="uploadBtn6">Upload</label>
</div>
</div>
</div>
<div class="col-md-6">
<img src="<?php echo (!empty($school_info['color_logo'])) ? base_url('common_assets/') . $school_info['color_logo'] : base_url('common_assets/No-Image.jpg'); ?>" style="max-width: 299px; max-height: 55px;">
</div>
</div>
</div>
<!-- Marks cardc heder image start -->
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<div class="upload-doc">
<label>Upload Logo for result <b class="text-danger" style=" font-size: 16px;">* <span style="font-size:9px;font-weight:bold;">Image size should be b/w width(200px-250px), height(175px-225px)</span></b></label>
<!-- <span id="uploaded-file">&nbsp</span> -->
<div class="upload-doc-btn-wrap">
<input type="file" name="markscard_header" id="logofor_result" accept=".png,.jpg,.jpeg" value="" />
<label for="logofor_result" class="upload-btn" id="uploadBtn7">Upload</label>
<label for="logofor_result" class="upload-btn re-upload-btn" id="uploadBtn8">Upload</label>
</div>
</div>
</div>
<div class="col-md-6">
<img src="<?php echo (!empty($school_info['markscard_header'])) ? base_url('common_assets/') . $school_info['markscard_header'] : base_url('common_assets/No-Image.jpg'); ?>" style="max-width: 299px; max-height: 55px;">
</div>
</div>
</div>
<!-- marks header image end here -->
</div>
</div>
</div>
<div class="row text-center justify-content-center">
<div class="col-md-12 ">
<div class="row">
<div class="col-md-10">
<div class="register-btn">
<button class="btn btn-md pr-5 pl-5 bg-success text-white" type="submit" id="school_update">Update</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<!----admin template section end---->
</main>
<!--End right-top side-->
</div>
<script>
jQuery.validator.addMethod("fullnameregex", function(value, element) {
return this.optional(element) || /^[a-zA-Z ]{3,100}$/.test(value);
}, 'Please enter alpha characters only ');
jQuery.validator.addMethod("emailregex", function(value, element) {
return this.optional(element) || /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/.test(value);
}, 'Email Address is invalid: Please enter a valid email address.');
jQuery.validator.addMethod("phonenumberregex", function(value, element) {
return this.optional(element) || /^[0-9]{8,14}$/.test(value);
}, 'Please enter a digits vaild phone number.');
jQuery.validator.addMethod("genral_regex", function(value, element) {
return this.optional(element) || /^[a-zA-Z0-9 -#]{1,50}$/.test(value);
}, 'Please enter alpha characters only');
jQuery.validator.addMethod("pannumberregex", function(value, element) {
return this.optional(element) || /^[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}$/.test(value);
}, 'Please enter correct PAN numner.');
jQuery.validator.addMethod('prefixregex', function(value, element) {
return this.optional(element) || /^[a-zA-Z]{2,6}$/.test(value);
}, 'Please enter alpha characters.')
var v = $("#addSchoolSetting").validate({
ignore: ':hidden',
rules: {
sname: {
required: true,
minlength: 3,
maxlength: 100,
fullnameregex: true,
},
semail: {
required: true,
email: true,
emailregex: true
},
scontact: {
required: true,
minlength: 8,
maxlength: 14,
phonenumberregex: true
},
sbatch: {
required: true
},
scurrency: {
required: true
},
span: {
required: true,
minlength: 2
},
saddress: {
required: true
},
school_prefix_id: {
required: true,
minlength: 2,
maxlength: 5,
prefixregex: true
},
swhiteLogo: {
required: function(element) {
var name = $('#school_update').text();
if (name == 'Update') {
return false;
} else {
return true;
}
}
},
scolorLogo: {
required: function(element) {
var name = $('#school_update').text();
if (name == 'Update') {
return false;
} else {
return true;
}
}
}
},
messages: {
semailre: {
required: "Enter your Email",
equalTo: "Please enter the same email address again.",
},
scontact: {
minlength: "Please Enter a digits valid phone Number",
maxlength: "Please Enter a Max 14 digits valid phone Number",
}
},
submitHandler: function(form) {
form.submit();
}
});
</script>
<script>
var _URL = window.URL || window.webkitURL;
$('#swhiteLogo').change(function() {
var checker = 1;
// var filename = $(this).val().replace(/C:\\fakepath\\/i, '')
// alert(filename);
var fileExtension = ['png'];
if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
alert("Only formats are allowed : " + fileExtension.join(', '));
$('#swhiteLogo').val('');
}
var file, img;
if ((file = this.files[0])) {
img = new Image();
img.onload = function() {
if ((this.width >= 200 && this.width <= 250) && (this.height >= 50 && this.height <= 60)) {
} else {
alert("change the size of image");
$('#swhiteLogo').val('');
}
};
img.onerror = function() {
alert("not a valid file: " + file.type);
$('#swhiteLogo').val('');
};
img.src = _URL.createObjectURL(file);
}
});
$('#ssigniture').change(function() {
var checker = 1;
// var filename = $(this).val().replace(/C:\\fakepath\\/i, '')
// alert(filename);
var fileExtension = ['png'];
if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
alert("Only formats are allowed : " + fileExtension.join(', '));
$('#ssigniture').val('');
}
var file, img;
if ((file = this.files[0])) {
img = new Image();
img.onload = function() {
if ((this.width >= 200 && this.width <= 250) && (this.height >= 50 && this.height <= 60)) {
} else {
alert("change the size of image");
$('#ssigniture').val('');
}
};
img.onerror = function() {
alert("not a valid file: " + file.type);
$('#ssigniture').val('');
};
img.src = _URL.createObjectURL(file);
}
});
$('#scolorLogo').change(function() {
var checker = 1;
// var filename = $(this).val().replace(/C:\\fakepath\\/i, '')
// alert(filename);
var fileExtension = ['png'];
if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
alert("Only formats are allowed : " + fileExtension.join(', '));
$('#scolorLogo').val('');
}
var file, img;
if ((file = this.files[0])) {
img = new Image();
img.onload = function() {
if ((this.width >= 200 && this.width <= 250) && (this.height >= 50 && this.height <= 60)) {
} else {
alert("change the size of image");
$('#scolorLogo').val('');
}
};
img.onerror = function() {
alert("not a valid file: " + file.type);
$('#scolorLogo').val('');
};
img.src = _URL.createObjectURL(file);
}
});
$('#logofor_result').change(function() {
// alert("shivuu");
var checker = 1;
// var filename = $(this).val().replace(/C:\\fakepath\\/i, '')
// alert(filename);
var fileExtension = ['png', 'jpeg', 'jpg'];
if ($.inArray($(this).val().split('.').pop().toLowerCase(), fileExtension) == -1) {
alert("Only formats are allowed : " + fileExtension.join(', '));
$('#logofor_result').val('');
}
var file, img;
if ((file = this.files[0])) {
img = new Image();
img.onload = function() {
// alert(this.width);
// if ((this.width >= 200 && this.width <= 250) && (this.height >= 175 && this.height <= 225)) {
// } else {
// alert("Image size should be between width(200px-250px) & height(175px-225px)");
// $('#logofor_result').val('');
}
};
img.onerror = function() {
alert("not a valid file: " + file.type);
$('#logofor_result').val('');
};
img.src = _URL.createObjectURL(file);
}
});
</script>
<script type="text/javascript">
$("#printSection").on("click", function() {
var element = $(".bill_count").text();
var frame1 = $('<iframe />').attr("id", "printDiv");
frame1[0].name = "frame1";
frame1.css({
"position": "absolute",
"top": "-1000000px"
});
var divContents = $("#printpage").html();
$("body").append(frame1);
var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;
frameDoc.document.open();
//Create a new HTML document.
frameDoc.document.write('<html>');
frameDoc.document.write('<head>');
frameDoc.document.write('<title></title>');
// frameDoc.document.write('<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap.min.css">');
frameDoc.document.write('<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/invoice.css">');
frameDoc.document.write('<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/bootstrap.min.css">');
frameDoc.document.write('<link rel="stylesheet" href="<?php echo base_url(); ?>assets_admin/css/all.css">');
// frameDoc.document.write('<style rel="stylesheet" type="text/css" media="print">@page { size: landscape; }</style>');
frameDoc.document.write('</head>');
frameDoc.document.write('<body>');
frameDoc.document.write('<div class = "col-md-3" > <div class="w-25 border align-items-center justify-content-center">');
// frameDoc.document.write(divContents);
frameDoc.document.write('<img class="mr-auto w-100 pl-4 pr-4 pt-4" src="<?php echo (!empty($school_info['school_qr_code'])) ? base_url() . '' . $school_info['school_qr_code'] : base_url('common_assets/No-Image.jpg'); ?>" style="max-width: 299px;">');
frameDoc.document.write('<p class="w-100 text-center h6 mb-0" style="font-size:small"><?php echo $result['school_name']; ?> </p>');
frameDoc.document.write('<p class="w-100 text-center h6 mb-4" style="font-size:x-small; font-weight:500"><?php echo $result['address']; ?> </p>');
frameDoc.document.write(' </div> </div>');
frameDoc.document.write('</body>');
frameDoc.document.write('</html>');
frameDoc.document.close();
setTimeout(function() {
document.getElementById('printDiv').contentWindow.focus();
document.getElementById('printDiv').contentWindow.print();
// frame1.remove();
if (winload) {
window.location.reload(true);
}
}, 500);
return true;
});
</script>