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

prescription-builder

v0.2.7

Published

Report Builder

Downloads

28

Readme

Report Builder / Prescription Builder

Report builder for prescription building alt text

Installation

You will need bootstrap as bootstrap is used to build this.

npm i bootstrap
npm i prescription-builder
yarn add bootstrap
yarn add prescription-builder

Use

in your main.ts import bootstrap and import prescription-builder style.css

import { createApp } from 'vue'
import './styles/style.scss'
import App from './App.vue'

+ import 'prescription-builder/lib/style.css'
+ import 'bootstrap'

createApp(App).mount('#app')

Register Builder Component

use this code to show builder component

import {PrescriptionBuilder} from "prescription-builder";

<PrescriptionBuilder></PrescriptionBuilder>

PrescriptionBuilder Component support variables, page-setup & render-list props where.

PrescriptionBuilder also support onExport event it's return the pageSetup and renderList in event argument

variables should be array of object

interface Variable {
    title: string;
    description: string;
}

page-setup should be object

interface Page {
    title: string;
    height: number; // height is in millimeters
    width: number; // weight is in  millimeters
}

render-list should be array of object


// check /lib/component/builder/utls/models.d.ts for all decleartaion
interface DragElementSettingsMap {
    text: TextSetting,
    columns: ColumnSetting,
    header: HeaderSetting,
    drug: DrugSetting,
    subscription: SubscriptionSetting,
}

use render-list props to edit prescription builder

Register Preview Component

use PrescriptionPreview to preview the prescription

const page = {
    type: 'a4',
    height: 210,
    width: 400,
}

  <PrescriptionPreview :render-list="" :page-setup="" :allow-demo="false"></PrescriptionPreview>

As you already apply the builder now it's time to make a printable document based on prescription builder.

as you exported pageSetup and renderList, i'm assuming that you are storing the export as JSON.stringify. so let's start form there.

const prescriptionRender = JSON.parse(exportedData).renderList;
prescriptionRender.forEach((el) => {
    // replace value by the declared variable
    // i.e your saved value is Patient Name: @patient_name
    // replace @patient_name to prescription.patient.full_name
    el.value =  yourModifiedValue
});

Better to do it from server side instate of client side

<?php

$builder = PrescriptionBuilder::find(1);
$data = json_decode($builder->data, true);
$prescriptionRender = $data['renderList'];


// Looping through each element in prescriptionRender
foreach ($prescriptionRender as &$el) {
    // replace value by the declared variable
    // i.e your saved value is Patient Name: @patient_name
    // replace @patient_name to prescription.patient.full_name

    // Assuming $prescription is an associative array with patient name and another value
    $prescription = [
        'patient' => [
            'full_name' => 'John Doe', // Example patient name
        ],
        'another_value' => 'Another Value', // Example another value
    ];

    // Replacing @patient_name with $prescription['patient']['full_name']
    // You can replace other variables similarly
    $el['value'] = str_replace('@patient_name', $prescription['patient']['full_name'], $el['value']);
    $el['value'] = str_replace('@another_value', $prescription['another_value'], $el['value']);
}

?>