(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["attachment-lists-attachment-lists-module"],{

/***/ "+T0H":
/*!***************************************************************************************************!*\
  !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/attachment-lists/attachment-lists.page.html ***!
  \***************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("<ion-header>\n\t<ion-toolbar>\n\t\t<ion-buttons slot=\"start\" class=\"on-search-hide\">\n\t\t\t<ion-back-button text=\"\" icon=\"chevron-back-sharp\"></ion-back-button>\n\t\t</ion-buttons>\n\t\t<ion-title>\n\t\t\t<span class=\"d-flex\">\n\t\t\t\t{{ type }} Attachment Lists \n\t\t\t</span>\n\t\t</ion-title>\n\t</ion-toolbar>\n\n</ion-header>\n<ion-content fullscreen>\n\t<ion-refresher slot=\"fixed\" (ionRefresh)=\"doRefresh($event)\">\n\t\t<ion-refresher-content></ion-refresher-content>\n\t</ion-refresher>\n<div class=\"container\">\n\t<ion-list *ngIf=\"lists.length === 0\">\n\t\t<ion-grid>\n\t\t\t<ion-row>\n\t\t\t\t<ion-col>\n\t\t\t\t\t<ion-note>{{msg}}</ion-note>\n\t\t\t\t</ion-col>\n\t\t\t</ion-row>\n\t\t</ion-grid>\n\t</ion-list>\n  <ion-list *ngIf=\"lists.length > 0\">\n\t<ion-list-header class=\"top-border title\">\n\t\t<ion-item lines=\"none\">\n\t\t\t<ion-label>Doc Type</ion-label>\n\t\t\t<ion-label>Filename</ion-label>\n\t\t</ion-item>\n\t</ion-list-header>\n\t<div >\n\t\t<ion-list-header class=\"top-border\" *ngFor=\"let list of lists\">\n\t\t\t<ion-item lines=\"none\">\n\t\t\t\t<ion-label>{{ list.doc_type }}</ion-label>\n\t\t\t\t<ion-label>{{ list.diplay_name }}\n\t\t\t\t</ion-label>\n\t\t\t\t<ion-icon name=\"download-outline\" *ngIf=\"list.diplay_name !== 'NA'\" (click)=\"downloadAttachment(list)\" ></ion-icon>\n\t\t\t</ion-item>\n\t\t</ion-list-header>\n\t</div>\n  </ion-list>\n</div>\n</ion-content>\n");

/***/ }),

/***/ "4H+C":
/*!***********************************************************!*\
  !*** ./src/app/attachment-lists/attachment-lists.page.ts ***!
  \***********************************************************/
/*! exports provided: AttachmentListsPage */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttachmentListsPage", function() { return AttachmentListsPage; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "mrSG");
/* harmony import */ var _raw_loader_attachment_lists_page_html__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! raw-loader!./attachment-lists.page.html */ "+T0H");
/* harmony import */ var _attachment_lists_page_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./attachment-lists.page.scss */ "maay");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/core */ "fXoL");
/* harmony import */ var src_services_service_request_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/services/service-request.service */ "YPdO");
/* harmony import */ var src_services_common_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/services/common.service */ "FBGF");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/router */ "tyNb");
/* harmony import */ var src_services_vehicle_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/services/vehicle.service */ "lMcH");
/* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/common/http */ "tk/3");
/* harmony import */ var _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @capacitor/filesystem */ "F7bV");
/* harmony import */ var _capacitor_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @capacitor/core */ "FUe0");
/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! file-saver */ "Iab2");
/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_11__);












