updtae
This commit is contained in:
parent
4ad484ddd3
commit
51388255cc
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
Urmi you happy me happy licence
|
Urmi you happy me happy licence
|
||||||
|
|
||||||
Copyright (c) 2026 shreebhattji
|
Copyright (/c) 2026 shreebhattji
|
||||||
|
|
||||||
License text:
|
License text:
|
||||||
https://github.com/shreebhattji/Urmi/blob/main/licence.md
|
https://github.com/shreebhattji/Urmi/blob/main/licence.md
|
||||||
|
|
@ -23,81 +23,82 @@ function getValue($data, $key) {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="container mt-5">
|
<div class="containerindex">
|
||||||
<h2>Company Information Entry</h2>
|
<h2 style="text-align: center; color: white; margin-bottom: 20px;">Company Information Entry</h2>
|
||||||
<form action="" method="POST" enctype="multipart/form-data" class="shadow p-4 bg-light rounded">
|
|
||||||
<div class="row">
|
<form action="" method="POST" enctype="multipart/mask" class="shadow p-4 bg-dark rounded" style="max-width: 900px; margin: 0 auto; color: white; border: 1px solid #333;">
|
||||||
|
<div class="grid" style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
|
||||||
|
|
||||||
<!-- Channel Details -->
|
<!-- Channel Details -->
|
||||||
<div class="col-md-6 mb-3">
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">Channel Name</label>
|
<label class="form-label">Channel Name</label>
|
||||||
<input type="text" name="channel_name" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'channel_name')); ?>" required>
|
<input type="text" name="channel_name" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'channel_name')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">Office Address</label>
|
<label class="form-label">Office Address</label>
|
||||||
<textarea name="office_address" class="form-control" rows="1" required><?php echo htmlspecialchars(getValue($saved_data, 'office_address')); ?></textarea>
|
<textarea name="office_address" class="form-control bg-dark text-white border-secondary" rows="1" required><?php echo htmlspecialchars(getValue($saved_data, 'office_address')); ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Contact Details -->
|
<!-- Contact Details -->
|
||||||
<div class="col-md-6 mb-3">
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">Contact Details</label>
|
<label class="form-label">Contact Details</label>
|
||||||
<input type="text" name="contact_details" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'contact_details')); ?>" required>
|
<input type="text" name="contact_details" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'contact_details')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Enforcement Officer Details -->
|
<!-- Enforcement Officer Details -->
|
||||||
<div class="col-md-6 mb-3">
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<lag class="form-label">Enforcement Officer</label>
|
<label class="form-label">Enforcement Officer</label>
|
||||||
<input type="text" name="enforcement_officer" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'enforcement_officer')); ?>" required>
|
<input type="text" name="enforcement_officer" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'enforcement_officer')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
<label class="form-label">Contact Details of Enforcement Officer</label>
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<input type="text" name="eo_contact_details" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'eo_contact_details')); ?>" required>
|
<label class="form-label">EO Contact Details</label>
|
||||||
|
<input type="text" name="eo_contact_details" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'eo_contact_details')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Company Details -->
|
<!-- Company Details -->
|
||||||
<div class="col-md-6 mb-3">
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">Company Name</label>
|
<label class="form-label">Company Name</label>
|
||||||
<input type="text" name="company_name" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'company_name')); ?>" required>
|
<input type="text" name="company_name" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'company_name')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">CIN Number</label>
|
<label class="form-label">CIN Number</label>
|
||||||
<input type="text" name="cin_number" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'cin_number')); ?>" required>
|
<input type="text" name="cin_number" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'cin_number')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">GSTIN Number</label>
|
<label class="form-label">GSTIN Number</label>
|
||||||
<input type="text" name="gstin_number" class="form-control" value="<?php echo htmlspecialchars(getValue($saved_data, 'gstin_number')); ?>" required>
|
<input type="text" name="gstin_number" class="form-control bg-dark text-white border-secondary" value="<?php echo htmlspecialchars(getValue($saved_data, 'gstin_number')); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- File Uploads -->
|
<!-- File Uploads -->
|
||||||
<div class="col-md-6 mb-3">
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<label class="form-label">Upload Ad (PNG only)</label>
|
<label class="form-label">Upload Ad (PNG)</label>
|
||||||
<input type="file" name="app_ad" class="form-control" accept="image/png">
|
<input type="file" name="app_ad" class="form-control bg-dark text-white border-secondary" accept="image/png">
|
||||||
<?php if (file_exists('/var/www/html/app_ad.png')): ?>
|
<?php if (file_exists('/var/www/html/app_ad.png')): ?>
|
||||||
<div class="mt-2">
|
<img src="/var/www/html/app_ad.png" class="mt-2 img-thumbnail" style="max-height: 60px;">
|
||||||
<small class="text-muted d-block">Current Ad:</small>
|
|
||||||
<img src="/var/www/html/app_ad.png" alt="Current Ad" class="img-thumbnail" style="max-height: 100px;">
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 mb-3">
|
|
||||||
<label class="form-label">Upload Logo (PNG only)</label>
|
<div class="card" style="background: #111827; padding: 15px; border-radius: 8px; border: 1px solid #333;">
|
||||||
<input type="file" name="app_logo" class="form-control" accept="image/png">
|
<label class="form-label">Upload Logo (PNG)</label>
|
||||||
|
<input type="file" name="app_logo" class="form-control bg-dark text-white border-secondary" accept="image/png">
|
||||||
<?php if (file_exists('/var/www/html/app_logo.png')): ?>
|
<?php if (file_exists('/var/www/html/app_logo.png')): ?>
|
||||||
<div class="mt-2">
|
<img src="/var/www/html/app_logo.png" class="mt-2 img-thumbnail" style="max-height: 60px;">
|
||||||
<small class="text-muted d-block">Current Logo:</small>
|
|
||||||
<img src="/php/var/www/html/app_logo.png" alt="Current Logo" class="img-thumbnail" style="max-height: 100px;">
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-4 text-center">
|
||||||
<button type="submit" name="submit" class="btn btn-primary">Submit Details</button>
|
<button type="submit" name="submit" class="green-btn" style="padding: 10px 40px;">Save All Details</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div class="mt-4">
|
||||||
<?php
|
<?php
|
||||||
if (isset($_POST['submit'])) {
|
if (isset($_POST['submit'])) {
|
||||||
// Handle File Uploads
|
|
||||||
$upload_paths = [
|
$upload_paths = [
|
||||||
'app_ad' => '/var/www/html/app_ad.png',
|
'app_ad' => '/var/www/html/app_ad.png',
|
||||||
'app_logo' => '/var/www/html/app_logo.png'
|
'app_logo' => '/var/www/html/app_logo.png'
|
||||||
|
|
@ -112,15 +113,14 @@ function getValue($data, $key) {
|
||||||
$errors[] = "File for $input_name must be a PNG.";
|
$errors[] = "File for $input_name must be a PNG.";
|
||||||
} else {
|
} else {
|
||||||
if (move_uploaded_file($_FILES[$input_name]['tmp_name'], $destination)) {
|
if (move_uploaded_file($_FILES[$input_name]['tmp_name'], $destination)) {
|
||||||
echo "<div class='alert alert-success mt-2'>$input_name uploaded successfully.</div>";
|
// Success
|
||||||
} else {
|
} else {
|
||||||
$errors[] = "Failed to upload $input_name. Check folder permissions.";
|
$errors[] = "Failed to upload $input_name.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save text data to JSON
|
|
||||||
$text_fields = [
|
$text_fields = [
|
||||||
'channel_name', 'office_address', 'contact_details', 'enforcement_officer',
|
'channel_name', 'office_address', 'contact_details', 'enforcement_officer',
|
||||||
'eo_contact_details', 'company_name', 'cin_number', 'gstin_number'
|
'eo_contact_details', 'company_name', 'cin_number', 'gstin_number'
|
||||||
|
|
@ -133,21 +133,21 @@ function getValue($data, $key) {
|
||||||
|
|
||||||
if (empty($errors)) {
|
if (empty($errors)) {
|
||||||
if (file_put_contents($json_file, json_encode($data_to_save, JSON_PRETTY_PRINT))) {
|
if (file_put_contents($json_file, json_encode($data_to_save, JSON_PRETTY_PRINT))) {
|
||||||
echo "<div class='alert alert-success mt-2'>All data and files processed successfully!</div>";
|
echo '<div class="alert alert-success text-center">All data and files processed successfully!</div>';
|
||||||
// Refresh to show updated data in form
|
|
||||||
echo "<script>setTimeout(() => { window.location.reload(); }, 2000);</script>";
|
echo "<script>setTimeout(() => { window.location.reload(); }, 2000);</script>";
|
||||||
} else {
|
} else {
|
||||||
$errors[] = "Failed to save JSON data. Check folder permissions.";
|
$errors[] = "Failed to save JSON data.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($errors)) {
|
if (!empty($errors)) {
|
||||||
foreach ($errors as $error) {
|
foreach ($errors as $error) {
|
||||||
echo "<div class='alert alert-danger mt-2'>$error</div>";
|
echo "<div class='alert alert-danger text-center'>$error</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php include 'footer.php'; ?>
|
<?php include 'footer.php'; ?>
|
||||||
Loading…
Reference in New Issue