refactoring actions of javascript

This commit is contained in:
Cayo Puigdefabregas 2022-01-03 13:40:30 +01:00
parent 5bfe1584b9
commit 1acd3c4929
3 changed files with 48 additions and 11 deletions

View file

@ -23,3 +23,7 @@ function deviceSelect() {
$(x).val(devices_id); $(x).val(devices_id);
}); });
} }
function newAction(action) {
return action;
}

View file

@ -0,0 +1,33 @@
<div class="modal fade" id="actionModal" tabindex="-1" style="display: none;" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Adding to a lot</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="{{ url_for('inventory.devices.lot_devices_add') }}" method="post">
{{ form_lot_device.csrf_token }}
<div class="modal-body">
Please write a name of a lot
<select class="form-control selectpicker" id="selectLot" name="lot" data-live-search="true">
{% for lot in lots %}
<option value="{{ lot.id }}">{{ lot.name }}</option>
{% endfor %}
</select>
<input class="devicesList" type="hidden" name="devices" />
<p class="text-danger">
You need select first some device for adding this in a lot
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<input type="submit" class="btn btn-primary d-none" value="Save changes" />
</div>
</form>
</div>
</div>
</div>

View file

@ -72,25 +72,25 @@
Status actions Status actions
</li> </li>
<li> <li>
<a href="javascript:actionRecycling()" class="dropdown-item"> <a href="javascript:newAction('Recycling')" class="dropdown-item" data-bs-toggle="modal" data-bs-target="#actionModal">
<i class="bi bi-recycle"></i> <i class="bi bi-recycle"></i>
Recycling Recycling
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionUse()" class="dropdown-item"> <a href="javascript:newAction('Use')" class="dropdown-item">
<i class="bi bi-play-circle-fill"></i> <i class="bi bi-play-circle-fill"></i>
Use Use
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionRefurbish()" class="dropdown-item"> <a href="javascript:newAction('Refurbish')" class="dropdown-item">
<i class="bi bi-tools"></i> <i class="bi bi-tools"></i>
Refurbish Refurbish
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionManagement()" class="dropdown-item"> <a href="javascript:newAction('Management')" class="dropdown-item">
<i class="bi bi-mastodon"></i> <i class="bi bi-mastodon"></i>
Management Management
</a> </a>
@ -99,13 +99,13 @@
Allocation Allocation
</li> </li>
<li> <li>
<a href="javascript:actionAllocate()" class="dropdown-item"> <a href="javascript:newAction('Allocate')" class="dropdown-item">
<i class="bi bi-house-fill"></i> <i class="bi bi-house-fill"></i>
Allocate Allocate
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionDeallocate()" class="dropdown-item"> <a href="javascript:newAction('Deallocate')" class="dropdown-item">
<i class="bi bi-house"></i> <i class="bi bi-house"></i>
Deallocate Deallocate
</a> </a>
@ -114,31 +114,31 @@
Physical actions Physical actions
</li> </li>
<li> <li>
<a href="javascript:actionToPrepare()" class="dropdown-item"> <a href="javascript:newAction('ToPrepare')" class="dropdown-item">
<i class="bi bi-tools"></i> <i class="bi bi-tools"></i>
ToPrepare ToPrepare
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionPrepare()" class="dropdown-item"> <a href="javascript:newAction('Prepare')" class="dropdown-item">
<i class="bi bi-egg"></i> <i class="bi bi-egg"></i>
Prepare Prepare
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionDataWipe()" class="dropdown-item"> <a href="javascript:newAction('DataWipe')" class="dropdown-item">
<i class="bi bi-eraser-fill"></i> <i class="bi bi-eraser-fill"></i>
DataWipe DataWipe
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionToRepair()" class="dropdown-item"> <a href="javascript:newAction('ToRepair')" class="dropdown-item">
<i class="bi bi-screwdriver"></i> <i class="bi bi-screwdriver"></i>
ToRepair ToRepair
</a> </a>
</li> </li>
<li> <li>
<a href="javascript:actionReady()" class="dropdown-item"> <a href="javascript:newAction('Ready')" class="dropdown-item">
<i class="bi bi-check2-all"></i> <i class="bi bi-check2-all"></i>
Ready Ready
</a> </a>