712 lines
44 KiB
PHP
712 lines
44 KiB
PHP
<html>
|
|
|
|
<head>
|
|
</head>
|
|
<style>
|
|
/* CSS for the preview image */
|
|
.preview-image {
|
|
display: block;
|
|
/* Ensure the image is displayed as a block element */
|
|
width: 120px;
|
|
/* Set the desired width for passport size */
|
|
height: auto;
|
|
/* Set the desired height for passport size */
|
|
object-fit: cover;
|
|
/* Maintain the aspect ratio and fill the container */
|
|
margin-top: 10px;
|
|
/* Add a top margin for spacing */
|
|
}
|
|
|
|
.toggle-icon {
|
|
cursor: pointer;
|
|
margin-left: 5px;
|
|
}
|
|
|
|
#error-message {
|
|
color: red;
|
|
|
|
}
|
|
</style>
|
|
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h4 class="header-title"><?= $page_name; ?></h4>
|
|
<p class="sub-header"> </p>
|
|
<?php if (session()->getFlashdata('success')) : ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
<?= session('success') ?>
|
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<?php endif; ?>
|
|
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_org"; ?>" id="myForm">
|
|
<hr />
|
|
<h4 class="header-title" id="org-settings-title">
|
|
Organization Settings
|
|
<span class="toggle-icon" onclick="toggleSettings('org-settings')">▼</span>
|
|
</h4>
|
|
<br>
|
|
|
|
<div>
|
|
<div class="form-group" id="org-settings">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="bname" class="col-form-label">Organization Name<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="bname" name="bname" value="<?= isset($organzations['title']) ? $organzations['title'] : '' ?>" placeholder="Organization Name" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="bmail" class="col-form-label">Organization Email<span class="text-danger">*</span></label>
|
|
<input type="email" class="form-control" id="bmail" name="bmail" value="<?= isset($organzations['email']) ? $organzations['email'] : '' ?>" placeholder="Email" required onchange="checkExisting(this,'email','bmail','business')"/>
|
|
<span id="bemailValidationMessage"></span>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="pan_no" class="col-form-label">Organization PAN Number<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="pan_no" name="pan_no" value="<?= isset($organzations['pan_no']) ? $organzations['pan_no'] : '' ?>" placeholder="PAN Number" required pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" title="Enter a valid PAN number" onchange="checkExisting(this,'pan_no','pan_no','business')"/>
|
|
<span id="panValidationMessage"></span>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="org_reg_no" class="col-form-label">Organization Reg Number<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="org_reg_no" value="<?= isset($organzations['org_reg_no']) ? $organzations['org_reg_no'] : '' ?>" placeholder="Organization Register Number" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if($loged_user === 'sadmin' || $loged_user === 'admin'){ ?>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label for="80G" class="col-form-label">80G</label>
|
|
<input type="text" class="form-control" id="80G" name="80G" value="<?= isset($organzations['80G']) ? htmlspecialchars($organzations['80G']) : '' ?>" placeholder="80G Tax Free / Registration number" onchange="checkValidityAndSetRequired()"/>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="80G_vaildupto" class="col-form-label">80G Vaild Upto<span class="text-danger 80G-text-danger" style="display:none;">*</span></label>
|
|
<input type="date" class="form-control" id="80G_vaildupto" name="80G_vaildupto" value="<?= !empty($organzations['80G_vaildupto']) ? htmlspecialchars($organzations['80G_vaildupto']) : null ?>" min="<?= date('Y-m-d') ?>">
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="12AA" class="col-form-label">12AA</label>
|
|
<input type="text" class="form-control" id="12AA" name="12AA" value="<?= isset($organzations['12AA']) ? htmlspecialchars($organzations['12AA']) : null ?>" placeholder="12AA Tax Free / Registration number" onchange="checkValidityAndSetRequired()"/>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="12AA_vaildupto" class="col-form-label">12AA Vaild Upto<span class="text-danger 12AA-text-danger" style="display:none;">*</span></label>
|
|
<input type="date" class="form-control" id="12AA_vaildupto" name="12AA_vaildupto" value="<?= !empty($organzations['12AA_vaildupto']) ? htmlspecialchars($organzations['12AA_vaildupto']) : null ?>" min="<?= date('Y-m-d') ?>">
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="bmobile" class="col-form-label">Organization Mobile Number<span class="text-danger">*</span></label>
|
|
<input type="tel" class="form-control" id="bmobile" name="bmobile" value="<?= isset($organzations['mobile_no']) ? $organzations['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d{10}" title="Please enter a 10-digit mobile number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" onchange="checkExisting(this,'mobile_no','bmobile','business')" />
|
|
<span id="bmobileValidationMessage"></span>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-8">
|
|
<label for="baddress" class="col-form-label">Organization Address<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="baddress" value="<?= isset($organzations['address']) ? $organzations['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<label for="bcity" class="col-form-label">City<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="bcity" value="<?= isset($organzations['city']) ? $organzations['city'] : '' ?>" placeholder="City" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="bstate" class="col-form-label">State<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="bstate" value="<?= isset($organzations['state']) ? $organzations['state'] : '' ?>" placeholder="State" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" name="bzip" value="<?= isset($organzations['postal_code']) ? $organzations['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" pattern="[0-9]{6}" maxlength="6" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-3">
|
|
<label for="country" class="col-form-label">Country</label>
|
|
<select class="form-control" id="country" name="country" >
|
|
<option value="<?= isset($organzations['country']) ? $organzations['country'] : '' ?>"><?= isset($organzations['country']) ? $organzations['country'] : '--Select--';?></option>
|
|
<?php foreach ($country_details as $value) { ?>
|
|
<option value="<?php echo $value['country_name']; ?>">
|
|
<?php
|
|
echo $value['country_name'];
|
|
?>
|
|
</option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Existing form fields above this section -->
|
|
<!-- ################################################################################################# -->
|
|
<hr />
|
|
<h4 class="header-title" id="site-settings-title">
|
|
Site Settings
|
|
<span class="toggle-icon" onclick="toggleSettings('site-settings')">▼</span>
|
|
</h4>
|
|
<br>
|
|
<div class="form-group" id="site-settings" style="display: none;">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-12" style="display:none;">
|
|
<label for="postal_code" class="col-form-label">Organization</label>
|
|
<select id="business_id" name="business_id" class="form-control">
|
|
<option value="null"><?php if (!isset($details['business_id'])) {
|
|
echo 'Choose Organization';
|
|
} ?></option>
|
|
<?php foreach ($master_organzation_details as $value) { ?>
|
|
<option value="<?php echo $value['business_id']; ?>" <?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
|
<?php echo $value['title']; ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="site_name" class="col-form-label">Site Name</label>
|
|
<input type="text" class="form-control" id="site_name" name="site_name" value="<?= isset($organzations['site_name']) ? $organzations['site_name'] : '' ?>" placeholder="Site Name" />
|
|
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-text copied from Organization Name field (First time only. If you want to change it means please edit.)</small></span> <?php endif; ?>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="site_title" class="col-form-label">Site Title</label>
|
|
<input type="text" class="form-control" id="site_title" name="site_title" placeholder="Site Title" value="<?= isset($organzations['site_title']) ? $organzations['site_title'] : '' ?>" />
|
|
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-text copied from Organization Name field (First time only. If you want to change it means please edit.)</small></span> <?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="admin_email" class="col-form-label">Admin Email</label>
|
|
<input type="email" class="form-control" id="admin_email" name="admin_email" placeholder="Admin Email" value="<?= isset($organzations['admin_email']) ? $organzations['admin_email'] : '' ?>" onchange="checkExisting(this,'admin_email','admin_email','business')"/>
|
|
<span id="adminemailValidationMessage"></span>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="site_mobile" class="col-form-label">Mobile Number</label>
|
|
<input type="text" class="form-control" id="site_mobile" name="site_mobile" placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number" value="<?= isset($organzations['site_mobile']) ? $organzations['site_mobile'] : '' ?>" pattern="\d{10}" title="Please enter a 10-digit mobile number" maxlength="10" onchange="checkExisting(this,'site_mobile','site_mobile','business')"/>
|
|
<span id="sitemobileValidationMessage"></span>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="copyright" class="col-form-label">Copyright</label>
|
|
<input type="text" class="form-control" id="copyright" name="copyright" placeholder="Copy Right" value="<?= isset($organzations['copyright']) ? $organzations['copyright'] : '' ?>" />
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="currency" class="col-form-label">Currency<span class="text-danger">*</span></label>
|
|
<select class="form-control" placeholder="Currency (eg : Rupees,Dollar,Euro - symbols)" id="currency" name="currency[]" required data-toggle="select2" multiple>
|
|
<option value="0" disabled>--Select--</option>
|
|
<?php
|
|
$defaultCurrencies = isset($organzations['currency']) ? unserialize((string)$organzations['currency']) : ['INR'];
|
|
foreach ($country_details as $val) {
|
|
echo '<option value="' . $val['currency_code'] . '" ' . (in_array($val['currency_code'], $defaultCurrencies) ? 'selected' : '') . '>';
|
|
echo $val['currency_code'];
|
|
echo '</option>';
|
|
}?>
|
|
<!-- echo $val['currency_code'] . ' (' . $val['currency_name'] . ' - ' . $val['currency_symbol'] . ')'; -->
|
|
|
|
</select>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ################################################################################################# -->
|
|
<?php if ($loged_user !== 'sadmin') : ?>
|
|
<hr />
|
|
<!-- -->
|
|
<h4 class="header-title" id="donaton-accepted-title">
|
|
Accepted Contribution
|
|
<span class="toggle-icon" onclick="toggleSettings('donaton-accepted')">▼</span>
|
|
</h4>
|
|
<br>
|
|
<div class="form-group" id="donaton-accepted" style="display: none;">
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
|
|
<select class="form-control" placeholder="Donation Accepted Name" id="name" name="name[]" required data-toggle="select2" multiple>
|
|
<option value="0" disabled>--Select--</option>
|
|
<?php foreach ($donation as $val) : ?>
|
|
<option value="<?= $val["id"] ?>" <?php if ($val["is_active"] == 1) echo "selected"; ?>> <?= $val["name"] ?> </option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
|
|
|
|
<div class="form-group col-md-6"></div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<?php endif; ?>
|
|
<!--#################################################################### -->
|
|
<hr />
|
|
<h4 class="header-title" id="branch-settings-title">
|
|
Branch Settings
|
|
<span class="toggle-icon" onclick="toggleSettings('branch-settings')">▼</span>
|
|
</h4>
|
|
<br>
|
|
<div id="branch-settings" style="display: none;">
|
|
<div class="after-busi-branch-add-more">
|
|
<div class="form-group">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger">* </span></label>
|
|
<input type="text" class="form-control" id="branchname" name="branch_name[]" placeholder="Branch Name" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="branchaddress" name="branchaddress[]" placeholder="Address (eg : 1234 Main St)" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="mobile_no" class="col-form-label">Contact Person Mobile <span class="text-danger">*</span></label>
|
|
<input type="number" class="form-control" id="mobile_no" name="mobile_no[]" placeholder="Contact Person Mobile " required data-parsley-type="number" maxlength="10" />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
<div class="form-group col-md-6">
|
|
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
|
|
<input type="text" class="form-control" id="email" name="email[]" placeholder="Email" required />
|
|
<div class="invalid-feedback"> Please provide. </div>
|
|
</div>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-3">
|
|
<!-- Add hidden input for branch id -->
|
|
<input type="hidden" id="buiness_branch_id" name="id[]" placeholder="hidden for buisness branch id" />
|
|
<input type="hidden" id="counter" value=<?= 0; ?> readonly />
|
|
</div>
|
|
<div class="form-group col-md-9 busi-branch-div-change text-right m-b-0">
|
|
<a class="btn btn-success waves-effect waves-light mr-1 busi-branch-add-more">+ Add More </a>
|
|
<a class="btn btn-danger waves-effect waves-light mr-1 busi-branch-remove">- Remove </a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- ############################################################################################### -->
|
|
|
|
|
|
<hr />
|
|
<h4 class="header-title" id="logo-settings-title">
|
|
Logo Settings
|
|
<span class="toggle-icon" onclick="toggleSettings('logo-settings')">▼</span>
|
|
</h4>
|
|
<br>
|
|
<div class="form-group" id="logo-settings" style="display: none;">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-6">
|
|
<label for="logo" class="col-form-label">Logo</label>
|
|
<input type="file" class="form-control" style="border: 0px !important; " id="logo" name="business_logo" placeholder="Logo Name" accept=".png, .jpg, .jpeg" value="<?= isset($organzations['business_logo']) ? $organzations['business_logo'] : '' ?>" />
|
|
<span class="help-block"><small>Image dimensions should be between <strong>140x45</strong> pixels and <strong>300x100</strong> pixels. (formats: .png, .jpg, .jpeg)</small></span>
|
|
<p id="logo-error-message" style="color: red;"></p>
|
|
|
|
</div>
|
|
<?php if (!empty($organzations['business_logo'])) { ?>
|
|
<div class="form-group col-md-6">
|
|
<label for="business_logo" class="col-form-label"> Logo <?= '('.$organzations['business_logo'].')'; ?></label>
|
|
<img src="<?= base_url('public/uploads/' . $organzations['business_logo']) ?>" alt="Logo" class="preview-image" />
|
|
</div>
|
|
<?php } ?>
|
|
<div class="form-group col-md-6">
|
|
<label for="favicon" class="col-form-label">Favicon</label>
|
|
<input type="file" class="form-control" style="border: 0px !important; " id="favic" name="favicon" placeholder="Fav-icon Name" accept=".png, .jpg, .jpeg" value="<?= isset($organzations['favicon']) ? $organzations['favicon'] : '' ?>" />
|
|
<span class="help-block"><small>Image dimensions should be <strong>256x256</strong> pixels.(formats: .png, .jpg, .jpeg) </small></span>
|
|
<p id="favic-error-message" style="color: red;"></p>
|
|
|
|
</div>
|
|
<?php if (!empty($organzations['favicon'])) { ?>
|
|
<div class="form-group col-md-6">
|
|
<label for="favicon" class="col-form-label">Favicon <?= '('.$organzations['favicon'].')'; ?></label>
|
|
<img src="<?= base_url('public/uploads/' . $organzations['favicon']) ?>" alt="Icon" class="preview-image" />
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
|
|
<div class="form-group col-md-6">
|
|
<label for="bfile" class="col-form-label">Signature</label>
|
|
<input type="file" onchange="validateImage(this)" class="form-control" style="border: 0px !important;" id="signature" name="signature" value="<?= isset($organzations['signature']) ? $organzations['signature'] : null ?>" accept=".png, .jpg, .jpeg"/>
|
|
<span class="help-block"><small>Image dimensions should be <strong>150x30</strong> pixels. (formats: .png, .jpg, .jpeg) </small></span>
|
|
<p id="error-message"></p>
|
|
</div>
|
|
|
|
<?php if (!empty($organzations['signature'])) { ?>
|
|
<div class="form-group col-md-6">
|
|
<label for="bfile" class="col-form-label">Current Signature <?= '('.$organzations['signature'].')'; ?></label>
|
|
<img src="<?= base_url('public/uploads/' . $organzations['signature']) ?>" alt="Signature" class="preview-image" />
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
|
|
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for Organization id" value="<?= isset($organzations['business_id']) ? $organzations['business_id'] : '' ?>" />
|
|
</div>
|
|
<div class="after-add-more">
|
|
<hr />
|
|
<h4 class="header-title" id="receipt-settings-title">
|
|
Receipt Settings
|
|
<span class="toggle-icon" onclick="toggleSettings('receipt-settings')">▼</span>
|
|
</h4>
|
|
<br>
|
|
<div class="form-group" id="receipt-settings" style="display: none;">
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<div>
|
|
<label for="prefix_format" class="col-form-label">Prefix</label>
|
|
<input type="text" class="form-control" id="prefix_format" name="prefix_format" placeholder="Receipt Number Format" value="<?= isset($organzations['prefix_format']) ? $organzations['prefix_format'] : '' ?>" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="left_pad" class="col-form-label">Left Padding</label>
|
|
<input type="text" class="form-control" id="left_pad" name="left_pad" placeholder="Left Padding Number" value="<?= isset($organzations['left_pad']) ? $organzations['left_pad'] : '' ?>" />
|
|
</div>
|
|
<div class="form-group col-md-4">
|
|
<label for="start_no" class="col-form-label">Start Number</label>
|
|
<input type="text" class="form-control" id="start_no" name="start_no" value="<?= isset($organzations['start_no']) ? $organzations['start_no'] : '1' ?>" placeholder="Start Number" />
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="bterms" class="col-form-label">Receipt Note</label>
|
|
<textarea class="form-control" id="terms" name="bterms" rows="5" cols="50"><?= isset($organzations['terms']) ? $organzations['terms'] : '' ?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php if (!empty($details)) { ?>
|
|
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
|
|
|
</div>
|
|
<br>
|
|
<?php } ?>
|
|
<br />
|
|
|
|
|
|
<input type="hidden" id="setting_id" name="setting_id" placeholder="hidden for setting id" value="<?= isset($details['setting_id']) ? $details['setting_id'] : '' ?>" />
|
|
<?php if (!empty($organzations) && ($loggedin_person_role === 'sadmin')) { ?>
|
|
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
|
<input type="checkbox" id="bcheckbox" name="bcheckbox" class="form-control" <?= isset($organzations) && $organzations['isactive'] == 1 ? 'checked' : '' ?>>
|
|
<label for="bcheckbox"> Is Active</label>
|
|
</div>
|
|
<br>
|
|
<?php } ?>
|
|
<div class="form-group text-right m-b-0">
|
|
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Save</button>
|
|
<?php
|
|
// $business_id=$organzations['business_id'];
|
|
$business_id = isset($organzations['business_id']) ? $organzations['business_id'] : null;
|
|
// Check if the logged-in user's ID matches the user's ID
|
|
if ($session_bid == $business_id) {
|
|
|
|
// Redirect to the dashboard with logged_user_id parameter
|
|
$redirect_url = base_url() . "dashboard";
|
|
} else {
|
|
// Redirect to the user list
|
|
$redirect_url = base_url() . "org_list";
|
|
}
|
|
?>
|
|
<!-- -->
|
|
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div> <!-- end card-body-->
|
|
</div> <!-- end card-->
|
|
</div> <!-- end col-->
|
|
</div><!-- end row -->
|
|
<script>
|
|
|
|
function checkValidityAndSetRequired() {
|
|
if (document.getElementById('80G').value.trim() !== "") {
|
|
document.getElementById('80G_vaildupto').setAttribute('required', 'required');
|
|
} else {
|
|
document.getElementById('80G_vaildupto').removeAttribute('required');
|
|
}
|
|
if (document.getElementById('12AA').value.trim() !== "") {
|
|
document.getElementById('12AA_vaildupto').setAttribute('required', 'required');
|
|
} else {
|
|
document.getElementById('12AA_vaildupto').removeAttribute('required');
|
|
}
|
|
}
|
|
|
|
document.getElementById('myForm').addEventListener('submit', function(event) {
|
|
var form = event.target;
|
|
|
|
var role = <?php echo json_encode($loged_user); ?>;
|
|
if(role === 'sadmin'){checkValidityAndSetRequired();}
|
|
|
|
if (form.checkValidity() === false) {
|
|
|
|
form.reportValidity(); // Display validation error messages
|
|
event.preventDefault(); // Prevent form submission if it's not valid
|
|
var invalidFields = form.querySelectorAll(':invalid');
|
|
if (invalidFields.length > 0) {
|
|
invalidFields[0].focus();
|
|
}
|
|
$('#submitBtn').prop('disabled', false);
|
|
} else {
|
|
|
|
$('#submitBtn').prop('disabled', true);
|
|
}
|
|
});
|
|
|
|
function validateImage(input) {
|
|
const errorMessageElement = document.getElementById('error-message');
|
|
errorMessageElement.textContent = '';
|
|
|
|
const image = input.files[0];
|
|
|
|
// Check image type
|
|
const allowedImageTypes = ['image/jpeg', 'image/png', 'image/gif']; // Add more if needed
|
|
if (!allowedImageTypes.includes(image.type)) {
|
|
errorMessageElement.textContent = 'Invalid image type. Please select a JPEG, PNG, or GIF image.';
|
|
input.value = ""; // Clear the input field
|
|
return;
|
|
}
|
|
|
|
const maxWidth = 150;
|
|
const maxHeight = 100;
|
|
|
|
const img = new Image();
|
|
img.onload = function() {
|
|
console.log("Image loaded successfully");
|
|
console.log("Image dimensions:", img.width, "x", img.height);
|
|
if (img.width > maxWidth || img.height > maxHeight) {
|
|
errorMessageElement.textContent = `Image dimensions should not exceed ${maxWidth}x${maxHeight}`;
|
|
input.value = ""; // Clear the input field
|
|
} else {
|
|
// If the image dimensions are within limits, you can proceed with displaying the image
|
|
img.src = URL.createObjectURL(image);
|
|
}
|
|
};
|
|
|
|
img.onerror = function() {
|
|
console.error("Error loading image");
|
|
errorMessageElement.textContent = "Error loading image.";
|
|
};
|
|
|
|
// Set the src after attaching onload and onerror handlers
|
|
img.src = URL.createObjectURL(image);
|
|
}
|
|
</script>
|
|
<script>
|
|
function toggleSettings(id) {
|
|
var settingsDiv = document.getElementById(id);
|
|
var titleIcon = document.querySelector("#" + id + "-title .toggle-icon");
|
|
if (settingsDiv.style.display === "none") {
|
|
settingsDiv.style.display = "block";
|
|
titleIcon.textContent = "▲"; // Change icon to up arrow
|
|
} else {
|
|
settingsDiv.style.display = "none";
|
|
titleIcon.textContent = "▼"; // Change icon to down arrow
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
document.getElementById('logo').addEventListener('change', function() {
|
|
var input = this;
|
|
var img = new Image();
|
|
var errorMessageElement = document.getElementById('logo-error-message');
|
|
|
|
img.onload = function() {
|
|
if (
|
|
img.width >= 140 && img.width <= 300 &&
|
|
img.height >= 45 && img.height <= 100
|
|
) {
|
|
// Valid size, clear error message
|
|
errorMessageElement.textContent = '';
|
|
} else {
|
|
// Invalid size, reset the input and display an error message
|
|
input.value = '';
|
|
errorMessageElement.textContent = 'Image dimensions should not exceed 150x50';
|
|
}
|
|
};
|
|
|
|
if (input.files && input.files[0]) {
|
|
var reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
img.src = e.target.result;
|
|
};
|
|
reader.readAsDataURL(input.files[0]);
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
document.getElementById('favic').addEventListener('change', function() {
|
|
var input = this;
|
|
var img = new Image();
|
|
var errorMessageElement = document.getElementById('favic-error-message');
|
|
|
|
img.onload = function() {
|
|
if (
|
|
img.width === 256 && img.height === 256
|
|
) {
|
|
// Valid size, clear error message
|
|
errorMessageElement.textContent = '';
|
|
} else {
|
|
// Invalid size, reset the input and display an error message
|
|
input.value = '';
|
|
errorMessageElement.textContent = 'Image dimensions should not exceed 256x256.';
|
|
}
|
|
};
|
|
|
|
if (input.files && input.files[0]) {
|
|
var reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
img.src = e.target.result;
|
|
};
|
|
reader.readAsDataURL(input.files[0]);
|
|
}
|
|
});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
var Role = <?php echo json_encode($loged_user); ?>;
|
|
$('#bname').change(function(){
|
|
// alert($(this).val());
|
|
if($('#site_name').val() === "" && $('#site_title').val() === "" && Role === 'sadmin'){
|
|
var bname = $(this).val();
|
|
$('#site_name').val(bname);
|
|
$('#site_title').val(bname);
|
|
if (bname === '' ) {
|
|
$('#site_name').val('');
|
|
$('#site_title').val('');
|
|
}
|
|
}
|
|
});
|
|
if (Role === 'sadmin') {
|
|
$('#branchaddress').removeAttr('required');
|
|
$('#branchaddress').siblings('span.text-danger').remove();
|
|
$('#branchname').removeAttr('required');
|
|
$('#branchname').siblings('span.text-danger').remove();
|
|
$('#mobile_no').removeAttr('required');
|
|
$('#mobile_no').siblings('span.text-danger').remove();
|
|
$('#email').removeAttr('required');
|
|
$('#email').siblings('span.text-danger').remove();
|
|
}
|
|
});
|
|
$(document).ready(function() {
|
|
var Role = <?php echo json_encode($loged_user); ?>;
|
|
var busiBranchArray = <?php echo json_encode($branches); ?>;
|
|
|
|
if (busiBranchArray.length > 0) {
|
|
j = 0;
|
|
for (var i = 0; i < busiBranchArray.length; i++) {
|
|
if (i == 0) {
|
|
var html = $(".after-busi-branch-add-more").first();
|
|
} else {
|
|
var html = $(".after-busi-branch-add-more").first().clone();
|
|
}
|
|
html.find('input#buiness_branch_id').val(busiBranchArray[i]['id']);
|
|
html.find('input#mobile_no').val(busiBranchArray[i]['mobile_no']);
|
|
html.find('input#email').val(busiBranchArray[i]['email']);
|
|
html.find('input#branchaddress').val(busiBranchArray[i]['address']);
|
|
html.find('input#branchname').val(busiBranchArray[i]['branch_name']);
|
|
|
|
if (i !== 0) {
|
|
html.find(".busi-branch-div-change").html("<a class='btn btn-success waves-effect waves-light mr-1 busi-branch-add-more'>+ Add More </a><a class='btn btn-danger waves-effect waves-light mr-1 busi-branch-remove'>- Remove </a>");
|
|
html.insertAfter(".after-busi-branch-add-more:last");
|
|
}
|
|
j++;
|
|
swapButtons();
|
|
}
|
|
} else {
|
|
swapButtons();
|
|
}
|
|
|
|
$("body").on("click", ".busi-branch-add-more", function() {
|
|
var html = $(".after-busi-branch-add-more").first().clone();
|
|
var count = $(".after-busi-branch-add-more").length;
|
|
|
|
html.find('input').val(''); // Clear input values in the cloned element
|
|
html.find('input#counter').val(count).prop("readonly", true);
|
|
html.find(".busi-branch-div-change").html("<a class='btn btn-success waves-effect waves-light mr-1 busi-branch-add-more'>+ Add More </a><a class='btn btn-danger waves-effect waves-light mr-1 busi-branch-remove'>- Remove </a>");
|
|
html.insertAfter(".after-busi-branch-add-more:last");
|
|
swapButtons();
|
|
});
|
|
|
|
$("body").on("click", ".busi-branch-remove", function() {
|
|
var rows = $(".after-busi-branch-add-more");
|
|
if (rows.length > 1) {
|
|
$(this).parents(".after-busi-branch-add-more").remove();
|
|
} else {
|
|
alert("At least one Shipping Address must be displayed.");
|
|
}
|
|
swapButtons();
|
|
});
|
|
|
|
function swapButtons() {
|
|
var elementCount = $(".after-busi-branch-add-more").length;
|
|
if (elementCount > 1) {
|
|
$(".busi-branch-remove").show(); // Show the "busi-branch-remove" buttons
|
|
} else {
|
|
$(".busi-branch-remove").hide(); // Hide the "busi-branch-remove" buttons
|
|
}
|
|
$(".after-busi-branch-add-more .busi-branch-add-more").hide();
|
|
$(".after-busi-branch-add-more:last .busi-branch-add-more").show();
|
|
|
|
}
|
|
});
|
|
|
|
</script>
|
|
<script>
|
|
function checkExisting(input,databasecolumnname,elementid,table){
|
|
|
|
switch(elementid){
|
|
case 'pan_no' :
|
|
spanid = "panValidationMessage"; break;
|
|
case 'bmail' :
|
|
spanid = "bemailValidationMessage"; break;
|
|
case 'bmobile' :
|
|
spanid = "bmobileValidationMessage"; break;
|
|
case 'admin_email' :
|
|
spanid = "adminemailValidationMessage"; break;
|
|
case 'site_mobile' :
|
|
spanid = "sitemobileValidationMessage"; break;
|
|
}
|
|
var validationMessage = document.getElementById(spanid);
|
|
var value = input.value.trim();
|
|
if (value === "") {
|
|
validationMessage.style.display = 'none';
|
|
return;
|
|
}
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "<?= base_url() . 'check_existing' ?>",
|
|
data: {
|
|
value: value,
|
|
module: table,
|
|
field: databasecolumnname
|
|
},
|
|
success: function(response) {
|
|
console.log("check existing " + elementId + "--" + response['data']['message']);
|
|
validationMessage.style.display = response['data']['status'] ? 'block' : 'none';
|
|
validationMessage.innerText = response['data']['message'];
|
|
validationMessage.style.color = "red";
|
|
input.setCustomValidity(response['data']['status'] ? response['data']['message'] : '');
|
|
if (response['data']['status']) input.value = '';
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error("check existing " + elementId + " -- " + status + ": " + error);
|
|
}
|
|
});
|
|
}
|
|
</script>
|