Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
VE10-Sanjeev 2025-02-24 12:55:20 +00:00
commit b6ea64666d
2 changed files with 287 additions and 108 deletions

View File

@ -2545,7 +2545,7 @@ class StockController extends BaseController
$this->global['pageTitle'] = 'Diesel Machine Stock Details'; $this->global['pageTitle'] = 'Diesel Machine Stock Details';
// Get the previous month's last date resin stock details for next month updation // Get the previous month's last date diesel stock details for next month updation
$previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m'); $previousMonth = DateTime::createFromFormat('Y-m', $month)->modify('-1 month')->format('Y-m');
$previousMonthStartDate = "$previousMonth-01"; $previousMonthStartDate = "$previousMonth-01";

View File

@ -21,6 +21,15 @@
background-color: #50bbd9; background-color: #50bbd9;
color: #ffffff; color: #ffffff;
} }
.grab {
cursor: grab; /* Default open-hand cursor */
}
.grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */
}
/* /*
.fht-table td[contenteditable="true"] { .fht-table td[contenteditable="true"] {
background-color: lightyellow; background-color: lightyellow;
@ -176,8 +185,10 @@
.fht-table thead { .fht-table thead {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 20; /* Ensure the entire header stays above table rows */ z-index: 20;
background-color: #50bbd9; /* Header background color */ /* Ensure the entire header stays above table rows */
background-color: #50bbd9;
/* Header background color */
} }
.dropdown-menu { .dropdown-menu {
@ -190,8 +201,10 @@
.fht-table thead th { .fht-table thead th {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 11; /* Higher than table rows but lower than first column */ z-index: 11;
background-color: #50bbd9; /* Green background */ /* Higher than table rows but lower than first column */
background-color: #50bbd9;
/* Green background */
color: #ffffff; color: #ffffff;
border: 1px solid #ddd; border: 1px solid #ddd;
padding: 10px; padding: 10px;
@ -203,7 +216,8 @@
position: sticky; position: sticky;
left: 0; left: 0;
background-color: #50bbd9; background-color: #50bbd9;
z-index: 15; /* Ensures it stays above other cells */ z-index: 15;
/* Ensures it stays above other cells */
border-right: 2px solid #ddd; border-right: 2px solid #ddd;
color: #ffffff; color: #ffffff;
} }
@ -212,7 +226,8 @@
.table-responsive { .table-responsive {
overflow-x: auto; overflow-x: auto;
overflow-y: auto; overflow-y: auto;
max-height: 500px; /* Adjust as needed */ max-height: 500px;
/* Adjust as needed */
position: relative; position: relative;
} }
@ -220,8 +235,6 @@
min-width: 100px; min-width: 100px;
max-width: 100px; max-width: 100px;
} }
</style> </style>
@ -291,10 +304,14 @@ foreach ($period as $day) {
class="form-control mt-2" data-provide="datepicker" class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1"> data-date-format="M-yyyy" data-date-min-view-mode="1">
</div> </div>
<div class="form-group col-md-2"> <div class="form-group col-md-3">
<button type="submit" class="btn btn-success"> Change Month </button> <button type="submit" class="btn btn-success"> Change Month </button>
<button type="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
data-toggle="modal">
Customize
</button>
</div> </div>
<div class="col-md-1"></div>
<div class="col-6"> <div class="col-6">
<div class="dropdown float-right"> <div class="dropdown float-right">
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown" <a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
@ -448,7 +465,6 @@ foreach ($period as $day) {
$summary[$materialCode]['receipt'] += is_numeric($resinStock['receipt']) ? $resinStock['receipt'] : 0; $summary[$materialCode]['receipt'] += is_numeric($resinStock['receipt']) ? $resinStock['receipt'] : 0;
$summary[$materialCode]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0; $summary[$materialCode]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0;
$summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0; $summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0;
} ?> } ?>
</tr> </tr>
@ -640,6 +656,86 @@ foreach ($period as $day) {
<!---------------------------------------
this modal is used to customize table header
1)list table header order
2)choose which material/machines you want
------------------------------------------------------------>
<div>
<div class="modal fade" id="customizeModalId" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="customizeModalLabel">Customize</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Dropdown to add back removed items -->
<div class="col">
<div class="form-group">
<label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()">
<option value="">Select</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col">
<h5>List of Selected Items</h5>
<div id="selectedItemsContainer">
<ul id="sortableList">
<?php foreach ($resinMaterials as $resinMaterial): ?>
<div class="sortable-item" draggable="true" id="<?= $resinMaterial['MaterialCode'] ?>_container">
<input type="checkbox"
id="<?= $resinMaterial['MaterialCode'] ?>_checkboxId"
name="materialCodes[]"
value="<?= $resinMaterial['MaterialCode'] ?>"
onclick="removeSelectedMaterial(this)"
checked>
<label class="grab" for="<?= $resinMaterial['MaterialCode'] ?>_checkboxId">
<?= $resinMaterial['MaterialName']; ?>
</label>
<br>
</div>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<button type="button" class="btn btn-primary float-right"> Apply </button>
</div>
</div>
</div>
</div>
</div>
<!-- modal section ends -->
<script> <script>
function navigateToResin() { function navigateToResin() {
@ -881,8 +977,6 @@ foreach ($period as $day) {
return input; return input;
} }
</script> </script>
<script> <script>
@ -921,7 +1015,6 @@ foreach ($period as $day) {
<script> <script>
$(document).ready(function() { $(document).ready(function() {
function exportTableToExcel(tableID, filename = '') { function exportTableToExcel(tableID, filename = '') {
@ -956,9 +1049,6 @@ foreach ($period as $day) {
}) })
</script> </script>
<script> <script>
@ -996,5 +1086,94 @@ foreach ($period as $day) {
} }
} }
}); });
</script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const list = document.getElementById("sortableList");
let draggedItem = null;
function attachDragEvents(item) {
item.setAttribute("draggable", "true");
item.addEventListener("dragstart", (event) => {
draggedItem = event.target;
event.target.classList.add("dragging");
});
item.addEventListener("dragend", (event) => {
event.target.classList.remove("dragging");
});
}
list.addEventListener("dragover", (event) => {
event.preventDefault(); // Allow dropping
const dragging = document.querySelector(".dragging");
const closestItem = getClosestItem(list, event.clientY);
if (closestItem) {
list.insertBefore(dragging, closestItem);
} else {
list.appendChild(dragging);
}
});
function getClosestItem(container, y) {
const items = [...container.querySelectorAll(".sortable-item:not(.dragging)")];
return items.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset
? { offset, element: child }
: closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
// Attach drag events to existing items
document.querySelectorAll(".sortable-item").forEach(attachDragEvents);
window.removeSelectedMaterial = function (checkbox) {
let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText;
let dropdown = document.getElementById("customizeHeader");
let newOption = document.createElement("option");
newOption.value = materialCode;
newOption.text = materialName;
dropdown.appendChild(newOption);
container.remove();
};
window.addBackToList = function () {
let dropdown = document.getElementById("customizeHeader");
let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") {
let materialCode = selectedOption.value;
let materialName = selectedOption.text;
let container = document.createElement("div");
container.classList.add("sortable-item");
container.id = materialCode + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="materialCodes[]" value="${materialCode}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<br>
`;
attachDragEvents(container);
document.getElementById("sortableList").appendChild(container);
dropdown.removeChild(selectedOption);
}
};
});
</script> </script>