File manager - Edit - /var/www/payraty/inventory_main/storage/framework/views/b5ea45b492e5e2d9896029a0444a96871c55b731.php
Back
<?php $__env->startSection('content'); ?> <div class="page-title-box"> <div class="row align-items-center"> <div class="col-sm-6"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="#" class="ic-javascriptVoid"><?php echo e(__('custom.warehouse')); ?></a></li> <li class="breadcrumb-item active"><?php echo e(__('custom.edit_warehouse')); ?></li> </ol> </div> </div> </div> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <h4 class="header-title"><?php echo e(__('custom.edit_warehouse')); ?></h4> <form class="form-validate" action="<?php echo e(route('admin.warehouses.update', $warehouse->id)); ?>" method="POST"> <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?> <div class="row"> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for=""><?php echo e(__('custom.warehouse_name')); ?> <span class="error">*</span></label> <input type="text" name="name" class="form-control" value="<?php echo e($warehouse->name); ?>" required> <?php $__errorArgs = ['name']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for="">Number of shelves<span class="error"></span></label> <input type="text" name="shelf" class="form-control" value="<?php echo e($warehouse->shelf); ?>" readonly> <?php $__errorArgs = ['shelf']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for=""><?php echo e(__('custom.email')); ?></label> <input type="email" name="email" class="form-control" value="<?php echo e($warehouse->email); ?>"> <?php $__errorArgs = ['email']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for=""><?php echo e(__('custom.phone')); ?></label> <input id="phone" type="text" name="phone" class="form-control w-100 phone" value="<?php echo e($warehouse->phone ?? '+1'); ?>"> <?php $__errorArgs = ['phone']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for=""><?php echo e(__('custom.company_name')); ?></label> <input type="text" name="company_name" class="form-control" value="<?php echo e($warehouse->company_name); ?>"> <?php $__errorArgs = ['company_name']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for="address_1"><?php echo e(__('custom.address_1')); ?></label> <input type="text" class="form-control" name="address_1" value="<?php echo e($warehouse->address_1); ?>"> <?php $__errorArgs = ['address_1']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class=" error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for="address_2"><?php echo e(__('custom.address_2')); ?></label> <input type="text" class="form-control" name="address_2" value="<?php echo e($warehouse->address_2); ?>"> <?php $__errorArgs = ['address_2']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class=" error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label for=""><?php echo e(__('custom.priority')); ?> <p class="p-0 m-0"> <small> <?php echo e(__('custom.warehouse_priority_message')); ?> </small> </p> </label> <input type="number" name="priority" class="form-control" value="<?php echo e($warehouse->priority); ?>"> <?php $__errorArgs = ['priority']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group col-sm-6 col-lg-6 col-xl-4"> <label class="text-white"><?php echo e(__('custom.default')); ?></label> <div class="custom-control custom-checkbox"> <input type="checkbox" class="custom-control-input" name="is_default" <?php if($warehouse->is_default): ?> checked <?php endif; ?> value="1" id="is_default"> <label class="custom-control-label" for="is_default"><?php echo e(__('custom.is_default_warehouse')); ?></label> </div> <?php $__errorArgs = ['is_default']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> <div class="form-group"> <label class="d-block mb-3"><?php echo e(__('custom.status')); ?> <span class="error">*</span></label> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="status_yes" value="<?php echo e(\App\Models\Warehouse::STATUS_ACTIVE); ?>" name="status" class="custom-control-input" <?php if(\App\Models\Warehouse::STATUS_ACTIVE==$warehouse->status): ?> checked <?php endif; ?>> <label class="custom-control-label" for="status_yes"><?php echo e(__('custom.active')); ?></label> </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="status_no" value="<?php echo e(\App\Models\Warehouse::STATUS_INACTIVE); ?>" name="status" class="custom-control-input" <?php if(\App\Models\Warehouse::STATUS_INACTIVE==$warehouse->status): ?> checked <?php endif; ?>> <label class="custom-control-label" for="status_no"><?php echo e(__('custom.inactive')); ?></label> </div> <?php $__errorArgs = ['status']; $__bag = $errors->getBag($__errorArgs[1] ?? 'default'); if ($__bag->has($__errorArgs[0])) : if (isset($message)) { $__messageOriginal = $message; } $message = $__bag->first($__errorArgs[0]); ?> <p class="error"><?php echo e($message); ?></p> <?php unset($message); if (isset($__messageOriginal)) { $message = $__messageOriginal; } endif; unset($__errorArgs, $__bag); ?> </div> </div> <div class="form-group"> <div> <button class="btn btn-primary waves-effect waves-lightml-2" type="submit"> <i class="fa fa-save"></i> <span><?php echo e(__('custom.submit')); ?></span> </button> <a class="btn btn-danger waves-effect" href="<?php echo e(route('admin.warehouses.index')); ?>"> <i class="fa fa-times"></i> <span><?php echo e(__('custom.cancel')); ?></span> </a> </div> </div> </form> <!-- Shelves Section --> <div class="card mt-4"> <div class="card-header d-flex justify-content-between align-items-center"> <h5 class="card-title mb-0">Existing Shelves</h5> <button type="button" class="btn btn-sm btn-success" id="addShelfBtn"> <i class="fa fa-plus"></i> Add New Shelf </button> </div> <div class="card-body"> <?php if($warehouse->shelves && count($warehouse->shelves) > 0): ?> <div class="table-responsive"> <table class="table table-bordered table-striped"> <thead> <tr> <th>Shelf Number</th> <th>Name</th> <th>Actions</th> </tr> </thead> <tbody id="shelfTableBody"> <?php $__currentLoopData = $warehouse->shelves; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $shelf): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <tr data-shelf-id="<?php echo e($shelf['id'] ?? ''); ?>"> <td><?php echo e($index + 1); ?></td> <td><?php echo e($shelf['name'] ?? 'Shelf ' . ($index + 1)); ?></td> <td> <button type="button" class="btn btn-sm btn-danger delete-shelf"> <i class="fa fa-trash"></i> </button> </td> </tr> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </tbody> </table> </div> <?php else: ?> <div class="alert alert-info" id="noShelvesAlert"> No Existing Shelves Found </div> <?php endif; ?> </div> </div> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startPush('style'); ?> <?php $__env->stopPush(); ?> <?php $__env->startPush('script'); ?> <?php $__env->stopPush(); ?> <script> document.addEventListener('DOMContentLoaded', function() { function findShelfTableBody() { return document.querySelector('#shelfTableBody') || document.querySelector('table tbody'); } function findNoShelvesAlert() { return document.querySelector('#noShelvesAlert'); } function updateShelfTable(data) { const shelfTableBody = findShelfTableBody(); const noShelvesAlert = findNoShelvesAlert(); const shelvesContainer = document.querySelector('.card-body'); // If table body doesn't exist, we might need to create the entire table if (!shelfTableBody) { const tableHtml = ` <div class="table-responsive"> <table class="table table-bordered table-striped"> <thead> <tr> <th>Shelf Number</th> <th>Name</th> <th>Actions</th> </tr> </thead> <tbody id="shelfTableBody"> <tr data-shelf-id="${data.shelf.id}"> <td>1</td> <td>${data.shelf.name}</td> <td> <button type="button" class="btn btn-sm btn-danger delete-shelf"> <i class="fa fa-trash"></i> </button> </td> </tr> </tbody> </table> </div> `; // Remove no shelves alert if it exists if (noShelvesAlert) { noShelvesAlert.remove(); } // Insert the new table shelvesContainer.innerHTML += tableHtml; } else { // If table already exists, add a new row const newRow = document.createElement('tr'); newRow.dataset.shelfId = data.shelf.id; newRow.innerHTML = ` <td>${shelfTableBody.children.length + 1}</td> <td>${data.shelf.name}</td> <td> <button type="button" class="btn btn-sm btn-danger delete-shelf"> <i class="fa fa-trash"></i> </button> </td> `; // Hide no shelves alert if it exists if (noShelvesAlert) { noShelvesAlert.style.display = 'none'; } // Append new row to table body shelfTableBody.appendChild(newRow); } } const addShelfBtn = document.getElementById('addShelfBtn'); if (addShelfBtn) { addShelfBtn.addEventListener('click', function() { fetch('/admin/warehouses/<?php echo e($warehouse->id); ?>/add-shelf', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>', } }) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { console.log('Shelf added:', data); // Update the table dynamically updateShelfTable(data); }) .catch(error => { console.error('Error:', error); alert('Error adding shelf: ' + error.message); }); }); } // Re-attach delete event listener to handle dynamically added delete buttons document.addEventListener('click', function(event) { const deleteBtn = event.target.closest('.delete-shelf'); if (deleteBtn) { const row = deleteBtn.closest('tr'); const shelfId = row.dataset.shelfId; if (confirm('Are you sure you want to delete this shelf?')) { fetch(`/admin/warehouses/<?php echo e($warehouse->id); ?>/delete-shelf`, { method: 'DELETE', headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>', }, body: JSON.stringify({ shelf_id: shelfId }) }) .then(response => response.json()) .then(data => { // Remove the row row.remove(); // Reindex the remaining rows const shelfTableBody = findShelfTableBody(); if (shelfTableBody) { Array.from(shelfTableBody.children).forEach((row, index) => { row.querySelector('td:first-child').textContent = index + 1; }); } // If no shelves left, show no shelves alert const noShelvesAlert = document.querySelector('.card-body'); if (shelfTableBody && shelfTableBody.children.length === 0) { noShelvesAlert.innerHTML += ` <div class="alert alert-info" id="noShelvesAlert"> No Existing Shelves Found </div> `; } }) .catch(error => { console.error('Error:', error); alert('Error deleting shelf'); }); } } }); }); </script> <?php echo $__env->make('admin.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/payraty/inventory_main/resources/views/admin/warehouses/edit.blade.php ENDPATH**/ ?>
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings