How to use saveRequest method in root

Best JavaScript code snippet using root

outdrivermotify.component.ts

Source:outdrivermotify.component.ts Github

copy

Full Screen

1import {Component, Input, OnInit} from '@angular/core';2import {OutTruckTransportationpoolRequestModel} from '../../../../models/Transportationpool/out-truck-transportationpool-request-model';3import {FormBuilder, FormGroup, Validators} from '@angular/forms';4import {VehicleContainerModel} from '../../../../models/vehiclemanagement/container-model';5import {Router} from '@angular/router';6import {EmitService} from '../../../../help/emit-service';7import {OutTruckTransportationpoolService} from '../../../../services/Transportationpool/out-truck-transportationpool.service';8import {VehicleContainerService} from '../../../../services/vehiclemanagement/vehicle-container.service';9import {Formextension} from '../../../../help/formextension';10import {AlertMessageType, EmitAlertMessage, MessageShowType} from '../../../../help/emit-alert-message';11import {TmsresponseStatusCode} from '../../../../models/tms-response.module';12import {StorageService} from '../../../../services/storage.service';13@Component({14 selector: 'app-biz-outdrivermotify',15 templateUrl: './outdrivermotify.component.html',16 styleUrls: ['./outdrivermotify.component.css']17})18export class OutdrivermotifyComponent implements OnInit {19 @Input('flag')20 Operate: number;21 saverequest: OutTruckTransportationpoolRequestModel;22 public saveform: FormGroup;23 public height = '250px';24 public fields: Object = { text: 'Name', value: 'Id' };25 public vehicleContainerData: VehicleContainerModel[];26 public btnmessage: string;27 constructor(28 private storageService: StorageService,29 private router: Router,30 private emitService: EmitService,31 private _services: OutTruckTransportationpoolService,32 private vehicleContainerService: VehicleContainerService,33 private fb: FormBuilder) { }34 ngOnInit() {35 if (this.Operate === 1) {36 this.btnmessage = '保存外租车吗';37 this.saverequest = new OutTruckTransportationpoolRequestModel();38 this.saverequest. RType = '外部车辆';39 this.saverequest. Enabel = true;40 this.saverequest. Weight = 0;41 this.saverequest. Volume = 0;42 this.saverequest.AllowAddHandlerFee = true;43 } else {44 this.btnmessage = '确认修改外租车数据吗';45 this.saverequest = <OutTruckTransportationpoolRequestModel> this.storageService.retrieve('outdriver');46 if (this.saverequest === undefined) {47 alert('数据错误');48 }49 }50 this.saveform = this.fb.group({51 ResourceId: this.saverequest.ResourceId,52 RName: [this.saverequest.RName, Validators.required],53 RType: this.saverequest.RType,54 Enabel: this.saverequest.Enabel,55 Mark: this.saverequest.Mark,56 Trnum: [this.saverequest.Trnum, Validators.required],57 Gpstype: this.saverequest.Gpstype,58 Gpsno: this.saverequest.Gpsno,59 Trtype: [this.saverequest.Trtype, Validators.required],60 Weight: this.saverequest.Weight,61 Volume: this.saverequest.Volume,62 Length: this.saverequest.Length,63 Width: this.saverequest.Width,64 Height: this.saverequest.Height,65 Drtel: [this.saverequest.Drtel, Validators.required],66 Dridnum: this.saverequest.Dridnum,67 Drlicensenum: this.saverequest.Drlicensenum,68 Draddr: this.saverequest.Draddr,69 AllowAddHandlerFee: this.saverequest.AllowAddHandlerFee70 });71 this.vehicleContainerService.Search({72 pageindex: 1,73 pagesize: 100,74 Name: ''}).subscribe(result => {75 this.vehicleContainerData = result.QueryResult;76 });77 }78 save($event: boolean) {79 if ($event === false) {80 return;81 }82 console.log(this.saveform.valid);83 if (this.saveform.valid === false) {84 Formextension.validateAllFormFields(this.saveform);85 // console.log('验证未通过');86 // console.log(CarrierValidatoinMessage);87 // Formextension.getFormValidationErrorsAndEmit(this.saveform, CarrierValidatoinMessage, this.emitService);88 return;89 } else {90 this. saverequest = <OutTruckTransportationpoolRequestModel> this.saveform.getRawValue();91 console.log( this. saverequest);92 const vc = this.vehicleContainerData.find(t => t.Id === parseInt(this.saverequest.Trtype) );93 if (vc === undefined) {94 alert('车型错误');95 }96 console.log(vc);97 this.saverequest.Trtype = vc.Name;98 this.saverequest.Weight = vc.Weightcapacity;99 this. saverequest. Volume = vc.Volumecapacity;100 this. saverequest. Length = vc.TypeLegth;101 this. saverequest. Width = vc.TypeWidth;102 this.saverequest.Height = vc.TypeHeight;103 if (this.Operate === 1) {104 this._services.Insert(this.saverequest).subscribe(a => {105 this.emitService.eventEmit.emit(106 new EmitAlertMessage(AlertMessageType.Info,107 '系统信息', a.Info, MessageShowType.Toast));108 if ( a.StatusCode === TmsresponseStatusCode.Succeed() ) {109 this.router.navigate(['biz/vehicle-management/ourdriver-detail', a.Data]);110 // biz/customer-management/edit/BC100004000005111 }112 });113 } else {114 this._services.Update(this.saverequest).subscribe(a => {115 this.emitService.eventEmit.emit(116 new EmitAlertMessage(AlertMessageType.Info,117 '系统信息', a.Info, MessageShowType.Toast));118 if ( a.StatusCode === TmsresponseStatusCode.Succeed() ) {119 this.router.navigate(['biz/vehicle-management/ourdriver-detail', this.saverequest.ResourceId]);120 // this.router.navigate(['biz/carriers-management/carriers-detail', a.Data]);121 // biz/customer-management/edit/BC100004000005122 }123 });124 }125 }126 }...

Full Screen

Full Screen

reducer.js

Source:reducer.js Github

copy

Full Screen

1/*2 * AppReducer3 *4 * The reducer takes care of our data. Using actions, we can change our5 * application state.6 * To add a new action, add it to the switch statement in the reducer function7 *8 * Example:9 * case YOUR_ACTION_CONSTANT:10 * return state.set('yourStateVariable', true);11 */12import { fromJS } from 'immutable';13import {14 CREATE_OTFORMS,15 SUCCESS_OTFORMS,16 ERROR_OTFORMS,17 DISMISS_OTFORMS,18 RETRIEVE_OTFORMS,19 RETRIEVE_OTFORMSUCCESS,20 RESET_STATE,21} from './constants';22// The initial state of the App23const initialState = fromJS({24 otforms: {25 saveRequest: {26 loading: false,27 error: false,28 data: false,29 startDate: false,30 endDate: false,31 OTMinutes: false,32 Remarks: false,33 successCode: false,34 successMessage: false,35 errorCode: false,36 errorMessage: false,37 },38 otlists: {39 loading: false,40 error: false,41 ObjectList: false,42 },43 },44});45function appReducer(state = initialState, action) {46 switch (action.type) {47 case CREATE_OTFORMS:48 return state49 .setIn(['otforms', 'saveRequest', 'loading'], true)50 .setIn(['otforms', 'saveRequest', 'error'], false)51 .setIn(['otforms', 'saveRequest', 'data'], action.data);52 // .setIn(['otforms', 'saveRequest', 'startDate'], action.startdate)53 // .setIn(['otforms', 'saveRequest', 'endDate'], action.enddate)54 // .setIn(['otforms', 'saveRequest', 'OTMinutes'], action.otminutes)55 // .setIn(['otforms', 'saveRequest', 'Remarks'], action.remarks)56 // .setIn(['otforms', 'saveRequest', 'successMessage'], false);57 case RETRIEVE_OTFORMS:58 return state59 .setIn(['otforms', 'otlists', 'loading'], true)60 .setIn(['otforms', 'otlists', 'error'], false)61 .setIn(['otforms', 'otlists', 'ObjectList'], false)62 .setIn(['otforms', 'saveRequest', 'startDate'], action.startdate);63 case RETRIEVE_OTFORMSUCCESS:64 return state65 .setIn(['otforms', 'otlists', 'loading'], true)66 .setIn(['otforms', 'otlists', 'ObjectList'], action.data);67 case SUCCESS_OTFORMS:68 return state69 .setIn(['otforms', 'saveRequest', 'loading'], false)70 .setIn(['otforms', 'saveRequest', 'successCode'], action.successcode)71 .setIn(['otforms', 'saveRequest', 'successMessage'], action.succesmsg);72 case ERROR_OTFORMS:73 return state74 .setIn(['otforms', 'saveRequest', 'loading'], false)75 .setIn(['otforms', 'saveRequest', 'error'], action.error)76 .setIn(['otforms', 'saveRequest', 'errorCode'], action.errorcode)77 .setIn(['otforms', 'saveRequest', 'errorMessage'], action.errormsg);78 case DISMISS_OTFORMS:79 return state80 .setIn(['otforms', 'saveRequest', 'OTMinutes'], false)81 .setIn(['otforms', 'saveRequest', 'Remarks'], false)82 .setIn(['otforms', 'saveRequest', 'startDate'], false)83 .setIn(['otforms', 'saveRequest', 'endDate'], false)84 .setIn(['otforms', 'saveRequest', 'successCode'], false)85 .setIn(['otforms', 'saveRequest', 'successMessage'], false)86 .setIn(['otforms', 'saveRequest', 'errorCode'], false)87 .setIn(['otforms', 'saveRequest', 'errorMessage'], false);88 case RESET_STATE:89 return initialState;90 default:91 return state;92 }93}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1root.saveRequest("test", "test");2root.saveRequest("test2", "test2");3root.saveRequest("test3", "test3");4root.saveRequest("test4", "test4");5root.saveRequest("test5", "test5");6root.saveRequest("test6", "test6");7root.saveRequest("test7", "test7");8root.saveRequest("test8", "test8");9root.saveRequest("test9", "test9");10root.saveRequest("test10", "test10");11root.saveRequest("test11", "test11");12root.saveRequest("test12", "test12");13root.saveRequest("test13", "test13");14root.saveRequest("test14", "test14");15root.saveRequest("test15", "test15");16root.saveRequest("test16", "test16");17root.saveRequest("test17", "test17");18root.saveRequest("test18

Full Screen

Using AI Code Generation

copy

Full Screen

1$rootScope.saveRequest = function(request) {2 $rootScope.request = request;3 $rootScope.requestSaved = true;4};5$rootScope.saveResponse = function(response) {6 $rootScope.response = response;7 $rootScope.responseSaved = true;8};9$rootScope.getRequest = function() {10 if ($rootScope.requestSaved) {11 return $rootScope.request;12 }13};14$rootScope.getResponse = function() {15 if ($rootScope.responseSaved) {16 return $rootScope.response;17 }18};19$rootScope.clearRequest = function() {20 $rootScope.request = {};21 $rootScope.requestSaved = false;22};23$rootScope.clearResponse = function() {24 $rootScope.response = {};25 $rootScope.responseSaved = false;26};27$rootScope.clearAll = function() {28 $rootScope.clearRequest();29 $rootScope.clearResponse();30};31$rootScope.isRequestSaved = function() {32 return $rootScope.requestSaved;33};34$rootScope.isResponseSaved = function() {35 return $rootScope.responseSaved;36};37$rootScope.isRequestSaved = function() {38 return $rootScope.requestSaved;39};40$rootScope.isResponseSaved = function() {41 return $rootScope.responseSaved;42};43$rootScope.isResponseSaved = function() {44 return $rootScope.responseSaved;45};46$rootScope.isRequestSaved = function() {47 return $rootScope.requestSaved;48};49$rootScope.isResponseSaved = function() {50 return $rootScope.responseSaved;51};52$rootScope.isRequestSaved = function() {53 return $rootScope.requestSaved;54};55$rootScope.isResponseSaved = function() {56 return $rootScope.responseSaved;57};

Full Screen

Using AI Code Generation

copy

Full Screen

1$scope.saveRequest = function() {2 $rootScope.saveRequest();3};4$rootScope.saveRequest = function() {5 var request = {};6 request.url = $location.url();7 request.params = $location.search();8 $cookies.putObject('request', request);9};10$rootScope.saveRequest = function() {11 var request = {};12 request.url = $location.url();13 request.params = $location.search();14 $cookies.putObject('request', request);15};16$rootScope.saveRequest = function() {17 var request = {};18 request.url = $location.url();19 request.params = $location.search();20 $cookies.putObject('request', request);21};22$rootScope.saveRequest = function() {23 var request = {};24 request.url = $location.url();25 request.params = $location.search();26 $cookies.putObject('request', request);27};28$rootScope.saveRequest = function() {29 var request = {};30 request.url = $location.url();31 request.params = $location.search();32 $cookies.putObject('request', request);33};34$rootScope.saveRequest = function() {35 var request = {};36 request.url = $location.url();37 request.params = $location.search();38 $cookies.putObject('request', request);39};

Full Screen

Using AI Code Generation

copy

Full Screen

1var rootController = require('./rootController.js');2rootController.saveRequest(req, res);3var saveRequest = function(req, res) {4}5module.exports.saveRequest = saveRequest;6var rootController = require('./rootController.js');7rootController.saveRequest(req, res);8var saveRequest = function(req, res) {9}10module.exports.saveRequest = saveRequest;

Full Screen

Using AI Code Generation

copy

Full Screen

1root.saveRequest("test", "test", "test", "test");2root.getRequest("test");3var request = root.getRequest("test");4request.method = "GET";5request.body = "test";6request.headers = "test";7var response = request.execute();8response.body;

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = context.getGlobalObject();2root.saveRequest("request.txt", request);3var root = context.getGlobalObject();4root.saveResponse("response.txt", response);5var root = context.getGlobalObject();6root.saveRequestResponse("requestResponse.txt", request, response);7var root = context.getGlobalObject();8root.saveRequestResponse("requestResponse.txt", request, response);9var root = context.getGlobalObject();10root.saveRequestResponse("requestResponse.txt", request, response);11var root = context.getGlobalObject();12root.saveRequestResponse("requestResponse.txt", request, response);13var root = context.getGlobalObject();14root.saveRequestResponse("requestResponse.txt", request, response);15var root = context.getGlobalObject();16root.saveRequestResponse("requestResponse.txt", request, response);17var root = context.getGlobalObject();18root.saveRequestResponse("requestResponse.txt", request, response);19var root = context.getGlobalObject();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful