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);
});
}
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
</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>
Recycling
</a>
</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>
Use
</a>
</li>
<li>
<a href="javascript:actionRefurbish()" class="dropdown-item">
<a href="javascript:newAction('Refurbish')" class="dropdown-item">
<i class="bi bi-tools"></i>
Refurbish
</a>
</li>
<li>
<a href="javascript:actionManagement()" class="dropdown-item">
<a href="javascript:newAction('Management')" class="dropdown-item">
<i class="bi bi-mastodon"></i>
Management
</a>
@ -99,13 +99,13 @@
Allocation
</li>
<li>
<a href="javascript:actionAllocate()" class="dropdown-item">
<a href="javascript:newAction('Allocate')" class="dropdown-item">
<i class="bi bi-house-fill"></i>
Allocate
</a>
</li>
<li>
<a href="javascript:actionDeallocate()" class="dropdown-item">
<a href="javascript:newAction('Deallocate')" class="dropdown-item">
<i class="bi bi-house"></i>
Deallocate
</a>
@ -114,31 +114,31 @@
Physical actions
</li>
<li>
<a href="javascript:actionToPrepare()" class="dropdown-item">
<a href="javascript:newAction('ToPrepare')" class="dropdown-item">
<i class="bi bi-tools"></i>
ToPrepare
</a>
</li>
<li>
<a href="javascript:actionPrepare()" class="dropdown-item">
<a href="javascript:newAction('Prepare')" class="dropdown-item">
<i class="bi bi-egg"></i>
Prepare
</a>
</li>
<li>
<a href="javascript:actionDataWipe()" class="dropdown-item">
<a href="javascript:newAction('DataWipe')" class="dropdown-item">
<i class="bi bi-eraser-fill"></i>
DataWipe
</a>
</li>
<li>
<a href="javascript:actionToRepair()" class="dropdown-item">
<a href="javascript:newAction('ToRepair')" class="dropdown-item">
<i class="bi bi-screwdriver"></i>
ToRepair
</a>
</li>
<li>
<a href="javascript:actionReady()" class="dropdown-item">
<a href="javascript:newAction('Ready')" class="dropdown-item">
<i class="bi bi-check2-all"></i>
Ready
</a>