stock module latest today vadivel J 21-02-2025
This commit is contained in:
parent
2885d14239
commit
474e2c0392
@ -2545,7 +2545,7 @@ class StockController extends BaseController
|
||||
$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');
|
||||
$previousMonthStartDate = "$previousMonth-01";
|
||||
|
||||
@ -21,6 +21,15 @@
|
||||
background-color: #50bbd9;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.grab {
|
||||
cursor: grab; /* Default open-hand cursor */
|
||||
}
|
||||
|
||||
.grab:active {
|
||||
cursor: grabbing; /* Closed-hand cursor when dragging */
|
||||
}
|
||||
|
||||
/*
|
||||
.fht-table td[contenteditable="true"] {
|
||||
background-color: lightyellow;
|
||||
@ -176,8 +185,10 @@
|
||||
.fht-table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 20; /* Ensure the entire header stays above table rows */
|
||||
background-color: #50bbd9; /* Header background color */
|
||||
z-index: 20;
|
||||
/* Ensure the entire header stays above table rows */
|
||||
background-color: #50bbd9;
|
||||
/* Header background color */
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
@ -190,8 +201,10 @@
|
||||
.fht-table thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 11; /* Higher than table rows but lower than first column */
|
||||
background-color: #50bbd9; /* Green background */
|
||||
z-index: 11;
|
||||
/* Higher than table rows but lower than first column */
|
||||
background-color: #50bbd9;
|
||||
/* Green background */
|
||||
color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
@ -203,7 +216,8 @@
|
||||
position: sticky;
|
||||
left: 0;
|
||||
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;
|
||||
color: #ffffff;
|
||||
}
|
||||
@ -212,7 +226,8 @@
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
max-height: 500px; /* Adjust as needed */
|
||||
max-height: 500px;
|
||||
/* Adjust as needed */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@ -220,8 +235,6 @@
|
||||
min-width: 100px;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@ -291,10 +304,14 @@ foreach ($period as $day) {
|
||||
class="form-control mt-2" data-provide="datepicker"
|
||||
data-date-format="M-yyyy" data-date-min-view-mode="1">
|
||||
</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="button" class="btn" style="background-color:maroon;color:white" data-target="#customizeModalId"
|
||||
data-toggle="modal">
|
||||
Customize
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-1"></div>
|
||||
<div class="col-6">
|
||||
<div class="dropdown float-right">
|
||||
<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]['used'] += is_numeric($resinStock['used']) ? $resinStock['used'] : 0;
|
||||
$summary[$materialCode]['balanceStock'] = is_numeric($resinStock['balanceStock']) ? $resinStock['balanceStock'] : 0;
|
||||
|
||||
} ?>
|
||||
|
||||
</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>
|
||||
function navigateToResin() {
|
||||
@ -881,8 +977,6 @@ foreach ($period as $day) {
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
@ -921,7 +1015,6 @@ foreach ($period as $day) {
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
function exportTableToExcel(tableID, filename = '') {
|
||||
@ -956,9 +1049,6 @@ foreach ($period as $day) {
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
</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>
|
||||
Loading…
Reference in New Issue
Block a user