let AttachmentListsPage = class AttachmentListsPage {
    constructor(serviceReq, vehicleService, commonService, route) {
        this.serviceReq = serviceReq;
        this.vehicleService = vehicleService;
        this.commonService = commonService;
        this.route = route;
        this.fileName = 'attachment-lists.page.ts';
        this.lists = [];
    }
    ngOnInit() {
        try {
            let data = JSON.parse(this.route.getCurrentNavigation().extras.queryParams.data);
            let id = data.id;
            this.vrnTicketId = data.id;
            if (data.op === 'tickets') {
                this.type = 'Tickets';
                this.serviceReq.attachment(id).subscribe((res) => Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () {
                    if (res.status) {
                        this.lists = res.data;
                        this.msg = (this.lists.length == 0) ? 'No Attachment available' : '';
                        this.lists.forEach((element, index) => {
                            let tmpFn = (element.file_name).split('/');
                            this.lists[index].diplay_name = tmpFn[tmpFn.length - 1];
                        });
                    }
                }));
            }
            if (data.op === 'vehicles') {
                this.type = 'Vehicles';
                this.vehicleService.attachment(id).subscribe((res) => Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () {
                    this.lists = [];
                    if (res.status) {
                        let tmpLists = [];
                        tmpLists = res.data;
                        for (const property in tmpLists) {
                            let tmpFn = (tmpLists[property]).split('/');
                            this.lists.push({
                                doc_type: property,
                                diplay_name: tmpFn[tmpFn.length - 1],
                                file_name: tmpLists[property]
                            });
                        }
                    }
                }));
            }
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'ngOnInit()',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    doRefresh(event) {
        try {
            setTimeout(() => {
                this.ngOnInit();
                event.target.complete();
            }, 2000);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'doRefresh()',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    downloadAttachment(list) {
        return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () {
            try {
                if (this.type === 'Vehicles') {
                    var obj = {
                        vrn: this.vrnTicketId,
                        docType: list.doc_type
                    };
                    yield this.commonService.showLoader();
                    this.vehicleService.downloadAttachment(obj).subscribe((res) => Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__awaiter"])(this, void 0, void 0, function* () {
                        if (res.type === _angular_common_http__WEBPACK_IMPORTED_MODULE_8__["HttpEventType"].DownloadProgress) {
                            //this.commonService.log(Math.round((100 * res2.loaded) / res2.total));
                        }
                        else if (res.type === _angular_common_http__WEBPACK_IMPORTED_MODULE_8__["HttpEventType"].Response) {
                            const base64 = yield this.commonService.convertBlobToBase64(res.body);
                            this.commonService.log({
                                base64Obj: base64,
                                path: res.data,
                                directory: _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_9__["Directory"].Documents
                            });
                            if (_capacitor_core__WEBPACK_IMPORTED_MODULE_10__["Capacitor"].getPlatform() === 'web') {
                                Object(file_saver__WEBPACK_IMPORTED_MODULE_11__["saveAs"])(base64, list.diplay_name);
                                yield this.commonService.hideLoader();
                            }
                            else {
                                const savedFile = yield _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_9__["Filesystem"].writeFile({
                                    path: list.diplay_name,
                                    data: base64,
                                    directory: _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_9__["Directory"].Documents
                                });
                                const filePath = _capacitor_core__WEBPACK_IMPORTED_MODULE_10__["Capacitor"].convertFileSrc(savedFile.uri);
                                yield this.commonService.hideLoader();
                                let fileObj = {
                                    base64: base64,
                                    filePath: savedFile.uri
                                };
                                this.commonService.openFile(fileObj);
                            }
                        }
                    }));
                }
            }
            catch (error) {
                let obj = {
                    fileName: this.fileName,
                    functionName: 'downloadAttachment()',
                    error: error
                };
                this.commonService.systemException(obj);
            }
        });
    }
};
AttachmentListsPage.ctorParameters = () => [
    { type: src_services_service_request_service__WEBPACK_IMPORTED_MODULE_4__["ServiceRequestService"] },
    { type: src_services_vehicle_service__WEBPACK_IMPORTED_MODULE_7__["VehicleService"] },
    { type: src_services_common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"] },
    { type: _angular_router__WEBPACK_IMPORTED_MODULE_6__["Router"] }
];
AttachmentListsPage = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_3__["Component"])({
        selector: 'app-attachment-lists',
        template: _raw_loader_attachment_lists_page_html__WEBPACK_IMPORTED_MODULE_1__["default"],
        styles: [_attachment_lists_page_scss__WEBPACK_IMPORTED_MODULE_2__["default"]]
    }),
    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [src_services_service_request_service__WEBPACK_IMPORTED_MODULE_4__["ServiceRequestService"],
        src_services_vehicle_service__WEBPACK_IMPORTED_MODULE_7__["VehicleService"],
        src_services_common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"],
        _angular_router__WEBPACK_IMPORTED_MODULE_6__["Router"]])
], AttachmentListsPage);



