filter work orders by open status
parent
7eac5a1ba0
commit
ff5473bf8a
|
|
@ -1,6 +1,7 @@
|
||||||
import type * as recordTypes from "../../types/recordTypes";
|
import type * as recordTypes from "../../types/recordTypes";
|
||||||
interface GetWorkOrdersFilters {
|
interface GetWorkOrdersFilters {
|
||||||
workOrderTypeId?: number | string;
|
workOrderTypeId?: number | string;
|
||||||
|
workOrderOpenStatus?: "" | "open" | "closed";
|
||||||
}
|
}
|
||||||
interface GetWorkOrdersOptions {
|
interface GetWorkOrdersOptions {
|
||||||
limit: number;
|
limit: number;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,14 @@ export const getWorkOrders = (filters, options) => {
|
||||||
sqlWhereClause += " and w.workOrderTypeId = ?";
|
sqlWhereClause += " and w.workOrderTypeId = ?";
|
||||||
sqlParameters.push(filters.workOrderTypeId);
|
sqlParameters.push(filters.workOrderTypeId);
|
||||||
}
|
}
|
||||||
|
if (filters.workOrderOpenStatus) {
|
||||||
|
if (filters.workOrderOpenStatus === "open") {
|
||||||
|
sqlWhereClause += " and w.workOrderCloseDate is null";
|
||||||
|
}
|
||||||
|
else if (filters.workOrderOpenStatus === "closed") {
|
||||||
|
sqlWhereClause += " and w.workOrderCloseDate is not null";
|
||||||
|
}
|
||||||
|
}
|
||||||
const count = database
|
const count = database
|
||||||
.prepare("select count(*) as recordCount" +
|
.prepare("select count(*) as recordCount" +
|
||||||
" from WorkOrders w" +
|
" from WorkOrders w" +
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import type * as recordTypes from "../../types/recordTypes";
|
||||||
|
|
||||||
interface GetWorkOrdersFilters {
|
interface GetWorkOrdersFilters {
|
||||||
workOrderTypeId?: number | string;
|
workOrderTypeId?: number | string;
|
||||||
|
workOrderOpenStatus?: "" | "open" | "closed";
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GetWorkOrdersOptions {
|
interface GetWorkOrdersOptions {
|
||||||
|
|
@ -35,6 +36,14 @@ export const getWorkOrders = (
|
||||||
sqlWhereClause += " and w.workOrderTypeId = ?";
|
sqlWhereClause += " and w.workOrderTypeId = ?";
|
||||||
sqlParameters.push(filters.workOrderTypeId);
|
sqlParameters.push(filters.workOrderTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filters.workOrderOpenStatus) {
|
||||||
|
if (filters.workOrderOpenStatus === "open") {
|
||||||
|
sqlWhereClause += " and w.workOrderCloseDate is null";
|
||||||
|
} else if (filters.workOrderOpenStatus === "closed") {
|
||||||
|
sqlWhereClause += " and w.workOrderCloseDate is not null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const count: number = database
|
const count: number = database
|
||||||
.prepare(
|
.prepare(
|
||||||
|
|
|
||||||
|
|
@ -32,21 +32,40 @@
|
||||||
<input id="searchFilter--limit" name="limit" type="hidden" value="100" />
|
<input id="searchFilter--limit" name="limit" type="hidden" value="100" />
|
||||||
<input id="searchFilter--offset" name="offset" type="hidden" value="0" />
|
<input id="searchFilter--offset" name="offset" type="hidden" value="0" />
|
||||||
|
|
||||||
<div class="field">
|
<div class="columns">
|
||||||
<label class="label" for="searchFilter--workOrderTypeId">Work Order Type</label>
|
<div class="column">
|
||||||
<div class="control has-icons-left">
|
<div class="field">
|
||||||
<div class="select is-fullwidth">
|
<label class="label" for="searchFilter--workOrderTypeId">Work Order Type</label>
|
||||||
<select id="searchFilter--workOrderTypeId" name="workOrderTypeId">
|
<div class="control has-icons-left">
|
||||||
<option value="">(All Work Order Types Types)</option>
|
<div class="select is-fullwidth">
|
||||||
<% for (const workOrderType of workOrderTypes) { %>
|
<select id="searchFilter--workOrderTypeId" name="workOrderTypeId">
|
||||||
<option value="<%= workOrderType.workOrderTypeId %>"><%= workOrderType.workOrderType || "(No Name)" %></option>
|
<option value="">(All Work Order Types Types)</option>
|
||||||
<% } %>
|
<% for (const workOrderType of workOrderTypes) { %>
|
||||||
</select>
|
<option value="<%= workOrderType.workOrderTypeId %>"><%= workOrderType.workOrderType || "(No Name)" %></option>
|
||||||
|
<% } %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-search" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="icon is-small is-left">
|
|
||||||
<i class="fas fa-search" aria-hidden="true"></i>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="searchFilter--workOrderOpenStatus">Open Status</label>
|
||||||
|
<div class="control">
|
||||||
|
<div class="select is-fullwidth">
|
||||||
|
<select id="searchFilter--workOrderOpenStatus" name="workOrderOpenStatus">
|
||||||
|
<option value="">(All Statuses)</option>
|
||||||
|
<option value="open" selected>Open</option>
|
||||||
|
<option value="closed">Closed</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue