show lot occupancy count on dashboard
parent
01c086da96
commit
90c107b0f3
|
|
@ -1,6 +1,7 @@
|
|||
import { dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js';
|
||||
import { getWorkOrderMilestones } from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js';
|
||||
import { getWorkOrders } from '../../helpers/lotOccupancyDB/getWorkOrders.js';
|
||||
import { getLotOccupancies } from '../../helpers/lotOccupancyDB/getLotOccupancies.js';
|
||||
export async function handler(_request, response) {
|
||||
const currentDateString = dateToString(new Date());
|
||||
const workOrderMilestones = await getWorkOrderMilestones({
|
||||
|
|
@ -16,10 +17,20 @@ export async function handler(_request, response) {
|
|||
limit: 1,
|
||||
offset: 0
|
||||
});
|
||||
const lotOccupancyResults = await getLotOccupancies({
|
||||
occupancyStartDateString: currentDateString
|
||||
}, {
|
||||
limit: 1,
|
||||
offset: 0,
|
||||
includeFees: false,
|
||||
includeOccupants: false,
|
||||
includeTransactions: false
|
||||
});
|
||||
response.render('dashboard', {
|
||||
headTitle: 'Dashboard',
|
||||
workOrderMilestones,
|
||||
workOrderCount: workOrderResults.count
|
||||
workOrderCount: workOrderResults.count,
|
||||
lotOccupancyCount: lotOccupancyResults.count
|
||||
});
|
||||
}
|
||||
export default handler;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@ import { dateToString } from '@cityssm/expressjs-server-js/dateTimeFns.js'
|
|||
|
||||
import { getWorkOrderMilestones } from '../../helpers/lotOccupancyDB/getWorkOrderMilestones.js'
|
||||
import { getWorkOrders } from '../../helpers/lotOccupancyDB/getWorkOrders.js'
|
||||
import { getLotOccupancies } from '../../helpers/lotOccupancyDB/getLotOccupancies.js'
|
||||
|
||||
export async function handler(_request: Request, response: Response): Promise<void> {
|
||||
export async function handler(
|
||||
_request: Request,
|
||||
response: Response
|
||||
): Promise<void> {
|
||||
const currentDateString = dateToString(new Date())
|
||||
|
||||
const workOrderMilestones = await getWorkOrderMilestones(
|
||||
|
|
@ -24,15 +28,29 @@ export async function handler(_request: Request, response: Response): Promise<vo
|
|||
workOrderOpenDateString: currentDateString
|
||||
},
|
||||
{
|
||||
limit: 1,
|
||||
limit: 1, // only using the count
|
||||
offset: 0
|
||||
}
|
||||
)
|
||||
|
||||
const lotOccupancyResults = await getLotOccupancies(
|
||||
{
|
||||
occupancyStartDateString: currentDateString
|
||||
},
|
||||
{
|
||||
limit: 1, // only using the count
|
||||
offset: 0,
|
||||
includeFees: false,
|
||||
includeOccupants: false,
|
||||
includeTransactions: false
|
||||
}
|
||||
)
|
||||
|
||||
response.render('dashboard', {
|
||||
headTitle: 'Dashboard',
|
||||
workOrderMilestones,
|
||||
workOrderCount: workOrderResults.count
|
||||
workOrderCount: workOrderResults.count,
|
||||
lotOccupancyCount: lotOccupancyResults.count
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import { dateIntegerToString, dateStringToInteger } from '@cityssm/expressjs-ser
|
|||
import * as configFunctions from '../functions.config.js';
|
||||
import { getOccupancyTypeById } from '../functions.cache.js';
|
||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js';
|
||||
import { getLotOccupancyFees } from './getLotOccupancyFees.js';
|
||||
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js';
|
||||
import { getLotNameWhereClause, getOccupancyTimeWhereClause, getOccupantNameWhereClause } from '../functions.sqlFilters.js';
|
||||
import getLotOccupancyFees from './getLotOccupancyFees.js';
|
||||
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js';
|
||||
function buildWhereClause(filters) {
|
||||
let sqlWhereClause = ' where o.recordDelete_timeMillis is null';
|
||||
const sqlParameters = [];
|
||||
|
|
|
|||
|
|
@ -11,16 +11,18 @@ import {
|
|||
import * as configFunctions from '../functions.config.js'
|
||||
|
||||
import { getOccupancyTypeById } from '../functions.cache.js'
|
||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
|
||||
|
||||
import type * as recordTypes from '../../types/recordTypes'
|
||||
import { getLotOccupancyOccupants } from './getLotOccupancyOccupants.js'
|
||||
import { getLotOccupancyFees } from './getLotOccupancyFees.js'
|
||||
import { getLotOccupancyTransactions } from './getLotOccupancyTransactions.js'
|
||||
|
||||
import {
|
||||
getLotNameWhereClause,
|
||||
getOccupancyTimeWhereClause,
|
||||
getOccupantNameWhereClause
|
||||
} from '../functions.sqlFilters.js'
|
||||
import getLotOccupancyFees from './getLotOccupancyFees.js'
|
||||
import getLotOccupancyTransactions from './getLotOccupancyTransactions.js'
|
||||
|
||||
import type * as recordTypes from '../../types/recordTypes'
|
||||
|
||||
interface GetLotOccupanciesFilters {
|
||||
lotId?: number | string
|
||||
|
|
|
|||
|
|
@ -224,4 +224,4 @@ span.button.is-static {
|
|||
&.is-visible-hover {
|
||||
visibility: visible !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,9 @@
|
|||
<span class="fa-layers fa-4x fa-fw" aria-hidden="true">
|
||||
<i class="fas fa-vector-square"></i>
|
||||
<i class="fas fa-user" data-fa-transform="shrink-10"></i>
|
||||
<% if (lotOccupancyCount > 0) { %>
|
||||
<span class="fa-layers-counter has-background-success"><%= lotOccupancyCount %></span>
|
||||
<% } %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="media-content has-text-black">
|
||||
|
|
|
|||
Loading…
Reference in New Issue