/***/ }),

/***/ "Rs0Z":
/*!*********************************************************************!*\
  !*** ./src/app/attachment-lists/attachment-lists-routing.module.ts ***!
  \*********************************************************************/
/*! exports provided: AttachmentListsPageRoutingModule */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttachmentListsPageRoutingModule", function() { return AttachmentListsPageRoutingModule; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "mrSG");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "fXoL");
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/router */ "tyNb");
/* harmony import */ var _attachment_lists_page__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./attachment-lists.page */ "4H+C");




const routes = [
    {
        path: '',
        component: _attachment_lists_page__WEBPACK_IMPORTED_MODULE_3__["AttachmentListsPage"]
    }
];
let AttachmentListsPageRoutingModule = class AttachmentListsPageRoutingModule {
};
AttachmentListsPageRoutingModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
        imports: [_angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterModule"].forChild(routes)],
        exports: [_angular_router__WEBPACK_IMPORTED_MODULE_2__["RouterModule"]],
    })
], AttachmentListsPageRoutingModule);



/***/ }),

/***/ "VNqq":
/*!*************************************************************!*\
  !*** ./src/app/attachment-lists/attachment-lists.module.ts ***!
  \*************************************************************/
/*! exports provided: AttachmentListsPageModule */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttachmentListsPageModule", function() { return AttachmentListsPageModule; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "mrSG");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "fXoL");
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/common */ "ofXK");
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/forms */ "3Pt+");
/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ionic/angular */ "TEn/");
/* harmony import */ var _attachment_lists_routing_module__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attachment-lists-routing.module */ "Rs0Z");
/* harmony import */ var _attachment_lists_page__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./attachment-lists.page */ "4H+C");







let AttachmentListsPageModule = class AttachmentListsPageModule {
};
AttachmentListsPageModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
        imports: [
            _angular_common__WEBPACK_IMPORTED_MODULE_2__["CommonModule"],
            _angular_forms__WEBPACK_IMPORTED_MODULE_3__["FormsModule"],
            _ionic_angular__WEBPACK_IMPORTED_MODULE_4__["IonicModule"],
            _attachment_lists_routing_module__WEBPACK_IMPORTED_MODULE_5__["AttachmentListsPageRoutingModule"]
        ],
        declarations: [_attachment_lists_page__WEBPACK_IMPORTED_MODULE_6__["AttachmentListsPage"]]
    })
], AttachmentListsPageModule);



/***/ }),

/***/ "YPdO":
/*!*************************************************!*\
  !*** ./src/services/service-request.service.ts ***!
  \*************************************************/
/*! exports provided: ServiceRequestService */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ServiceRequestService", function() { return ServiceRequestService; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "mrSG");
/* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common/http */ "tk/3");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "fXoL");
/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "kU1M");
/* harmony import */ var _base_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./base-service */ "4YT6");
/* harmony import */ var _common_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./common.service */ "FBGF");
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "k8oS");







let ServiceRequestService = class ServiceRequestService extends _base_service__WEBPACK_IMPORTED_MODULE_4__["BaseService"] {
    constructor(_httpClient, _commonService) {
        super();
        this._httpClient = _httpClient;
        this._commonService = _commonService;
        this.fileName = 'service-request.service.ts';
    }
    getAllServiceRequestCategories(data) {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].SERVICE_REQUEST_API,
                local_json_file: 'local-service-request-topics',
                param_data: {},
                mapcol: false
            };
            return this._commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'getAllServiceRequestCategories(data)',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    getAllServiceRequestTickets(obj) {
        try {
            /*var today = new Date();
            var monthStart = this.getLastThreeMonthDate();
            var monthEnd = today.toISOString().substr(0, 10);*/
            let dataObj = {
                offset: obj.offset,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].SERVICE_REQUEST_TICKETS_API,
                local_json_file: 'local-service-request-list',
                param_data: {
                    "name": "tickets",
                    "row_count": _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ROW_COUNT,
                    "row_offset": obj.offset,
                    "sorting": {
                        "id": "desc"
                    },
                    "filterparams": {
                        "created_on": [obj.startDate + "T00:01Z", obj.endDate + "T23:59Z"]
                    },
                    mapcol: true
                }
            };
            return this._commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'getAllServiceRequestTickets(obj)',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    addTicket(obj) {
        try {
            let data = {
                "categoryId": obj.categoryId,
                "userId": this.getLocalUserId(),
                "remarks": obj.remarks,
                "properties": obj.properties
            };
            let url = this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ADD_TICKET_API;
            return this._httpClient.post(url, data).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(resp => {
                return resp;
            }));
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'addTicket(obj)',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    closeTicket(obj) {
        try {
            let data = {
                "id": obj.id,
                "adminRemark": obj.adminRemark
            };
            let url = this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].CLOSE_TICKET_API;
            return this._httpClient.post(url, data).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(resp => {
                return resp;
            }));
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'closeTicket(obj)',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    getDBTicketStatus() {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].TICKET_STATUS_CNT_API,
                local_json_file: 'local-ticket-status-count',
                param_data: {},
                mapcol: false
            };
            return this._commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'getDBTicketStatus()',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    getDocList() {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].TICKET_DOC_TYPE_API,
                local_json_file: '',
                param_data: {},
                mapcol: false
            };
            return this._commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'getDocList()',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    uploadTiketDoc(obj) {
        try {
            const formData = new FormData();
            formData.append('file', obj.file);
            let dataObj = {
                offset: 0,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].TICKET_DOC_UPLOAD_API + obj.id + '/' + obj.docKey,
                local_json_file: '',
                param_data: {
                    file: formData
                },
                mapcol: false
            };
            return this._commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'uploadTiketDoc(obj)',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
    attachment(id) {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                //api_url: this.getLocalapiBaseURL() + Enums.CONSTANTS.ATTACHMENT_LISTS_API,
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].TICKET_ATTACHMENT_LISTS_API + id,
                local_json_file: '',
                data: {},
                mapcol: false
            };
            return this._commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'attachment()',
                error: error
            };
            this._commonService.systemException(obj);
        }
    }
};
ServiceRequestService.ctorParameters = () => [
    { type: _angular_common_http__WEBPACK_IMPORTED_MODULE_1__["HttpClient"] },
    { type: _common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"] }
];
ServiceRequestService = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])({
        providedIn: 'root'
    }),
    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_common_http__WEBPACK_IMPORTED_MODULE_1__["HttpClient"], _common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"]])
], ServiceRequestService);



/***/ }),

/***/ "lMcH":
/*!*****************************************!*\
  !*** ./src/services/vehicle.service.ts ***!
  \*****************************************/
/*! exports provided: VehicleService */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VehicleService", function() { return VehicleService; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "mrSG");
/* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common/http */ "tk/3");
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "fXoL");
/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "kU1M");
/* harmony import */ var _base_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./base-service */ "4YT6");
/* harmony import */ var _common_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./common.service */ "FBGF");
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./constants */ "k8oS");







let VehicleService = class VehicleService extends _base_service__WEBPACK_IMPORTED_MODULE_4__["BaseService"] {
    constructor(commonService, httpClient) {
        super();
        this.commonService = commonService;
        this.httpClient = httpClient;
        this.fileName = 'vehicle.service.ts';
        this.paramName = "customervehicle";
        this.columnArray = _constants__WEBPACK_IMPORTED_MODULE_6__["COLUMNS"];
    }
    getAllVehicle(offset) {
        try {
            let dataObj = {
                offset: offset,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_LISTING_API,
                local_json_file: 'local-vehicle-list',
                param_data: {
                    "name": this.paramName
                },
                mapcol: true
            };
            let res = this.commonService.fetchData(dataObj);
            res.subscribe((data) => {
                if (data.status)
                    localStorage.setItem("vehicleUpdateTime", this.commonService.getTimestamp());
            });
            return res;
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'getAllVehicle(offset)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    suspendVehicle(list) {
        try {
            let data = {};
            let url = this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_SUSPEND_API + (list === null || list === void 0 ? void 0 : list.tag_id);
            return this.httpClient.post(url, data).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(resp => {
                return resp;
            }));
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'suspendVehicle(list)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    generatePdf(obj) {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_GENERATE_CHALLAN_PDF_API + '/' + obj.key,
                local_json_file: '',
                mapcol: false
            };
            return this.commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'generatePdf(obj)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    downloadPdf(obj) {
        try {
            let filename = encodeURIComponent(obj.data).replace(/\./g, '%2E');
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_DOWNLOAD_CHALLAN_PDF_API + '/' + filename,
                local_json_file: '',
                mapcol: false
            };
            return this.httpClient.get(this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_DOWNLOAD_CHALLAN_PDF_API + '/' + filename + '/', {
                responseType: 'blob',
                reportProgress: true,
                observe: 'events'
            });
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'downloadPdf(obj)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    getVehicleDocList() {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_DOC_TYPE_API,
                local_json_file: '',
                param_data: {},
                mapcol: false
            };
            return this.commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'getVehicleDocList()',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    uploadVehicleDoc(obj) {
        try {
            const formData = new FormData();
            formData.append('file', obj.file);
            formData.append('customer_id', this.getLocalUserId());
            formData.append('vrn', obj.vrn);
            formData.append('doc_type', obj.docKey);
            let dataObj = {
                offset: 0,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_DOC_UPLOAD_API + obj.vrn + '/' + obj.docKey,
                local_json_file: '',
                param_data: {
                    file: formData
                },
                mapcol: false
            };
            return this.commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'uploadVehicleDoc(obj)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    addVehicle(obj) {
        try {
            let dataObj;
            dataObj = {
                offset: 0,
                method: 'post',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].ADD_VEHICLE_API,
                local_json_file: '',
                param_data: {
                    vehicle_num: obj.vehicle_num,
                    vehicle_commercial: obj.vehicle_commercial,
                    vehicle_class: obj.vehicle_class
                },
                mapcol: false
            };
            console.log({
                dataObj: dataObj
            });
            return this.commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'addvehicle(obj)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    attachment(id) {
        try {
            let dataObj = {
                offset: 0,
                method: 'get',
                //api_url: this.getLocalapiBaseURL() + Enums.CONSTANTS.ATTACHMENT_LISTS_API,
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_ATTACHMENT_LISTS_API + id,
                local_json_file: '',
                data: {},
                mapcol: false
            };
            return this.commonService.fetchData(dataObj);
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'attachment()',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
    downloadAttachment(obj) {
        try {
            //let filename = encodeURIComponent(obj.data).replace(/\./g, '%2E');
            let dataObj = {
                offset: 0,
                method: 'get',
                api_url: this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_DOC_DOWNLOAD_API + obj.vrn + '/' + obj.docType,
                local_json_file: '',
                mapcol: false
            };
            return this.httpClient.get(this.getLocalapiBaseURL() + _constants__WEBPACK_IMPORTED_MODULE_6__["CONSTANTS"].VEHICLE_DOC_DOWNLOAD_API + obj.vrn + '/' + obj.docType, {
                responseType: 'blob',
                reportProgress: true,
                observe: 'events'
            });
        }
        catch (error) {
            let obj = {
                fileName: this.fileName,
                functionName: 'downloadAttachment(obj)',
                error: error
            };
            this.commonService.systemException(obj);
        }
    }
};
VehicleService.ctorParameters = () => [
    { type: _common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"] },
    { type: _angular_common_http__WEBPACK_IMPORTED_MODULE_1__["HttpClient"] }
];
VehicleService = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
    Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])({
        providedIn: 'root'
    }),
    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_common_service__WEBPACK_IMPORTED_MODULE_5__["CommonService"],
        _angular_common_http__WEBPACK_IMPORTED_MODULE_1__["HttpClient"]])
], VehicleService);



/***/ }),

/***/ "maay":
/*!*************************************************************!*\
  !*** ./src/app/attachment-lists/attachment-lists.page.scss ***!
  \*************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("ion-header ion-toolbar ion-buttons ion-menu-button {\n  border-radius: 50%;\n  margin: 0 15px;\n  width: 42px;\n  height: 42px;\n}\n\n.container {\n  padding: 10px;\n}\n\n.container p.info-icon {\n  text-align: center;\n}\n\n.container .info-icon {\n  font-size: 250% !important;\n}\n\n.container ion-grid {\n  background: #e1e6ea;\n  color: var(--secondary);\n  padding: 10px;\n  border-radius: 10px 10px 0 0;\n  margin: 0px 0px 2px 0px;\n  border-top: 2px solid var(--secondary);\n}\n\n.container ion-grid ion-note {\n  color: var(--secondary);\n}\n\n.container ion-list-header {\n  font-size: var(--title_font_size);\n  color: var(--primary);\n}\n\n.container ion-list-header ion-icon {\n  margin: 0 15px 0 0;\n  color: var(--primary);\n}\n\n.container ion-item {\n  color: var(--secondary);\n  font-size: var(--title_font_size);\n  width: 95%;\n}\n\n.container ion-item ion-label {\n  font-size: var(--sub_title_font_size);\n}\n\n.container ion-note {\n  font-size: var(--text_font_size);\n  color: var(--primary);\n}\n\n.container .title {\n  border-radius: 10px;\n  background: var(--white);\n}\n\n.container .title ion-item {\n  --background: var(--white) !important;\n}\n\n.container .top-border {\n  border-top: 1px solid var(--secondary);\n}\n\nion-content {\n  --offset-bottom:0px !important;\n}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2F0dGFjaG1lbnQtbGlzdHMucGFnZS5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVFO0VBQ0Msa0JBQUE7RUFDQSxjQUFBO0VBQ0EsV0FBQTtFQUNBLFlBQUE7QUFESDs7QUFNQTtFQUVDLGFBQUE7QUFKRDs7QUFLQztFQUNDLGtCQUFBO0FBSEY7O0FBS0M7RUFDQywwQkFBQTtBQUhGOztBQUtDO0VBQ0MsbUJBQUE7RUFDQSx1QkFBQTtFQUNBLGFBQUE7RUFDQSw0QkFBQTtFQUNBLHVCQUFBO0VBQ0Esc0NBQUE7QUFIRjs7QUFJRTtFQUNDLHVCQUFBO0FBRkg7O0FBS0M7RUFNQyxpQ0FBQTtFQUNBLHFCQUFBO0FBUkY7O0FBRUU7RUFDQyxrQkFBQTtFQUNBLHFCQUFBO0FBQUg7O0FBTUM7RUFDQyx1QkFBQTtFQUNBLGlDQUFBO0VBQ0EsVUFBQTtBQUpGOztBQU1FO0VBQ0MscUNBQUE7QUFKSDs7QUFPQztFQUNDLGdDQUFBO0VBQ0EscUJBQUE7QUFMRjs7QUFPQztFQUNDLG1CQUFBO0VBQ0Esd0JBQUE7QUFMRjs7QUFNRTtFQUNDLHFDQUFBO0FBSkg7O0FBT0M7RUFDQyxzQ0FBQTtBQUxGOztBQVNBO0VBQ0MsOEJBQUE7QUFORCIsImZpbGUiOiJhdHRhY2htZW50LWxpc3RzLnBhZ2Uuc2NzcyIsInNvdXJjZXNDb250ZW50IjpbImlvbi1oZWFkZXIge1xuXHRpb24tdG9vbGJhciB7XG5cdFx0aW9uLWJ1dHRvbnMgaW9uLW1lbnUtYnV0dG9uIHtcblx0XHRcdGJvcmRlci1yYWRpdXM6IDUwJTtcblx0XHRcdG1hcmdpbjogMCAxNXB4O1xuXHRcdFx0d2lkdGg6IDQycHg7XG5cdFx0XHRoZWlnaHQ6IDQycHg7XG5cdFx0fVxuXHR9XG5cbn1cbi5jb250YWluZXIge1xuXHQvL2JhY2tncm91bmQ6IHZhcigtLXdoaXRlKTtcblx0cGFkZGluZzogMTBweDtcblx0cC5pbmZvLWljb257XG5cdFx0dGV4dC1hbGlnbjogY2VudGVyO1xuXHR9XG5cdC5pbmZvLWljb257XG5cdFx0Zm9udC1zaXplOiAyNTAlICFpbXBvcnRhbnQ7XG5cdH1cdFxuXHRpb24tZ3JpZHtcblx0XHRiYWNrZ3JvdW5kOiAjZTFlNmVhO1xuXHRcdGNvbG9yOiB2YXIoLS1zZWNvbmRhcnkpO1xuXHRcdHBhZGRpbmc6IDEwcHg7XG5cdFx0Ym9yZGVyLXJhZGl1czogMTBweCAxMHB4IDAgMDtcblx0XHRtYXJnaW46IDBweCAwcHggMnB4IDBweDtcblx0XHRib3JkZXItdG9wOiAycHggc29saWQgdmFyKC0tc2Vjb25kYXJ5KTtcblx0XHRpb24tbm90ZXtcblx0XHRcdGNvbG9yOnZhcigtLXNlY29uZGFyeSk7XG5cdFx0fVxuXHR9XG5cdGlvbi1saXN0LWhlYWRlcntcblx0XHRpb24taWNvbntcblx0XHRcdG1hcmdpbjogMCAxNXB4IDAgMDtcblx0XHRcdGNvbG9yOiB2YXIoLS1wcmltYXJ5KTtcblx0XHRcdFxuXHRcdH1cblx0XHRmb250LXNpemU6IHZhcigtLXRpdGxlX2ZvbnRfc2l6ZSk7XG5cdFx0Y29sb3I6IHZhcigtLXByaW1hcnkpO1xuXHR9XG5cdGlvbi1pdGVte1xuXHRcdGNvbG9yOnZhcigtLXNlY29uZGFyeSk7XG5cdFx0Zm9udC1zaXplOiB2YXIoLS10aXRsZV9mb250X3NpemUpO1xuXHRcdHdpZHRoOiA5NSU7XG5cdFx0XG5cdFx0aW9uLWxhYmVsIHtcblx0XHRcdGZvbnQtc2l6ZTogdmFyKC0tc3ViX3RpdGxlX2ZvbnRfc2l6ZSk7XG5cdFx0fVxuXHR9XG5cdGlvbi1ub3Rle1xuXHRcdGZvbnQtc2l6ZTogdmFyKC0tdGV4dF9mb250X3NpemUpO1xuXHRcdGNvbG9yOnZhcigtLXByaW1hcnkpO1xuXHR9XG5cdC50aXRsZXtcblx0XHRib3JkZXItcmFkaXVzOiAxMHB4O1xuXHRcdGJhY2tncm91bmQ6IHZhcigtLXdoaXRlKTtcblx0XHRpb24taXRlbXtcblx0XHRcdC0tYmFja2dyb3VuZDogdmFyKC0td2hpdGUpICFpbXBvcnRhbnQ7XG5cdFx0fVxuXHR9XG5cdC50b3AtYm9yZGVye1xuXHRcdGJvcmRlci10b3A6IDFweCBzb2xpZCB2YXIoLS1zZWNvbmRhcnkpO1xuXHR9XG59XG5cbmlvbi1jb250ZW50e1xuXHQtLW9mZnNldC1ib3R0b206MHB4ICFpbXBvcnRhbnQ7XG59Il19 */");

/***/ })

}]);
//# sourceMappingURL=attachment-lists-attachment-lists-module-es2015.js.map