@seniorsistemas/yms-integration 1.18.1 → 1.18.3-dedd666f-1a6a-40f2-b527-cd463044cb54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1868,7 +1868,7 @@
1868
1868
  if (!this.formGroup.valid) {
1869
1869
  return this.validateAllFormFields(this.formGroup);
1870
1870
  }
1871
- var visitante = this.formGroup.value;
1871
+ var visitante = this.formGroup.getRawValue();
1872
1872
  visitante.id = this.id;
1873
1873
  this.close(visitante);
1874
1874
  };
@@ -1914,7 +1914,9 @@
1914
1914
  this.integrationCallback = integrationCallback;
1915
1915
  this.visitors = [];
1916
1916
  this.visitorsChange = new core.EventEmitter();
1917
+ this.hasChange = new core.EventEmitter();
1917
1918
  this.ngUnsubscribe = new rxjs.Subject();
1919
+ this.visitorFound = false;
1918
1920
  this.unsubscribe$ = new rxjs.Subject();
1919
1921
  this._integrationCallback = integrationCallback;
1920
1922
  }
@@ -2046,6 +2048,17 @@
2046
2048
  .subscribe(function (visitante) { return _this.adicionaVisitanteParaSalvar(visitante); });
2047
2049
  };
2048
2050
  VisitanteComponent.prototype.adicionaVisitanteParaSalvar = function (visitante) {
2051
+ var _this = this;
2052
+ this.visitanteGridData.forEach(function (visitor) {
2053
+ if (visitor.document === visitante.document) {
2054
+ visitor.contact = visitante.contact;
2055
+ visitor.name = visitante.name;
2056
+ _this.visitorFound = true;
2057
+ }
2058
+ });
2059
+ if (this.visitorFound) {
2060
+ return;
2061
+ }
2049
2062
  this.visitanteGridLoading = true;
2050
2063
  visitante.documentType = this.getDocumentType();
2051
2064
  if (visitante.visitorSituation === undefined) {
@@ -2065,6 +2078,7 @@
2065
2078
  };
2066
2079
  this.visitors.push(novo_visitante);
2067
2080
  this.visitorsChange.emit(this.visitors);
2081
+ this.hasChange.emit(true);
2068
2082
  };
2069
2083
  VisitanteComponent.prototype.model = function (visitante) {
2070
2084
  var _this = this;
@@ -2133,6 +2147,7 @@
2133
2147
  else {
2134
2148
  visitorWithCredencial.credentialCards.push(this.createCredentialCard(visitorCredentialCard));
2135
2149
  }
2150
+ this.hasChange.emit(true);
2136
2151
  };
2137
2152
  VisitanteComponent.prototype.editarVisitante = function (visitante) {
2138
2153
  this.criarOuAtualizarVisitante(visitante);
@@ -2145,12 +2160,14 @@
2145
2160
  var removeVisitor = _this.visitors.findIndex(function (visitor) { return visitor.visitor.document === value.document; });
2146
2161
  if (removeVisitor !== -1) {
2147
2162
  _this.visitors.splice(removeVisitor, 1);
2163
+ _this.hasChange.emit(true);
2148
2164
  }
2149
2165
  }
2150
2166
  });
2151
2167
  };
2152
2168
  VisitanteComponent.prototype.deletarCredenciais = function (viisitorCredential) {
2153
2169
  viisitorCredential.credentialCards.splice(0, viisitorCredential.credentialCards.length);
2170
+ this.hasChange.emit(true);
2154
2171
  };
2155
2172
  VisitanteComponent.prototype.getContatoMotorista = function (motorista) {
2156
2173
  return motorista.telefone === undefined ? "0" : motorista.telefone;
@@ -2244,6 +2261,10 @@
2244
2261
  core.Output(),
2245
2262
  __metadata("design:type", Object)
2246
2263
  ], VisitanteComponent.prototype, "visitorsChange", void 0);
2264
+ __decorate([
2265
+ core.Output(),
2266
+ __metadata("design:type", Object)
2267
+ ], VisitanteComponent.prototype, "hasChange", void 0);
2247
2268
  VisitanteComponent = __decorate([
2248
2269
  core.Component({
2249
2270
  selector: 'visitante-component',
@@ -2831,7 +2852,7 @@
2831
2852
  SchedulingComponent = __decorate([
2832
2853
  core.Component({
2833
2854
  selector: "scheduling",
2834
- template: "<visited-info [agenda]=\"agenda\"> </visited-info>\r\n<form [formGroup]=\"formGroup\" *sLoadingState=\"loading\" novalidate>\r\n <div class=\"ui-fluid\">\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12 ui-md-6 required\">\r\n <label for=\"motivoVisita\">{{ \"yms.patio.sam_motivo_visita\" | translate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"motivoVisita\"\r\n name=\"motivoVisita\"\r\n pInputText\r\n formControlName=\"motivoVisita\"\r\n autocomplete=\"off\"\r\n />\r\n <s-control-errors\r\n [control]=\"formGroup.controls['motivoVisita']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\"\r\n >\r\n </s-control-errors>\r\n </div>\r\n <div class=\"ui-g-12 ui-md-6 required\">\r\n <label for=\"portaria\">{{ \"yms.patio.sam_portaria\" | translate }}</label>\r\n <s-lookup\r\n dataKey=\"id\"\r\n id=\"portaria\"\r\n name=\"portaria\"\r\n formControlName=\"portaria\"\r\n lookupDisplayField=\"name\"\r\n [multiple]=\"false\"\r\n (onLookupRequest)=\"portariaLookup.lookupRequest($event)\"\r\n (onSearchRequest)=\"portariaLookup.searchRequest($event)\"\r\n [searchTitle]=\"'yms.patio.sam_portaria' | translate\"\r\n [searchEmptyTitle]=\"'nothing_found' | translate\"\r\n [searchFields]=\"portariaLookup.searchFields\"\r\n [searchGridFields]=\"portariaLookup.searchGridFields\"\r\n [searchGridData]=\"portariaLookup.searchGridData\"\r\n [searchTotalRecords]=\"portariaLookup.searchTotalRecords\"\r\n [searchTotalRecordsLabel]=\"\r\n 'total_records' | translate : { value: portariaLookup.searchTotalRecords }\r\n \">\r\n </s-lookup>\r\n <s-control-errors \r\n [control]=\"formGroup.controls['portaria']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\">\r\n </s-control-errors>\r\n </div>\r\n <div class=\"ui-g-6 ui-md-3 required\">\r\n <label for=\"dataSaida\">{{ \"yms.patio.sam_data_saida\" | translate }}</label>\r\n <p-calendar\r\n id=\"dataSaida\"\r\n name=\"dataSaida\"\r\n formControlName=\"dataSaida\"\r\n inputId=\"dataSaida\"\r\n [showIcon]=\"true\"\r\n [locale]=\"localeConfig.calendar\"\r\n [dateFormat]=\"localeConfig.calendar.dateFormat\"\r\n >\r\n </p-calendar>\r\n <s-control-errors\r\n [control]=\"formGroup.controls['dataSaida']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\"\r\n >\r\n </s-control-errors>\r\n </div>\r\n <div class=\"ui-g-6 ui-md-3 required\">\r\n <label for=\"horaSaida\">{{ \"yms.patio.sam_hora_saida\" | translate }}</label>\r\n <p-calendar\r\n id=\"horaSaida\"\r\n name=\"horaSaida\"\r\n formControlName=\"horaSaida\"\r\n [locale]=\"localeConfig.calendar\"\r\n inputId=\"horaSaida\"\r\n [showTime]=\"true\"\r\n [hourFormat]=\"localeConfig.calendar.hourFormat\"\r\n [timeOnly]=\"true\"\r\n >\r\n </p-calendar>\r\n <s-control-errors\r\n [control]=\"formGroup.controls['horaSaida']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\"\r\n >\r\n </s-control-errors>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n<div class=\"separator\"></div>\r\n<div *ngIf=\"schedulingVisitors.visitors\">\r\n <visitante-component [motorista]=\"agenda.motorista\" [(visitors)]=\"schedulingVisitors.visitors\"></visitante-component>\r\n</div>\r\n<div class=\"separator\"></div>\r\n<div style=\"margin-top: 10px\">\r\n <s-button priority=\"primary\" [label]=\"'save' | translate\" (onClick)=\"onSave()\"\r\n [disabled]=\"loading || !canSave()\"></s-button>\r\n <s-button *ngIf=\"saveAndInitButton\" priority=\"primary\" [label]=\"'save_and_init' | translate\" (onClick)=\"onSave(true)\"\r\n [disabled]=\"loading\"></s-button>\r\n \r\n</div>\r\n"
2855
+ template: "<visited-info [agenda]=\"agenda\"> </visited-info>\r\n<form [formGroup]=\"formGroup\" *sLoadingState=\"loading\" novalidate>\r\n <div class=\"ui-fluid\">\r\n <div class=\"ui-g\">\r\n <div class=\"ui-g-12 ui-md-6 required\">\r\n <label for=\"motivoVisita\">{{ \"yms.patio.sam_motivo_visita\" | translate }}</label>\r\n <input\r\n type=\"text\"\r\n id=\"motivoVisita\"\r\n name=\"motivoVisita\"\r\n pInputText\r\n formControlName=\"motivoVisita\"\r\n autocomplete=\"off\"\r\n />\r\n <s-control-errors\r\n [control]=\"formGroup.controls['motivoVisita']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\"\r\n >\r\n </s-control-errors>\r\n </div>\r\n <div class=\"ui-g-12 ui-md-6 required\">\r\n <label for=\"portaria\">{{ \"yms.patio.sam_portaria\" | translate }}</label>\r\n <s-lookup\r\n dataKey=\"id\"\r\n id=\"portaria\"\r\n name=\"portaria\"\r\n formControlName=\"portaria\"\r\n lookupDisplayField=\"name\"\r\n [multiple]=\"false\"\r\n (onLookupRequest)=\"portariaLookup.lookupRequest($event)\"\r\n (onSearchRequest)=\"portariaLookup.searchRequest($event)\"\r\n [searchTitle]=\"'yms.patio.sam_portaria' | translate\"\r\n [searchEmptyTitle]=\"'nothing_found' | translate\"\r\n [searchFields]=\"portariaLookup.searchFields\"\r\n [searchGridFields]=\"portariaLookup.searchGridFields\"\r\n [searchGridData]=\"portariaLookup.searchGridData\"\r\n [searchTotalRecords]=\"portariaLookup.searchTotalRecords\"\r\n [searchTotalRecordsLabel]=\"\r\n 'total_records' | translate : { value: portariaLookup.searchTotalRecords }\r\n \">\r\n </s-lookup>\r\n <s-control-errors \r\n [control]=\"formGroup.controls['portaria']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\">\r\n </s-control-errors>\r\n </div>\r\n <div class=\"ui-g-6 ui-md-3 required\">\r\n <label for=\"dataSaida\">{{ \"yms.patio.sam_data_saida\" | translate }}</label>\r\n <p-calendar\r\n id=\"dataSaida\"\r\n name=\"dataSaida\"\r\n formControlName=\"dataSaida\"\r\n inputId=\"dataSaida\"\r\n [showIcon]=\"true\"\r\n [locale]=\"localeConfig.calendar\"\r\n [dateFormat]=\"localeConfig.calendar.dateFormat\"\r\n >\r\n </p-calendar>\r\n <s-control-errors\r\n [control]=\"formGroup.controls['dataSaida']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\"\r\n >\r\n </s-control-errors>\r\n </div>\r\n <div class=\"ui-g-6 ui-md-3 required\">\r\n <label for=\"horaSaida\">{{ \"yms.patio.sam_hora_saida\" | translate }}</label>\r\n <p-calendar\r\n id=\"horaSaida\"\r\n name=\"horaSaida\"\r\n formControlName=\"horaSaida\"\r\n [locale]=\"localeConfig.calendar\"\r\n inputId=\"horaSaida\"\r\n [showTime]=\"true\"\r\n [hourFormat]=\"localeConfig.calendar.hourFormat\"\r\n [timeOnly]=\"true\"\r\n >\r\n </p-calendar>\r\n <s-control-errors\r\n [control]=\"formGroup.controls['horaSaida']\"\r\n [errorMessages]=\"{ required: 'error_required' | translate }\"\r\n >\r\n </s-control-errors>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n<div class=\"separator\"></div>\r\n<div *ngIf=\"schedulingVisitors.visitors\">\r\n <visitante-component\r\n [motorista]=\"agenda.motorista\"\r\n [(visitors)]=\"schedulingVisitors.visitors\"\r\n (hasChange)=\"isFormModified = $event\">\r\n </visitante-component>\r\n</div>\r\n<div class=\"separator\"></div>\r\n<div style=\"margin-top: 10px\">\r\n <s-button priority=\"primary\" [label]=\"'save' | translate\" (onClick)=\"onSave()\"\r\n [disabled]=\"loading || !canSave()\"></s-button>\r\n <s-button *ngIf=\"saveAndInitButton\" priority=\"primary\" [label]=\"'save_and_init' | translate\" (onClick)=\"onSave(true)\"\r\n [disabled]=\"loading\"></s-button>\r\n \r\n</div>\r\n"
2835
2856
  }),
2836
2857
  __metadata("design:paramtypes", [forms.FormBuilder,
2837
2858
  router.ActivatedRoute,
@@ -6508,6 +6529,12 @@
6508
6529
  _this.hasChangeService.hasChange(_this.agenda.id);
6509
6530
  }
6510
6531
  });
6532
+ var statusAgenda = ["AGUARDANDO_CONFIRMACAO_SOLICITANTE", "AGENDADO", "AGUARDANDO_CONFIRMACAO", "REJEITADO_POR_VALIDACAO"];
6533
+ if (this.agenda && !statusAgenda.includes(this.agenda.status) || !this.permissions.editar) {
6534
+ this.formGroup.disable();
6535
+ this.disableButtonSave = true;
6536
+ }
6537
+ this.createdByErpDisableForm();
6511
6538
  };
6512
6539
  DevolucaoFormComponent.prototype.ngOnInit = function () {
6513
6540
  var _this = this;
@@ -6535,12 +6562,6 @@
6535
6562
  this.setTransportadora(this.agenda.externalTenant.cnpj);
6536
6563
  }
6537
6564
  this.totalEixosComposicao = this.agenda && this.agenda.veiculo ? this.agenda.veiculo.eixos || 0 : 0;
6538
- var statusAgenda = ["AGUARDANDO_CONFIRMACAO_SOLICITANTE", "AGENDADO", "AGUARDANDO_CONFIRMACAO", "REJEITADO_POR_VALIDACAO"];
6539
- if (this.agenda && !statusAgenda.includes(this.agenda.status) || !this.permissions.editar) {
6540
- this.formGroup.disable();
6541
- this.disableButtonSave = true;
6542
- }
6543
- this.createdByErpDisableForm();
6544
6565
  this.erpProcessService.current.subscribe(function (message) { return _this.erpProcessData = message; });
6545
6566
  this.erpFormConfigService.current.subscribe(function (message) { return _this.enableRevalidation = message; });
6546
6567
  this.route.data.pipe(operators.takeUntil(this.ngUnsubscribe)).subscribe(function (data) { return _this.onRouteDataChange(data); });