9 | {
10 | private SaveEventService _saveEventService;
11 |
12 | public CreateProjectCommandHandler(SaveEventService saveEventService)
13 | {
14 | _saveEventService = saveEventService;
15 | }
16 |
17 | protected override void Handle(Commands.CreateProject command)
18 | {
19 | var dateTime = DateTime.UtcNow;
20 |
21 | var @event = new ProjectCreated(
22 | command.ProjectId,
23 | command.ProjectOwnerId,
24 | command.Name,
25 | dateTime);
26 |
27 | _saveEventService.SaveEvent(@event, dateTime);
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/HourlyRate/src/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/CreateProject/src/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/Pages/Error.cshtml:
--------------------------------------------------------------------------------
1 | @page
2 | @model ErrorModel
3 | @{
4 | ViewData["Title"] = "Error";
5 | }
6 |
7 | Error.
8 | An error occurred while processing your request.
9 |
10 | @if (Model.ShowRequestId)
11 | {
12 |
13 | Request ID: @Model.RequestId
14 |
15 | }
16 |
17 | Development Mode
18 |
19 | Swapping to the Development environment displays detailed information about the error that occurred.
20 |
21 |
22 | The Development environment shouldn't be enabled for deployed applications.
23 | It can result in displaying sensitive information from exceptions to end users.
24 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
25 | and restarting the app.
26 |
27 |
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CreateProject
5 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/CommandHandlers/SubmitTimesheetCommandHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MediatR;
3 | using SubmitTimesheet.Services;
4 | using SubmitTimesheet.Events;
5 |
6 | namespace SubmitTimesheet.CommandHandlers
7 | {
8 | public class SubmitTimesheetCommandHandler : RequestHandler
9 | {
10 | private SaveEventService _saveEventService;
11 |
12 | public SubmitTimesheetCommandHandler(SaveEventService saveEventService)
13 | {
14 | _saveEventService = saveEventService;
15 | }
16 |
17 | protected override void Handle(Commands.SubmitTimesheet command)
18 | {
19 | var dateTime = DateTime.UtcNow;
20 |
21 | var @event = new TimesheetSubmitted(
22 | command.TimesheetId,
23 | command.UserId,
24 | command.StartDate,
25 | command.EndDate,
26 | dateTime);
27 |
28 | _saveEventService.SaveEvent(@event, dateTime);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false
30 | });
31 | };
32 |
--------------------------------------------------------------------------------
/HourlyRate/src/ClientApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "HourlyRate",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "bootstrap": "^4.3.1",
7 | "jquery": "^3.5.0",
8 | "react": "^16.0.0",
9 | "react-dom": "^16.13.1",
10 | "react-router-bootstrap": "^0.24.4",
11 | "react-router-dom": "^4.2.2",
12 | "react-scripts": "^3.4.1",
13 | "react-uuid": "^1.0.2",
14 | "reactstrap": "^6.3.0",
15 | "rimraf": "^2.6.2"
16 | },
17 | "devDependencies": {
18 | "ajv": "^6.0.0",
19 | "cross-env": "^5.2.0",
20 | "eslint-config-react-app": "^2.1.0",
21 | "eslint-plugin-flowtype": "^2.50.3",
22 | "eslint-plugin-import": "^2.14.0",
23 | "eslint-plugin-jsx-a11y": "^5.1.1",
24 | "eslint-plugin-react": "^7.11.1"
25 | },
26 | "eslintConfig": {
27 | "extends": "react-app"
28 | },
29 | "scripts": {
30 | "start": "rimraf ./build && react-scripts start",
31 | "build": "react-scripts build",
32 | "test": "cross-env CI=true react-scripts test --env=jsdom",
33 | "eject": "react-scripts eject",
34 | "lint": "eslint ./src/"
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/src/karma.conf.js:
--------------------------------------------------------------------------------
1 | // Karma configuration file, see link for more information
2 | // https://karma-runner.github.io/1.0/config/configuration-file.html
3 |
4 | module.exports = function (config) {
5 | config.set({
6 | basePath: '',
7 | frameworks: ['jasmine', '@angular-devkit/build-angular'],
8 | plugins: [
9 | require('karma-jasmine'),
10 | require('karma-chrome-launcher'),
11 | require('karma-jasmine-html-reporter'),
12 | require('karma-coverage-istanbul-reporter'),
13 | require('@angular-devkit/build-angular/plugins/karma')
14 | ],
15 | client: {
16 | clearContext: false // leave Jasmine Spec Runner output visible in browser
17 | },
18 | coverageIstanbulReporter: {
19 | dir: require('path').join(__dirname, '../coverage'),
20 | reports: ['html', 'lcovonly'],
21 | fixWebpackSourcePaths: true
22 | },
23 | reporters: ['progress', 'kjhtml'],
24 | port: 9876,
25 | colors: true,
26 | logLevel: config.LOG_INFO,
27 | autoWatch: true,
28 | browsers: ['Chrome'],
29 | singleRun: false
30 | });
31 | };
32 |
--------------------------------------------------------------------------------
/Approve/src/Pages/Shared/_CookieConsentPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Http.Features
2 |
3 | @{
4 | var consentFeature = Context.Features.Get();
5 | var showBanner = !consentFeature?.CanTrack ?? false;
6 | var cookieString = consentFeature?.CreateConsentCookie();
7 | }
8 |
9 | @if (showBanner)
10 | {
11 |
12 | Use this space to summarize your privacy and cookie use policy.
Learn More .
13 |
14 | Accept
15 |
16 |
17 |
25 | }
26 |
--------------------------------------------------------------------------------
/Approve/src/Controllers/TimesheetController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Approve.Commands;
4 | using Approve.Events;
5 | using Approve.Services;
6 | using MediatR;
7 | using Microsoft.AspNetCore.Mvc;
8 | using Newtonsoft.Json;
9 |
10 | namespace Approve.Controllers
11 | {
12 | [Route("api/[controller]")]
13 | public class TimesheetController : Controller
14 | {
15 | private LoadEventService _loadEventService;
16 | private IMediator _mediator;
17 |
18 | public TimesheetController(IMediator mediator)
19 | {
20 | _mediator = mediator;
21 | _loadEventService = new LoadEventService();
22 | }
23 |
24 | [HttpGet("approve")]
25 | public IActionResult Approve(Guid timesheetId, Guid userId)
26 | {
27 | _mediator.Send(new ApproveTimesheet(timesheetId, userId));
28 | return Ok($"save event");
29 | }
30 |
31 | [HttpGet("get")]
32 | public IActionResult GetEvents()
33 | {
34 | return Ok(_loadEventService.LoadEvent());
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/README.md:
--------------------------------------------------------------------------------
1 | # CreateProject
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
4 |
5 | ## Development server
6 |
7 | 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.
8 |
9 | ## Code scaffolding
10 |
11 | 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`.
12 |
13 | ## Build
14 |
15 | 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.
16 |
17 | ## Running unit tests
18 |
19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20 |
21 | ## Running end-to-end tests
22 |
23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
28 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/README.md:
--------------------------------------------------------------------------------
1 | # SubmitTimesheet
2 |
3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
4 |
5 | ## Development server
6 |
7 | 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.
8 |
9 | ## Code scaffolding
10 |
11 | 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`.
12 |
13 | ## Build
14 |
15 | 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.
16 |
17 | ## Running unit tests
18 |
19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20 |
21 | ## Running end-to-end tests
22 |
23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24 |
25 | ## Further help
26 |
27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
28 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx-router:
4 | image: nginx:latest
5 | volumes:
6 | - ./NginxRouter/nginx.conf:/etc/nginx/nginx.conf
7 | - ./NginxRouter/index.html:/var/www/index.html
8 | ports:
9 | - 80:80
10 |
11 | create-project:
12 | build: ./CreateProject
13 | expose:
14 | - "80"
15 | volumes:
16 | - ./events:/events
17 | environment:
18 | EVENT_PATH: /events
19 | ASPNETCORE_URLS: https://+:80
20 |
21 | approve:
22 | build: ./Approve
23 | expose:
24 | - "80"
25 | volumes:
26 | - ./events:/events
27 | environment:
28 | EVENT_PATH: /events
29 | ASPNETCORE_URLS: https://+:80
30 |
31 | submit-timesheet:
32 | build: ./SubmitTimesheet
33 | expose:
34 | - "80"
35 | volumes:
36 | - ./events:/events
37 | environment:
38 | EVENT_PATH: /events
39 | ASPNETCORE_URLS: https://+:80
40 |
41 | hourly-rate:
42 | build: ./HourlyRate
43 | expose:
44 | - "80"
45 | volumes:
46 | - ./events:/events
47 | environment:
48 | EVENT_PATH: /events
49 | ASPNETCORE_URLS: https://+:80
50 |
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { HttpClient } from '@angular/common/http';
2 | import { Component, Inject } from '@angular/core';
3 | import { Project } from './Project';
4 | import * as uuid from 'uuid';
5 |
6 | @Component({
7 | selector: 'app-root',
8 | templateUrl: './app.component.html',
9 | styleUrls: ['./app.component.css']
10 | })
11 | export class AppComponent {
12 | title = 'app';
13 |
14 | project = new Project();
15 |
16 | constructor(private httpClient: HttpClient, @Inject('BASE_URL') private baseUrl: string) {
17 | this.generateIds();
18 | }
19 |
20 |
21 | submit() {
22 | console.log(this.project);
23 | this.httpClient
24 | .post(`${this.baseUrl}api/project/create`, this.project).subscribe(result => {
25 | }, error => console.error(error));
26 | }
27 |
28 |
29 | generateIds() {
30 | const n = this.getRandomInt(1, 50);
31 | this.project.ProjectId = uuid.v4();
32 | this.project.ProjectOwnerId = uuid.v4();
33 | this.project.Name= `Name ${n}`;
34 | }
35 |
36 | private getRandomInt(min: number, max: number) {
37 | return Math.floor(Math.random() * (max - min + 1)) + min;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Approve/src/wwwroot/lib/jquery-validation/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | =====================
3 |
4 | Copyright Jörn Zaefferer
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Approve/src/Pages/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/Approve/src/wwwroot/lib/bootstrap/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2011-2018 Twitter, Inc.
4 | Copyright (c) 2011-2018 The Bootstrap Authors
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/Approve/src/wwwroot/css/site.css:
--------------------------------------------------------------------------------
1 | /* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
2 | for details on configuring this project to bundle and minify static web assets. */
3 |
4 | a.navbar-brand {
5 | white-space: normal;
6 | text-align: center;
7 | word-break: break-all;
8 | }
9 |
10 | /* Sticky footer styles
11 | -------------------------------------------------- */
12 | html {
13 | font-size: 14px;
14 | }
15 | @media (min-width: 768px) {
16 | html {
17 | font-size: 16px;
18 | }
19 | }
20 |
21 | .border-top {
22 | border-top: 1px solid #e5e5e5;
23 | }
24 | .border-bottom {
25 | border-bottom: 1px solid #e5e5e5;
26 | }
27 |
28 | .box-shadow {
29 | box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
30 | }
31 |
32 | button.accept-policy {
33 | font-size: 1rem;
34 | line-height: inherit;
35 | }
36 |
37 | /* Sticky footer styles
38 | -------------------------------------------------- */
39 | html {
40 | position: relative;
41 | min-height: 100%;
42 | }
43 |
44 | body {
45 | /* Margin bottom by footer height */
46 | margin-bottom: 60px;
47 | }
48 | .footer {
49 | position: absolute;
50 | bottom: 0;
51 | width: 100%;
52 | white-space: nowrap;
53 | /* Set the fixed height of the footer here */
54 | height: 60px;
55 | line-height: 60px; /* Vertically center the text there */
56 | }
57 |
--------------------------------------------------------------------------------
/HourlyRate/src/node_modules/react-uuid/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "_from": "react-uuid",
3 | "_id": "react-uuid@1.0.2",
4 | "_inBundle": false,
5 | "_integrity": "sha512-5e0GM16uuQj9MdRJlZ0GdLC8LKMwpU9PIqYmF27s3fIV2z+rLyASTaiW4aKzSY4DyGanz+ImzsECkftwGWfAwA==",
6 | "_location": "/react-uuid",
7 | "_phantomChildren": {},
8 | "_requested": {
9 | "type": "tag",
10 | "registry": true,
11 | "raw": "react-uuid",
12 | "name": "react-uuid",
13 | "escapedName": "react-uuid",
14 | "rawSpec": "",
15 | "saveSpec": null,
16 | "fetchSpec": "latest"
17 | },
18 | "_requiredBy": [
19 | "#USER",
20 | "/"
21 | ],
22 | "_resolved": "https://registry.npmjs.org/react-uuid/-/react-uuid-1.0.2.tgz",
23 | "_shasum": "c77cea91cf38eafb1aaa7910f92621b2ed91b969",
24 | "_spec": "react-uuid",
25 | "_where": "E:\\PROJECTS\\CURRENT\\TimeTrackingSystem.DotNetStack\\HourlyRate\\src",
26 | "author": {
27 | "name": "Rick Brown",
28 | "email": "ricky.brown.00@gmail.com",
29 | "url": "https://github.com/RickBr0wn/minimal-react-boilerplate"
30 | },
31 | "bundleDependencies": false,
32 | "deprecated": false,
33 | "description": "A simple library to create uuid's in React",
34 | "license": "MIT",
35 | "main": "uuid.js",
36 | "name": "react-uuid",
37 | "scripts": {
38 | "test": "echo \"Error: no test specified\" && exit 1"
39 | },
40 | "version": "1.0.2"
41 | }
42 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SubmitTimesheet
5 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component, Inject} from '@angular/core';
2 | import {SubmitTimesheet} from "./SubmitTimesheet";
3 | import { HttpClient } from '@angular/common/http';
4 | import {catchError} from "rxjs/operators";
5 | import {of} from "rxjs";
6 | import * as uuid from 'uuid';
7 | import * as moment from 'moment';
8 |
9 |
10 | @Component({
11 | selector: 'app-root',
12 | templateUrl: './app.component.html',
13 | styleUrls: ['./app.component.css']
14 | })
15 | export class AppComponent {
16 | title = 'app';
17 |
18 | submitTimesheet = new SubmitTimesheet();
19 |
20 | constructor(private httpClient: HttpClient, @Inject('BASE_URL') private baseUrl: string) {
21 | this.generateAll();
22 | }
23 |
24 | generateDates(){
25 | this.submitTimesheet.StartDate = moment().toDate();
26 | this.submitTimesheet.EndDate = moment().add(10,'h').toDate();
27 | }
28 |
29 |
30 | generateGuidForTimesheetId(){
31 | this.submitTimesheet.TimesheetId = uuid.v4();
32 | }
33 |
34 | generateGuidForUserId(){
35 | this.submitTimesheet.UserId = uuid.v4();
36 | }
37 | generateAll(){
38 | this.generateGuidForTimesheetId();
39 | this.generateDates();
40 | this.generateGuidForUserId();
41 | }
42 |
43 | submit() {
44 | console.log("try subbmit");
45 | this.httpClient
46 | .post(`${this.baseUrl}api/timesheet/submitTimesheet`, this.submitTimesheet).subscribe(result => {
47 | }, error => console.error(error));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Approve/src/wwwroot/lib/jquery/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright JS Foundation and other contributors, https://js.foundation/
2 |
3 | This software consists of voluntary contributions made by many
4 | individuals. For exact contribution history, see the revision history
5 | available at https://github.com/jquery/jquery
6 |
7 | The following license applies to all parts of this software except as
8 | documented below:
9 |
10 | ====
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | ====
32 |
33 | All files located in the node_modules and external directories are
34 | externally maintained libraries used by this software which have their
35 | own licenses; we recommend you read them, as their terms may differ from
36 | the terms above.
37 |
--------------------------------------------------------------------------------
/HourlyRate/src/ClientApp/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
23 | HourlyRate
24 |
25 |
26 |
27 | You need to enable JavaScript to run this app.
28 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "CreateProject",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "build:ssr": "ng run CreateProject:server:dev",
9 | "test": "ng test",
10 | "lint": "ng lint",
11 | "e2e": "ng e2e"
12 | },
13 | "private": true,
14 | "dependencies": {
15 | "@angular/animations": "6.1.10",
16 | "@angular/common": "6.1.10",
17 | "@angular/compiler": "6.1.10",
18 | "@angular/core": "6.1.10",
19 | "@angular/forms": "6.1.10",
20 | "@angular/http": "6.1.10",
21 | "@angular/platform-browser": "6.1.10",
22 | "@angular/platform-browser-dynamic": "6.1.10",
23 | "@angular/platform-server": "6.1.10",
24 | "@angular/router": "6.1.10",
25 | "@nguniversal/module-map-ngfactory-loader": "6.0.0",
26 | "core-js": "^2.5.4",
27 | "rxjs": "^6.0.0",
28 | "zone.js": "^0.8.26",
29 | "aspnet-prerendering": "^3.0.1",
30 | "bootstrap": "^4.3.1",
31 | "jquery": "3.3.1",
32 | "popper.js": "^1.14.3"
33 | },
34 | "devDependencies": {
35 | "@angular-devkit/build-angular": "~0.6.0",
36 | "@angular/cli": "~6.0.0",
37 | "@angular/compiler-cli": "6.1.10",
38 | "@angular/language-service": "^6.0.0",
39 | "@types/jasmine": "~2.8.6",
40 | "@types/jasminewd2": "~2.0.3",
41 | "@types/node": "~8.9.4",
42 | "codelyzer": "~4.2.1",
43 | "jasmine-core": "~2.99.1",
44 | "jasmine-spec-reporter": "~4.2.1",
45 | "karma": "^3.0.0",
46 | "karma-chrome-launcher": "~2.2.0",
47 | "karma-coverage-istanbul-reporter": "~1.4.2",
48 | "karma-jasmine": "~1.1.1",
49 | "karma-jasmine-html-reporter": "^0.2.2",
50 | "typescript": "~2.7.2"
51 | },
52 | "optionalDependencies": {
53 | "node-sass": "^4.9.3",
54 | "protractor": "~5.4.0",
55 | "ts-node": "~5.0.1",
56 | "tslint": "~5.9.1"
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SubmitTimesheet",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "ng": "ng",
6 | "start": "ng serve",
7 | "build": "ng build",
8 | "build:ssr": "ng run SubmitTimesheet:server:dev",
9 | "test": "ng test",
10 | "lint": "ng lint",
11 | "e2e": "ng e2e"
12 | },
13 | "private": true,
14 | "dependencies": {
15 | "@angular/animations": "6.1.10",
16 | "@angular/common": "6.1.10",
17 | "@angular/compiler": "6.1.10",
18 | "@angular/core": "6.1.10",
19 | "@angular/forms": "6.1.10",
20 | "@angular/http": "6.1.10",
21 | "@angular/platform-browser": "6.1.10",
22 | "@angular/platform-browser-dynamic": "6.1.10",
23 | "@angular/platform-server": "6.1.10",
24 | "@angular/router": "6.1.10",
25 | "@nguniversal/module-map-ngfactory-loader": "6.0.0",
26 | "aspnet-prerendering": "^3.0.1",
27 | "bootstrap": "^4.3.1",
28 | "core-js": "^2.5.4",
29 | "jquery": "3.4.0",
30 | "moment": "^2.24.0",
31 | "popper.js": "^1.14.3",
32 | "rxjs": "^6.0.0",
33 | "zone.js": "^0.8.26"
34 | },
35 | "devDependencies": {
36 | "@angular-devkit/build-angular": "~0.6.0",
37 | "@angular/cli": "~6.0.0",
38 | "@angular/compiler-cli": "6.1.10",
39 | "@angular/language-service": "^6.0.0",
40 | "@types/jasmine": "~2.8.6",
41 | "@types/jasminewd2": "~2.0.3",
42 | "@types/node": "~8.9.4",
43 | "codelyzer": "~4.2.1",
44 | "jasmine-core": "~2.99.1",
45 | "jasmine-spec-reporter": "~4.2.1",
46 | "karma": "^3.0.0",
47 | "karma-chrome-launcher": "~2.2.0",
48 | "karma-coverage-istanbul-reporter": "~1.4.2",
49 | "karma-jasmine": "~1.1.1",
50 | "karma-jasmine-html-reporter": "^0.2.2",
51 | "typescript": "~2.7.2"
52 | },
53 | "optionalDependencies": {
54 | "node-sass": "^4.9.3",
55 | "protractor": "~5.4.0",
56 | "ts-node": "~5.0.1",
57 | "tslint": "~5.9.1"
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using MediatR;
3 | using Microsoft.AspNetCore.Builder;
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.AspNetCore.HttpsPolicy;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.SpaServices.AngularCli;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.DependencyInjection;
10 | using SubmitTimesheet.Services;
11 |
12 | namespace SubmitTimesheet
13 | {
14 | public class Startup
15 | {
16 | public Startup(IConfiguration configuration)
17 | {
18 | Configuration = configuration;
19 | }
20 |
21 | public IConfiguration Configuration { get; }
22 |
23 | public void ConfigureServices(IServiceCollection services)
24 | {
25 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
26 |
27 | services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; });
28 |
29 | services.AddMediatR(Assembly.GetExecutingAssembly());
30 | services.AddTransient();
31 | }
32 |
33 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
34 | {
35 | if (env.IsDevelopment())
36 | {
37 | app.UseDeveloperExceptionPage();
38 | }
39 | else
40 | {
41 | app.UseExceptionHandler("/Error");
42 | app.UseHsts();
43 | }
44 |
45 | app.UseHttpsRedirection();
46 | app.UseStaticFiles();
47 | app.UseSpaStaticFiles();
48 |
49 | app.UseMvc();
50 | app.UseSpa(spa =>
51 | {
52 | spa.Options.SourcePath = "ClientApp";
53 |
54 | if (env.IsDevelopment())
55 | {
56 | spa.UseAngularCliServer(npmScript: "start");
57 | }
58 | });
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/NginxRouter/nginx.conf:
--------------------------------------------------------------------------------
1 | worker_processes 1;
2 |
3 | events { worker_connections 1024; }
4 |
5 | http {
6 | error_log /etc/nginx/error_log.log warn;
7 |
8 | server {
9 | listen 80;
10 |
11 | location / {
12 | # Hack to retrive correct static files;
13 | if ($http_referer ~* (/create-project) ) {
14 | proxy_pass http://create-project:80;
15 | rewrite ^/create-project(.*)$ /$1 break;
16 | }
17 | if ($http_referer ~* (/approve) ) {
18 | proxy_pass http://approve:80;
19 | rewrite ^/approve(.*)$ /$1 break;
20 | }
21 | if ($http_referer ~* (/submit-timesheet) ) {
22 | proxy_pass http://submit-timesheet:80;
23 | rewrite ^/submit-timesheet(.*)$ /$1 break;
24 | }
25 | if ($http_referer ~* (/hourly-rate) ) {
26 | proxy_pass http://hourly-rate:80;
27 | rewrite ^/hourly-rate(.*)$ /$1 break;
28 | }
29 |
30 | root /var/www/;
31 | index index.html;
32 | }
33 |
34 | location /create-project {
35 | proxy_pass http://create-project:80;
36 | rewrite ^/create-project(.*)$ /$1 break;
37 | }
38 |
39 | location /approve {
40 | proxy_pass http://approve:80;
41 | rewrite ^/approve(.*)$ /$1 break;
42 | }
43 | location /api/timesheet/approve {
44 | proxy_pass http://approve:80;
45 | }
46 |
47 | location /submit-timesheet {
48 | proxy_pass http://submit-timesheet:80;
49 | rewrite ^/submit-timesheet(.*)$ /$1 break;
50 | }
51 |
52 | location /hourly-rate {
53 | proxy_pass http://hourly-rate:80;
54 | rewrite ^/hourly-rate(.*)$ /$1 break;
55 | }
56 | location /api/rate/setHourlyRate {
57 | proxy_pass http://hourly-rate:80;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/HourlyRate/src/ClientApp/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import uuid from 'react-uuid';
3 |
4 | export default class App extends Component {
5 | static displayName = App.name;
6 |
7 | constructor(props) {
8 | super(props);
9 | this.state = {
10 | userId: uuid(),
11 | hourlyRate: 40
12 | };
13 |
14 | this.updateHourlyRate = this.updateHourlyRate.bind(this);
15 | this.updateUserId = this.updateUserId.bind(this);
16 |
17 | this.handleSubmit = this.handleSubmit.bind(this);
18 | }
19 |
20 |
21 | handleSubmit(event) {
22 | event.preventDefault();
23 | console.log(JSON.stringify(this.state));
24 |
25 | fetch('api/rate/setHourlyRate', {
26 | method: 'POST',
27 | headers: {
28 | Accept: 'application/json',
29 | 'Content-Type': 'application/json',
30 | },
31 | body: JSON.stringify(this.state),
32 | });
33 | }
34 |
35 | setDefault() {
36 | this.setState({userId:uuid(), hourlyRate:40 });
37 | }
38 |
39 | updateUserId(event) {
40 | this.setState({userId: event.target.value});
41 | }
42 |
43 | updateHourlyRate(event) {
44 | this.setState({hourlyRate: event.target.value});
45 | }
46 |
47 | render () {
48 | return (
49 |
50 |
HourlyRate
51 |
60 |
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Approve/src/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using Approve.Services;
3 | using MediatR;
4 | using Microsoft.AspNetCore.Builder;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.Http;
7 | using Microsoft.AspNetCore.Internal;
8 | using Microsoft.AspNetCore.Mvc;
9 | using Microsoft.Extensions.Configuration;
10 | using Microsoft.Extensions.DependencyInjection;
11 |
12 | namespace Approve
13 | {
14 | public class Startup
15 | {
16 | public Startup(IConfiguration configuration)
17 | {
18 | Configuration = configuration;
19 | }
20 |
21 | public IConfiguration Configuration { get; }
22 |
23 | // This method gets called by the runtime. Use this method to add services to the container.
24 | public void ConfigureServices(IServiceCollection services)
25 | {
26 | services.Configure(options =>
27 | {
28 | // This lambda determines whether user consent for non-essential cookies is needed for a given request.
29 | options.CheckConsentNeeded = context => true;
30 | options.MinimumSameSitePolicy = SameSiteMode.None;
31 | });
32 |
33 | services.AddMediatR(Assembly.GetExecutingAssembly());
34 | services.AddTransient();
35 |
36 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
37 | }
38 |
39 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
40 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
41 | {
42 | if (env.IsDevelopment())
43 | {
44 | app.UseDeveloperExceptionPage();
45 | }
46 | else
47 | {
48 | app.UseExceptionHandler("/Error");
49 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
50 | app.UseHsts();
51 | }
52 |
53 | app.UseEndpointRouting();
54 | app.UseHttpsRedirection();
55 | app.UseStaticFiles();
56 | app.UseCookiePolicy();
57 |
58 | app.UseMvc();
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/TimeTrackingSystem.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Approve", "Approve\src\Approve.csproj", "{90A83C29-E133-4BD0-AB7C-DDAB6860EF3C}"
4 | EndProject
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubmitTimesheet", "SubmitTimesheet\src\SubmitTimesheet.csproj", "{32709AD8-DC9C-4D44-9620-58B02191D6BF}"
6 | EndProject
7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HourlyRate", "HourlyRate\src\HourlyRate.csproj", "{3598BDB8-60D1-43DE-BFB4-22EAFFB83E48}"
8 | EndProject
9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateProject", "CreateProject\src\CreateProject.csproj", "{70636761-43B9-462F-B315-DA51606F0F21}"
10 | EndProject
11 | Global
12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
13 | Debug|Any CPU = Debug|Any CPU
14 | Release|Any CPU = Release|Any CPU
15 | EndGlobalSection
16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
17 | {90A83C29-E133-4BD0-AB7C-DDAB6860EF3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18 | {90A83C29-E133-4BD0-AB7C-DDAB6860EF3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
19 | {90A83C29-E133-4BD0-AB7C-DDAB6860EF3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
20 | {90A83C29-E133-4BD0-AB7C-DDAB6860EF3C}.Release|Any CPU.Build.0 = Release|Any CPU
21 | {32709AD8-DC9C-4D44-9620-58B02191D6BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {32709AD8-DC9C-4D44-9620-58B02191D6BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {32709AD8-DC9C-4D44-9620-58B02191D6BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {32709AD8-DC9C-4D44-9620-58B02191D6BF}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {3598BDB8-60D1-43DE-BFB4-22EAFFB83E48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {3598BDB8-60D1-43DE-BFB4-22EAFFB83E48}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {3598BDB8-60D1-43DE-BFB4-22EAFFB83E48}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {3598BDB8-60D1-43DE-BFB4-22EAFFB83E48}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {70636761-43B9-462F-B315-DA51606F0F21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {70636761-43B9-462F-B315-DA51606F0F21}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {70636761-43B9-462F-B315-DA51606F0F21}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {70636761-43B9-462F-B315-DA51606F0F21}.Release|Any CPU.Build.0 = Release|Any CPU
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/HourlyRate/src/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using HourlyRate.Services;
3 | using MediatR;
4 | using Microsoft.AspNetCore.Builder;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.HttpsPolicy;
7 | using Microsoft.AspNetCore.Mvc;
8 | using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer;
9 | using Microsoft.Extensions.Configuration;
10 | using Microsoft.Extensions.DependencyInjection;
11 |
12 | namespace HourlyRate
13 | {
14 | public class Startup
15 | {
16 | public Startup(IConfiguration configuration)
17 | {
18 | Configuration = configuration;
19 | }
20 |
21 | public IConfiguration Configuration { get; }
22 |
23 | // This method gets called by the runtime. Use this method to add services to the container.
24 | public void ConfigureServices(IServiceCollection services)
25 | {
26 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
27 |
28 | // In production, the React files will be served from this directory
29 | services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/build"; });
30 |
31 | services.AddMediatR(Assembly.GetExecutingAssembly());
32 | services.AddTransient();
33 | }
34 |
35 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
36 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
37 | {
38 | if (env.IsDevelopment())
39 | {
40 | app.UseDeveloperExceptionPage();
41 | }
42 | else
43 | {
44 | app.UseExceptionHandler("/Error");
45 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
46 | app.UseHsts();
47 | }
48 |
49 | app.UseHttpsRedirection();
50 | app.UseStaticFiles();
51 | app.UseSpaStaticFiles();
52 |
53 | app.UseMvc(routes =>
54 | {
55 | routes.MapRoute(
56 | name: "default",
57 | template: "{controller}/{action=Index}/{id?}");
58 | });
59 |
60 | app.UseSpa(spa =>
61 | {
62 | spa.Options.SourcePath = "ClientApp";
63 |
64 | if (env.IsDevelopment())
65 | {
66 | spa.UseReactDevelopmentServer(npmScript: "start");
67 | }
68 | });
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/CreateProject/src/Startup.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using CreateProject.Services;
3 | using MediatR;
4 | using Microsoft.AspNetCore.Builder;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.Mvc;
7 | using Microsoft.AspNetCore.SpaServices.AngularCli;
8 | using Microsoft.Extensions.Configuration;
9 | using Microsoft.Extensions.DependencyInjection;
10 |
11 | namespace CreateProject
12 | {
13 | public class Startup
14 | {
15 | public Startup(IConfiguration configuration)
16 | {
17 | Configuration = configuration;
18 | }
19 |
20 | public IConfiguration Configuration { get; }
21 |
22 | // This method gets called by the runtime. Use this method to add services to the container.
23 | public void ConfigureServices(IServiceCollection services)
24 | {
25 | services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
26 |
27 | // In production, the Angular files will be served from this directory
28 | services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; });
29 |
30 | services.AddMediatR(Assembly.GetExecutingAssembly());
31 | services.AddTransient();
32 | }
33 |
34 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
35 | public void Configure(IApplicationBuilder app, IHostingEnvironment env)
36 | {
37 | if (env.IsDevelopment())
38 | {
39 | app.UseDeveloperExceptionPage();
40 | }
41 | else
42 | {
43 | app.UseExceptionHandler("/Error");
44 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
45 | app.UseHsts();
46 | }
47 |
48 | app.UseHttpsRedirection();
49 | app.UseStaticFiles();
50 | app.UseSpaStaticFiles();
51 |
52 | app.UseMvc(routes =>
53 | {
54 | routes.MapRoute(
55 | name: "default",
56 | template: "{controller}/{action=Index}/{id?}");
57 | });
58 |
59 | app.UseSpa(spa =>
60 | {
61 | // To learn more about options for serving an Angular SPA from ASP.NET Core,
62 | // see https://go.microsoft.com/fwlink/?linkid=864501
63 |
64 | spa.Options.SourcePath = "ClientApp";
65 |
66 | if (env.IsDevelopment())
67 | {
68 | spa.UseAngularCliServer(npmScript: "start");
69 | }
70 | });
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/HourlyRate/src/HourlyRate.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.2
5 | true
6 | Latest
7 | false
8 | ClientApp\
9 | $(DefaultItemExcludes);$(SpaRoot)node_modules\**
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | %(DistFiles.Identity)
45 | PreserveNewest
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Approve/.gitignore:
--------------------------------------------------------------------------------
1 | #REATed by https://www.gitignore.io/api/eclipse,netbeans,java,maven,gradle,intellij
2 |
3 | ### Eclipse ###
4 | *.pydevproject
5 | .metadata
6 | .gradle
7 | bin/
8 | tmp/
9 | *.tmp
10 | *.bak
11 | *.swp
12 | *~.nib
13 | local.properties
14 | .settings/
15 | .loadpath
16 |
17 | # Eclipse Core
18 | .project
19 |
20 | # External tool builders
21 | .externalToolBuilders/
22 |
23 | # Locally stored "Eclipse launch configurations"
24 | *.launch
25 |
26 | # CDT-specific
27 | .cproject
28 |
29 | # JDT-specific (Eclipse Java Development Tools)
30 | .classpath
31 |
32 | # Java annotation processor (APT)
33 | .factorypath
34 |
35 | # PDT-specific
36 | .buildpath
37 |
38 | # sbteclipse plugin
39 | .target
40 |
41 | # TeXlipse plugin
42 | .texlipse
43 |
44 |
45 | ### NetBeans ###
46 | nbproject/private/
47 | build/
48 | nbbuild/
49 | dist/
50 | nbdist/
51 | nbactions.xml
52 | nb-configuration.xml
53 | .nb-gradle/
54 |
55 |
56 | ### Java ###
57 | *.class
58 |
59 | # Mobile Tools for Java (J2ME)
60 | .mtj.tmp/
61 |
62 | # Package Files #
63 | *.jar
64 | *.war
65 | *.ear
66 |
67 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
68 | hs_err_pid*
69 |
70 |
71 | ### Maven ###
72 | target/
73 | pom.xml.tag
74 | pom.xml.releaseBackup
75 | pom.xml.versionsBackup
76 | pom.xml.next
77 | release.properties
78 | dependency-reduced-pom.xml
79 | buildNumber.properties
80 | .mvn/timing.properties
81 |
82 |
83 | ### Gradle ###
84 | .gradle
85 | build/
86 |
87 | # Ignore Gradle GUI config
88 | gradle-app.setting
89 |
90 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
91 | !gradle-wrapper.jar
92 |
93 |
94 | ### Intellij ###
95 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
96 |
97 | *.iml
98 |
99 | ## Directory-based project format:
100 | .idea/
101 | # if you remove the above rule, at least ignore the following:
102 |
103 | # User-specific stuff:
104 | # .idea/workspace.xml
105 | # .idea/tasks.xml
106 | # .idea/dictionaries
107 |
108 | # Sensitive or high-churn files:
109 | # .idea/dataSources.ids
110 | # .idea/dataSources.xml
111 | # .idea/sqlDataSources.xml
112 | # .idea/dynamic.xml
113 | # .idea/uiDesigner.xml
114 |
115 | # Gradle:
116 | # .idea/gradle.xml
117 | # .idea/libraries
118 |
119 | # Mongo Explorer plugin:
120 | # .idea/mongoSettings.xml
121 |
122 | ## File-based project format:
123 | *.ipr
124 | *.iws
125 |
126 | ## Plugin-specific files:
127 |
128 | # IntelliJ
129 | /out/
130 |
131 | # mpeltonen/sbt-idea plugin
132 | .idea_modules/
133 |
134 | # JIRA plugin
135 | atlassian-ide-plugin.xml
136 |
137 | # Crashlytics plugin (for Android Studio and IntelliJ)
138 | com_crashlytics_export_strings.xml
139 | crashlytics.properties
140 | crashlytics-build.properties
141 |
142 |
--------------------------------------------------------------------------------
/HourlyRate/src/node_modules/react-uuid/README.md:
--------------------------------------------------------------------------------
1 | # React Uuid
2 |
3 | A UUID (Universal Unique Identifier) is a 128-bit number used to uniquely identify some object or entity on the Internet. Depending on the specific mechanisms used, a UUID is either guaranteed to be different or is, at least, extremely likely to be different from any other UUID generated until 3400 A.D.
4 | In its authoritative textual representation, the 16 octets of a UUID are represented as 32 hexadecimal (base-16) digits, displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and 4 hyphens).
5 |
6 | React's power lies in its robust reconciliation process. When we use JSX to create or update components, React creates its own virtual DOM. It compares this virtual DOM to the actual DOM in the browser, calculating the least number of changes necessary to update the actual DOM to match the virtual DOM.
7 | Sometimes we use multiple instances of the same component in the same spot. Such as the multiple instances of a 'TodoItem' component inside a 'TodoList' component. When this occurs, unique keys are very important, because they allow React to differentiate between these similar components, and hone in on any that may need to be updated individually, instead of re-rendering them all.
8 |
9 | ## Getting Started
10 |
11 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
12 |
13 | ### Prerequisites
14 |
15 | A React (or any Javascript framework) project that requires components to be marked with a uuid, to enable the framework to mutate the correct component.
16 |
17 | ### Installing
18 |
19 | From the command line (in the root of your project), simply type:
20 |
21 | ```
22 | npm i react-uuid
23 | ```
24 |
25 | And then can be used inside the project like:
26 |
27 | ```
28 | import React from 'react'
29 | import uuid from 'react-uuid'
30 |
31 | const array = ['one', 'two', 'three']
32 |
33 | export const LineItem = item => {item}
34 |
35 | export const List = () => array.map(item => )
36 | ```
37 |
38 | In the above example, the output would be 3 ```LineItem``` components being rendered, with each ```LineItem``` supplied a universal unique identifier, which when required, will allow React to identify which ```LineItem``` component should be mutated.
39 |
40 | ## Built With
41 |
42 | - [Javacript](javascript) - JavaScript (JS) is a lightweight interpreted or just-in-time compiled programming language with first-class functions.
43 |
44 | ## Contributing
45 |
46 | Please read [CONTRIBUTING.md](https://gist.github.com/RickBr0wn/e9cc0f06cbd452186bcf245c072e4137) for details on our code of conduct, and the process for submitting pull requests to us.
47 |
48 | ## Authors
49 |
50 | - **Rick Brown** - _Initial work_ - [RickBr0wn](https://gist.github.com/RickBr0wn)
51 |
52 | See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
53 |
54 | ## License
55 |
56 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
57 |
--------------------------------------------------------------------------------
/CreateProject/src/CreateProject.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.2
5 | true
6 | Latest
7 | false
8 | ClientApp\
9 | $(DefaultItemExcludes);$(SpaRoot)node_modules\**
10 |
11 |
12 | false
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | %(DistFiles.Identity)
51 | PreserveNewest
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-shadowed-variable": true,
69 | "no-string-literal": false,
70 | "no-string-throw": true,
71 | "no-switch-case-fall-through": true,
72 | "no-trailing-whitespace": true,
73 | "no-unnecessary-initializer": true,
74 | "no-unused-expression": true,
75 | "no-use-before-declare": true,
76 | "no-var-keyword": true,
77 | "object-literal-sort-keys": false,
78 | "one-line": [
79 | true,
80 | "check-open-brace",
81 | "check-catch",
82 | "check-else",
83 | "check-whitespace"
84 | ],
85 | "prefer-const": true,
86 | "quotemark": [
87 | true,
88 | "single"
89 | ],
90 | "radix": true,
91 | "semicolon": [
92 | true,
93 | "always"
94 | ],
95 | "triple-equals": [
96 | true,
97 | "allow-null-check"
98 | ],
99 | "typedef-whitespace": [
100 | true,
101 | {
102 | "call-signature": "nospace",
103 | "index-signature": "nospace",
104 | "parameter": "nospace",
105 | "property-declaration": "nospace",
106 | "variable-declaration": "nospace"
107 | }
108 | ],
109 | "unified-signatures": true,
110 | "variable-name": false,
111 | "whitespace": [
112 | true,
113 | "check-branch",
114 | "check-decl",
115 | "check-operator",
116 | "check-separator",
117 | "check-type"
118 | ],
119 | "no-output-on-prefix": true,
120 | "use-input-property-decorator": true,
121 | "use-output-property-decorator": true,
122 | "use-host-property-decorator": true,
123 | "no-input-rename": true,
124 | "no-output-rename": true,
125 | "use-life-cycle-interface": true,
126 | "use-pipe-transform-interface": true,
127 | "component-class-suffix": true,
128 | "directive-class-suffix": true
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rulesDirectory": [
3 | "node_modules/codelyzer"
4 | ],
5 | "rules": {
6 | "arrow-return-shorthand": true,
7 | "callable-types": true,
8 | "class-name": true,
9 | "comment-format": [
10 | true,
11 | "check-space"
12 | ],
13 | "curly": true,
14 | "deprecation": {
15 | "severity": "warn"
16 | },
17 | "eofline": true,
18 | "forin": true,
19 | "import-blacklist": [
20 | true,
21 | "rxjs/Rx"
22 | ],
23 | "import-spacing": true,
24 | "indent": [
25 | true,
26 | "spaces"
27 | ],
28 | "interface-over-type-literal": true,
29 | "label-position": true,
30 | "max-line-length": [
31 | true,
32 | 140
33 | ],
34 | "member-access": false,
35 | "member-ordering": [
36 | true,
37 | {
38 | "order": [
39 | "static-field",
40 | "instance-field",
41 | "static-method",
42 | "instance-method"
43 | ]
44 | }
45 | ],
46 | "no-arg": true,
47 | "no-bitwise": true,
48 | "no-console": [
49 | true,
50 | "debug",
51 | "info",
52 | "time",
53 | "timeEnd",
54 | "trace"
55 | ],
56 | "no-construct": true,
57 | "no-debugger": true,
58 | "no-duplicate-super": true,
59 | "no-empty": false,
60 | "no-empty-interface": true,
61 | "no-eval": true,
62 | "no-inferrable-types": [
63 | true,
64 | "ignore-params"
65 | ],
66 | "no-misused-new": true,
67 | "no-non-null-assertion": true,
68 | "no-shadowed-variable": true,
69 | "no-string-literal": false,
70 | "no-string-throw": true,
71 | "no-switch-case-fall-through": true,
72 | "no-trailing-whitespace": true,
73 | "no-unnecessary-initializer": true,
74 | "no-unused-expression": true,
75 | "no-use-before-declare": true,
76 | "no-var-keyword": true,
77 | "object-literal-sort-keys": false,
78 | "one-line": [
79 | true,
80 | "check-open-brace",
81 | "check-catch",
82 | "check-else",
83 | "check-whitespace"
84 | ],
85 | "prefer-const": true,
86 | "quotemark": [
87 | true,
88 | "single"
89 | ],
90 | "radix": true,
91 | "semicolon": [
92 | true,
93 | "always"
94 | ],
95 | "triple-equals": [
96 | true,
97 | "allow-null-check"
98 | ],
99 | "typedef-whitespace": [
100 | true,
101 | {
102 | "call-signature": "nospace",
103 | "index-signature": "nospace",
104 | "parameter": "nospace",
105 | "property-declaration": "nospace",
106 | "variable-declaration": "nospace"
107 | }
108 | ],
109 | "unified-signatures": true,
110 | "variable-name": false,
111 | "whitespace": [
112 | true,
113 | "check-branch",
114 | "check-decl",
115 | "check-operator",
116 | "check-separator",
117 | "check-type"
118 | ],
119 | "no-output-on-prefix": true,
120 | "use-input-property-decorator": true,
121 | "use-output-property-decorator": true,
122 | "use-host-property-decorator": true,
123 | "no-input-rename": true,
124 | "no-output-rename": true,
125 | "use-life-cycle-interface": true,
126 | "use-pipe-transform-interface": true,
127 | "component-class-suffix": true,
128 | "directive-class-suffix": true
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** IE10 and IE11 requires the following for the Reflect API. */
41 | // import 'core-js/es6/reflect';
42 |
43 |
44 | /** Evergreen browsers require these. **/
45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46 | import 'core-js/es7/reflect';
47 |
48 |
49 | /**
50 | * Web Animations `@angular/platform-browser/animations`
51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
53 | **/
54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
55 |
56 | /**
57 | * By default, zone.js will patch all possible macroTask and DomEvents
58 | * user can disable parts of macroTask/DomEvents patch by setting following flags
59 | */
60 |
61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
64 |
65 | /*
66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
68 | */
69 | // (window as any).__Zone_enable_cross_context_check = true;
70 |
71 | /***************************************************************************************************
72 | * Zone JS is required by default for Angular itself.
73 | */
74 | import 'zone.js/dist/zone'; // Included with Angular CLI.
75 |
76 |
77 |
78 | /***************************************************************************************************
79 | * APPLICATION IMPORTS
80 | */
81 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/src/polyfills.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * This file includes polyfills needed by Angular and is loaded before the app.
3 | * You can add your own extra polyfills to this file.
4 | *
5 | * This file is divided into 2 sections:
6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8 | * file.
9 | *
10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13 | *
14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
15 | */
16 |
17 | /***************************************************************************************************
18 | * BROWSER POLYFILLS
19 | */
20 |
21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/
22 | // import 'core-js/es6/symbol';
23 | // import 'core-js/es6/object';
24 | // import 'core-js/es6/function';
25 | // import 'core-js/es6/parse-int';
26 | // import 'core-js/es6/parse-float';
27 | // import 'core-js/es6/number';
28 | // import 'core-js/es6/math';
29 | // import 'core-js/es6/string';
30 | // import 'core-js/es6/date';
31 | // import 'core-js/es6/array';
32 | // import 'core-js/es6/regexp';
33 | // import 'core-js/es6/map';
34 | // import 'core-js/es6/weak-map';
35 | // import 'core-js/es6/set';
36 |
37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */
38 | // import 'classlist.js'; // Run `npm install --save classlist.js`.
39 |
40 | /** IE10 and IE11 requires the following for the Reflect API. */
41 | // import 'core-js/es6/reflect';
42 |
43 |
44 | /** Evergreen browsers require these. **/
45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
46 | import 'core-js/es7/reflect';
47 |
48 |
49 | /**
50 | * Web Animations `@angular/platform-browser/animations`
51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
53 | **/
54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
55 |
56 | /**
57 | * By default, zone.js will patch all possible macroTask and DomEvents
58 | * user can disable parts of macroTask/DomEvents patch by setting following flags
59 | */
60 |
61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
64 |
65 | /*
66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge
68 | */
69 | // (window as any).__Zone_enable_cross_context_check = true;
70 |
71 | /***************************************************************************************************
72 | * Zone JS is required by default for Angular itself.
73 | */
74 | import 'zone.js/dist/zone'; // Included with Angular CLI.
75 |
76 |
77 |
78 | /***************************************************************************************************
79 | * APPLICATION IMPORTS
80 | */
81 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/SubmitTimesheet.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.2
5 | true
6 | Latest
7 | false
8 | ClientApp\
9 | $(DefaultItemExcludes);$(SpaRoot)node_modules\**
10 |
11 |
12 | false
13 |
14 |
15 |
16 | ..\bin\Debug\
17 |
18 |
19 |
20 | ..\bin\Release\
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | <_ContentIncludedByDefault Remove="wwwroot\favicon.ico" />
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | %(DistFiles.Identity)
64 | PreserveNewest
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Approve/src/Pages/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewData["Title"] - Approve
7 |
8 |
9 |
10 |
11 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
Approve
25 |
27 |
28 |
29 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | @RenderBody()
46 |
47 |
48 |
49 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
66 |
72 |
73 |
74 |
75 | @RenderSection("Scripts", required: false)
76 |
77 |
78 |
--------------------------------------------------------------------------------
/HourlyRate/src/ClientApp/src/registerServiceWorker.js:
--------------------------------------------------------------------------------
1 | // In production, we register a service worker to serve assets from local cache.
2 |
3 | // This lets the app load faster on subsequent visits in production, and gives
4 | // it offline capabilities. However, it also means that developers (and users)
5 | // will only see deployed updates on the "N+1" visit to a page, since previously
6 | // cached resources are updated in the background.
7 |
8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
9 | // This link also includes instructions on opting out of this behavior.
10 |
11 | const isLocalhost = Boolean(
12 | window.location.hostname === 'localhost' ||
13 | // [::1] is the IPv6 localhost address.
14 | window.location.hostname === '[::1]' ||
15 | // 127.0.0.1/8 is considered localhost for IPv4.
16 | window.location.hostname.match(
17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
18 | )
19 | );
20 |
21 | export default function register () {
22 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
23 | // The URL constructor is available in all browsers that support SW.
24 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
25 | if (publicUrl.origin !== window.location.origin) {
26 | // Our service worker won't work if PUBLIC_URL is on a different origin
27 | // from what our page is served on. This might happen if a CDN is used to
28 | // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374
29 | return;
30 | }
31 |
32 | window.addEventListener('load', () => {
33 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
34 |
35 | if (isLocalhost) {
36 | // This is running on localhost. Lets check if a service worker still exists or not.
37 | checkValidServiceWorker(swUrl);
38 | } else {
39 | // Is not local host. Just register service worker
40 | registerValidSW(swUrl);
41 | }
42 | });
43 | }
44 | }
45 |
46 | function registerValidSW (swUrl) {
47 | navigator.serviceWorker
48 | .register(swUrl)
49 | .then(registration => {
50 | registration.onupdatefound = () => {
51 | const installingWorker = registration.installing;
52 | installingWorker.onstatechange = () => {
53 | if (installingWorker.state === 'installed') {
54 | if (navigator.serviceWorker.controller) {
55 | // At this point, the old content will have been purged and
56 | // the fresh content will have been added to the cache.
57 | // It's the perfect time to display a "New content is
58 | // available; please refresh." message in your web app.
59 | console.log('New content is available; please refresh.');
60 | } else {
61 | // At this point, everything has been precached.
62 | // It's the perfect time to display a
63 | // "Content is cached for offline use." message.
64 | console.log('Content is cached for offline use.');
65 | }
66 | }
67 | };
68 | };
69 | })
70 | .catch(error => {
71 | console.error('Error during service worker registration:', error);
72 | });
73 | }
74 |
75 | function checkValidServiceWorker (swUrl) {
76 | // Check if the service worker can be found. If it can't reload the page.
77 | fetch(swUrl)
78 | .then(response => {
79 | // Ensure service worker exists, and that we really are getting a JS file.
80 | if (
81 | response.status === 404 ||
82 | response.headers.get('content-type').indexOf('javascript') === -1
83 | ) {
84 | // No service worker found. Probably a different app. Reload the page.
85 | navigator.serviceWorker.ready.then(registration => {
86 | registration.unregister().then(() => {
87 | window.location.reload();
88 | });
89 | });
90 | } else {
91 | // Service worker found. Proceed as normal.
92 | registerValidSW(swUrl);
93 | }
94 | })
95 | .catch(() => {
96 | console.log(
97 | 'No internet connection found. App is running in offline mode.'
98 | );
99 | });
100 | }
101 |
102 | export function unregister () {
103 | if ('serviceWorker' in navigator) {
104 | navigator.serviceWorker.ready.then(registration => {
105 | registration.unregister();
106 | });
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/CreateProject/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | bin/
23 | Bin/
24 | obj/
25 | Obj/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | *_i.c
44 | *_p.c
45 | *_i.h
46 | *.ilk
47 | *.meta
48 | *.obj
49 | *.pch
50 | *.pdb
51 | *.pgc
52 | *.pgd
53 | *.rsp
54 | *.sbr
55 | *.tlb
56 | *.tli
57 | *.tlh
58 | *.tmp
59 | *.tmp_proj
60 | *.log
61 | *.vspscc
62 | *.vssscc
63 | .builds
64 | *.pidb
65 | *.svclog
66 | *.scc
67 |
68 | # Chutzpah Test files
69 | _Chutzpah*
70 |
71 | # Visual C++ cache files
72 | ipch/
73 | *.aps
74 | *.ncb
75 | *.opendb
76 | *.opensdf
77 | *.sdf
78 | *.cachefile
79 |
80 | # Visual Studio profiler
81 | *.psess
82 | *.vsp
83 | *.vspx
84 | *.sap
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 | nCrunchTemp_*
110 |
111 | # MightyMoose
112 | *.mm.*
113 | AutoTest.Net/
114 |
115 | # Web workbench (sass)
116 | .sass-cache/
117 |
118 | # Installshield output folder
119 | [Ee]xpress/
120 |
121 | # DocProject is a documentation generator add-in
122 | DocProject/buildhelp/
123 | DocProject/Help/*.HxT
124 | DocProject/Help/*.HxC
125 | DocProject/Help/*.hhc
126 | DocProject/Help/*.hhk
127 | DocProject/Help/*.hhp
128 | DocProject/Help/Html2
129 | DocProject/Help/html
130 |
131 | # Click-Once directory
132 | publish/
133 |
134 | # Publish Web Output
135 | *.[Pp]ublish.xml
136 | *.azurePubxml
137 | # TODO: Comment the next line if you want to checkin your web deploy settings
138 | # but database connection strings (with potential passwords) will be unencrypted
139 | *.pubxml
140 | *.publishproj
141 |
142 | # NuGet Packages
143 | *.nupkg
144 | # The packages folder can be ignored because of Package Restore
145 | **/packages/*
146 | # except build/, which is used as an MSBuild target.
147 | !**/packages/build/
148 | # Uncomment if necessary however generally it will be regenerated when needed
149 | #!**/packages/repositories.config
150 |
151 | # Microsoft Azure Build Output
152 | csx/
153 | *.build.csdef
154 |
155 | # Microsoft Azure Emulator
156 | ecf/
157 | rcf/
158 |
159 | # Microsoft Azure ApplicationInsights config file
160 | ApplicationInsights.config
161 |
162 | # Windows Store app package directory
163 | AppPackages/
164 | BundleArtifacts/
165 |
166 | # Visual Studio cache files
167 | # files ending in .cache can be ignored
168 | *.[Cc]ache
169 | # but keep track of directories ending in .cache
170 | !*.[Cc]ache/
171 |
172 | # Others
173 | ClientBin/
174 | ~$*
175 | *~
176 | *.dbmdl
177 | *.dbproj.schemaview
178 | *.pfx
179 | *.publishsettings
180 | orleans.codegen.cs
181 |
182 | /node_modules
183 |
184 | # RIA/Silverlight projects
185 | Generated_Code/
186 |
187 | # Backup & report files from converting an old project file
188 | # to a newer Visual Studio version. Backup files are not needed,
189 | # because we have git ;-)
190 | _UpgradeReport_Files/
191 | Backup*/
192 | UpgradeLog*.XML
193 | UpgradeLog*.htm
194 |
195 | # SQL Server files
196 | *.mdf
197 | *.ldf
198 |
199 | # Business Intelligence projects
200 | *.rdl.data
201 | *.bim.layout
202 | *.bim_*.settings
203 |
204 | # Microsoft Fakes
205 | FakesAssemblies/
206 |
207 | # GhostDoc plugin setting file
208 | *.GhostDoc.xml
209 |
210 | # Node.js Tools for Visual Studio
211 | .ntvs_analysis.dat
212 |
213 | # Visual Studio 6 build log
214 | *.plg
215 |
216 | # Visual Studio 6 workspace options file
217 | *.opt
218 |
219 | # Visual Studio LightSwitch build output
220 | **/*.HTMLClient/GeneratedArtifacts
221 | **/*.DesktopClient/GeneratedArtifacts
222 | **/*.DesktopClient/ModelManifest.xml
223 | **/*.Server/GeneratedArtifacts
224 | **/*.Server/ModelManifest.xml
225 | _Pvt_Extensions
226 |
227 | # Paket dependency manager
228 | .paket/paket.exe
229 |
230 | # FAKE - F# Make
231 | .fake/
232 |
--------------------------------------------------------------------------------
/SubmitTimesheet/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | bin/
23 | Bin/
24 | obj/
25 | Obj/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | *_i.c
44 | *_p.c
45 | *_i.h
46 | *.ilk
47 | *.meta
48 | *.obj
49 | *.pch
50 | *.pdb
51 | *.pgc
52 | *.pgd
53 | *.rsp
54 | *.sbr
55 | *.tlb
56 | *.tli
57 | *.tlh
58 | *.tmp
59 | *.tmp_proj
60 | *.log
61 | *.vspscc
62 | *.vssscc
63 | .builds
64 | *.pidb
65 | *.svclog
66 | *.scc
67 |
68 | # Chutzpah Test files
69 | _Chutzpah*
70 |
71 | # Visual C++ cache files
72 | ipch/
73 | *.aps
74 | *.ncb
75 | *.opendb
76 | *.opensdf
77 | *.sdf
78 | *.cachefile
79 |
80 | # Visual Studio profiler
81 | *.psess
82 | *.vsp
83 | *.vspx
84 | *.sap
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 | nCrunchTemp_*
110 |
111 | # MightyMoose
112 | *.mm.*
113 | AutoTest.Net/
114 |
115 | # Web workbench (sass)
116 | .sass-cache/
117 |
118 | # Installshield output folder
119 | [Ee]xpress/
120 |
121 | # DocProject is a documentation generator add-in
122 | DocProject/buildhelp/
123 | DocProject/Help/*.HxT
124 | DocProject/Help/*.HxC
125 | DocProject/Help/*.hhc
126 | DocProject/Help/*.hhk
127 | DocProject/Help/*.hhp
128 | DocProject/Help/Html2
129 | DocProject/Help/html
130 |
131 | # Click-Once directory
132 | publish/
133 |
134 | # Publish Web Output
135 | *.[Pp]ublish.xml
136 | *.azurePubxml
137 | # TODO: Comment the next line if you want to checkin your web deploy settings
138 | # but database connection strings (with potential passwords) will be unencrypted
139 | *.pubxml
140 | *.publishproj
141 |
142 | # NuGet Packages
143 | *.nupkg
144 | # The packages folder can be ignored because of Package Restore
145 | **/packages/*
146 | # except build/, which is used as an MSBuild target.
147 | !**/packages/build/
148 | # Uncomment if necessary however generally it will be regenerated when needed
149 | #!**/packages/repositories.config
150 |
151 | # Microsoft Azure Build Output
152 | csx/
153 | *.build.csdef
154 |
155 | # Microsoft Azure Emulator
156 | ecf/
157 | rcf/
158 |
159 | # Microsoft Azure ApplicationInsights config file
160 | ApplicationInsights.config
161 |
162 | # Windows Store app package directory
163 | AppPackages/
164 | BundleArtifacts/
165 |
166 | # Visual Studio cache files
167 | # files ending in .cache can be ignored
168 | *.[Cc]ache
169 | # but keep track of directories ending in .cache
170 | !*.[Cc]ache/
171 |
172 | # Others
173 | ClientBin/
174 | ~$*
175 | *~
176 | *.dbmdl
177 | *.dbproj.schemaview
178 | *.pfx
179 | *.publishsettings
180 | orleans.codegen.cs
181 |
182 | /node_modules
183 |
184 | # RIA/Silverlight projects
185 | Generated_Code/
186 |
187 | # Backup & report files from converting an old project file
188 | # to a newer Visual Studio version. Backup files are not needed,
189 | # because we have git ;-)
190 | _UpgradeReport_Files/
191 | Backup*/
192 | UpgradeLog*.XML
193 | UpgradeLog*.htm
194 |
195 | # SQL Server files
196 | *.mdf
197 | *.ldf
198 |
199 | # Business Intelligence projects
200 | *.rdl.data
201 | *.bim.layout
202 | *.bim_*.settings
203 |
204 | # Microsoft Fakes
205 | FakesAssemblies/
206 |
207 | # GhostDoc plugin setting file
208 | *.GhostDoc.xml
209 |
210 | # Node.js Tools for Visual Studio
211 | .ntvs_analysis.dat
212 |
213 | # Visual Studio 6 build log
214 | *.plg
215 |
216 | # Visual Studio 6 workspace options file
217 | *.opt
218 |
219 | # Visual Studio LightSwitch build output
220 | **/*.HTMLClient/GeneratedArtifacts
221 | **/*.DesktopClient/GeneratedArtifacts
222 | **/*.DesktopClient/ModelManifest.xml
223 | **/*.Server/GeneratedArtifacts
224 | **/*.Server/ModelManifest.xml
225 | _Pvt_Extensions
226 |
227 | # Paket dependency manager
228 | .paket/paket.exe
229 |
230 | # FAKE - F# Make
231 | .fake/
232 |
--------------------------------------------------------------------------------
/HourlyRate/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | bin/
23 | Bin/
24 | obj/
25 | Obj/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | /wwwroot/dist/
30 |
31 | # MSTest test Results
32 | [Tt]est[Rr]esult*/
33 | [Bb]uild[Ll]og.*
34 |
35 | # NUNIT
36 | *.VisualState.xml
37 | TestResult.xml
38 |
39 | # Build Results of an ATL Project
40 | [Dd]ebugPS/
41 | [Rr]eleasePS/
42 | dlldata.c
43 |
44 | *_i.c
45 | *_p.c
46 | *_i.h
47 | *.ilk
48 | *.meta
49 | *.obj
50 | *.pch
51 | *.pdb
52 | *.pgc
53 | *.pgd
54 | *.rsp
55 | *.sbr
56 | *.tlb
57 | *.tli
58 | *.tlh
59 | *.tmp
60 | *.tmp_proj
61 | *.log
62 | *.vspscc
63 | *.vssscc
64 | .builds
65 | *.pidb
66 | *.svclog
67 | *.scc
68 |
69 | # Chutzpah Test files
70 | _Chutzpah*
71 |
72 | # Visual C++ cache files
73 | ipch/
74 | *.aps
75 | *.ncb
76 | *.opendb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 | *.sap
86 |
87 | # TFS 2012 Local Workspace
88 | $tf/
89 |
90 | # Guidance Automation Toolkit
91 | *.gpState
92 |
93 | # ReSharper is a .NET coding add-in
94 | _ReSharper*/
95 | *.[Rr]e[Ss]harper
96 | *.DotSettings.user
97 |
98 | # JustCode is a .NET coding add-in
99 | .JustCode
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | _NCrunch_*
109 | .*crunch*.local.xml
110 | nCrunchTemp_*
111 |
112 | # MightyMoose
113 | *.mm.*
114 | AutoTest.Net/
115 |
116 | # Web workbench (sass)
117 | .sass-cache/
118 |
119 | # Installshield output folder
120 | [Ee]xpress/
121 |
122 | # DocProject is a documentation generator add-in
123 | DocProject/buildhelp/
124 | DocProject/Help/*.HxT
125 | DocProject/Help/*.HxC
126 | DocProject/Help/*.hhc
127 | DocProject/Help/*.hhk
128 | DocProject/Help/*.hhp
129 | DocProject/Help/Html2
130 | DocProject/Help/html
131 |
132 | # Click-Once directory
133 | publish/
134 |
135 | # Publish Web Output
136 | *.[Pp]ublish.xml
137 | *.azurePubxml
138 | # TODO: Comment the next line if you want to checkin your web deploy settings
139 | # but database connection strings (with potential passwords) will be unencrypted
140 | *.pubxml
141 | *.publishproj
142 |
143 | # NuGet Packages
144 | *.nupkg
145 | # The packages folder can be ignored because of Package Restore
146 | **/packages/*
147 | # except build/, which is used as an MSBuild target.
148 | !**/packages/build/
149 | # Uncomment if necessary however generally it will be regenerated when needed
150 | #!**/packages/repositories.config
151 |
152 | # Microsoft Azure Build Output
153 | csx/
154 | *.build.csdef
155 |
156 | # Microsoft Azure Emulator
157 | ecf/
158 | rcf/
159 |
160 | # Microsoft Azure ApplicationInsights config file
161 | ApplicationInsights.config
162 |
163 | # Windows Store app package directory
164 | AppPackages/
165 | BundleArtifacts/
166 |
167 | # Visual Studio cache files
168 | # files ending in .cache can be ignored
169 | *.[Cc]ache
170 | # but keep track of directories ending in .cache
171 | !*.[Cc]ache/
172 |
173 | # Others
174 | ClientBin/
175 | ~$*
176 | *~
177 | *.dbmdl
178 | *.dbproj.schemaview
179 | *.pfx
180 | *.publishsettings
181 | orleans.codegen.cs
182 |
183 | /node_modules
184 |
185 | # RIA/Silverlight projects
186 | Generated_Code/
187 |
188 | # Backup & report files from converting an old project file
189 | # to a newer Visual Studio version. Backup files are not needed,
190 | # because we have git ;-)
191 | _UpgradeReport_Files/
192 | Backup*/
193 | UpgradeLog*.XML
194 | UpgradeLog*.htm
195 |
196 | # SQL Server files
197 | *.mdf
198 | *.ldf
199 |
200 | # Business Intelligence projects
201 | *.rdl.data
202 | *.bim.layout
203 | *.bim_*.settings
204 |
205 | # Microsoft Fakes
206 | FakesAssemblies/
207 |
208 | # GhostDoc plugin setting file
209 | *.GhostDoc.xml
210 |
211 | # Node.js Tools for Visual Studio
212 | .ntvs_analysis.dat
213 |
214 | # Visual Studio 6 build log
215 | *.plg
216 |
217 | # Visual Studio 6 workspace options file
218 | *.opt
219 |
220 | # Visual Studio LightSwitch build output
221 | **/*.HTMLClient/GeneratedArtifacts
222 | **/*.DesktopClient/GeneratedArtifacts
223 | **/*.DesktopClient/ModelManifest.xml
224 | **/*.Server/GeneratedArtifacts
225 | **/*.Server/ModelManifest.xml
226 | _Pvt_Extensions
227 |
228 | # Paket dependency manager
229 | .paket/paket.exe
230 |
231 | # FAKE - F# Make
232 | .fake/
233 |
--------------------------------------------------------------------------------
/CreateProject/src/ClientApp/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "CreateProject": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {},
12 | "architect": {
13 | "build": {
14 | "builder": "@angular-devkit/build-angular:browser",
15 | "options": {
16 | "progress": true,
17 | "extractCss": true,
18 | "outputPath": "dist",
19 | "index": "src/index.html",
20 | "main": "src/main.ts",
21 | "polyfills": "src/polyfills.ts",
22 | "tsConfig": "src/tsconfig.app.json",
23 | "assets": [
24 | "src/assets"
25 | ],
26 | "styles": [
27 | "node_modules/bootstrap/dist/css/bootstrap.min.css",
28 | "src/styles.css"
29 | ],
30 | "scripts": []
31 | },
32 | "configurations": {
33 | "production": {
34 | "fileReplacements": [
35 | {
36 | "replace": "src/environments/environment.ts",
37 | "with": "src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "optimization": true,
41 | "outputHashing": "all",
42 | "sourceMap": false,
43 | "extractCss": true,
44 | "namedChunks": false,
45 | "aot": true,
46 | "extractLicenses": true,
47 | "vendorChunk": false,
48 | "buildOptimizer": true
49 | }
50 | }
51 | },
52 | "serve": {
53 | "builder": "@angular-devkit/build-angular:dev-server",
54 | "options": {
55 | "browserTarget": "CreateProject:build"
56 | },
57 | "configurations": {
58 | "production": {
59 | "browserTarget": "CreateProject:build:production"
60 | }
61 | }
62 | },
63 | "extract-i18n": {
64 | "builder": "@angular-devkit/build-angular:extract-i18n",
65 | "options": {
66 | "browserTarget": "CreateProject:build"
67 | }
68 | },
69 | "test": {
70 | "builder": "@angular-devkit/build-angular:karma",
71 | "options": {
72 | "main": "src/test.ts",
73 | "polyfills": "src/polyfills.ts",
74 | "tsConfig": "src/tsconfig.spec.json",
75 | "karmaConfig": "src/karma.conf.js",
76 | "styles": [
77 | "styles.css"
78 | ],
79 | "scripts": [],
80 | "assets": [
81 | "src/assets"
82 | ]
83 | }
84 | },
85 | "lint": {
86 | "builder": "@angular-devkit/build-angular:tslint",
87 | "options": {
88 | "tsConfig": [
89 | "src/tsconfig.app.json",
90 | "src/tsconfig.spec.json"
91 | ],
92 | "exclude": [
93 | "**/node_modules/**"
94 | ]
95 | }
96 | },
97 | "server": {
98 | "builder": "@angular-devkit/build-angular:server",
99 | "options": {
100 | "outputPath": "dist-server",
101 | "main": "src/main.ts",
102 | "tsConfig": "src/tsconfig.server.json"
103 | },
104 | "configurations": {
105 | "dev": {
106 | "optimization": true,
107 | "outputHashing": "all",
108 | "sourceMap": false,
109 | "namedChunks": false,
110 | "extractLicenses": true,
111 | "vendorChunk": true
112 | },
113 | "production": {
114 | "optimization": true,
115 | "outputHashing": "all",
116 | "sourceMap": false,
117 | "namedChunks": false,
118 | "extractLicenses": true,
119 | "vendorChunk": false
120 | }
121 | }
122 | }
123 | }
124 | },
125 | "CreateProject-e2e": {
126 | "root": "e2e/",
127 | "projectType": "application",
128 | "architect": {
129 | "e2e": {
130 | "builder": "@angular-devkit/build-angular:protractor",
131 | "options": {
132 | "protractorConfig": "e2e/protractor.conf.js",
133 | "devServerTarget": "CreateProject:serve"
134 | }
135 | },
136 | "lint": {
137 | "builder": "@angular-devkit/build-angular:tslint",
138 | "options": {
139 | "tsConfig": "e2e/tsconfig.e2e.json",
140 | "exclude": [
141 | "**/node_modules/**"
142 | ]
143 | }
144 | }
145 | }
146 | }
147 | },
148 | "defaultProject": "CreateProject"
149 | }
150 |
--------------------------------------------------------------------------------
/SubmitTimesheet/src/ClientApp/angular.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3 | "version": 1,
4 | "newProjectRoot": "projects",
5 | "projects": {
6 | "SubmitTimesheet": {
7 | "root": "",
8 | "sourceRoot": "src",
9 | "projectType": "application",
10 | "prefix": "app",
11 | "schematics": {},
12 | "architect": {
13 | "build": {
14 | "builder": "@angular-devkit/build-angular:browser",
15 | "options": {
16 | "progress": true,
17 | "extractCss": true,
18 | "outputPath": "dist",
19 | "index": "src/index.html",
20 | "main": "src/main.ts",
21 | "polyfills": "src/polyfills.ts",
22 | "tsConfig": "src/tsconfig.app.json",
23 | "assets": [
24 | "src/assets"
25 | ],
26 | "styles": [
27 | "node_modules/bootstrap/dist/css/bootstrap.min.css",
28 | "src/styles.css"
29 | ],
30 | "scripts": []
31 | },
32 | "configurations": {
33 | "production": {
34 | "fileReplacements": [
35 | {
36 | "replace": "src/environments/environment.ts",
37 | "with": "src/environments/environment.prod.ts"
38 | }
39 | ],
40 | "optimization": true,
41 | "outputHashing": "all",
42 | "sourceMap": false,
43 | "extractCss": true,
44 | "namedChunks": false,
45 | "aot": true,
46 | "extractLicenses": true,
47 | "vendorChunk": false,
48 | "buildOptimizer": true
49 | }
50 | }
51 | },
52 | "serve": {
53 | "builder": "@angular-devkit/build-angular:dev-server",
54 | "options": {
55 | "browserTarget": "SubmitTimesheet:build"
56 | },
57 | "configurations": {
58 | "production": {
59 | "browserTarget": "SubmitTimesheet:build:production"
60 | }
61 | }
62 | },
63 | "extract-i18n": {
64 | "builder": "@angular-devkit/build-angular:extract-i18n",
65 | "options": {
66 | "browserTarget": "SubmitTimesheet:build"
67 | }
68 | },
69 | "test": {
70 | "builder": "@angular-devkit/build-angular:karma",
71 | "options": {
72 | "main": "src/test.ts",
73 | "polyfills": "src/polyfills.ts",
74 | "tsConfig": "src/tsconfig.spec.json",
75 | "karmaConfig": "src/karma.conf.js",
76 | "styles": [
77 | "styles.css"
78 | ],
79 | "scripts": [],
80 | "assets": [
81 | "src/assets"
82 | ]
83 | }
84 | },
85 | "lint": {
86 | "builder": "@angular-devkit/build-angular:tslint",
87 | "options": {
88 | "tsConfig": [
89 | "src/tsconfig.app.json",
90 | "src/tsconfig.spec.json"
91 | ],
92 | "exclude": [
93 | "**/node_modules/**"
94 | ]
95 | }
96 | },
97 | "server": {
98 | "builder": "@angular-devkit/build-angular:server",
99 | "options": {
100 | "outputPath": "dist-server",
101 | "main": "src/main.ts",
102 | "tsConfig": "src/tsconfig.server.json"
103 | },
104 | "configurations": {
105 | "dev": {
106 | "optimization": true,
107 | "outputHashing": "all",
108 | "sourceMap": false,
109 | "namedChunks": false,
110 | "extractLicenses": true,
111 | "vendorChunk": true
112 | },
113 | "production": {
114 | "optimization": true,
115 | "outputHashing": "all",
116 | "sourceMap": false,
117 | "namedChunks": false,
118 | "extractLicenses": true,
119 | "vendorChunk": false
120 | }
121 | }
122 | }
123 | }
124 | },
125 | "SubmitTimesheet-e2e": {
126 | "root": "e2e/",
127 | "projectType": "application",
128 | "architect": {
129 | "e2e": {
130 | "builder": "@angular-devkit/build-angular:protractor",
131 | "options": {
132 | "protractorConfig": "e2e/protractor.conf.js",
133 | "devServerTarget": "SubmitTimesheet:serve"
134 | }
135 | },
136 | "lint": {
137 | "builder": "@angular-devkit/build-angular:tslint",
138 | "options": {
139 | "tsConfig": "e2e/tsconfig.e2e.json",
140 | "exclude": [
141 | "**/node_modules/**"
142 | ]
143 | }
144 | }
145 | }
146 | }
147 | },
148 | "defaultProject": "SubmitTimesheet"
149 | }
150 |
--------------------------------------------------------------------------------
/Approve/src/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js:
--------------------------------------------------------------------------------
1 | // Unobtrusive validation support library for jQuery and jQuery Validate
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | // @version v3.2.11
5 | !function(a){"function"==typeof define&&define.amd?define("jquery.validate.unobtrusive",["jquery-validation"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery-validation")):jQuery.validator.unobtrusive=a(jQuery)}(function(a){function e(a,e,n){a.rules[e]=n,a.message&&(a.messages[e]=a.message)}function n(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function t(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function r(a){return a.substr(0,a.lastIndexOf(".")+1)}function i(a,e){return 0===a.indexOf("*.")&&(a=a.replace("*.",e)),a}function o(e,n){var r=a(this).find("[data-valmsg-for='"+t(n[0].name)+"']"),i=r.attr("data-valmsg-replace"),o=i?a.parseJSON(i)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error"),e.data("unobtrusiveContainer",r),o?(r.empty(),e.removeClass("input-validation-error").appendTo(r)):e.hide()}function d(e,n){var t=a(this).find("[data-valmsg-summary=true]"),r=t.find("ul");r&&r.length&&n.errorList.length&&(r.empty(),t.addClass("validation-summary-errors").removeClass("validation-summary-valid"),a.each(n.errorList,function(){a(" ").html(this.message).appendTo(r)}))}function s(e){var n=e.data("unobtrusiveContainer");if(n){var t=n.attr("data-valmsg-replace"),r=t?a.parseJSON(t):null;n.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),r&&n.empty()}}function l(e){var n=a(this),t="__jquery_unobtrusive_validation_form_reset";if(!n.data(t)){n.data(t,!0);try{n.data("validator").resetForm()}finally{n.removeData(t)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function u(e){var n=a(e),t=n.data(v),r=a.proxy(l,e),i=f.unobtrusive.options||{},u=function(n,t){var r=i[n];r&&a.isFunction(r)&&r.apply(e,t)};return t||(t={options:{errorClass:i.errorClass||"input-validation-error",errorElement:i.errorElement||"span",errorPlacement:function(){o.apply(e,arguments),u("errorPlacement",arguments)},invalidHandler:function(){d.apply(e,arguments),u("invalidHandler",arguments)},messages:{},rules:{},success:function(){s.apply(e,arguments),u("success",arguments)}},attachValidation:function(){n.off("reset."+v,r).on("reset."+v,r).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(v,t)),t}var m,f=a.validator,v="unobtrusiveValidation";return f.unobtrusive={adapters:[],parseElement:function(e,n){var t,r,i,o=a(e),d=o.parents("form")[0];d&&(t=u(d),t.options.rules[e.name]=r={},t.options.messages[e.name]=i={},a.each(this.adapters,function(){var n="data-val-"+this.name,t=o.attr(n),s={};void 0!==t&&(n+="-",a.each(this.params,function(){s[this]=o.attr(n+this)}),this.adapt({element:e,form:d,message:t,params:s,rules:r,messages:i}))}),a.extend(r,{__dummy__:!0}),n||t.attachValidation())},parse:function(e){var n=a(e),t=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){f.unobtrusive.parseElement(this,!0)}),t.each(function(){var a=u(this);a&&a.attachValidation()})}},m=f.unobtrusive.adapters,m.add=function(a,e,n){return n||(n=e,e=[]),this.push({name:a,params:e,adapt:n}),this},m.addBool=function(a,n){return this.add(a,function(t){e(t,n||a,!0)})},m.addMinMax=function(a,n,t,r,i,o){return this.add(a,[i||"min",o||"max"],function(a){var i=a.params.min,o=a.params.max;i&&o?e(a,r,[i,o]):i?e(a,n,i):o&&e(a,t,o)})},m.addSingleVal=function(a,n,t){return this.add(a,[n||"val"],function(r){e(r,t||a,r.params[n])})},f.addMethod("__dummy__",function(a,e,n){return!0}),f.addMethod("regex",function(a,e,n){var t;return!!this.optional(e)||(t=new RegExp(n).exec(a),t&&0===t.index&&t[0].length===a.length)}),f.addMethod("nonalphamin",function(a,e,n){var t;return n&&(t=a.match(/\W/g),t=t&&t.length>=n),t}),f.methods.extension?(m.addSingleVal("accept","mimtype"),m.addSingleVal("extension","extension")):m.addSingleVal("extension","extension","accept"),m.addSingleVal("regex","pattern"),m.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),m.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),m.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),m.add("equalto",["other"],function(n){var o=r(n.element.name),d=n.params.other,s=i(d,o),l=a(n.form).find(":input").filter("[name='"+t(s)+"']")[0];e(n,"equalTo",l)}),m.add("required",function(a){"INPUT"===a.element.tagName.toUpperCase()&&"CHECKBOX"===a.element.type.toUpperCase()||e(a,"required",!0)}),m.add("remote",["url","type","additionalfields"],function(o){var d={url:o.params.url,type:o.params.type||"GET",data:{}},s=r(o.element.name);a.each(n(o.params.additionalfields||o.element.name),function(e,n){var r=i(n,s);d.data[r]=function(){var e=a(o.form).find(":input").filter("[name='"+t(r)+"']");return e.is(":checkbox")?e.filter(":checked").val()||e.filter(":hidden").val()||"":e.is(":radio")?e.filter(":checked").val()||"":e.val()}}),e(o,"remote",d)}),m.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&e(a,"minlength",a.params.min),a.params.nonalphamin&&e(a,"nonalphamin",a.params.nonalphamin),a.params.regex&&e(a,"regex",a.params.regex)}),m.add("fileextensions",["extensions"],function(a){e(a,"extension",a.params.extensions)}),a(function(){f.unobtrusive.parse(document)}),f.unobtrusive});
--------------------------------------------------------------------------------
/Approve/src/wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js:
--------------------------------------------------------------------------------
1 | // Unobtrusive validation support library for jQuery and jQuery Validate
2 | // Copyright (c) .NET Foundation. All rights reserved.
3 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4 | // @version v3.2.11
5 |
6 | /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
7 | /*global document: false, jQuery: false */
8 |
9 | (function (factory) {
10 | if (typeof define === 'function' && define.amd) {
11 | // AMD. Register as an anonymous module.
12 | define("jquery.validate.unobtrusive", ['jquery-validation'], factory);
13 | } else if (typeof module === 'object' && module.exports) {
14 | // CommonJS-like environments that support module.exports
15 | module.exports = factory(require('jquery-validation'));
16 | } else {
17 | // Browser global
18 | jQuery.validator.unobtrusive = factory(jQuery);
19 | }
20 | }(function ($) {
21 | var $jQval = $.validator,
22 | adapters,
23 | data_validation = "unobtrusiveValidation";
24 |
25 | function setValidationValues(options, ruleName, value) {
26 | options.rules[ruleName] = value;
27 | if (options.message) {
28 | options.messages[ruleName] = options.message;
29 | }
30 | }
31 |
32 | function splitAndTrim(value) {
33 | return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
34 | }
35 |
36 | function escapeAttributeValue(value) {
37 | // As mentioned on http://api.jquery.com/category/selectors/
38 | return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
39 | }
40 |
41 | function getModelPrefix(fieldName) {
42 | return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
43 | }
44 |
45 | function appendModelPrefix(value, prefix) {
46 | if (value.indexOf("*.") === 0) {
47 | value = value.replace("*.", prefix);
48 | }
49 | return value;
50 | }
51 |
52 | function onError(error, inputElement) { // 'this' is the form element
53 | var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
54 | replaceAttrValue = container.attr("data-valmsg-replace"),
55 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
56 |
57 | container.removeClass("field-validation-valid").addClass("field-validation-error");
58 | error.data("unobtrusiveContainer", container);
59 |
60 | if (replace) {
61 | container.empty();
62 | error.removeClass("input-validation-error").appendTo(container);
63 | }
64 | else {
65 | error.hide();
66 | }
67 | }
68 |
69 | function onErrors(event, validator) { // 'this' is the form element
70 | var container = $(this).find("[data-valmsg-summary=true]"),
71 | list = container.find("ul");
72 |
73 | if (list && list.length && validator.errorList.length) {
74 | list.empty();
75 | container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
76 |
77 | $.each(validator.errorList, function () {
78 | $(" ").html(this.message).appendTo(list);
79 | });
80 | }
81 | }
82 |
83 | function onSuccess(error) { // 'this' is the form element
84 | var container = error.data("unobtrusiveContainer");
85 |
86 | if (container) {
87 | var replaceAttrValue = container.attr("data-valmsg-replace"),
88 | replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
89 |
90 | container.addClass("field-validation-valid").removeClass("field-validation-error");
91 | error.removeData("unobtrusiveContainer");
92 |
93 | if (replace) {
94 | container.empty();
95 | }
96 | }
97 | }
98 |
99 | function onReset(event) { // 'this' is the form element
100 | var $form = $(this),
101 | key = '__jquery_unobtrusive_validation_form_reset';
102 | if ($form.data(key)) {
103 | return;
104 | }
105 | // Set a flag that indicates we're currently resetting the form.
106 | $form.data(key, true);
107 | try {
108 | $form.data("validator").resetForm();
109 | } finally {
110 | $form.removeData(key);
111 | }
112 |
113 | $form.find(".validation-summary-errors")
114 | .addClass("validation-summary-valid")
115 | .removeClass("validation-summary-errors");
116 | $form.find(".field-validation-error")
117 | .addClass("field-validation-valid")
118 | .removeClass("field-validation-error")
119 | .removeData("unobtrusiveContainer")
120 | .find(">*") // If we were using valmsg-replace, get the underlying error
121 | .removeData("unobtrusiveContainer");
122 | }
123 |
124 | function validationInfo(form) {
125 | var $form = $(form),
126 | result = $form.data(data_validation),
127 | onResetProxy = $.proxy(onReset, form),
128 | defaultOptions = $jQval.unobtrusive.options || {},
129 | execInContext = function (name, args) {
130 | var func = defaultOptions[name];
131 | func && $.isFunction(func) && func.apply(form, args);
132 | };
133 |
134 | if (!result) {
135 | result = {
136 | options: { // options structure passed to jQuery Validate's validate() method
137 | errorClass: defaultOptions.errorClass || "input-validation-error",
138 | errorElement: defaultOptions.errorElement || "span",
139 | errorPlacement: function () {
140 | onError.apply(form, arguments);
141 | execInContext("errorPlacement", arguments);
142 | },
143 | invalidHandler: function () {
144 | onErrors.apply(form, arguments);
145 | execInContext("invalidHandler", arguments);
146 | },
147 | messages: {},
148 | rules: {},
149 | success: function () {
150 | onSuccess.apply(form, arguments);
151 | execInContext("success", arguments);
152 | }
153 | },
154 | attachValidation: function () {
155 | $form
156 | .off("reset." + data_validation, onResetProxy)
157 | .on("reset." + data_validation, onResetProxy)
158 | .validate(this.options);
159 | },
160 | validate: function () { // a validation function that is called by unobtrusive Ajax
161 | $form.validate();
162 | return $form.valid();
163 | }
164 | };
165 | $form.data(data_validation, result);
166 | }
167 |
168 | return result;
169 | }
170 |
171 | $jQval.unobtrusive = {
172 | adapters: [],
173 |
174 | parseElement: function (element, skipAttach) {
175 | ///
176 | /// Parses a single HTML element for unobtrusive validation attributes.
177 | ///
178 | /// The HTML element to be parsed.
179 | /// [Optional] true to skip attaching the
180 | /// validation to the form. If parsing just this single element, you should specify true.
181 | /// If parsing several elements, you should specify false, and manually attach the validation
182 | /// to the form when you are finished. The default is false.
183 | var $element = $(element),
184 | form = $element.parents("form")[0],
185 | valInfo, rules, messages;
186 |
187 | if (!form) { // Cannot do client-side validation without a form
188 | return;
189 | }
190 |
191 | valInfo = validationInfo(form);
192 | valInfo.options.rules[element.name] = rules = {};
193 | valInfo.options.messages[element.name] = messages = {};
194 |
195 | $.each(this.adapters, function () {
196 | var prefix = "data-val-" + this.name,
197 | message = $element.attr(prefix),
198 | paramValues = {};
199 |
200 | if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
201 | prefix += "-";
202 |
203 | $.each(this.params, function () {
204 | paramValues[this] = $element.attr(prefix + this);
205 | });
206 |
207 | this.adapt({
208 | element: element,
209 | form: form,
210 | message: message,
211 | params: paramValues,
212 | rules: rules,
213 | messages: messages
214 | });
215 | }
216 | });
217 |
218 | $.extend(rules, { "__dummy__": true });
219 |
220 | if (!skipAttach) {
221 | valInfo.attachValidation();
222 | }
223 | },
224 |
225 | parse: function (selector) {
226 | ///
227 | /// Parses all the HTML elements in the specified selector. It looks for input elements decorated
228 | /// with the [data-val=true] attribute value and enables validation according to the data-val-*
229 | /// attribute values.
230 | ///
231 | /// Any valid jQuery selector.
232 |
233 | // $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
234 | // element with data-val=true
235 | var $selector = $(selector),
236 | $forms = $selector.parents()
237 | .addBack()
238 | .filter("form")
239 | .add($selector.find("form"))
240 | .has("[data-val=true]");
241 |
242 | $selector.find("[data-val=true]").each(function () {
243 | $jQval.unobtrusive.parseElement(this, true);
244 | });
245 |
246 | $forms.each(function () {
247 | var info = validationInfo(this);
248 | if (info) {
249 | info.attachValidation();
250 | }
251 | });
252 | }
253 | };
254 |
255 | adapters = $jQval.unobtrusive.adapters;
256 |
257 | adapters.add = function (adapterName, params, fn) {
258 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.
259 | /// The name of the adapter to be added. This matches the name used
260 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
261 | /// [Optional] An array of parameter names (strings) that will
262 | /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
263 | /// mmmm is the parameter name).
264 | /// The function to call, which adapts the values from the HTML
265 | /// attributes into jQuery Validate rules and/or messages.
266 | ///
267 | if (!fn) { // Called with no params, just a function
268 | fn = params;
269 | params = [];
270 | }
271 | this.push({ name: adapterName, params: params, adapt: fn });
272 | return this;
273 | };
274 |
275 | adapters.addBool = function (adapterName, ruleName) {
276 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
277 | /// the jQuery Validate validation rule has no parameter values.
278 | /// The name of the adapter to be added. This matches the name used
279 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
280 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value
281 | /// of adapterName will be used instead.
282 | ///
283 | return this.add(adapterName, function (options) {
284 | setValidationValues(options, ruleName || adapterName, true);
285 | });
286 | };
287 |
288 | adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
289 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
290 | /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
291 | /// one for min-and-max). The HTML parameters are expected to be named -min and -max.
292 | /// The name of the adapter to be added. This matches the name used
293 | /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).
294 | /// The name of the jQuery Validate rule to be used when you only
295 | /// have a minimum value.
296 | /// The name of the jQuery Validate rule to be used when you only
297 | /// have a maximum value.
298 | /// The name of the jQuery Validate rule to be used when you
299 | /// have both a minimum and maximum value.
300 | /// [Optional] The name of the HTML attribute that
301 | /// contains the minimum value. The default is "min".
302 | /// [Optional] The name of the HTML attribute that
303 | /// contains the maximum value. The default is "max".
304 | ///
305 | return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
306 | var min = options.params.min,
307 | max = options.params.max;
308 |
309 | if (min && max) {
310 | setValidationValues(options, minMaxRuleName, [min, max]);
311 | }
312 | else if (min) {
313 | setValidationValues(options, minRuleName, min);
314 | }
315 | else if (max) {
316 | setValidationValues(options, maxRuleName, max);
317 | }
318 | });
319 | };
320 |
321 | adapters.addSingleVal = function (adapterName, attribute, ruleName) {
322 | /// Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
323 | /// the jQuery Validate validation rule has a single value.
324 | /// The name of the adapter to be added. This matches the name used
325 | /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).
326 | /// [Optional] The name of the HTML attribute that contains the value.
327 | /// The default is "val".
328 | /// [Optional] The name of the jQuery Validate rule. If not provided, the value
329 | /// of adapterName will be used instead.
330 | ///
331 | return this.add(adapterName, [attribute || "val"], function (options) {
332 | setValidationValues(options, ruleName || adapterName, options.params[attribute]);
333 | });
334 | };
335 |
336 | $jQval.addMethod("__dummy__", function (value, element, params) {
337 | return true;
338 | });
339 |
340 | $jQval.addMethod("regex", function (value, element, params) {
341 | var match;
342 | if (this.optional(element)) {
343 | return true;
344 | }
345 |
346 | match = new RegExp(params).exec(value);
347 | return (match && (match.index === 0) && (match[0].length === value.length));
348 | });
349 |
350 | $jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
351 | var match;
352 | if (nonalphamin) {
353 | match = value.match(/\W/g);
354 | match = match && match.length >= nonalphamin;
355 | }
356 | return match;
357 | });
358 |
359 | if ($jQval.methods.extension) {
360 | adapters.addSingleVal("accept", "mimtype");
361 | adapters.addSingleVal("extension", "extension");
362 | } else {
363 | // for backward compatibility, when the 'extension' validation method does not exist, such as with versions
364 | // of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
365 | // validating the extension, and ignore mime-type validations as they are not supported.
366 | adapters.addSingleVal("extension", "extension", "accept");
367 | }
368 |
369 | adapters.addSingleVal("regex", "pattern");
370 | adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
371 | adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
372 | adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
373 | adapters.add("equalto", ["other"], function (options) {
374 | var prefix = getModelPrefix(options.element.name),
375 | other = options.params.other,
376 | fullOtherName = appendModelPrefix(other, prefix),
377 | element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
378 |
379 | setValidationValues(options, "equalTo", element);
380 | });
381 | adapters.add("required", function (options) {
382 | // jQuery Validate equates "required" with "mandatory" for checkbox elements
383 | if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
384 | setValidationValues(options, "required", true);
385 | }
386 | });
387 | adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
388 | var value = {
389 | url: options.params.url,
390 | type: options.params.type || "GET",
391 | data: {}
392 | },
393 | prefix = getModelPrefix(options.element.name);
394 |
395 | $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
396 | var paramName = appendModelPrefix(fieldName, prefix);
397 | value.data[paramName] = function () {
398 | var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
399 | // For checkboxes and radio buttons, only pick up values from checked fields.
400 | if (field.is(":checkbox")) {
401 | return field.filter(":checked").val() || field.filter(":hidden").val() || '';
402 | }
403 | else if (field.is(":radio")) {
404 | return field.filter(":checked").val() || '';
405 | }
406 | return field.val();
407 | };
408 | });
409 |
410 | setValidationValues(options, "remote", value);
411 | });
412 | adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
413 | if (options.params.min) {
414 | setValidationValues(options, "minlength", options.params.min);
415 | }
416 | if (options.params.nonalphamin) {
417 | setValidationValues(options, "nonalphamin", options.params.nonalphamin);
418 | }
419 | if (options.params.regex) {
420 | setValidationValues(options, "regex", options.params.regex);
421 | }
422 | });
423 | adapters.add("fileextensions", ["extensions"], function (options) {
424 | setValidationValues(options, "extension", options.params.extensions);
425 | });
426 |
427 | $(function () {
428 | $jQval.unobtrusive.parse(document);
429 | });
430 |
431 | return $jQval.unobtrusive;
432 | }));
433 |
--------------------------------------------------------------------------------