npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

3pm-timesheet-module

v1.5.0

Published

![NPM](https://img.shields.io/npm/v/3pm-timesheet-module.svg)

Downloads

43

Readme

NPM

3PM Packages

Following included packages:
  • Timesheet Package
  • Leave Request Package
Please refer to the wiki for the following:

Adding checkboxes for approving timesheets

Adding API success and error logging

Timesheet Module

Installation

$ npm install 3pm-timesheet-module

You will also need to setup an express server if you haven't done so.

$ npm install express cors nodemon

Features

  • Sign in / Sign out
  • Start new jobs when signing out
  • Selecting multiple assets to assign hours too hasMultiAssets should be set to TRUE() in app.
  • Selecting one asset. hasOneAsset should be set to TRUE() in mobile app.

Usage

This is a basic example on how we can setup our server and implement the Timesheet module.

const express = require('express');
const cors = require('cors');
const { Timesheet } = require('3pm-timesheet-module');

const { knack } = require('./api') // Knack API functions

const app = express();
const PORT = process.env.PORT || 8000;

app.use(cors());
app.use(express.urlencoded({ extended: false }));
app.use(express.json());

app.post('/api/timesheet', async (req, res) => {
  const payload = req.body.Entry;

  const {
    createRecord,
    updateRecord,
    getAllRecords
  } = knack; // API functions
  try {
    const fieldLookup = {
      timesheetID: "field_9",
      signinDateTime: "field_5",
      signoutDateTime: "field_10",
      staffConnection: "field_6",
      staffName: "field_16",
      jobConnection: "field_7",
      signinLocation: "field_8",
      signoutLocation: "field_11",
      lunch: "field_14",
      comments: "field_13",
    };

    await Timesheet(payload, fieldLookup, createRecord, updateRecord, getAllRecords);

    res.status(200).send('Successfully created/updated timesheet entry.');
  } catch(err) {
    res.status(400).json({
      message: 'Failed creating/updating timesheet.',
      error: err
    })
  }
})

👀 Timesheet Props

| Prop | Description | Type | Required | | --------------------- | ------------------------------------------------- | ------------------------------- | -------------- | | payload | Data payload from app | object | Yes | | lookup | Object to map keys / fields | {key: field} | Yes | | createRecord | Function to create timesheet record | fn(obj_num, data, retry?) | Yes | | updateRecord | Function to update timesheet record | fn(obj_num, data, id, retry?) | Yes | | getAllRecords | Function to get record by timesheet ID | fn(obj_num, filer?, retry?) | Yes | | objectNum | Knack object # for where payload is going too | number | Yes | | assetObject | Function to get record by timesheet ID | number | No |

Leave Request Module

Here is a basic example on how we could implement the leave process.

app.post('/api/leave', async (req, res) => {
  const { createRecord } = knack;
  try {
    res.status(200).send('Successfully created leave entry.')
    const fieldLookup = {
      firstDay: "field_21",
      lastDay: "field_22",
      days: "field_23",
      staffConnection: "field_18",
      leaveType: "field_19",
      otherLeaveType: "field_20",
      leaveComments: "field_25",
    }
    const objectNum = 4;
    await Leave(req.body.Entry, fieldLookup, createRecord, objectNum)
  } catch (err) {
    res.status(400).json({
      message: 'Failed creating leave request.',
      error: err
    })
  }
})

👀 Leave Props

| Prop | Description | Type | Required | | --------------------- | ------------------------------------------------- | ------------------------------- | -------------- | | payload | Data payload from app | object | Yes | | lookup | Object to map keys / fields | {key: field} | Yes | | createRecord | Function to create leave record | fn(obj_num, data, retry?) | Yes | | objectNum | Object to create records in | number | Yes |

📝 Changelog

For every major or minor release changelog/migration-guide will be available in releases