omarali-me / hilux

Hilux Project UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hilux

This project was generated with Angular CLI version 9.1.3.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Starting Server

  1. Build application bundles by running yarn build

  2. For starting server ng serve

    for specifying port use: --port=port_number

    for disabling host check use: --disable-host-check

Translations

for convenience default language of app to arabic, In templates create Unique Id on tags which needs translations like: <a href="/" i18n="@@loginPageLoginLabel"><b>Hilux</b>Login</a>

That i18n attribute is the Id for translation. After specifying Ids we have to make entry of these Ids in the translation file by running: yarn int:extract

this will update the translation file src/locale/messages.xlf

This is the main translation file and for each languages there are different translation files depending on locale

update the arabic translations file as our default language is arabic so file will be src/locale/messages.ar.xlf

and for that you have to add a target tag below the source tag this tags content will act as translation.

sample of the translation node is:

<trans-unit id="headerMyTaskLabel" datatype="html"> // LABEL DI WE HAVE SPECIFIED IN TEMPLATE <source>My Tasks</source> // TEXT OF LABEL WHICH NEEDS TO BE REPLACED <target>My Tasks Arabic</target> // TRANSLATION TEXT OF LABEL <context-group purpose="location"> // LOCATUON WHERE THE LABEL IS USED <context context-type="sourcefile">src/app/shared/layouts/header/header.component.html</context> <context context-type="linenumber">17</context> </context-group> </trans-unit>

if the entry for tag is not available it will raise a translation not found error

Environment Variables

inside environments there are environment files on per environment basis

depending on environment the contents will be replaced in environment.ts

for changing API host you have to update entries in environment.ts

export const environment = { production: false, apiHost: 'http://192.168.5.113' // UPDATE THIS TO THE HOST YOU WANT TO MAKE API CALL };

make sure you rebuild bundles and restart server after doing this.

Form Renderer

All code related to form renderer is inside Fields Directory

All fields available in the system are listed there and depending on the type of field it is rendering fields dynamically from this field

External Api calls for fields

Data loading from thirdparty is done by FieldsService There are two separate methods one for get call and one for post call, this will be decided by the AuxInfo key of json Received.

This Service is also responsible for showing label texts on the fields generated by form Renderer

About

Hilux Project UI


Languages

Language:CSS 57.4%Language:HTML 27.9%Language:TypeScript 14.2%Language:JavaScript 0.5%