1 Commits

Author SHA1 Message Date
arfat qureshi
9e99e4b1c9 angular version 20 upgraded 2025-10-31 13:34:16 +05:30
271 changed files with 7102 additions and 22991 deletions

View File

@@ -1,45 +1,45 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": "f4854f29-3f5d-460e-b705-561313912e45"
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ExtraNet": {
"extra-net": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular/build:application",
"options": {
"progress": false,
"browser": "src/main.ts",
"outputPath": "dist/ExtraNet",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"./node_modules/primeng/resources/themes/saga-blue/theme.css",
"./node_modules/primeicons/primeicons.css",
"./node_modules/primeng/resources/primeng.min.css",
"./node_modules/quill/dist/quill.core.css",
"./node_modules/quill/dist/quill.snow.css",
"./src/scss/default.scss",
"./src/styles.scss"
"assets": [
{
"glob": "**/*",
"input": "node_modules/@kolkov/angular-editor/assets/icons",
"output": "assets/ae-icons/"
},
{
"glob": "**/*",
"input": "public"
}
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
"styles": [
"src/styles.scss",
"node_modules/@kolkov/angular-editor/themes/default.scss"
]
},
"configurations": {
"dev": {
@@ -49,24 +49,18 @@
"with": "src/environments/environment.dev.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"deployUrl": "",
"budgets": [
{
"type": "initial",
"maximumWarning": "512kb",
"maximumError": "3mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "1mb",
"maximumError": "3mb"
"maximumWarning": "100kb",
"maximumError": "150kb"
}
]
},
@@ -77,24 +71,18 @@
"with": "src/environments/environment.uat.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"deployUrl": "",
"budgets": [
{
"type": "initial",
"maximumWarning": "512kb",
"maximumError": "3mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "1mb",
"maximumError": "3mb"
"maximumWarning": "100kb",
"maximumError": "150kb"
}
]
},
@@ -105,24 +93,18 @@
"with": "src/environments/environment.preprod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"deployUrl": "",
"budgets": [
{
"type": "initial",
"maximumWarning": "512kb",
"maximumError": "3mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "1mb",
"maximumError": "3mb"
"maximumWarning": "100kb",
"maximumError": "150kb"
}
]
},
@@ -133,133 +115,74 @@
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"deployUrl": "",
"budgets": [
{
"type": "initial",
"maximumWarning": "512kb",
"maximumError": "3mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "1mb",
"maximumError": "3mb"
"maximumWarning": "100kb",
"maximumError": "150kb"
}
]
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": ""
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"port": 52725,
"buildTarget": "ExtraNet:build"
},
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "ExtraNet:build:production"
"buildTarget": "extra-net:build:production"
},
"development": {
"buildTarget": "extra-net:build:development"
}
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "ExtraNet:build"
}
"builder": "@angular/build:extract-i18n"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"builder": "@angular/build:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"karmaConfig": "karma.conf.js",
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss",
"src/scss/default.scss",
"node_modules/quill/dist/quill.core.css",
"node_modules/quill/dist/quill.snow.css"
],
"scripts": [
"node_modules/quill/dist/quill.min.js"
],
"assets": [
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json"
{
"glob": "**/*",
"input": "node_modules/@kolkov/angular-editor/assets/icons",
"output": "assets/ae-icons/"
},
{
"glob": "**/*",
"input": "public"
}
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist-server",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.server.json",
"sourceMap": true,
"optimization": false
},
"configurations": {
"dev": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true
}
},
"defaultConfiguration": ""
}
}
},
"ExtraNet-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "ExtraNet:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
"styles": [
"src/styles.scss",
"node_modules/@kolkov/angular-editor/themes/default.scss"
]
}
}
}
}
},
"cli": {
"analytics": false
}
}
}

13548
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -5,15 +5,23 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build-dev": "ng build --configuration=dev",
"build-uat": "ng build --configuration=uat",
"build-preprod": "ng build --configuration=preprod",
"build-prod": "ng build --configuration=prod",
"build-dev": "ng build --configuration=dev && npm run post-build",
"build-uat": "ng build --configuration=uat && npm run post-build",
"build-preprod": "ng build --configuration=preprod && npm run post-build",
"build-prod": "ng build --configuration=prod && npm run post-build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"post-build": "node ./build/post-build.js",
"serve": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve"
"post-build": "node ./build/post-build.js"
},
"prettier": {
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
},
"private": true,
"dependencies": {
@@ -26,24 +34,24 @@
"@angular/platform-browser": "^20.1.0",
"@angular/platform-browser-dynamic": "^20.1.2",
"@angular/router": "^20.1.0",
"@fullcalendar/angular": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.15",
"@ng-select/ng-option-highlight": "^13.7.0",
"@ionic/angular": "^8.7.6",
"@kolkov/angular-editor": "^3.0.0-beta.2",
"@ng-select/ng-select": "^20.1.2",
"@ngx-translate/core": "^17.0.0",
"ag-grid-angular": "^32.0.2",
"ag-grid-community": "^32.0.2",
"angular-calendar": "^0.31.1",
"@ngx-translate/http-loader": "^17.0.0",
"crypto-js": "^4.2.0",
"date-fns": "^3.6.0",
"date-fns": "^4.1.0",
"file-saver": "^2.0.5",
"jsencrypt": "^3.3.2",
"jspdf": "^3.0.1",
"jspdf-autotable": "^5.0.2",
"moment": "^2.30.1",
"my-workspace": "github:ngx-translate/core",
"ng-otp-input": "^2.0.8",
"ngx-cookie-service": "^20.0.1",
"primeng": "^20.0.0",
"ngx-toastr": "^19.1.0",
"node-fetch": "^2.7.0",
"primeng": "^20.2.0",
"quill": "^2.0.3",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
@@ -54,16 +62,14 @@
"@angular/build": "^20.1.1",
"@angular/cli": "^20.1.1",
"@angular/compiler-cli": "^20.1.0",
"@types/file-saver": "^2.0.7",
"@types/node": "^22.1.0",
"@types/jasmine": "~5.1.0",
"@types/xlsx": "^0.0.35",
"jasmine-core": "~5.8.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.8.2",
"webpack": "^5.93.0"
"typescript": "~5.8.2"
}
}
}

View File

@@ -1,11 +1,12 @@
import { Component, Renderer2 } from '@angular/core';
import * as moment from 'moment';
import moment from 'moment';
import { Subscription, interval } from 'rxjs';
import { CommonFunctionService } from './core/common/common-function.service';
import { API } from './core/services/api.service';
import { RouteChangeService } from './core/common/RouteChangeService.service';
@Component({
standalone: false,
selector: 'app-root',
templateUrl: './app.component.html',
})
@@ -70,7 +71,7 @@ export class AppComponent {
ngOnDestroy() {
// Unsubscribe from the observable to prevent memory leaks
this.commonService.subscription.unsubscribe();
this.commonService.subscription?.unsubscribe();
}
extendJWTTime() {
this.stopTimer();

View File

@@ -3,7 +3,7 @@ import { API } from "../services/api.service";
import { Injectable } from "@angular/core";
import { Title } from "@angular/platform-browser";
import { ValidationService } from "./validation.service";
import * as moment from "moment";
import moment from "moment";
import { FileUpload } from "primeng/fileupload";
import jsPDF from "jspdf";
import * as FileSaver from "file-saver";
@@ -12,7 +12,7 @@ import { UserLoginData } from "../models/common-model/userModel";
import { securityFunctions } from "./security";
import { UserLog } from "../models/common-model/user-logout.model";
import { Subscription, interval } from "rxjs";
import { environment } from "src/environments/environment";
import { environment } from "../../../environments/environment";
import { Router, NavigationEnd } from '@angular/router';
import { filter } from 'rxjs/operators';
@@ -55,10 +55,10 @@ export class CommonFunctionService {
HotelOffers: { val:false, link:'Services/Hotel/HotelManage/AddOffer', IsActive: false, Download: false},
HotelSupplements: { val:false, link:'Services/Hotel/HotelManage/AddSuppliment', IsActive: false, Download: false},
}
CurrencyList = [];
CountryList = [];
CityList = [];
agencyData = [];
CurrencyList: any[] = [];
CountryList: any[] = [];
CityList: any[] = [];
agencyData: any[] = [];
timer;
AllVendor = []
// =============================== normal function ==========================
@@ -181,11 +181,11 @@ export class CommonFunctionService {
*/
public exportPdf(GetallData, title_list, file_name) {
let bookResultResp = GetallData.map(el => {
let data_Array = [];
let data_Array: any[] = [];
title_list.forEach(title => data_Array.push(el[title.field]))
return data_Array
});
let key_Array = [];
let key_Array: any[] = [];
title_list.forEach(title => key_Array.push(title.header))
const head = [key_Array]
const doc = new jsPDF("l", "ex", [100, 280]);
@@ -234,7 +234,7 @@ export class CommonFunctionService {
? decimalAmountSplitList[index]
: '0';
});
let amountSplitListTemp = [];
let amountSplitListTemp: any[] = [];
let amountIndex = 0;
amountFormatSplitList.forEach((x, index) => {
if (amountFormatSplitList[index] == '#' && amountSplitList[amountIndex]) {
@@ -345,7 +345,7 @@ export class CommonFunctionService {
const reader = new FileReader();
reader.readAsText(file); // Read as binary data
reader.onload = (e) => {
const binaryString = e.target.result as string;
const binaryString = e.target?.result as string;
const hasScriptTag = this.hasScriptTagInBinary(binaryString);
if (hasScriptTag) {
filedata.clear();
@@ -458,7 +458,7 @@ export class CommonFunctionService {
return this.ApiServ.AdminGoPost('/ExtranetVendorMaster/GetAll', searchObj)
};
loginOut() {
let loginData = sessionStorage.getItem('IP');
let loginData: any = sessionStorage.getItem('IP');
this.LoginUserData = JSON.parse(securityFunctions.getSessionStorage('LoginUserData'));
try {
let userLogModel = new UserLog();
@@ -489,7 +489,7 @@ export class CommonFunctionService {
//
displayPosition = false;
position: string;
public subscription: Subscription;
public subscription: Subscription | undefined;
remainingTime: number;
StartTimer() {
const source = interval(1000);

View File

@@ -2,7 +2,7 @@ import { HttpHandler, HttpRequest, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, Subject, throwError } from 'rxjs';
import { catchError, exhaustMap, finalize, take } from 'rxjs/operators';
import * as moment from 'moment';
import moment from 'moment';
import { MessageService } from 'primeng/api';
import { LoaderService } from './loader.service';
import { API } from '../services/api.service';
@@ -142,7 +142,7 @@ export class InterceptLoader {
}
loginOut() {
let loginData = sessionStorage.getItem('IP');
let loginData: any = sessionStorage.getItem('IP');
let LoginUserData = JSON.parse(securityFunctions.getSessionStorage('LoginUserData'));
try {
let userLogModel = new UserLog();
@@ -241,8 +241,8 @@ export class InterceptLoader {
headerSetup(req) {
this.LoginUserData = securityFunctions.getSessionStorage('LoginUserData') ? JSON.parse(securityFunctions.getSessionStorage('LoginUserData')) : '';
let domain = document.location.host
// let domain = 'extranet.dev.futuretravelplatform.com'
// let domain = document.location.host
let domain = 'extranet.dev.futuretravelplatform.com'
let domainName = domain.replace(/^(https?:\/\/)?/, '');
const adjustedTime = this.apiServ.getAdjustedLocalTime(); // Get adjusted local time
// Handle vendor id in token

View File

@@ -1,6 +1,6 @@
import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { environment } from "src/environments/environment";
import { environment } from "../../../../environments/environment";
@Injectable()
export class HotelBookingManagementService {

View File

@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { environment } from '../../../environments/environment';
@Injectable({
providedIn: 'root'

View File

@@ -30,7 +30,7 @@ export class FlightContractService {
}
timer;
AirlineList = [];
AirportList = [];
AirportList: any[] = [];
AllAirCraftList = [];
getAirLineBySearch(val) {
if (val.length >= 2) {

View File

@@ -1,14 +1,14 @@
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Router } from "@angular/router";
import { environment } from "src/environments/environment";
import { environment } from "../../../environments/environment";
import { CommonService } from "./common.service";
import { of } from "rxjs";
import { LoginModel, SSOLoginModel } from "../models/common-model/Sign-in.model";
import { API } from "./api.service";
import { securityFunctions } from "../common/security";
import { CommonFunctionService } from "../common/common-function.service";
import * as moment from "moment";
import moment from "moment";
@Injectable()
export class SSOService {

View File

@@ -1,4 +1,4 @@
<div class="progress-loader" [hidden]="!loading">
<div class="progress-loader" [hidden]="!loading">
<!-- -->
<div class="loading-spinner">
<div class="row examples">

View File

@@ -1,7 +1,8 @@
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { LoaderService } from 'src/app/core/common/loader.service';
import { LoaderService } from '../../common/loader.service';
@Component({
standalone: false,
selector: 'app-loader',
templateUrl: './intercept-loader.component.html',
})

View File

@@ -1,4 +1,4 @@
<div class="app-main" [ngClass]="{'ng-app-main-active': ChcekSidebar.activeSide == 'IsActive'}">
<div class="app-main" [ngClass]="{'ng-app-main-active': ChcekSidebar.activeSide == 'IsActive'}">
<div class="app-asidebar">
<custom-sidebar></custom-sidebar>
</div>

View File

@@ -1,8 +1,9 @@
import { Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
import { ActiveSidebarService } from '../../core/services/active-sidebar.service';
@Component({
standalone: false,
templateUrl: './base.component.html',
selector: 'app-base',
})

View File

@@ -1,4 +1,4 @@
<!-- <div class="progress-loader" [hidden]="!loading">
<!-- <div class="progress-loader" [hidden]="!loading">
<div class="loading-spinner">
<div class="row examples">
<div class="col-3">

View File

@@ -1,7 +1,8 @@
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { LoaderService } from 'src/app/core/common/loader.service';
import { LoaderService } from '../../../core/common/loader.service';
@Component({
standalone: false,
selector: 'app-loader',
templateUrl: './loader.component.html',
})

View File

@@ -1,4 +1,4 @@
<div class="error-404">
<div class="error-404">
<div class="errorWrap">
<div class="errorSvG"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400px" height="400px" viewBox="0 0 871 731">
<defs>

View File

@@ -1,7 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { CommonFunctionService } from '../../core/common/common-function.service';
@Component({
standalone: false,
selector: 'app-Unauthorized',
templateUrl: './unauthorized.component.html',
})

View File

@@ -0,0 +1 @@


View File

@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
standalone: false,
selector: 'app-auth',
templateUrl: './auth.component.html',
})

View File

@@ -7,14 +7,14 @@ import { RouterModule, Routes } from '@angular/router';
import { MessageService } from 'primeng/api';
import { PasswordModule } from 'primeng/password';
import { ToastModule } from 'primeng/toast';
import { ValidationService } from 'src/app/core/common/validation.service';
import { ValidationService } from '../../core/common/validation.service';
import { LoginComponent } from './login/login.component';
import { InterceptLoader } from 'src/app/core/common/intercept-loader.service';
import { InterceptLoader } from '../../core/common/intercept-loader.service';
import { ForgetPasswordComponent } from './forget-password/forget-password.component';
import { VerifyEmailComponent } from './verify-email/verify-email.component';
import { NgOtpInputModule } from 'ng-otp-input';
import { SingleSignOnComponent } from './single-sign-on/single-sign-on.component';
import { SSOService } from 'src/app/core/services/sso.service';
import { SSOService } from '../../core/services/sso.service';
import { ButtonModule } from 'primeng/button';
const routes: Routes = [

View File

@@ -1,4 +1,4 @@
<div class="app-ForgotWrap" *ngIf="showMsgValid" [ngStyle]="{'background-image':'url(' + commonService.environmentObj.cdnBaseUrl + 'assets/banner/bg-common.jpg)'}">
<div class="app-ForgotWrap" *ngIf="showMsgValid" [ngStyle]="{'background-image':'url(' + commonService.environmentObj.cdnBaseUrl + 'assets/banner/bg-common.jpg)'}">
<div class="app-ForgotBody">
<div class="app-loginLogo">
<img alt="">
@@ -86,4 +86,4 @@
</div>
</div>
</div>
<p-toast></p-toast>
<!-- <p-toast> --><!-- </p-toast> -->

View File

@@ -1,12 +1,13 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { securityFunctions } from 'src/app/core/common/security';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../core/common/common-function.service';
import { securityFunctions } from '../../../core/common/security';
import { ValidationService } from '../../../core/common/validation.service';
import { API } from '../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-forget-password',
templateUrl: './forget-password.component.html',
})
@@ -34,7 +35,7 @@ export class ForgetPasswordComponent implements OnInit {
});
this.route.queryParams.subscribe((key_obj) => {
if (key_obj) {
this.ResetPswdForm.get('EncryptedData').setValue(key_obj['key']);
this.ResetPswdForm.get('EncryptedData')?.setValue(key_obj['key']);
this.checkResetPassAllow(key_obj['key'])
}
});

View File

@@ -1,4 +1,4 @@
<div class="app-loginWrap" [ngStyle]="{'background-image':'url(' + commonService.environmentObj.cdnBaseUrl + 'assets/banner/bg-extranet.png)'}">
<div class="app-loginWrap" [ngStyle]="{'background-image':'url(' + commonService.environmentObj.cdnBaseUrl + 'assets/banner/bg-extranet.png)'}">
<div class="overlay"></div>
<div class="app-loginBody" [formGroup]="SignInForm">
<div class="login-textWrap">
@@ -236,4 +236,4 @@
</div>
</div> -->
</div>
<p-toast></p-toast>
<!-- <p-toast> --><!-- </p-toast> -->

View File

@@ -3,16 +3,17 @@ import { Component, OnInit, Renderer2 } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Title } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { environment } from 'src/environments/environment';
import * as moment from 'moment';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { securityFunctions } from 'src/app/core/common/security';
import { API } from '../../../core/services/api.service';
import { environment } from '../../../../environments/environment';
import moment from 'moment';
import { CommonFunctionService } from '../../../core/common/common-function.service';
import { securityFunctions } from '../../../core/common/security';
import { CookieService } from 'ngx-cookie-service';
import { LoginModel, OTPModel } from 'src/app/core/models/common-model/Sign-in.model';
import { LoginModel, OTPModel } from '../../../core/models/common-model/Sign-in.model';
import { NgOtpInputConfig } from 'ng-otp-input';
import { ValidationService } from '../../../core/common/validation.service';
@Component({
standalone: false,
selector: 'app-login',
templateUrl: './login.component.html',
})
@@ -106,7 +107,7 @@ export class LoginComponent implements OnInit {
userId = '';
disableSignInButton = false;
SignIn() {
if (this.SignInForm.get('EmailID').status == "INVALID" || this.SignInForm.get('Password').status == "INVALID") {
if (this.SignInForm.get('EmailID')?.status == "INVALID" || this.SignInForm.get('Password')?.status == "INVALID") {
this.validationService.showValidationsMsg(this.SignInForm.get('EmailID'));
this.validationService.showValidationsMsg(this.SignInForm.get('Password'));
return;
@@ -204,7 +205,7 @@ export class LoginComponent implements OnInit {
// OTP set
onOtpChange(otp) {
this.SignInForm.get('OTP').setValue(otp);
this.SignInForm.get('OTP')?.setValue(otp);
// if (otp.keyCode == 13 ) {
// this.Verify();
// }
@@ -225,7 +226,7 @@ export class LoginComponent implements OnInit {
this.errorMessage = '';
this.timeLeft = 60;
this.startTimer();
this.Email = localStorage.getItem('UserEmail');
this.Email = localStorage.getItem('UserEmail') || '';
return
}
}
@@ -332,7 +333,7 @@ export class LoginComponent implements OnInit {
return this.http.get(environment.APIBaseUrl + '/MenuMasterNew/GetAllMenuByUserId/' + sessionStorage.getItem('userId') + '/2405170833594899108')
}
Verify() {
if (this.SignInForm.get('OTP').status == "INVALID") {
if (this.SignInForm.get('OTP')?.status == "INVALID") {
this.errorMessage = 'Please enter valid OTP'
return;
}
@@ -360,11 +361,11 @@ export class LoginComponent implements OnInit {
};
// forget Password
SendMail() {
if (this.SignInForm.get('forgetPassEmail').status == "INVALID") {
if (this.SignInForm.get('forgetPassEmail')?.status == "INVALID") {
this.validationService.showValidationsMsg(this.SignInForm.get('forgetPassEmail'));
return;
}
let val = this.SignInForm.get('forgetPassEmail').value;
let val = this.SignInForm.get('forgetPassEmail')?.value || '';
let request = {
email: val,
domain: window.location.origin,
@@ -464,12 +465,12 @@ export class LoginComponent implements OnInit {
// common function
addRemoveValid(name, check) {
if (check) {
this.SignInForm.get(name).addValidators([Validators.required]);
this.SignInForm.get(name)?.addValidators([Validators.required]);
} else {
this.SignInForm.get(name).clearValidators();
this.SignInForm.get(name)?.clearValidators();
}
this.SignInForm.get(name).updateValueAndValidity();
this.SignInForm.get(name).markAsUntouched();
this.SignInForm.get(name)?.updateValueAndValidity();
this.SignInForm.get(name)?.markAsUntouched();
};
// Tpin

View File

@@ -1 +1 @@
<!-- <p>single-sign-on</p> -->
<!-- <p>single-sign-on</p> -->

View File

@@ -1,8 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { SSOService } from 'src/app/core/services/sso.service';
import { SSOService } from '../../../core/services/sso.service';
@Component({
standalone: false,
selector: 'app-single-sign-on',
templateUrl: './single-sign-on.component.html',
})

View File

@@ -1,4 +1,4 @@
<div class="custom-container">
<div class="custom-container">
<div class="custom-card cardDeactive" *ngIf="ShowApprovalCard">
<div class="card-content">
<img [src]="commonService.environmentObj.cdnBaseUrl + 'assets/icon/correct.png'" alt="Image" width="100px">

View File

@@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../core/common/common-function.service';
import { API } from '../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-verify-email',
templateUrl: './verify-email.component.html',
})

View File

@@ -1 +1 @@
<p>booking-management works!</p>
<p>booking-management works!</p>

View File

@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
standalone: false,
selector: 'app-booking-management',
templateUrl: './booking-management.component.html',
})

View File

@@ -1 +1 @@
<p>Experience-booking-search works!</p>
<p>Experience-booking-search works!</p>

View File

@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
standalone: false,
selector: 'app-Experience-booking-search',
templateUrl: './experience-booking-search.component.html',
})

View File

@@ -1 +1 @@
<p>Experience-booking works!</p>
<p>Experience-booking works!</p>

View File

@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
standalone: false,
selector: 'app-Experience-booking',
templateUrl: './experience-booking.component.html',
})

View File

@@ -389,7 +389,7 @@
<div class="col-lg-3 calenderField">
<div class="formControlWrapper">
<span class="formLabel">From Date</span>
<p-calendar #DateNg [showIcon]="true" formControlName="from_Date" placeholder="Select"
<p-datePicker #DateNg [showIcon]="true" formControlName="from_Date" placeholder="Select"
(onClose)="applyToDate(HotelBookingFiltersForm.controls['from_Date'].value)" [readonlyInput]="true"
inputId="range1" [showButtonBar]="true" dateFormat="dd M yy">
<ng-template pTemplate="header">
@@ -404,13 +404,13 @@
</div>
</div>
</ng-template>
</p-calendar>
</p-datePicker>
</div>
</div>
<div class="col-lg-3 calenderField">
<div class="formControlWrapper">
<span class="formLabel">To Date</span>
<p-calendar #DatesNg [showIcon]="true" formControlName="To_Date" [minDate]="To_Date_Start"
<p-datePicker #DatesNg [showIcon]="true" formControlName="To_Date" [minDate]="To_Date_Start"
[readonlyInput]="true" inputId="range2" [showButtonBar]="true" dateFormat="dd M yy" placeholder="Select">
<ng-template pTemplate="header">
<div class="temp_mobileBack">
@@ -424,7 +424,7 @@
</div>
</div>
</ng-template>
</p-calendar>
</p-datePicker>
</div>
</div>
</div>
@@ -657,7 +657,7 @@
</div>
<div class="formControlWrapper calenderField">
<span class="formLabel">Date Of Confirmation</span>
<p-calendar inputId="basic" placeholder="Select" [showIcon]="true" formControlName="hotel_confirmation_number_date" class="d-block"></p-calendar>
<p-datePicker inputId="basic" placeholder="Select" [showIcon]="true" formControlName="hotel_confirmation_number_date" class="d-block"></p-datePicker>
</div>
<div class="formControlWrapper">
<span class="formLabel">Remarks</span>

View File

@@ -1,14 +1,15 @@
import { Component, NgModule, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import * as moment from 'moment';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { API } from 'src/app/core/services/api.service';
import { HotelBookingManagementService } from 'src/app/core/services/HotelServices/hotel_booking_management.service';
import { Product } from 'src/app/core/services/product';
import { securityFunctions } from 'src/app/core/common/security';
import moment from 'moment';
import { CommonFunctionService } from '../../../../core/common/common-function.service';
import { API } from '../../../../core/services/api.service';
import { HotelBookingManagementService } from '../../../../core/services/HotelServices/hotel_booking_management.service';
import { Product } from '../../../../core/services/product';
import { securityFunctions } from '../../../../core/common/security';
@Component({
standalone: false,
selector: 'hotel-booking-search',
templateUrl: './hotel-booking-search.component.html',
})
@@ -25,15 +26,15 @@ export class HotelBookingSearchComponent implements OnInit {
Entitylist;
Countrylist;
Citylist;
AssignUserList=[];
AssignSupportList=[];
AssignUser=[];
AssignSupport=[];
AssignUserSearch=[];
AssignUserList: any[] = [];
AssignSupportList: any[] = [];
AssignUser: any[] = [];
AssignSupport: any[] = [];
AssignUserSearch: any[] = [];
User_Type;
User_Name;
User_Id = [{user_id:'',user_name:'Assign to me'}];
User_Id_sup = [{user_id:'',user_name:'Assign to me'}];
User_Id: any[] = [{user_id:'',user_name:'Assign to me'}];
User_Id_sup: any[] = [{user_id:'',user_name:'Assign to me'}];
HotelSupplierlist;
HotelBookingList;
@ViewChild('dt') myTable;
@@ -430,7 +431,7 @@ export class HotelBookingSearchComponent implements OnInit {
});
}
onCountrySelect(e) {
this.HotelBookingFiltersForm.get('fltr_city').setValue(null);
this.HotelBookingFiltersForm.get('fltr_city')?.setValue(null);
e ? this.getHotelCityList(e.country_code) : this.Citylist = null;
}
@@ -481,16 +482,16 @@ export class HotelBookingSearchComponent implements OnInit {
})
}
GetDatabyAgencyType() {
this.HotelBookingFiltersForm.get('fltr_agency').setValue(null);
this.HotelBookingFiltersForm.get('fltr_agency')?.setValue(null);
}
// Set Default for the from date & to date
setDefaultDate(){
this.HotelBookingFiltersForm.get("fltr_date").setValue("Booking Date");
this.HotelBookingFiltersForm.get("fltr_date")?.setValue("Booking Date");
let from_date = new Date(new Date().getTime() - 7 * 24 * 60 * 60 * 1000);
let to_date = new Date();
this.HotelBookingFiltersForm.get("from_Date").setValue(from_date);
this.HotelBookingFiltersForm.get("To_Date").setValue(to_date);
this.HotelBookingFiltersForm.get("from_Date")?.setValue(from_date);
this.HotelBookingFiltersForm.get("To_Date")?.setValue(to_date);
}
initConfirmationForm(itinerary_data) {
let obj = {
@@ -537,9 +538,9 @@ export class HotelBookingSearchComponent implements OnInit {
hotel_confirmation_number_date:obj.hotel_confirmation_number_date,
hotel_confirmation_staff_name:obj.hotel_confirmation_staff_name,
hotel_confirmation_staff_remarks:obj.hotel_confirmation_staff_remarks,
hotel_rooms:[]
hotel_rooms:[] as any[]
}
let hotel_confirm_number = [];
let hotel_confirm_number: any[] = [];
obj.hotel_confirmation_number.forEach(data=>{
hotel_confirm_number.push(
{

View File

@@ -67,9 +67,16 @@
</div>
</div>
<div class="ng-tab custom-shadow hotelTab_Wrapper">
<p-tabView (onChange)="tabClick($event)">
<p-tabs (valueChange)="tabClick({ index: $event })">
<p-tablist>
<p-tab [value]="0">Itinerary</p-tab>
<p-tab [value]="1">Passengers</p-tab>
<p-tab [value]="2">Vendor Costing</p-tab>
<p-tab [value]="3">Vendor Notes</p-tab>
</p-tablist>
<p-tabpanels>
<!-- Itinerary tab -->
<p-tabPanel header="Itinerary">
<p-tabpanel [value]="0">
<div *ngIf="tab_data_status.itinerary == 'success'" [formGroup]="StatusGroup">
<div class=" Itinerary_Details" formArrayName="statusArr"
*ngFor="let itinerary of itinerary_tab_data;let i = index">
@@ -208,9 +215,9 @@
<p>Itinerary Data not found</p>
</div>
</div>
</p-tabPanel>
</p-tabpanel>
<!-- Passengers tab -->
<p-tabPanel header="Passengers">
<p-tabpanel [value]="1">
<div *ngIf="tab_data_status.passenger == 'success'">
<div *ngFor="let bkg of guest_tab_data" class="ng-bookingDetail">
<div class="app-mainGrid2">
@@ -294,9 +301,9 @@
<div *ngIf="tab_data_status.passenger == 'failed'" style="display: flex; justify-content: center">
<p>Passenger Data not found</p>
</div>
</p-tabPanel>
</p-tabpanel>
<!-- Vendor Costing tab -->
<p-tabPanel header="Vendor Costing">
<p-tabpanel [value]="2">
<div *ngIf="tab_data_status.costing == 'success'">
<div class="ng-bookingDetail" *ngFor="let bkg of costing_tab_data.booking_list; let a = index">
<div class="bookingMngmnt_gridWrap">
@@ -309,10 +316,6 @@
<h5 class="app-bgtext">Booking Id</h5>
<p class="app-text">{{ bkg.booking_id }}</p>
</div>
<!-- <div class="app-comCol">
<h5 class="app-bgtext">Vendor Name</h5>
<p class="app-text">Amaan</p>
</div> -->
<div class="app-comCol" *ngIf="bkg.Contract">
<h5 class="app-bgtext">Contract Name</h5>
<p class="app-text">{{ bkg.Contract }}</p>
@@ -341,17 +344,7 @@
<h5 class="app-bgtext">Vendor Total</h5>
<p class="app-text">{{ bkg.supplier_amount }}</p>
</div>
<!-- <div class="app-comCol">
<h5 class="app-bgtext">Adjustment</h5>
<p class="app-text">0.23</p>
</div> -->
</div>
<!-- <div class="view-action-btnWrapper text-left">
<button class="btn btn-primary" [matMenuTriggerFor]="menu">Action</button>
<mat-menu #menu="matMenu">
<button mat-menu-item>Action</button>
</mat-menu>
</div> -->
</div>
<div *ngFor="let Room_Details of bkg.room_details_list;let i=index">
<div class="overflow-auto mt-20">
@@ -389,12 +382,6 @@
<tr>
<th class="text-left">Date</th>
<th class="text-left" *ngFor="let Date of Room_Details.Room_Allocation_Data.Date">{{Date}}</th>
<!-- <th>Thur 05 Sep</th>
<th>Fri 06 Sep</th>
<th>Sat 07 Sep</th>
<th>Sun 08 Sep</th>
<th>Mon 09 Sep</th>
<th>Tue 10 Sep</th> -->
<th>Total</th>
</tr>
</thead>
@@ -425,9 +412,9 @@
</div>
</div>
</div>
</p-tabPanel>
</p-tabpanel>
<!-- Vendor Notes tab -->
<p-tabPanel header="Vendor Notes">
<p-tabpanel [value]="3">
<div class="text-right mb-3">
<button class="btn btn-primary" (click)="openSendAddNote()"> Add Notes </button>
</div>
@@ -459,8 +446,9 @@
</table>
</div>
</p-tabPanel>
</p-tabView>
</p-tabpanel>
</p-tabpanels>
</p-tabs>
</div>
<!-- Notes Modal -->
@@ -537,7 +525,7 @@
</div>
<div class="formControlWrapper calenderField">
<span class="formLabel">Date Of Confirmation</span>
<p-calendar inputId="basic" placeholder="Select" [showIcon]="true" formControlName="hotel_confirmation_number_date" class="d-block"></p-calendar>
<p-datePicker inputId="basic" placeholder="Select" [showIcon]="true" formControlName="hotel_confirmation_number_date" class="d-block"></p-datePicker>
</div>
<div class="formControlWrapper">
<span class="formLabel">Remarks</span>
@@ -564,7 +552,7 @@
</div>
<div class="formControlWrapper calenderField">
<span class="formLabel">Date of Invoice Issue</span>
<p-calendar inputId="basic" placeholder="Select" [showIcon]="true" class="d-block"></p-calendar>
<p-datePicker inputId="basic" placeholder="Select" [showIcon]="true" class="d-block"></p-datePicker>
</div>
<div class="formControlWrapper">
<span class="formLabel">Remarks</span>

View File

@@ -2,20 +2,21 @@ import { Component, ElementRef, OnInit, ViewChild } from "@angular/core";
import { FormArray, FormBuilder, FormControl, FormGroup, Validators } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router";
import * as _ from 'lodash';
import * as moment from "moment";
import { MessageService, PrimeNGConfig } from 'primeng/api';
import moment from "moment";
import { MessageService } from 'primeng/api';
import { forkJoin } from "rxjs";
import { CommonFunctionService } from "src/app/core/common/common-function.service";
import { ValidationService } from "src/app/core/common/validation.service";
import { HotelBookingManagementService } from "src/app/core/services/HotelServices/hotel_booking_management.service";
import { API } from "src/app/core/services/api.service";
import { CommonFunctionService } from "../../../../core/common/common-function.service";
import { ValidationService } from "../../../../core/common/validation.service";
import { HotelBookingManagementService } from "../../../../core/services/HotelServices/hotel_booking_management.service";
import { API } from "../../../../core/services/api.service";
@Component({
standalone: false,
selector: 'app-hotel-booking-view',
templateUrl: './hotel-booking-view.component.html',
})
export class HotelBookingViewComponent {
dialogStatus = [];
dialogStatus: any[] = [];
isOpenAddNote: boolean = false;
VendorInvoiceForm:FormGroup;
isOpenCancellationPolicyModal: boolean = false;
@@ -31,7 +32,7 @@ export class HotelBookingViewComponent {
addConfirmationNumber
AssignUserList;
User_Name;
User_Id = [{ user_id: '', user_name: 'Assign to me' }];
User_Id: any[] = [{ user_id: '', user_name: 'Assign to me' }];
AssignUser;
User_Type;
value: Date;
@@ -52,7 +53,7 @@ export class HotelBookingViewComponent {
hotelTotalAmount;
hotelNotesResp;
bookingId;
supplierNightlyRate = [];
supplierNightlyRate: any[] = [];
hotelDocumentResp;
hotelSupplierCancellationPolicy;
hotelAgentCancellationPolicy;
@@ -82,17 +83,17 @@ export class HotelBookingViewComponent {
Cancellation_Agent_Amont = 0;
Cancellation_Supp_Amont = 0;
//SAGAR
currency_list = null;
booking_customer_data = null;
itinerary_tab_data = null;
guest_tab_data = null;
costing_tab_data = null;
payment_tab_data = null;
document_tab_data = null;
note_tab_data = null;
verification_tab_data = null;
veri_tab_data_mid = null;
selected__mail_document_type = "";
currency_list: any = null;
booking_customer_data: any = null;
itinerary_tab_data: any = null;
guest_tab_data: any = null;
costing_tab_data: any = null;
payment_tab_data: any = null;
document_tab_data: any = null;
note_tab_data: any = null;
verification_tab_data: any = null;
veri_tab_data_mid: any = null;
selected__mail_document_type: string = "";
mailForm: FormGroup;
StatusGroup: FormGroup;
hotelBookingForm: FormGroup;
@@ -131,7 +132,6 @@ export class HotelBookingViewComponent {
private ApiServ: API,
private messageService: MessageService,
public validationServ: ValidationService,
private primengConfig: PrimeNGConfig,
public commonserv: CommonFunctionService,
) {
this.route.queryParams.subscribe(params => {
@@ -154,7 +154,6 @@ export class HotelBookingViewComponent {
this.initFormsGroup();
this.GetAllData();
this.initConfirmationForm(null);
this.primengConfig.ripple = true;
this.User_Type = sessionStorage.getItem('userType');
this.User_Name = sessionStorage.getItem('userName');
this.User_Id[0]['user_id'] = sessionStorage.getItem('userId');
@@ -284,12 +283,12 @@ export class HotelBookingViewComponent {
this.itinerary_tab_data = data;
this.WhatsApp_Support = data[0] ? data[0].is_whatsapp_notify : false;//added is whatapp check of agency
if (this.itinerary_tab_data[0].payment_mode) {
this.updateAccountingPayForm.get('payment_mode').setValue(this.itinerary_tab_data[0].payment_mode);
this.updateAccountingPayForm.get('payment_mode')?.setValue(this.itinerary_tab_data[0].payment_mode);
}
if (this.itinerary_tab_data.assigned_user) {
this.itinerary_tab_data.assigned_user == this.User_Id[0]['user_id'] ? this.User_Id[0]['user_name'] = this.User_Name : this.itinerary_tab_data = [{ user_id: this.itinerary_tab_data.assigned_user, user_name: this.itinerary_tab_data.assigned_user_name }]
}
let hotelCities = [];
let hotelCities: any[] = [];
if (this.itinerary_tab_data.length > 0 && this.itinerary_tab_data) {
this.itinerary_tab_data.forEach(e => {
e.reserved_timeline_local = e.reserved_timeline_local ? this.commonserv.UtcToLocaleTime(e.reserved_timeline_local, 'DD MMM YYYY, HH:mm:ss') : e.reserved_timeline_local;
@@ -347,7 +346,7 @@ export class HotelBookingViewComponent {
mapHotelBkgDeadline(data) {
let agent_cancellation_policy = data.cancellation_policy.filter(x => x.from_type == 'agent').sort(function (a, b) { return a.sequence_no - b.sequence_no });
let dateTimeArray = [];
let dateTimeArray: any[] = [];
if (agent_cancellation_policy && agent_cancellation_policy.length > 0) {
agent_cancellation_policy.forEach(cp => {
let date = cp.deadline_date_from != null && cp.deadline_date_from != '' ? this.commonserv.UtcToLocaleTime(cp.deadline_date_from, 'DD MMM YYYY') : '';
@@ -370,7 +369,7 @@ export class HotelBookingViewComponent {
this.APIServ.getPassengerDetails(this.trip_id).subscribe((data: any) => {
if (data) {
this.guest_tab_data = data;
this.guest_tab_data.map(li => {
this.guest_tab_data?.map(li => {
li.booking_date = this.commonserv.UtcToLocaleTime(li.booking_date, 'DD MMM YYYY, HH:mm:ss')
})
this.tab_data_status.passenger = "success";
@@ -386,12 +385,12 @@ export class HotelBookingViewComponent {
this.costing_tab_data = null;
this.APIServ.getCostingDetails(this.trip_id).subscribe((data: any) => {
if (data) {
let booking_list = [];
let booking_list: any[] = [];
data.map(bkg => {
let Supplements = [];
let contract_name = [];
let Offers = [];
let room_name = [];
let Supplements: any[] = [];
let contract_name: any[] = [];
let Offers: any[] = [];
let room_name: any[] = [];
let booking_count = 1;
let obj_agency_currency = this.currency_list.find(x => x.currency_code == bkg.currency);
let agency_decimal_definer = obj_agency_currency ? obj_agency_currency.currency_deci_definer : '2';
@@ -440,7 +439,7 @@ export class HotelBookingViewComponent {
room_rate_det.total = this.commonserv.amountDefiner(room_rate_det.total,supplier_decimal_definer)
}
})
let room_details_arr = [];
let room_details_arr: any[] = [];
bkg.room_list.forEach((room_det,i)=>{
room_det['hotel_confirmation_number'] = room_det.hotel_confirmation_number;
room_det['booking_id'] = bkg.booking_id;
@@ -517,9 +516,9 @@ export class HotelBookingViewComponent {
this.payment_tab_data.total_paid_amount = this.commonserv.amountDefiner(this.payment_tab_data.total_paid_amount, this.agency_decimal_definer);
this.payment_tab_data.total_pending_amount = this.commonserv.amountDefiner(this.payment_tab_data.total_pending_amount, this.agency_decimal_definer);
this.updateAccountingPayForm.get('currency').setValue(this.payment_tab_data.booking_list[0].invoice_currency);
this.updateAccountingPayForm.get('booking_id').setValue(this.payment_tab_data.booking_list[0].booking_id);
this.updateAccountingPayForm.get('pending_amt').setValue(this.payment_tab_data.total_pending_amount);
this.updateAccountingPayForm.get('currency')?.setValue(this.payment_tab_data.booking_list[0].invoice_currency);
this.updateAccountingPayForm.get('booking_id')?.setValue(this.payment_tab_data.booking_list[0].booking_id);
this.updateAccountingPayForm.get('pending_amt')?.setValue(this.payment_tab_data.total_pending_amount);
if (this.payment_tab_data.booking_list) {
this.payment_tab_data.booking_list.map(x => {
@@ -729,9 +728,9 @@ export class HotelBookingViewComponent {
hotel_confirmation_number_date:obj.hotel_confirmation_number_date,
hotel_confirmation_staff_name:obj.hotel_confirmation_staff_name,
hotel_confirmation_staff_remarks:obj.hotel_confirmation_staff_remarks,
hotel_rooms:[]
hotel_rooms:[] as any[]
}
let hotel_confirm_number = [];
let hotel_confirm_number: any[] = [];
obj.hotel_confirmation_number.forEach(data=>{
hotel_confirm_number.push(
{
@@ -759,7 +758,7 @@ export class HotelBookingViewComponent {
}
let obj = {
booking_refrence_number: this.trip_id,
booking_notes_free_text: this.notesform.get('Note').value,
booking_notes_free_text: this.notesform.get('Note')?.value || '',
};
this.APIServ.saveNotesDetail(obj).subscribe((data) => {
if (data) {
@@ -875,7 +874,7 @@ export class HotelBookingViewComponent {
isOpenSendEmailModal: boolean = false;
isOpenAddBookingCancelModal: boolean = false;
selectedItinerary = [];
selectedItinerary:any[] = [];
showModalDialog() {
this.displayModal = true;
}
@@ -905,7 +904,7 @@ export class HotelBookingViewComponent {
this.UpdAccountPayStatus = true;
}
rateBreakupModal(obj_booking) {
let obj = [];
let obj: any[] = [];
if (obj_booking.room_rate_list != null) {
obj_booking.room_rate_list.map(room => {
obj.push({
@@ -919,7 +918,7 @@ export class HotelBookingViewComponent {
this.rateBreakup = true;
}
mapNightlyRate(nightly_rate) {
let obj = [];
let obj: any[] = [];
nightly_rate.map(rate => {
let obj_base_price = rate.PriceDetails.find(x => x.PriceDetailType == 'BasePrice');
let obj_agency_currency = this.currency_list.find(x => x.currency_code == obj_base_price.Currency);
@@ -978,7 +977,7 @@ export class HotelBookingViewComponent {
});
//set the default email Id of user in the send mail field
if(this.booking_customer_data){
this.mailForm.get('email_id').setValue(this.booking_customer_data['guest_email_address']);
this.mailForm.get('email_id')?.setValue(this.booking_customer_data['guest_email_address']);
}
this.selected__mail_document_type = document_type;
this.isOpenSendEmailModal = true;
@@ -995,7 +994,7 @@ export class HotelBookingViewComponent {
//let cancellation_policy = [{ "from_type": "supplier", "room_name": "Double room ? Disability access", "cancellation_policy_text": null, "sequence_no": 2, "deadline_date_from": "2022-09-21", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-25", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 100, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398246022", "no_of_rooms": 1 }, { "from_type": "supplier", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 2, "deadline_date_from": "2022-09-21", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-25", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 100, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398247445", "no_of_rooms": 1 }, { "from_type": "agent", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 2, "deadline_date_from": "2022-09-21", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-25", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 100, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398247445", "no_of_rooms": 1 }, { "from_type": "supplier", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 2, "deadline_date_from": "2022-09-21", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-25", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 100, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398248361", "no_of_rooms": 1 }, { "from_type": "agent", "room_name": "Double room ? Disability access", "cancellation_policy_text": null, "sequence_no": 2, "deadline_date_from": "2022-09-21", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-25", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 100, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398246022", "no_of_rooms": 1 }, { "from_type": "supplier", "room_name": "Double room ? Disability access", "cancellation_policy_text": null, "sequence_no": 1, "deadline_date_from": "2022-08-22", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-21", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 0, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398246022", "no_of_rooms": 1 }, { "from_type": "agent", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 2, "deadline_date_from": "2022-09-21", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-25", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 100, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398248361", "no_of_rooms": 1 }, { "from_type": "agent", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 1, "deadline_date_from": "2022-08-22", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-21", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 0, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398248361", "no_of_rooms": 1 }, { "from_type": "agent", "room_name": "Double room ? Disability access", "cancellation_policy_text": null, "sequence_no": 1, "deadline_date_from": "2022-08-22", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-21", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 0, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398246022", "no_of_rooms": 1 }, { "from_type": "supplier", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 1, "deadline_date_from": "2022-08-22", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-21", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 0, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398248361", "no_of_rooms": 1 }, { "from_type": "supplier", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 1, "deadline_date_from": "2022-08-22", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-21", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 0, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398247445", "no_of_rooms": 1 }, { "from_type": "agent", "room_name": "DOUBLE STANDARD", "cancellation_policy_text": null, "sequence_no": 1, "deadline_date_from": "2022-08-22", "deadline_time_from": "00:00:00", "deadline_date_to": "2022-09-21", "deadline_time_to": "00:00:00", "currency": "USD", "amount": 0, "is_roomwise_policy": true, "format_type": "Flat", "hotel_room_details_id": "2208231504398247445", "no_of_rooms": 1 }];
//let cancellation_policy = [{"from_type":"supplier","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":1,"deadline_date_from":"2022-08-22","deadline_time_from":null,"deadline_date_to":"2022-08-29","deadline_time_to":null,"currency":"USD","amount":0,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218409642","no_of_rooms":1},{"from_type":"supplier","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":1,"deadline_date_from":"2022-08-22","deadline_time_from":null,"deadline_date_to":"2022-08-29","deadline_time_to":null,"currency":"USD","amount":0,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218410665","no_of_rooms":1},{"from_type":"agent","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":2,"deadline_date_from":"2022-08-29","deadline_time_from":null,"deadline_date_to":"2022-09-13","deadline_time_to":null,"currency":"USD","amount":100,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218409642","no_of_rooms":1},{"from_type":"supplier","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":2,"deadline_date_from":"2022-08-29","deadline_time_from":null,"deadline_date_to":"2022-09-13","deadline_time_to":null,"currency":"USD","amount":100,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218409642","no_of_rooms":1},{"from_type":"supplier","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":2,"deadline_date_from":"2022-08-29","deadline_time_from":null,"deadline_date_to":"2022-09-13","deadline_time_to":null,"currency":"USD","amount":100,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218408033","no_of_rooms":1},{"from_type":"agent","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":1,"deadline_date_from":"2022-08-22","deadline_time_from":null,"deadline_date_to":"2022-08-29","deadline_time_to":null,"currency":"USD","amount":0,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218410665","no_of_rooms":1},{"from_type":"agent","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":1,"deadline_date_from":"2022-08-22","deadline_time_from":null,"deadline_date_to":"2022-08-29","deadline_time_to":null,"currency":"USD","amount":0,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218409642","no_of_rooms":1},{"from_type":"agent","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":2,"deadline_date_from":"2022-08-29","deadline_time_from":null,"deadline_date_to":"2022-09-13","deadline_time_to":null,"currency":"USD","amount":100,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218408033","no_of_rooms":1},{"from_type":"agent","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":1,"deadline_date_from":"2022-08-22","deadline_time_from":null,"deadline_date_to":"2022-08-29","deadline_time_to":null,"currency":"USD","amount":0,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218408033","no_of_rooms":1},{"from_type":"supplier","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":1,"deadline_date_from":"2022-08-22","deadline_time_from":null,"deadline_date_to":"2022-08-29","deadline_time_to":null,"currency":"USD","amount":0,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218408033","no_of_rooms":1},{"from_type":"supplier","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":2,"deadline_date_from":"2022-08-29","deadline_time_from":null,"deadline_date_to":"2022-09-13","deadline_time_to":null,"currency":"USD","amount":100,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218410665","no_of_rooms":1},{"from_type":"agent","room_name":"Standard Double Room,1 King Bed","cancellation_policy_text":null,"sequence_no":2,"deadline_date_from":"2022-08-29","deadline_time_from":null,"deadline_date_to":"2022-09-13","deadline_time_to":null,"currency":"USD","amount":100,"is_roomwise_policy":false,"format_type":"Percentage","hotel_room_details_id":"2208231413218410665","no_of_rooms":1}];
console.log(cancellation_policy);
let room_list = [];
let room_list: any[] = [];
if (cancellation_policy) {
if (cancellation_policy.some(x => x.is_roomwise_policy)) {
this.is_roomwise_policy = true;
@@ -1039,7 +1038,7 @@ export class HotelBookingViewComponent {
isOpen ? this.isOpenCancellationPolicyModal = true : '';
}
mapCancellationPolicy(cancellation_policy) {
let resp = [];
let resp: any[] = [];
cancellation_policy.map(item => {
if (item.format_type == 'Percentage' || item.format_type == 'Flat' || item.format_type == 'Night' || item.format_type == 'Nights') {
let obj_currency = item.format_type == 'Flat' && item.currency != null && item.currency != '' ? this.currency_list.find(x => x.currency_code == item.currency) : null;
@@ -1173,7 +1172,7 @@ export class HotelBookingViewComponent {
this.validationServ.showValidationsMsg(this.statusArr.controls[ind]);
return;
};
let val = this.StatusGroup.get('statusArr').value;
let val = this.StatusGroup.get('statusArr')?.value;
let hotelBookingModify = {
booking_id: BookingId,
status_id: val[ind].status

View File

@@ -1 +1 @@
<hotel-booking-search></hotel-booking-search>
<hotel-booking-search></hotel-booking-search>

View File

@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
standalone: false,
selector: 'app-hotel-booking',
templateUrl: './hotel-booking.component.html',
})

View File

@@ -6,7 +6,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { RouterModule, Routes } from '@angular/router';
import { NgSelectModule } from '@ng-select/ng-select';
import { ButtonModule } from 'primeng/button';
import { CalendarModule } from 'primeng/calendar';
import { DatePickerModule } from 'primeng/datepicker';
import { DialogModule } from 'primeng/dialog';
import { TableModule } from "primeng/table";
import { MatCheckboxModule } from '@angular/material/checkbox';
@@ -22,9 +22,9 @@ import { InputNumberModule } from 'primeng/inputnumber';
import { TreeModule } from 'primeng/tree';
import { RatingModule } from 'primeng/rating';
import { HotelBookingViewComponent } from './hotel-booking-view/hotel-booking-view.component';
import { TabViewModule } from 'primeng/tabview';
import { TabsModule } from 'primeng/tabs';
import { MatButtonModule } from '@angular/material/button';
import { HotelBookingManagementService } from 'src/app/core/services/HotelServices/hotel_booking_management.service';
import { HotelBookingManagementService } from '../../../core/services/HotelServices/hotel_booking_management.service';
//
const routes: Routes = [
{
@@ -48,7 +48,7 @@ const routes: Routes = [
NgSelectModule,
FormsModule,
ReactiveFormsModule,
CalendarModule,
DatePickerModule,
InputTextModule,
InputNumberModule,
TreeModule,
@@ -62,7 +62,7 @@ const routes: Routes = [
DialogModule,
RippleModule,
ToastModule,
TabViewModule,
TabsModule,
MatMenuModule,
MatTabsModule,
MatButtonModule,

View File

@@ -1,8 +1,9 @@
import { trigger, state, style, transition, animate } from '@angular/animations';
import { Component, Input } from '@angular/core';
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
import { ActiveSidebarService } from '../../../../core/services/active-sidebar.service';
@Component({
standalone: false,
selector: 'custom-sidebar-item',
templateUrl: './custom-sidebar-item.component.html',
animations: [

View File

@@ -1,15 +1,16 @@
import { ChangeDetectorRef, Component, ElementRef, Renderer2, ViewChild } from '@angular/core';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
import { API } from 'src/app/core/services/api.service';
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
import { CommonFunctionService } from '../../../core/common/common-function.service';
import { ActiveSidebarService } from '../../../core/services/active-sidebar.service';
import { API } from '../../../core/services/api.service';
import { BreakpointsService } from '../../../core/services/breakpoints.services';
import { MenuItem } from 'primeng/api';
import { securityFunctions } from 'src/app/core/common/security';
import { securityFunctions } from '../../../core/common/security';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { filter } from 'rxjs';
import { NavigationEnd, Router } from '@angular/router';
@Component({
standalone: false,
selector: 'custom-sidebar',
templateUrl: './custom-sidebar.component.html',
animations: [
@@ -88,7 +89,7 @@ export class CustomSidebarComponent {
return this.ApiSer.AdminGet('/MenuMasterNew/GetAllMenuByUserId/' + LoginUserData.user_id + '/2405170833594899108')
}
BindMenu(list) {
let aisemenu = [];
let aisemenu: MenuItem[] = [];
let FliterList = list.sort(function (a, b) { return a.sequence - b.sequence; });
let AllParentlist = list.filter(e => e.parent_id == '');
AllParentlist.forEach(e => {
@@ -159,7 +160,7 @@ export class CustomSidebarComponent {
menu = false;
for (let ind = i + 1; ind < items.length; ind++) {
if (items[ind].items) {
items[ind].items.forEach(sub_item => sub_item.styleClass = '')
items[ind].items?.forEach(sub_item => sub_item.styleClass = '')
}
}
return true;
@@ -170,7 +171,7 @@ export class CustomSidebarComponent {
item.styleClass = 'parent-menu-active';
for (let ind = i + 1; ind < items.length; ind++) {
if (items[ind].items) {
items[ind].items.forEach(sub_item => sub_item.styleClass = '')
items[ind].items?.forEach(sub_item => sub_item.styleClass = '')
}
}
// this.RemoveSubmenuActive(items,index+1);
@@ -186,9 +187,9 @@ export class CustomSidebarComponent {
}
// Get the active panel (the expanded one)
const activePanel = document.querySelector('.menu');
const selected_panel = activePanel.querySelector('.active-panel')
const selected_panel = activePanel?.querySelector('.active-panel')
selected_panel?.classList.remove("active-panel")
const panel = activePanel.querySelector('.p-highlight')?.closest('.p-panelmenu-panel');
const panel = activePanel?.querySelector('.p-highlight')?.closest('.p-panelmenu-panel');
// Add 'active-panel' class to the currently active panel
if (panel) {

View File

@@ -1,8 +1,9 @@
import { Component } from "@angular/core";
import * as moment from "moment";
import { securityFunctions } from "src/app/core/common/security";
import moment from "moment";
import { securityFunctions } from "../../../core/common/security";
@Component({
standalone: false,
templateUrl: './footer.component.html',
selector: 'app-footer'
})

View File

@@ -1,14 +1,15 @@
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { ChangeDetectorRef, Component, ElementRef, OnInit, Renderer2, ViewChild } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { PrimeNGConfig } from 'primeng/api';
// import { PrimeNGConfig } from 'primeng/api';
import { Subject, takeUntil } from 'rxjs';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
import { API } from 'src/app/core/services/api.service';
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
import { CommonFunctionService } from '../../../core/common/common-function.service';
import { ActiveSidebarService } from '../../../core/services/active-sidebar.service';
import { API } from '../../../core/services/api.service';
import { BreakpointsService } from '../../../core/services/breakpoints.services';
@Component({
standalone: false,
templateUrl: './header.component.html',
selector: 'app-header',
})
@@ -71,7 +72,7 @@ export class HeaderComponent implements OnInit {
? (this.ChcekSidebar.activeSide = '') : (this.ChcekSidebar.activeSide = 'IsActive'); this.cd.detectChanges();
if (sessionStorage.getItem("logo")) {
const favicon = document.getElementById('favIcon') as HTMLLinkElement;
let res = JSON.parse(sessionStorage.getItem("logo"));
let res = JSON.parse(sessionStorage.getItem("logo") || '{}');
if (res != null) if (res["logo"] != null) {
this.orgLogo = res["logo"];
this.commonF.logo = this.orgLogo

View File

@@ -1,13 +1,14 @@
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { MenuItem } from 'primeng/api';
import { ActiveSidebarService } from 'src/app/core/services/active-sidebar.service';
import { ActiveSidebarService } from '../../../core/services/active-sidebar.service';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Subject, takeUntil } from 'rxjs';
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
import { API } from 'src/app/core/services/api.service';
import { securityFunctions } from 'src/app/core/common/security';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { BreakpointsService } from '../../../core/services/breakpoints.services';
import { API } from '../../../core/services/api.service';
import { securityFunctions } from '../../../core/common/security';
import { CommonFunctionService } from '../../../core/common/common-function.service';
@Component({
standalone: false,
templateUrl: './sidebar.component.html',
selector: 'side-bar',
})
@@ -135,7 +136,7 @@ export class SideBarComponent implements OnInit {
return this.ApiSer.AdminGet('/MenuMasterNew/GetAllMenuByUserId/' + LoginUserData.user_id + '/2405170833594899108')
}
BindMenu(list) {
let aisemenu = [];
let aisemenu: MenuItem[] = [];
let FliterList = list.sort(function (a, b) { return a.sequence - b.sequence; });
let AllParentlist = list.filter(e => e.parent_id == '');
AllParentlist.forEach(e => {

View File

@@ -1,14 +1,15 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import moment from 'moment';
import { of } from 'rxjs';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { environment } from 'src/environments/environment';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { ValidationService } from '../../../../../core/common/validation.service';
import { API } from '../../../../../core/services/api.service';
import { environment } from '../../../../../../environments/environment';
@Component({
standalone: false,
selector: 'app-activity-add-on-add',
templateUrl: './activity-add-on-add.component.html',
})
@@ -22,8 +23,8 @@ Edit_Id: string;
{ key: 'Per Service', value: 'PERSERVICE' },
];
vendorList: any[] = [];
fileInfo = [];
fileArr = [];
fileInfo: any[] = [];
fileArr: File[] = [];
editResp: any;
constructor(
@@ -97,11 +98,11 @@ Edit_Id: string;
}
// Set file and preview URL
this.AddOnForm.get(controlName).setValue(file);
this.AddOnForm.get(controlName)?.setValue(file);
const urlReader = new FileReader();
urlReader.readAsDataURL(file);
urlReader.onload = () => {
this.AddOnForm.get('addonImageUrl').setValue(urlReader.result?.toString());
this.AddOnForm.get('addonImageUrl')?.setValue(urlReader.result?.toString());
};
};
} else {
@@ -111,8 +112,8 @@ Edit_Id: string;
}
RemoveImage() {
this.AddOnForm.get('addonImage').setValue('');
this.AddOnForm.get('addonImageUrl').setValue('');
this.AddOnForm.get('addonImage')?.setValue('');
this.AddOnForm.get('addonImageUrl')?.setValue('');
}
getById() {
@@ -120,21 +121,21 @@ Edit_Id: string;
if (res && res.status) {
this.editResp = res.data;
this.HandleApplyRateOn(this.editResp.applyRateOn)
this.AddOnForm.get('addOn').setValue(this.editResp.activityAddonDetails.addOn);
this.AddOnForm.get('defaultLanguageCode').setValue(this.editResp.defaultLanguageCode);
this.AddOnForm.get('description').setValue(this.editResp.activityAddonDetails.description);
this.AddOnForm.get('applyRateOn').setValue(this.editResp.applyRateOn);
this.AddOnForm.get('currency').setValue(this.editResp.currency);
this.AddOnForm.get('addOn')?.setValue(this.editResp.activityAddonDetails.addOn);
this.AddOnForm.get('defaultLanguageCode')?.setValue(this.editResp.defaultLanguageCode);
this.AddOnForm.get('description')?.setValue(this.editResp.activityAddonDetails.description);
this.AddOnForm.get('applyRateOn')?.setValue(this.editResp.applyRateOn);
this.AddOnForm.get('currency')?.setValue(this.editResp.currency);
this.AddOnForm.get('adult')?.setValue(this.editResp.adult);
this.AddOnForm.get('child')?.setValue(this.editResp.child);
this.AddOnForm.get('youth')?.setValue(this.editResp.youth);
this.AddOnForm.get('senior')?.setValue(this.editResp.senior);
this.AddOnForm.get('amount')?.setValue(this.editResp.amount);
this.AddOnForm.get('activityAddonVendorId').setValue(this.editResp.activityAddonVendorId || '');
this.AddOnForm.get('activityAddonVendorId')?.setValue(this.editResp.activityAddonVendorId || '');
if (this.editResp.addonImage) {
this.AddOnForm.get('addonImage').setValue(this.editResp.addonImage);
this.AddOnForm.get('addonImageUrl').setValue(this.editResp.addonImage);
this.AddOnForm.get('addonImage')?.setValue(this.editResp.addonImage);
this.AddOnForm.get('addonImageUrl')?.setValue(this.editResp.addonImage);
}
}
});

View File

@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
@Component({
standalone: false,
selector: 'app-activity-add-on-edit',
templateUrl: './activity-add-on-edit.component.html',
})

View File

@@ -2,10 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { forkJoin, of } from 'rxjs';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { ValidationService } from '../../../../../core/common/validation.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-activity-add-on-language',
templateUrl: './activity-add-on-language.component.html',
})
@@ -57,11 +58,11 @@ Edit_Id: string;
// Set default language name
const defaultLang = this.AllLang.find(lang => lang.LanguageCode === defaultLangCode);
this.AddOnLangForm.get('defaultLanguageCode').setValue(defaultLang?.LanguageName || defaultLangCode);
this.AddOnLangForm.get('defaultLanguageCode')?.setValue(defaultLang?.LanguageName || defaultLangCode);
// Set default content
this.AddOnLangForm.get('defaultAddOn').setValue(this.editResp.activityAddonDetails.addOn);
this.AddOnLangForm.get('defaultDescription').setValue(this.editResp.activityAddonDetails.description);
this.AddOnLangForm.get('defaultAddOn')?.setValue(this.editResp.activityAddonDetails.addOn);
this.AddOnLangForm.get('defaultDescription')?.setValue(this.editResp.activityAddonDetails.description);
// Remove default language from dropdown
this.AllLang = this.AllLang.filter(lang => lang.LanguageCode !== defaultLangCode);
@@ -70,7 +71,7 @@ Edit_Id: string;
}
getDataByLang() {
const langCode = this.AddOnLangForm.get('languageCode').value;
const langCode = this.AddOnLangForm.get('languageCode')?.value;
if (!langCode || !this.Edit_Id) return;
this.apiserv.Get(`/ActivityAddon/GetActivityAddonDetailsByIdAndLangCode/${this.Edit_Id}/${langCode}`).subscribe(res => {

View File

@@ -2,9 +2,10 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-activity-add-on-search',
templateUrl: './activity-add-on-search.component.html',
})

View File

@@ -6,7 +6,7 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatMenuModule } from '@angular/material/menu';
import { Routes, RouterModule } from '@angular/router';
import { NgSelectModule } from '@ng-select/ng-select';
import { CalendarModule } from 'angular-calendar';
import { DatePickerModule } from 'primeng/datepicker';
import { ButtonModule } from 'primeng/button';
import { DialogModule } from 'primeng/dialog';
import { FileUploadModule } from 'primeng/fileupload';
@@ -52,7 +52,7 @@ const routes: Routes = [
FileUploadModule,
ToolbarModule,
MatMenuModule,
CalendarModule,
DatePickerModule,
NgSelectModule,
InputTextModule,
ReactiveFormsModule,

View File

@@ -1,11 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { ValidationService } from '../../../../../core/common/validation.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-activity-category-add',
templateUrl: './activity-category-add.component.html',
})
@@ -56,9 +57,9 @@ export class ActivityCategoryAddComponent {
this.apiserv.Get(`/ActivityCategory/GetById/${this.Edit_Id}`).subscribe(res => {
if (res && res.status) {
this.editResp = res.data;
this.ActivityCategoryForm.get('categoryName').setValue(this.editResp.activityCategoryDetails.categoryName);
this.ActivityCategoryForm.get('defaultLanguageCode').setValue(this.editResp.defaultLanguageCode);
this.ActivityCategoryForm.get('parentCategoryId').setValue(this.editResp.parentCategoryId);
this.ActivityCategoryForm.get('categoryName')?.setValue(this.editResp.activityCategoryDetails.categoryName);
this.ActivityCategoryForm.get('defaultLanguageCode')?.setValue(this.editResp.defaultLanguageCode);
this.ActivityCategoryForm.get('parentCategoryId')?.setValue(this.editResp.parentCategoryId);
}
});
}

View File

@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
@Component({
standalone: false,
selector: 'app-activity-category-edit',
templateUrl: './activity-category-edit.component.html',
})

View File

@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
@Component({
standalone: false,
selector: 'app-activity-category-language',
templateUrl: './activity-category-language.component.html',
})

View File

@@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { API } from 'src/app/core/services/api.service'
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { API } from '../../../../../core/services/api.service'
@Component({
standalone: false,
selector: 'app-activity-category-search',
templateUrl: './activity-category-search.component.html',
})

View File

@@ -6,7 +6,7 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatMenuModule } from '@angular/material/menu';
import { Routes, RouterModule } from '@angular/router';
import { NgSelectModule } from '@ng-select/ng-select';
import { CalendarModule } from 'angular-calendar';
import { DatePickerModule } from 'primeng/datepicker';
import { ButtonModule } from 'primeng/button';
import { DialogModule } from 'primeng/dialog';
import { FileUploadModule } from 'primeng/fileupload';
@@ -52,7 +52,7 @@ const routes: Routes = [
FileUploadModule,
ToolbarModule,
MatMenuModule,
CalendarModule,
DatePickerModule,
NgSelectModule,
InputTextModule,
ReactiveFormsModule,

View File

@@ -2,11 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { PaginatorState } from 'primeng/paginator';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { ValidationService } from '../../../../../core/common/validation.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-hotel-zone-add',
templateUrl: './hotel-zone-add.component.html',
})
@@ -19,15 +20,15 @@ export class HotelZoneAddComponent implements OnInit {
city:false,
};
CountryList:any[] = [];
cityList=[];
cityList: any[] = [];
timer:any;
citySelection = true;
hotelList = [];
hotelList: any[] = [];
Edit_Id;
editResp;
selectedHotelList = [];
selectedHotelCheck = [];
SelectedHotels = [];
selectedHotelCheck: any[] = [];
SelectedHotels: any[] = [];
constructor(public fb:FormBuilder, public validServ:ValidationService, private apiserv:API, private commonMasterSer:CommonFunctionService, private router:Router, private activateRoute:ActivatedRoute){
@@ -74,10 +75,10 @@ export class HotelZoneAddComponent implements OnInit {
this.CountryList.push(country_obj);
this.cityList.push(city_obj);
this.hotelZoneForm.get('Country').setValue(this.editResp.country);
this.hotelZoneForm.get('City').setValue(this.editResp.city);
this.hotelZoneForm.get('ZoneName').setValue(this.editResp.zoneName);
this.hotelZoneForm.get('ZoneName').disable();
this.hotelZoneForm.get('Country')?.setValue(this.editResp.country);
this.hotelZoneForm.get('City')?.setValue(this.editResp.city);
this.hotelZoneForm.get('ZoneName')?.setValue(this.editResp.zoneName);
this.hotelZoneForm.get('ZoneName')?.disable();
this.getHotelsByCity(true);
}
});
@@ -117,7 +118,7 @@ export class HotelZoneAddComponent implements OnInit {
"languageCode": "EN",
"lattitude": "0",
"longitude": "0",
"CountryCode": this.hotelZoneForm.get('Country').value || '',
"CountryCode": this.hotelZoneForm.get('Country')?.value || '',
}
this.timer = setTimeout(() => {
this.apiserv.PostGo(`/Hotel/GetHotelCities`, req).subscribe(res => {
@@ -131,8 +132,8 @@ export class HotelZoneAddComponent implements OnInit {
}
checkCountrySelection(){
let val = this.hotelZoneForm.get('Country').value;
this.hotelZoneForm.get('City').setValue('');
let val = this.hotelZoneForm.get('Country')?.value;
this.hotelZoneForm.get('City')?.setValue('');
if(val){
this.citySelection = false;
}else {
@@ -142,8 +143,8 @@ export class HotelZoneAddComponent implements OnInit {
}
getHotelsByCity(check?){
let cityVal =this.hotelZoneForm.get('City').value;
let countryVal =this.hotelZoneForm.get('City').value;
let cityVal =this.hotelZoneForm.get('City')?.value;
let countryVal =this.hotelZoneForm.get('City')?.value;
if(countryVal && cityVal){
this.selectedHotelList = [];
this.apiserv.Get(`/ActivityHotelZone/GetHotelByCityCode/${cityVal}`).subscribe(res => {
@@ -167,14 +168,14 @@ export class HotelZoneAddComponent implements OnInit {
}
});
if(this.hotelList.every(hotelDet=> hotelDet['check'] )){
this.hotelZoneForm.get('selectAll').setValue(true);
this.hotelZoneForm.get('selectAll')?.setValue(true);
}else {
this.hotelZoneForm.get('selectAll').setValue(false);
this.hotelZoneForm.get('selectAll')?.setValue(false);
}
}
SelectDeselectHotels(){
let val = this.hotelZoneForm.get('selectAll').value;
let val = this.hotelZoneForm.get('selectAll')?.value;
this.hotelList.forEach(hotelDet=>{
hotelDet['check'] = val;
});
@@ -199,7 +200,7 @@ export class HotelZoneAddComponent implements OnInit {
City:formVal.City,
Hotels:'',
};
let hotel_arr = [];
let hotel_arr: any[] = [];
this.hotelList.forEach(hotelDet=>{
if(hotelDet['check']){
hotel_arr.push(hotelDet.hotelId);

View File

@@ -1,6 +1,7 @@
import { Component } from '@angular/core';
@Component({
standalone: false,
selector: 'app-hotel-zone-edit',
templateUrl: './hotel-zone-edit.component.html',
})

View File

@@ -2,10 +2,11 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import { TableModule } from 'primeng/table';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-hotel-zone-search',
templateUrl: './hotel-zone-search.component.html',
})

View File

@@ -9,7 +9,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatMenuModule } from '@angular/material/menu';
import { NgSelectModule } from '@ng-select/ng-select';
import { CalendarModule } from 'angular-calendar';
import { DatePickerModule } from 'primeng/datepicker';
import { ButtonModule } from 'primeng/button';
import { DialogModule } from 'primeng/dialog';
import { FileUploadModule } from 'primeng/fileupload';
@@ -52,7 +52,7 @@ const routes: Routes = [
ToolbarModule,
MatMenuModule,
PaginatorModule,
CalendarModule,
DatePickerModule,
ToastModule,
NgSelectModule,
InputTextModule,

View File

@@ -1,14 +1,15 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import moment from 'moment';
import { of } from 'rxjs';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { environment } from 'src/environments/environment';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { ValidationService } from '../../../../../core/common/validation.service';
import { API } from '../../../../../core/services/api.service';
import { environment } from '../../../../../../environments/environment';
@Component({
standalone: false,
selector: 'app-vehicle-master-add',
templateUrl: './vehicle-master-add.component.html',
})
@@ -17,8 +18,8 @@ export class VehicleMasterAddComponent implements OnInit {
VehicleForm: FormGroup;
AllLang;
transferVendorList;
fileInfo = [];
fileArr = [];
fileInfo: any[] = [];
fileArr: any[] = [];
vehicleTypeList = [
{ key: 'Standard', value: 'STANDARD' },
{ key: 'Sedan', value: 'SEDAN' },
@@ -89,7 +90,7 @@ export class VehicleMasterAddComponent implements OnInit {
console.log(file)
reader.readAsText(file); // Read as binary data
reader.onload = (res) => {
const binaryString = res.target.result as string;
const binaryString = res.target?.result as string;
const hasScriptTag = this.commonMasterSer.hasScriptTagInBinary(binaryString);
if (hasScriptTag) {
filedata.clear();
@@ -97,17 +98,17 @@ export class VehicleMasterAddComponent implements OnInit {
} else {
//base 64
if (contol == 'displayVehicleImage') {
this.VehicleForm.get(contol).setValue(file);
this.VehicleForm.get(contol)?.setValue(file);
} else {
this.VehicleForm.get(contol).value.push(file);
this.VehicleForm.get(contol)?.value.push(file);
}
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
if (contol == 'displayVehicleImage') {
this.VehicleForm.get('displayVehicleImageUrl').setValue(reader.result.toString());
this.VehicleForm.get('displayVehicleImageUrl')?.setValue(reader.result?.toString());
} else {
this.VehicleForm.get('vehicleImagesUrl').value.push(reader.result.toString());
this.VehicleForm.get('vehicleImagesUrl')?.value.push(reader.result?.toString());
}
}
};
@@ -119,12 +120,12 @@ export class VehicleMasterAddComponent implements OnInit {
}
RemoveImage(ind, contol) {
if (contol == 'displayVehicleImage') {
this.VehicleForm.get(contol).setValue('');
this.VehicleForm.get('displayVehicleImageUrl').setValue('');
this.VehicleForm.get(contol)?.setValue('');
this.VehicleForm.get('displayVehicleImageUrl')?.setValue('');
} else {
let image_url_list = this.VehicleForm.get(contol).value;
let image_url_list = this.VehicleForm.get(contol)?.value;
image_url_list.splice(ind, 1);
let image_display_url_list = this.VehicleForm.get('vehicleImagesUrl').value;
let image_display_url_list = this.VehicleForm.get('vehicleImagesUrl')?.value;
image_display_url_list.splice(ind, 1);
}
}
@@ -133,26 +134,26 @@ export class VehicleMasterAddComponent implements OnInit {
this.apiserv.Get(`/ActivityVehicle/GetById/${this.Edit_Id}`).subscribe(res => {
if (res && res.status) {
this.editResp = res.data;
this.VehicleForm.get('vehicleType').setValue(this.editResp.vehicleType);
this.VehicleForm.get('defaultLanguageCode').setValue(this.editResp.defaultLanguageCode);
this.VehicleForm.get('maxPassengerCapacity').setValue(this.editResp.maxPassengerCapacity);
this.VehicleForm.get('maxLuggageCapacity').setValue(this.editResp.maxLuggageCapacity);
this.VehicleForm.get('vehicleNumberPlate').setValue(this.editResp.vehicleNumberPlate);
this.VehicleForm.get('vehicleTransferType').setValue(this.editResp.vehicleTransferType);
this.VehicleForm.get('fuelType').setValue(this.editResp.fuelType);
this.VehicleForm.get('vehicleName').setValue(this.editResp.activityVehicleDetails.vehicleName);
this.VehicleForm.get('vehicleVendorId').setValue(this.editResp.activityVehicleDetails.vehicleVendorId || '');
this.VehicleForm.get('VehicleDescription').setValue(this.editResp.activityVehicleDetails.VehicleDescription);
this.VehicleForm.get('vehicleType')?.setValue(this.editResp.vehicleType);
this.VehicleForm.get('defaultLanguageCode')?.setValue(this.editResp.defaultLanguageCode);
this.VehicleForm.get('maxPassengerCapacity')?.setValue(this.editResp.maxPassengerCapacity);
this.VehicleForm.get('maxLuggageCapacity')?.setValue(this.editResp.maxLuggageCapacity);
this.VehicleForm.get('vehicleNumberPlate')?.setValue(this.editResp.vehicleNumberPlate);
this.VehicleForm.get('vehicleTransferType')?.setValue(this.editResp.vehicleTransferType);
this.VehicleForm.get('fuelType')?.setValue(this.editResp.fuelType);
this.VehicleForm.get('vehicleName')?.setValue(this.editResp.activityVehicleDetails.vehicleName);
this.VehicleForm.get('vehicleVendorId')?.setValue(this.editResp.activityVehicleDetails.vehicleVendorId || '');
this.VehicleForm.get('VehicleDescription')?.setValue(this.editResp.activityVehicleDetails.VehicleDescription);
if (this.editResp.vehicleImages) {
let Images_Arr = this.editResp.vehicleImages.split(',');
Images_Arr.forEach(data => {
this.VehicleForm.get('vehicleImages').value.push(data);
this.VehicleForm.get('vehicleImagesUrl').value.push(data);
this.VehicleForm.get('vehicleImages')?.value.push(data);
this.VehicleForm.get('vehicleImagesUrl')?.value.push(data);
})
}
if (this.editResp.displayVehicleImage) {
this.VehicleForm.get('displayVehicleImage').setValue(this.editResp.displayVehicleImage);
this.VehicleForm.get('displayVehicleImageUrl').setValue(this.editResp.displayVehicleImage);
this.VehicleForm.get('displayVehicleImage')?.setValue(this.editResp.displayVehicleImage);
this.VehicleForm.get('displayVehicleImageUrl')?.setValue(this.editResp.displayVehicleImage);
}
}
})
@@ -186,7 +187,7 @@ export class VehicleMasterAddComponent implements OnInit {
activityVehicleDetailsId: this.editResp ?this.editResp.activityVehicleDetails.activityVehicleDetailsId :''
},
}
let vehicleImages_arr = []
let vehicleImages_arr: any[] = []
formVal.vehicleImages.forEach((img_data, img_Ind) => {
if (typeof (img_data) == 'object' && img_data) {
let image_type = img_data.name.split('.');

View File

@@ -2,11 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { forkJoin, of } from 'rxjs';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { ValidationService } from '../../../../../core/common/validation.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-vehicle-master-language',
templateUrl: './vehicle-master-language.component.html',
})
@@ -31,15 +32,15 @@ export class VehicleMasterLanguageComponent implements OnInit {
forkJoin(
this.GetAllLAng(),
this.GetById(this.Edit_Id)
).subscribe(res=>{
).subscribe((res: any[])=>{
if(res && res.length > 0){
this.AllLang = res[0];
if(res[1] && res[1].status){
this.editResp = res[1].data;
this.VehicleManageLangForm.get('defaultvehicleName').setValue(this.editResp.activityVehicleDetails.vehicleName);
this.VehicleManageLangForm.get('defaultVehicleDescription').setValue(this.editResp.activityVehicleDetails.vehicleDescription);
this.VehicleManageLangForm.get('defaultvehicleName')?.setValue(this.editResp.activityVehicleDetails.vehicleName);
this.VehicleManageLangForm.get('defaultVehicleDescription')?.setValue(this.editResp.activityVehicleDetails.vehicleDescription);
const index = this.AllLang.findIndex(lang => lang.LanguageCode === this.editResp.defaultLanguageCode);
this.VehicleManageLangForm.get('defaultLanguageCode').setValue(this.AllLang[index].LanguageName);
this.VehicleManageLangForm.get('defaultLanguageCode')?.setValue(this.AllLang[index].LanguageName);
if(index !== -1){
this.AllLang.splice(index, 1);
}
@@ -95,12 +96,12 @@ export class VehicleMasterLanguageComponent implements OnInit {
}
getDataByLang(){
let langCode = this.VehicleManageLangForm.get('languageCode').value;
let langCode = this.VehicleManageLangForm.get('languageCode')?.value;
this.apiserv.Get(`/ActivityVehicle/GetActivityVehicleDetailsByIdAndLangCode/${this.Edit_Id}/${langCode}`).subscribe(res=>{
if(res && res.data){
this.VehicleManageLangForm.get('vehicleName').setValue(res.data.vehicleName);
this.VehicleManageLangForm.get('vehicleDescription').setValue(res.data.vehicleDescription);
this.VehicleManageLangForm.get('activityVehicleDetailsId').setValue(res.data.activityVehicleDetailsId);
this.VehicleManageLangForm.get('vehicleName')?.setValue(res.data.vehicleName);
this.VehicleManageLangForm.get('vehicleDescription')?.setValue(res.data.vehicleDescription);
this.VehicleManageLangForm.get('activityVehicleDetailsId')?.setValue(res.data.activityVehicleDetailsId);
}
})
}

View File

@@ -1,10 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import { CommonFunctionService } from 'src/app/core/common/common-function.service';
import { API } from 'src/app/core/services/api.service';
import { CommonFunctionService } from '../../../../../core/common/common-function.service';
import { API } from '../../../../../core/services/api.service';
@Component({
standalone: false,
selector: 'app-vehicle-master-search',
templateUrl: './vehicle-master-search.component.html',
})

View File

@@ -6,7 +6,7 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatMenuModule } from '@angular/material/menu';
import { RouterModule, Routes } from '@angular/router';
import { NgSelectModule } from '@ng-select/ng-select';
import { CalendarModule } from 'angular-calendar';
import { DatePickerModule } from 'primeng/datepicker';
import { ButtonModule } from 'primeng/button';
import { DialogModule } from 'primeng/dialog';
import { FileUploadModule } from 'primeng/fileupload';
@@ -52,7 +52,7 @@ const routes: Routes = [
FileUploadModule,
ToolbarModule,
MatMenuModule,
CalendarModule,
DatePickerModule,
NgSelectModule,
InputTextModule,
ReactiveFormsModule,

View File

@@ -1,31 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
// import { ExpServicesComponent } from './exp-services/exp-services.component';
const routes: Routes = [
{
path: 'ExpServices',
loadChildren: () =>
import('./exp-services/exp-services.module').then(
(m) => m.ExpServicesModule
),
},
{
path: 'HotelZone',
loadChildren: () =>
import('./hotel-zone-services/hotel-zone-services.module').then(
(m) => m.HotelZoneServicesModule
),
},
{
path: '',
pathMatch: 'full',
redirectTo: 'search',
},
];
@NgModule({
declarations: [],
imports: [CommonModule, RouterModule.forChild(routes)],
})
export class ActivityServicesModule {}

View File

@@ -1,236 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Search']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Experience Manage Translation</div>
<div [formGroup]="formdata">
<div class="app-mainCard">
<div class="app-mainGrid4">
<div>
<label class="formLabel">Default Language</label>
<ng-select [multiple]="false" formControlName="def_language_code" [readonly]="true" [items]="ServiceLanguages" bindValue="lov_value" bindLabel="lov_value" #select>
<ng-template ng-header-tmp>
<div class="select-mobileHeader">
<button matRipple class="select-mobileBack">
<i class="material-icons"> arrow_back </i>
</button>
<div class="select-mobileTitle">Service Language</div>
</div>
<div class="select-search">
<span class="material-icons"> search </span>
<input type="text" #search (input)="select.filter(search.value)" />
</div>
</ng-template>
</ng-select>
</div>
<div>
<label class="formLabel">Translate To</label>
<ng-select [multiple]="false" [items]="Languages" (change)="getactivity()" formControlName="language_code" bindValue="lov_value" bindLabel="lov_value" #select>
<ng-template ng-header-tmp>
<div class="select-mobileHeader">
<button matRipple class="select-mobileBack">
<i class="material-icons"> arrow_back </i>
</button>
<div class="select-mobileTitle">Service Language</div>
</div>
<div class="select-search">
<span class="material-icons"> search </span>
<input type="text" #search (input)="select.filter(search.value)" />
</div>
</ng-template>
</ng-select>
</div>
</div>
</div>
<div>
<div class="row mr-0 ml-0 MobiHide">
<div class="app-mainHeader col-lg-6">Default Language Content</div>
<div class="app-mainHeader col-lg-6">Selected Language Content</div>
</div>
<div class="app-mainCard pos-rel">
<div class="centerBorder"></div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<div>
<label class="formLabel">Experience Name</label>
<textarea class="formInput readonlyInput" formControlName="def_activity_name" rows="3" readonly type="text">
</textarea>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<div>
<label class="formLabel">Experience Name</label>
<textarea class="formInput" rows="3" formControlName="activity_name" type="text"> </textarea>
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<div>
<label class="formLabel">Departure Point</label>
<input class="formInput readonlyInput" formControlName="def_departure_point" rows="1" readonly type="text" />
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<div>
<label class="formLabel">Departure Point</label>
<input class="formInput" formControlName="departure_point" type="text" />
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label class="formLabel">Meeting Point</label>
<input class="formInput readonlyInput" rows="1" formControlName="def_meeting_point" readonly type="text" />
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<div>
<label class="formLabel">Meeting Point</label>
<input class="formInput" formControlName="meeting_point" type="text" />
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<div class="">
<label class="formLabel">Additional Pickup Details</label>
<textarea class="formInput readonlyInput" formControlName="def_additional_pick_up_details" readonly rows="1" type="text">
</textarea>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<div class="">
<label class="formLabel">Additional Pickup Details</label>
<textarea class="formInput" rows="1" formControlName="additional_pick_up_details" type="text"> </textarea>
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<div>
<label class="formLabel">Drop Off Point</label>
<input class="formInput readonlyInput" formControlName="def_drop_point" readonly type="text" />
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<div>
<label class="formLabel">Drop Off Point</label>
<input class="formInput" type="text" formControlName="drop_point" />
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label class="formLabel">Experience Highlights</label>
<textarea class="formInput readonlyInput" formControlName="def_activity_highlight" readonly rows="1" type="text">
</textarea>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label class="formLabel">Experience Highlights</label>
<textarea class="formInput" rows="1" formControlName="activity_highlight" type="text"> </textarea>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label class="formLabel">Experience Description</label>
<div class="">
<p-editor class="readonlyInput" formControlName="def_activity_description" [readonly]="true"></p-editor>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label class="formLabel">Experience Description</label>
<div class="">
<p-editor class="" formControlName="activity_description"></p-editor>
</div>
</div>
</div>
<div class="row mt-20">
<div class="app-subHeader col-lg-6 pr-40 mobiPr-15">
Day Wise Itinerary
</div>
<div class="app-subHeader col-lg-6 pl-40 mobiPl-15 MobiHide">
Day Wise Itinerary
</div>
</div>
<div class="" formArrayName="daywise_itinerary">
<div class="row mt-10" *ngFor="let group of formdata.get('daywise_itinerary')['controls']; let i = index" [formGroupName]="i">
<div class="col-lg-6 pr-40 mobiPr-15">
<label for="" class="formLabel">Day {{i + 1}}</label>
<div class="mt-10">
<p-editor class="readonlyInput" formControlName="def_Text_html" [readonly]="true"></p-editor>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label for="" class="formLabel">Day {{i +1}}</label>
<div class="mt-10">
<p-editor class="app-grid1-4" formControlName="Text_html"></p-editor>
</div>
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label class="formLabel">Restrictions/Limitations</label>
<textarea class="formInput readonlyInput" formControlName="def_activity_restriction" readonly rows="1" type="text">
</textarea>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label class="formLabel">Restrictions/Limitations</label>
<textarea class="formInput" rows="1" formControlName="activity_restriction" type="text"> </textarea>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label for="" class="formLabel">Activities</label>
<div class="mt-10">
<p-editor class="readonlyInput" formControlName="def_activities_details"></p-editor>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label for="" class="formLabel">Activities</label>
<div class="mt-10">
<p-editor class="" formControlName="activities_details"></p-editor>
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label for="" class="formLabel">Inclusions</label>
<div class="mt-10">
<p-editor class="readonlyInput" formControlName="def_activity_inclusion" [readonly]="true"></p-editor>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label for="" class="formLabel">Inclusions</label>
<div class="mt-10">
<p-editor class="" formControlName="activity_inclusion"></p-editor>
</div>
</div>
</div>
<div class="row mt-10">
<div class="col-lg-6 pr-40 mobiPr-15">
<label for="" class="formLabel">Exclusions</label>
<div class="mt-10">
<p-editor class="readonlyInput" formControlName="def_activity_exclusion" [readonly]="true"></p-editor>
</div>
</div>
<div class="col-lg-6 mobiMt-10 pl-40 mobiPl-15">
<label for="" class="formLabel">Exclusions</label>
<div class="mt-10">
<p-editor class="" formControlName="activity_exclusion"></p-editor>
</div>
</div>
</div>
</div>
<div class="row mt-20 ">
<div class="col-lg-12 text-right">
<button pButton type="button" label="Save" (click)="SaveActivityLang()" class="btn-primary"></button>
</div>
</div>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,196 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from 'primeng/api';
import { ActivityContent } from 'src/app/core/models/Experience-Service/experience-manage-languag/experience-manage-lang.model';
import { API } from 'src/app/core/services/api.service';
@Component({
selector: 'app-exp-manage-translation',
templateUrl: './exp-manage-translation.component.html',
})
export class ExpManageTranslationComponent implements OnInit {
constructor(private ApiServ: API, private router: Router, public MsgService : MessageService ,private route: ActivatedRoute, public fb: FormBuilder) { }
formdata: FormGroup
ServiceLanguages;
Languages;
ngOnInit(): void {
this.GetLOVLanguage();
this.GetDefaultActivity();
this.formdata = this.fb.group({
language_code: [''],
def_language_code: [''],
activity_name: [''],
def_activity_name: [''],
departure_point: [''],
def_departure_point: [''],
meeting_point: [''],
def_meeting_point: [''],
drop_point: [''],
def_drop_point: [''],
activity_highlight: [''],
def_activity_highlight: [''],
activity_description: [''],
def_activity_description: [''],
activity_restriction: [''],
def_activity_restriction: [''],
activities_details: [''],
def_activities_details: [''],
activity_inclusion: [''],
def_activity_inclusion: [''],
activity_exclusion: [''],
def_activity_exclusion: [''],
additional_pick_up_details: [''],
def_additional_pick_up_details: [''],
daywise_itinerary: this.fb.array([]),
})
}
/**
* @author Abdul Razzak
* to get LOV data
*/
GetLOVLanguage() {
let formdata = {
"lov_types": [{ "lov_type": "Language" }],
"lov_lang": "en"
}
this.ApiServ.Post("/LovMaster/GetLov", formdata).subscribe(data => {
if (data) {
console.log(data)
this.ServiceLanguages = data['responseObject']['0']['keys'];
this.Languages = data['responseObject']['0']['keys'];
}
});
};
// GetActivityContent() {
// this.ApiServ.Get('/Activity/GetActivityContent/')
// }
activity_id;
GetDefaultActivity() {
this.route.queryParams.subscribe(d => {
if (d['id']) {
this.activity_id = d['id']
this.GetActivityDetails(d['id'],'','def_');
}
});
};
getactivity(){
let lang = this.formdata.get('language_code').value;
this.GetActivityDetails(this.activity_id , lang , false);
}
GetActivityDetails(Id,lang,check){
this.ApiServ.Get('/Activity/GetActivityContent/' + Id + '?LangCode=' + lang).subscribe(data => {
if (data) {
console.log(data,)
this.Setvalue(data.responseObject, check)
}
});
}
Setvalue(data, check) {
let value = this.formdata.getRawValue()
Object.keys(value).forEach(e => {
let controlname = check ? check + e : e;
if ( e == 'activity_name' || e == 'departure_point'
|| e == 'meeting_point'
|| e == 'additional_pick_up_details'
|| e == 'drop_point' || e == 'activity_highlight' || e == 'activity_description'
|| e == 'activity_restriction' || e == 'activities_details' || e == 'activity_inclusion' || e == 'activity_exclusion'
) {
this.formdata.get(controlname).setValue(data ? data[e] : '');
}else if(e == 'language_code'){
if(check){
debugger
this.formdata.get(controlname).setValue(data ? data[e] : '');
let list = this.Languages
let ind = this.Languages.findIndex(d => d.lov_value == data[e]);
list.splice(ind, 1);
this.Languages = [...list]
}
} else if (e == 'daywise_itinerary') {
if(data){
let daywiseObj = JSON.parse(data[e]);
if (daywiseObj.length > 0 && daywiseObj) {
daywiseObj.forEach((e, l) => {
check ? this.CreateitineraryGroup(e) : '';
let html = check ? check + 'Text_html' : 'Text_html';
this.formdata.get('daywise_itinerary')['controls'][l].get(html).setValue(data ? e.Text_html : '');
})
}
} else this.cleardayswiseitinerary()
}
})
}
cleardayswiseitinerary(){
this.formdata.get('daywise_itinerary')['controls'].forEach(e => {
e.get('Text_html').setValue('');
})
};
CreateitineraryGroup(data) {
let controller = this.formdata.get('daywise_itinerary') as FormArray;
controller.push(this.fb.group({
Text_html: [],
def_Text_html: [],
city_code: [data.city_code],
country_code: [data.country_code],
}));
};
SaveActivityLang(){
let value = this.formdata.getRawValue();
let postdata = new ActivityContent();
postdata.activity_id = this.activity_id;
postdata.activity_name = value.activity_name;
postdata.supplier_id = '1232';
postdata.language_code = value.language_code;
postdata.departure_point = value.departure_point;
postdata.meeting_point = value.meeting_point;
postdata.additional_pick_up_details = value.additional_pick_up_details;
postdata.drop_point = value.drop_point;
postdata.activity_highlight = value.activity_highlight;
postdata.activity_description = value.activity_description;
postdata.activity_restriction = value.activity_restriction;
postdata.activities_details = value.activities_details;
postdata.activity_inclusion = value.activity_inclusion;
postdata.activity_exclusion = value.activity_exclusion;
let dayswiseitinerary = []
if(value.daywise_itinerary){
value.daywise_itinerary.forEach(e => {
dayswiseitinerary.push({
'Text_html' : e.Text_html,
'country_code' : e.country_code,
'city_code' : e.city_code,
})
})
}
postdata.daywise_itinerary = JSON.stringify(dayswiseitinerary);
this.ApiServ.Post('/Activity/SaveContentDetails' ,postdata).subscribe((res) => {
if(res){
this.showToastrMsg(res);
}
});
};
showToastrMsg(respData) {
this.MsgService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
};
btnClick() {
this.router.navigateByUrl("/Services/ActivityServices/ExpServices/Search");
};
}

View File

@@ -1,802 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Search']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div [formGroup]="formData">
<div class="app-mainHeader">Add Experience</div>
<div class="app-mainCard">
<div class="app-mainGrid4">
<div class="app-grid1-4">
<label class="formLabel" for="">Experience Name</label>
<textarea formControlName="activity_name"
[ngClass]="{errorInput: validationService.onBlur(formData.controls['activity_name'], 'required' )}" rows="1"
class="formInput" name="" id=""></textarea>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['activity_name'], 'required')
">Please enter experience name
</span>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="">
<label class="formLabel" for="">Experience Category</label>
<ng-select #select [items]="Experience_Type" formControlName="category_id" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['category_id'],
'required'
)
}" (change)="GetSubCategory($event.activity_category_id)" bindLabel="category_name"
bindValue="activity_category_id" class="is-invalid" placeholder="">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['category_id'], 'required')
">Please select experience category
</span>
</div>
<div class="">
<label class="formLabel" for="">Experience Sub-Category</label>
<ng-select #select [items]="SubCategory" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['Sub_Category'],
'required'
)
}" bindLabel="category_name" formControlName="Sub_Category" bindValue="activity_category_id" class="is-invalid"
placeholder="select" [multiple]="true">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['Sub_Category'],
'required'
)
">Please select experience sub category
</span>
</div>
<div>
<label class="formLabel">Emergency Number</label>
<div class="phoneBox">
<div
[ngClass]="{ 'ErrorWrapper': validationService.onBlur(formData.controls['emergency_phone_code'],'required')}">
<ng-select [items]="PhoneCode" formControlName="emergency_phone_code" bindLabel="mobile_code"
bindValue="mobile_code">
</ng-select>
<span class="errorspan"
*ngIf=" validationService.onBlur( formData.controls['emergency_phone_code'], 'required' )">Please select
phone
code
</span>
</div>
<div>
<input class="formInput formPhone" formControlName="emergency_phone_nbr" type="text"
[ngClass]="{'errorInput': validationService.onBlur(formData.controls['emergency_phone_nbr'],'required') || validationService.onBlur(formData.controls['emergency_phone_nbr'],'pattern')}" />
<span class="errorspan"
*ngIf=" validationService.onBlur( formData.controls['emergency_phone_nbr'], 'required' )">Please enter
phone number
</span>
<span class="errorspan"
*ngIf="validationService.onBlur( formData.controls['emergency_phone_nbr'], 'pattern' )"> accept only
number
</span>
</div>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class=""
[ngClass]="{ 'ErrorWrapper': validationService.onBlur(formData.controls['_service_language'],'required')}">
<label class="formLabel" for="">Service Language</label>
<ng-select #select formControlName="_service_language" [items]="Service_Language" bindValue="lov_value"
bindLabel="lov_value" class="is-invalid" placeholder="Select" [multiple]="true">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['_service_language'],
'required'
)
">Please select service language
</span>
</div>
<div class=""
[ngClass]="{ 'ErrorWrapper': validationService.onBlur(formData.controls['default_lang_code'],'required')}">
<label class="formLabel" for=""> Default Language</label>
<ng-select #select formControlName="default_lang_code" class="is-invalid" placeholder="Select"
[multiple]="false">
<ng-option *ngFor="let item of Service_Language" [value]="item.lov_value">{{ item.lov_value }}</ng-option>
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['default_lang_code'],
'required'
)
">Please select default language
</span>
</div>
<div>
<label class="formLabel" for="">Service Duration Days</label>
<div class="mobiGrid app-mainGrid3">
<div class="w-33">
<ng-select #select [items]="CommonVari.days" formControlName="service_days" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['service_days'],
'required'
)
}" placeholder="Days" [multiple]="false" bindLabel="name" (change)="DaysItineryForm($event.id)"
bindValue="id" [multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['service_days'],
'required'
)
">Please select days
</span>
</div>
<div class="w-33">
<ng-select #select [items]="CommonVari.Hours" [multiple]="false" bindLabel="name" bindValue="id"
placeholder="Hours" formControlName="service_hours" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['service_hours'],
'required'
)
}" [multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['service_hours'],
'required'
)
">Please select hours
</span>
</div>
<div class="w-33">
<ng-select #select [items]="CommonVari.minutes" [multiple]="false" bindLabel="name" bindValue="id"
formControlName="service_minutes" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['service_minutes'],
'required'
)
}" placeholder="Minutes" [multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['service_minutes'],
'required'
)
">Please select minutes
</span>
</div>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['country_code'],
'required'
)
}">
<label class="formLabel" for="">Country</label>
<ng-select #select [items]="AllCountry" (change)="getcity($event, 'CountryManda' , 0 , false)"
formControlName="country_code" bindLabel="country_name" bindValue="alpha_2_code" placeholder="Select"
[multiple]="true">
</ng-select>
<span class="errorspan" *ngIf="validationService.onBlur( formData.controls['country_code'],'required')">Please
select country
</span>
</div>
<div class="" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['city_id'],
'required'
)
}">
<label class="formLabel" for="">City</label>
<ng-select #select [items]="allCityDetials[0]" (change)="GetStartingCity(true)" formControlName="city_id"
bindLabel="city_name" bindValue="city_id" class="is-invalid" placeholder="Select" [multiple]="true">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['city_id'], 'required')
">Please select city
</span>
</div>
<div class="" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['starting_city'],
'required'
)
}">
<label class="formLabel" for="">Starting City</label>
<ng-select #select [items]="Allstartingcity" formControlName="starting_city" bindLabel="city_name"
bindValue="city_id" class="is-invalid" placeholder="Select" [multiple]="false">
<ng-template ng-header-tmp>
<div class="select-mobileHeader">
<button matRipple class="select-mobileBack">
<i class="material-icons"> arrow_back </i>
</button>
<div class="select-mobileTitle">Starting City</div>
</div>
<div class="select-search">
<span class="material-icons"> search </span>
<input type="text" #search (input)="select.filter(search.value)" />
</div>
</ng-template>
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['starting_city'], 'required')
">Please select starting city
</span>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class=""
[ngClass]="{ 'ErrorWrapper': validationService.onBlur(formData.controls['is_pickup_included'], 'required' ) }">
<label class="formLabel" for="">Pickup Included</label>
<ng-select #select [items]="option" formControlName="is_pickup_included" (change)="PickupIncludes($event.name)"
bindValue="name" bindLabel="name" class="is-invalid" placeholder="Select" [multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['is_pickup_included'], 'required')
">Please select pickup included
</span>
</div>
<div class="app-grid1" *ngIf="allFormGroup.is_pickup_included == 'Yes' && formData.get('_pickup_point_type')"
[ngClass]="{ 'ErrorWrapper': validationService.onBlur(formData.controls['_pickup_point_type'], 'required' ) }">
<label class="formLabel" for="">Pickup Point</label>
<ng-select #select [items]="HotelPickupPointType" formControlName="_pickup_point_type"
(change)="PickupPointValid()" bindValue="lov_key" bindLabel="lov_value" class="is-invalid"
placeholder="Select" [multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="validationService.onBlur(formData.controls['_pickup_point_type'], 'required')">
Please select pickup point
</span>
</div>
<div class="" *ngIf="
allFormGroup.is_pickup_included == 'Yes' &&
allFormGroup._pickup_point_type == 1 && formData.get('_hotel_pickup_type')
" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['_hotel_pickup_type'],
'required'
)
}">
<label class="formLabel" for="">Hotel Pickup</label>
<ng-select #select [items]="HotelPickupType" [multiple]="false" (change)="Hotel_Type_AddPickupValid()"
formControlName="_hotel_pickup_type" bindValue="lov_key" bindLabel="lov_value">
</ng-select>
<span class="errorspan" *ngIf="validationService.onBlur(formData.controls['_hotel_pickup_type'], 'required')">
Please select hotel pickup
</span>
</div>
<div *ngIf="
allFormGroup.is_pickup_included == 'Yes' &&
allFormGroup._pickup_point_type == 1 && allFormGroup._hotel_pickup_type == 1
">
<div>
<label class="formLabel" for="">Pickup Before Time</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="CommonVari.Hours" formControlName="All_Hotel_hour" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['All_Hotel_hour'],'required')
}" bindValue="id" bindLabel="name" class="is-invalid mW50" placeholder="Hours" [multiple]="false">
</ng-select>
<ng-select class="mW50" #select [items]="CommonVari.minutes" bindLabel="name" placeholder="Minutes"
formControlName="All_Hotel_minute" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['All_Hotel_minute'],
'required'
)
}" bindValue="id" [multiple]="false">
</ng-select>
</div>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10" *ngIf="
allFormGroup.is_pickup_included == 'Yes' &&
allFormGroup._pickup_point_type == 1 && allFormGroup._hotel_pickup_type == 2 && formData.get('pickup_hotel')">
<div class="app-grid2">
<label class="formLabel" for="">Hotels</label>
<ng-select #select [items]="AllHotelContent" [multiple]="true" formControlName="pickup_hotel" [ngClass]="{'errorInput': validationService.onBlur(
formData.controls['pickup_hotel'],
'required'
)
}" bindValue="hotel_id" bindLabel="hotel_name" class="is-invalid" placeholder="" [multiple]="true">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['pickup_hotel'],
'required'
)
">Please select hotels
</span>
</div>
<div>
<label class="formLabel" for="">Pickup Before Time</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="CommonVari.Hours" formControlName="Specific_Hotel_hour" bindLabel="name"
bindValue="id" [ngClass]="{'errorInput': validationService.onBlur(
formData.controls['Specific_Hotel_hour'],
'required'
)
}" class="is-invalid mW50" placeholder="Hours" [multiple]="false">
</ng-select>
<ng-select #select [items]="CommonVari.minutes" formControlName="Specific_Hotel_minute" bindLabel="name"
bindValue="id" [ngClass]="{'errorInput': validationService.onBlur(
formData.controls['Specific_Hotel_minute'],
'required'
)
}" class="is-invalid mW50" placeholder="Minutes" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10" *ngIf="
allFormGroup.is_pickup_included == 'Yes' &&
allFormGroup._pickup_point_type == 1 && allFormGroup._hotel_pickup_type == 3 && formData.get('hotel_zone')">
<div class="app-grid2">
<label class="formLabel" for="">Hotel Zone</label>
<ng-select #select [items]="AllActivityHotelZone" bindLabel="zone_name" bindValue="zone_id" class="is-invalid"
formControlName="hotel_zone" placeholder="Select" [multiple]="true" [ngClass]="{'errorInput': validationService.onBlur(
formData.controls['hotel_zone'],
'required'
)
}">
</ng-select>
</div>
<div>
<label class="formLabel" for="">Pickup Before Time</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="CommonVari.Hours" bindLabel="name" bindValue="id"
formControlName="hotel_zone_hour" [ngClass]="{'errorInput': validationService.onBlur(
formData.controls['hotel_zone_hour'],
'required'
)
}" class="is-invalid mW50" placeholder="Hours" [multiple]="false">
</ng-select>
<ng-select #select [items]="CommonVari.minutes" bindLabel="name" bindValue="id"
formControlName="hotel_zone_minute" [ngClass]="{'errorInput': validationService.onBlur(
formData.controls['hotel_zone_minute'],
'required'
)
}" class="is-invalid mW50" placeholder="Minutes" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10" *ngIf="
allFormGroup.is_pickup_included == 'Yes' &&
allFormGroup._pickup_point_type == 2 && formData.get('departure_point')
">
<div class="app-grid1">
<label class="formLabel" for="">Departure Point</label>
<input class="formInput" formControlName="departure_point" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['departure_point'],
'required'
)
}" type="text" />
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['departure_point'],
'required'
)
">Please enter departure point
</span>
</div>
<div>
<label class="formLabel" for="">Pickup Before Time</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="CommonVari.Hours" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['departure_hour'],
'required'
)
}" bindLabel="name" bindValue="id" formControlName="departure_hour" class="is-invalid mW50"
placeholder="Hours" [multiple]="false">
</ng-select>
<ng-select #select [items]="CommonVari.minutes" bindLabel="name" bindValue="id" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['departure_minute'],
'required'
)
}" class="is-invalid mW50" formControlName="departure_minute" placeholder="Minutes" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10" *ngIf="allFormGroup.is_pickup_included == 'No' && formData.get('meeting_point')">
<div class="app-grid1">
<label class="formLabel" for="">Meeting Point</label>
<input class="formInput" formControlName="meeting_point" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['meeting_point'],
'required'
)
}" type="text" />
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['meeting_point'],
'required'
)
">Please enter meeting point</span>
</div>
<div>
<label class="formLabel" for="">Meeting Before Time</label>
<div class="mobiGrid app-mainGrid2">
<div [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['meeting_before_hour'],
'required'
)
}">
<ng-select #select [items]="CommonVari.Hours" formControlName="meeting_before_hour" placeholder="Hours"
[multiple]="false" bindLabel="name" bindValue="id">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['meeting_before_hour'],
'required'
)
">Please select hours
</span>
</div>
<div [ngClass]="{
'ErrorWrapper': validationService.onBlur( formData.controls['meeting_before_minute'], 'required' ) }">
<ng-select #select [items]="CommonVari.minutes" formControlName="meeting_before_minute"
placeholder="minutes" [multiple]="false" bindLabel="name" bindValue="id">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
formData.controls['meeting_before_minute'],
'required'
)
">Please select minutes</span>
</div>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel" for="">Additional Pickup Details</label>
<textarea rows="1" class="formInput" formControlName="additional_pick_up_details"></textarea>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="">
<label class="formLabel" for="">Drop Off Included</label>
<ng-select [items]="optionDropOff" formControlName="is_drop_included" (change)="dropoffvalid($event.name)"
bindValue="name" bindLabel="name">
</ng-select>
</div>
<div class="" *ngIf="allFormGroup.is_drop_included == 'Yes'">
<label class="formLabel" for="">Drop Off Point</label>
<input class="formInput" formControlName="drop_point" [ngClass]="{
errorInput: validationService.onBlur(
formData.controls['drop_point'],
'required'
)
}" type="text" />
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['drop_point'], 'required')
">Please enter drop off point
</span>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['min_pax'],
'required'
)
}">
<label class="formLabel" for="select">Min Travelers (Per Booking)</label>
<ng-select #select [items]="sequence" formControlName="min_pax" class="is-invalid" placeholder="Select"
[multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['min_pax'], 'required')
">Please select min travelers
</span>
</div>
<div class="" [ngClass]="{
'ErrorWrapper': validationService.onBlur(
formData.controls['max_pax'],
'required'
)
}">
<label class="formLabel" for="select">Max Travelers (Per Booking)</label>
<ng-select #select [items]="sequence" formControlName="max_pax" class="is-invalid" placeholder="Select"
[multiple]="false">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['max_pax'], 'required')
">Please select Max travelers
</span>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<mat-checkbox class="app-subHeader disable-opacity" [disabled]="true" formControlName="is_adult">
<div>Adult</div>
</mat-checkbox>
<div *ngIf="allFormGroup.is_adult">
<label class="formLabel" for="">Adult Age</label>
<div class="mobiGrid app-mainGrid2">
<ng-select formControlName="adult_age_from"
[ngClass]="{ 'errorInput': validationService.onBlur( formData.controls['adult_age_from'], 'required')}"
bindValue="value" bindLabel="value" #select [items]="AdultNoArray" class="is-invalid mW50"
placeholder="From" [multiple]="false">
</ng-select>
<ng-select [items]="AdultNoArray" formControlName="adult_age_to" [ngClass]="{
errorInput: validationService.onBlur(
formData.controls['adult_age_to'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="To" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<mat-checkbox class="app-subHeader" formControlName="is_senior" (change)="SeniorValid($event.checked)">
<div>Senior</div>
</mat-checkbox>
<div *ngIf="allFormGroup.is_senior">
<label class="formLabel" for="">Senior Age</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="AdultNoArray" formControlName="senior_age_from" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['senior_age_from'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="From" [multiple]="false">
</ng-select>
<ng-select #select [items]="AdultNoArray" formControlName="senior_age_to" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['senior_age_to'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="To" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<mat-checkbox class="app-subHeader" formControlName="is_youth" (change)="YouthValid($event.checked)">
<div>Youth</div>
</mat-checkbox>
<div *ngIf="allFormGroup.is_youth">
<label class="formLabel" for="">Youth Age</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="AdultNoArray" formControlName="youth_age_from" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['youth_age_from'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="From" [multiple]="false">
</ng-select>
<ng-select #select [items]="AdultNoArray" formControlName="youth_age_to" [ngClass]="{
'errorInput': validationService.onBlur(
formData.controls['youth_age_to'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="To" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<mat-checkbox class="app-subHeader" formControlName="is_child" (change)="ChildValid($event.checked)">
<div>Child</div>
</mat-checkbox>
<div *ngIf="allFormGroup.is_child">
<label class="formLabel" for="">Child Age</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="childNoArray" formControlName="child_age_from" [ngClass]="{
errorInput: validationService.onBlur(
formData.controls['child_age_from'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="From" [multiple]="false">
</ng-select>
<ng-select #select [items]="childNoArray" formControlName="child_age_to" [ngClass]="{
errorInput: validationService.onBlur(
formData.controls['child_age_to'],
'required'
)
}" bindValue="value" bindLabel="value" class="is-invalid mW50" placeholder="To" [multiple]="false">
</ng-select>
</div>
</div>
<div *ngIf="allFormGroup.is_child">
<label class="formLabel" for="">Max Child Count</label>
<div class="">
<input class="formInput" type="text" formControlName="max_child_count" />
</div>
</div>
<div *ngIf="allFormGroup.is_child">
<label class="formLabel" for="">Free Child Age</label>
<div class="mobiGrid app-mainGrid2">
<ng-select #select [items]="childNoArray" formControlName="free_child_age_from" bindValue="value"
bindLabel="value" class="is-invalid mW50" placeholder="From" [multiple]="false">
</ng-select>
<ng-select #select [items]="childNoArray" formControlName="free_child_age_to" bindValue="value"
bindLabel="value" class="is-invalid mW50" placeholder="To" [multiple]="false">
</ng-select>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<mat-checkbox formControlName="is_child_seat">
<div>Child Seat Included</div>
</mat-checkbox>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel" for="">Experience Highlights</label>
<textarea rows="1" formControlName="activity_highlight" class="formInput" name="" id=""></textarea>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel">Experience Description</label>
<p-editor class="" formControlName="activity_description" formControlName="activity_description"></p-editor>
</div>
</div>
<div class="app-subHeader" *ngIf="Itinerary.controls.length > 0">Day Wise Itinerary</div>
<div class="mt-10" formArrayName="Itinerary">
<div class="app-mainGrid4">
<div class="app-grid1-4">
<div class="mb-10" *ngFor="let group of Itinerary.controls ; let i = index" [formGroupName]="i">
<label class="formLabel">Day {{i +1}}</label>
<div class="">
<p-editor class="" formControlName="Text_html"></p-editor>
</div>
<div class="app-mainGrid4 mt-10">
<div class="">
<label class="formLabel" for="">Country</label>
<ng-select #select [items]="AllCountry" (change)="getcity($event, 'common' , (i + 1) ,false )"
formControlName="country_code" bindLabel="country_name" bindValue="alpha_2_code" class="is-invalid"
placeholder="" [multiple]="true">
</ng-select>
</div>
<div class="">
<label class="formLabel" for="">City</label>
<ng-select #select [items]="allCityDetials[i +1]" formControlName="city_code" bindLabel="city_name"
bindValue="city_id" class="is-invalid" placeholder="" [multiple]="true">
</ng-select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel" for="">Restrictions/Limitations</label>
<textarea rows="1" class="formInput" formControlName="activity_restriction" name="" id=""></textarea>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel">Activities</label>
<p-editor class="" formControlName="activities_details"></p-editor>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel">Inclusions</label>
<p-editor class="" formControlName="activity_inclusion"></p-editor>
</div>
</div>
<div class="app-mainGrid4 mt-10">
<div class="app-grid1-4">
<label class="formLabel">Exclusions</label>
<p-editor class="" formControlName="activity_exclusion"></p-editor>
</div>
</div>
<div class="mt-10 customDropzone singalSelect">
<label class="formLabel" for="">Thumbnail Image</label>
<div class="mt-10 customDropzone singalSelect">
<p-fileUpload *ngIf="!showThumbnailImg" [showUploadButton]="false" [showCancelButton]="false"
(onSelect)="getThumnailImg($event)" (onRemove)="emptyThunailImg()" name="demo[]" url="./upload.php"
class="popularDest" accept="image/*" [maxFileSize]="100000" >
</p-fileUpload>
<div class="d-flex">
<div class="p-fileupload-files" *ngIf="showThumbnailImg">
<div class="">
<div class="p-fileupload-row">
<div>
<img [src]="base64Output ? base64Output : formData.controls['thumnailImg'].value " width="50" />
</div>
<div class="p-fileupload-filename">date.PNG</div>
<div>490 B</div>
<div>
<button type="button" icon="pi pi-times" pbutton="" (click)="emptyThunailImg()"
class="p-element p-button p-component p-button-icon-only" ng-reflect-icon="pi pi-times">
<span class="p-button-icon pi pi-times" aria-hidden="true"></span><span aria-hidden="true"
class="p-button-label">&nbsp;</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<span class="errorspan" *ngIf="
validationService.onBlur(formData.controls['thumnailImg'], 'required')
">Please choose image</span>
</div>
<div class="mt-10 customDropzone">
<label class="formLabel" for="">Images</label>
<div class="mt-10 customDropzone customMultiDropzone">
<p-fileUpload name="demo[]" [showUploadButton]="false" [showCancelButton]="false" class="popularDest"
(onSelect)="getMultiGalleryImg($event)" [multiple]="true" [maxFileSize]="100000">
</p-fileUpload>
<div class="p-fileupload-files">
<div class="ng-star d-flex mt-20">
<div class="p-fileupload-row" *ngFor="let file of MultiImageGallery; let i = index">
<div><img [src]="file" width="50" class="ng-star-inserted" /></div>
<div class="p-fileupload-filename">date.PNG</div>
<div>490 B</div>
<div>
<button type="button" icon="pi pi-times" pbutton="" (click)="emptyImgGallery(i)"
class="p-element p-button p-component p-button-icon-only" ng-reflect-icon="pi pi-times">
<span class="p-button-icon pi pi-times" aria-hidden="true"></span><span aria-hidden="true"
class="p-button-label">&nbsp;</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="mt-20 w-50 appFootInput" formArrayName="VideoURL">
<label for="" class="app-subHeader">Videos (Youtube/Vimeo Url)</label>
<div *ngFor="let item of formData.get('VideoURL')['controls']; let i = index">
<div class="flex-end mb-10" [formGroupName]="i">
<input class="formInput mt-10" formControlName="activity_videos" type="text" />
<div class="ml-20">
<button pButton *ngIf="i == 0" icon="pi pi-plus" class="btn-icon" (click)="addvideo()"></button>
<button pButton *ngIf="i != 0" icon="pi pi-minus" class="btn-icon" (click)="removevideo(i)"></button>
</div>
</div>
</div>
</div>
</div>
<div class="app-mainHeader mt-20">Traveler Required Information</div>
<div class="app-mainCard">
<div formArrayName="Requirment">
<div class="mt-20" *ngFor="let group of Requirment.controls; let i = index" [formGroupName]="i">
<mat-checkbox class="mt-20 fw-600" formControlName="is_header"
(change)="requirementCheck($event.checked , group)">{{group.get('header_name').value }}
</mat-checkbox>
<div formArrayName="requirements" class="app-mainGrid5 mt-10 ml-20">
<div *ngFor="let item of group.get('requirements')['controls'];let z = index" [formGroupName]="z">
<mat-checkbox [ngClass]="{'disable-opacity' : !group.get('is_header').value }"
formControlName="is_requirement">{{item.get('requirement_name').value }}
</mat-checkbox>
</div>
</div>
</div>
</div>
<div class="row mt-20 br-top">
<div class="col-lg-12 text-right">
<button pButton type="button" label="Save" [disabled]="SaveBtn" (click)="SaveFormData()"
class="btn-primary"></button>
</div>
</div>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,971 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from 'primeng/api';
import { Observable, ReplaySubject } from 'rxjs';
import { StaticDataService } from 'src/app/core/common/static-data.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { ActivityContent, experience_add } from 'src/app/core/models/Experience-Service/experience-sevice-add/experience-service-add.model';
import { API } from 'src/app/core/services/api.service';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-exp-services-add',
templateUrl: './exp-services-add.component.html',
})
export class ExpServicesAddComponent implements OnInit {
selectedCities: string[] = [];
uploadedFiles: any[] = [];
//
user_id = '2205290611511299310'
//
formData: FormGroup;
Experience_Type;
SubCategory;
Service_Language;
CategroyDetails;
activity_id;
AllHotelContent;
HotelPickupPointType;
HotelPickupType;
showThumbnailImg: boolean;
allCityDetials = [];
Allstartingcity = [];
sequence = [];
AdultNoArray = [];
childNoArray = [];
InfantNoArray = [];
SaveBtn = false;
AllCountry;
AllActivityHotelZone;
PhoneCode;
constructor(
private messageService: MessageService,
public ApiServ: API,
public Fb: FormBuilder,
private route: ActivatedRoute,
private router: Router,
public validationService: ValidationService,
public CommonVari: StaticDataService
) { }
ngOnInit(): void {
this.GetCountryPhone();
this.agelength();
this.showThumbnailImg = false
this.ngOinitForm();
this.allCityDetials.push('');
this.GetAllRequirementView();
this.GetLOVLanguage();
this.getexperienceCate();
this.GetAllHotel();
this.GetLOVHotelPickupPointType();
this.GetLOVHotelPickupType();
this.getCountry();
this.PickupIncludes('No');
this.GetAllActivityHotelZone();
this.getID();
}
ngOinitForm(){
this.formData = this.Fb.group({
activity_name: this.validationService.required,
category_id: this.validationService.required,
Sub_Category: this.validationService.required,
emergency_phone_nbr: this.validationService.mobNo,
emergency_phone_code: this.validationService.required,
default_lang_code: this.validationService.required,
_service_language: this.validationService.required,
service_days: this.validationService.required,
service_hours: this.validationService.required,
service_minutes: this.validationService.required,
country_code: this.validationService.required,
starting_city: this.validationService.required,
city_id: this.validationService.required,
is_pickup_included: this.validationService.required,
additional_pick_up_details: [''],
Requirment: this.Fb.array([]),
pickup_hotel: [''],
is_drop_included: ['No'],
drop_point: [''],
min_pax: this.validationService.required,
max_pax: this.validationService.required,
is_adult: [true],
adult_age_from: this.validationService.required,
adult_age_to: this.validationService.required,
is_senior: [false],
senior_age_from: [null],
senior_age_to: [null],
is_youth: [false],
youth_age_from: [null],
youth_age_to: [null],
is_child: [false],
child_age_from: [null],
child_age_to: [null],
max_child_count: [''],
free_child_age_from: [null],
free_child_age_to: [null],
is_child_seat: [false],
Itinerary: this.Fb.array([
]),
activity_highlight: [''],
activity_description: [''],
activity_restriction: [''],
activities_details: [''],
activity_inclusion: [''],
activity_exclusion: [''],
VideoURL: this.Fb.array([
this.Fb.group({ activity_videos: [''] })
]),
thumnailImg: this.validationService.required,
images: this.Fb.array([]),
})
}
getCountry() {
this.ApiServ.Get('/Country/GetCountry').subscribe(data => {
if (data) {
this.AllCountry = data;
}
});
};
GetStartingCity(check) {
let val = this.formData.getRawValue();
let allcity = [];
val.city_id.forEach(e => {
let city = this.allCityDetials[0].filter(a => a.city_id == e)
allcity.push(...city);
});
this.Allstartingcity = allcity;
if (val.city_id.length > 1) {
check ? this.formData.get('starting_city').setValue('') : '';
} else {
this.formData.get('starting_city').setValue(val.city_id.join(','))
}
};
getID() {
this.route.queryParams.subscribe(d => {
if (d['id']) {
this.activity_id = d['id']
this.ApiServ.Get('/Activity/GetActivity/' + d['id']).subscribe(data => {
if (data) {
this.AllSetvalue(data['responseObject']);
}
});
}
});
};
getcity(countryId, check, ind , startcity) {
this.allCityDetials[ind] = [];
this.allCityDetials[ind].push(...[]);
let countrycode;
if (check == 'set') countrycode = countryId;
else {
let country_code = [];
countryId.map(d => {
country_code.push(d.alpha_2_code);
});
countrycode = country_code;
}
if (check == 'CountryManda') this.formData.get('city_id').setValue('');
if (countrycode.length > 0) {
this.ApiServ.Get('/City/GetCity/' + countrycode.join(',')).subscribe(data => {
if (data) {
this.allCityDetials[ind] = [];
this.allCityDetials[ind].push(...data);
startcity ? this.GetStartingCity(false) : '';
}
});
}
};
getexperienceCate() {
this.ApiServ.Get('/ActivityCategoryMaster/GetAllCategory').subscribe(data => {
if (data) {
this.Experience_Type = data['responseObject']
}
});
};
GetCountryPhone() {
this.ApiServ.Get('/CountryPhone/GetCountryPhone').subscribe(data => {
if (data) {
this.PhoneCode = data
}
});
};
AllSetvalue(d) {
let value = this.formData.getRawValue()
Object.keys(value).forEach(e => {
if (e == 'thumnailImg') {
this.formData.get(e).setValue(d['thumbnail_image'])
d['thumbnail_image'] != "" ? this.showThumbnailImg = true : this.showThumbnailImg = false
} else if (e == 'images') {
let multiImgs = JSON.parse(d['activity_images'])
this.setmultiimage(multiImgs);
} else if (e == 'category_id') {
this.formData.get(e).setValue(d['category_id']);
let sub_category_id = d['sub_category_id'].split(',');
this.GetSubCategory(d['category_id']);
setTimeout(() => {
this.formData.get('Sub_Category').setValue(sub_category_id);
}, 50);
} else if (e == "country_code") {
let value = d[e] ? d[e].split(",") : null;
this.getcity(value, 'set', 0 , true);
this.formData.get(e).setValue(value);
let city = d['city_id'] ? d['city_id'].split(",") : null;
this.formData.get('city_id').setValue(city);
this.formData.get('starting_city').setValue(d['starting_city']);
}
else if (e == '_service_language') {
let value = d[e] ? d[e].split(",") : null;
this.formData.get(e).setValue(value);
} else if (e == 'default_lang_code') {
this.formData.get(e).setValue(d[e]);
}
else if (e == 'VideoURL') {
this.setUrlLink(d['activity_videos']);
}
else if (e == 'activity_name' || e == 'departure_point' || e == 'activity_highlight'
|| e == 'activity_description' || e == 'activity_restriction' || e == 'activities_details' ||
e == 'activity_exclusion' || e == 'activity_inclusion' || e == 'drop_point' || e == 'additional_pick_up_details') {
this.formData.get(e).setValue(d['activityContents'][0][e] ? d['activityContents'][0][e] : "");
}
else if (e == 'is_drop_included') {
if (e == 'is_drop_included') {
this.formData.get(e).setValue(d[e] ? 'Yes' : 'No');
this.dropoffvalid(d[e] ? 'Yes' : 'No');
}
} else if (e == 'is_pickup_included') {
this.formData.get(e).setValue(d[e] ? 'Yes' : 'No');
this.PickupIncludes(d[e] ? 'Yes' : 'No');
if (!d[e]) {
this.formData.get('meeting_before_hour').setValue(d['meeting_before_hour']);
this.formData.get('meeting_before_minute').setValue(d['meeting_before_minute']);
this.formData.get('meeting_point').setValue(d['activityContents'][0]['meeting_point']);
} else if (d[e]) {
this.formData.get('_pickup_point_type').setValue(parseInt(d['_pickup_point_type']))
this.PickupPointValid();
if (d['_pickup_point_type'] == '2') {
this.formData.get('departure_point').setValue(d['activityContents'][0]['departure_point'])
this.formData.get('departure_hour').setValue(d['pickup_before_hour'])
this.formData.get('departure_minute').setValue(d['pickup_before_minute'])
} else if (d['_pickup_point_type'] == '1') {
this.formData.get('_hotel_pickup_type').setValue(parseInt(d['_hotel_pickup_type']));
this.Hotel_Type_AddPickupValid();
if (d['_hotel_pickup_type'] == '1') {
this.formData.get('All_Hotel_hour').setValue(d['pickup_before_hour'])
this.formData.get('All_Hotel_minute').setValue(d['pickup_before_minute'])
} else if (d['_hotel_pickup_type'] == '2') {
let pickup_hotel = d['pickup_hotel'].split(',');
this.formData.get('pickup_hotel').setValue(pickup_hotel);
this.formData.get('Specific_Hotel_hour').setValue(d['pickup_before_hour']);
this.formData.get('Specific_Hotel_minute').setValue(d['pickup_before_minute']);
} else if (d['_hotel_pickup_type'] == '3') {
let hotel_zone = d['hotel_zone'].split(',');
this.formData.get('hotel_zone').setValue(hotel_zone);
this.formData.get('hotel_zone_hour').setValue(d['pickup_before_hour']);
this.formData.get('hotel_zone_minute').setValue(d['pickup_before_minute']);
}
}
}
} else if (e == "is_adult" || e == "is_senior" || e == "is_youth" || e == "is_child") {
if (e == "is_adult" && d['is_adult']) {
this.formData.get(e).setValue(d[e]);
this.adultValid(d[e]);
this.formData.get('adult_age_from').setValue(d['adult_age_from']);
this.formData.get('adult_age_to').setValue(d['adult_age_to']);
} else if (e == "is_senior" && d['is_senior']) {
this.formData.get(e).setValue(d[e]);
this.SeniorValid(d[e]);
this.formData.get('senior_age_from').setValue(d['senior_age_from']);
this.formData.get('senior_age_to').setValue(d['senior_age_to']);
} else if (e == "is_youth" && d['is_youth']) {
this.formData.get(e).setValue(d[e]);
this.YouthValid(d[e]);
this.formData.get('youth_age_from').setValue(d['youth_age_from']);
this.formData.get('youth_age_to').setValue(d['youth_age_to']);
} else if (e == "is_child" && d['is_child']) {
this.formData.get(e).setValue(d[e]);
this.ChildValid(d[e]);
this.formData.get('child_age_from').setValue(d['child_age_from']);
this.formData.get('child_age_to').setValue(d['child_age_to']);
}
} else if (e == 'Requirment') {
let required = d['requirements'] ? d['requirements'].split(',') : false;
if (required) {
this.Requirment.controls.forEach(x => {
Object.keys(x['controls']).forEach(l => {
let check = required.filter(m => m == x.get('header_id').value);
if (check.length > 0) {
x.get('is_header').setValue(true);
x.get('requirements')['controls'].forEach(re => {
Object.keys(re['controls']).forEach(li => {
let check = required.filter(m => m == re.get('requirement_id').value);
if (check.length > 0) re.get('is_requirement').setValue(true);
})
});
}
})
})
}
}
else if (e == 'max_pax' || e == 'min_pax' || e == 'emergency_phone_nbr' || e == 'emergency_phone_code' || e == 'service_minutes' ||
e == 'service_hours' || e == 'is_child_seat' || e == 'max_child_count'
|| e == 'free_child_age_to' || e == 'free_child_age_from') {
this.formData.get(e).setValue(d[e]);
} else if (e == 'service_days') {
this.formData.get(e).setValue(d[e]);
this.DaysItineryForm(d[e]);
let obj = JSON.parse(d['activityContents'][0]['daywise_itinerary']);
obj.forEach((z, i) => {
Object.keys(z).forEach((q) => {
if (q == 'Text_html') {
this.Itinerary.controls[i].get(q).setValue(z[q]);
} else if (q == 'country_code') {
this.Itinerary.controls[i].get(q).setValue(z[q]);
this.getcity(z[q], 'set', i + 1 , false);
this.Itinerary.controls[i].get('city_code').setValue(z['city_code']);
}
})
})
}
});
};
setUrlLink(URL) {
let val = JSON.parse(URL);
val.map((valLi, i) => {
i != 0 ? this.addvideo() : "";
this.VideoURl.controls[i].get('activity_videos').setValue(valLi.activity_videos);
});
};
setmultiimage(image) {
this.MultiImageGallery = [];
image.map((valLi, i) => {
this.addPackageImgGallery();
this.ImgGallery.controls[i].get('image_url').setValue(valLi.image_url);
this.MultiImageGallery.push(valLi.image_url);
});
}
// get form controls
get allFormGroup() {
return this.formData.getRawValue();
};
get VideoURl() {
return this.formData.get('VideoURL') as FormArray;
};
get Requirment() {
return this.formData.get('Requirment') as FormArray;
};
// GetDetailsByID(id) {
// this.ApiServ.Get('/GetHotel/{Id}')
// }
GetAllHotel() {
this.ApiServ.Get('/HotelContent/GetAllHotelContent').subscribe(data => {
if (data) {
this.AllHotelContent = data['responseObject'];
}
});
};
GetSubCategory(value) {
this.formData.get('Sub_Category').setValue('')
this.ApiServ.Get('/ActivityCategoryMaster/GetSubCategory?Id=' + value).subscribe(data => {
if (data) {
this.SubCategory = data['responseObject']
}
});
};
GetLOVHotelPickupPointType() {
let formdata = {
"lov_types": [{ "lov_type": "HotelPickupPointType" }],
"lov_lang": "en"
}
this.ApiServ.Post("/LovMaster/GetLov", formdata).subscribe(data => {
if (data) {
console.log(data)
this.HotelPickupPointType = data['responseObject']['0']['keys']
console.log(this.HotelPickupPointType)
}
});
};
requirementCheck(check, formgroup) {
if (check) {
formgroup.get('requirements').controls.forEach(e => {
e.get('is_requirement').setValue(true);
})
} else {
formgroup.get('requirements').controls.forEach(e => {
e.get('is_requirement').setValue(false);
})
}
}
GetLOVHotelPickupType() {
let formdata = {
"lov_types": [{ "lov_type": "HotelPickupType" }],
"lov_lang": "en"
}
this.ApiServ.Post("/LovMaster/GetLov", formdata).subscribe(data => {
if (data) {
console.log(data)
this.HotelPickupType = data['responseObject']['0']['keys']
console.log(this.HotelPickupPointType)
}
});
};
GetLOVLanguage() {
let formdata = {
"lov_types": [{ "lov_type": "Language" }],
"lov_lang": "en"
}
this.ApiServ.Post("/LovMaster/GetLov", formdata).subscribe(data => {
if (data) {
console.log(data)
this.Service_Language = data['responseObject']['0']['keys']
console.log(this.Service_Language)
}
});
};
// save
SaveFormData() {
let value = this.formData.getRawValue();
if (this.formData.status == "INVALID") {
this.validationService.showValidationsMsg(this.formData);
const firstElementWithError = document.querySelector('.ng-invalid');
if (firstElementWithError) {
firstElementWithError.scrollIntoView({ behavior: 'smooth' });
}
return;
}
this.SaveBtn = true;
let org_id = '2105311837100000021';
let supplier_id = '2205221841391724322';
let dataArr = [];
let postArrayData = new ActivityContent();
postArrayData.activity_name = value.activity_name;
postArrayData.meeting_point = value.is_pickup_included == 'No' ? value.meeting_point : '';
postArrayData.drop_point = value.is_drop_included == 'Yes' ? value.drop_point : "";
postArrayData.activity_highlight = value.activity_highlight;
postArrayData.activity_description = value.activity_description;
postArrayData.activity_restriction = value.activity_restriction;
postArrayData.activities_details = value.activities_details;
postArrayData.activity_inclusion = value.activity_inclusion;
postArrayData.activity_exclusion = value.activity_exclusion;
postArrayData.org_id = org_id;
let daysiternery = this.Itinerary.getRawValue();
postArrayData.daywise_itinerary = JSON.stringify(daysiternery);
postArrayData.additional_pick_up_details = value.additional_pick_up_details;
postArrayData.language_code = 'EN'; //
postArrayData.supplier_id = supplier_id; //
dataArr.push(postArrayData)
// undefine hardcode
postArrayData.activity_content_id = '';
postArrayData.activity_id = this.activity_id ? this.activity_id : "";
postArrayData.created_by = 'Razzak';
postArrayData.updated_by = 'Razzak';
//
//
let PostData = new experience_add();
PostData.org_id = org_id;
PostData.category_id = value.category_id;
PostData._pickup_point_type = value.is_pickup_included == 'Yes' ? value._pickup_point_type.toString() : '';
PostData._service_language = value._service_language.join(",");
PostData.default_lang_code = value.default_lang_code;
PostData.emergency_phone_code = value.emergency_phone_code;
PostData.emergency_phone_nbr = value.emergency_phone_nbr;
PostData.service_days = value.service_days;
PostData.service_hours = value.service_hours;
PostData.service_minutes = value.service_minutes;
PostData.supplier_id = supplier_id; //
PostData.activity_id = this.activity_id ? this.activity_id : "";
// undefined hardcode
PostData.sub_category_id = value.Sub_Category.join(",");
PostData.activity_content_json = '';
PostData.category_name = '';
this.Requirment.getRawValue();
let AllReqirement = this.Requirment.getRawValue();
let All_Id = [];
AllReqirement.forEach(e => {
if (e.is_header) {
All_Id.push(e.header_id);
if (e.requirements) {
e.requirements.forEach(d => {
d.is_requirement ? All_Id.push(d.requirement_id) : '';
});
};
};
});
PostData.requirements = All_Id.length > 0 ? All_Id.join(',') : '';
PostData.starting_city = value.starting_city;
// multi images
this.ImageGalleryArr = [];
value.images.map((galLi, i) => {
if (typeof (galLi.image_url) == 'object') {
this.fileArr.push(galLi.image_url);
this.fileInfo.push({ 'fileName': "Activity/Add_Act_Id_gallery_" + (i + 1) + "." + galLi.image_url.name.split('.')[1], 'pathToSave': 'ThemeImages/ORGID' });
}
let imagedata = {
image_url: typeof (galLi.image_url) == 'object' ? environment.cdnFileUrl + "ThemeImages/ORGID/Activity/Add_Act_Id_gallery_" + (i + 1) + "." + galLi.image_url.name.split('.')[1] : galLi.image_url,
sequence: i + 1
}
this.ImageGalleryArr.push(imagedata);
});
PostData.activity_images = JSON.stringify(this.ImageGalleryArr);
// thumnail images
if (typeof (value.thumnailImg) == 'object') {
this.fileArr.push(value.thumnailImg);
this.fileInfo.push({ 'fileName': "Activity/Add_Act_Id." + value.thumnailImg.name.split('.')[1], 'pathToSave': 'ThemeImages/ORGID' });
}
let thumnail_img = typeof (value.thumnailImg) == 'object' ? environment.cdnFileUrl + "ThemeImages/ORGID/Activity/Add_Act_Id." + value.thumnailImg.name.split('.')[1] : value.thumnailImg.split('.')[0];
PostData.thumbnail_image = thumnail_img;
PostData.created_by = ''
PostData.updated_by = ''
PostData.activity_videos = JSON.stringify(this.VideoURl.getRawValue())
PostData.country_code = value.country_code.join(",");
PostData.city_id = value.city_id.join(",");
// condition based pickup before time
postArrayData.departure_point = '';
PostData._hotel_pickup_type = '';
PostData.pickup_hotel = '';
PostData.hotel_zone = '';
if (value.is_pickup_included == 'Yes') {
if (value._pickup_point_type == 2) {
postArrayData.departure_point = value.departure_point;
PostData.pickup_before_hour = value.departure_hour;
PostData.pickup_before_minute = value.departure_minute;
} else if (value._pickup_point_type == 1) {
PostData._hotel_pickup_type = value._hotel_pickup_type.toString();
if (value._hotel_pickup_type == 1) {
PostData.pickup_before_hour = value.All_Hotel_hour;
PostData.pickup_before_minute = value.All_Hotel_minute;
} else if (value._hotel_pickup_type == 2) {
PostData.pickup_hotel = value.pickup_hotel.join(',');
PostData.pickup_before_hour = value.Specific_Hotel_hour;
PostData.pickup_before_minute = value.Specific_Hotel_minute;
} else if (value._hotel_pickup_type == 3) {
PostData.hotel_zone = value.hotel_zone.join(',');
PostData.pickup_before_minute = value.hotel_zone_hour;
PostData.pickup_before_hour = value.hotel_zone_minute;
}
}
}
PostData.is_pickup_included = value.is_pickup_included == 'No' ? false : true;
PostData.meeting_before_hour = value.is_pickup_included == 'No' ? value.meeting_before_hour : 0;
PostData.meeting_before_minute = value.is_pickup_included == 'No' ? value.meeting_before_minute : 0;
/////
PostData.is_drop_included = value.is_drop_included == 'No' ? false : true;
PostData.min_pax = value.min_pax;
PostData.max_pax = value.max_pax;
PostData.is_adult = value.is_adult;
PostData.adult_age_from = value.is_adult ? value.adult_age_from : 0;
PostData.adult_age_to = value.is_adult ? value.adult_age_to : 0;
PostData.is_senior = value.is_senior;
PostData.senior_age_from = value.is_senior ? value.senior_age_from : 0;
PostData.senior_age_to = value.is_senior ? value.senior_age_to : 0;
PostData.is_youth = value.is_youth;
PostData.youth_age_from = value.is_youth ? value.youth_age_from : 0;
PostData.youth_age_to = value.is_youth ? value.youth_age_to : 0;
PostData.is_child = value.is_child;
PostData.child_age_from = value.is_child ? value.child_age_from : 0;
PostData.child_age_to = value.is_child ? value.child_age_to : 0;
PostData.max_child_count = value.is_child ? value.max_child_count ? value.max_child_count : 0 : 0;
PostData.free_child_age_from = value.is_child ? value.free_child_age_from ? value.free_child_age_from : 0 : 0;
PostData.free_child_age_to = value.is_child ? value.free_child_age_to ? value.free_child_age_to : 0 : 0;
PostData.is_child_seat = value.is_child_seat;
PostData.activityContents = dataArr;
if (this.activity_id) {
this.ApiServ.Post('/Activity/UpdateActivity', PostData).subscribe(data => {
if (data) {
(data['status'] && this.fileInfo.length > 0) ? this.saveImg(data, this.fileArr, this.fileInfo) : this.showToastrMsg(data);
}
});
} else {
this.ApiServ.Post('/Activity/SaveActivity', PostData).subscribe(data => {
if (data) {
(data['status'] && this.fileInfo.length > 0) ? this.saveImg(data, this.fileArr, this.fileInfo) : this.showToastrMsg(data);
}
});
}
}
showToastrMsg(respData) {
this.messageService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
this.SaveBtn = false;
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
}
// ng select
option = [
{ id: 0, name: 'Yes' },
{ id: 1, name: 'No' },
];
optionDropOff = [
{ id: 0, name: 'Yes' },
{ id: 1, name: 'No' },
];
selectOption = this.option[0].name;
onUpload(event: { files: any }) {
for (let file of event.files) {
this.uploadedFiles.push(file);
}
this.messageService.add({
severity: 'info',
summary: 'File Uploaded',
detail: '',
});
}
addvideo() {
this.VideoURl.push(this.Fb.group({ activity_videos: [''] }))
}
removevideo(index: number) {
this.VideoURl.removeAt(index)
}
// hours and minutes option dropdown
agelength() {
for (let i = 0; i <= 100; i++) {
i >= 0 && i <= 18 ? this.childNoArray.push({ value: i }) : "";
i >= 0 && i <= 2 ? this.InfantNoArray.push({ value: i }) : "";
this.AdultNoArray.push({ value: i })
i != 0 ? this.sequence.push(i) : ''
};
};
GetAllRequirementView() {
this.ApiServ.Get('/ActivityRequirement/GetAllRequirementView').subscribe(res => {
if (res) {
let requirementObj = res.responseObject.sort((a, b) => a.header_sequence - b.header_sequence);
requirementObj.forEach((e, i) => {
let req_menu = e.requirements.sort((a, b) => a.sub_sequence - b.sub_sequence)
this.Requirment.push(
this.Fb.group({
header_name: [e.header_name],
header_id: [e.header_id],
is_header: [false],
requirements: this.Fb.array([
])
})
)
if (req_menu) {
req_menu.forEach(d => {
let form = this.Requirment.controls[i].get('requirements') as FormArray;
form.push(this.Fb.group({
requirement_id: [d.requirement_id],
requirement_name: [d.requirement_name],
is_requirement: [false]
}))
})
}
})
}
})
}
/// images save
fileArr = [];
fileInfo = [];
//
MultiImageGallery = [];
ImageGalleryArr = [];
get ImgGallery() {
return this.formData.get('images') as FormArray;
}
get Itinerary() {
return this.formData.get('Itinerary') as FormArray;
}
getMultiGalleryImg(e) {
console.log(e)
if (e.currentFiles.length != 0) {
for (let i = 0; i < e.files.length; i++) {
this.addPackageImgGallery();
let file = e.files[i];
this.ImgGallery.controls[this.MultiImageGallery.length + i].get('image_url').setValue(file)
//base 64
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
this.MultiImageGallery.push(reader.result)
};
}
}
}
emptyImgGallery(i) {
this.ImgGallery.removeAt(i);
this.MultiImageGallery.splice(i, 1);
console.log(this.MultiImageGallery)
}
addPackageImgGallery() {
this.ImgGallery.push(
this.Fb.group({
image_url: [''],
sequence: ['']
})
)
}
/////
getThumnailImg(e) {
this.onFileSelected(e)
if (e.currentFiles.length != 0) {
let file = e.files[0];
this.showThumbnailImg = true
this.formData.get('thumnailImg').setValue(file);
}
};
base64Output;
onFileSelected(event) {
this.convertFile(event.files[0]).subscribe(base64 => {
if (base64) {
this.base64Output = 'data:image/png;base64,' + base64;
console.log(this.base64Output);
}
});
}
convertFile(file: File): Observable<string> {
const result = new ReplaySubject<string>(1);
const reader = new FileReader();
reader.readAsBinaryString(file);
reader.onload = (event) => result.next(btoa(event.target.result.toString()));
return result;
}
emptyThunailImg() {
this.base64Output = '';
this.showThumbnailImg = false
this.formData.get('thumnailImg').setValue('');
};
btnClick() {
this.router.navigate(['/Services/ActivityServices/ExpServices/Search']);
}
saveImg(respData, file_arr, file_info) {
var formdata = new FormData();
file_arr.forEach(x => {
formdata.append("files", x);
})
let Id = this.activity_id ? this.activity_id : respData['responseObject'].activity_id;
let a = JSON.stringify(file_info).replaceAll('Add_Act_Id', Id);
formdata.append("fileInfo", a);
this.ApiServ.PostFile('/FileUpload/SaveFile', formdata).subscribe(imdata => {
if (imdata['status']) {
this.showToastrMsg(respData)
}
});
}
// add validation
PickupIncludes(val) {
if (val == 'No') {
this.formData.addControl('meeting_point', this.Fb.control('', Validators.required));
this.formData.addControl('meeting_before_hour', this.Fb.control(null, Validators.required));
this.formData.addControl('meeting_before_minute', this.Fb.control(null, Validators.required));
this.formData.removeControl('_pickup_point_type');
} else {
this.formData.addControl('_pickup_point_type', this.Fb.control(1, [Validators.required]));
this.formData.removeControl('meeting_point');
this.formData.removeControl('meeting_before_hour');
this.formData.removeControl('meeting_before_minute');
this.PickupPointValid();
}
}
PickupPointValid() {
let val = this.formData.getRawValue();
if (val._pickup_point_type == 1) {
this.formData.removeControl('departure_point');
this.formData.removeControl('departure_hour');
this.formData.removeControl('departure_minute');
this.formData.addControl('_hotel_pickup_type', this.Fb.control(1, Validators.required));
this.Hotel_Type_AddPickupValid();
} else {
this.formData.removeControl('_hotel_pickup_type');
this.formData.addControl('departure_point', this.Fb.control('', Validators.required));
this.formData.addControl('departure_hour', this.Fb.control(null, Validators.required));
this.formData.addControl('departure_minute', this.Fb.control(null, Validators.required));
this.Hotel_Type_AddPickupValid();
}
}
Hotel_Type_AddPickupValid() {
let val = this.formData.getRawValue();
this.formData.removeControl('All_Hotel_hour');
this.formData.removeControl('All_Hotel_minute');
this.formData.removeControl('pickup_hotel');
this.formData.removeControl('Specific_Hotel_hour');
this.formData.removeControl('Specific_Hotel_minute');
this.formData.removeControl('hotel_zone');
this.formData.removeControl('hotel_zone_hour');
this.formData.removeControl('hotel_zone_minute');
if (val._hotel_pickup_type == 1) {
this.formData.addControl('All_Hotel_hour', this.Fb.control(null, Validators.required));
this.formData.addControl('All_Hotel_minute', this.Fb.control(null, Validators.required));
} else if (val._hotel_pickup_type == 2) {
this.formData.addControl('pickup_hotel', this.Fb.control(null, Validators.required));
this.formData.addControl('Specific_Hotel_hour', this.Fb.control(null, Validators.required));
this.formData.addControl('Specific_Hotel_minute', this.Fb.control(null, Validators.required));
} else if (val._hotel_pickup_type == 3) {
this.formData.addControl('hotel_zone', this.Fb.control(null, Validators.required));
this.formData.addControl('hotel_zone_hour', this.Fb.control(null, Validators.required));
this.formData.addControl('hotel_zone_minute', this.Fb.control(null, Validators.required));
}
}
/// check box validation
adultValid(check) {
if (check) {
this.addvalid("adult_age_from", 'add');
this.addvalid("adult_age_to", 'add');
} else {
this.addvalid("adult_age_from", 'remove');
this.addvalid("adult_age_to", 'remove');
}
}
SeniorValid(check) {
if (check) {
this.addvalid("senior_age_from", 'add');
this.addvalid("senior_age_to", 'add');
} else {
this.addvalid("senior_age_from", 'remove');
this.addvalid("senior_age_to", 'remove');
}
}
YouthValid(check) {
if (check) {
this.addvalid("youth_age_from", 'add');
this.addvalid("youth_age_to", 'add');
} else {
this.addvalid("youth_age_from", 'remove');
this.addvalid("youth_age_to", 'remove');
}
};
ChildValid(check) {
if (check) {
this.addvalid("child_age_from", 'add');
this.addvalid("child_age_to", 'add');
} else {
this.addvalid("child_age_from", 'remove');
this.addvalid("child_age_to", 'remove');
}
};
InfantValid(check) {
if (check) {
this.addvalid("infant_age_from", 'add');
this.addvalid("infant_age_to", 'add');
} else {
this.addvalid("infant_age_from", 'remove');
this.addvalid("infant_age_to", 'remove');
}
};
dropoffvalid(val) {
if (val == 'No') {
this.addvalid("drop_point", 'remove');
} else {
this.addvalid("drop_point", 'add');
}
};
addvalid(name, type) {
if (type == 'add') {
this.formData.controls[name].addValidators([Validators.required]);
this.formData.controls[name].updateValueAndValidity();
} else {
this.formData.controls[name].clearValidators();
this.formData.controls[name].updateValueAndValidity();
this.formData.controls[name].markAsUntouched();
}
};
GetAllActivityHotelZone() {
let SearchObj = {
city_id: '',
country_code: '',
zone_name: '',
}
this.ApiServ.Post('/ActivityHotelZone/GetAllActivityHotelZone', SearchObj).subscribe(res => {
if (res) {
this.AllActivityHotelZone = res.result.responseObject;
}
})
}
DaysItineryForm(ind) {
let val = this.formData.getRawValue();
this.Itinerary.clear()
for (let i = 0; i < ind; i++) {
this.Itinerary.push(this.Fb.group({
Text_html: [''],
country_code: [''],
city_code: [''],
}));
}
}
}

View File

@@ -1,11 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-exp-services-manage',
templateUrl: './exp-services-manage.component.html',
})
export class ExpServicesManageComponent implements OnInit {
constructor() {}
ngOnInit(): void {}
}

View File

@@ -1,163 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { TabsComponent } from './tabs/tabs.component';
import { OverviewComponent } from './tabs-content/Overview/Overview.component';
import { TabViewModule } from 'primeng/tabview';
import { TreeModule } from 'primeng/tree';
import { NgSelectModule } from '@ng-select/ng-select';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { FileUploadModule } from 'primeng/fileupload';
import { ProductService } from 'src/app/core/services/product.service';
import { ConfirmationService, MessageService } from 'primeng/api';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { InputNumberModule } from 'primeng/inputnumber';
import { InputTextModule } from 'primeng/inputtext';
import { CalendarModule } from 'primeng/calendar';
// import { ExpServicesManageComponent } from './activity-services-manage.component';
import { TableModule } from 'primeng/table';
import { ToolbarModule } from 'primeng/toolbar';
import { DialogModule } from 'primeng/dialog';
import { RadioButtonModule } from 'primeng/radiobutton';
import { ListboxModule } from 'primeng/listbox';
import { CheckboxModule } from 'primeng/checkbox';
import { DropdownModule } from 'primeng/dropdown';
import { CarouselModule } from 'primeng/carousel';
import { MenuModule } from 'primeng/menu';
import { MatButtonModule } from '@angular/material/button';
import {
MatRadioModule,
MAT_RADIO_DEFAULT_OPTIONS,
} from '@angular/material/radio';
import { MatMenuModule } from '@angular/material/menu';
import { FullCalendarModule } from '@fullcalendar/angular';
import { ToastModule } from 'primeng/toast';
import { MatCheckbox, MatCheckboxModule, MAT_CHECKBOX_DEFAULT_OPTIONS } from '@angular/material/checkbox';
import { ExpServicesManageComponent } from './exp-services-manage.component';
import { SlotsComponent } from './tabs-content/slots/slots.component';
import { AddOptionalAddOnComponent } from './tabs-content/optional-addOns/add-optional-add-on/add-optional-add-on.component';
import { OptionalAddOnsComponent } from './tabs-content/optional-addOns/optional-addOns.component';
import { AddRateConfigComponent } from './tabs-content/rate-config/add-rate-config/add-rate-config.component';
import { EditAllocationComponent } from './tabs-content/rate-config/edit-allocation/edit-allocation.component';
import { EditCancelletionPolicyComponent } from './tabs-content/rate-config/edit-cancelletion-policy/edit-cancelletion-policy.component';
import { EditModifyRateComponent } from './tabs-content/rate-config/edit-modify-rate/edit-modify-rate.component';
import { RateConfigComponent } from './tabs-content/rate-config/rate-config.component';
import { AddNewSeasonComponent } from './tabs-content/season-creation/add-new-season/add-new-season.component';
import { SeasonCreationComponent } from './tabs-content/season-creation/season-creation.component';
import { AddSlotsComponent } from './tabs-content/slots/add-slots/add-slots.component';
import { EditDetailsComponent } from './tabs-content/rate-config/edit-details/edit-details.component';
import { ModifyDetailsComponent } from './tabs-content/rate-config/modify-details/modify-details.component';
import { StaticDataService } from 'src/app/core/common/static-data.service';
import { TooltipModule } from 'primeng/tooltip';
const routes: Routes = [
{
path: '',
component: ExpServicesManageComponent,
},
{
path: 'Add',
component: AddRateConfigComponent,
},
{
path: 'EditCancelletionPolicy',
component: EditCancelletionPolicyComponent,
},
{
path: 'EditDetails',
component: ModifyDetailsComponent,
},
{
path: 'EditAllocation',
component: EditAllocationComponent,
},
{
path: 'EditModifyRate',
component: EditModifyRateComponent,
},
{
path: 'AddOptionalAddOn',
component: AddOptionalAddOnComponent,
},
{
path: 'AddNewSeason',
component: AddNewSeasonComponent,
},
{
path: 'AddSlots',
component: AddSlotsComponent,
},
{
path: '',
pathMatch: 'full',
redirectTo: 'Search',
},
];
@NgModule({
declarations: [
TabsComponent,
OverviewComponent,
SeasonCreationComponent,
RateConfigComponent,
OptionalAddOnsComponent,
ExpServicesManageComponent,
AddRateConfigComponent,
EditModifyRateComponent,
EditAllocationComponent,
EditCancelletionPolicyComponent,
AddOptionalAddOnComponent,
AddNewSeasonComponent,
SlotsComponent,
AddSlotsComponent,
EditDetailsComponent,
ModifyDetailsComponent,
],
imports: [
CommonModule,
TabViewModule,
TreeModule,
NgSelectModule,
FormsModule,
ReactiveFormsModule,
ToastModule,
FileUploadModule,
TranslateModule,
InputNumberModule,
InputTextModule,
CalendarModule,
CarouselModule,
TableModule,
ToolbarModule,
DialogModule,
TooltipModule,
ListboxModule,
CheckboxModule,
MatCheckboxModule,
DropdownModule,
MenuModule,
MatMenuModule,
MatButtonModule,
RadioButtonModule,
MatRadioModule,
FullCalendarModule,
RouterModule.forChild(routes),
],
providers: [
ProductService,
ConfirmationService,
StaticDataService,
MessageService,
TranslateService,
{
provide: MAT_RADIO_DEFAULT_OPTIONS,
useValue: { color: 'primary' },
},
{
provide: MAT_CHECKBOX_DEFAULT_OPTIONS,
useValue: { color: 'primary' },
},
],
})
export class ExpServicesManageModule {}

View File

@@ -1,549 +0,0 @@
<div class="app-mainHeader mt-20">Overview</div>
<div class="exp-card" *ngIf="ActivityData">
<div class="exp-carousel">
<p-carousel [value]="activityImages" [numVisible]="1" [numScroll]="1" [responsiveOptions]="responsiveOptions">
<ng-template let-activityImages pTemplate="item">
<img [src]="activityImages.image_url" alt="logo" />
</ng-template>
</p-carousel>
</div>
<div>
<div class="exp-heading">
{{ActivityData.activityContents[0].activity_name}}
</div>
</div>
<div class="exp-heading" [innerHTML]="ActivityData.activityContents[0].activity_description">
</div>
</div>
<div class="box_wrapper" [formGroup]="formgroup">
<div class="box-header">Allocation</div>
<div class="card">
<div class="app-mainGrid4">
<div class="mb-20">
<label class="formLabel">Option </label>
<ng-select [items]="rateDetails" appendTo="body" (change)="GetSlotsById($event.activity_contract_id ,false)" bindLabel="option_name" bindValue="activity_contract_id" formControlName="option_name">
</ng-select>
</div>
<div class="mb-20">
<label class="formLabel">Time Slot </label>
<ng-select #select formControlName="slot_id" (change)="getAllocationDetails()">
<ng-option *ngFor="let item of AllSlots" [value]="item.activity_slot_id">
{{ item.start_time | date : 'HH:mm'}} to {{item.end_time| date : 'HH:mm'}}
</ng-option>
</ng-select>
</div>
</div>
<div class="exp-calendar" formGroupName="Calender">
<div class="common_calendar" *ngIf="datelist">
<p-calendar [inline]="true" [showOtherMonths]="false" [readonlyInput]="true">
<ng-template pTemplate="date" let-date>
<span class="text-end w-100 fs-30">{{ date.day }} </span>
<div *ngIf="bindAllocationdate(date) then highlightedDate else normalDate"></div>
<ng-template #highlightedDate>
<div class="mt-20 w-10" formGroupName="{{convertproperadate(date)}}">
<div class="d-flex">
<div class="calenderContent align-start">
<span>Allocated:</span>
<span>Booked:</span>
<span>Remaining:</span>
</div>
<div class="calenderContent align-center">
<span>
<div class="d-flex justify-center">
<span class="material-icons mr-5 p-5" (click)="handlePlus(convertproperadate(date))">
add_circle
</span>
<input class="p-5 w-40 text-center" (change)="SaveAllocation(Calender.get(convertproperadate(date)))" formControlName="allocation_count" />
<span (click)="handleMinus(convertproperadate(date))" [ngClass]="{'disabled': Calender.get(convertproperadate(date)).get('allocation_count').value == 0}" class="material-icons ml-5 p-5">
remove_circle
</span>
</div>
</span>
<span> {{Calender.get(convertproperadate(date)).get('booking_count').value}}</span>
<span> {{Calender.get(convertproperadate(date)).get('_allocation_type').value == '1' ? 'Free Sale' :
Calender.get(convertproperadate(date)).get('_allocation_type').value == '2' ? 'Stop Sale' :
Calender.get(convertproperadate(date)).get('remaining_count').value}} </span>
<span>
<button class="btn-primary" (click)="StopSale(Calender.get(convertproperadate(date)))">Stop
Sale</button>
</span>
</div>
</div>
</div>
</ng-template>
<ng-template #normalDate>
<div class="mt-20 w-10"></div>
</ng-template>
</ng-template>
</p-calendar>
</div>
</div>
</div>
</div>
<div class="box-wrapper">
<div class="box-header">Season</div>
<div class="card">
<!-- <div class="app-mainCard"> -->
<p-table #dtseason [value]="SeasonData" [rows]="3" responsiveLayout="scroll" styleClass="p-datatable-gridlines" [paginator]="true" [columns]="cols" [globalFilterFields]="[
'activitySeason.season_name',
'country.name',
'activitySeason.is_active',
'status'
]" [(selection)]="SeasonData" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar>
<ng-template pTemplate="left">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="dtseason.exportCSV()" class="btn-secondary mr-10" pTooltip="CSV" label="CSV" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportseasonExcel()" class="btn-secondary mr-10" pTooltip="XLS" label="Excel" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportseasonPdf()" class="btn-secondary mr-10" pTooltip="PDF" label="PDF" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print" tooltipPosition="bottom"></button>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dtseason.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header" let-season>
<tr>
<th pSortableColumn="activitySeason.season_name">
Season Name
<p-sortIcon field="activitySeason.season_name" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="seasondateRange.fromDate">
Season Date Range
<p-sortIcon field="seasondateRange.fromDate" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="activitySeason.is_active">
Status
<p-sortIcon field="activitySeason.is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rating">
Action
<p-sortIcon field="rating" class="p-sort-icon"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-season>
<tr>
<td>{{ season.activitySeason.season_name }}</td>
<td>
<span class="d-block" *ngFor="let date of season.seasondateRange; let i = index">12 Feb 2022 - 02 Mar 2022
</span>
</td>
<td>
<span class="product-badge" [ngClass]="{
'status-active': season.activitySeason.is_active,
'status-inactive': season.activitySeason.is_active == false
}">{{
season.activitySeason.is_active ? "Active" : "Deactive"
}}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="EditSeason(season.activitySeason.activity_season_id)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> edit </span>
<span> Edit </span>
</span>
</button>
<button mat-menu-item (click)="
UpdateSeasonStatus(
season.activitySeason.activity_season_id,
season.activitySeason.is_active
)
">
<span class="flex-center">
<span class="mr-10 f-20 material-icons">
check_circle
</span>
<span>
{{
season.activitySeason.is_active
? "Deactivate"
: "Activate"
}}
</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<div class="box-wrapper">
<div class="box-header">Slots</div>
<div class="card">
<!-- <div class="app-mainCard"> -->
<p-table #dtseason [value]="AllSlotsData" [rows]="25" responsiveLayout="scroll" styleClass="p-datatable-gridlines" [paginator]="true" [columns]="cols" [globalFilterFields]="[
'activity_slot_id',
'start_time',
'end_time',
'cut_off_time',
'is_active'
]" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar>
<ng-template pTemplate="left">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="dtseason.exportCSV()" class="btn-secondary mr-10" pTooltip="CSV" label="CSV" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportseasonExcel()" class="btn-secondary mr-10" pTooltip="XLS" label="Excel" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportseasonPdf()" class="btn-secondary mr-10" pTooltip="PDF" label="PDF" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print" tooltipPosition="bottom"></button>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dtseason.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="activity_slot_id">
Slot Id
<p-sortIcon field="activity_slot_id" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="start_time">
Slot Start Time
<p-sortIcon field="start_time" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="end_time">
Slot End Time
<p-sortIcon field="end_time" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="cut_off_time">
Cut-Off Time (in Hrs)
<p-sortIcon field="cut_off_time" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_active">
Status
<p-sortIcon field="is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rating">
Action
<p-sortIcon field="rating" class="p-sort-icon"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-AllSlotsData>
<tr>
<td>{{ AllSlotsData.activity_slot_id }}</td>
<td>
<span class="d-block">{{
AllSlotsData.start_time | date: "H:mm"
}}</span>
</td>
<td>
<span class="product-badge">{{
AllSlotsData.end_time | date: "H:mm"
}}</span>
</td>
<td>
<span class="product-badge">{{
AllSlotsData.cut_off_time | date: "H:mm"
}}</span>
</td>
<td>
<span class="booking-history-status" [ngClass]="{
'booking-history-status-success': AllSlotsData.is_active,
'booking-history-status-fail': AllSlotsData.is_active == false
}">
{{ AllSlotsData.is_active ? "Active" : "Deactive" }}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button (click)="EditSlot(AllSlotsData.activity_slot_id)" mat-menu-item>
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> edit </span>
<span> Edit </span>
</span>
</button>
<button (click)="UpdateStatusSlot(AllSlotsData.activity_slot_id, AllSlotsData.is_active)" mat-menu-item>
<span class="flex-center">
<span class="mr-10 f-20 material-icons">
check_circle
</span>
<span>{{
AllSlotsData.is_active ? "Deactive" : "Activate"
}}</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage">
<tr *ngIf="AllSlotsData === null || AllSlotsData" class="ResultNotFound">
<td>
No data found
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<div class="box-wrapper">
<div class="box-header">Rates</div>
<div class="card">
<p-table #Ratedt [value]="rateDetails" [rows]="10" responsiveLayout="scroll" electionMode="multiple" styleClass="p-datatable-gridlines" [paginator]="true" [globalFilterFields]="[
'option_name',
'nationality',
'date',
'currency_code',
'contract_days',
'is_pickup_included',
'is_drop_off_included'
]" [(selection)]="rateDetails" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar>
<ng-template pTemplate="left">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="CSV" label="CSV" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="XLS" label="Excel" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="PDF" label="PDF" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print" tooltipPosition="bottom"></button>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="Ratedt.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="option_name">
Option Name
<p-sortIcon field="option_name" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="nationality">
Nationality
<p-sortIcon field="nationality" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="date">
Date Range/Season
<p-sortIcon field="date" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="currency_code">
Currency
<p-sortIcon field="currency_code" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="slot">
Slot
<p-sortIcon field="slot" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_pickup_included">
Pickup Included
<p-sortIcon field="is_pickup_included" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_drop_off_included">
Drop Off Included
<p-sortIcon field="is_drop_off_included" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_active">
Status
</th>
<th pSortableColumn="rating">
Action
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rateDetails>
<tr>
<td>{{rateDetails.option_name}}</td>
<td>{{rateDetails.nationality}}</td>
<td>
<span *ngIf="rateDetails.date">
<span class="d-block" *ngFor="let item of rateDetails.date.split(','); let i = index">{{rateDetails.date
== null ? '' :
item | date: 'dd MMM YYYY' }} {{
i == 0 && rateDetails.date.split(',').length > 1? '-' : ''}} </span>
</span>
</td>
<td>{{rateDetails.currency_code}}</td>
<td>
<span *ngFor="let item of SoltsDetailsConvParse(rateDetails.activity_slot)"> {{item.date}}</span>
</td>
<td>{{rateDetails.is_pickup_included ? "Yes" : "No"}}</td>
<td>{{rateDetails.is_drop_off_included? "Yes" : "No"}}</td>
<td>
<span class="product-badge" [ngClass]="{'status-active':rateDetails.is_active,'status-inactive' : rateDetails.is_active == false}">{{
rateDetails.is_active ?
'Active' : 'Deactive' }}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="EditRateConfig(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit Rate</span>
</span>
</button>
<button mat-menu-item (click)="EditDetails(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit Details</span>
</span>
</button>
<button mat-menu-item (click)="EditAllocation(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit Allocation </span>
</span>
</button>
<button mat-menu-item (click)="EditCancelPoli(rateDetails.activity_contract_id)">
<span class="flex-center">
<span> Edit Cancellation Policy </span>
</span>
</button>
<!-- <button mat-menu-item (click)="EditAllocation(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit No Show Policy </span>
</span>
</button> -->
<button mat-menu-item (click)="UpdateRateStatus(rateDetails.activity_contract_id ,rateDetails.is_active)">
<span class="flex-center">
<span>{{rateDetails.is_active
? 'Deactivate' : 'Activate' }}
</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<div class="box-wrapper">
<div class="box-header">Optional Add-Ons</div>
<div class="card">
<p-table #dtOpt [value]="OptAddData" [columns]="cols" [rows]="3" [resizableColumns]="true" styleClass="p-datatable-gridlines" responsiveLayout="scroll" selectionMode="multiple" [(selection)]="OptAddData" [paginator]="true" [globalFilterFields]="[
'add_on_name',
'add_on_description',
'rate_type',
'currency_code',
'rate',
'is_active'
]" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar *ngIf="OptAddData">
<ng-template pTemplate="left">
<div class="p-button-set">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="dtOpt.exportCSV()" class="btn-secondary mr-10" pTooltip="CSV" label="CSV" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportOptExcel()" class="btn-secondary mr-10" pTooltip="XLS" label="Excel" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportOptPdf()" class="btn-secondary mr-10" pTooltip="PDF" label="PDF" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print" tooltipPosition="bottom"></button>
</div>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dtOpt.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="add_on_name">
Add-On
<p-sortIcon field="add_on_name" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="add_on_description">
Description
<p-sortIcon field="add_on_description" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rate_type">
Rate Type
<p-sortIcon field="rate_type" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="currency_code">
Currency
<p-sortIcon field="currency_code" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_active">
Status
<p-sortIcon field="is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="Action">Action</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-ons>
<tr>
<td>{{ ons.add_on_name }}</td>
<td>{{ ons.add_on_description }}</td>
<td>{{ ons.rate_type }}</td>
<td>{{ ons.currency_code }}</td>
<td>
<span class="product-badge" [ngClass]="{
'status-active': ons.is_active,
'status-inactive': ons.is_active == false
}">{{ ons.is_active ? "Active" : "Deactive" }}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="EditOpt(ons.activity_add_on_id)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> edit </span>
<span> Edit </span>
</span>
</button>
<button mat-menu-item (click)="UpdateOptStatus(ons.activity_add_on_id, ons.is_active)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> check_circle </span>
<span>
{{ ons.is_active ? "Deactivate" : "Activate" }}
</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>

View File

@@ -1,616 +0,0 @@
const colors: any = {
red: {
primary: '#ad2121',
secondary: '#FAE3E3',
},
blue: {
primary: '#1e90ff',
secondary: '#D1E8FF',
},
yellow: {
primary: '#e3bc08',
secondary: '#FDF1BA',
},
};
import {
Component,
OnInit,
ViewChild
} from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Router } from '@angular/router';
import * as FileSaver from 'file-saver';
import jsPDF from 'jspdf';
import 'jspdf-autotable';
import * as moment from 'moment';
import {
MessageService
} from 'primeng/api';
import { Table } from 'primeng/table/table';
import { AllocationOverview } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-allocation/edit-allocation.model';
import { ActivityAllContract, GetRateDetails } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-rate-confi/edit-rate-confi.model';
import { GetActivitySlot } from 'src/app/core/models/Experience-Service/slot/add-slots-model';
import { API } from 'src/app/core/services/api.service';
import { BreakpointsService } from 'src/app/core/services/breakpoints.services';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'Overview',
// changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './Overview.component.html',
})
export class OverviewComponent implements OnInit {
// items!: MenuItem[];
dateValue!: Date;
// responsive code
isMobile = false;
DateList: any[] = []
responsiveOptions;
activityId;
// modal: any;
constructor(
// private confirmationService: ConfirmationService,
private messageService: MessageService,
// responsive constructor
public MobileBreakpoints: BreakpointsService,
// private cd: ChangeDetectorRef, // responsive constructor
public ApiServ: API,
public MsgService: MessageService,
private router: Router,
private fb: FormBuilder
) {
// this.MobileBreakpoints.IsMobile.subscribe({
// next: (val) => {
// this.isMobile = val;
// // this.cd.detectChanges();
// },
// });
}
date14!: Date;
cities = [
{ id: 1, name: 'Vilnius' },
{ id: 2, name: 'Kaunas' },
{ id: 3, name: 'Pavilnys', disabled: true },
{ id: 4, name: 'Pabradė' },
{ id: 5, name: 'Klaipėda' },
];
cols!: any[];
exportColumns!: any[];
datelist;
formgroup: FormGroup;
OptAddData;
rateDetails;
ActivityData;
activityImages;
SeasonData;
AllocationDetails;
AllSlotsData;
AllSlots
ngOnInit() {
// this.cols = [
// { field: 'code', header: 'Code', customExportHeader: 'Product Code' },
// { field: 'name', header: 'Name' },
// { field: 'category', header: 'Category' },
// { field: 'quantity', header: 'Quantity' },
// ];
// this.exportColumns = this.cols.map((col) => ({
// title: col.header,
// dataKey: col.field,
// }));
this.activityId = CommonService.getSessionStoage('activity_id');
this.ngOinitForm();
this.GetActivityData();
this.GetallrateDetails(true);
this.SearchSeason();
this.GetAllSlot();
}
/**
* @author Abdul Razzak
* to create form group
*/
ngOinitForm() {
this.formgroup = this.fb.group({
slot_id: [''],
option_name: [''],
Calender: this.fb.group({
})
});
}
/**
* @author Abdul Razzak
* to get form controller
*/
get Calender() {
return this.formgroup.get('Calender') as FormGroup
}
/**
* @author Abdul razzak
* to get all allocation details
*/
getAllocationDetails() {
let value = this.formgroup.getRawValue();
let postdata = new GetRateDetails();
postdata.from_date = '';
postdata.to_date = '';
postdata.dates = '';
postdata.slot_id = value.slot_id;
postdata.seasonId = [];
postdata.days = '';
postdata.contract_id = value.option_name;
this.ApiServ.Post('/ActivityContract/GetAllocationDetails', postdata).subscribe(data => {
if (data) {
this.AllocationDetails = data.responseObject;
this.SetTimeAvali(this.AllocationDetails);
}
});
};
// ------------------------------------------------ date overview ----------------------------------------
updateinputvalue(group) {
// console.log('asfdgujvfi')
// this.SaveAllocation()
}
/**
* @author Abdul Razzak
* for plus allocation count
* @param group
*/
handleMinus(group) {
let value = this.Calender.get(group).get('allocation_count').value - 1;
if (value >= 0) {
this.Calender.get(group).get('allocation_count').setValue(value);
this.SaveAllocation(this.Calender.get(group));
}
}
/**
* @author Abdul Razzak
* for minus allocation count
* @param group
*/
handlePlus(group) {
let value = this.Calender.get(group).get('allocation_count').value + 1;
this.Calender.get(group).get('allocation_count').setValue(value);
this.SaveAllocation(this.Calender.get(group));
}
/**
* @author Abdul Razzak
* for save allocation details
* @param group
*/
SaveAllocation(group) {
let value = group.getRawValue();
let contractDetails = this.formgroup.getRawValue();
let postdata = new AllocationOverview();
postdata._allocation_type = value.allocation_count > 0 ? '3' : value._allocation_type;
postdata.allocation_count = value.allocation_count ? value.allocation_count : 0;
postdata.activity_allocation_id = value.activity_allocation_id;
postdata.activity_contract_id = contractDetails.option_name;
postdata.activity_slot_id = contractDetails.slot_id;
this.ApiServ.Post('/ActivityContract/UpdateAllocationViewTab', postdata).subscribe((res) => {
if (res) {
this.setvalue(res.responseObject, group)
}
})
}
/**
* @author Abdul Razzak
* for set value when allocation count plus and minus
* @param data
* @param group
*/
setvalue(data, group) {
group.get('allocation_count').setValue(data.allocation_count);
group.get('_allocation_type').setValue(data._allocation_type);
group.get('booking_count').setValue(data.booking_count);
group.get('remaining_count').setValue(data.remaining_count);
}
/**
* for binding
* @param date
* @returns
*/
bindAllocationdate(date) {
let d = new Date(date.year, date.month, date.day);
let validate;
validate = false;
let format = moment(d).format('MM-DD-YYYY')
let valid = this.datelist.filter(e => e == format);
if (valid.length > 0) {
validate = true;
}
return validate;
}
/**
* @author Abdul Razzak
* to convert date format MM-DD-YYYY
*/
convertproperadate(date) {
let d = new Date(date.year, date.month, date.day);
let format = moment(d).format('MM-DD-YYYY');
return format
}
/**
* @author Abdul Razzak
* to create form controls and set value
* @param allDate
*/
SetTimeAvali(allDate) {
this.datelist = allDate.map(e => moment(e._date).format('MM-DD-YYYY'));
allDate.map(e => {
let date = moment(e._date).format('MM-DD-YYYY');
this.Calender.addControl(date, this.fb.group({
activity_allocation_id: e.activity_allocation_id,
allocation_count: e.allocation_count,
booking_count: e.booking_count,
remaining_count: e.remaining_count,
_allocation_type: e._allocation_type,
}));
});
}
/**
* @author Abdul Razzak
* to stop sale in allocation
* @param group
*/
StopSale(group) {
group.get('_allocation_type').setValue('2');
group.get('allocation_count').setValue(0);
this.SaveAllocation(group);
}
// ----------------------------------------------------- ------------------------------------------------------
/**
* @author Abdul Razzak
* to get activity details by Id
*/
GetActivityData() {
let activityid = CommonService.getSessionStoage('activity_id');
this.ApiServ.Get('/Activity/GetActivity/' + activityid).subscribe((e) => {
if (e) {
this.ActivityData = e.responseObject;
this.activityImages = JSON.parse(e.responseObject.activity_images);
CommonService.setSessionStorage('Def_Lang_code', e.responseObject.default_lang_code);
this.GetActivityAddOn();
}
});
}
// ----------------------------------------------------- Season Details ------------------------------------------------------
UpdateSeasonStatus(exp_id, status) {
let obj = { id: exp_id, status: status ? false : true, updatedBy: '' };
this.ApiServ.Post('/ActivitySeason/UpdateStatus', obj).subscribe((data) => {
if (data) {
this.MsgService.add({
severity: data['status'] ? 'success' : 'error',
detail: data['message'],
});
this.SearchSeason();
}
});
}
SearchSeason() {
this.ApiServ.Get('/ActivitySeason/GetAllActivitySeason?activityId=' + this.activityId + '&seasonName=' + '').subscribe((e) => {
if (e) {
this.SeasonData = e['responseObject'];
}
});
}
EditSeason(sea_id) {
let obj = { id: sea_id };
this.router.navigate(['/Services/ExpServices/Manage/AddNewSeason'], {
queryParams: obj,
});
}
exportseasonExcel() {
import('xlsx').then((xlsx) => {
console.log(xlsx);
const worksheet = xlsx.utils.json_to_sheet(this.SeasonData);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, {
bookType: 'xlsx',
type: 'array',
});
this.saveAsExcelFile(
excelBuffer,
'Season_Data_export_' + new Date().getTime()
);
});
}
exportseasonPdf() {
// const doc = new jsPDF();
const doc = new jsPDF('p', 'pt');
doc['autoTable'](this.exportColumns, this.SeasonData);
doc.save('Season_Data_export_' + new Date().getTime() + '.pdf');
}
// ----------------------------------------------------- Add Optional Add-Ons ------------------------------------------------------
GetActivityAddOn() {
let obj = {
activityId: this.activityId,
_add_on_name: "",
_language_code: CommonService.getSessionStoage('Def_Lang_code')
}
this.ApiServ.Post('/ActivityAddOn/GetActivityAddOn', obj).subscribe(e => {
if (e) {
this.OptAddData = e['responseObject'];
}
})
}
EditOpt(pk_id) {
let obj = { id: pk_id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/AddOptionalAddOn'], { queryParams: obj })
}
UpdateOptStatus(exp_id, status) {
let obj = { id: exp_id, status: status ? false : true, updatedBy: '' };
this.ApiServ.Post('/ActivityAddOn/UpdateStatus', obj).subscribe((data) => {
if (data) {
this.MsgService.add({
severity: data['status'] ? 'success' : 'error',
detail: data['message'],
});
this.GetActivityAddOn();
}
});
}
exportOptPdf() {
const doc = new jsPDF('p', 'pt');
doc['autoTable'](this.exportColumns, this.OptAddData);
doc.save('Option_Add_Ons_export_' + new Date().getTime() + '.pdf');
}
exportOptExcel() {
import('xlsx').then((xlsx) => {
console.log(xlsx);
const worksheet = xlsx.utils.json_to_sheet(this.OptAddData);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, {
bookType: 'xlsx',
type: 'array',
});
this.saveAsExcelFile(excelBuffer, 'Option_Add_Ons');
});
}
// ----------------------------------------------------- rate Details ------------------------------------------------------
EditCancelPoli(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditCancelletionPolicy'], { queryParams: obj })
}
EditAllocation(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditAllocation'], { queryParams: obj })
}
EditRateConfig(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditModifyRate'], { queryParams: obj })
}
EditDetails(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditDetails'], { queryParams: obj })
}
UpdateRateStatus(ID, Status) {
let Obj = {
id: ID,
updatedBy: "",
"status": Status ? false : true
}
this.ApiServ.Post('/ActivityContract/UpdateStatus', Obj).subscribe(data => {
if (data) {
this.MsgService.add({
severity: data["status"] ? "success" : "error",
detail: data["message"],
});
this.GetallrateDetails(false);
}
});
};
SoltsDetailsConvParse(data) {
let obj = data ? JSON.parse(data) : '';
let html = [];
obj ? obj.forEach(e => html.push({ 'date': moment(e.start_time).format('hh:mm') + '-' + moment(e.end_time).format('hh:mm') })) : ''
return html
}
GetallrateDetails(check) {
let activityid = CommonService.getSessionStoage('activity_id');
let postdata = new ActivityAllContract();
postdata.activity_id = activityid;
postdata.is_drop_off_included = false;
postdata.is_pickup_included = false;
postdata.option_name = '';
this.ApiServ.Post('/ActivityContract/GetAllActivityRates', postdata).subscribe(data => {
if (data) {
this.rateDetails = data.responseObject;
if (check) {
this.formgroup.get('option_name').setValue(this.rateDetails[0].activity_contract_id);
this.GetSlotsById(this.rateDetails[0].activity_contract_id, true);
}
}
})
}
// ----------------------------------------------------- rate Details ------------------------------------------------------
GetAllSlot() {
let post = new GetActivitySlot();
post.activity_id = this.activityId;
post.from_hour = null;
post.from_minute = null;
post.to_hour = null;
post.to_minute = null;
console.log(post)
this.ApiServ.Post('/ActivitySlot/GetAllSlot', post).subscribe(res => {
if (res) {
this.AllSlotsData = res['responseObject'];
}
});
}
EditSlot(pk_id) {
let obj = { id: pk_id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/AddSlots'], { queryParams: obj });
}
UpdateStatusSlot(slot_id, status) {
let obj = { Id: slot_id, Status: status ? false : true }
this.ApiServ.Post('/ActivitySlot/UpdateStatus', obj).subscribe(data => {
if (data) {
this.GetAllSlot();
this.MsgService.add({
severity: data["status"] ? "success" : "error",
detail: data["message"],
});
}
})
}
/**
* @author Abdul Razzak
* to get slot data by contract id
* @param Id
*/
GetSlotsById(Id, check) {
this.formgroup.get('slot_id').setValue('')
this.ApiServ.Get('/ActivityContract/GetSlotsById/' + Id).subscribe(res => {
if (res) {
this.AllSlots = res.responseObject;
if (check) {
this.formgroup.get('slot_id').setValue(this.AllSlots[0].activity_slot_id);
this.getAllocationDetails();
}
}
})
}
@ViewChild('dt')
table!: Table;
// exportExcel() {
// import('xlsx').then((xlsx) => {
// console.log(xlsx);
// const worksheet = xlsx.utils.json_to_sheet(this.products);
// const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
// const excelBuffer: any = xlsx.write(workbook, {
// bookType: 'xlsx',
// type: 'array',
// });
// this.saveAsExcelFile(excelBuffer, 'products');
// });
// }
saveAsExcelFile(buffer: any, fileName: string): void {
import('file-saver').then((abc) => {
let EXCEL_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
let EXCEL_EXTENSION = '.xlsx';
const data: Blob = new Blob([buffer], {
type: EXCEL_TYPE,
});
console.log(FileSaver);
FileSaver.saveAs(
data,
fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION
);
});
}
}

View File

@@ -1,145 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Add Optional Add-Ons</div>
<div class="app-mainCard" [formGroup]="AddOptForm">
<div class="">
<div class="app-mainGrid4">
<div class="mb-20">
<label class="formLabel">Add-On</label>
<input class="formInput" formControlName="add_on_name" type="text"
[ngClass]="{ errorInput: validationService.onBlur( AddOptForm.controls['add_on_name'], 'required') }" />
<span class="errorspan" *ngIf=" validationService.onBlur( AddOptForm.controls['add_on_name'], 'required' )">
Please enter add on
</span>
</div>
<div class="mb-20 app-grid2-4">
<label class="formLabel">Description</label>
<textarea rows="3" formControlName="add_on_description" class="formInput">
</textarea>
</div>
</div>
<div class="mb-20">
<label class="formLabel">Add-On Image</label>
<div class="mt-10 customDropzone">
<p-fileUpload *ngIf="!showImgBox" [showUploadButton]="false" [showCancelButton]="false"
(onSelect)="getImage($event)" (onRemove)="emptyValue()" [maxFileSize]="100000" name="demo[]" url="./upload.php" class="popularDest"
accept="image/*">
<ng-template pTemplate="content">
<ul *ngIf="uploadedFiles.length">
<li *ngFor="let file of uploadedFiles">
{{ file.name }} - {{ file.size }} bytes
</li>
</ul>
</ng-template>
</p-fileUpload>
<div class="p-fileupload-files ng-star-inserted" *ngIf="showImgBox">
<div class="ng-star-inserted">
<div class="p-fileupload-row ng-star-inserted">
<div>
<img [src]="AddOptForm.controls['add_on_image'].value" width="50" class="ng-star-inserted" />
</div>
<div class="p-fileupload-filename">date.PNG</div>
<div>490 B</div>
<div>
<button type="button" icon="pi pi-times" pbutton="" (click)="emptyValue()"
class="p-element p-button p-component p-button-icon-only" ng-reflect-icon="pi pi-times">
<span class="p-button-icon pi pi-times" aria-hidden="true"></span><span aria-hidden="true"
class="p-button-label">&nbsp;</span>
</button>
</div>
</div>
</div>
</div>
<span class="errorspan" *ngIf=" validationService.onBlur( AddOptForm.controls['add_on_image'], 'required' )">
Please choose add on image
</span>
</div>
</div>
<div class="app-mainGrid4">
<div>
<label class="formLabel">Apply Rate On</label>
<ng-select [items]="RateTypes" placeholder="Select" (change)="RateTypesCheck()" bindLabel="lov_value"
bindValue="lov_key" formControlName="_rate_type"
[ngClass]="{ errorInput: validationService.onBlur(AddOptForm.controls['_rate_type'], 'required') }">
</ng-select>
<span class="errorspan" *ngIf="validationService.onBlur( AddOptForm.controls['_rate_type'], 'required' )">
Please select rate on
</span>
</div>
<div>
<label class="formLabel">Currrency</label>
<ng-select [items]="Currency" placeholder="Select" bindLabel="currency_name" bindValue="currency_code"
formControlName="currency_code"
[ngClass]="{ errorInput: validationService.onBlur( AddOptForm.controls['currency_code'], 'required') }">
</ng-select>
<span class="errorspan" *ngIf=" validationService.onBlur( AddOptForm.controls['currency_code'], 'required' )">
Please select currency
</span>
</div>
<div *ngIf="AddOptForm.get('per_service_rate')">
<label class="formLabel">Amount</label>
<input class="formInput" formControlName="per_service_rate" type="text"
[ngClass]="{ 'errorInput': validationService.onBlur( AddOptForm.controls['per_service_rate'], 'pattern') || validationService.onBlur( AddOptForm.controls['per_service_rate'], 'required')}" />
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['per_service_rate'], 'pattern')">
Please enter numbers only
</span>
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['per_service_rate'], 'required')">
Please enter amount
</span>
</div>
<div *ngIf="AddOptForm.get('adult_rate')">
<label class="formLabel">Adult</label>
<input class="formInput" formControlName="adult_rate" type="text"
[ngClass]="{ 'errorInput': validationService.onBlur( AddOptForm.controls['adult_rate'], 'pattern') || validationService.onBlur( AddOptForm.controls['adult_rate'], 'required')}" />
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['adult_rate'], 'pattern')">
Accept numbers only
</span>
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['adult_rate'], 'required')">
Please enter adult amount
</span>
</div>
<div *ngIf="AddOptForm.get('youth_rate')">
<label class="formLabel">Youth</label>
<input class="formInput" formControlName="youth_rate" type="text"
[ngClass]="{ 'errorInput': validationService.onBlur( AddOptForm.controls['youth_rate'], 'pattern') || validationService.onBlur( AddOptForm.controls['youth_rate'], 'required')}" />
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['youth_rate'], 'pattern')">
Accept numbers only
</span>
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['youth_rate'], 'required')">
Please enter youth amount
</span>
</div>
<div *ngIf="AddOptForm.get('child_rate')">
<label class="formLabel">Child</label>
<input class="formInput" formControlName="child_rate" type="text"
[ngClass]="{ 'errorInput': validationService.onBlur( AddOptForm.controls['child_rate'], 'pattern') || validationService.onBlur( AddOptForm.controls['child_rate'], 'required')}" />
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['child_rate'], 'pattern')">
Accept numbers only
</span>
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['child_rate'], 'required')">
Please enter child amount
</span>
</div>
<div *ngIf="AddOptForm.get('senior_rate')">
<label class="formLabel">Senior</label>
<input class="formInput" formControlName="senior_rate" type="text"
[ngClass]="{ 'errorInput': validationService.onBlur( AddOptForm.controls['senior_rate'], 'pattern') || validationService.onBlur( AddOptForm.controls['senior_rate'], 'required')}" />
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['senior_rate'], 'pattern')">
Accept numbers only
</span>
<span class="errorspan" *ngIf="validationService.onBlur(AddOptForm.controls['senior_rate'], 'required')">
Please enter senior amount
</span>
</div>
</div>
<div class="text-end mt-20">
<button pButton label="Save" class="btn-primary" (click)="SaveOpt()"></button>
</div>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,225 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from 'primeng/api';
import { ValidationService } from 'src/app/core/common/validation.service';
import { ActivityAddOn, ActivityAddOnDetails } from 'src/app/core/models/optional-ons/optional-ons.model'
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-add-optional-add-on',
templateUrl: './add-optional-add-on.component.html',
})
export class AddOptionalAddOnComponent implements OnInit {
uploadedFiles: any[] = [];
fileArr = [];
fileInfo = [];
AddOptForm: FormGroup;
showImgBox;
RateTypes;
Currency;
addOne_Id;
constructor(
private router: Router,
private ApiServ: API,
private MsgService: MessageService,
private route: ActivatedRoute,
public validationService: ValidationService,
private fb: FormBuilder
) { }
ngOnInit(): void {
this.initForm();
this.GetRateType();
this.GetCurrency();
this.route.queryParams.subscribe(obj => {
if (obj['id']) {
this.showImgBox = true;
this.ApiServ.Get('/ActivityAddOn/GetActivityAddOn/' + obj['id']).subscribe(d => {
this.SetValue(d['responseObject']);
this.addOne_Id = obj['id'];
});
}
})
}
SetValue(val) {
Object.keys(val).forEach(li => {
if (li == "rate" || li == "currency_code") {
this.AddOptForm.get(li).setValue(val[li]);
} else if (li == "_rate_type") {
this.AddOptForm.get(li).setValue(parseInt(val[li]));
this.RateTypesCheck();
if (parseInt(val[li]) == 1) {
this.AddOptForm.get('adult_rate').setValue(val['adult_rate']);
this.AddOptForm.get('senior_rate').setValue(val['senior_rate']);
this.AddOptForm.get('youth_rate').setValue(val['youth_rate']);
this.AddOptForm.get('child_rate').setValue(val['child_rate']);
} else if (parseInt(val[li]) == 2) this.AddOptForm.get('per_service_rate').setValue(val['per_service_rate']);
}
if (li == 'activityAddOnDetails') {
this.setAddOnsDetail(val[li]);
}
})
}
setAddOnsDetail(val) {
val.map(obj => {
Object.keys(obj).forEach(li => {
if (li == "add_on_image" || li == "add_on_description" || li == "add_on_name" || li == 'activity_add_on_id') {
this.AddOptForm.get(li).setValue(obj[li]);
}
})
})
}
GetRateType() {
this.ApiServ.Get('/LovMaster/GetLovByType/AddOnRateType').subscribe(obj => {
if (obj) {
this.RateTypes = obj['responseObject'];
}
})
}
GetCurrency() {
this.ApiServ.Get('/Currency/GetCurrency').subscribe(obj => {
if (obj) {
this.Currency = obj;
}
})
}
RateTypesCheck() {
let val = this.AddOptForm.getRawValue();
if (val._rate_type == '1') {
this.AddOptForm.addControl('adult_rate', this.fb.control('', [Validators.required, Validators.pattern(/^[0-9]*$/)]));
this.AddOptForm.addControl('senior_rate', this.fb.control('', [Validators.required, Validators.pattern(/^[0-9]*$/)]));
this.AddOptForm.addControl('youth_rate', this.fb.control('', [Validators.required, Validators.pattern(/^[0-9]*$/)]));
this.AddOptForm.addControl('child_rate', this.fb.control('', [Validators.required, Validators.pattern(/^[0-9]*$/)]));
this.AddOptForm.removeControl('per_service_rate');
} else if (val._rate_type == '2') {
this.AddOptForm.addControl('per_service_rate', this.fb.control('', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
this.AddOptForm.removeControl('adult_rate');
this.AddOptForm.removeControl('senior_rate');
this.AddOptForm.removeControl('youth_rate');
this.AddOptForm.removeControl('child_rate');
}
}
initForm() {
this.AddOptForm = this.fb.group({
activity_add_on_id: [''],
add_on_name: this.validationService.required,
add_on_description: [''],
add_on_image: this.validationService.required,
supplier_id: ['2205221841391724322'],
_rate_type: this.validationService.required,
currency_code: this.validationService.required,
// per_service_rate: this.validationService.decimal,
})
}
getImage(e) {
if (e.currentFiles.length != 0) {
let file = e.files[0];
this.AddOptForm.get('add_on_image').setValue(file);
}
}
emptyValue() {
this.showImgBox = false;
this.AddOptForm.get('add_on_image').setValue('');
}
SaveOpt() {
if (this.AddOptForm.status == "INVALID") {
this.validationService.showValidationsMsg(this.AddOptForm);
return;
}
this.fileArr = [];
this.fileInfo = [];
let value = this.AddOptForm.getRawValue();
this.showImgBox = false;
let ActAddOnModel = new ActivityAddOn();
let ActAddOnDetailArr = new Array<ActivityAddOnDetails>();
let ActAddOnDetailObj = new ActivityAddOnDetails();
debugger
ActAddOnModel._rate_type = value._rate_type.toString();
ActAddOnModel.currency_code = value.currency_code;
ActAddOnModel.per_service_rate = value.per_service_rate ? parseInt(value.per_service_rate) : 0;
ActAddOnModel.activity_add_on_id = value.activity_add_on_id;
ActAddOnModel.supplier_id = value.supplier_id;
ActAddOnModel.org_id = '2105311837100000021';
ActAddOnModel.is_deleted = false;
ActAddOnModel.activity_id = CommonService.getSessionStoage('activity_id');
if (value._rate_type == '1') {
ActAddOnModel.adult_rate = value.adult_rate;
ActAddOnModel.child_rate = value.child_rate;
ActAddOnModel.senior_rate = value.senior_rate;
ActAddOnModel.youth_rate = value.youth_rate;
} else if (value._rate_type == '2') ActAddOnModel.per_service_rate = value.per_service_rate;
ActAddOnDetailObj.is_deleted = false;
ActAddOnDetailObj.org_id = '2105311837100000021';
ActAddOnDetailObj.activity_id = CommonService.getSessionStoage('activity_id');
ActAddOnDetailObj.add_on_description = value.add_on_description;
if (typeof (value.add_on_image) == 'object') {
this.fileArr.push(value.add_on_image);
this.fileInfo.push({ 'fileName': "AddOns/Add_Act_Id." + value.add_on_image.name.split('.')[1], 'pathToSave': 'ThemeImages/ORGID' });
}
ActAddOnDetailObj.add_on_image = typeof (value.add_on_image) == 'object' ? environment.cdnFileUrl + "ThemeImages/ORGID/AddOns/Add_Act_Id." + value.add_on_image.name.split('.')[1] : value.add_on_image.split('?')[0];
ActAddOnDetailObj.add_on_name = value.add_on_name;
ActAddOnDetailObj.language_code = CommonService.getSessionStoage('Def_Lang_code');
ActAddOnDetailObj.supplier_id = value.supplier_id;
ActAddOnDetailArr.push(ActAddOnDetailObj)
ActAddOnModel.activityAddOnDetails = ActAddOnDetailArr;
if (this.addOne_Id) {
this.ApiServ.Post('/ActivityAddOn/UpdateActivityAddOn', ActAddOnModel).subscribe(data => {
if (data) {
(data['status'] && this.fileInfo.length > 0) ? this.saveImg(data, this.fileArr, this.fileInfo) : this.showToastrMsg(data);
}
})
} else {
this.ApiServ.Post('/ActivityAddOn/SaveActivityAddOn', ActAddOnModel).subscribe(data => {
if (data) {
(data['status'] && this.fileInfo.length > 0) ? this.saveImg(data, this.fileArr, this.fileInfo) : this.showToastrMsg(data);
}
})
}
}
showToastrMsg(respData) {
this.MsgService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
}
saveImg(respData, file_arr, file_info) {
var formdata = new FormData();
file_arr.forEach(x => {
formdata.append("files", x);
})
let Id = this.addOne_Id ? this.addOne_Id : respData['responseObject'].activity_add_on_id;
let a = JSON.stringify(file_info).replaceAll('Add_Act_Id', Id);
formdata.append("fileInfo", a);
this.ApiServ.PostFile('/FileUpload/SaveFile', formdata).subscribe(imdata => {
if (imdata['status']) {
this.showToastrMsg(respData);
}
})
}
btnClick() {
this.router.navigateByUrl("/Services/ActivityServices/ExpServices/Manage");
}
}

View File

@@ -1,130 +0,0 @@
<div class="app-mainHeader mt-20">
<div>Optional Add-Ons</div>
<button pButton type="button" label="Add Optional Add-Ons" class="btn-primary"
[routerLink]="['/Services/ActivityServices/ExpServices/Manage/AddOptionalAddOn']"></button>
</div>
<div class="app-mainCard">
<div class="app-mainGrid4">
<div class="">
<label class="formLabel">Add-On</label>
<input class="formInput" [(ngModel)]="add_on" type="text" />
</div>
</div>
<div class="mt-20">
<button pButton type="button" label="Reset" (click)="ResetExp()" class="btn btn-secondary mr-10"></button>
<button pButton type="button" label="Search" (click)="SearchExp()" class="btn btn-primary"></button>
</div>
</div>
<div class="card">
<p-table #dt [value]="OptAddData" [columns]="cols" [rows]="3" [resizableColumns]="true"
styleClass="p-datatable-gridlines" responsiveLayout="scroll" selectionMode="multiple" [(selection)]="OptAddData"
[paginator]="true" [globalFilterFields]="[
'add_on_name',
'add_on_description',
'rate_type',
'currency_code',
'rate',
'is_active'
]" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
[showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar *ngIf="OptAddData">
<ng-template pTemplate="left">
<div class="p-button-set">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy"
tooltipPosition="bottom"></button>
<button type="button" pButton (click)="dt.exportCSV()" class="btn-secondary mr-10" pTooltip="CSV"
label="CSV" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportExcel()" class="btn-secondary mr-10" pTooltip="XLS"
label="Excel" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportPdf()" class="btn-secondary mr-10" pTooltip="PDF" label="PDF"
tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print"
tooltipPosition="bottom"></button>
</div>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dt.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="add_on_name">
Add-On
<p-sortIcon field="add_on_name" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="add_on_description">
Description
<p-sortIcon field="add_on_description" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rate_type">
Rate Type
<p-sortIcon field="rate_type" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="currency_code">
Currency
<p-sortIcon field="currency_code" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_active">
Status
<p-sortIcon field="is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="Action">Action</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-ons>
<tr>
<td>{{ ons.add_on_name }}</td>
<td>{{ ons.add_on_description }}</td>
<td>{{ ons.rate_type }}</td>
<td>{{ ons.currency_code }}</td>
<td>
<span class="product-badge" [ngClass]="{
'status-active': ons.is_active,
'status-inactive': ons.is_active == false
}">{{ ons.is_active ? "Active" : "Deactive" }}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="Edit(ons.activity_add_on_id)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> edit </span>
<span> Edit </span>
</span>
</button>
<button mat-menu-item (click)="UpdateStatus(ons.activity_add_on_id, ons.is_active)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> check_circle </span>
<span>
{{ ons.is_active ? "Deactivate" : "Activate" }}
</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage">
<tr *ngIf="OptAddData === null || OptAddData" class="ResultNotFound">
<td>
No data found
</td>
</tr>
</ng-template>
</p-table>
</div>
<p-toast></p-toast>

View File

@@ -1,118 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import * as FileSaver from 'file-saver';
import { API } from 'src/app/core/services/api.service';
import jsPDF from "jspdf";
import "jspdf-autotable";
import { MessageService } from 'primeng/api';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'optional-addOns',
templateUrl: './optional-addOns.component.html',
})
export class OptionalAddOnsComponent implements OnInit {
@Input() content
OptAddData;
add_on;
constructor(
private router: Router,
private ApiServ: API,
private MsgService: MessageService
) { }
cols!: any[];
exportColumns!: any[];
ngOnInit(): void {
// console.log(this.content.data)
this.cols = [
{ field: 'add_on_name', header: 'Add-On', customExportHeader: 'Option_Add_Ons_export_' + new Date().getTime() },
{ field: 'add_on_description', header: 'Description' },
{ field: 'rate_type', header: 'Rate Type' },
{ field: 'currency_code', header: 'Currency' },
{ field: 'rate', header: 'Amount' },
{ field: 'is_active', header: 'Status' },
];
this.exportColumns = this.cols.map((col) => ({
title: col.header,
dataKey: col.field,
}));
}
exportPdf() {
// const doc = new jsPDF();
const doc = new jsPDF('p', 'pt');
doc['autoTable'](this.exportColumns, this.OptAddData);
// doc.autoTable(this.exportColumns, this.products);
doc.save("Option_Add_Ons_export_" + new Date().getTime() + ".pdf");
}
Edit(pk_id) {
let obj = { id: pk_id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/AddOptionalAddOn'], { queryParams: obj })
}
UpdateStatus(exp_id, status) {
let obj = { id: exp_id, status: status ? false : true, updatedBy: '' }
this.ApiServ.Post('/ActivityAddOn/UpdateStatus', obj).subscribe((data) => {
if (data) {
this.MsgService.add({
severity: data["status"] ? "success" : "error",
detail: data["message"],
});
this.SearchExp();
}
});
}
SearchExp() {
let activityid = CommonService.getSessionStoage('activity_id')
let obj = {
activityId: activityid,
_add_on_name: this.add_on ? this.add_on : "",
_language_code: CommonService.getSessionStoage('Def_Lang_code')
}
this.ApiServ.Post('/ActivityAddOn/GetActivityAddOn', obj).subscribe(e => {
if (e) {
this.OptAddData = e['responseObject'];
}
})
}
ResetExp() {
this.add_on = '';
}
exportExcel() {
import('xlsx').then((xlsx) => {
console.log(xlsx);
const worksheet = xlsx.utils.json_to_sheet(this.OptAddData);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, {
bookType: 'xlsx',
type: 'array',
});
this.saveAsExcelFile(excelBuffer, 'Option_Add_Ons');
});
}
saveAsExcelFile(buffer: any, fileName: string): void {
import('file-saver').then((abc) => {
let EXCEL_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
let EXCEL_EXTENSION = '.xlsx';
const data: Blob = new Blob([buffer], {
type: EXCEL_TYPE,
});
console.log(FileSaver);
FileSaver.saveAs(
data,
fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION
);
});
}
}

View File

@@ -1,137 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Modify Allocation</div>
<div class="app-mainCard" [formGroup]="FormData">
<div class="app-mainGrid2">
<div class="">
<label class="formLabel">Experience Name</label>
<input class="formInput readonlyInput" formControlName="activity_name" type="text" readonly />
</div>
<div class="">
<label class="formLabel">Option Name</label>
<input class="formInput readonlyInput" formControlName="option_name" type="text" readonly />
</div>
</div>
<div class="app-mainCard mt-20">
<div class="app-mainGrid4 mt-20" *ngIf="FormData.get('slot_id')">
<div class="ng-hideHead">
<label class="formLabel">Slot</label>
<ng-select #select formControlName="slot_id" [ngClass]="{ errorInput: validationService.onBlur(FormData.controls['slot_id'],'required')}">
<ng-option *ngFor="let item of AllSlots" [value]="item.activity_slot_id">
{{ item.start_time | date : 'HH:mm'}} to {{item.end_time| date : 'HH:mm'}}
</ng-option>
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['slot_id'],
'required'
)
">Please select Slot</span>
</div>
</div>
<div class="app-mainGrid4 mb-20 mt-20">
<div class="dateRange">
<label for="multiple1" class="formLabel">Period Type</label>
<ng-select [items]="lovKeyDataObj.RatePeriodType" bindLabel="lov_value" (change)="ClearSearchField()" formControlName="period_type" bindValue="lov_key">
</ng-select>
</div>
<div class="dateRange" *ngIf="FormData.get('period_type').value == '1'">
<label for="multiple1" class="formLabel">Date Range</label>
<p-calendar [numberOfMonths]="2" formControlName="dates" selectionMode="range" [readonlyInput]="true" inputId="multiple">
</p-calendar>
</div>
<div *ngIf="FormData.get('period_type').value == '2'">
<label class="formLabel">Season</label>
<ng-select formControlName="seasonId" #select [multiple]="true">
<ng-option *ngFor="let activity_obj of season_list" [value]="activity_obj.activitySeason.activity_season_id">
{{ activity_obj.activitySeason.season_name}}</ng-option>
</ng-select>
</div>
<div>
<label class="formLabel">Days</label>
<ng-select #select [items]="lovKeyDataObj.DaySelect" bindLabel="lov_value" bindValue="lov_key" formControlName="days" appendTo="body" [multiple]="true">
</ng-select>
</div>
<div class="mt-20">
<button pButton type="button " (click)="getAllocationDetails()" label="Search" class="btn-primary btn mr-20"></button>
<button pButton type="button" (click)="reset()" label="Reset" class="btn-primary btn"></button>
</div>
</div>
</div>
<div class="app-mainCard" [formGroup]="FormData">
<div class="listBox mt-20 d-flex">
<p-listbox [metaKeySelection]="false" [multiple]="true" [options]="Months" optionLabel="name">
</p-listbox>
</div>
<div class="tableWrapper d-flex" formArrayName="Allocation_list">
<table>
<tr class="tablehead" [formGroupName]="0">
<th></th>
<th>
<input class="formInput" formControlName="allocation_count" type="number" />
</th>
<th>
<input class="formInput" formControlName="release_days" type="number" />
</th>
<th>
<mat-checkbox formControlName="FreeSale" (change)="freesalecheck($event.checked ,0)"></mat-checkbox>
</th>
<th>
<mat-checkbox formControlName="StopSale" (change)="StopSalecheck($event.checked ,0)"></mat-checkbox>
</th>
</tr>
<tr>
<th>
<div>Date</div>
</th>
<th>
<div>
Allocation
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th>
<div>
Release Days
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th>
<div>Free Sale</div>
</th>
<th>
<div>Stop Sale</div>
</th>
</tr>
<tr *ngFor="let data of AllocationDetails; let i = index" [formGroupName]="i +1">
<td>{{data._date | date : "dd MMM YYYY"}}</td>
<td>
<input class="formInput" formControlName="allocation_count" type="number" />
</td>
<td>
<input class="formInput" formControlName="release_days" type="number" />
</td>
<td>
<mat-checkbox formControlName="FreeSale" (change)="freesalecheck($event.checked ,i +1)">
</mat-checkbox>
</td>
<td>
<mat-checkbox formControlName="StopSale" (change)="StopSalecheck($event.checked ,i + 1)">
</mat-checkbox>
</td>
</tr>
</table>
<div class="app-tableBtn">
<button pButton type="button" label="Copy on UI" (click)="CopyOnUi()" class="btn-primary"></button>
</div>
</div>
<div class="text-end mt-20">
<button pButton type="button" label="Save" (click)="updateAllocation()" class="btn-primary"></button>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,410 +0,0 @@
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatCheckbox } from '@angular/material/checkbox';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { MessageService } from 'primeng/api';
import { ValidationService } from 'src/app/core/common/validation.service';
import { AllocationItems, UpdateAllocation } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-allocation/edit-allocation.model';
import { GetCancellationPolicy } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-cancellation-policy/edit-cancellation-policy.model';
import { GetRateDetails } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-rate-confi/edit-rate-confi.model';
// import { AllocationItems, UpdateAllocation } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-allocation/edit-allocation.model';
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
interface grp {
name: string;
code: string;
}
@Component({
selector: 'app-edit-allocation',
templateUrl: './edit-allocation.component.html',
})
export class EditAllocationComponent implements OnInit {
FormData: FormGroup
activityContractId;
activityContract;
DaySelect;
NoShowPolicyType;
AllSlotData;
AllocationDetails;
SoltDate;
slot_wise_cancellation_policy;
RateConfigdata
AllSlots;
lovKeyDataObj = {
RatePeriodType: [],
DaySelect: [],
ActivityNoShowPolicyType: [],
ActivityCancellationPolicyType: [],
ActivityCancellationChargeType: [],
};
season_list;
constructor(private router: Router, private route: ActivatedRoute, public ApiServ: API, public Fb: FormBuilder, public MsgService: MessageService, public validationService: ValidationService) { }
ngOnInit(): void {
this.NgOinitFrom();
this.GetSlotData();
this.GetRateConfig();
this.GetAllActivitySeason();
this.GetLOVKeys('RatePeriodType,DaySelect,ActivityNoShowPolicyType,ActivityCancellationPolicyType,ActivityCancellationChargeType');
};
/**
* @author Abdul Razzak
* To create form group
*/
NgOinitFrom() {
this.FormData = this.Fb.group({
option_name: [''],
activity_name: [''],
period_type: [''],
seasonId: [''],
dates: [''],
days: [''],
Allocation_list: this.Fb.array([
this.Fb.group({
allocation_count: [''],
release_days: [''],
FreeSale: [false],
StopSale: [false],
})
])
});
}
/**
* @author Abdul Razzak
* to get activity contract data by contract id and set value
*/
GetRateConfig() {
this.route.queryParams.subscribe(obj => {
if (obj['id']) {
this.GetActivityById();
this.activityContractId = obj['id'];
this.GetSlotsById(obj['id']);
this.ApiServ.Get('/ActivityContract/GetRateConfig/' + obj['id']).subscribe(d => {
if (d && d.status) {
this.RateConfigdata = d.responseObject;
d.responseObject.is_slot_wise_cancellation_policy;
if (d.responseObject.is_slot_wise_cancellation_policy) {
this.FormData.addControl('slot_id', this.Fb.control('',[Validators.required]));
}
this.FormData.get('option_name').setValue(d.responseObject.option_name);
}
})
}
});
}
/**
* @author Abdul Razzak
* to get slot data by contract id
* @param Id
*/
GetSlotsById(Id) {
this.ApiServ.Get('/ActivityContract/GetSlotsById/' + Id).subscribe(res => {
if (res) {
this.AllSlots = res.responseObject;
}
})
}
/**
* @author Abdul Razzak
* to get activity details
*/
GetActivityById() {
let activity_id = CommonService.getSessionStoage('activity_id');
this.ApiServ.Get('/Activity/GetActivity/' + activity_id).subscribe(res => {
if (res) {
this.FormData.get('activity_name').setValue(res.responseObject.activityContents[0].activity_name);
}
})
}
/**
* @author Abdul razzak
* to set value
*/
CopyOnUi() {
console.log('this.allocationValue.nativeElement.value')
let Group = this.Allocation_list.getRawValue();
let newgroup = Group.splice(0, 1)
Group.map((e, i) => {
!newgroup[0].FreeSale ? this.Allocation_list.controls[i + 1].get('allocation_count').setValue(newgroup[0].allocation_count) : '';
this.StopSalecheck(newgroup[0].StopSale, i + 1);
this.freesalecheck(newgroup[0].FreeSale, i + 1);
this.Allocation_list.controls[i + 1].get('StopSale').setValue(newgroup[0].StopSale);
this.Allocation_list.controls[i + 1].get('FreeSale').setValue(newgroup[0].FreeSale);
this.Allocation_list.controls[i + 1].get('release_days').setValue(newgroup[0].release_days);
});
}
/**
* @author Abdul Razzak
* to get data from LOV
* @param lov_key_names
*/
GetLOVKeys(lov_key_names) {
let lov_key_names_arr = lov_key_names.split(',');
let lov_obj = {
"lov_types": [],
"lov_lang": "en"
}
lov_key_names_arr.forEach(key_name => {
lov_obj.lov_types.push({ "lov_type": key_name });
});
this.ApiServ.Post('/LovMaster/GetLov', lov_obj).subscribe(lov_data => {
if (lov_data && lov_data.status) {
this.GetActivityById();
lov_key_names_arr.forEach(key_name => {
let arr = lov_data.responseObject.filter(el => el.lov_type == key_name);
arr.length > 0 ? this.lovKeyDataObj[key_name] = arr[0].keys : '';
});
}
});
}
/**
* @author Abdul Razzak
* to get all activity season data
*/
GetAllActivitySeason() {
this.ApiServ.Get('/ActivitySeason/GetAllActivitySeason?activityId=' + CommonService.getSessionStoage('activity_id')).subscribe(d => {
if (d && d.status) {
this.season_list = d.responseObject;
}
});
}
/**
* @author Abdul Razzak
* to get form group controls
*/
get Allocation_list() {
return this.FormData.get('Allocation_list') as FormArray
};
/**
* @author Abdul Razzak
* to set value for each form list
* @param data
*/
setValue(data) {
this.Allocation_list.clear();
this.addForm();
for (let i = 0; i < data.length; i++) {
this.addForm();
let formval = this.Allocation_list.controls[i + 1].value;
Object.keys(formval).forEach(a => {
if (a == 'StopSale' || a == 'FreeSale') {
if (data[i]['_allocation_type'] == '1') {
this.Allocation_list.controls[i + 1].get('FreeSale').setValue(true);
this.freesalecheck(true, i + 1);
}
if (data[i]['_allocation_type'] == '2') {
this.Allocation_list.controls[i + 1].get('StopSale').setValue(true);
this.StopSalecheck(true, i + 1);
}
}
else {
this.Allocation_list.controls[i + 1].get(a).setValue(data[i][a]);
}
});
}
};
/**
* @author Abdul Razzak
* to create allocation form group
*
*/
addForm() {
this.Allocation_list.push(this.Fb.group({
allocation_count: [''],
release_days: [''],
FreeSale: [false],
StopSale: [false],
_date: [''],
activity_allocation_id: [''],
}));
};
/**
* @author Abdul Razzak
* to get slots list by contract id
*/
GetSlotData() {
this.ApiServ.Get('/ActivityContract/GetSlotsById/' + this.activityContractId).subscribe(data => {
if (data) {
this.AllSlotData = data.responseObject;
}
});
};
/**
* @author Abdul Razzak
* to clear input field
*/
ClearSearchField() {
let val = this.FormData.getRawValue()
if (val.period_type == 2) this.FormData.get('dates').setValue('');
else if (val.period_type == 1) this.FormData.get('seasonId').setValue([]);
}
Months = [
{ id: 1, name: 'Jan' },
{ id: 2, name: 'Feb' },
{ id: 3, name: 'Mar' },
{ id: 4, name: 'Apr' },
{ id: 5, name: 'Jun' },
{ id: 6, name: 'Jun' },
{ id: 7, name: 'Jul' },
{ id: 8, name: 'Aug' },
{ id: 9, name: 'Sep' },
{ id: 10, name: 'Oct' },
{ id: 11, name: 'Nov' },
{ id: 12, name: 'Dec' },
];
MonthsList = this.Months[0].name;
/**
* @author Abdul razzak
* to get all allocation details
*/
getAllocationDetails() {
let val = this.FormData.getRawValue();
let postdata = new GetRateDetails();
postdata.from_date = val.dates[0] ? moment(val.dates[0]).format('YYYY-MM-DD') : '';
postdata.to_date = val.dates[1] ? moment(val.dates[1]).format('YYYY-MM-DD') : '';
postdata.dates = '';
postdata.slot_id = val.slot_id ? val.slot_id : '';
postdata.seasonId = val.seasonId ? val.seasonId : [];
postdata.days = val.days ? val.days.join(',') : '';
postdata.contract_id = this.activityContractId;
this.ApiServ.Post('/ActivityContract/GetAllocationDetails', postdata).subscribe(data => {
if (data) {
this.AllocationDetails = data.responseObject;
data.responseObject ? this.setValue(data.responseObject) : '';
}
});
};
/**
* @author Abdul Razzak
* to update allocation value
* @returns
*/
updateAllocation() {
if (this.FormData.status == "INVALID") {
this.validationService.showValidationsMsg(this.FormData);
const firstElementWithError = document.querySelector('.ng-invalid');
if (firstElementWithError) {
firstElementWithError.scrollIntoView({ behavior: 'smooth' });
}
return;
}
let value = this.FormData.getRawValue();
let postArr = [];
value.Allocation_list.splice(0, 1)
value.Allocation_list.map((e, i) => {
let items = new AllocationItems();
if (value.Allocation_list[i].FreeSale) {
items._allocation_type = '1';
} else if (value.Allocation_list[i].StopSale) {
items._allocation_type = '2';
} else items._allocation_type = '3';
items.allocation_count = value.Allocation_list[i].allocation_count ? value.Allocation_list[i].allocation_count : 0;
items.release_days = value.Allocation_list[i].release_days ? value.Allocation_list[i].release_days : 0;
items.activity_allocation_id = value.Allocation_list[i].activity_allocation_id;
postArr.push(items)
})
let PostData = new UpdateAllocation();
PostData.activity_contract_id = this.activityContractId;
PostData.activity_slot_id = value.slot_id ? value.slot_id : '';
PostData.allocationItems = postArr;
this.ApiServ.Post('/ActivityContract/UpdateActivityAllocation', PostData).subscribe((res) => {
if (res) {
this.showToastrMsg(res)
}
});
};
/**
* @author Abdul Razzak
* to show toaster
* @param respData
*/
showToastrMsg(respData) {
this.MsgService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
}
/**
* @author Abdul Razzak
* to navigate overview
*/
btnClick() {
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage'])
}
/**
* @author Abdul Razzak
* to disable checkbox
* @param Check
* @param Ind
*/
freesalecheck(Check, Ind) {
if (Check) {
this.Allocation_list.controls[Ind].get('StopSale').disable();
this.Allocation_list.controls[Ind].get('allocation_count').disable();
this.Allocation_list.controls[Ind].get('allocation_count').setValue('');
} else {
this.Allocation_list.controls[Ind].get('allocation_count').enable();
this.Allocation_list.controls[Ind].get('StopSale').enable();
}
};
/**
* @author Abdul Razzak
* to disable checkbox
* @param Check
* @param Ind
*/
StopSalecheck(Check, Ind) {
if (Check) {
this.Allocation_list.controls[Ind].get('FreeSale').disable();
} else {
this.Allocation_list.controls[Ind].get('FreeSale').enable();
}
};
/**
* @author Abdul Razzak
* to reset search value
*/
reset() {
this.FormData.get('seasonId').setValue([]);
this.FormData.get('dates').setValue('');
this.FormData.get('period_type').setValue('');
this.FormData.get('slot_id').setValue('');
this.FormData.get('slot_id').markAsUntouched();
this.FormData.get('days').setValue('');
}
}

View File

@@ -1,161 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Modify Cancellation</div>
<div [formGroup]="FromData">
<div class="app-mainCard">
<div class="app-mainGrid2">
<div>
<label class="formLabel">Experience Name</label>
<input class="formInput readonlyInput" formControlName="activity_name" type="text" readonly />
</div>
<div>
<label class="formLabel">Option Name</label>
<input class="formInput readonlyInput" formControlName="option_name" type="text" readonly />
</div>
</div>
<div class="app-mainGrid4 mt-20">
<div class="ng-hideHead">
<label class="formLabel">No Show Type</label>
<ng-select [items]="lovKeyDataObj.ActivityNoShowPolicyType" bindLabel="lov_value" (change)="No_Show_Type($event.lov_key)" formControlName="_no_show_policy_type" bindValue="lov_key" [ngClass]="{ errorInput: validationService.onBlur(FromData.controls['_no_show_policy_type'],'required')}">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FromData.controls['_no_show_policy_type'],
'required'
)
">Please select No Show Type</span>
</div>
<div *ngIf="FromData.get('no_show_charge_value')">
<label class="formLabel">Value</label>
<input class="formInput" formControlName="no_show_charge_value" type="text" [ngClass]="{ errorInput: validationService.onBlur(FromData.controls['no_show_charge_value'],'required') || validationService.onBlur(FromData.controls['no_show_charge_value'],'pattern')}"
/>
<span class="errorspan" *ngIf="
validationService.onBlur(
FromData.controls['no_show_charge_value'],
'required'
)
">Please enter value </span>
<span class="errorspan" *ngIf="
validationService.onBlur(
FromData.controls['no_show_charge_value'],
'pattern'
)
">accept number only </span>
</div>
</div>
</div>
<div class="app-mainCard mt-20">
<div class="app-mainGrid4 mt-20" *ngIf="slot_wise_cancellation_policy">
<div class="ng-hideHead">
<label class="formLabel">Slot</label>
<ng-select #select formControlName="slot_id">
<ng-option *ngFor="let item of AllSlots" [value]="item.activity_slot_id">
{{ item.start_time | date : 'HH:mm'}} to {{item.end_time| date : 'HH:mm'}}
</ng-option>
</ng-select>
</div>
</div>
<div class="app-mainGrid4 mb-20 mt-20">
<div class="dateRange">
<label for="multiple1" class="formLabel">Period Type</label>
<ng-select [items]="lovKeyDataObj.RatePeriodType" bindLabel="lov_value" (change)="ClearSearchField()" formControlName="period_type" bindValue="lov_key">
</ng-select>
</div>
<div class="dateRange" *ngIf="FromData.get('period_type').value == '1'">
<label for="multiple1" class="formLabel">Date Range</label>
<p-calendar [numberOfMonths]="2" (onSelect)="Checkdate()" formControlName="dates" selectionMode="range" [readonlyInput]="true" inputId="multiple">
</p-calendar>
</div>
<div *ngIf="FromData.get('period_type').value == '2'">
<label class="formLabel">Season</label>
<ng-select formControlName="seasonId" #select [multiple]="true" (change)="checkMonthOfSeason()">
<ng-option *ngFor="let activity_obj of season_list" [value]="activity_obj.activitySeason.activity_season_id">
{{ activity_obj.activitySeason.season_name}}</ng-option>
</ng-select>
</div>
<div>
<label class="formLabel">Days</label>
<ng-select #select [items]="lovKeyDataObj.DaySelect" bindLabel="lov_value" bindValue="lov_key" formControlName="days" appendTo="body" [multiple]="true">
</ng-select>
</div>
<div class="mt-20">
<button pButton type="button" label="Search" (click)="SearchCancellationPolicy()" class="btn-primary btn mr-20"></button>
<button pButton type="button" label="Reset" (click)="reset()" class="btn-primary btn "></button>
</div>
</div>
</div>
<div class="app-mainCard mt-20">
<div class="listBox mt-20 d-flex" *ngIf="AllMonths.length > 0">
<p-listbox [metaKeySelection]="false" [multiple]="true" (onClick)="MonthCheck($event)" [options]="AllMonths">
</p-listbox>
</div>
<div class="app-copyUibtn">
<button pButton type="button" (click)="CopyBlocksValue()" label="Copy first block data on UI based on Days" class="btn-primary w-20"></button>
</div>
<div class="tableWrapper w-100" formArrayName="cancellationDisplays">
<table>
<tr>
<th>
<div>Date</div>
</th>
<th>
<div>Days</div>
</th>
<th>
<div>Policy Type</div>
</th>
<th>
<div>Cancellation Type</div>
</th>
<th>
<div>Range</div>
</th>
<th>
<div>
Value
<button pButton label="Copy blocks on UI " (click)="CopyValue()" class="tb-btn btn-primary btn-copy"></button>
</div>
</th>
</tr>
<tr *ngFor="let data of cancelDisplay.controls; let i = index" [formGroupName]="i">
<td>{{data.get('_date').value| date: 'dd MMM YYYY'}}</td>
<td>{{data.get('_date').value| date : 'EEEE'}}</td>
<td>
<div class="ng-hideHead">
<ng-select #select appendTo="body" [ngClass]="{'errorInput': validationService.onBlur(data['controls']['_cancellation_policy_type'],'required')}" formControlName="_cancellation_policy_type" bindValue="lov_key" bindLabel="lov_value" [items]="lovKeyDataObj.ActivityCancellationPolicyType">
</ng-select>
</div>
</td>
<td>
<div class="ng-hideHead">
<ng-select #select appendTo="body" bindLabel="lov_value" [ngClass]="{'errorInput': validationService.onBlur(data['controls']['_charge_type'],'required')}" (change)="InputClear($event.lov_key,i , data)" formControlName="_charge_type" bindValue="lov_key"
[items]="lovKeyDataObj.ActivityCancellationChargeType">
</ng-select>
</div>
</td>
<td>{{data.get('_from').value}} to {{data.get('_to').value}}</td>
<td>
<input class="formInput" [ngClass]="{'errorInput': validationService.onBlur(data['controls']['charge_value'],'required') || validationService.onBlur(data['controls']['charge_value'],'pattern')}" [ngClass]="{'readonlyInput' : data.get('_charge_type').value == '1' }"
formControlName="charge_value" [readonly]="data.get('_charge_type').value == '1'" type="text" />
</td>
<td>
<button (click)="remove(i)" class="btn-icon close-btn">
<span class="material-icons">
close
</span>
</button>
</td>
</tr>
</table>
</div>
<div class="text-end mt-20">
<button pButton type="button" (click)="UpdateCancellationDetails()" label="Save" class="btn-primary"></button>
</div>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,472 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { API } from 'src/app/core/services/api.service';
import * as moment from 'moment';
import { ValidationService } from 'src/app/core/common/validation.service';
// import { CancellationDisplay, GetCancellationPolicy, UpdateCancellationPolicy } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-cancellation-policy/edit-cancellation-policy.model';
import { MessageService } from 'primeng/api';
import { CommonService } from 'src/app/core/services/common.service';
import { CancellationDisplay, GetCancellationPolicy, UpdateCancellationPolicy } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-cancellation-policy/edit-cancellation-policy.model';
interface grp {
name: string,
code: string
}
@Component({
selector: 'app-edit-cancelletion-policy',
templateUrl: './edit-cancelletion-policy.component.html',
})
export class EditCancelletionPolicyComponent implements OnInit {
Pickup: string[] = [];
date1!: Date;
date2!: Date;
CommonCalender!: string;
FromData: FormGroup
Data;
AllSlots;
activityContractId;
RateConfigdata;
season_list;
slot_wise_cancellation_policy;
lovKeyDataObj = {
RatePeriodType: [],
DaySelect: [],
ActivityNoShowPolicyType: [],
ActivityCancellationPolicyType: [],
ActivityCancellationChargeType: [],
};
constructor(private route: ActivatedRoute,
public ApiServ: API, public Fb: FormBuilder,
public validationService: ValidationService,
private MsgService: MessageService,
private router: Router,) { }
ngOnInit(): void {
this.GetLOVKeys('RatePeriodType,DaySelect,ActivityNoShowPolicyType,ActivityCancellationPolicyType,ActivityCancellationChargeType');
this.GetRateConfig();
this.ngOninForm();
this.GetAllActivitySeason();
}
/**
* @author Abdul Razzak
* to create form group
*/
ngOninForm() {
this.FromData = this.Fb.group({
activity_name: [''],
option_name: [''],
period_type: [''],
slot_id: [''],
dates: [''],
days: [''],
seasonId: [''],
_no_show_policy_type: this.validationService.required,
cancellationDisplays: this.Fb.array([
])
});
}
/**
* @author Abdul Razzak
* to get activity contract data by contract id and set value
*/
GetRateConfig() {
this.route.queryParams.subscribe(obj => {
if (obj['id']) {
this.GetActivityById();
this.activityContractId = obj['id'];
this.GetSlotsById(obj['id']);
this.ApiServ.Get('/ActivityContract/GetRateConfig/' + obj['id']).subscribe(d => {
if (d && d.status) {
this.RateConfigdata = d.responseObject;
this.slot_wise_cancellation_policy = d.responseObject.is_slot_wise_cancellation_policy;
this.FromData.get('option_name').setValue(d.responseObject.option_name);
this.FromData.get('_no_show_policy_type').setValue(parseInt(d.responseObject._no_show_policy_type));
if (d.responseObject._no_show_policy_type != 1) {
this.No_Show_Type(d.responseObject._no_show_policy_type);
this.FromData.get('no_show_charge_value').setValue(d.responseObject.no_show_charge_value);
}
}
})
}
});
}
/**
* @author Abdul Razzak
* to get slot data by contract id
* @param Id
*/
GetSlotsById(Id) {
this.ApiServ.Get('/ActivityContract/GetSlotsById/' + Id).subscribe(res => {
if (res) {
this.AllSlots = res.responseObject;
}
})
}
/**
* @author Abdul Razzak
* to get form controls
*/
get cancelDisplay() {
return this.FromData.get('cancellationDisplays') as FormArray;
};
// AddFormDate() {
// this.cancelDisplay.push(this.Fb.group({
// _charge_type: this.validationService.required,
// charge_value: [''],
// _from: [''],
// _to: [''],
// _date: [''],
// activity_cancellation_policy_id: [''],
// // _cancellation_policy_type: this.validationService.required,
// }))
// }
// cancellationDisplays;
// SetValue(d) {
// let value = this.FromData.getRawValue();
// this.cancellationDisplays = d.cancellationDisplays;
// this.setinputVal(d.cancellationDisplays);
// // Object.keys(value).forEach(e => {
// // if (e != 'cancellationDisplays') {
// // this.FromData.get(e).setValue(d[e]);
// // }
// // });
// }
// setinputVal(data) {
// for (let i = 0; i < data.length; i++) {
// console.log(i);
// this.AddFormDate()
// let formval = this.cancelDisplay.controls[i].value
// Object.keys(formval).forEach(a => {
// console.log(a)
// if (a == "_charge_type") {
// this.cancelDisplay.controls[i].get('_charge_type').setValue(parseInt(data[i][a]));
// }
// // else if (a == '_cancellation_policy_type') {
// // this.cancelDisplay.controls[i].get(a).setValue(parseInt(data[i][a]));
// // }
// else if (a == 'charge_value') {
// this.cancelDisplay.controls[i].get('charge_value').setValue(this.cancelDisplay.controls[i].get('_charge_type').value == '1' ? '' : data[i][a]);
// }
// else {
// this.cancelDisplay.controls[i].get(a).setValue(data[i][a]);
// }
// });
// };
// };
// LOVCancallationData;
// LOVCancallationPolicy;
// GetLOVMater() {
// let formdata = {
// "lov_types": [
// { "lov_type": "NoShowType" },
// { "lov_type": "CancellationPolicyType" }
// ],
// "lov_lang": "EN"
// }
// this.ApiServ.Post("/LovMaster/GetLov", formdata).subscribe(data => {
// if (data) {
// this.LOVCancallationData = data.responseObject[0].keys;
// this.LOVCancallationPolicy = data.responseObject[1].keys;
// }
/**
* @author Abdul Razzak
* to check cancellation type if full amount is selected then
* @param val
* @param ind
*/
InputClear(val, ind, group) {
if (val == '1') {
this.cancelDisplay.controls[ind].get('charge_value').setValue('');
this.addvalidNum('charge_value', val, group);
} else this.addvalidNum('charge_value', val, group);
};
addvalidNum(name, val, group) {
if (val == '1') {
group.controls[name].clearValidators();
group.controls[name].updateValueAndValidity();
group.controls[name].markAsUntouched();
} else {
group.controls[name].addValidators([Validators.required, Validators.pattern(/^[0-9.]*$/)]);
group.controls[name].updateValueAndValidity();
}
};
/**
* @author Abdul Razzak
* to empty value
* @param ind
*/
No_Show_Type(ind) {
if (ind != 1) {
this.FromData.addControl('no_show_charge_value', this.Fb.control('', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
} else {
this.FromData.removeControl('no_show_charge_value');
}
}
/**
* @author Abdul Razzak
* to get data from LOV
* @param lov_key_names
*/
GetLOVKeys(lov_key_names) {
let lov_key_names_arr = lov_key_names.split(',');
let lov_obj = {
"lov_types": [],
"lov_lang": "en"
}
lov_key_names_arr.forEach(key_name => {
lov_obj.lov_types.push({ "lov_type": key_name });
});
this.ApiServ.Post('/LovMaster/GetLov', lov_obj).subscribe(lov_data => {
if (lov_data && lov_data.status) {
this.GetActivityById();
lov_key_names_arr.forEach(key_name => {
let arr = lov_data.responseObject.filter(el => el.lov_type == key_name);
arr.length > 0 ? this.lovKeyDataObj[key_name] = arr[0].keys : '';
});
}
});
}
/**
* @author Abdul Razzak
* to get activity details
*/
GetActivityById() {
let activity_id = CommonService.getSessionStoage('activity_id');
this.ApiServ.Get('/Activity/GetActivity/' + activity_id).subscribe(res => {
if (res) {
this.FromData.get('activity_name').setValue(res.responseObject.activityContents[0].activity_name);
}
})
}
/**
* @author Abdul Razzak
* to remove specific row of cancellation policy list
* @param ind
*/
remove(ind) {
this.cancelDisplay.removeAt(ind);
}
CopyValue() {
let val = this.cancelDisplay.getRawValue();
for (let i = 1; i < val.length; i++) {
this.cancelDisplay.controls[i].get('charge_value').setValue(this.cancelDisplay.controls[i].get('_charge_type').value != '1' ? val[0].charge_value : '');
}
}
CopyBlocksValue() {
let val = this.cancelDisplay.getRawValue();
for (let i = 1; i < val.length; i++) {
this.cancelDisplay.controls[i].get('_cancellation_policy_type').setValue(val[0]._cancellation_policy_type);
this.cancelDisplay.controls[i].get('_charge_type').setValue(val[0]._charge_type);
this.cancelDisplay.controls[i].get('charge_value').setValue(this.cancelDisplay.controls[i].get('_charge_type').value != '1' ? val[0].charge_value : '');
}
}
/**
* @author Abdul Razzak
* to get all activity season data
*/
GetAllActivitySeason() {
this.ApiServ.Get('/ActivitySeason/GetAllActivitySeason?activityId=' + CommonService.getSessionStoage('activity_id')).subscribe(d => {
if (d && d.status) {
this.season_list = d.responseObject;
}
});
}
/**
* @author Abdul Razzak
* to get all cancellation details
*/
SearchCancellationPolicy() {
let val = this.FromData.getRawValue();
let postdata = new GetCancellationPolicy();
postdata.from_date = val.dates[0] ? moment(val.dates[0]).format('YYYY-MM-DD') : '';
postdata.to_date = val.dates[1] ? moment(val.dates[1]).format('YYYY-MM-DD') : '';
postdata.slot_id = val.slot_id ? val.slot_id : '';
postdata.seasonId = val.seasonId ? val.seasonId : [];
postdata.days = val.days ? val.days.join(',') : '';
postdata.contract_id = this.activityContractId;
this.ApiServ.Post('/ActivityContract/GetCancellationPolicy', postdata).subscribe(res => {
if (res) {
this.SetPolicyValue(res.responseObject)
}
})
}
/**
* @author Abdul Razzak
* method to create form group controler and set value
* @param data
*/
SetPolicyValue(data) {
this.cancelDisplay.clear()
data.forEach(d => {
this.cancelDisplay.push(this.Fb.group({
_charge_type: [parseInt(d._charge_type), [Validators.required]],
charge_value: parseInt(d._charge_type) == 1 ? [''] : [d.charge_value, [Validators.required, Validators.pattern(/^[0-9.]*$/)]],
_from: [d._from],
_to: [d._to],
_date: [d._date],
activity_cancellation_policy_id: [d.activity_cancellation_policy_id],
_cancellation_policy_type: [parseInt(d._cancellation_policy_type), [Validators.required]]
}))
})
}
/**
* @author Abdul Razzak
* method to update cancellation details
*/
UpdateCancellationDetails() {
let postArrayData = [];
if (this.FromData.status == 'INVALID') {
this.validationService.showValidationsMsg(this.FromData);
const firstElementWithError = document.querySelector('.ng-invalid');
if (firstElementWithError) {
firstElementWithError.scrollIntoView({ behavior: 'auto' });
}
return;
};
let val = this.FromData.getRawValue()
let ValArr = this.cancelDisplay.getRawValue();
ValArr.map(e => {
let PostArray = new CancellationDisplay();
PostArray._cancellation_policy_type = e._cancellation_policy_type.toString();
PostArray._charge_type = JSON.stringify(e._charge_type);
PostArray.charge_value = e.charge_value ? e.charge_value : 0;
PostArray.activity_cancellation_policy_id = e.activity_cancellation_policy_id;
PostArray.date = e.date;
PostArray.from = e.from;
PostArray.to = e.to;
postArrayData.push(PostArray);
})
let PostData = new UpdateCancellationPolicy();
PostData.activity_contract_id = this.activityContractId;
PostData._no_show_policy_type = val._no_show_policy_type.toString();
PostData.no_show_value = val.no_show_charge_value ? val.no_show_charge_value : 0;
PostData.cancellation_policy = postArrayData;
this.ApiServ.Post('/ActivityContract/UpdateActivityCancellation', PostData).subscribe(data => {
if (data) {
this.showToastrMsg(data)
}
});
};
/**
* @author Abdul Razzak
* to show toastr
* @param respData
*/
showToastrMsg(respData) {
this.MsgService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
}
/**
* @author Abdul razzak
* to navigate overview tab
*/
btnClick() {
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage'])
}
/**
* @author Abdul Razzak
* to clear hide field value
*/
ClearSearchField() {
let val = this.FromData.getRawValue()
if (val.period_type == 2) this.FromData.get('dates').setValue('');
else if (val.period_type == 1) this.FromData.get('seasonId').setValue([]);
}
AllMonths = []
Checkdate() {
let date = this.FromData.get('dates').value
console.log(date)
if (date.length > 1) {
// var result = eachMonthOfInterval({
// start: new Date(date[0]),
// end: new Date(date[1])
// });
// console.log(result);
let allname = []
// this.AllMonths = result.map(e => allname.push(moment(e).format("MMM")))
this.AllMonths = [...new Set(allname)];
}
}
checkMonthOfSeason() {
this.season_list
console.log(this.season_list)
let alldate = [];
let val = this.FromData.get('seasonId').value;
val.forEach(ID => {
this.season_list.forEach(q => {
if (q.activitySeason.activity_season_id == ID) {
q.seasondateRange.forEach(t => {
// var result = eachMonthOfInterval({
// start: new Date(t.fromDate),
// end: new Date(t.toDate)
// });
// let list = result.map(r => moment(r).format("MMM"));
// alldate.push(...list);
});
};
});
});
let AllDateName = [...new Set(alldate)];
this.AllMonths = AllDateName;
}
MonthCheck(data) {
console.log(data)
}
/**
* @author Abdul Razzak
* to reset search value
*/
reset() {
this.FromData.get('seasonId').setValue([]);
this.FromData.get('dates').setValue('');
this.FromData.get('period_type').setValue('');
this.FromData.get('slot_id').setValue('');
this.FromData.get('days').setValue('');
}
}

View File

@@ -1,183 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Edit Details</div>
<div class="app-mainCard" [formGroup]="FormData">
<div class="app-mainGrid4">
<div class="app-grid1-3">
<label class="formLabel">Experience Name</label>
<input class="formInput" formControlName="option_name" [ngClass]="{
errorInput: validationService.onBlur(
FormData.controls['option_name'],
'required'
)
}" type="text" />
<span class="errorspan" *ngIf="
validationService.onBlur(FormData.controls['option_name'], 'required')
">Please enter option name</span>
</div>
<div>
<label class="formLabel">Option Name</label>
<input class="formInput" type="text" name="" id="">
</div>
<div>
<label class="formLabel">Select Currency</label>
<ng-select #select [items]="currencyList" [readonly]="true" formControlName="currency_code"
bindLabel="currency_name" bindValue="currency_code" [ngClass]="{
errorInput: validationService.onBlur(
FormData.controls['currency_code'],
'required'
)
}">
<ng-template ng-header-tmp>
<div class="select-mobileHeader">
<button matRipple class="select-mobileBack">
<i class="material-icons"> arrow_back </i>
</button>
<div class="select-mobileTitle">Currency</div>
</div>
<div class="select-search">
<span class="material-icons"> search </span>
<input type="text" #search (input)="select.filter(search.value)" />
</div>
</ng-template>
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['currency_code'],
'required'
)
">Please select currency</span>
</div>
</div>
<div class="app-subHeader">Applicable Nationality</div>
<div class="mt-20 mb-20">
<mat-radio-group (change)="is_Nationality($event.value)" formControlName="_nationality_type">
<div class="app-mainGrid4">
<div>
<mat-radio-button value="all_nationality">All Nationality</mat-radio-button>
</div>
<div class="app-grid2-5">
<mat-radio-button value="specific_nationality">Specify Nationality</mat-radio-button>
<div class="Rate_hideInput" *ngIf="
FormData.get('_nationality_type').value == 'specific_nationality'
">
<div class="mt-20">
<div>
<label class="formLabel">Nationality</label>
<ng-select #select [items]="include_nationality_list" formControlName="include_nationality_code"
bindLabel="country_name" bindValue="alpha_2_code" class="is-invalid" placeholder="" [multiple]="true"
[ngClass]="{
errorInput: validationService.onBlur(
FormData.controls['include_nationality_code'],
'required'
)
}">
<ng-template ng-header-tmp>
<div class="select-mobileHeader">
<button matRipple class="select-mobileBack">
<i class="material-icons"> arrow_back </i>
</button>
<div class="select-mobileTitle">Nationality</div>
</div>
<div class="select-search">
<span class="material-icons"> search </span>
<input type="text" #search (input)="select.filter(search.value)" />
</div>
</ng-template>
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['include_nationality_code'],
'required'
)
">Please select Nationality
</span>
</div>
</div>
</div>
</div>
</div>
</mat-radio-group>
</div>
<div class="app-mainGrid4">
<div class="app-grid1-4">
<mat-checkbox name="ExcludeRate" formControlName="is_exclude_nationality" (change)="is_exclude($event.checked)">
Is Exclude Nationality
</mat-checkbox>
<div class="Rate_hideInput" *ngIf="FormData.get('is_exclude_nationality').value">
<div class="mt-20">
<div>
<label class="formLabel">Nationality</label>
<ng-select #select [items]="exclude_nationality_list" formControlName="exclude_nationality_code"
bindLabel="country_name" bindValue="alpha_2_code" class="is-invalid" placeholder="" [multiple]="true"
[ngClass]="{
errorInput: validationService.onBlur(
FormData.controls['exclude_nationality_code'],
'required'
)
}">
<ng-template ng-header-tmp>
<div class="select-mobileHeader">
<button matRipple class="select-mobileBack">
<i class="material-icons"> arrow_back </i>
</button>
<div class="select-mobileTitle">Nationality</div>
</div>
<div class="select-search">
<span class="material-icons"> search </span>
<input type="text" #search (input)="select.filter(search.value)" />
</div>
</ng-template>
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['exclude_nationality_code'],
'required'
)
">Please select currency</span>
</div>
</div>
</div>
</div>
<div class="app-grid1-3">
<label class="formLabel">Rate Inclusions</label>
<textarea class="formInput" rows="3" formControlName="rate_inclusion">
</textarea>
</div>
<div class="app-grid1-3">
<label class="formLabel">Contract Remark</label>
<textarea class="formInput" rows="3" formControlName="contract_remark">
</textarea>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<div class="mb-20 self-center mt-20">
<mat-checkbox name="group1" formControlName="is_guide_included" (change)="is_guideLang($event.checked)"
inputId="Tourist">Tourist Guide Included</mat-checkbox>
</div>
<div class="mb-5 self-center" *ngIf="FormData.get('is_guide_included').value">
<label class="formLabel">Tourist Guide Languages</label>
<ng-select [items]="LangList" formControlName="guide_languages" bindLabel="lov_value" bindValue="lov_key"
[multiple]="true" [ngClass]="{
errorInput: validationService.onBlur(
FormData.controls['guide_languages'],
'required'
)
}">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['guide_languages'],
'required'
)
">Please select tourist guide languages</span>
</div>
</div>
<div class="text-end mt-20">
<button pButton type="button" (click)="UpdateRateConfi()" label="Save" class="btn-primary"></button>
</div>
</div>

View File

@@ -1,479 +0,0 @@
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatCheckbox } from '@angular/material/checkbox';
import { ActivatedRoute } from '@angular/router';
import * as moment from 'moment';
import { ValidationService } from 'src/app/core/common/validation.service';
import { EditActivityContractDetail } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-details/edit-deatils.model';
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'app-edit-details',
templateUrl: './edit-details.component.html',
})
export class EditDetailsComponent implements OnInit {
constructor(
private route: ActivatedRoute,
public Fb: FormBuilder,
public APIServ: API,
public validationService: ValidationService
) {}
Pickup: string[] = [];
CommonCalender: string[] = [];
//
FormData: FormGroup;
currencyList;
activityContractId;
PhoneCode;
include_nationality_list;
exclude_nationality_list;
fil_exclude_nationality_list;
PaxDetails;
vahicleDetails;
LangList = [];
DaySelect = [];
AllSlotData;
SoltDate;
@ViewChild('Vehicle_Rate_copy') Vehicle_Rate_copy: ElementRef;
@ViewChild('myCalendar') datePicker;
ngOnInit(): void {
this.FormData = this.Fb.group({
option_name: this.validationService.required,
emergency_phone_code: this.validationService.required,
emergency_phone: this.validationService.mobNo,
currency_code: this.validationService.required,
is_exclude_nationality: [false],
include_nationality_code: [''],
exclude_nationality_code: [''],
contract_remark: [''],
rate_inclusion: [''],
_nationality_type: [''],
Solt_data: [''],
Search_date: [''],
Days: [''],
is_pickup_included: [false],
is_drop_off_included: [false],
is_guide_included: [false],
guide_languages: [''],
PaxDetails: this.Fb.array([
this.Fb.group({
adult_rate: [''],
child_rate: [''],
infant_rate: [''],
senior_rate: [''],
youth_rate: [''],
}),
]),
vahicle_list: this.Fb.array([]),
});
this.GetLOVMater();
this.GetAllCurrency();
this.GetAllNationality();
this.getRateConfig();
this.GetPhoneCode();
// hard code
// this.getVehicleRateDetails()
// this.getPerPaxDetails()
this.getPaxType();
}
// form get
get paxform() {
return this.FormData.get('PaxDetails') as FormArray;
}
get Vahicleform() {
return this.FormData.get('vahicle_list') as FormArray;
}
Months = [
{ id: 1, name: 'Jan' },
{ id: 2, name: 'Feb' },
{ id: 3, name: 'Mar' },
{ id: 4, name: 'Apr' },
{ id: 5, name: 'Jun' },
{ id: 6, name: 'Jun' },
{ id: 7, name: 'Jul' },
{ id: 8, name: 'Aug' },
{ id: 9, name: 'Sep' },
{ id: 10, name: 'Oct' },
{ id: 11, name: 'Nov' },
{ id: 12, name: 'Dec' },
];
MonthsList = this.Months[0].name;
getRateConfig() {
this.route.queryParams.subscribe((obj) => {
if (obj['id']) {
this.activityContractId = obj['id'];
this.GetSlotData();
this.APIServ.Get(
'/ActivityContract/GetRateConfig/' + obj['id']
).subscribe((data) => {
if (data) {
// this.activityContract = data.responseObject;
console.log(data);
console.log(data.result.responseObject);
this.SetValueConfi(data.result.responseObject);
}
});
}
});
}
SetValueConfi(d) {
let value = this.FormData.getRawValue();
Object.keys(value).map((e) => {
if (e == 'guide_languages') {
let value = d[e] ? d[e].split(',') : null;
let Arr = [];
value.map((e) => Arr.push(parseInt(e)));
setTimeout(() => {
this.FormData.get(e).setValue(Arr);
}, 100);
} else if (e == 'is_guide_included') {
this.FormData.get(e).setValue(d[e]);
d[e] ? this.is_guideLang('guide_languages') : '';
} else if (
e == 'include_nationality_code' ||
e == 'exclude_nationality_code'
) {
let value = d[e] ? d[e].split(',') : null;
this.FormData.get(e).setValue(value);
} else if (e == '_nationality_type') {
this.FormData.get(e).setValue(d[e]);
d[e] == 'specific_nationality'
? this.is_Nationality('specific_nationality')
: '';
} else if (e == 'is_exclude_nationality') {
this.FormData.get(e).setValue(d[e]);
d[e] ? this.is_exclude(true) : '';
} else if (
e == 'PaxDetails' ||
e == 'vahicle_list' ||
e == 'Solt_data' ||
e == 'Search_date' ||
e == 'Days'
) {
console.log('nice razzak ');
} else this.FormData.get(e).setValue(d[e]);
});
}
GetAllCurrency() {
this.APIServ.Get('/Currency/GetCurrency').subscribe((d) => {
if (d) this.currencyList = d;
});
}
GetAllNationality() {
this.APIServ.Get('/Country/GetCountry').subscribe((d) => {
this.include_nationality_list = d;
this.exclude_nationality_list = d;
this.fil_exclude_nationality_list = d;
});
}
GetLOVMater() {
let formdata = {
lov_types: [{ lov_type: 'Language' }, { lov_type: 'DaySelect' }],
lov_lang: 'EN',
};
this.APIServ.Post('/LovMaster/GetLov', formdata).subscribe((data) => {
if (data) {
this.LangList = data.responseObject[0].keys;
this.DaySelect = data.responseObject[1].keys;
}
});
}
GetSlotData() {
// this.APIServ.Get('/ActivityContract/GetSlotsById/' + this.activityContractId).subscribe(data => {
// if (data) {
// this.AllSlotData = data.responseObject;
// console.log(data)
// }
// });
this.APIServ.Get(
'/ActivityContract/GetSlotsById/' + '2207140719598616047'
).subscribe((data) => {
if (data) {
this.AllSlotData = data.responseObject;
}
});
}
GetSoltDetails(val) {
// this.SoltDate = val.date.split(",")
this.getPerPaxDetails();
}
getPerPaxDetails() {
let val = this.FormData.getRawValue();
let obj = {
contract_id: this.activityContractId,
slot_id: val.Solt_data.activity_slot_id,
dates: val.Search_date
? moment(val.Search_date[0]).format('dd MMM YYYY') +
'to' +
moment(val.Search_date[1]).format('dd MMM YYYY ')
: val.Solt_data.date,
days: val.Days ? val.Days.join(',') : '7',
};
// hard code
let new_obj = {
contract_id: '2206290724107915812',
slot_id: '2206290724110863052',
dates: '2022-05-30,2022-05-31',
days: '1,2',
};
this.APIServ.Post('/ActivityContract/GetRatePerPax', new_obj).subscribe(
(data) => {
if (data) {
console.log(data);
if (data.result.responseObject) {
this.PaxDetails = data.result.responseObject;
this.setpaxValue(data.result.responseObject);
}
}
}
);
/// GetVehicleRate
// hard code
// let vahicle_obj = {
// "contract_id": "2206290730562842277",
// "slot_id": "2206290730584999007",
// "dates": "2022-06-01,2022-06-02",
// "days": "0,1,2,3,4,5"
// }
this.APIServ.Post('/ActivityContract/GetVehicleRate', obj).subscribe(
(data) => {
if (data) {
console.log(data);
if (data.result.responseObject) {
this.vahicleDetails = data.result.responseObject;
this.setvahicleValue(data.result.responseObject);
}
}
}
);
}
// getVehicleRateDetails() {
// let new_obj = {
// "contract_id": "2206290730562842277",
// "slot_id": "2206290730584999007",
// "dates": "2022-06-01,2022-06-02",
// "days": "0,1,2,3,4,5"
// }
// let val = this.FormData.getRawValue();
// let obj = {
// "contract_id": this.activityContractId,
// "slot_id": val.Solt_data.activity_slot_id,
// "dates": val.Search_date ? val.Search_date.join(',') : val.Solt_data.date,
// "days": val.Days ? val.Days.join(',') : '7'
// }
// console.log(obj)
// // this.APIServ.Post('/ActivityContract/GetVehicleRate', new_obj).subscribe(data => {
// // if (data) {
// // console.log(data)
// // this.vahicleDetails = data.result.responseObject;
// // this.setvahicleValue(data.result.responseObject);
// // }
// // });
// };
setpaxValue(data) {
for (let i = 0; i < data.length; i++) {
this.AddPaxGroup();
Object.keys(data[i]).map((e) => {
this.paxform.controls[i + 1].get(e).setValue(data[i][e]);
});
}
}
setvahicleValue(data) {
for (let i = 0; i < data.length; i++) {
this.addvahicleGroup();
Object.keys(data[i]).map((e) => {
this.Vahicleform.controls[i].get(e).setValue(data[i][e]);
});
}
}
AddPaxGroup() {
this.paxform.push(
this.Fb.group({
date: [''],
adult_rate: [''],
child_rate: [''],
infant_rate: [''],
senior_rate: [''],
youth_rate: [''],
})
);
}
addvahicleGroup() {
this.Vahicleform.push(
this.Fb.group({
date: [''],
rate: [''],
})
);
}
getPaxType() {
this.APIServ.Get(
'/Activity/GetActivity/' + CommonService.getSessionStoage('activity_id')
).subscribe((data) => {
if (data) {
// this.AllSetvalue(data['responseObject']);
console.log(data);
}
});
}
// vehicle selection
Vehicle_Selection = [
{ id: 1, name: 'Mercedes S Class' },
{ id: 2, name: 'Coach 20 Seater' },
{ id: 3, name: 'Helicopter' },
];
GetPhoneCode() {
this.APIServ.Get('/CountryPhone/GetCountryPhone').subscribe((data) => {
if (data) {
this.PhoneCode = data;
}
});
}
UpdateRateConfi() {
let value = this.FormData.getRawValue();
console.log(this.FormData);
console.log(value);
let PostData = new EditActivityContractDetail();
PostData.contract_id = this.activityContractId;
PostData.option_name = value.option_name;
PostData.currency_code = value.currency_code;
PostData.include_nationality_code = value.include_nationality_code
? value.include_nationality_code.join(',')
: '';
PostData.exclude_nationality_code = value.exclude_nationality_code
? value.exclude_nationality_code.join(',')
: '';
PostData._nationality_type = value._nationality_type;
PostData.is_exclude_nationality = value.is_exclude_nationality;
PostData.rate_inclusion = value.rate_inclusion;
PostData.contract_remark = value.contract_remark;
PostData.is_pickup_included = value.is_pickup_included;
PostData.is_drop_off_included = value.is_drop_off_included;
PostData.is_guide_included = value.is_guide_included;
PostData.guide_languages = value.guide_languages
? value.guide_languages.join(',')
: '';
}
addvalid(name, type, num) {
if (type == 'add') {
if (num == 'number') {
this.FormData.controls[name].addValidators([
Validators.pattern(/^[0-9]*$/),
]);
this.FormData.controls[name].updateValueAndValidity();
} else {
this.FormData.controls[name].addValidators([Validators.required]);
this.FormData.controls[name].updateValueAndValidity();
}
} else {
this.FormData.controls[name].clearValidators();
this.FormData.controls[name].updateValueAndValidity();
this.FormData.controls[name].markAsUntouched();
}
}
is_exclude(check) {
check
? this.addvalid('exclude_nationality_code', 'add', 'required')
: this.addvalid('exclude_nationality_code', 'remove', '');
}
is_Nationality(val) {
val == 'specific_nationality'
? this.addvalid('include_nationality_code', 'add', 'required')
: this.addvalid('include_nationality_code', 'remove', 'required');
}
is_guideLang(check) {
check
? this.addvalid('guide_languages', 'add', 'required')
: this.addvalid('guide_languages', 'remove', '');
}
SetVahicleValCopyUi() {
let value = this.Vehicle_Rate_copy.nativeElement.value;
if (value != '') {
let obj = this.Vahicleform.getRawValue();
obj.map((e) => {
Object.keys(e).forEach((ol, i) => {
this.Vahicleform.controls[i].get('rate').setValue(value);
});
});
}
}
checkcleander() {
let value = this.FormData.getRawValue();
if (value.Search_date[0] && value.Search_date[1]) {
this.datePicker.overlayVisible = false;
this.getPerPaxDetails();
}
}
setpaxValueFromUi() {
let val = this.paxform.getRawValue();
if (val[0].adult_rate != '') {
this.setValueFormUi('adult_rate');
}
if (val[0].senior_rate != '') {
this.setValueFormUi('senior_rate');
}
if (val[0].youth_rate != '') {
this.setValueFormUi('youth_rate');
}
if (val[0].child_rate != '') {
this.setValueFormUi('child_rate');
}
if (val[0].infant_rate != '') {
this.setValueFormUi('infant_rate');
}
}
setValueFormUi(name) {
let obj = this.paxform.getRawValue();
for (let i = 1; i < obj.length; i++) {
Object.keys(obj[i]).map((e) => {
if (e == name) {
this.paxform.controls[i].get(e).setValue(obj[0][name]);
}
});
}
}
Pax_Type = [
{ id: 0, name: 'Adult' },
{ id: 1, name: 'Senior' },
{ id: 2, name: 'Youth' },
{ id: 3, name: 'Child' },
{ id: 4, name: 'Infant' },
];
}

View File

@@ -1,398 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div [formGroup]="FormData">
<div class="app-mainHeader">Edit Rate Config</div>
<div class="app-mainCard">
<div class="app-mainGrid4 mb-20">
<div class="app-grid1-3">
<label class="formLabel">Experience Name</label>
<input class="formInput readonlyInput" readonly formControlName="activity_name" type="text" />
</div>
<div>
<label class="formLabel">Option Name</label>
<input class="formInput readonlyInput" readonly type="text" formControlName="option_name" />
</div>
<div>
<label class="formLabel">Select Currency</label>
<ng-select #select [items]="currencyList" [readonly]="true" formControlName="currency_code" bindLabel="currency_name" bindValue="currency_code">
</ng-select>
</div>
</div>
<div *ngIf="FormData.get('privateTransfer')">
<div formArrayName="privateTransfer">
<label class="app-subHeader">Private Transfer (Add-On Rate)</label>
<div class="d-flex align-center mt-10 mb-20" *ngFor="let group of privateTransfer.controls; let i = index" [formGroupName]="i">
<div class="app-mainGrid4 mtMobi-20 w-75">
<div class="app-grid1 ng-hideHead">
<label class="formLabel">Supplier</label>
<ng-select [items]="AllVehicleSupplier" (change)="GetAllVehicleBySupplierId($event , 'Shared' , i)" [ngClass]="{errorInput: validationService.onBlur(group['controls']['vehicle_supplier_id'],'required')}" formControlName="vehicle_supplier_id" bindLabel="name"
bindValue="id">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(group['controls']['vehicle_supplier_id'],'required')">Please select
supplier
</span>
</div>
<div class="ng-hideHead">
<label class="formLabel">Vehicle Selection</label>
<ng-select [items]="AllVehicleBySupplierId.Shared[i]" bindLabel="vehicle_name" bindValue="vehicle_id" formControlName="vehicle_id" [ngClass]="{errorInput: validationService.onBlur(group['controls']['vehicle_id'],'required')}">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(group['controls']['vehicle_id'],'required')">Please select
vehicle selection</span>
</div>
<div>
<label class="formLabel">Private Transfer Occupancy</label>
<input type="text" formControlName="vehicle_occupancy" class="formInput" [ngClass]="{errorInput: validationService.onBlur(group['controls']['vehicle_occupancy'],'required')}" />
<span class="errorspan" *ngIf=" validationService.onBlur(group['controls']['vehicle_occupancy'],'required')">Please select
private transfer occupancy</span>
</div>
<div>
<label class="formLabel">Price</label>
<input type="text" formControlName="rate" [ngClass]="{errorInput: validationService.onBlur(group['controls']['rate'],'required') || validationService.onBlur(group['controls']['rate'],'pattern')}" class="formInput" />
<span class="errorspan" *ngIf="
validationService.onBlur(group['controls']['rate'],'required')">Please select
supplier</span>
<span class="errorspan" *ngIf="
validationService.onBlur(group['controls']['rate'],'pattern')">Accept number only</span>
</div>
</div>
<div>
<div class="h-100 w-25" *ngIf="i == 0">
<button pButton icon="pi pi-plus" (click)="AddPrivateTransferGroup(false , i)" class="btn-icon ml-20"></button>
</div>
<div class="h-100 w-25" *ngIf="i != 0">
<button pButton icon="pi pi-minus" (click)="RemovePrivateformGroup(i)" class="btn-icon ml-20"></button>
</div>
</div>
</div>
</div>
</div>
<div *ngIf="FormData.get('sharedTransfer')" formGroupName="sharedTransfer">
<div class="mt-10 mb-20">
<label class="app-subHeader">Shared Transfer (Add-On Rate)</label>
<div class="app-mainGrid4" *ngIf="FormData.get('sharedTransfer').get('vehicle_supplier_id')">
<div class="ng-hideHead mt-10">
<label class="formLabel">Supplier</label>
<ng-select [items]="AllVehicleSupplier" formControlName="vehicle_supplier_id" [ngClass]="{errorInput: validationService.onBlur(sharedTransfer.controls['vehicle_supplier_id'],'required')}">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['vehicle_supplier_id'],'required')">Please select
supplier</span>
</div>
</div>
</div>
<!-- Per Person -->
<div class="app-mainGrid5 mt-20 mb-20">
<div *ngIf="FormData.get('sharedTransfer').get('adult_rate')">
<label class="formLabel">Adult ({{activityData.adult_age_from}} to
{{activityData.adult_age_to}})</label>
<input class="formInput" formControlName="adult_rate" type="text" [ngClass]="{errorInput: validationService.onBlur(sharedTransfer.controls['adult_rate'],'required') || validationService.onBlur(sharedTransfer.controls['adult_rate'],'pattern')}" />
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['adult_rate'],'required')">Please enter
adult</span>
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['adult_rate'],'pattern')"> accept number only
</span>
</div>
<div *ngIf="FormData.get('sharedTransfer').get('senior_rate')">
<label class="formLabel">Senior ({{activityData.senior_age_from}} to
{{activityData.senior_age_to}})</label>
<input class="formInput" formControlName="senior_rate" type="text" [ngClass]="{errorInput: validationService.onBlur(sharedTransfer.controls['senior_rate'],'required') || validationService.onBlur(sharedTransfer.controls['senior_rate'],'pattern')}" />
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['senior_rate'],'required')">Please enter
senior</span>
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['senior_rate'],'pattern')"> accept number only
</span>
</div>
<div *ngIf="FormData.get('sharedTransfer').get('youth_rate')">
<label class="formLabel">Youth ({{activityData.youth_age_from}} to
{{activityData.youth_age_to}})</label>
<input class="formInput" formControlName="youth_rate" type="text" [ngClass]="{errorInput: validationService.onBlur(sharedTransfer.controls['youth_rate'],'required') || validationService.onBlur(sharedTransfer.controls['youth_rate'],'pattern')}" />
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['youth_rate'],'required')">Please enter
youth</span>
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['youth_rate'],'pattern')"> accept number only
</span>
</div>
<div *ngIf="FormData.get('sharedTransfer').get('child_rate')">
<label class="formLabel">Child ({{activityData.child_age_from}} to
{{activityData.child_age_to}})</label>
<input class="formInput" formControlName="child_rate" type="text" [ngClass]="{errorInput: validationService.onBlur(sharedTransfer.controls['child_rate'],'required') || validationService.onBlur(sharedTransfer.controls['child_rate'],'pattern')}" />
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['child_rate'],'required')">Please enter
child</span>
<span class="errorspan" *ngIf="
validationService.onBlur(sharedTransfer.controls['child_rate'],'pattern')"> accept number only
</span>
</div>
</div>
</div>
</div>
<div formGroupName="searchgroup" class="app-seperator app-mainCard mt-20">
<div class="app-mainGrid4">
<div class="app-grid1">
<label class="formLabel">Slots</label>
<ng-select formControlName="slot_id">
<ng-option *ngFor="let item of AllSlots" [value]="item.activity_slot_id">{{ item.start_time | date: "h:mm" }} to {{ item.end_time | date: "h:mm" }}</ng-option>
</ng-select>
</div>
<div class="">
<label class="formLabel" for="">Rate Type</label>
<ng-select [readonly]="true" [items]="lovKeyDataObj.RateConfigType" bindLabel="lov_value" bindValue="lov_key" formControlName="_rate_type">
</ng-select>
</div>
</div>
<div class="app-mainGrid4 mb-20 mt-20">
<div class="dateRange">
<label for="multiple1" class="formLabel">Period Type</label>
<ng-select [items]="lovKeyDataObj.RatePeriodType" bindLabel="lov_value" (change)="ClearDateAndSeason()" formControlName="period_type" bindValue="lov_key">
</ng-select>
</div>
<div class="dateRange" *ngIf="FormData.get('searchgroup').get('period_type').value == '1'">
<label for="multiple1" class="formLabel">Date Range</label>
<p-calendar [numberOfMonths]="2" formControlName="dates" selectionMode="range" [readonlyInput]="true" inputId="multiple">
</p-calendar>
</div>
<div *ngIf="FormData.get('searchgroup').get('period_type').value == '2'">
<label class="formLabel">Season</label>
<ng-select formControlName="seasonId" #select [multiple]="true">
<ng-option *ngFor="let activity_obj of season_list" [value]="activity_obj.activitySeason.activity_season_id">
{{ activity_obj.activitySeason.season_name}}</ng-option>
</ng-select>
</div>
<div>
<label class="formLabel">Days</label>
<ng-select #select [items]="lovKeyDataObj.DaySelect" bindLabel="lov_value" bindValue="lov_key" formControlName="days" appendTo="body" [multiple]="true">
</ng-select>
</div>
<div class="mt-20">
<button pButton type="button" (click)="Search()" label="Search" class="btn-primary btn mr-20"></button>
<button pButton type="button" label="Reset" (click)="reset()" class="btn-primary btn"></button>
</div>
</div>
</div>
<div class="app-mainCard">
<!-- Per Person Pricing -->
<div class="tableWrapper mt-20" *ngIf="FormData.get('PaxDetails')" formArrayName="PaxDetails">
<div class="app-subHeader">Per Person Pricing</div>
<div class="d-flex">
<table>
<tr class="tablehead" [formGroupName]="0">
<th></th>
<th></th>
<td *ngIf="paxformGroup.controls[0].get('adult_rate')">
<input class="formInput" formControlName="adult_rate" type="number" />
</td>
<td *ngIf="paxformGroup.controls[0].get('senior_rate')">
<input class="formInput" formControlName="senior_rate" type="number" />
</td>
<td *ngIf="paxformGroup.controls[0].get('youth_rate')">
<input class="formInput" formControlName="youth_rate" type="number" />
</td>
<td *ngIf="paxformGroup.controls[0].get('child_rate')">
<input class="formInput" formControlName="child_rate" type="number" />
</td>
</tr>
<tr>
<th class="w-15">
<div>Date</div>
</th>
<th class="w-15">
<div>Days</div>
</th>
<th *ngIf="activityData.is_adult">
<div>
Adult Rate
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th *ngIf="activityData.is_senior">
<div>
Senior Rate
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th *ngIf="activityData.is_youth">
<div>
Youth Rate
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th *ngIf="activityData.is_child">
<div>
Child Rate
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
</tr>
<tr *ngFor="let item of PaxDetails; let i = index" [formGroupName]="i +1">
<td>{{ item.date | date: "dd MMM YYYY" }}</td>
<td>{{ item.date | date: "EEEE" }}</td>
<td *ngIf="paxformGroup.controls[i].get('adult_rate')">
<input class="formInput" formControlName="adult_rate" type="number" />
</td>
<td *ngIf="paxformGroup.controls[i].get('senior_rate')">
<input class="formInput" formControlName="senior_rate" type="number" />
</td>
<td *ngIf="paxformGroup.controls[i].get('youth_rate')">
<input class="formInput" formControlName="youth_rate" type="number" />
</td>
<td *ngIf="paxformGroup.controls[i].get('child_rate')">
<input class="formInput" formControlName="child_rate" type="number" />
</td>
</tr>
</table>
<div class="app-tableBtn">
<button pButton type="button" label="Copy on UI" (click)="setallpaxdetails()" class="btn-primary"></button>
</div>
</div>
</div>
<!-- Per Vehicle Pricing -->
<div class="tableWrapper mt-20 w-60" *ngIf="FormData.get('vahicle_list')" formArrayName="vahicle_list">
<div class="app-subHeader">Per Vehicle Pricing</div>
<div class="d-flex">
<table>
<tr class="tablehead" [formGroupName]="0">
<th></th>
<th></th>
<th class="d-flex" formArrayName="vehicle_rates">
<div class="mr-20" *ngFor="let item of VahicleformGroup.controls[0].get('vehicle_rates')['controls']; let i = index" [formGroupName]="i">
<input class="formInput" formControlName="rate" type="number" />
</div>
</th>
</tr>
<tr>
<th class="w-20">
<div>Date</div>
</th>
<th class="w-20">
<div>Days</div>
</th>
<th class="d-flex">
<div class="mr-20 formInput" *ngFor="let item of VahicleformGroup.controls[0].get('vehicle_rates')['controls']">
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
</tr>
<tr *ngFor="let item of vahicleDetails; let li = index" [formGroupName]="li +1">
<td>{{ item.date | date: "dd MMM YYYY" }}</td>
<td>{{ item.date | date: "EEEE" }}</td>
<td formArrayName="vehicle_rates" class="d-flex">
<div class="mr-20" *ngFor="let g of item.vehicle_rates; let i = index" [formGroupName]="i">
<input class="formInput" formControlName="rate" type="number" />
</div>
</td>
</tr>
</table>
<div class="app-tableBtn w-40">
<button pButton type="button" label="Copy on UI" (click)="CopyOnUIvehicle()" class="btn-primary"></button>
</div>
</div>
</div>
<!-- Tiered Pricing -->
<div *ngIf="FormData.get('tieredPricings')" class="app-subHeader">Tiered Pricing</div>
<div *ngIf="FormData.get('tieredPricings')" class="tableWrapper d-flex mt-20">
<table formArrayName="tieredPricings">
<tr class="tablehead" [formGroupName]="0">
<th></th>
<th></th>
<th *ngFor="let controls of HeaderTieredRateGroup.adult_range; let li = index">
<input class="formInput" formControlName="adult_rate_range_{{li + 1}}" type="number" />
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.senior_range; let li = index">
<input class="formInput" formControlName="senior_rate_range_{{li + 1}}" type="number" />
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.youth_range; let li = index">
<input class="formInput" formControlName="youth_rate_range_{{li + 1}}" type="number" />
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.child_range; let li = index">
<input class="formInput" formControlName="child_rate_range_{{li + 1}}" type="number" />
</th>
</tr>
<tr>
<th class="w-10">
<div>Date</div>
</th>
<th class="w-10">
<div>Days</div>
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.adult_range; let li = index">
<div>
Adult <span class="d-block">
({{controls.from_adult_count}} to
{{controls.to_adult_count}})
</span>
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.senior_range; let li = index">
<div>
Senior <span class="d-block">
({{controls.from_senior_count}} to
{{controls.to_senior_count}})
</span>
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.youth_range; let li = index">
<div>
Youth <span class="d-block">
({{controls.from_youth_count}} to
{{controls.to_youth_count}})
</span>
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.child_range; let li = index">
<div>
Child <span class="d-block">
({{controls.from_child_count}} to
{{controls.to_child_count}})
</span>
<span class="pi pi-copy btn-copy ng-asideToggle" pTooltip="Copy"></span>
</div>
</th>
</tr>
<tr *ngFor="let group of AllContractTieredRate; let i = index" [formGroupName]="i + 1">
<td>{{ group.date | date: "dd MMM YYYY" }}</td>
<td>{{ group.date | date: "EEEE" }}</td>
<th *ngFor="let controls of HeaderTieredRateGroup.adult_range; let li = index">
<input class="formInput" formControlName="adult_rate_range_{{li + 1}}" type="number" />
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.senior_range; let li = index">
<input class="formInput" formControlName="senior_rate_range_{{li + 1}}" type="number" />
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.youth_range; let li = index">
<input class="formInput" formControlName="youth_rate_range_{{li + 1}}" type="number" />
</th>
<th *ngFor="let controls of HeaderTieredRateGroup.child_range; let li = index">
<input class="formInput" formControlName="child_rate_range_{{li + 1}}" type="number" />
</th>
</tr>
</table>
<div class="app-tableBtn">
<button pButton type="button" label="Copy on UI" (click)="SetTieredRateValCopyUi()" class="btn-primary"></button>
</div>
</div>
<div class="text-end mt-20">
<button pButton type="button" label="Save" (click)="UpdateRate()" class="btn-primary"></button>
</div>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,861 +0,0 @@
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatCheckbox } from '@angular/material/checkbox';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { MessageService } from 'primeng/api';
import { ValidationService } from 'src/app/core/common/validation.service';
import { EditActivityContractRate, GetRateDetails, PaxPricing, PaxRates, TieredPricingList, VehicleRates } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-rate-confi/edit-rate-confi.model';
import { ActivityPrivateTransfer, ActivitySharedTransfer } from 'src/app/core/models/Experience-Service/experience-rate-config/experience-rate-config.model';
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'app-edit-modify-rate',
templateUrl: './edit-modify-rate.component.html',
})
export class EditModifyRateComponent implements OnInit {
constructor(
private route: ActivatedRoute,
public Fb: FormBuilder,
public ApiServ: API,
public validationService: ValidationService,
public MsgService: MessageService,
private router: Router,
) { }
Pickup: string[] = [];
CommonCalender: string[] = [];
//
FormData: FormGroup;
currencyList;
activityContractId;
PaxDetails;
vahicleDetails;
activityData;
AllSlots;
AllVehicleBySupplierId = {
Shared: [],
Slots: []
};;
lovKeyDataObj = {
RatePeriodType: [],
DaySelect: [],
RateConfigType: [],
ActivityNoShowPolicyType: [],
ActivityCancellationPolicyType: [],
ActivityCancellationChargeType: [],
};
season_list;
AllVehicleSupplier;
AllContractTieredRate;
HeaderTieredRateGroup = {
adult_range: [],
youth_range: [],
senior_range: [],
child_range: [],
}
TieredRatedynamicgroup: FormGroup;
ngOnInit(): void {
this.ngOninitform();
this.GetAllCurrency();
this.GetAllVehicleSupplier();
this.GetLOVKeys('RatePeriodType,DaySelect,ActivityNoShowPolicyType,RateConfigType,ActivityCancellationPolicyType,ActivityCancellationChargeType');
this.GetAllActivitySeason();
}
/**
* @author Abdul Razzak
* to create a form group
*/
ngOninitform() {
this.FormData = this.Fb.group({
activity_name: [''],
option_name: [''],
currency_code: [''],
searchgroup: this.Fb.group({
slot_id: [''],
_rate_type: [''],
period_type: [''],
dates: [''],
seasonId: [[]],
days: [''],
})
});
}
/**
* @author Abdul Razzak
* to get form controller
*/
get privateTransfer() {
return this.FormData.get('privateTransfer') as FormArray;
}
get sharedTransfer() {
return this.FormData.get('sharedTransfer') as FormGroup;
}
get paxformGroup() {
return this.FormData.get('PaxDetails') as FormArray;
}
get tieredPricingsGroup() {
return this.FormData.get('tieredPricings') as FormArray;
}
get VahicleformGroup() {
return this.FormData.get('vahicle_list') as FormArray;
}
/**
* @author Abdul Razzak
* to get activity details
*/
GetActivityById() {
let activity_id = CommonService.getSessionStoage('activity_id');
this.ApiServ.Get('/Activity/GetActivity/' + activity_id).subscribe(res => {
if (res) {
this.activityData = res.responseObject;
this.FormData.get('activity_name').setValue(res.responseObject.activityContents[0].activity_name);
this.getRateConfig();
}
})
}
/**
* @author Abdul razzak
* to get contract details
*/
getRateConfig() {
this.route.queryParams.subscribe((obj) => {
if (obj['id']) {
this.activityContractId = obj['id'];
this.GetSlotsById(obj['id'])
this.ApiServ.Get('/ActivityContract/GetRateConfig/' + obj['id']).subscribe((res) => {
if (res) {
this.FormData.get('option_name').setValue(res.responseObject.option_name);
this.FormData.get('currency_code').setValue(res.responseObject.currency_code);
let val = parseInt(res.responseObject._rate_type)
this.FormData.get('searchgroup').get('_rate_type').setValue(val);
if (val == 2) {
this.FormData.addControl('PaxDetails', this.Fb.array([
this.Fb.group({
activity_rate_per_pax_id: [''],
date: [''],
})
]))
this.AddPaxController(this.paxformGroup.controls[0], false);
} else if (val == 3) {
this.FormData.addControl('vahicle_list', this.Fb.array([
this.Fb.group({
date: [''],
vehicle_rates: this.Fb.array([
this.Fb.group({
activity_rate_per_vehicle_id: [''],
rate: [''],
vehicle_id: [''],
vehicle_name: [''],
})
])
})
]))
} else if (val == 1) {
this.ApiServ.Get('/ActivityContract/GetTieredRateTableView/' + this.activityContractId).subscribe(res => {
if (res) {
this.FormData.addControl('tieredPricings', this.Fb.array([
]))
res.responseObject.forEach((e, i) => {
this.tieredPricingsGroup.push(this.Fb.group({
date: [''],
activity_rate_tiered_id: [''],
}))
let controls = this.tieredPricingsGroup.controls[0] as FormGroup
if (e.adult_range) {
let adult_range = JSON.parse(e.adult_range);
this.HeaderTieredRateGroup.adult_range = adult_range;
adult_range.forEach((r, i) => {
controls.addControl('adult_rate_range_' + (i + 1), this.Fb.control(''));
})
}
if (e.youth_range) {
let youth_range = JSON.parse(e.youth_range);
this.HeaderTieredRateGroup.youth_range = youth_range;
youth_range.forEach((r, i) => {
controls.addControl('youth_rate_range_' + (i + 1), this.Fb.control(''));
})
}
if (e.senior_range) {
let senior_range = JSON.parse(e.senior_range);
this.HeaderTieredRateGroup.senior_range = senior_range;
senior_range.forEach((r, i) => {
controls.addControl('senior_rate_range_' + (i + 1), this.Fb.control(''));
})
}
if (e.child_range) {
let child_range = JSON.parse(e.child_range);
this.HeaderTieredRateGroup.child_range = child_range;
child_range.forEach((r, i) => {
controls.addControl('child_rate_range_' + (i + 1), this.Fb.control(''));
})
}
})
}
});
}
if (res.responseObject.is_shared_transfer) this.AddSharedTransferControls(true, res.responseObject.shared_transfer);
if (res.responseObject.is_private_transfer) this.AddPrivateTransferControls(true, res.responseObject.private_transfer);
}
});
}
});
}
/**
* @author Abdul Razzak
* to get slot data by contract id
* @param Id
*/
GetSlotsById(Id) {
this.ApiServ.Get('/ActivityContract/GetSlotsById/' + Id).subscribe(res => {
if (res) {
this.AllSlots = res.responseObject;
}
})
}
/**
* @author Abdul Razzak
* to create Tiered Pricings FormGroup
* @param ind
*/
createTieredGroup(ind) {
this.tieredPricingsGroup.push(this.Fb.group({
date: [''],
activity_rate_tiered_id: [''],
}))
let controls = this.tieredPricingsGroup.controls[ind] as FormGroup
if (this.HeaderTieredRateGroup.adult_range) {
this.HeaderTieredRateGroup.adult_range.forEach((r, i) => {
controls.addControl('adult_rate_range_' + (i + 1), this.Fb.control(''));
})
}
if (this.HeaderTieredRateGroup.youth_range) {
this.HeaderTieredRateGroup.youth_range.forEach((r, i) => {
controls.addControl('youth_rate_range_' + (i + 1), this.Fb.control(''));
})
}
if (this.HeaderTieredRateGroup.senior_range) {
this.HeaderTieredRateGroup.senior_range.forEach((r, i) => {
controls.addControl('senior_rate_range_' + (i + 1), this.Fb.control(''));
})
}
if (this.HeaderTieredRateGroup.child_range) {
this.HeaderTieredRateGroup.child_range.forEach((r, i) => {
controls.addControl('child_rate_range_' + (i + 1), this.Fb.control(''));
})
}
}
/**
* @author Abdul Razzak
* To Get All Activity Season
*/
GetAllActivitySeason() {
this.ApiServ.Get('/ActivitySeason/GetAllActivitySeason?activityId=' + CommonService.getSessionStoage('activity_id')).subscribe(d => {
if (d && d.status) {
this.season_list = d.responseObject;
}
});
}
/**
* @author Abdul Razzak
* To Get All Vehicle Supplier
*/
GetAllVehicleSupplier() {
this.ApiServ.Get('/Vehicle/GetAllVehicleSupplier').subscribe((res) => {
if (res) {
this.AllVehicleSupplier = res.responseObject;
}
});
}
/**
* @author Abdul Razzak
* To get all curency
*/
GetAllCurrency() {
this.ApiServ.Get('/Currency/GetCurrency').subscribe((d) => {
if (d) this.currencyList = d;
});
}
/**
* @author Abdul Razzak
* TO get Get All Vehicle details by supplier Id
* @param Id
* @param name
* @param i
*/
GetAllVehicleBySupplierId(Id, name, i) {
this.ApiServ.Get('/Vehicle/GetAllVehicleBySupplier/' + Id).subscribe((res) => {
if (res) {
this.AllVehicleBySupplierId[name][i] = []
this.AllVehicleBySupplierId[name][i] = res.responseObject;
}
});
}
/**
* @author Abdul Razzak
* to get data from LOV
* @param lov_key_names
*/
GetLOVKeys(lov_key_names) {
let lov_key_names_arr = lov_key_names.split(',');
let lov_obj = {
"lov_types": [],
"lov_lang": "en"
}
lov_key_names_arr.forEach(key_name => {
lov_obj.lov_types.push({ "lov_type": key_name });
});
this.ApiServ.Post('/LovMaster/GetLov', lov_obj).subscribe(lov_data => {
if (lov_data && lov_data.status) {
this.GetActivityById();
lov_key_names_arr.forEach(key_name => {
let arr = lov_data.responseObject.filter(el => el.lov_type == key_name);
arr.length > 0 ? this.lovKeyDataObj[key_name] = arr[0].keys : '';
});
}
});
}
/**
* @author Abdul Razzak
* to get Per Pax Details , Vehicle Rate and Tiered Rate
*/
Search() {
let val = this.FormData.get('searchgroup').get('_rate_type').value;
let searchform = this.FormData.get('searchgroup').value;
let postdata = new GetRateDetails();
postdata.contract_id = this.activityContractId;
postdata.slot_id = searchform.slot_id;
postdata.from_date = searchform.dates[0] ? moment(searchform.dates[0]).format('YYYY-MM-DD') : '';
postdata.to_date = searchform.dates[1] ? moment(searchform.dates[1]).format('YYYY-MM-DD') : '';
postdata.seasonId = searchform.seasonId;
postdata.days = searchform.days ? searchform.days.join(',') : '';
if (val == 2) {
this.getPerPaxDetails(postdata);
} else if (val == 3) {
this.GetVehicleRate(postdata);
} else if (val == 1) {
this.GetActivityTieredRate(postdata);
}
}
// private Transfer --------------------------------------------------------------------
/**
* @author Abdul Razzak
* to create private Transfer form array
* @param check
* @param Data
*/
AddPrivateTransferControls(check, Data) {
if (check) {
this.FormData.addControl('privateTransfer', this.Fb.array([
]))
let Obj = JSON.parse(Data)
Obj.forEach((e, i) => {
this.AddPrivateTransferGroup(e, i);
});
}
}
/**
* @author Abdul Razzak
* to create pax controls on form group
* @param Data
* @param ind
*/
AddPrivateTransferGroup(Data, ind) {
Data ? this.GetAllVehicleBySupplierId(Data.vehicle_supplier_id, 'Shared', ind) : ''
this.privateTransfer.push(this.Fb.group({
// activity_pvt_transfer_add_on_id: [Data.activity_pvt_transfer_add_on_id],
vehicle_supplier_id: [Data ? Data.vehicle_supplier_id : '', Validators.required],
vehicle_id: [Data ? Data.vehicle_id : '', Validators.required],
vehicle_occupancy: [Data ? Data.vehicle_occupancy : '', Validators.required],
rate: [Data ? Data.rate : '', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]],
}))
}
/**
* @author Abdul Razzak
* to remove form group on privete transfer
* @param ind
*/
RemovePrivateformGroup(ind) {
this.privateTransfer.removeAt(ind);
}
/**
* @author Abdul Razzak
* to clear formcontrols value when period type change
*/
ClearDateAndSeason() {
let val = this.FormData.get('searchgroup').get('period_type').value;
if (val == 2) this.FormData.get('searchgroup').get('dates').setValue('');
else if (val == 1) this.FormData.get('searchgroup').get('seasonId').setValue([]);
}
// shared transfer --------------------------------------------------------------------
/**
* @author Abdul Razzak
* to add contols on shared transfer
* @param check
*/
AddSharedTransferControls(check, data) {
if (check) {
this.FormData.addControl('sharedTransfer', this.Fb.group({}))
let obj = JSON.parse(data)
this.sharedTransfer.addControl('vehicle_supplier_id', this.Fb.control(obj[0].vehicle_supplier_id, [Validators.required]));
this.sharedTransfer.addControl('activity_shared_transfer_add_on_id', this.Fb.control(obj[0].activity_shared_transfer_add_on_id, [Validators.required]));
if (this.activityData.is_adult) this.sharedTransfer.addControl('adult_rate', this.Fb.control(obj[0].adult_rate, [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
if (this.activityData.is_senior) this.sharedTransfer.addControl('senior_rate', this.Fb.control(obj[0].senior_rate, [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
if (this.activityData.is_youth) this.sharedTransfer.addControl('youth_rate', this.Fb.control(obj[0].youth_rate, [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
if (this.activityData.is_child) this.sharedTransfer.addControl('child_rate', this.Fb.control(obj[0].child_rate, [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
}
// else {
// this.sharedTransfer.removeControl('vehicle_supplier_id');
// this.sharedTransfer.removeControl('activity_shared_transfer_add_on_id');
// if (this.activityData.is_adult) this.sharedTransfer.removeControl('adult_rate');
// if (this.activityData.is_senior) this.sharedTransfer.removeControl('senior_rate');
// if (this.activityData.is_youth) this.sharedTransfer.removeControl('youth_rate');
// if (this.activityData.is_child) this.sharedTransfer.removeControl('child_rate');
// }
}
// per pax details --------------------------------------------------------------------
/**
* @author Abdul Razzak
* to get contract pax details
* @param postdata
*/
getPerPaxDetails(postdata) {
this.ApiServ.Post('/ActivityContract/GetRatePerPax', postdata).subscribe((data) => {
if (data) {
this.PaxDetails = data.responseObject;
data.responseObject ? this.setpaxValue(data.responseObject) : '';
}
});
}
/**
* @author Abdul Razzak
* to create form group and set value
* @param data
*/
setpaxValue(data) {
this.paxformGroup.clear();
this.paxformGroup.push(this.Fb.group({
activity_rate_per_pax_id: [''],
date: [''],
}))
this.AddPaxController(this.paxformGroup.controls[0], false);
data.forEach((e, i) => {
this.paxformGroup.push(
this.Fb.group({
activity_rate_per_pax_id: [e['activity_rate_per_pax_id']],
date: [e['date']],
})
);
this.AddPaxController(this.paxformGroup.controls[i + 1], data[i]);
});
}
/**
* @author Abdul Razzak
* to create pax control
* @param group
* @param value
*/
AddPaxController(group, value) {
if (this.activityData.is_adult) group.addControl('adult_rate', this.Fb.control(value ? value.adult_rate : '', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
if (this.activityData.is_senior) group.addControl('senior_rate', this.Fb.control(value ? value.senior_rate : '', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
if (this.activityData.is_youth) group.addControl('youth_rate', this.Fb.control(value ? value.youth_rate : '', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
if (this.activityData.is_child) group.addControl('child_rate', this.Fb.control(value ? value.child_rate : '', [Validators.required, Validators.pattern(/^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)$/)]));
}
/**
* @author Abdul Razzak
* to set all pax rate value form copy on UI button
*/
setallpaxdetails() {
let val = this.paxformGroup.getRawValue();
if (val[0].adult_rate != '') {
this.setValueFormUi('adult_rate');
}
if (val[0].senior_rate != '') {
this.setValueFormUi('senior_rate');
}
if (val[0].youth_rate != '') {
this.setValueFormUi('youth_rate');
}
if (val[0].child_rate != '') {
this.setValueFormUi('child_rate');
}
}
setValueFormUi(name) {
let obj = this.paxformGroup.getRawValue();
for (let i = 1; i < obj.length; i++) {
Object.keys(obj[i]).map((e) => {
if (e == name) {
this.paxformGroup.controls[i].get(e).setValue(obj[0][name]);
}
});
}
}
// Vehicle Rate --------------------------------------------------------------------
/**
* @author Abdul Razzak
* to get contract vehicle details
* @param postdata
*/
GetVehicleRate(postdata) {
this.ApiServ.Post('/ActivityContract/GetVehicleRate', postdata).subscribe(
(data) => {
if (data) {
console.log(data);
if (data.responseObject) {
this.vahicleDetails = data.responseObject;
data.responseObject ? this.setvahicleValue(data.responseObject) : '';
}
}
}
);
}
/**
* @author Abdul Razzak
* to creta form group and set value on vehicle rate group
*/
setvahicleValue(data) {
this.VahicleformGroup.clear();
this.VahicleformGroup.push(
this.Fb.group({
date: [''],
vehicle_rates: this.Fb.array([])
})
)
this.CreateFormGroup(data[0], this.VahicleformGroup.controls[0].get('vehicle_rates'), false);
data.forEach((value, i) => {
this.VahicleformGroup.push(
this.Fb.group({
date: [value['date']],
vehicle_rates: this.Fb.array([])
})
);
let VehicleRatesGroup = this.VahicleformGroup.controls[i + 1].get('vehicle_rates') as FormArray;
this.CreateFormGroup(value, VehicleRatesGroup, true);
});
}
CreateFormGroup(value, VehicleRatesGroup, check) {
value.vehicle_rates.forEach((e) => {
VehicleRatesGroup.push(this.Fb.group({
activity_rate_per_vehicle_id: [check ? e.activity_rate_per_vehicle_id : ''],
rate: [check ? e.rate : ''],
vehicle_id: [check ? e.vehicle_id : ''],
vehicle_name: [check ? e.vehicle_name : ''],
}))
})
}
/**
* @author Abdul Razzak
* to set all vehicle rate price
*/
CopyOnUIvehicle() {
let val = this.VahicleformGroup.controls[0].get('vehicle_rates').value;
if (this.VahicleformGroup.controls.length > 1) {
let obj = this.VahicleformGroup.getRawValue();
obj.forEach((e, i) => {
val.forEach((d, li) => {
this.VahicleformGroup.controls[i].get('vehicle_rates')['controls'][li].get('rate').setValue(d.rate)
});
});
};
};
// Tiered Rate --------------------------------------------------------------------
/**
* @author Abdul Razzak
* to get all Tiered Rate details
* @param PostData
*/
GetActivityTieredRate(PostData) {
this.ApiServ.Post('/ActivityContract/GetActivityTieredRate', PostData).subscribe((res) => {
if (res) {
this.AllContractTieredRate = res.responseObject;
this.tieredPricingsGroup.clear();
this.createTieredGroup(0)
this.AllContractTieredRate.forEach((e, i) => {
let ind = i + 1;
this.createTieredGroup(ind)
let val = this.tieredPricingsGroup.controls[ind].value;
Object.keys(val).forEach((l) => {
this.tieredPricingsGroup.controls[ind].get(l).setValue(e[l]);
});
})
}
})
}
/**
* @author Abdul Razzak
* to set all Tiered Rate value
*/
SetTieredRateValCopyUi() {
let val = this.tieredPricingsGroup.controls[0].value;
if (this.tieredPricingsGroup.controls.length > 1) {
let obj = this.tieredPricingsGroup.getRawValue();
obj.forEach((e, i) => {
if (this.HeaderTieredRateGroup.adult_range) {
this.HeaderTieredRateGroup.adult_range.forEach((d, li) => {
let name = 'adult_rate_range_' + (li + 1)
this.tieredPricingsGroup.controls[i].get(name).setValue(val[name]);
})
}
if (this.HeaderTieredRateGroup.senior_range) {
this.HeaderTieredRateGroup.senior_range.forEach((d, li) => {
let name = 'senior_rate_range_' + (li + 1)
this.tieredPricingsGroup.controls[i].get(name).setValue(val[name]);
})
}
if (this.HeaderTieredRateGroup.youth_range) {
this.HeaderTieredRateGroup.youth_range.forEach((d, li) => {
let name = 'youth_rate_range_' + (li + 1)
this.tieredPricingsGroup.controls[i].get(name).setValue(val[name]);
})
}
if (this.HeaderTieredRateGroup.child_range) {
this.HeaderTieredRateGroup.child_range.forEach((d, li) => {
let name = 'child_rate_range_' + (li + 1)
this.tieredPricingsGroup.controls[i].get(name).setValue(val[name]);
})
}
});
};
}
UpdateRate() {
let val = this.FormData.getRawValue()
let postdata = new EditActivityContractRate();
postdata.activity_contract_id = this.activityContractId;
postdata.activity_slot_id = '';
// private Transfer
let privateTransferArr = []
if (val.privateTransfer) {
val.privateTransfer.forEach((e) => {
let PostPrivateTransfer = new ActivityPrivateTransfer();
PostPrivateTransfer.rate = e.rate;
PostPrivateTransfer.vehicle_id = e.vehicle_id;
PostPrivateTransfer.vehicle_occupancy = e.vehicle_occupancy;
PostPrivateTransfer.vehicle_supplier_id = e.vehicle_supplier_id;
privateTransferArr.push(PostPrivateTransfer)
})
}
postdata.privateTransfer = val.privateTransfer ? privateTransferArr : [];
// shared Transfer
let PostSharedTransfer = new ActivitySharedTransfer();
if (val.sharedTransfer) {
let value = val.sharedTransfer
PostSharedTransfer.vehicle_supplier_id = value.vehicle_supplier_id;
PostSharedTransfer.adult_rate = value.adult_rate;
PostSharedTransfer.child_rate = value.child_rate;
PostSharedTransfer.senior_rate = value.senior_rate;
PostSharedTransfer.youth_rate = value.youth_rate;
}
postdata.sharedTransfer = val.sharedTransfer ? PostSharedTransfer : null;
// per pax prices
let PaxDetailsArr = []
if (val.PaxDetails) {
val.PaxDetails.splice(0, 1);
val.PaxDetails.forEach((e) => {
let postpaxrate = new PaxRates();
postpaxrate.activity_rate_per_pax_id = e.activity_rate_per_pax_id;
postpaxrate.adult_rate = e.adult_rate ? e.adult_rate : 0;
postpaxrate.child_rate = e.child_rate ? e.child_rate : 0;
postpaxrate.senior_rate = e.senior_rate ? e.senior_rate : 0;
postpaxrate.youth_rate = e.youth_rate ? e.youth_rate : 0;
PaxDetailsArr.push(postpaxrate)
});
}
postdata.perPaxPrices = val.PaxDetails ? PaxDetailsArr : [];
// per Vehicle Rates
let VahiclelistArr = []
if (val.vahicle_list) {
val.vahicle_list.splice(0, 1);
val.vahicle_list.forEach((q) => {
q.vehicle_rates.forEach((e) => {
let PostVahiclelist = new VehicleRates();
PostVahiclelist.activity_rate_per_vehicle_id = e.activity_rate_per_vehicle_id;
PostVahiclelist.rate = e.rate;
PostVahiclelist.vehicle_id = e.vehicle_id;
PostVahiclelist.vehicle_max_occupancy = e.vehicle_max_occupancy;
PostVahiclelist.vehicle_supplier_id = e.vehicle_supplier_id;
VahiclelistArr.push(PostVahiclelist)
})
})
}
postdata.perVehicleRates = val.vahicle_list ? VahiclelistArr : [];
// tiered Pricings
let PostTieredPricings = [];
if (val.tieredPricings) {
if (val.tieredPricings.length > 1) {
val.tieredPricings.splice(0, 1);
val.tieredPricings.forEach(e => {
let postList = new TieredPricingList();
postList.id = e.activity_rate_tiered_id;
let pricingArr = []
if (this.HeaderTieredRateGroup.adult_range) {
this.HeaderTieredRateGroup.adult_range.forEach((r, i) => {
let post = new PaxPricing();
post.rate = e['adult_rate_range_' + (i + 1)];
post.sequence = (i + 1);
post.pax_type = 'adult';
pricingArr.push(post);
})
}
if (this.HeaderTieredRateGroup.youth_range) {
this.HeaderTieredRateGroup.youth_range.forEach((r, i) => {
let post = new PaxPricing();
post.rate = e['youth_rate_range_' + (i + 1)];
post.sequence = (i + 1);
post.pax_type = 'youth';
pricingArr.push(post);
})
}
if (this.HeaderTieredRateGroup.senior_range) {
this.HeaderTieredRateGroup.senior_range.forEach((r, i) => {
let post = new PaxPricing();
post.rate = e['senior_rate_range_' + (i + 1)];
post.sequence = (i + 1);
post.pax_type = 'senior';
pricingArr.push(post);
})
}
if (this.HeaderTieredRateGroup.child_range) {
this.HeaderTieredRateGroup.child_range.forEach((r, i) => {
let post = new PaxPricing();
post.rate = e['child_rate_range_' + (i + 1)];
post.sequence = (i + 1);
post.pax_type = 'child';
pricingArr.push(post);
})
}
postList.pricing = pricingArr;
PostTieredPricings.push(postList)
})
}
postdata.tieredPricings = val.tieredPricings.length > 1 ? PostTieredPricings : [];
}
this.ApiServ.Post('/ActivityContract/UpdateRateConfig', postdata).subscribe((res) => {
if (res) {
this.showToastrMsg(res)
}
})
}
/**
* @author Abdul Razzak
* to show toaster
* @param respData
*/
showToastrMsg(respData) {
this.MsgService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
}
/**
* @author Abdul razzak
* to navigate overview tab
*/
btnClick() {
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage'])
}
/**
* @author Abdul Razzak
* to reset search value
*/
reset() {
this.FormData.get('searchgroup').get('slot_id').setValue('');
this.FormData.get('searchgroup').get('period_type').setValue('');
this.FormData.get('searchgroup').get('dates').setValue('');
this.FormData.get('searchgroup').get('seasonId').setValue([]);
this.FormData.get('searchgroup').get('days').setValue('');
}
// ----------------------------------------------------------------------------------------
// addvalid(name, type, num) {
// if (type == 'add') {
// if (num == 'number') {
// this.FormData.controls[name].addValidators([
// Validators.pattern(/^[0-9]*$/),
// ]);
// this.FormData.controls[name].updateValueAndValidity();
// } else {
// this.FormData.controls[name].addValidators([Validators.required]);
// this.FormData.controls[name].updateValueAndValidity();
// }
// } else {
// this.FormData.controls[name].clearValidators();
// this.FormData.controls[name].updateValueAndValidity();
// this.FormData.controls[name].markAsUntouched();
// }
// }
// ----------------------------------------------------------------------------------------------
// for calender
// checkcleander() {
// let value = this.FormData.getRawValue();
// if (value.Search_date[0] && value.Search_date[1]) {
// this.datePicker.overlayVisible = false;
// }
// }
}

View File

@@ -1,139 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Edit Modify Details</div>
<div class="app-mainCard" [formGroup]="FormData">
<div class="app-mainGrid2">
<div class="">
<label class="formLabel">Experience Name</label>
<input class="formInput readonlyInput" formControlName="experience_name" type="text" readonly />
</div>
<div class="">
<label class="formLabel"> Currency</label>
<ng-select #select [items]="currencyList" [readonly]="true" formControlName="currency_code"
bindLabel="currency_name" bindValue="currency_code"></ng-select>
</div>
<div class="">
<label class="formLabel">Option Name</label>
<input class="formInput" formControlName="option_name"
[ngClass]="{ errorInput: validationService.onBlur(FormData.controls['option_name'],'required')}"
type="text" />
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['option_name'],
'required'
)
">Please enter option name</span>
</div>
</div>
<div class="mt-40">
<h4>Applicable Nationality</h4>
<div class="mt-20 mb-20">
<mat-radio-group (change)="isIncludeNationality($event.value)" formControlName="_nationality_type">
<div class="app-mainGrid4">
<div>
<mat-radio-button value="1">All Nationality</mat-radio-button>
</div>
<div class="app-grid2-5">
<mat-radio-button value="2">Specific Nationality</mat-radio-button>
<div class="Rate_hideInput" *ngIf="FormData.value._nationality_type == '2'">
<div class="mt-20">
<div *ngIf="FormData.get('include_nationality_code')">
<label class="formLabel">Nationality</label>
<ng-select [items]="include_nationality_list" bindLabel="country_name"
bindValue="alpha_2_code" class="is-invalid" [multiple]="true"
formControlName="include_nationality_code"
(change)="remove_nationality('exclude')"
[ngClass]="{
errorInput: validationService.onBlur( FormData.controls['include_nationality_code'],'required') }">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['include_nationality_code'],
'required'
)
">Please select nationality</span>
</div>
</div>
</div>
</div>
</div>
</mat-radio-group>
</div>
<div class="mt-20 mb-20">
<div class="app-mainGrid4">
<div class="mt-20">
<mat-checkbox formControlName="is_exclude_nationality"
(change)="isExcludeNationality($event.checked)" inputId="is_exclude_nationality"> Exclude
Nationality</mat-checkbox>
</div>
<div class="Rate_hideInput" *ngIf="FormData.get('exclude_nationality_code')">
<div class="">
<div>
<label class="formLabel">Nationality</label>
<ng-select [items]="exclude_nationality_list" bindLabel="country_name"
bindValue="alpha_2_code" class="is-invalid" [multiple]="true"
formControlName="exclude_nationality_code" (change)="remove_nationality('include')"
[ngClass]="{
errorInput: validationService.onBlur(
FormData.controls['exclude_nationality_code'],
'required'
)
}">
</ng-select>
<span class="errorspan" *ngIf="
validationService.onBlur(
FormData.controls['exclude_nationality_code'],
'required'
)
">Please select nationality</span>
</div>
</div>
</div>
</div>
</div>
<div class="app-mainGrid4">
<div class="mt-20 mb-5 self-center">
<mat-checkbox formControlName="is_pickup_included" inputId="is_pickup_included">Pickup Included
</mat-checkbox>
</div>
<div class="mt-20 mb-5 self-center">
<mat-checkbox formControlName="is_drop_off_included" inputId="is_drop_off_included">Drop Off Included
</mat-checkbox>
</div>
</div>
<div class="app-mainGrid2 mt-20">
<div>
<label class="formLabel">Rate Inclusions</label>
<textarea class="formInput" formControlName="rate_inclusion"></textarea>
</div>
<div>
<label class="formLabel">Contract Remark</label>
<textarea class="formInput" formControlName="contract_remark"></textarea>
</div>
</div>
<div class="app-mainGrid4 mt-20">
<mat-checkbox formControlName="is_guide_included" (change)="AddLangContorls($event.checked)">Tourist Guide
Included</mat-checkbox>
<div class="ng-hideHead" *ngIf="FormData.get('guide_languages')">
<label class="formLabel">Tourist Guide Language</label>
<ng-select [items]="lovKeyDataObj.Language" formControlName="guide_languages" bindLabel="lov_value"
bindValue="lov_value" [multiple]="true"
[ngClass]="{ errorInput: validationService.onBlur(FormData.controls['guide_languages'],'required')}">
</ng-select>
<span class="errorspan"
*ngIf="validationService.onBlur(FormData.controls['guide_languages'],'required' )">Please enter
tourist guide language</span>
</div>
</div>
<div class="row mt-20">
<div class="col-lg-12 text-right">
<button pButton type="button" (click)="updateEditdetails()" label="Save" class="btn-primary"></button>
</div>
</div>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,228 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageService } from 'primeng/api';
import { ValidationService } from 'src/app/core/common/validation.service';
import { EditActivityContractDetail } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-details/edit-deatils.model';
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'app-modify-details',
templateUrl: './modify-details.component.html',
})
export class ModifyDetailsComponent implements OnInit {
FormData: FormGroup
activityData;
currencyList;
activityContractId;
include_nationality_list;
exclude_nationality_list;
all_nationality_list;
constructor(
private route: ActivatedRoute,
public fb: FormBuilder,
public APIServ: API,
public validationService: ValidationService,
public MsgService: MessageService,
private router: Router
) { }
ngOnInit(): void {
this.OnintGroup()
this.GetActivityById();
this.GetAllCurrency();
this.GetAllNationality();
this.GetLOVKeys('Language')
this.getRateConfig();
}
lovKeyDataObj = {
Language: []
}
OnintGroup() {
this.FormData = this.fb.group({
experience_name: [''],
option_name: this.validationService.required,
currency_code: [''],
_nationality_type: ['1'],
is_exclude_nationality: [false],
rate_inclusion: [''],
contract_remark: [''],
is_pickup_included: [false],
is_drop_off_included: [false],
is_guide_included: [false],
});
}
GetActivityById() {
let activity_id = CommonService.getSessionStoage('activity_id');
this.APIServ.Get('/Activity/GetActivity/' + activity_id).subscribe(d => {
if (d && d.status) {
if (d.responseObject.activityContents && d.responseObject.activityContents.length > 0) {
this.activityData = d.responseObject;
this.FormData.get('experience_name').setValue(d.responseObject.activityContents[0].activity_name);
}
}
});
}
getRateConfig() {
this.route.queryParams.subscribe((obj) => {
if (obj['id']) {
this.activityContractId = obj['id'];
this.APIServ.Get(
'/ActivityContract/GetRateConfig/' + obj['id']
).subscribe((data) => {
if (data) {
this.SetValue(data.responseObject);
}
});
}
});
}
SetValue(data) {
let value = this.FormData.getRawValue();
Object.keys(value).forEach(e => {
if (e == 'option_name' || e == 'currency_code' || e == 'rate_inclusion' || e == 'contract_remark' ||
e == 'is_drop_off_included' || e == 'is_pickup_included') {
this.FormData.get(e).setValue(data[e]);
} else if (e == '_nationality_type') {
this.FormData.get(e).setValue(data[e]);
if (data[e] == '2') {
this.isIncludeNationality(data[e]);
let code = data['include_nationality_code'] ? data['include_nationality_code'].split(',') : [];
this.FormData.get('include_nationality_code').setValue(code);
this.remove_nationality('exclude');
}
} else if (e == 'is_exclude_nationality') {
this.FormData.get(e).setValue(data[e]);
if (data[e]) {
this.isExcludeNationality(data[e]);
let code = data['exclude_nationality_code'] ? data['exclude_nationality_code'].split(',') : [];
this.FormData.get('exclude_nationality_code').setValue(code);
this.remove_nationality('include');
}
} else if (e == 'is_guide_included') {
this.FormData.get(e).setValue(data[e]);
if (data[e]) {
this.AddLangContorls(data[e])
let Lngcode = data['guide_languages'] ? data['guide_languages'].split(',') : '';
this.FormData.get('guide_languages').setValue(Lngcode);
}
}
});
}
AddLangContorls(check) {
if (check) {
this.FormData.addControl('guide_languages', this.fb.control([], Validators.required));
} else {
this.FormData.removeControl('guide_languages');
}
}
GetAllCurrency() {
this.APIServ.Get('/Currency/GetCurrency').subscribe(d => {
if (d) this.currencyList = d;
});
}
isExcludeNationality(check) {
if (check) {
this.FormData.addControl('exclude_nationality_code', this.fb.control([[]], Validators.required));
this.remove_nationality('include');
} else this.FormData.removeControl('exclude_nationality_code');
}
isIncludeNationality(val) {
if (val == '2') {
this.FormData.addControl('include_nationality_code', this.fb.control([], Validators.required));
this.FormData.get('include_nationality_code').setValue([]);
} else if (val == '1') {
this.FormData.removeControl('include_nationality_code');
this.remove_nationality('exclude');
}
}
remove_nationality(type) {
let con = type == 'exclude' ? 'include_nationality_code' : 'exclude_nationality_code'
type == 'exclude' ? this.exclude_nationality_list = [...this.all_nationality_list] : this.include_nationality_list = [...this.all_nationality_list];
let list = type == 'exclude' ? this.exclude_nationality_list : this.include_nationality_list;
let nationality_arr = this.FormData.get(con) ? this.FormData.get(con).value : [];
nationality_arr.forEach(nationality_code => {
let ind = list.findIndex(nationality_obj => nationality_obj.alpha_2_code == nationality_code);
(ind != -1) ? list.splice(ind, 1) : '';
type == 'exclude' ? this.exclude_nationality_list = [...list] : this.include_nationality_list = [...list];
});
}
GetAllNationality() {
this.APIServ.Get('/Country/GetCountry').subscribe(res => {
if (res) {
this.all_nationality_list = res;
this.include_nationality_list = res;
this.exclude_nationality_list = res;
}
});
}
GetLOVKeys(lov_key_names) {
let lov_key_names_arr = lov_key_names.split(',');
let lov_obj = {
"lov_types": [],
"lov_lang": "en"
}
lov_key_names_arr.forEach(key_name => {
lov_obj.lov_types.push({ "lov_type": key_name });
});
this.APIServ.Post('/LovMaster/GetLov', lov_obj).subscribe(lov_data => {
if (lov_data && lov_data.status) {
this.GetActivityById();
lov_key_names_arr.forEach(key_name => {
let arr = lov_data.responseObject.filter(el => el.lov_type == key_name);
arr.length > 0 ? this.lovKeyDataObj[key_name] = arr[0].keys : '';
});
}
});
}
updateEditdetails() {
let postdata = new EditActivityContractDetail();
let value = this.FormData.getRawValue();
postdata.contract_id = this.activityContractId;
postdata.language_code = CommonService.getSessionStoage('Def_Lang_code');
postdata.option_name = value.option_name;
postdata.currency_code = value.currency_code;
postdata._nationality_type = value._nationality_type;
postdata.is_exclude_nationality = value.is_exclude_nationality;
postdata.rate_inclusion = value.rate_inclusion;
postdata.contract_remark = value.contract_remark;
postdata.is_pickup_included = value.is_pickup_included;
postdata.is_drop_off_included = value.is_drop_off_included;
postdata.is_guide_included = value.is_guide_included;
postdata.exclude_nationality_code = value.exclude_nationality_code ? value.exclude_nationality_code.join(',') : '';
postdata.include_nationality_code = value.include_nationality_code ? value.include_nationality_code.join(',') : '';
postdata.guide_languages = value.guide_languages ? value.guide_languages.join(',') : '';
this.APIServ.Post('/ActivityContract/UpdateContractDetails', postdata).subscribe(res => {
if (res) {
this.showToastrMsg(res)
}
})
}
showToastrMsg(respData) {
this.MsgService.add({
severity: respData['status'] ? 'success' : 'error',
detail: respData['message'],
});
setTimeout(() => {
respData['status'] ? this.btnClick() : '';
}, 500);
}
btnClick() {
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage'])
}
}

View File

@@ -1,178 +0,0 @@
<div class="app-mainHeader mt-20">
<div>Rate Config</div>
<button pButton type="button" label="Add Rate Config" class="btn-primary" [routerLink]="['/Services/ActivityServices/ExpServices/Manage/Add']"></button>
</div>
<div class="app-mainCard">
<div class="app-mainGrid4">
<div class="">
<label class="formLabel">Option Name</label>
<input class="formInput" [(ngModel)]="OptionName" type="text" />
</div>
<div>
<mat-checkbox class="app-subHeader" [(ngModel)]="is_pickup_included">
<div>Pickup Included</div>
</mat-checkbox>
</div>
<div>
<mat-checkbox class="app-subHeader" [(ngModel)]="is_drop_off_included">
<div>Drop Off Included</div>
</mat-checkbox>
</div>
</div>
<div class="mt-20">
<button pButton type="button" label="Reset" (click)="reset()" class="btn-secondary btn mr-10"></button>
<button pButton type="button" label="Search" (click)="GetallrateDetails()" class="btn-primary btn"></button>
</div>
</div>
<div class="app-mainCard">
<div class="rate_config">
<p-table #dt [value]="rateDetails" [rows]="10" responsiveLayout="scroll" electionMode="multiple" styleClass="p-datatable-gridlines" [paginator]="true" [globalFilterFields]="[
'option_name',
'nationality',
'date',
'currency_code',
'contract_days',
'is_pickup_included',
'is_drop_off_included',
'is_active'
]" [(selection)]="rateDetails" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar>
<ng-template pTemplate="left">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="dt.exportCSV()" class="btn-secondary mr-10" pTooltip="CSV" label="CSV" tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportExcel()" class="btn-secondary mr-10" pTooltip="XLS" label="Excel" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="PDF" label="PDF" tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print" tooltipPosition="bottom"></button>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dt.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="option_name">
Option Name
<p-sortIcon field="option_name" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="nationality">
Nationality
<p-sortIcon field="nationality" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="date">
Date Range/Season
<p-sortIcon field="date" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="currency_code">
Currency
<p-sortIcon field="currency_code" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="slot">
Slot
<p-sortIcon field="slot" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_pickup_included">
Pickup Included
<p-sortIcon field="is_pickup_included" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_drop_off_included">
Drop Off Included
<p-sortIcon field="is_drop_off_included" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_active">
Status
<p-sortIcon field="is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rating">
Action
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-rateDetails>
<tr>
<td>{{rateDetails.option_name}}</td>
<td>{{rateDetails.nationality}}</td>
<td>
<span *ngIf="rateDetails.date">
<span class="d-block" *ngFor="let item of rateDetails.date.split(','); let i = index">{{rateDetails.date
== null ? '' :
item | date: 'dd MMM YYYY' }} {{
i == 0 && rateDetails.date.split(',').length > 1? '-' : ''}} </span>
</span>
</td>
<td>{{rateDetails.currency_code}}</td>
<td>
<span *ngFor="let item of SoltsDetailsConvParse(rateDetails.activity_slot)"> {{item.date}}</span>
</td>
<td>{{rateDetails.is_pickup_included ? "Yes" : "No"}}</td>
<td>{{rateDetails.is_drop_off_included? "Yes" : "No"}}</td>
<td>
<span class="product-badge" [ngClass]="{'status-active':rateDetails.is_active,'status-inactive' : rateDetails.is_active == false}">{{
rateDetails.is_active ?
'Active' : 'Deactive' }}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="EditRateConfig(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit Rate</span>
</span>
</button>
<button mat-menu-item (click)="EditDetails(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit Details</span>
</span>
</button>
<button mat-menu-item (click)="EditAllocation(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit Allocation </span>
</span>
</button>
<button mat-menu-item (click)="EditCancelPoli(rateDetails.activity_contract_id)">
<span class="flex-center">
<span> Edit Cancellation Policy </span>
</span>
</button>
<!-- <button mat-menu-item (click)="EditAllocation(rateDetails.activity_contract_id) ">
<span class="flex-center">
<span> Edit No Show Policy </span>
</span>
</button> -->
<button mat-menu-item (click)="UpdateStatus(rateDetails.activity_contract_id ,rateDetails.is_active)">
<span class="flex-center">
<span>{{rateDetails.is_active
? 'Deactivate' : 'Activate' }}
</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage">
<tr *ngIf="rateDetails === null || rateDetails" class="ResultNotFound">
<td>
No data found
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,122 +0,0 @@
import { Component, OnInit } from '@angular/core';
import * as FileSaver from 'file-saver';
import {
ConfirmationService,
MessageService,
PrimeNGConfig,
} from 'primeng/api';
import { API } from 'src/app/core/services/api.service';
import { Product } from 'src/app/core/services/product';
import { CommonService } from 'src/app/core/services/common.service';
import { Router } from '@angular/router';
import { ActivityAllContract } from 'src/app/core/models/Experience-Service/experience-rate-config-Edit/edit-rate-confi/edit-rate-confi.model';
import * as moment from 'moment';
@Component({
selector: 'rate-config',
templateUrl: './rate-config.component.html',
})
export class RateConfigComponent implements OnInit {
products!: Product[];
selectedProducts!: Product[];
product!: Product;
rateDetails;
OptionName = '';
is_pickup_included = false;
is_drop_off_included = false;
constructor(public ApiServ: API, private MsgService: MessageService, private router: Router) { }
ngOnInit(): void {
// this.GetallrateDetails();
}
GetallrateDetails() {
let activityid = CommonService.getSessionStoage('activity_id');
let postdata = new ActivityAllContract();
postdata.activity_id = activityid;
postdata.is_drop_off_included = this.is_drop_off_included;
postdata.is_pickup_included = this.is_pickup_included;
postdata.option_name = this.OptionName;
this.ApiServ.Post('/ActivityContract/GetAllActivityRates', postdata).subscribe(data => {
if (data) {
this.rateDetails = data.responseObject;
}
})
}
UpdateStatus(ID, Status) {
let Obj = {
id: ID,
updatedBy: "",
"status": Status ? false : true
}
this.ApiServ.Post('/ActivityContract/UpdateStatus', Obj).subscribe(data => {
if (data) {
this.MsgService.add({
severity: data["status"] ? "success" : "error",
detail: data["message"],
});
this.GetallrateDetails();
}
});
};
EditCancelPoli(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditCancelletionPolicy'], { queryParams: obj })
}
EditAllocation(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditAllocation'], { queryParams: obj })
}
EditRateConfig(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditModifyRate'], { queryParams: obj })
}
EditDetails(Id) {
let obj = { id: Id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/EditDetails'], { queryParams: obj })
}
exportExcel() {
import('xlsx').then((xlsx) => {
const worksheet = xlsx.utils.json_to_sheet(this.products);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, {
bookType: 'xlsx',
type: 'array',
});
this.saveAsExcelFile(excelBuffer, 'products');
});
}
reset(){
this.is_drop_off_included = false;
this.is_pickup_included = false;
this.OptionName = '';
}
SoltsDetailsConvParse(data) {
let obj = data ? JSON.parse(data) : '';
let html = [];
obj ? obj.forEach(e => html.push({ 'date': moment(e.start_time).format('hh:mm') + '-' + moment(e.end_time).format('hh:mm') })) : ''
return html
}
saveAsExcelFile(buffer: any, fileName: string): void {
import('file-saver').then((abc) => {
let EXCEL_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
let EXCEL_EXTENSION = '.xlsx';
const data: Blob = new Blob([buffer], {
type: EXCEL_TYPE,
});
FileSaver.saveAs(
data,
fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION
);
});
}
}

View File

@@ -1,43 +0,0 @@
<div class="btn-back mb-15" (click)="btnClick()">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation" >
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Add New Season Setting</div>
<div class="app-mainCard" [formGroup]="AddSeasonForm">
<div class="app-mainGrid4">
<div>
<label class="formLabel">Season Name</label>
<input class="formInput" formControlName="season_name" type="text" [ngClass]="{ errorInput: validationService.onBlur( AddSeasonForm.controls['season_name'], 'required') }"/>
<span class="errorspan" *ngIf=" validationService.onBlur( AddSeasonForm.controls['season_name'], 'required' )">
Please enter season name
</span>
</div>
<div>
<div formArrayName="Calender">
<div *ngFor="let item of Calenders.controls; let i = index" class="app-Cominput mb-20" [formGroupName]="i">
<div>
<label for="multiple1" class="formLabel">Date Select</label>
<p-calendar formControlName="CalenderDate" #Datecalendar (onClose)="onSelect($event ,i)" [minDate]="minDateLst[i]" [numberOfMonths]="2" selectionMode="range" [readonlyInput]="true" inputId="multiple">
<!-- <ng-template pTemplate="footer">
<div class="calendarBtn">
<button pButton label="Cancel" class="btn-secondary"></button>
<button pButton label="Apply" (click)="onSelect($event ,i)" class="btn-primary"></button>
</div>
</ng-template> -->
</p-calendar>
</div>
<div class="ml-10">
<button pButton *ngIf="i == 0" icon="pi pi-plus" (click)="addSeasonSetting(true)" class="btn-icon"></button>
<button pButton *ngIf="i != 0" icon="pi pi-minus" class="btn-icon" (click)="removeSeasonSetting(i)"></button>
</div>
</div>
</div>
</div>
</div>
<div class="text-end">
<button pButton type="button" label="Save" (click)="SaveSeason()" class="btn-primary"></button>
</div>
</div>
<p-toast></p-toast>

View File

@@ -1,168 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { MessageService } from 'primeng/api';
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
import { ValidationService } from 'src/app/core/common/validation.service';
import { ActivitySeason, ActivitySeasonDetails } from 'src/app/core/models/Experience-Service/season-setting/season-setting-add.model';
@Component({
selector: 'app-add-new-season',
templateUrl: './add-new-season.component.html',
})
export class AddNewSeasonComponent implements OnInit {
CommonCalender!: string;
minDateLst = []
AddSeasonForm;
season_id;
messageService: any;
constructor(
private router: Router,
private route: ActivatedRoute,
private ApiServ: API,
private MsgService: MessageService,
public validationService: ValidationService,
private fb: FormBuilder
) { }
ngOnInit(): void {
this.initForm();
this.minDateLst.push(new Date())
this.update()
}
update() {
this.route.queryParams.subscribe(obj => {
if (obj['id']) {
this.ApiServ.Get('/ActivitySeason/GetActivitySeason/' + obj['id']).subscribe(d => {
this.SetValue(d['responseObject']);
this.season_id = obj['id'];
});
}
});
}
initForm() {
this.AddSeasonForm = this.fb.group({
season_name: this.validationService.required,
// supplier_id: ['2205221841391724322'],
activity_id: CommonService.getSessionStoage('activity_id'),
org_id: ['2105311837100000021'],
Calender: this.fb.array([
this.fb.group({
CalenderDate: [[new Date(), new Date()]]
})
])
})
}
SetValue(value) {
this.AddSeasonForm.get("season_name").setValue(value[0].activitySeason.season_name)
this.Calenders.clear()
for (let i = 0; i < value[0].seasondateRange.length; i++) {
this.Calenders.push(this.fb.group({
CalenderDate: [[,]]
}))
let first = new Date(value[0].seasondateRange[i].fromDate);
let last = new Date(value[0].seasondateRange[i].toDate);
this.Calenders.controls[i].get('CalenderDate').setValue([first, last]);
this.minDateLst[i] = first
}
}
get Calenders() {
return this.AddSeasonForm.get('Calender') as FormArray;
}
onSelect(elem, index) {
for (let i = index + 1; i < this.Calenders.controls.length; i++) {
let value = this.Calenders.controls[index].value
this.Calenders.controls[i].get('CalenderDate').setValue([
new Date(moment(value.CalenderDate[1]).add(1, 'days').format()),//start date
new Date(moment(value.CalenderDate[1]).add(1, 'days').format()) //end date
]);
this.minDateLst[i] = new Date(moment(value.CalenderDate[1]).add(1, 'days').format())
}
}
addSeasonSetting(checkDate) {
if (checkDate) {
let value = this.Calenders.controls[this.Calenders.controls.length - 1].value
this.Calenders.push(this.fb.group({
CalenderDate: [[
new Date(moment(value.CalenderDate[1]).add(1, 'days').format()),//start date
new Date(moment(value.CalenderDate[1]).add(1, 'days').format())//end date
]]
}));
this.minDateLst.push(new Date(moment(value.CalenderDate[1]).add(1, 'days').format()))
};
}
SaveSeason() {
if (this.AddSeasonForm.status == "INVALID") {
this.validationService.showValidationsMsg(this.AddSeasonForm);
return;
}
let dateArray = []
for (let i = 0; i < this.Calenders.controls.length; i++) {
let value = this.Calenders.controls[i].value
let newdate = value.CalenderDate
dateArray.push({
FromDate: moment(newdate[0]).format('YYYY-MM-DD'),
ToDate: moment(newdate[1]).format('YYYY-MM-DD')
})
}
let value = this.AddSeasonForm.getRawValue()
let SeasonModel = new ActivitySeasonDetails()
let Season = new ActivitySeason()
Season.org_id = '';
Season.season_name = value.season_name;
Season.activity_id = value.activity_id;
Season.supplier_id = ''
Season.activity_season_id = this.season_id ? this.season_id : '';
SeasonModel.activitySeason = Season;
Season.created_by = '';
Season.updated_by = ''
SeasonModel.seasondateRange = dateArray;
if (this.season_id) {
this.ApiServ.Post('/ActivitySeason/UpdateActivitySeason', SeasonModel).subscribe(data => {
if (data) {
this.MsgService.add({
severity: data['status'] ? 'success' : 'error',
detail: data['message'],
});
setTimeout(() => {
data['status'] ? this.btnClick() : ''
}, 500);
}
});
} else {
this.ApiServ.Post('/ActivitySeason/SaveActivitySeason', SeasonModel).subscribe(data => {
if (data) {
this.MsgService.add({
severity: data['status'] ? 'success' : 'error',
detail: data['message'],
});
setTimeout(() => {
data['status'] ? this.btnClick() : ''
}, 500);
}
});
}
};
removeSeasonSetting(index: number) {
this.Calenders.removeAt(index)
this.minDateLst.splice(index, 1)
}
btnClick() {
this.router.navigateByUrl("/Services/ActivityServices/ExpServices/Manage");
}
descreption: string = '';
showInfo(descreption) {
this.descreption = descreption;
this.messageService.add({ severity: 'info', summary: 'samary', detail: '' });
}
}

View File

@@ -1,117 +0,0 @@
<div class="app-mainHeader mt-20">
<div>Season Setting</div>
<button pButton type="button" label="Add New Season" class="btn-primary" [routerLink]="[
'/Services/ActivityServices/ExpServices/Manage/AddNewSeason'
]"></button>
</div>
<div class="app-mainCard">
<div class="app-mainGrid4">
<div class="">
<label class="formLabel">Season Name</label>
<input class="formInput" [(ngModel)]="Season_name" type="text">
</div>
</div>
<div class="mt-20">
<button pButton type="button" label="Reset" (click)="reset()" class="btn-secondary btn mr-10"></button>
<button pButton type="button" label="Search" (click)="SearchSeason()" class="btn-primary btn"></button>
</div>
</div>
<div class="app-mainCard">
<p-table #dt [value]="SeasonData" [rows]="25" responsiveLayout="scroll" styleClass="p-datatable-gridlines"
[paginator]="true" [columns]="cols" [globalFilterFields]="[
'activitySeason.season_name',
'country.name',
'activitySeason.is_active',
'status'
]" [(selection)]="SeasonData" [rowHover]="true" dataKey="id"
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries" [showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar>
<ng-template pTemplate="left">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy"
tooltipPosition="bottom"></button>
<button type="button" pButton (click)="dt.exportCSV()" class="btn-secondary mr-10" pTooltip="CSV" label="CSV"
tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportExcel()" class="btn-secondary mr-10" pTooltip="XLS" label="Excel"
tooltipPosition="bottom"></button>
<button type="button" pButton (click)="exportPdf()" class="btn-secondary mr-10" pTooltip="PDF" label="PDF"
tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print"
tooltipPosition="bottom"></button>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dt.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header" let-SeasonData>
<tr>
<th pSortableColumn="activitySeason.season_name">
Season Name
<p-sortIcon field="activitySeason.season_name" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="seasondateRange.fromDate">
Season Date Range
<p-sortIcon field="seasondateRange.fromDate" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="activitySeason.is_active">
Status
<p-sortIcon field="activitySeason.is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rating">
Action
<p-sortIcon field="rating" class="p-sort-icon"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-SeasonData>
<tr>
<td>{{SeasonData.activitySeason.season_name}}</td>
<td>
<span class="d-block" *ngFor="let date of SeasonData.seasondateRange; let i = index">{{date.fromDate | date:
'dd MMM yyyy'}} - {{date.toDate| date: 'dd MMM yyyy'}}</span>
</td>
<td>
<span class="product-badge"
[ngClass]="{'status-active':SeasonData.activitySeason.is_active,'status-inactive':SeasonData.activitySeason.is_active == false}">{{
SeasonData.activitySeason.is_active ? 'Active' : 'Deactive'}}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="Edit(SeasonData.activitySeason.activity_season_id)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> edit </span>
<span> Edit </span>
</span>
</button>
<button mat-menu-item
(click)="UpdateStatus(SeasonData.activitySeason.activity_season_id, SeasonData.activitySeason.is_active)">
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> check_circle </span>
<span> {{SeasonData.activitySeason.is_active ? 'Deactivate' : 'Activate' }} </span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage">
<tr *ngIf="SeasonData === null || SeasonData" class="ResultNotFound">
<td>
No data found
</td>
</tr>
</ng-template>
</p-table>
</div>

View File

@@ -1,106 +0,0 @@
import { Component, OnInit } from '@angular/core';
import * as FileSaver from 'file-saver';
import { MessageService } from 'primeng/api';
import { API } from 'src/app/core/services/api.service';
import jsPDF from "jspdf";
import "jspdf-autotable";
import { Router } from '@angular/router';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'season-creation',
templateUrl: './season-creation.component.html',
})
export class SeasonCreationComponent implements OnInit {
constructor(
private router: Router,
private ApiServ: API,
private MsgService: MessageService,
// private primengConfig: PrimeNGConfig
) { }
SeasonData;
cols!: any[];
exportColumns!: any[];
Season_name = '';
ngOnInit(): void {
// this.primengConfig.ripple = true;
this.cols = [
{ field: 'activitySeason.season_name', header: 'Season Name', customExportHeader: 'Product Code' },
{ field: 'seasondateRange.fromDate', header: 'Season Date Range' },
{ field: 'activitySeason.is_active', header: 'Status' },
];
this.exportColumns = this.cols.map((col) => ({
title: col.header,
dataKey: col.field,
}));
}
exportPdf() {
// const doc = new jsPDF();
const doc = new jsPDF('p', 'pt');
doc['autoTable'](this.exportColumns, this.SeasonData);
doc.save("Season_Data_export_" + new Date().getTime() + ".pdf");
}
Edit(sea_id) {
let obj = { id: sea_id };
this.router.navigate(['/Services/ActivityServices/ExpServices/Manage/AddNewSeason'], { queryParams: obj })
}
UpdateStatus(exp_id, status) {
let obj = { id: exp_id, status: status ? false : true, updatedBy: '' }
this.ApiServ.Post('/ActivitySeason/UpdateStatus', obj).subscribe((data) => {
if (data) {
this.MsgService.add({
severity: data["status"] ? "success" : "error",
detail: data["message"],
});
this.SearchSeason();
}
});
}
SearchSeason() {
let activityid = CommonService.getSessionStoage('activity_id')
this.ApiServ.Get('/ActivitySeason/GetAllActivitySeason?activityId=' + activityid + '&seasonName=' + this.Season_name).subscribe(e => {
if (e) {
this.SeasonData = e['responseObject'];
}
})
}
reset() {
this.Season_name = '';
}
exportExcel() {
import('xlsx').then((xlsx) => {
console.log(xlsx);
const worksheet = xlsx.utils.json_to_sheet(this.SeasonData);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, {
bookType: 'xlsx',
type: 'array',
});
this.saveAsExcelFile(excelBuffer, 'Season_Data_export_' + new Date().getTime());
});
}
saveAsExcelFile(buffer: any, fileName: string): void {
import('file-saver').then((abc) => {
let EXCEL_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
let EXCEL_EXTENSION = '.xlsx';
const data: Blob = new Blob([buffer], {
type: EXCEL_TYPE,
});
console.log(FileSaver);
FileSaver.saveAs(
data,
fileName + '_export_' + new Date().getTime() + EXCEL_EXTENSION
);
});
}
}

View File

@@ -1,59 +0,0 @@
<div class="btn-back mb-15" [routerLink]="['/Services/ActivityServices/ExpServices/Manage']">
<svg height="20px" fill="#48465b" focusable="false" viewBox="0 0 24 24" aria-hidden="true" role="presentation">
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path>
</svg>
<span>Back</span>
</div>
<div class="app-mainHeader">Add Slot</div>
<div class="app-mainCard" [formGroup]="SaveAddSlot">
<div class="app-mainGrid4 mb-20">
<div class="app-timer">
<label class="formLabel" for="timeonly">Slot Start Time</label>
<p-calendar (onSelect)="Check()" [timeOnly]="true" hourFormat="24" inputId="timeonly" [readonlyInput]="true"
class="formLabel" formControlName="start_time"
[ngClass]="{
'errorInput': validationService.onBlur(SaveAddSlot.controls['start_time'],'required') || SaveAddSlot.controls['start_time_Check'].value}"></p-calendar>
<span class="errorspan" *ngIf="validationService.onBlur(SaveAddSlot.controls['start_time'], 'required')
">Please select Slot Start Time
</span>
<span class="errorspan" *ngIf="SaveAddSlot.controls['start_time_Check'].value">Please select different start time
</span>
</div>
<div class="app-timer">
<label class="formLabel" for="timeonly">Slot End Time</label>
<p-calendar [timeOnly]="true" hourFormat="24" (onSelect)="Check()" inputId="timeonly" [readonlyInput]="true"
class="formLabel" formControlName="end_time"
[ngClass]="{
'errorInput': validationService.onBlur(SaveAddSlot.controls['end_time'],'required') || SaveAddSlot.controls['end_time_Check'].value }"></p-calendar>
<span class="errorspan" *ngIf="validationService.onBlur(SaveAddSlot.controls['end_time'], 'required') ">Please
select slot end time
</span>
<span class="errorspan" *ngIf="SaveAddSlot.controls['end_time_Check'].value">Please select different end time
</span>
</div>
<div class="app-timer">
<label class="formLabel">Cut-Off Time (in Hrs)</label>
<p-calendar [timeOnly]="true" hourFormat="24" inputId="timeonly" [readonlyInput]="true" class="formLabel"
formControlName="cut_off_time" [ngClass]="{
'errorInput': validationService.onBlur(SaveAddSlot.controls['cut_off_time'],'required')}"></p-calendar>
<span class="errorspan" *ngIf="validationService.onBlur(SaveAddSlot.controls['cut_off_time'], 'required')
">Please select cut-off time
</span>
</div>
<div>
<label class="formLabel">Time Zone</label>
<ng-select #selectExp formControlName="timezone" [ngClass]="{
'errorInput': validationService.onBlur(SaveAddSlot.controls['timezone'],'required')}">
<ng-option *ngFor="let item of timeZoneData" [value]="item.timezone_Id">{{item.utc + ' ' + item.timezone }}
</ng-option>
</ng-select>
<span class="errorspan" *ngIf="validationService.onBlur(SaveAddSlot.controls['timezone'], 'required')
">Please select time zone
</span>
</div>
</div>
<div class="text-right mt-40">
<button pButton class="btn-primary" label="Save" (click)="Save()"></button>
</div>
<p-toast></p-toast>

View File

@@ -1,173 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { MessageService } from 'primeng/api';
import { ValidationService } from 'src/app/core/common/validation.service';
import { ActivitySlot } from 'src/app/core/models/Experience-Service/slot/add-slots-model';
// import { ActivitySlot } from 'src/app/core/models/Experience-Service/slot/add-slots.model';
import { API } from 'src/app/core/services/api.service';
import { CommonService } from 'src/app/core/services/common.service';
@Component({
selector: 'app-add-slots',
templateUrl: './add-slots.component.html',
})
export class AddSlotsComponent implements OnInit {
date8: Date;
timeZoneData: any;
slot_id: any;
constructor(
public fb: FormBuilder,
public ApiServ: API,
public router: Router,
public validationService: ValidationService,
public MsgService: MessageService,
public routes: ActivatedRoute
) { }
SaveAddSlot: FormGroup;
date1 = new Date();
date2 = new Date();
ngOnInit(): void {
this.initform();
this.GetData();
this.GetSlotId();
this.date1.setHours(0);
this.date1.setMinutes(0);
this.date1.setSeconds(0);
this.date2.setHours(0);
this.date2.setMinutes(0);
this.date2.setSeconds(0);
}
initform() {
this.SaveAddSlot = this.fb.group({
start_time: [this.date1, Validators.required],
start_time_Check: [false],
end_time_Check: [false],
end_time: [this.date2, Validators.required],
cut_off_time: [this.date2, Validators.required],
timezone: this.validationService.required,
});
}
GetData() {
this.ApiServ.Get('/TimezoneCity/GetAllTimezoneCity').subscribe((res) => {
if (res) {
this.timeZoneData = res;
}
});
}
//this function is user for edit
GetSlotId() {
this.routes.queryParams.subscribe((d) => {
if (d['id']) {
this.slot_id = d['id'];
this.ApiServ.Get('/ActivitySlot/GetSlot/' + d['id']).subscribe(
(data) => {
if (data) {
this.AllSetvalue(data['responseObject']);
}
}
);
}
});
}
AllSetvalue(val) {
Object.keys(val).forEach((li) => {
if (li == 'cut_off_time' || li == 'start_time' || li == 'end_time') {
let date = val[li].split('T');
let st = moment().utc().format('MM-DD-YYYY ' + date[1]);
let date1 = new Date(st);
this.SaveAddSlot.get(li).setValue(date1);
}
if (li == 'timezone') {
this.SaveAddSlot.get(li).setValue(val[li]);
}
});
}
Save() {
if (this.SaveAddSlot.status == 'INVALID') {
console.log(this.SaveAddSlot.get('start_time'));
this.validationService.showValidationsMsg(this.SaveAddSlot);
console.log(this.SaveAddSlot);
return;
}
let val = this.SaveAddSlot.getRawValue();
var now = new Date(val.start_time);
var d = new Date(val.end_time);
if (now.getTime() == d.getTime() || now.getTime() >= d.getTime()) {
this.SaveAddSlot.get('start_time_Check').setValue(true);
this.SaveAddSlot.get('end_time_Check').setValue(true);
return
}
let postdata = new ActivitySlot();
postdata.activity_id = CommonService.getSessionStoage('activity_id');
postdata.start_time =
'0001-01-01' + 'T' + moment(val.start_time).format('HH:mm:01');
postdata.end_time =
'0001-01-01' + 'T' + moment(val.end_time).format('HH:mm:01');
postdata.cut_off_time =
'0001-01-01' + 'T' + moment(val.cut_off_time).format('HH:mm:01');
postdata.timezone = val.timezone;
postdata.is_deleted = false;
postdata.activity_slot_id = this.slot_id ? this.slot_id : '';
postdata.org_id = '';
postdata.supplier_id = '';
if (this.slot_id) {
this.ApiServ.Post('/ActivitySlot/UpdateActivitySlot', postdata).subscribe(
(res) => {
if (res) {
console.log(res);
this.MsgService.add({
severity: res['status'] ? 'success' : 'error',
detail: res['message'],
});
setTimeout(() => {
this.router.navigate([
'/Services/ActivityServices/ExpServices/Manage',
]);
}, 500);
}
}
);
} else {
this.ApiServ.Post('/ActivitySlot/SaveActivitySlot', postdata).subscribe(
(res) => {
if (res) {
console.log(res);
this.MsgService.add({
severity: res['status'] ? 'success' : 'error',
detail: res['message'],
});
setTimeout(() => {
this.router.navigate([
'/Services/ActivityServices/ExpServices/Manage',
]);
}, 500);
}
}
);
}
}
//
Check() {
let val = this.SaveAddSlot.getRawValue();
var now = new Date(val.start_time);
var d = new Date(val.end_time);
if (now.getTime() == d.getTime() || now.getTime() >= d.getTime()) {
this.SaveAddSlot.get('start_time_Check').setValue(true);
this.SaveAddSlot.get('end_time_Check').setValue(true);
} else {
this.SaveAddSlot.get('start_time_Check').setValue(false);
this.SaveAddSlot.get('end_time_Check').setValue(false);
}
}
}

View File

@@ -1,163 +0,0 @@
<div class="app-mainHeader mt-20">
Search Slots
<button pButton type="button" label="Add Slots" class="btn-primary"
[routerLink]="['/Services/ActivityServices/ExpServices/Manage/AddSlots']"></button>
</div>
<div class="app-mainCard">
<div class="app-mainGrid4">
<div class="">
<label class="formLabel">Slot Start Time</label>
<div class="mobiGrid app-mainGrid3">
<div class="w-33">
<ng-select [(ngModel)]="StartTime" [multiple]="false" [multiple]="false" placeholder="Select">
<ng-option *ngFor="let item of CommonVari.HoursAndMinutes" [value]="item.hour+':'+item.minute">
{{ item.hour }} : {{item.minute}}</ng-option>
</ng-select>
</div>
</div>
</div>
<div class="">
<label class="formLabel">Slot End Time</label>
<div class="mobiGrid app-mainGrid3">
<div class="w-33">
<ng-select [(ngModel)]="EndTime" [multiple]="false" [multiple]="false" placeholder="Select">
<ng-option *ngFor="let item of CommonVari.HoursAndMinutes" [value]="item.hour+':'+item.minute">
{{item.hour}} : {{item.minute}}</ng-option>
</ng-select>
</div>
</div>
</div>
</div>
<div class="mt-20">
<button pButton type="button" label="Reset" (click)="reset()" class="btn-secondary btn mr-10"></button>
<button pButton type="button" label="Search" (click)="GetAllSlot()" class="btn-primary btn"></button>
</div>
</div>
<div class="app-mainCard">
<div class="">
<!-- <div class="app-mainCard"> -->
<p-table #dtseason [value]="AllSlots" [rows]="25" responsiveLayout="scroll" styleClass="p-datatable-gridlines"
[paginator]="true" [columns]="cols" [globalFilterFields]="[
'activity_slot_id',
'start_time',
'end_time',
'cut_off_time',
'is_active'
]" [rowHover]="true" dataKey="id" currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
[showCurrentPageReport]="true">
<ng-template pTemplate="caption">
<p-toolbar>
<ng-template pTemplate="left">
<button type="button" pButton class="btn-secondary mr-10" pTooltip="Copy" label="Copy"
tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="CSV" label="CSV"
tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="XLS" label="Excel"
tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary mr-10" pTooltip="PDF" label="PDF"
tooltipPosition="bottom"></button>
<button type="button" pButton class="btn-secondary" pTooltip="Print" label="Print"
tooltipPosition="bottom"></button>
</ng-template>
<ng-template pTemplate="right">
<div class="p-d-flex p-ai-center">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<input pInputText type="search" #searchInp (input)="dtseason.filterGlobal(searchInp.value, 'contains')"
placeholder="Search..." />
</span>
</div>
</ng-template>
</p-toolbar>
</ng-template>
<ng-template pTemplate="header">
<tr>
<th pSortableColumn="activity_slot_id">
Slot Id
<p-sortIcon field="activity_slot_id" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="start_time">
Slot Start Time
<p-sortIcon field="start_time" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="end_time">
Slot End Time
<p-sortIcon field="end_time" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="cut_off_time">
Cut-Off Time (in Hrs)
<p-sortIcon field="cut_off_time" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="is_active">
Status
<p-sortIcon field="is_active" class="p-sort-icon"></p-sortIcon>
</th>
<th pSortableColumn="rating">
Action
<p-sortIcon field="rating" class="p-sort-icon"></p-sortIcon>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-AllSlots>
<tr>
<td>{{ AllSlots.activity_slot_id }}</td>
<td>
<span class="d-block">{{
AllSlots.start_time | date: "H:mm"
}}</span>
</td>
<td>
<span class="product-badge">{{
AllSlots.end_time | date: "H:mm"
}}</span>
</td>
<td>
<span class="product-badge">{{
AllSlots.cut_off_time | date: "H:mm"
}}</span>
</td>
<td>
<span class="booking-history-status" [ngClass]="{
'booking-history-status-success': AllSlots.is_active,
'booking-history-status-fail': AllSlots.is_active == false
}">
{{ AllSlots.is_active ? "Active" : "Deactive" }}</span>
</td>
<td>
<div class="actionButton">
<button mat-icon-button [matMenuTriggerFor]="menu">
<span class="material-icons"> more_horiz </span>
</button>
<mat-menu #menu="matMenu">
<button (click)="Edit(AllSlots.activity_slot_id)" mat-menu-item>
<span class="flex-center">
<span class="mr-10 f-20 material-icons"> edit </span>
<span> Edit </span>
</span>
</button>
<button (click)="UpdateStatus(AllSlots.activity_slot_id, AllSlots.is_active)" mat-menu-item>
<span class="flex-center">
<span class="mr-10 f-20 material-icons">
check_circle
</span>
<span>{{
AllSlots.is_active ? "Deactive" : "Activate"
}}</span>
</span>
</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
<ng-template pTemplate="emptymessage">
<tr *ngIf="AllSlots === null || AllSlots" class="ResultNotFound">
<td>
No data found
</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
<p-toast></p-toast>

Some files were not shown because too many files have changed in this diff Show More