kui-crm_actions 0.0.187 → 0.0.188
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.
- package/cjs/index.js +1 -1
- package/index.d.ts +4 -4
- package/index.js +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("yup"),n=require("lodash"),t=require("react/jsx-runtime"),r=require("kui-crm"),i=require("kui-utils"),o=require("await-to-js"),a=require("luxon"),s=require("kui-complex"),l=require("react"),u=require("react-hook-form"),d=require("kui-basic"),c=require("@hookform/resolvers/yup"),m=require("@emotion/styled"),p=require("kui-icon"),f=require("mobx-react"),v=require("mobx");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var b=g(e),y=h(n),x=h(o),_=h(m),I=function(){return I=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},I.apply(this,arguments)};function w(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}function C(e,n,t,r){return new(t||(t=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((r=r.apply(e,n||[])).next())}))}function S(e,n){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function q(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i<o;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return e.concat(r||Array.prototype.slice.call(n))}function N(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e}var P,T,j,F,k=b.object().shape({number:b.string().trim().required("This field is required"),withDefaultValue:b.boolean(),values:b.object({value:b.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()}),value:b.number().when(["withDefaultValue","values.value"],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).required("This field is required").transform((function(e){return Number.isNaN(e)?void 0:e}))}),R=function(e){var n,i,o=e.form,a=e.prefixName,s=e.settings,l=e.meters,u=e.withCheckValue,d=e.meter,c=o.watch("".concat(a,"number")),m=(null==d?void 0:d.isFilled)?d:null==l?void 0:l.find((function(e){return e.number===c}));return t.jsx(r.NumberField,I({isRequired:!0,label:"Value",name:"".concat(a,"value"),maxIntegerPart:7,maxDecimalPart:3,warningMessage:"There are deviations in meter readings. It should be no more than",form:o,maxValue:(null===(n=null==m?void 0:m.maxValue)||void 0===n?void 0:n.value)&&u?Number(m.maxValue.value):null,placeholder:null===(i=null==m?void 0:m.values)||void 0===i?void 0:i.value},null==s?void 0:s.value))},M={getPostBodyInitialInspection:function(e,n){return{based_on:null,date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"initial",dropbox_link:e.dropboxLink,photo_groups:n,initial:this.getInitialInspectionFields(e)}},getInitialInspectionFields:function(e){var n,t,r;return{city:e.city.id,address:e.apartment.address,apartment_number:e.apartmentNumber||"",post_index:e.zipCode,floor:e.floor,floor_count:e.floorCount,room_type:e.typeOfObject,num_entrance:e.entrance,has_intercom:e.hasIntercom,intercom_code:e.intercomCode,has_gate:e.hasGate,gate_code:e.gateCode,area:e.area,rooms_number:e.roomsNumber,bedrooms_number:e.bedroomsNumber,bathrooms_number:e.bathroomsNumber,restrooms_number:e.restroomsNumber,combined_bathrooms_number:e.combinedBathroomsNumber,number_of_windows:e.numberOfWindows,renovation_year:null===(n=e.renovation)||void 0===n?void 0:n.year,renovation_type:null===(t=e.renovation)||void 0===t?void 0:t.type,renovation_style:null===(r=e.renovation)||void 0===r?void 0:r.style,wall_type:e.wallMaterial,overlap_type:e.overlapType,passenger_elevators_number:e.passengerElevatorsCount,service_elevators_number:e.serviceElevatorsCount,ceiling_height:e.ceilingHeight,building_year:e.buildingYear,serial_number:e.houseNumber,type_gas:e.gasLeads,hot_water:e.withHotWater,type_houses:e.typeOfHouse,parking_type:e.parkingType,parking_number:e.parkingNumber,rooms:e.rooms.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n}})),used_resources:{electricity:e.availableResources.electricity,water:e.availableResources.water,gas:e.availableResources.gas,heating:e.availableResources.heating}}},getPostBodyRegularInspection:function(e,n){return{date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"regular",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,regular:I(I({},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getPostBodyTransferInspection:function(e,n,t){return{date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"transfer",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,transfer:I(I({inspection_document:t.transferAct||void 0,rental_contract_signed_document:t.rentalContractFile||void 0,rental_contract_termination_document:t.rentalTerminationAgreement||void 0,service_contract_termination_document:t.serviceTerminationAgreement||void 0,transfer_type:e.transferType},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getInspectionFilling:function(e){var n;return{filling:null===(n=null==e?void 0:e.filter((function(e){return e})))||void 0===n?void 0:n.map((function(e){return{apartment_feature_id:e.id,is_absent:!e.check}}))}},getPartialInspectionMeters:function(e){var n=this;return{meters:(null==e?void 0:e.map((function(e,t){return{id:e.id,resource_type:e.resource,meter_type:e.type,passport_number:e.number,photos:n.getFilesParams(e.images),values:i.clearNotValidFields(n.getInspectionMeterValues(e))}})))||[]}},getPostBodyInventoryInspection:function(e,n,t,r,o,s){var l,u,d,c,m,p,f,v,h,g,b,y,x=this;return{date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"inventory",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,inventory:I({inspection_document:o||void 0,service_contract_signed_document:s||void 0,allowed_children:e.withChildren,allowed_pets:e.withPets,allowed_smoking:e.withSmoking,additional_terms:e.additionalTerms,country_of_residence:(null===(l=e.countryOfResidence)||void 0===l?void 0:l.id)||null,administrative_company:(null===(u=e.company)||void 0===u?void 0:u.id)||null,tax_type:e.taxesType,financial_personal_account:e.communalServicesAccount,max_electricity_counters:null===(d=e.maxMeters)||void 0===d?void 0:d.electricity,max_gas_counters:null===(c=e.maxMeters)||void 0===c?void 0:c.gas,max_heating_counters:null===(m=e.maxMeters)||void 0===m?void 0:m.heating,max_water_counters:null===(p=e.maxMeters)||void 0===p?void 0:p.water,has_barrier:e.hasBarrier,has_concierge:e.hasConcierge,has_security:e.hasSecurity,has_video_surveillance:e.hasVideoControl,barrier_phone:e.barrierPhone?i.getPhoneNumberFromPhoneParams(e.barrierPhone):null,concierge_phone:e.conciergePhone?i.getPhoneNumberFromPhoneParams(e.conciergePhone):null,security_phone:e.securityPhone?i.getPhoneNumberFromPhoneParams(e.securityPhone):null,video_surveillance_phone:e.videoControlPhone?i.getPhoneNumberFromPhoneParams(e.videoControlPhone):null,home_phone:e.homePhone?i.getPhoneNumberFromPhoneParams(e.homePhone):null,wifi_name:null===(f=e.wifi)||void 0===f?void 0:f.name,wifi_password:null===(v=e.wifi)||void 0===v?void 0:v.password,internet_provider_link:null===(h=e.internetProvider)||void 0===h?void 0:h.link,internet_provider_login:null===(g=e.internetProvider)||void 0===g?void 0:g.login,internet_provider_password:null===(b=e.internetProvider)||void 0===b?void 0:b.password,payer_code:e.payerCode,rooms:null===(y=e.rooms)||void 0===y?void 0:y.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n,area:e.area}})),filling:e.fillingList.map((function(e,n){var r;return{feature:(null===(r=e.tag)||void 0===r?void 0:r.id)||0,description:e.description,model:e.name,serial_code:e.serialNumber,amount:e.numberOfSubjects,photos:x.getFilesParams(e.images),instruction:t[n]}}))},this.getInventoryInspectionMeters(e.meters,r))}},getInventoryInspectionMeters:function(e,n,t){var r=this;return{meters:(null==e?void 0:e.map((function(e,o){return I(I({},r.getMeterCommonFields(e)),{passport:n[o],values:i.clearNotValidFields(r.getInspectionMeterValues(e,"initialValue")),photos:t?t[o]:r.getFilesParams(e.images),no_tariff:e.noTariff,auto_sending:e.withAutoSending})})))||[]}},getInspectionMeterValues:function(e,n){var t;if("electricity"===e.resource){var r=n||"",i=e["".concat(r,"T1")],o=e["".concat(r,"T2")],a=e["".concat(r,"T3")];return{T1:i?Number(i):i,T2:o?Number(o):o,T3:a?Number(a):a}}var s=n||"value";if("water"===e.resource){if("cold"===e.type){var l=e[s];return{cold:l?Number(l):l}}var u=e[s];return{hot:u?Number(u):u}}var d=e[s];return(t={})[e.resource]=d?Number(d):d,t},getMeterCommonFields:function(e){var n;return{id:e.id,meter_type:e.type,passport_number:e.number,resource_type:e.resource,activation_date:(null===(n=e.startDate)||void 0===n?void 0:n.toISODate())||null}},getMeterValues:function(e,n){return i.clearNotValidFields({initial_value:e,last_value:n})},getFilesParams:function(e){return(null==e?void 0:e.map((function(e){return e.uploadedData})).filter((function(e){return e})))||[]}},A={createInspectionHandler:function(e,n,t,i){return C(this,void 0,void 0,(function(){var o,a,s;return S(this,(function(l){switch(l.label){case 0:if(!e)return[3,5];n.startLoading("inspection creation"),o=void 0,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,i()];case 2:return o=l.sent(),[3,4];case 3:return a=l.sent(),(s=r.KUISettings.getSettings().Sentry).withScope((function(e){e.setExtras(t),s.captureException(new Error("Ошибка в генерации тела запроса при создании инспекции"))})),n.setError("Некорректное тело запроса",a),n.endLoading(),[3,4];case 4:return o?[2,this.createInspection(e,o,n)]:[2,null];case 5:return[2,null]}}))}))},getInspectionTypes:function(e){return C(this,void 0,void 0,(function(){var n,t,i;return S(this,(function(o){switch(o.label){case 0:return[4,x.default(r.requests.get("/apartments/".concat(e,"/inspection-types")))];case 1:return n=o.sent(),t=n[0],i=n[1],t?[2,[t,void 0]]:[2,[null,null==i?void 0:i.inspection_types]]}}))}))},getTransferTypes:function(e){return C(this,void 0,void 0,(function(){var n,t,i;return S(this,(function(o){switch(o.label){case 0:return[4,x.default(r.requests.get("/apartments/".concat(e,"/transfer-inspection-types")))];case 1:return n=o.sent(),t=n[0],i=n[1],t?[2,[t,void 0]]:[2,[null,null==i?void 0:i.transfer_inspection_types]]}}))}))},createInspection:function(e,n,t){var o;return C(this,void 0,void 0,(function(){var a;return S(this,(function(s){switch(s.label){case 0:return[4,x.default(r.requests.post("/apartments/".concat(e,"/inspections"),n))];case 1:return a=s.sent(),i.resHandler(a,t),[2,null===(o=a[1])||void 0===o?void 0:o.id]}}))}))},createInitialInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var r=this;return S(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return C(r,void 0,void 0,(function(){var n;return S(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,M.getPostBodyInitialInspection(e,n)]}))}))}))]}))}))},createRegularInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var r=this;return S(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return C(r,void 0,void 0,(function(){var n;return S(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,M.getPostBodyRegularInspection(e,n)]}))}))}))]}))}))},createTransferInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var i=this;return S(this,(function(o){return[2,this.createInspectionHandler(n,t,e,(function(){return C(i,void 0,void 0,(function(){var n,i;return S(this,(function(o){switch(o.label){case 0:return n=this.getRoomParams(e.roomsImages),[4,r.uploadFilesWithoutFilter(t,[e.transferAct,e.signedContract,e.rcTerminationAgreement,e.scTerminationAgreement])];case 1:return i=o.sent(),[2,M.getPostBodyTransferInspection(e,n,{transferAct:i[0],rentalContractFile:i[1],rentalTerminationAgreement:i[2],serviceTerminationAgreement:i[3]})]}}))}))}))]}))}))},createInventoryInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var o=this;return S(this,(function(a){return[2,this.createInspectionHandler(n,t,e,(function(){return C(o,void 0,void 0,(function(){var n,o,a,s,l;return S(this,(function(u){switch(u.label){case 0:return n=e.fillingList.map((function(e){return e.instruction})),o=(null===(l=e.meters)||void 0===l?void 0:l.map((function(e){return e.passportFile})))||[],[4,i.callPromises([r.uploadFiles(t,n),r.uploadFiles(t,o),r.uploadNewFile(t,e.inventoryAct),r.uploadNewFile(t,e.signedContract)])];case 1:return a=u.sent(),s=this.getRoomParams(e.roomsImages),[2,M.getPostBodyInventoryInspection(e,s,a[0],a[1],a[2],a[3])]}}))}))}))]}))}))},getRoomParams:function(e){var n,t=-1;return(null===(n=null==e?void 0:e.map((function(e){var n="room"===e.type||"bedroom"===e.type;return n&&(t+=1),{purpose:null==e?void 0:e.type,comment:null==e?void 0:e.comment,photos:M.getFilesParams((null==e?void 0:e.files)||[]),room_order_number:n?t:void 0}})))||void 0===n?void 0:n.filter((function(e){return e.purpose})))||[]}},B={getApartmentDescriptionInfo:function(e){return I(I(I(I(I(I({},this.getApartmentMainInfo(e)),this.getApartmentSecurityInfo(e)),this.getApartmentDetailInfo(e)),this.getApartmentTelecommunicationInfo(e)),this.getApartmentHouseInfo(e)),this.getMaxMetersParams(e))},getApartmentMainInfo:function(e){return I(I({},e),{apartmentNumber:e.apartment_number,zipCode:e.post_index||"",floorCount:e.floor_count,entrance:e.num_entrance,geolocation:this.getGeolocationParams(e.geolocation),distanceToCenter:e.distance_to_center_kilometers||null,typeOfObject:e.room_type})},getApartmentSecurityInfo:function(e){var n,t,r,o,a,s;return{hasIntercom:null!==(n=e.has_intercom)&&void 0!==n?n:null,hasGate:null!==(t=e.has_gate)&&void 0!==t?t:null,hasBarrier:null!==(r=e.has_barrier)&&void 0!==r?r:null,hasSecurity:null!==(o=e.has_security)&&void 0!==o?o:null,hasConcierge:null!==(a=e.has_concierge)&&void 0!==a?a:null,hasVideoControl:null!==(s=e.has_video_surveillance)&&void 0!==s?s:null,intercomCode:e.intercom_code||"",gateCode:e.gate_code||"",barrierPhone:e.barrier_phone?i.getPhoneParamsFromString(e.barrier_phone):null,conciergePhone:e.concierge_phone?i.getPhoneParamsFromString(e.concierge_phone):null,securityPhone:e.security_phone?i.getPhoneParamsFromString(e.security_phone):null,videoControlPhone:e.video_surveillance_phone?i.getPhoneParamsFromString(e.video_surveillance_phone):null}},getApartmentDetailInfo:function(e){var n;return{area:e.area,livingArea:e.living_area,kitchenArea:e.kitchen_area,roomsNumber:e.rooms_number,bedroomsNumber:e.bedrooms_number,bathroomsNumber:e.bathrooms_number,restroomsNumber:e.restrooms_number,combinedBathroomsNumber:e.combined_bathrooms_number,ceilingHeight:e.ceiling_height,numberOfWindows:e.number_of_windows,renovation:{year:e.renovation_year||null,type:e.renovation_type||null,style:e.renovation_style||null},rooms:(null===(n=e.rooms)||void 0===n?void 0:n.map((function(e){return{id:e.id,area:e.area||null,type:e.room_type||null}})))||[]}},getApartmentTelecommunicationInfo:function(e){return{homePhone:e.home_phone?i.getPhoneParamsFromString(e.home_phone):null,wifi:{name:e.wifi_name,password:e.wifi_password},internetProvider:{link:e.internet_provider_link,login:e.internet_provider_login,password:e.internet_provider_password},tvType:e.tv_type}},getApartmentHouseInfo:function(e){return{typeOfHouse:e.type_houses,buildingYear:e.building_year,houseNumber:e.serial_number,wallMaterial:e.wall_type,overlapType:e.overlap_type,parkingType:e.parking_type,parkingNumber:e.parking_number,passengerElevatorsCount:e.passenger_elevators_number?Number(e.passenger_elevators_number):null,serviceElevatorsCount:e.service_elevators_number?Number(e.service_elevators_number):null,gasLeads:e.type_gas,withHotWater:e.hot_water}},getMaxMetersParams:function(e){return{maxMeters:{water:e.max_water_counters,electricity:e.max_electricity_counters,gas:e.max_gas_counters,heating:e.max_heating_counters}}},getGeolocationParams:function(e){return e?{lat:Number(e.lat),lng:Number(e.lon)}:null},getObjectRoomsImages:function(e){return e.map((function(e){return{id:e.id,type:e.purpose,comment:e.comment,images:e.photos.map((function(e){return r.ImageStore.initFromImageModel(e)})),roomNumber:"number"==typeof e.room_order_number?e.room_order_number+1:0}}))},getInspectionFillingParams:function(e,n){var t;return I({id:e.id,name:e.description||"",tag:{id:e.feature.id,name:e.feature.name},images:null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return r.ImageStore.initFromImageModel(e)})),serialNumber:e.serial_code,numberOfSubjects:Number(e.amount),instruction:e.instruction?r.FileStore.initFromDocumentModel(e.instruction):null,type:r.matchesAPIFillingTypes[e.feature.feature_type]},n&&"appliance"===e.feature.feature_type?{check:!e.is_absent,wasMissing:e.previously_absent}:{})},getApartmentDescriptionWithMetro:function(e){return I(I({},this.getApartmentDescriptionInfo(e)),{metroStations:this.getMetroStationsParams(null==e?void 0:e.metro_stations)})},getMetroStationsParams:function(e){return(null==e?void 0:e.map((function(e){return{id:e.metro_station_id,name:e.name,walkDistance:e.distance_walk_meters,carDistance:Number(e.distance_car_kilometers),carTime:e.time_car_minutes,walkTime:Math.round(e.distance_walk_meters/(5e3/60))}})))||[]},getMeterValues:function(e,n,t){var r,i,o,a,s,l;if("electricity"===n){var u=t||"";return I(I(((r={})["".concat(u,"T1")]=Number(e.values.T1),r),"T1"!==e.meter_type&&((i={})["".concat(u,"T2")]=Number(e.values.T2),i)),"T3"===e.meter_type&&((o={})["".concat(u,"T3")]=Number(e.values.T3),o))}var d=t||"value";return"water"===n?"cold"===e.meter_type?((a={})["".concat(d)]=Number(e.values.cold),a):((s={})["".concat(d)]=Number(e.values.hot),s):((l={})["".concat(d)]=Number(e.values[n]),l)},getTransferMetersInfo:function(e){var n=this;return{meters:e.map((function(e){var t;return I({id:e.id,type:e.meter_type,number:e.passport_number,resource:e.resource_type,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return r.ImageStore.initFromImageModel(e)})))||[],values:n.getMeterValues(e,e.resource_type)},n.getMeterValues(e,e.resource_type))}))}},getApartmentPaymentInfo:function(e){return{payerCode:e.payer_code,communalServicesAccount:e.financial_personal_account,managementCompany:e.administrative_company?I(I({},e.administrative_company),{operatingAccount:e.payer_code}):null}},getInspectionPaymentInfo:function(e){return I(I({},this.getApartmentPaymentInfo(e)),{countryOfResidence:e.country_of_residence,taxesType:e.tax_type})},getMeterInfo:function(e,n){var t;return{id:e.id,type:e.meter_type,number:e.passport_number,startDate:e.activation_date?a.DateTime.fromISO(e.activation_date):null,company:e.company,operationalAccountNumber:e.operating_account,resource:n,tariff:e.tariff?{id:e.tariff.id,name:e.tariff.code_name}:null,passportFile:e.passport?r.FileStore.initFromFileModel(e.passport):null,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return r.ImageStore.initFromImageModel(e)})))||[]}},getInventoryMetersInfo:function(e){var n=this;return{meters:e.meters.map((function(e){return I(I({},n.getMeterInfo(e,e.resource_type)),n.getMeterValues(e,e.resource_type,"initialValue"))}))}}},O={apartment:b.object({address:b.string().trim().required("This field is required")}),apartmentNumber:b.string().required("This field is required"),city:b.object({name:b.string().required("This field is required")})},D=b.object(O),L={passengerElevatorsCount:r.positiveNumberSchema,serviceElevatorsCount:r.positiveNumberSchema,typeOfHouse:b.string().required(r.defaultRequiredMessage),buildingYear:b.string().required(r.defaultRequiredMessage),wallMaterial:b.string().required(r.defaultRequiredMessage),overlapType:b.string().required(r.defaultRequiredMessage),gasLeads:b.string().required(r.defaultRequiredMessage),withHotWater:b.boolean().required(r.defaultRequiredMessage)},V=b.object(L),W={step:.01},z={area:b.number().positive().required("This field is required"),rooms:b.array().of(b.object({type:b.string().required("This field is required")})),numberOfWindows:b.number().min(0).required("This field is required"),renovation:b.object({year:b.number().positive().required("This field is required"),type:b.string().required("This field is required"),style:b.string().required("This field is required")}),ceilingHeight:r.positiveNumberSchema},H=b.object(z),G={floor:b.number().integer().min(0).test("is less than floorCount","Too much",(function(e){return e<=this.parent.floorCount})),floorCount:b.number().integer().positive().required("This field is required"),roomsNumber:b.number().integer().min(0).required("This field is required"),bedroomsNumber:b.number().integer().min(0).required("This field is required"),bathroomsNumber:b.number().integer().min(0).required("This field is required"),restroomsNumber:b.number().integer().min(0).required("This field is required"),combinedBathroomsNumber:b.number().integer().min(0).required("This field is required")},E=b.object(G),U={typeOfObject:b.string().required("This field is required"),entrance:b.string().required("This field is required"),hasIntercom:b.string().required("This field is required"),intercomCode:r.fieldWithConditionSchema("hasIntercom"),hasGate:b.string().required("This field is required"),gateCode:r.fieldWithConditionSchema("hasGate")},Y=b.object(U),K={size:"s"},Q={taxesType:b.string().required(r.defaultRequiredMessage),countryOfResidence:b.object({name:b.string().required(r.defaultRequiredMessage)}),company:b.object({name:b.string().required(r.defaultRequiredMessage)})},Z=b.object(Q),J={hasBarrier:b.string().required(r.defaultRequiredMessage),barrierPhone:r.phoneWithConditionSchema("hasBarrier"),hasConcierge:b.string().required(r.defaultRequiredMessage),conciergePhone:r.phoneWithConditionSchema("hasConcierge"),hasSecurity:b.string().required(r.defaultRequiredMessage),securityPhone:r.phoneWithConditionSchema("hasSecurity"),hasVideoControl:b.string().required(r.defaultRequiredMessage),videoControlPhone:r.phoneWithConditionSchema("hasVideoControl")},X=b.object(J),$=r.getNumbersValues(7),ee={maxMeters:b.object({water:r.positiveNumberSchema,electricity:r.positiveNumberSchema,gas:r.positiveNumberSchema,heating:r.positiveNumberSchema})},ne=b.object(ee),te={homePhone:r.phoneNonRequiredSchema("homePhone")},re=b.object().shape(te,[["homePhone","homePhone"]]),ie=b.object().shape({type:b.string(),tag:b.object({name:b.string().required(r.defaultRequiredMessage)}),name:b.string().when("type",{is:function(e){return"electronics"===e},then:function(e){return e.required(r.defaultRequiredMessage)}})}),oe={number:b.string().required("This field is required")},ae=function(e){var n=r.getMeterValuesFieldsSchema(e);return b.object().shape(I(I({},oe),Object.assign.apply(Object,q([{}],n,!1))))},se=function(e,n){return q(q([],r.basicFieldsOfNewResourceMeter(e,n),!0),[I({label:"Activation date",name:"startDate",variant:"date",max:a.DateTime.now()},null==n?void 0:n.startDate),I({label:"Passport",name:"passportFile",variant:"custom",CustomInput:s.InputFile},null==n?void 0:n.passportFile)],!1)},le=function(e){var n=e.meter,i=e.getMeterLabel,o=n.resource,a=n.type,s=n.number,l=[n.initialValue,n.initialValueT1,n.initialValueT2,n.initialValueT3].filter((function(e){return void 0!==e})).map((function(e){return e})).join(" / "),u=i?i(o,a):y.default.capitalize("".concat(a?"".concat(a," "):"").concat(o," meter"));return t.jsxs(d.Caption,I({"data-testid":"addedMeterLine",size:"s"},{children:["• ",u," #",s," -"," ",t.jsxs(ue,{children:[l," ",r.meterUnitLabel[n.resource]]})]}))},ue=_.default.span(P||(P=N(["\n font-weight: 600;\n"],["\n font-weight: 600;\n"]))),de=function(e){var n,r,i=e.resource,o=e.formStore,a=e.label,s=e.getMeterLabel,l=null===(r=null===(n=o.fields)||void 0===n?void 0:n.meters)||void 0===r?void 0:r.filter((function(e){return e.resource===i}));return(null==l?void 0:l.length)?t.jsxs(ce,I({"data-testid":"addedMetersBlock"},{children:[t.jsxs(pe,I({container:!0,alignItems:"center"},{children:[t.jsx(me,{}),t.jsx(d.Caption,I({size:"s",color:"fiftyP"},{children:a||"In the previous steps were added:"}))]})),l.map((function(e){return t.jsx(le,{getMeterLabel:s,meter:e},e.number)}))]})):null},ce=_.default.div(T||(T=N(["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"],["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"])),d.theme.palette.grey.fifteenB),me=_.default(p.WarningIcon)(j||(j=N(["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"],["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"])),d.theme.palette.brand.main),pe=_.default(d.Grid)(F||(F=N(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"])));var fe,ve,he,ge,be,ye,xe,_e,Ie,we,Ce,Se,qe,Ne,Pe,Te,je,Fe,ke,Re,Me,Ae,Be,Oe={rooms:b.array().of(b.object({area:b.number().positive().required(r.defaultRequiredMessage).transform((function(e){return Number.isNaN(e)?void 0:e}))}))},De=b.object(Oe),Le=function(e){var n=e.feedback,i=e.label;return t.jsx(Ve,I({status:n.status},{children:t.jsxs(d.Grid,I({container:!0,alignItems:"center"},{children:[t.jsx(d.Caption,I({size:"s",weight:500,color:"fiftyP"},{children:i})),"notSigned"!==n.status&&t.jsxs(We,{children:["signed"===n.status?t.jsx(ze,{}):t.jsx(He,{}),!!n.comment&&t.jsx(r.Tooltip,I({placement:"bottom",content:t.jsxs("div",{children:[t.jsx(d.Caption,I({size:"xs",color:"fiftyP"},{children:"Comment"})),t.jsx(Ge,I({size:"xs"},{children:n.comment}))]})},{children:t.jsx(Ee,{})}))]})]}))}))},Ve=_.default.div(fe||(fe=N(["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"],["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"])),(function(e){return"notSigned"===e.status?d.theme.palette.background.light1:d.theme.palette.grey.zero}),d.theme.palette.grey.fifteenB,d.theme.breakpoints.sm),We=_.default.div(ve||(ve=N(["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"],["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"]))),ze=_.default(p.CheckIcon)(he||(he=N(["\n path {\n fill: ",";\n }\n"],["\n path {\n fill: ",";\n }\n"])),d.theme.palette.green.fiftyP),He=_.default(p.CancelIcon)(ge||(ge=N(["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"],["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"])),d.theme.palette.red.fiftyP),Ge=_.default(d.Caption)(be||(be=N(["\n margin-top: 8px;\n"],["\n margin-top: 8px;\n"]))),Ee=_.default(p.CommentIcon)(ye||(ye=N(["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"],["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"])),d.theme.palette.grey.zero,d.theme.palette.grey.thirty),Ue=f.observer((function(e){var n=e.feedback,r=e.label,i=e.resendLabel,o=e.resend;return n?t.jsx(d.Grid,I({item:!0},{children:t.jsxs(d.Grid,I({container:!0,alignItems:"center"},{children:[t.jsx(Le,{feedback:n,label:r}),"rejected"===n.status&&t.jsx(Ye,I({size:"xs",variant:"orange",onClick:o,endIcon:t.jsx(p.UpdateIcon,{})},{children:i}))]}))})):null})),Ye=_.default(d.Button)(xe||(xe=N(["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"],["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"])),d.theme.breakpoints.sm),Ke=f.observer((function(e){var n=e.tenantFeedback,r=e.landlordFeedback,i=e.resignInspection,o=e.resendLabel,a=e.tenantLabel,s=e.landlordLabel;return n||r?t.jsxs(Qe,I({container:!0,spacing:2,alignItems:"center"},{children:[t.jsx(Ue,{resend:i,resendLabel:o,feedback:n,label:a}),t.jsx(Ue,{resend:i,resendLabel:o,feedback:r,label:s})]})):null})),Qe=_.default(d.Grid)(_e||(_e=N(["\n padding-top: 8px;\n"],["\n padding-top: 8px;\n"]))),Ze=function(e){var n=e.filling,i=e.warningLabel;return t.jsxs(d.Grid,I({container:!0,alignItems:"center"},{children:[n.wasMissing&&t.jsx(r.Tooltip,I({content:t.jsx(d.Caption,I({size:"xs"},{children:i}))},{children:t.jsx(Je,{width:17,height:17})})),t.jsxs(Xe,{children:[t.jsxs(d.Caption,I({size:"s"},{children:[n.tagName," ",n.name?" | ".concat(n.name):""]})),!(!n.numberOfSubjects&&!n.serialNumber)&&t.jsxs($e,I({size:"xs",color:"fiftyP"},{children:[n.numberOfSubjects?"".concat(n.numberOfSubjects," pieces"):"",n.numberOfSubjects&&n.serialNumber?" • ":"",n.serialNumber]}))]})]}))},Je=_.default(p.WarningIcon)(Ie||(Ie=N(["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"],["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"])),d.theme.palette.red.fiftyP),Xe=_.default.div(we||(we=N(["\n margin-left: 8px;\n"],["\n margin-left: 8px;\n"]))),$e=_.default(d.Caption)(Ce||(Ce=N(["\n margin-top: 4px;\n"],["\n margin-top: 4px;\n"]))),en=_.default(d.Grid)(Se||(Se=N(["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"],["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"]))),nn=_.default(s.CheckboxWithController)(qe||(qe=N(["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"],["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"]))),tn=function(e,n,t,r){var i,o=function(){r&&r(),n.loader.endLoading()};l.useEffect((function(){C(void 0,void 0,void 0,(function(){var r,i;return S(this,(function(a){switch(a.label){case 0:return t?(null===(i=null===(r=e.fields)||void 0===r?void 0:r.meters)||void 0===i?void 0:i.length)?[3,2]:[4,n.fetchMeters()]:[3,3];case 1:a.sent(),a.label=2;case 2:return o(),[3,4];case 3:!1===t&&o(),a.label=4;case 4:return[2]}}))}))}),[t]),l.useEffect((function(){var t,r;n.loader.isLoading||(null===(r=null===(t=e.fields)||void 0===t?void 0:t.meters)||void 0===r?void 0:r.length)||!n.meters.length||(e.updateFormFields({meters:n.meters}),e.updateFormFields({metersFromStore:n.meters}))}),[n.meters,n.loader.isLoading]),l.useEffect((function(){var t,r;n.loader.isLoading||!(null===(r=null===(t=e.fields)||void 0===t?void 0:t.metersFromStore)||void 0===r?void 0:r.length)||n.meters.length||n.updateMetersFromForm(e.fields.metersFromStore)}),[null===(i=e.fields)||void 0===i?void 0:i.metersFromStore,n.loader.isLoading])},rn=function(){var e=this;this.fetchFillingList=function(n,t){return C(e,void 0,void 0,(function(){var e;return S(this,(function(o){switch(o.label){case 0:return this.loader.startLoading(),[4,x.default(r.ApartmentsAgent.getFillingList(n,t))];case 1:return e=o.sent(),i.resHandler(e,this.loader,this.updateFillingList),[2]}}))}))},this.updateFillingList=function(n){e.fillingList=(null==n?void 0:n.map((function(e){return{id:e.id,name:e.description,tagName:e.feature_name,serialNumber:e.serial_code,numberOfSubjects:e.amount,wasMissing:e.is_absent}})))||[]},this.fillingList=[],this.loader=new i.Loader,v.makeAutoObservable(this)},on=function(e,n,t,r,i){var o=function(){i&&i(),t.loader.endLoading()};l.useEffect((function(){C(void 0,void 0,void 0,(function(){var i,a;return S(this,(function(s){switch(s.label){case 0:return r&&e?(null===(a=null===(i=n.fields)||void 0===i?void 0:i.fillingList)||void 0===a?void 0:a.length)?[3,2]:[4,t.fetchFillingList(e,"appliance")]:[3,3];case 1:s.sent(),s.label=2;case 2:return o(),[3,4];case 3:!1===r&&o(),s.label=4;case 4:return[2]}}))}))}),[e,r]),l.useEffect((function(){var e,r;t.loader.isLoading||(null===(r=null===(e=n.fields)||void 0===e?void 0:e.fillingList)||void 0===r?void 0:r.length)||n.updateFormFields({fillingList:t.fillingList.map((function(e){return I(I({},e),{check:!1})}))})}),[t.fillingList,t.loader.isLoading])},an=function(e){var n=e.label,r=e.onClick,i=e.isActive;return t.jsx(d.Button,I({size:"xs",variant:i?"primary":"white",onClick:r},{children:n}))},sn=function(e){var n=e.metroStation,r=n.color,i=n.name;return t.jsxs(ln,I({item:!0,container:!0,alignItems:"center"},{children:[t.jsx(un,{style:{background:r}}),t.jsx(d.Caption,I({size:"s",color:"sixty"},{children:i}))]}))},ln=_.default(d.Grid)(Ne||(Ne=N(["\n width: auto;\n"],["\n width: auto;\n"]))),un=_.default.div(Pe||(Pe=N(["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"],["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"]))),dn=function(e){var n=e.phone,r=i.getPhoneNumberFromPhoneParams(n," "),o=r.replace(/\d/g,"");return t.jsxs(cn,I({container:!0,alignItems:"center",wrap:"nowrap"},{children:[t.jsx(mn,{width:14,height:14}),t.jsx("a",I({href:"tel:+".concat(o)},{children:t.jsx(d.Caption,I({size:"s",weight:500,color:"sixty"},{children:r}))}))]}))},cn=_.default(d.Grid)(Te||(Te=N(["\n width: auto;\n"],["\n width: auto;\n"]))),mn=_.default(p.PhoneIcon)(je||(je=N(["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"],["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"])),d.theme.palette.grey.sixty),pn=function(e){var n=e.inspection,i=e.onClose,o=e.getClientLink,a=e.getInspectionLink,s=n.apartment,l=n.tenant,u=n.landlord,c=n.metroStations,m=l||u,f=o&&m?o(null==m?void 0:m.id):"",v=a(s.id,n.id);return t.jsxs(fn,{children:[t.jsx(r.Link,I({href:v},{children:t.jsx(vn,{imageSrc:s.previewImage,description:s.address})})),t.jsx(d.Grid,I({container:!0,spacing:2,alignItems:"center"},{children:c.map((function(e){return t.jsx(sn,{metroStation:e},e.name)}))})),!!m&&t.jsxs(hn,I({container:!0,alignItems:"center",justify:"space-between"},{children:[f?t.jsx(bn,I({href:f},{children:t.jsx(r.UserBadge,{weight:500,user:m})})):t.jsx(r.UserBadge,{weight:500,user:m}),!!(null==m?void 0:m.phoneNumber)&&t.jsx(dn,{phone:null==m?void 0:m.phoneNumber})]})),t.jsx(gn,I({isCircle:!0,size:"xs",variant:"whiteWithGray",onClick:i},{children:t.jsx(p.CloseIcon,{width:6,height:6})}))]})},fn=_.default.div(Fe||(Fe=N(["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"],["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"])),d.theme.palette.grey.zero),vn=_.default(r.PreviewContent)(ke||(ke=N(["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"],["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"]))),hn=_.default(d.Grid)(Re||(Re=N(["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"],["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"])),d.theme.palette.grey.fifteenB),gn=_.default(d.Button)(Me||(Me=N(["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"],["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"]))),bn=_.default(r.Link)(Ae||(Ae=N(["\n max-width: calc(100% - 140px);\n"],["\n max-width: calc(100% - 140px);\n"]))),yn=_.default.div(Be||(Be=N(["\n position: relative;\n"],["\n position: relative;\n"])));exports.AddedMetersBlock=de,exports.AdditionalInfoFieldsSchema=Q,exports.AdditionalInfoStepSchema=Z,exports.BasicApartmentInfoFieldsSchema=O,exports.BasicApartmentInfoStepSchema=D,exports.DetailApartmentInfoFieldsSchema=z,exports.DetailApartmentInfoStepSchema=H,exports.FillingInfoFieldsSchema=ie,exports.FillingListStore=rn,exports.HouseInfoFieldsSchema=L,exports.HouseInfoStepSchema=V,exports.HouseServicesInfoFieldsSchema=J,exports.HouseServicesInfoStepSchema=X,exports.InspectionFeedback=Ke,exports.InspectionFillingCard=function(e){var n=e.className,r=e.form,i=e.index,o=e.disabled,a=w(e,["className","form","index","disabled"]);return t.jsx(en,I({className:n},{children:t.jsx(nn,{form:r,name:"fillingList.".concat(i,".check"),label:t.jsx(Ze,I({},a)),disabled:o})}))},exports.InventoryMeterInfoFields=function(e){var n,i,o=e.resource,a=e.index,s=e.formStore,m=null===(i=null===(n=s.fields)||void 0===n?void 0:n.meters)||void 0===i?void 0:i[a],p="water"===o||"electricity"===o,f=p?"water"===o?"cold":"T1":null,v=l.useState((null==m?void 0:m.type)||f),h=v[0],g=v[1],b=se({resource:o,meterType:h}),y=b.filter((function(e){return"number"===e.type})).map((function(e){return e.name})),x=ae(y),_=l.useMemo((function(){return u.useForm({resolver:c.yupResolver(x),defaultValues:I({},m),values:m})}),[x]);return t.jsx(r.FormWrapper,I({form:_,onSubmit:function(e){s.replaceFieldInArray("meters",I(I({},e),{resource:o}),a),s.nextStep()},label:"Next",variant:"next",withPrevStep:!0,handlePrevClick:s.prevStep},{children:t.jsxs(d.Grid,I({container:!0,spacing:2},{children:[t.jsx(d.Grid,I({item:!0,xs:12},{children:t.jsx(de,{formStore:s,resource:o})})),p&&t.jsx(d.Grid,I({item:!0,xs:12},{children:t.jsx(r.MeterTypeRadioGroup,{form:_,resource:o,handleChange:g})})),b.map((function(e){var n=e.size,i=w(e,["size"]);return t.jsx(d.Grid,I({item:!0,xs:n||6},{children:t.jsx(r.InputByType,I({form:_},i))}),i.name)}))]}))}))},exports.MetersInfoFieldsSchema=ee,exports.MetersInfoStepSchema=ne,exports.ObjectForMapCard=pn,exports.ObjectForMapOverlay=function(e){var n=e.inspection,i=e.map,o=e.label,a=w(e,["inspection","map","label"]),s=r.useMapCards(n.location,i),l=s.ref,u=s.isOpen,d=s.closeCard,c=s.toggleCard;return t.jsx(r.MapOverlay,I({map:i,position:n.location},{children:t.jsxs(yn,I({ref:l},{children:[t.jsx(an,{label:o,isActive:u,onClick:c}),u&&t.jsx(pn,I({inspection:n,onClose:d},a))]}))}))},exports.ObjectForMapPoint=an,exports.RoomsApartmentInfoFieldsSchema=G,exports.RoomsApartmentInfoStepSchema=E,exports.RoomsInfoFieldsSchema=Oe,exports.RoomsInfoStepSchema=De,exports.SecurityApartmentInfoFieldsSchema=U,exports.SecurityApartmentInfoStepSchema=Y,exports.TelecommunicationsInfoFieldsSchema=te,exports.TelecommunicationsInfoStepSchema=re,exports.WaterMeterFieldsSchema=k,exports.apartmentFields=B,exports.getAdditionalInfoStepFields=function(e){return q([I({label:"Pets",name:"withPets",variant:"custom",CustomInput:s.CheckboxWithController,labelProps:K},null==e?void 0:e.withPets),I({label:"Children",name:"withChildren",variant:"custom",CustomInput:s.CheckboxWithController,labelProps:K},null==e?void 0:e.withChildren),I({label:"Smoking",name:"withSmoking",variant:"custom",CustomInput:s.CheckboxWithController,labelProps:K},null==e?void 0:e.withSmoking),I({isTextArea:!0,placeholder:"other terms",name:"additionalTerms"},null==e?void 0:e.additionalTerms)],r.getApartmentPaymentFields(e),!0)},exports.getAvailableResourcesFields=function(e){return[I({label:"Water",name:"availableResources.water",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.water),I({label:"Electricity",name:"availableResources.electricity",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.electricity),I({label:"Gas",name:"availableResources.gas",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.gas),I({label:"Heating",name:"availableResources.heating",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.heating)]},exports.getBasicApartmentInfoFields=function(e,n){return[I({name:"country",label:"Country",variant:"custom",CustomInput:r.CountryAutocomplete,size:12},null==n?void 0:n.country),I({name:"region",label:"Region",variant:"custom",CustomInput:r.RegionAutocomplete},null==n?void 0:n.region),I({name:"city",label:"City",variant:"custom",CustomInput:r.CityAutocomplete,isRequired:!0},null==n?void 0:n.city),I({name:"apartment",variant:"custom",CustomInput:r.InputWithAddressAutocomplete,handlePlaceSelect:e,size:12,isRequired:!0},null==n?void 0:n.apartment),I({label:"Apartment",name:"apartmentNumber","data-testid":"apartment_number",isRequired:!0},null==n?void 0:n.apartmentNumber),I({label:"Zip code",name:"zipCode"},null==n?void 0:n.zipCode)]},exports.getDetailApartmentInfoFields=function(e,n,t){var i,o;return q(q([I(I({label:"Total area",name:"area",type:"number",isRequired:!0},W),null==t?void 0:t.area)],e?new Array(Number(e)).fill(0).map((function(e,i){var o,a=n&&i<n?"Bedroom ".concat(i+1):"Room ".concat(i+1),s=n&&i<n?"bedrooms":"rooms";return[I({name:"rooms.".concat(i,".type"),label:"".concat(a," type"),variant:"select",options:r.RoomTypeValues,isRequired:!0},(null==t?void 0:t[s])?null===(o=t[s](i))||void 0===o?void 0:o.type:{})]})).flat():[],!0),[I(I({name:"ceilingHeight",label:"Ceiling height",type:"number",cornerLabel:"m.",isRequired:!0},W),null==t?void 0:t.ceilingHeight),I({name:"numberOfWindows",label:"Windows",type:"number",isRequired:!0},null==t?void 0:t.numberOfWindows),I({name:"renovation.year",label:"Year of last renovation",type:"number",isRequired:!0},null==t?void 0:t.renovation.year),I({name:"renovation.type",label:"Type of renovation",variant:"select",options:r.RenovationTypeValues,isRequired:!0},null===(i=null==t?void 0:t.renovation)||void 0===i?void 0:i.type),I({name:"renovation.style",label:"Renovation style",variant:"select",options:r.RenovationStyleValues,isRequired:!0},null===(o=null==t?void 0:t.renovation)||void 0===o?void 0:o.style)],!1)},exports.getFillingInfoFields=function(e,n,t,o){return q(q(q(q(q(q(q([],i.addToArrayByCondition(e,I({label:"Filling type",name:"type",variant:"select",options:r.FillingTypeValues,handleChange:t,isRequired:!0},null==o?void 0:o.type)),!0),[I({label:"Name (tag)",name:"tag",type:n,variant:"custom",CustomInput:r.FillingTagsAutocomplete,isRequired:!0},null==o?void 0:o.tag)],!1),i.addToArrayByCondition("finish"!==n,I({label:"Model",name:"name",isRequired:!0},null==o?void 0:o.name)),!0),i.addToArrayByCondition("finish"!==n,I({label:"Serial code",name:"serialNumber",size:6},null==o?void 0:o.serialNumber)),!0),i.addToArrayByCondition("finish"!==n,I({label:"Amount",name:"numberOfSubjects",type:"number",size:6},null==o?void 0:o.numberOfSubjects)),!0),[I({label:"Description",name:"description",isTextArea:!0},null==o?void 0:o.description)],!1),i.addToArrayByCondition("finish"!==n,I({label:"Instruction",name:"instruction",variant:"custom",CustomInput:r.InputFileWithVisibility},null==o?void 0:o.instruction)),!0)},exports.getHouseInfoStep=function(e){return[I({name:"typeOfHouse",label:"Type houses",variant:"select",options:r.HouseTypesValues,isRequired:!0},null==e?void 0:e.typeOfHouse),I({name:"houseNumber",label:"House series"},null==e?void 0:e.houseNumber),I({name:"wallMaterial",label:"Wall material",variant:"select",options:r.WallMaterialsValues,isRequired:!0},null==e?void 0:e.wallMaterial),I({name:"overlapType",label:"Overlap type",variant:"select",options:r.SlabsTypesValues,isRequired:!0},null==e?void 0:e.overlapType),I({name:"gasLeads",label:"Gas",variant:"select",options:r.GasTypesValues,isRequired:!0},null==e?void 0:e.gasLeads),I({name:"withHotWater",label:"Hot water",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.withHotWater),I({name:"passengerElevatorsCount",label:"Passenger elevators",type:"number",isRequired:!0},null==e?void 0:e.passengerElevatorsCount),I({name:"serviceElevatorsCount",label:"Service elevators",type:"number",isRequired:!0},null==e?void 0:e.serviceElevatorsCount),I({name:"buildingYear",label:"Builded",isRequired:!0},null==e?void 0:e.buildingYear)]},exports.getHouseServicesInfoStep=function(e){return[I({name:"hasBarrier",label:"Barrier",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasBarrier),I({name:"barrierPhone",label:"Barrier code",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasBarrier",Input:s.InputPhoneWithForm},null==e?void 0:e.barrierPhone),I({name:"hasConcierge",label:"Concierge",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasConcierge),I({name:"conciergePhone",label:"Concierge",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasConcierge",Input:s.InputPhoneWithForm},null==e?void 0:e.conciergePhone),I({name:"hasSecurity",label:"Security",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasSecurity),I({name:"securityPhone",label:"Security",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasSecurity",Input:s.InputPhoneWithForm},null==e?void 0:e.securityPhone),I({name:"hasVideoControl",label:"Video surveillance",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasVideoControl),I({name:"videoControlPhone",label:"Video surveillance",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasVideoControl",Input:s.InputPhoneWithForm},null==e?void 0:e.videoControlPhone)]},exports.getInventoryDocumentsFields=function(e,n){return q([I({label:"Inventory inspection file",name:"inventoryAct",variant:"file"},null==n?void 0:n.transferAct)],i.addToArrayByCondition(!e,I({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==n?void 0:n.signedContract)),!0)},exports.getInventoryDocumentsSchema=function(e){return b.object().shape(I({inventoryAct:b.mixed()},e?{}:{signedContract:b.mixed().required(r.defaultRequiredMessage)}))},exports.getInventoryMeterFields=se,exports.getMetersInfoStepFields=function(e){var n,t,r,i;return[I({name:"maxMeters.water",label:"Water",variant:"select",options:$,isRequired:!0},null===(n=null==e?void 0:e.maxMeters)||void 0===n?void 0:n.water),I({name:"maxMeters.electricity",label:"Electricity",variant:"select",options:$,isRequired:!0},null===(t=null==e?void 0:e.maxMeters)||void 0===t?void 0:t.electricity),I({name:"maxMeters.gas",label:"Gas",variant:"select",options:$,isRequired:!0},null===(r=null==e?void 0:e.maxMeters)||void 0===r?void 0:r.gas),I({name:"maxMeters.heating",label:"Heating",variant:"select",options:$,isRequired:!0},null===(i=null==e?void 0:e.maxMeters)||void 0===i?void 0:i.heating)]},exports.getPartialMeterInfoSchema=function(e){var n=e.filter((function(e){return e.maxIntegerPart})).map((function(e){return e.name})),t=n.map((function(e){var n;return(n={})[e]=b.number().when(["withDefaultValue","values.".concat(e)],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).required("This field is required").transform((function(e){return Number.isNaN(e)?void 0:e})),n}));return b.object().shape(I({number:b.string().trim().required("This field is required"),withDefaultValue:b.boolean(),values:b.object(I({},Object.fromEntries(n.map((function(e){return[e,b.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()]})))))},Object.assign.apply(Object,q([{}],t,!1))))},exports.getRoomsApartmentInfoFields=function(e,n){return[I({label:"Floor",name:"floor",type:"number",isRequired:!0},null==n?void 0:n.floor),I({label:"Floors",name:"floorCount",type:"number",isRequired:!0},null==n?void 0:n.floorCount),I({label:"Rooms",name:"roomsNumber",type:"number",isRequired:!0},null==n?void 0:n.roomsNumber),I({label:"Bedrooms",name:"bedroomsNumber",type:"number",isRequired:!0,disabled:0===e||"0"===e},null==n?void 0:n.bedroomsNumber),I({label:"Bathrooms",name:"bathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.bathroomsNumber),I({label:"Restrooms",name:"restroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.restroomsNumber),I({label:"Combined bathroom",name:"combinedBathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.combinedBathroomsNumber)]},exports.getRoomsImagesSteps=function(e,n,t){return q(q(q(q(q(q(q(q(q(q([I({type:"kitchen"},n.kitchen)],new Array(Number((null==t?void 0:t.bedroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"bedroom"},n.bedroom((null==t?void 0:t.bedroomsNumber)?"".concat(r+1," "):"",null==t?void 0:t.rooms[r]))})),!0),new Array(Math.max(Number((null==t?void 0:t.roomsNumber)||0)-Number((null==t?void 0:t.bedroomsNumber)||0),0)).fill(0).map((function(e,r){return I({type:"room"},n.room((null==t?void 0:t.roomsNumber)?"".concat(r+1+((null==t?void 0:t.bedroomsNumber)||0)," "):"",null==t?void 0:t.rooms[((null==t?void 0:t.bedroomsNumber)||0)+r]))})),!0),new Array(Number((null==t?void 0:t.bathroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"bathroom"},n.bathroom((null==t?void 0:t.bathroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.restroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"toilet"},n.toilet((null==t?void 0:t.restroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.combinedBathroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"combined_bathroom"},n.combinedBathroom((null==t?void 0:t.combinedBathroomsNumber)?"".concat(r+1," "):""))})),!0),[I({type:"others"},n.others)],!1),i.addToArrayByCondition("initial"===e,I({type:"entrance"},n.entrance)),!0),i.addToArrayByCondition("initial"!==e,I({type:"keys"},n.keys)),!0),i.addToArrayByCondition(!("initial"!==e||!(null==t?void 0:t.parkingType)),I({type:"parking"},n.parking)),!0),[I({type:"additional"},n.additional)],!1)},exports.getRoomsInfoStepFields=function(e,n){return q([],(null==e?void 0:e.roomsNumber)?new Array(Number(e.roomsNumber)).fill(0).map((function(t,r){var i,o=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"Bedroom ".concat(r+1):"Room ".concat(r+1),a=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"bedrooms":"rooms";return[I({name:"rooms.".concat(r,".area"),label:"".concat(o," area"),type:"number",isRequired:!0},(null==n?void 0:n[a])?null===(i=n[a](r))||void 0===i?void 0:i.area:{})]})).flat():[],!0)},exports.getSecurityApartmentInfoFields=function(e){return[I({label:"Object type",name:"typeOfObject",variant:"select",options:r.RoomTypesValues,isRequired:!0},null==e?void 0:e.typeOfObject),I({label:"Entrance",name:"entrance",isRequired:!0},null==e?void 0:e.entrance),I({name:"hasIntercom",label:"Intercom",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasIntercom),I({name:"intercomCode",label:"Intercom code",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasIntercom"},null==e?void 0:e.intercomCode),I({name:"hasGate",label:"Gate",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasGate),I({name:"gateCode",label:"Gate code",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasGate"},null==e?void 0:e.gateCode),I({name:"parkingType",label:"Parking",variant:"select",options:r.ParkingTypesValues},null==e?void 0:e.parkingType),I({name:"parkingNumber",label:"Parking number",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"parkingType"},null==e?void 0:e.parkingNumber)]},exports.getTelecommunicationsInfoStepFields=function(e){var n,t,i,o,a;return[I({name:"wifi.name",label:"Name of network"},null===(n=null==e?void 0:e.wifi)||void 0===n?void 0:n.name),I({name:"wifi.password",label:"WiFi password"},null===(t=null==e?void 0:e.wifi)||void 0===t?void 0:t.password),I({name:"internetProvider.link",label:"Link to provider",size:12},null===(i=null==e?void 0:e.internetProvider)||void 0===i?void 0:i.link),I({name:"internetProvider.login",label:"Login"},null===(o=null==e?void 0:e.internetProvider)||void 0===o?void 0:o.login),I({name:"internetProvider.password",label:"Password"},null===(a=null==e?void 0:e.internetProvider)||void 0===a?void 0:a.password),I({name:"tvType",label:"Television",variant:"select",options:r.TVTypesValues},null==e?void 0:e.tvType),I({name:"homePhone",label:"Home phone",variant:"phone"},null==e?void 0:e.homePhone)]},exports.getTransferDocumentsFields=function(e,n,t){return q(q(q(q([I({label:"Transfer inspection file",name:"transferAct",variant:"file"},null==t?void 0:t.transferAct)],i.addToArrayByCondition("maroom_tenant"===e&&!n,I({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==t?void 0:t.signedContract)),!0),i.addToArrayByCondition("tenant_maroom"===e,I({label:"Contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),i.addToArrayByCondition("maroom_landlord"===e,I({label:"Contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),"tenant_landlord"===e?[I({label:"Rental contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.rcTerminationAgreement),I({label:"Service contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.scTerminationAgreement)]:[],!0)},exports.getTransferDocumentsSchema=function(e,n){return b.object().shape(I(I(I(I({transferAct:b.mixed()},"maroom_tenant"!==e||n?{}:{signedContract:b.mixed().required(r.defaultRequiredMessage)}),"tenant_maroom"===e?{rcTerminationAgreement:b.mixed().required(r.defaultRequiredMessage)}:{}),"maroom_landlord"===e?{scTerminationAgreement:b.mixed().required(r.defaultRequiredMessage)}:{}),"tenant_landlord"===e?{rcTerminationAgreement:b.mixed().required(r.defaultRequiredMessage),scTerminationAgreement:b.mixed().required(r.defaultRequiredMessage)}:{}))},exports.getWaterMeterFields=function(e,n,t,r,i){var o=r?"".concat(r,"."):"",a=!n||!(null==n?void 0:n.isFilled)&&e.length?null==e?void 0:e.map((function(e){return{value:e.number,label:"".concat(y.default.capitalize(e.type||"")," | #").concat(e.number)}})):[{value:n.number,label:"".concat(y.default.capitalize(n.type||"")," | #").concat(n.number)}];return[I({label:"Meter",name:"".concat(o,"number"),variant:"select",options:a,size:12,isRequired:!0,disabled:1===a.length},null==i?void 0:i.meter),{name:"".concat(o,"value"),variant:"custom",CustomInput:R,prefixName:o,meters:e,settings:i,withCheckValue:t,meter:n}]},exports.inspectionsRequestBody=M,exports.inspectionsRequests=A,exports.onInspectionModalClose=function(e,n,t){var r=e.inspectionsStore,o=n.formStateName,a=n.formFieldsName;r.setCanUpdateDB(!1),r.creationForm.resetForm(),i.clearIndexStores(r.indexDB,[o,a]),t&&t()},exports.onInspectionModalOpen=function(e,n,t){var r=e.inspectionsStore,o=e.apartmentId,a=n.formStateName,s=n.formFieldsName,l=r.creationForm.fields;l&&l.apartmentId!==o&&i.clearIndexStores(r.indexDB,[a,s]),r.setCanUpdateDB(!0),t&&t()},exports.renderMetersSteps=function(e,n,r){return q(q(q(q([],new Array(Number((null==r?void 0:r.water)||0)).fill("water"),!0),new Array(Number((null==r?void 0:r.electricity)||0)).fill("electricity"),!0),new Array(Number((null==r?void 0:r.gas)||0)).fill("gas"),!0),new Array(Number((null==r?void 0:r.heating)||0)).fill("heating"),!0).map((function(r,i){return[t.jsx(e,{index:i,resource:r},"meter_info_".concat(i)),t.jsx(n,{index:i,resource:r},"meter_photo_".concat(i))]}))},exports.useFillingList=on,exports.useInspectionData=function(e){var n,t=e.apartmentId,r=e.inspectionsStore,i=e.metersStore,o=e.fillingStore,a=l.useState(!1),s=a[0],u=a[1],d=l.useState(!1),c=d[0],m=d[1],p=r.creationForm,f=null===(n=p.fields)||void 0===n?void 0:n.type,v=f?"regular"===f||"transfer"===f:void 0,h=o.loader.isLoading,g=i.loader.isLoading;l.useEffect((function(){s&&c&&!h&&!g&&r.setCanLoadDB(!0)}),[s,c,h,g]),tn(p,i,v,(function(){return u(!0)})),on(t||null,p,o,v,(function(){return m(!0)}))},exports.useInspectionIndexDB=function(e,n,t){var r=e.dbCreationTime,o=e.formFieldsName,s=e.formStateName,u=e.inspectionCreationFormName,d=n.inspectionsStore,c=n.apartmentId,m=d.creationForm,p=d.actionLoader,f=d.indexDB,v=d.setCanUpdateDB,h=d.canUpdateDB,g=u,b=function(e){i.addIndexDBStore(e,o),i.addIndexDBStore(e,s)};var y=function(){return C(void 0,void 0,void 0,(function(){return S(this,(function(e){return i.initIndexDB(g,b,p,(function(e){return C(void 0,void 0,void 0,(function(){var n;return S(this,(function(l){switch(l.label){case 0:return d.setIndexDB(e),v(!1),u=localStorage.getItem(r),f=Date.now(),u&&f-Number(u)>864e5&&(i.clearIndexStores(d.indexDB,[s,o]),localStorage.removeItem(r)),[4,i.readFromIndexDB(e,o,p)];case 1:return(n=l.sent())?(null==n?void 0:n.apartmentId)===c&&(m.updateFormFields(I(I({},n),{date:n.date?a.DateTime.fromISO(n.date):null})),t&&t()):v(!0),[2]}var u,f}))}))})),[2]}))}))};l.useEffect((function(){c&&y()}),[c]),l.useEffect((function(){d.canLoadDB&&f&&C(void 0,void 0,void 0,(function(){var e,n;return S(this,(function(t){switch(t.label){case 0:return[4,i.readFromIndexDB(f,s,p)];case 1:return e=t.sent(),[4,i.readFromIndexDB(f,o,p)];case 2:return n=t.sent(),e&&(null==n?void 0:n.apartmentId)===c&&m.setStep(Number(e.step)),v(!0),[2]}}))}))}),[d.canLoadDB,f]),l.useEffect((function(){if(h){var e={step:m.step};i.addToIndexDBWithQueue(f,s,e,p),i.addToIndexDBWithQueue(f,o,m.fields,p),localStorage.getItem(r)||localStorage.setItem(r,Date.now().toString())}}),[m.step])},exports.useMetersValues=tn;
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("yup"),n=require("lodash"),t=require("react/jsx-runtime"),r=require("kui-crm"),i=require("kui-utils"),o=require("await-to-js"),a=require("luxon"),s=require("kui-complex"),l=require("react"),u=require("react-hook-form"),d=require("kui-basic"),c=require("@hookform/resolvers/yup"),m=require("@emotion/styled"),p=require("kui-icon"),f=require("mobx-react"),v=require("mobx");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function g(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var b=g(e),y=h(n),x=h(o),_=h(m),I=function(){return I=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},I.apply(this,arguments)};function w(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}function C(e,n,t,r){return new(t||(t=Promise))((function(i,o){function a(e){try{l(r.next(e))}catch(e){o(e)}}function s(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((r=r.apply(e,n||[])).next())}))}function S(e,n){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function q(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i<o;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return e.concat(r||Array.prototype.slice.call(n))}function N(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e}var P,T,j,F,k=function(e){var n,i,o=e.form,a=e.prefixName,s=e.settings,l=e.meters,u=e.withCheckValue,d=e.meter,c=o.watch("".concat(a,"number")),m=(null==d?void 0:d.isFilled)?d:null==l?void 0:l.find((function(e){return e.number===c}));return t.jsx(r.NumberField,I({isRequired:!u,label:"Value",name:"".concat(a,"value"),maxIntegerPart:7,maxDecimalPart:3,warningMessage:"There are deviations in meter readings. It should be no more than",form:o,maxValue:(null===(n=null==m?void 0:m.maxValue)||void 0===n?void 0:n.value)&&u?Number(m.maxValue.value):null,placeholder:null===(i=null==m?void 0:m.values)||void 0===i?void 0:i.value},null==s?void 0:s.value))},R={getPostBodyInitialInspection:function(e,n){return{based_on:null,date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"initial",dropbox_link:e.dropboxLink,photo_groups:n,initial:this.getInitialInspectionFields(e)}},getInitialInspectionFields:function(e){var n,t,r;return{city:e.city.id,address:e.apartment.address,apartment_number:e.apartmentNumber||"",post_index:e.zipCode,floor:e.floor,floor_count:e.floorCount,room_type:e.typeOfObject,num_entrance:e.entrance,has_intercom:e.hasIntercom,intercom_code:e.intercomCode,has_gate:e.hasGate,gate_code:e.gateCode,area:e.area,rooms_number:e.roomsNumber,bedrooms_number:e.bedroomsNumber,bathrooms_number:e.bathroomsNumber,restrooms_number:e.restroomsNumber,combined_bathrooms_number:e.combinedBathroomsNumber,number_of_windows:e.numberOfWindows,renovation_year:null===(n=e.renovation)||void 0===n?void 0:n.year,renovation_type:null===(t=e.renovation)||void 0===t?void 0:t.type,renovation_style:null===(r=e.renovation)||void 0===r?void 0:r.style,wall_type:e.wallMaterial,overlap_type:e.overlapType,passenger_elevators_number:e.passengerElevatorsCount,service_elevators_number:e.serviceElevatorsCount,ceiling_height:e.ceilingHeight,building_year:e.buildingYear,serial_number:e.houseNumber,type_gas:e.gasLeads,hot_water:e.withHotWater,type_houses:e.typeOfHouse,parking_type:e.parkingType,parking_number:e.parkingNumber,rooms:e.rooms.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n}})),used_resources:{electricity:e.availableResources.electricity,water:e.availableResources.water,gas:e.availableResources.gas,heating:e.availableResources.heating}}},getPostBodyRegularInspection:function(e,n){return{date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"regular",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,regular:I(I({},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getPostBodyTransferInspection:function(e,n,t){return{date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"transfer",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,transfer:I(I({inspection_document:t.transferAct||void 0,rental_contract_signed_document:t.rentalContractFile||void 0,rental_contract_termination_document:t.rentalTerminationAgreement||void 0,service_contract_termination_document:t.serviceTerminationAgreement||void 0,transfer_type:e.transferType},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getInspectionFilling:function(e){var n;return{filling:null===(n=null==e?void 0:e.filter((function(e){return e})))||void 0===n?void 0:n.map((function(e){return{apartment_feature_id:e.id,is_absent:!e.check}}))}},getPartialInspectionMeters:function(e){var n=this;return{meters:(null==e?void 0:e.map((function(e,t){return{id:e.id,resource_type:e.resource,meter_type:e.type,passport_number:e.number,photos:n.getFilesParams(e.images),values:i.clearNotValidFields(n.getInspectionMeterValues(e))}})))||[]}},getPostBodyInventoryInspection:function(e,n,t,r,o,s){var l,u,d,c,m,p,f,v,h,g,b,y,x=this;return{date:(e.date||a.DateTime.now()).toISODate(),inspection_type:"inventory",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,inventory:I({inspection_document:o||void 0,service_contract_signed_document:s||void 0,allowed_children:e.withChildren,allowed_pets:e.withPets,allowed_smoking:e.withSmoking,additional_terms:e.additionalTerms,country_of_residence:(null===(l=e.countryOfResidence)||void 0===l?void 0:l.id)||null,administrative_company:(null===(u=e.company)||void 0===u?void 0:u.id)||null,tax_type:e.taxesType,financial_personal_account:e.communalServicesAccount,max_electricity_counters:null===(d=e.maxMeters)||void 0===d?void 0:d.electricity,max_gas_counters:null===(c=e.maxMeters)||void 0===c?void 0:c.gas,max_heating_counters:null===(m=e.maxMeters)||void 0===m?void 0:m.heating,max_water_counters:null===(p=e.maxMeters)||void 0===p?void 0:p.water,has_barrier:e.hasBarrier,has_concierge:e.hasConcierge,has_security:e.hasSecurity,has_video_surveillance:e.hasVideoControl,barrier_phone:e.barrierPhone?i.getPhoneNumberFromPhoneParams(e.barrierPhone):null,concierge_phone:e.conciergePhone?i.getPhoneNumberFromPhoneParams(e.conciergePhone):null,security_phone:e.securityPhone?i.getPhoneNumberFromPhoneParams(e.securityPhone):null,video_surveillance_phone:e.videoControlPhone?i.getPhoneNumberFromPhoneParams(e.videoControlPhone):null,home_phone:e.homePhone?i.getPhoneNumberFromPhoneParams(e.homePhone):null,wifi_name:null===(f=e.wifi)||void 0===f?void 0:f.name,wifi_password:null===(v=e.wifi)||void 0===v?void 0:v.password,internet_provider_link:null===(h=e.internetProvider)||void 0===h?void 0:h.link,internet_provider_login:null===(g=e.internetProvider)||void 0===g?void 0:g.login,internet_provider_password:null===(b=e.internetProvider)||void 0===b?void 0:b.password,payer_code:e.payerCode,rooms:null===(y=e.rooms)||void 0===y?void 0:y.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n,area:e.area}})),filling:e.fillingList.map((function(e,n){var r;return{feature:(null===(r=e.tag)||void 0===r?void 0:r.id)||0,description:e.description,model:e.name,serial_code:e.serialNumber,amount:e.numberOfSubjects,photos:x.getFilesParams(e.images),instruction:t[n]}}))},this.getInventoryInspectionMeters(e.meters,r))}},getInventoryInspectionMeters:function(e,n,t){var r=this;return{meters:(null==e?void 0:e.map((function(e,o){return I(I({},r.getMeterCommonFields(e)),{passport:n[o],values:i.clearNotValidFields(r.getInspectionMeterValues(e,"initialValue")),photos:t?t[o]:r.getFilesParams(e.images),no_tariff:e.noTariff,auto_sending:e.withAutoSending})})))||[]}},getInspectionMeterValues:function(e,n){var t;if("electricity"===e.resource){var r=n||"",i=e["".concat(r,"T1")],o=e["".concat(r,"T2")],a=e["".concat(r,"T3")];return{T1:i?Number(i):i,T2:o?Number(o):o,T3:a?Number(a):a}}var s=n||"value";if("water"===e.resource){if("cold"===e.type){var l=e[s];return{cold:l?Number(l):l}}var u=e[s];return{hot:u?Number(u):u}}var d=e[s];return(t={})[e.resource]=d?Number(d):d,t},getMeterCommonFields:function(e){var n;return{id:e.id,meter_type:e.type,passport_number:e.number,resource_type:e.resource,activation_date:(null===(n=e.startDate)||void 0===n?void 0:n.toISODate())||null}},getMeterValues:function(e,n){return i.clearNotValidFields({initial_value:e,last_value:n})},getFilesParams:function(e){return(null==e?void 0:e.map((function(e){return e.uploadedData})).filter((function(e){return e})))||[]}},M={createInspectionHandler:function(e,n,t,i){return C(this,void 0,void 0,(function(){var o,a,s;return S(this,(function(l){switch(l.label){case 0:if(!e)return[3,5];n.startLoading("inspection creation"),o=void 0,l.label=1;case 1:return l.trys.push([1,3,,4]),[4,i()];case 2:return o=l.sent(),[3,4];case 3:return a=l.sent(),(s=r.KUISettings.getSettings().Sentry).withScope((function(e){e.setExtras(t),s.captureException(new Error("Ошибка в генерации тела запроса при создании инспекции"))})),n.setError("Некорректное тело запроса",a),n.endLoading(),[3,4];case 4:return o?[2,this.createInspection(e,o,n)]:[2,null];case 5:return[2,null]}}))}))},getInspectionTypes:function(e){return C(this,void 0,void 0,(function(){var n,t,i;return S(this,(function(o){switch(o.label){case 0:return[4,x.default(r.requests.get("/apartments/".concat(e,"/inspection-types")))];case 1:return n=o.sent(),t=n[0],i=n[1],t?[2,[t,void 0]]:[2,[null,null==i?void 0:i.inspection_types]]}}))}))},getTransferTypes:function(e){return C(this,void 0,void 0,(function(){var n,t,i;return S(this,(function(o){switch(o.label){case 0:return[4,x.default(r.requests.get("/apartments/".concat(e,"/transfer-inspection-types")))];case 1:return n=o.sent(),t=n[0],i=n[1],t?[2,[t,void 0]]:[2,[null,null==i?void 0:i.transfer_inspection_types]]}}))}))},createInspection:function(e,n,t){var o;return C(this,void 0,void 0,(function(){var a;return S(this,(function(s){switch(s.label){case 0:return[4,x.default(r.requests.post("/apartments/".concat(e,"/inspections"),n))];case 1:return a=s.sent(),i.resHandler(a,t),[2,null===(o=a[1])||void 0===o?void 0:o.id]}}))}))},createInitialInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var r=this;return S(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return C(r,void 0,void 0,(function(){var n;return S(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,R.getPostBodyInitialInspection(e,n)]}))}))}))]}))}))},createRegularInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var r=this;return S(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return C(r,void 0,void 0,(function(){var n;return S(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,R.getPostBodyRegularInspection(e,n)]}))}))}))]}))}))},createTransferInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var i=this;return S(this,(function(o){return[2,this.createInspectionHandler(n,t,e,(function(){return C(i,void 0,void 0,(function(){var n,i;return S(this,(function(o){switch(o.label){case 0:return n=this.getRoomParams(e.roomsImages),[4,r.uploadFilesWithoutFilter(t,[e.transferAct,e.signedContract,e.rcTerminationAgreement,e.scTerminationAgreement])];case 1:return i=o.sent(),[2,R.getPostBodyTransferInspection(e,n,{transferAct:i[0],rentalContractFile:i[1],rentalTerminationAgreement:i[2],serviceTerminationAgreement:i[3]})]}}))}))}))]}))}))},createInventoryInspection:function(e,n,t){return C(this,void 0,void 0,(function(){var o=this;return S(this,(function(a){return[2,this.createInspectionHandler(n,t,e,(function(){return C(o,void 0,void 0,(function(){var n,o,a,s,l;return S(this,(function(u){switch(u.label){case 0:return n=e.fillingList.map((function(e){return e.instruction})),o=(null===(l=e.meters)||void 0===l?void 0:l.map((function(e){return e.passportFile})))||[],[4,i.callPromises([r.uploadFiles(t,n),r.uploadFiles(t,o),r.uploadNewFile(t,e.inventoryAct),r.uploadNewFile(t,e.signedContract)])];case 1:return a=u.sent(),s=this.getRoomParams(e.roomsImages),[2,R.getPostBodyInventoryInspection(e,s,a[0],a[1],a[2],a[3])]}}))}))}))]}))}))},getRoomParams:function(e){var n,t=-1;return(null===(n=null==e?void 0:e.map((function(e){var n="room"===e.type||"bedroom"===e.type;return n&&(t+=1),{purpose:null==e?void 0:e.type,comment:null==e?void 0:e.comment,photos:R.getFilesParams((null==e?void 0:e.files)||[]),room_order_number:n?t:void 0}})))||void 0===n?void 0:n.filter((function(e){return e.purpose})))||[]}},A={getApartmentDescriptionInfo:function(e){return I(I(I(I(I(I({},this.getApartmentMainInfo(e)),this.getApartmentSecurityInfo(e)),this.getApartmentDetailInfo(e)),this.getApartmentTelecommunicationInfo(e)),this.getApartmentHouseInfo(e)),this.getMaxMetersParams(e))},getApartmentMainInfo:function(e){return I(I({},e),{apartmentNumber:e.apartment_number,zipCode:e.post_index||"",floorCount:e.floor_count,entrance:e.num_entrance,geolocation:this.getGeolocationParams(e.geolocation),distanceToCenter:e.distance_to_center_kilometers||null,typeOfObject:e.room_type})},getApartmentSecurityInfo:function(e){var n,t,r,o,a,s;return{hasIntercom:null!==(n=e.has_intercom)&&void 0!==n?n:null,hasGate:null!==(t=e.has_gate)&&void 0!==t?t:null,hasBarrier:null!==(r=e.has_barrier)&&void 0!==r?r:null,hasSecurity:null!==(o=e.has_security)&&void 0!==o?o:null,hasConcierge:null!==(a=e.has_concierge)&&void 0!==a?a:null,hasVideoControl:null!==(s=e.has_video_surveillance)&&void 0!==s?s:null,intercomCode:e.intercom_code||"",gateCode:e.gate_code||"",barrierPhone:e.barrier_phone?i.getPhoneParamsFromString(e.barrier_phone):null,conciergePhone:e.concierge_phone?i.getPhoneParamsFromString(e.concierge_phone):null,securityPhone:e.security_phone?i.getPhoneParamsFromString(e.security_phone):null,videoControlPhone:e.video_surveillance_phone?i.getPhoneParamsFromString(e.video_surveillance_phone):null}},getApartmentDetailInfo:function(e){var n;return{area:e.area,livingArea:e.living_area,kitchenArea:e.kitchen_area,roomsNumber:e.rooms_number,bedroomsNumber:e.bedrooms_number,bathroomsNumber:e.bathrooms_number,restroomsNumber:e.restrooms_number,combinedBathroomsNumber:e.combined_bathrooms_number,ceilingHeight:e.ceiling_height,numberOfWindows:e.number_of_windows,renovation:{year:e.renovation_year||null,type:e.renovation_type||null,style:e.renovation_style||null},rooms:(null===(n=e.rooms)||void 0===n?void 0:n.map((function(e){return{id:e.id,area:e.area||null,type:e.room_type||null}})))||[]}},getApartmentTelecommunicationInfo:function(e){return{homePhone:e.home_phone?i.getPhoneParamsFromString(e.home_phone):null,wifi:{name:e.wifi_name,password:e.wifi_password},internetProvider:{link:e.internet_provider_link,login:e.internet_provider_login,password:e.internet_provider_password},tvType:e.tv_type}},getApartmentHouseInfo:function(e){return{typeOfHouse:e.type_houses,buildingYear:e.building_year,houseNumber:e.serial_number,wallMaterial:e.wall_type,overlapType:e.overlap_type,parkingType:e.parking_type,parkingNumber:e.parking_number,passengerElevatorsCount:e.passenger_elevators_number?Number(e.passenger_elevators_number):null,serviceElevatorsCount:e.service_elevators_number?Number(e.service_elevators_number):null,gasLeads:e.type_gas,withHotWater:e.hot_water}},getMaxMetersParams:function(e){return{maxMeters:{water:e.max_water_counters,electricity:e.max_electricity_counters,gas:e.max_gas_counters,heating:e.max_heating_counters}}},getGeolocationParams:function(e){return e?{lat:Number(e.lat),lng:Number(e.lon)}:null},getObjectRoomsImages:function(e){return e.map((function(e){return{id:e.id,type:e.purpose,comment:e.comment,images:e.photos.map((function(e){return r.ImageStore.initFromImageModel(e)})),roomNumber:"number"==typeof e.room_order_number?e.room_order_number+1:0}}))},getInspectionFillingParams:function(e,n){var t;return I({id:e.id,name:e.description||"",tag:{id:e.feature.id,name:e.feature.name},images:null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return r.ImageStore.initFromImageModel(e)})),serialNumber:e.serial_code,numberOfSubjects:Number(e.amount),instruction:e.instruction?r.FileStore.initFromDocumentModel(e.instruction):null,type:r.matchesAPIFillingTypes[e.feature.feature_type]},n&&"appliance"===e.feature.feature_type?{check:!e.is_absent,wasMissing:e.previously_absent}:{})},getApartmentDescriptionWithMetro:function(e){return I(I({},this.getApartmentDescriptionInfo(e)),{metroStations:this.getMetroStationsParams(null==e?void 0:e.metro_stations)})},getMetroStationsParams:function(e){return(null==e?void 0:e.map((function(e){return{id:e.metro_station_id,name:e.name,walkDistance:e.distance_walk_meters,carDistance:Number(e.distance_car_kilometers),carTime:e.time_car_minutes,walkTime:Math.round(e.distance_walk_meters/(5e3/60))}})))||[]},getMeterValues:function(e,n,t){var r,i,o,a,s,l;if("electricity"===n){var u=t||"";return I(I(((r={})["".concat(u,"T1")]=Number(e.values.T1),r),"T1"!==e.meter_type&&((i={})["".concat(u,"T2")]=Number(e.values.T2),i)),"T3"===e.meter_type&&((o={})["".concat(u,"T3")]=Number(e.values.T3),o))}var d=t||"value";return"water"===n?"cold"===e.meter_type?((a={})["".concat(d)]=Number(e.values.cold),a):((s={})["".concat(d)]=Number(e.values.hot),s):((l={})["".concat(d)]=Number(e.values[n]),l)},getTransferMetersInfo:function(e){var n=this;return{meters:e.map((function(e){var t;return I({id:e.id,type:e.meter_type,number:e.passport_number,resource:e.resource_type,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return r.ImageStore.initFromImageModel(e)})))||[],values:n.getMeterValues(e,e.resource_type)},n.getMeterValues(e,e.resource_type))}))}},getApartmentPaymentInfo:function(e){return{payerCode:e.payer_code,communalServicesAccount:e.financial_personal_account,managementCompany:e.administrative_company?I(I({},e.administrative_company),{operatingAccount:e.payer_code}):null}},getInspectionPaymentInfo:function(e){return I(I({},this.getApartmentPaymentInfo(e)),{countryOfResidence:e.country_of_residence,taxesType:e.tax_type})},getMeterInfo:function(e,n){var t;return{id:e.id,type:e.meter_type,number:e.passport_number,startDate:e.activation_date?a.DateTime.fromISO(e.activation_date):null,company:e.company,operationalAccountNumber:e.operating_account,resource:n,tariff:e.tariff?{id:e.tariff.id,name:e.tariff.code_name}:null,passportFile:e.passport?r.FileStore.initFromFileModel(e.passport):null,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return r.ImageStore.initFromImageModel(e)})))||[]}},getInventoryMetersInfo:function(e){var n=this;return{meters:e.meters.map((function(e){return I(I({},n.getMeterInfo(e,e.resource_type)),n.getMeterValues(e,e.resource_type,"initialValue"))}))}}},B={apartment:b.object({address:b.string().trim().required("This field is required")}),apartmentNumber:b.string().required("This field is required"),city:b.object({name:b.string().required("This field is required")})},O=b.object(B),D={passengerElevatorsCount:r.positiveNumberSchema,serviceElevatorsCount:r.positiveNumberSchema,typeOfHouse:b.string().required(r.defaultRequiredMessage),buildingYear:b.string().required(r.defaultRequiredMessage),wallMaterial:b.string().required(r.defaultRequiredMessage),overlapType:b.string().required(r.defaultRequiredMessage),gasLeads:b.string().required(r.defaultRequiredMessage),withHotWater:b.boolean().required(r.defaultRequiredMessage)},L=b.object(D),V={step:.01},W={area:b.number().positive().required("This field is required"),rooms:b.array().of(b.object({type:b.string().required("This field is required")})),numberOfWindows:b.number().min(0).required("This field is required"),renovation:b.object({year:b.number().positive().required("This field is required"),type:b.string().required("This field is required"),style:b.string().required("This field is required")}),ceilingHeight:r.positiveNumberSchema},z=b.object(W),H={floor:b.number().integer().min(0).test("is less than floorCount","Too much",(function(e){return e<=this.parent.floorCount})),floorCount:b.number().integer().positive().required("This field is required"),roomsNumber:b.number().integer().min(0).required("This field is required"),bedroomsNumber:b.number().integer().min(0).required("This field is required"),bathroomsNumber:b.number().integer().min(0).required("This field is required"),restroomsNumber:b.number().integer().min(0).required("This field is required"),combinedBathroomsNumber:b.number().integer().min(0).required("This field is required")},G=b.object(H),E={typeOfObject:b.string().required("This field is required"),entrance:b.string().required("This field is required"),hasIntercom:b.string().required("This field is required"),intercomCode:r.fieldWithConditionSchema("hasIntercom"),hasGate:b.string().required("This field is required"),gateCode:r.fieldWithConditionSchema("hasGate")},U=b.object(E),Y={size:"s"},K={taxesType:b.string().required(r.defaultRequiredMessage),countryOfResidence:b.object({name:b.string().required(r.defaultRequiredMessage)}),company:b.object({name:b.string().required(r.defaultRequiredMessage)})},Q=b.object(K),Z={hasBarrier:b.string().required(r.defaultRequiredMessage),barrierPhone:r.phoneWithConditionSchema("hasBarrier"),hasConcierge:b.string().required(r.defaultRequiredMessage),conciergePhone:r.phoneWithConditionSchema("hasConcierge"),hasSecurity:b.string().required(r.defaultRequiredMessage),securityPhone:r.phoneWithConditionSchema("hasSecurity"),hasVideoControl:b.string().required(r.defaultRequiredMessage),videoControlPhone:r.phoneWithConditionSchema("hasVideoControl")},J=b.object(Z),X=r.getNumbersValues(7),$={maxMeters:b.object({water:r.positiveNumberSchema,electricity:r.positiveNumberSchema,gas:r.positiveNumberSchema,heating:r.positiveNumberSchema})},ee=b.object($),ne={homePhone:r.phoneNonRequiredSchema("homePhone")},te=b.object().shape(ne,[["homePhone","homePhone"]]),re=b.object().shape({type:b.string(),tag:b.object({name:b.string().required(r.defaultRequiredMessage)}),name:b.string().when("type",{is:function(e){return"electronics"===e},then:function(e){return e.required(r.defaultRequiredMessage)}})}),ie={number:b.string().required("This field is required")},oe=function(e){var n=r.getMeterValuesFieldsSchema(e);return b.object().shape(I(I({},ie),Object.assign.apply(Object,q([{}],n,!1))))},ae=function(e,n){return q(q([],r.basicFieldsOfNewResourceMeter(e,n),!0),[I({label:"Activation date",name:"startDate",variant:"date",max:a.DateTime.now()},null==n?void 0:n.startDate),I({label:"Passport",name:"passportFile",variant:"custom",CustomInput:s.InputFile},null==n?void 0:n.passportFile)],!1)},se=function(e){var n=e.meter,i=e.getMeterLabel,o=n.resource,a=n.type,s=n.number,l=[n.initialValue,n.initialValueT1,n.initialValueT2,n.initialValueT3].filter((function(e){return void 0!==e})).map((function(e){return e})).join(" / "),u=i?i(o,a):y.default.capitalize("".concat(a?"".concat(a," "):"").concat(o," meter"));return t.jsxs(d.Caption,I({"data-testid":"addedMeterLine",size:"s"},{children:["• ",u," #",s," -"," ",t.jsxs(le,{children:[l," ",r.meterUnitLabel[n.resource]]})]}))},le=_.default.span(P||(P=N(["\n font-weight: 600;\n"],["\n font-weight: 600;\n"]))),ue=function(e){var n,r,i=e.resource,o=e.formStore,a=e.label,s=e.getMeterLabel,l=null===(r=null===(n=o.fields)||void 0===n?void 0:n.meters)||void 0===r?void 0:r.filter((function(e){return e.resource===i}));return(null==l?void 0:l.length)?t.jsxs(de,I({"data-testid":"addedMetersBlock"},{children:[t.jsxs(me,I({container:!0,alignItems:"center"},{children:[t.jsx(ce,{}),t.jsx(d.Caption,I({size:"s",color:"fiftyP"},{children:a||"In the previous steps were added:"}))]})),l.map((function(e){return t.jsx(se,{getMeterLabel:s,meter:e},e.number)}))]})):null},de=_.default.div(T||(T=N(["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"],["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"])),d.theme.palette.grey.fifteenB),ce=_.default(p.WarningIcon)(j||(j=N(["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"],["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"])),d.theme.palette.brand.main),me=_.default(d.Grid)(F||(F=N(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"])));var pe,fe,ve,he,ge,be,ye,xe,_e,Ie,we,Ce,Se,qe,Ne,Pe,Te,je,Fe,ke,Re,Me,Ae,Be={rooms:b.array().of(b.object({area:b.number().positive().required(r.defaultRequiredMessage).transform((function(e){return Number.isNaN(e)?void 0:e}))}))},Oe=b.object(Be),De=function(e){var n=e.feedback,i=e.label;return t.jsx(Le,I({status:n.status},{children:t.jsxs(d.Grid,I({container:!0,alignItems:"center"},{children:[t.jsx(d.Caption,I({size:"s",weight:500,color:"fiftyP"},{children:i})),"notSigned"!==n.status&&t.jsxs(Ve,{children:["signed"===n.status?t.jsx(We,{}):t.jsx(ze,{}),!!n.comment&&t.jsx(r.Tooltip,I({placement:"bottom",content:t.jsxs("div",{children:[t.jsx(d.Caption,I({size:"xs",color:"fiftyP"},{children:"Comment"})),t.jsx(He,I({size:"xs"},{children:n.comment}))]})},{children:t.jsx(Ge,{})}))]})]}))}))},Le=_.default.div(pe||(pe=N(["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"],["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"])),(function(e){return"notSigned"===e.status?d.theme.palette.background.light1:d.theme.palette.grey.zero}),d.theme.palette.grey.fifteenB,d.theme.breakpoints.sm),Ve=_.default.div(fe||(fe=N(["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"],["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"]))),We=_.default(p.CheckIcon)(ve||(ve=N(["\n path {\n fill: ",";\n }\n"],["\n path {\n fill: ",";\n }\n"])),d.theme.palette.green.fiftyP),ze=_.default(p.CancelIcon)(he||(he=N(["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"],["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"])),d.theme.palette.red.fiftyP),He=_.default(d.Caption)(ge||(ge=N(["\n margin-top: 8px;\n"],["\n margin-top: 8px;\n"]))),Ge=_.default(p.CommentIcon)(be||(be=N(["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"],["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"])),d.theme.palette.grey.zero,d.theme.palette.grey.thirty),Ee=f.observer((function(e){var n=e.feedback,r=e.label,i=e.resendLabel,o=e.resend;return n?t.jsx(d.Grid,I({item:!0},{children:t.jsxs(d.Grid,I({container:!0,alignItems:"center"},{children:[t.jsx(De,{feedback:n,label:r}),"rejected"===n.status&&t.jsx(Ue,I({size:"xs",variant:"orange",onClick:o,endIcon:t.jsx(p.UpdateIcon,{})},{children:i}))]}))})):null})),Ue=_.default(d.Button)(ye||(ye=N(["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"],["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"])),d.theme.breakpoints.sm),Ye=f.observer((function(e){var n=e.tenantFeedback,r=e.landlordFeedback,i=e.resignInspection,o=e.resendLabel,a=e.tenantLabel,s=e.landlordLabel;return n||r?t.jsxs(Ke,I({container:!0,spacing:2,alignItems:"center"},{children:[t.jsx(Ee,{resend:i,resendLabel:o,feedback:n,label:a}),t.jsx(Ee,{resend:i,resendLabel:o,feedback:r,label:s})]})):null})),Ke=_.default(d.Grid)(xe||(xe=N(["\n padding-top: 8px;\n"],["\n padding-top: 8px;\n"]))),Qe=function(e){var n=e.filling,i=e.warningLabel;return t.jsxs(d.Grid,I({container:!0,alignItems:"center"},{children:[n.wasMissing&&t.jsx(r.Tooltip,I({content:t.jsx(d.Caption,I({size:"xs"},{children:i}))},{children:t.jsx(Ze,{width:17,height:17})})),t.jsxs(Je,{children:[t.jsxs(d.Caption,I({size:"s"},{children:[n.tagName," ",n.name?" | ".concat(n.name):""]})),!(!n.numberOfSubjects&&!n.serialNumber)&&t.jsxs(Xe,I({size:"xs",color:"fiftyP"},{children:[n.numberOfSubjects?"".concat(n.numberOfSubjects," pieces"):"",n.numberOfSubjects&&n.serialNumber?" • ":"",n.serialNumber]}))]})]}))},Ze=_.default(p.WarningIcon)(_e||(_e=N(["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"],["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"])),d.theme.palette.red.fiftyP),Je=_.default.div(Ie||(Ie=N(["\n margin-left: 8px;\n"],["\n margin-left: 8px;\n"]))),Xe=_.default(d.Caption)(we||(we=N(["\n margin-top: 4px;\n"],["\n margin-top: 4px;\n"]))),$e=_.default(d.Grid)(Ce||(Ce=N(["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"],["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"]))),en=_.default(s.CheckboxWithController)(Se||(Se=N(["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"],["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"]))),nn=function(e,n,t,r){var i,o=function(){r&&r(),n.loader.endLoading()};l.useEffect((function(){C(void 0,void 0,void 0,(function(){var r,i;return S(this,(function(a){switch(a.label){case 0:return t?(null===(i=null===(r=e.fields)||void 0===r?void 0:r.meters)||void 0===i?void 0:i.length)?[3,2]:[4,n.fetchMeters()]:[3,3];case 1:a.sent(),a.label=2;case 2:return o(),[3,4];case 3:!1===t&&o(),a.label=4;case 4:return[2]}}))}))}),[t]),l.useEffect((function(){var t,r;n.loader.isLoading||(null===(r=null===(t=e.fields)||void 0===t?void 0:t.meters)||void 0===r?void 0:r.length)||!n.meters.length||(e.updateFormFields({meters:n.meters}),e.updateFormFields({metersFromStore:n.meters}))}),[n.meters,n.loader.isLoading]),l.useEffect((function(){var t,r;n.loader.isLoading||!(null===(r=null===(t=e.fields)||void 0===t?void 0:t.metersFromStore)||void 0===r?void 0:r.length)||n.meters.length||n.updateMetersFromForm(e.fields.metersFromStore)}),[null===(i=e.fields)||void 0===i?void 0:i.metersFromStore,n.loader.isLoading])},tn=function(){var e=this;this.fetchFillingList=function(n,t){return C(e,void 0,void 0,(function(){var e;return S(this,(function(o){switch(o.label){case 0:return this.loader.startLoading(),[4,x.default(r.ApartmentsAgent.getFillingList(n,t))];case 1:return e=o.sent(),i.resHandler(e,this.loader,this.updateFillingList),[2]}}))}))},this.updateFillingList=function(n){e.fillingList=(null==n?void 0:n.map((function(e){return{id:e.id,name:e.description,tagName:e.feature_name,serialNumber:e.serial_code,numberOfSubjects:e.amount,wasMissing:e.is_absent}})))||[]},this.fillingList=[],this.loader=new i.Loader,v.makeAutoObservable(this)},rn=function(e,n,t,r,i){var o=function(){i&&i(),t.loader.endLoading()};l.useEffect((function(){C(void 0,void 0,void 0,(function(){var i,a;return S(this,(function(s){switch(s.label){case 0:return r&&e?(null===(a=null===(i=n.fields)||void 0===i?void 0:i.fillingList)||void 0===a?void 0:a.length)?[3,2]:[4,t.fetchFillingList(e,"appliance")]:[3,3];case 1:s.sent(),s.label=2;case 2:return o(),[3,4];case 3:!1===r&&o(),s.label=4;case 4:return[2]}}))}))}),[e,r]),l.useEffect((function(){var e,r;t.loader.isLoading||(null===(r=null===(e=n.fields)||void 0===e?void 0:e.fillingList)||void 0===r?void 0:r.length)||n.updateFormFields({fillingList:t.fillingList.map((function(e){return I(I({},e),{check:!1})}))})}),[t.fillingList,t.loader.isLoading])},on=function(e){var n=e.label,r=e.onClick,i=e.isActive;return t.jsx(d.Button,I({size:"xs",variant:i?"primary":"white",onClick:r},{children:n}))},an=function(e){var n=e.metroStation,r=n.color,i=n.name;return t.jsxs(sn,I({item:!0,container:!0,alignItems:"center"},{children:[t.jsx(ln,{style:{background:r}}),t.jsx(d.Caption,I({size:"s",color:"sixty"},{children:i}))]}))},sn=_.default(d.Grid)(qe||(qe=N(["\n width: auto;\n"],["\n width: auto;\n"]))),ln=_.default.div(Ne||(Ne=N(["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"],["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"]))),un=function(e){var n=e.phone,r=i.getPhoneNumberFromPhoneParams(n," "),o=r.replace(/\d/g,"");return t.jsxs(dn,I({container:!0,alignItems:"center",wrap:"nowrap"},{children:[t.jsx(cn,{width:14,height:14}),t.jsx("a",I({href:"tel:+".concat(o)},{children:t.jsx(d.Caption,I({size:"s",weight:500,color:"sixty"},{children:r}))}))]}))},dn=_.default(d.Grid)(Pe||(Pe=N(["\n width: auto;\n"],["\n width: auto;\n"]))),cn=_.default(p.PhoneIcon)(Te||(Te=N(["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"],["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"])),d.theme.palette.grey.sixty),mn=function(e){var n=e.inspection,i=e.onClose,o=e.getClientLink,a=e.getInspectionLink,s=n.apartment,l=n.tenant,u=n.landlord,c=n.metroStations,m=l||u,f=o&&m?o(null==m?void 0:m.id):"",v=a(s.id,n.id);return t.jsxs(pn,{children:[t.jsx(r.Link,I({href:v},{children:t.jsx(fn,{imageSrc:s.previewImage,description:s.address})})),t.jsx(d.Grid,I({container:!0,spacing:2,alignItems:"center"},{children:c.map((function(e){return t.jsx(an,{metroStation:e},e.name)}))})),!!m&&t.jsxs(vn,I({container:!0,alignItems:"center",justify:"space-between"},{children:[f?t.jsx(gn,I({href:f},{children:t.jsx(r.UserBadge,{weight:500,user:m})})):t.jsx(r.UserBadge,{weight:500,user:m}),!!(null==m?void 0:m.phoneNumber)&&t.jsx(un,{phone:null==m?void 0:m.phoneNumber})]})),t.jsx(hn,I({isCircle:!0,size:"xs",variant:"whiteWithGray",onClick:i},{children:t.jsx(p.CloseIcon,{width:6,height:6})}))]})},pn=_.default.div(je||(je=N(["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"],["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"])),d.theme.palette.grey.zero),fn=_.default(r.PreviewContent)(Fe||(Fe=N(["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"],["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"]))),vn=_.default(d.Grid)(ke||(ke=N(["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"],["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"])),d.theme.palette.grey.fifteenB),hn=_.default(d.Button)(Re||(Re=N(["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"],["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"]))),gn=_.default(r.Link)(Me||(Me=N(["\n max-width: calc(100% - 140px);\n"],["\n max-width: calc(100% - 140px);\n"]))),bn=_.default.div(Ae||(Ae=N(["\n position: relative;\n"],["\n position: relative;\n"])));exports.AddedMetersBlock=ue,exports.AdditionalInfoFieldsSchema=K,exports.AdditionalInfoStepSchema=Q,exports.BasicApartmentInfoFieldsSchema=B,exports.BasicApartmentInfoStepSchema=O,exports.DetailApartmentInfoFieldsSchema=W,exports.DetailApartmentInfoStepSchema=z,exports.FillingInfoFieldsSchema=re,exports.FillingListStore=tn,exports.HouseInfoFieldsSchema=D,exports.HouseInfoStepSchema=L,exports.HouseServicesInfoFieldsSchema=Z,exports.HouseServicesInfoStepSchema=J,exports.InspectionFeedback=Ye,exports.InspectionFillingCard=function(e){var n=e.className,r=e.form,i=e.index,o=e.disabled,a=w(e,["className","form","index","disabled"]);return t.jsx($e,I({className:n},{children:t.jsx(en,{form:r,name:"fillingList.".concat(i,".check"),label:t.jsx(Qe,I({},a)),disabled:o})}))},exports.InventoryMeterInfoFields=function(e){var n,i,o=e.resource,a=e.index,s=e.formStore,m=null===(i=null===(n=s.fields)||void 0===n?void 0:n.meters)||void 0===i?void 0:i[a],p="water"===o||"electricity"===o,f=p?"water"===o?"cold":"T1":null,v=l.useState((null==m?void 0:m.type)||f),h=v[0],g=v[1],b=ae({resource:o,meterType:h}),y=b.filter((function(e){return"number"===e.type})).map((function(e){return e.name})),x=oe(y),_=l.useMemo((function(){return u.useForm({resolver:c.yupResolver(x),defaultValues:I({},m),values:m})}),[x]);return t.jsx(r.FormWrapper,I({form:_,onSubmit:function(e){s.replaceFieldInArray("meters",I(I({},e),{resource:o}),a),s.nextStep()},label:"Next",variant:"next",withPrevStep:!0,handlePrevClick:s.prevStep},{children:t.jsxs(d.Grid,I({container:!0,spacing:2},{children:[t.jsx(d.Grid,I({item:!0,xs:12},{children:t.jsx(ue,{formStore:s,resource:o})})),p&&t.jsx(d.Grid,I({item:!0,xs:12},{children:t.jsx(r.MeterTypeRadioGroup,{form:_,resource:o,handleChange:g})})),b.map((function(e){var n=e.size,i=w(e,["size"]);return t.jsx(d.Grid,I({item:!0,xs:n||6},{children:t.jsx(r.InputByType,I({form:_},i))}),i.name)}))]}))}))},exports.MetersInfoFieldsSchema=$,exports.MetersInfoStepSchema=ee,exports.ObjectForMapCard=mn,exports.ObjectForMapOverlay=function(e){var n=e.inspection,i=e.map,o=e.label,a=w(e,["inspection","map","label"]),s=r.useMapCards(n.location,i),l=s.ref,u=s.isOpen,d=s.closeCard,c=s.toggleCard;return t.jsx(r.MapOverlay,I({map:i,position:n.location},{children:t.jsxs(bn,I({ref:l},{children:[t.jsx(on,{label:o,isActive:u,onClick:c}),u&&t.jsx(mn,I({inspection:n,onClose:d},a))]}))}))},exports.ObjectForMapPoint=on,exports.RoomsApartmentInfoFieldsSchema=H,exports.RoomsApartmentInfoStepSchema=G,exports.RoomsInfoFieldsSchema=Be,exports.RoomsInfoStepSchema=Oe,exports.SecurityApartmentInfoFieldsSchema=E,exports.SecurityApartmentInfoStepSchema=U,exports.TelecommunicationsInfoFieldsSchema=ne,exports.TelecommunicationsInfoStepSchema=te,exports.apartmentFields=A,exports.getAdditionalInfoStepFields=function(e){return q([I({label:"Pets",name:"withPets",variant:"custom",CustomInput:s.CheckboxWithController,labelProps:Y},null==e?void 0:e.withPets),I({label:"Children",name:"withChildren",variant:"custom",CustomInput:s.CheckboxWithController,labelProps:Y},null==e?void 0:e.withChildren),I({label:"Smoking",name:"withSmoking",variant:"custom",CustomInput:s.CheckboxWithController,labelProps:Y},null==e?void 0:e.withSmoking),I({isTextArea:!0,placeholder:"other terms",name:"additionalTerms"},null==e?void 0:e.additionalTerms)],r.getApartmentPaymentFields(e),!0)},exports.getAvailableResourcesFields=function(e){return[I({label:"Water",name:"availableResources.water",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.water),I({label:"Electricity",name:"availableResources.electricity",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.electricity),I({label:"Gas",name:"availableResources.gas",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.gas),I({label:"Heating",name:"availableResources.heating",variant:"custom",CustomInput:r.BigCheckbox},null==e?void 0:e.heating)]},exports.getBasicApartmentInfoFields=function(e,n){return[I({name:"country",label:"Country",variant:"custom",CustomInput:r.CountryAutocomplete,size:12},null==n?void 0:n.country),I({name:"region",label:"Region",variant:"custom",CustomInput:r.RegionAutocomplete},null==n?void 0:n.region),I({name:"city",label:"City",variant:"custom",CustomInput:r.CityAutocomplete,isRequired:!0},null==n?void 0:n.city),I({name:"apartment",variant:"custom",CustomInput:r.InputWithAddressAutocomplete,handlePlaceSelect:e,size:12,isRequired:!0},null==n?void 0:n.apartment),I({label:"Apartment",name:"apartmentNumber","data-testid":"apartment_number",isRequired:!0},null==n?void 0:n.apartmentNumber),I({label:"Zip code",name:"zipCode"},null==n?void 0:n.zipCode)]},exports.getDetailApartmentInfoFields=function(e,n,t){var i,o;return q(q([I(I({label:"Total area",name:"area",type:"number",isRequired:!0},V),null==t?void 0:t.area)],e?new Array(Number(e)).fill(0).map((function(e,i){var o,a=n&&i<n?"Bedroom ".concat(i+1):"Room ".concat(i+1),s=n&&i<n?"bedrooms":"rooms";return[I({name:"rooms.".concat(i,".type"),label:"".concat(a," type"),variant:"select",options:r.RoomTypeValues,isRequired:!0},(null==t?void 0:t[s])?null===(o=t[s](i))||void 0===o?void 0:o.type:{})]})).flat():[],!0),[I(I({name:"ceilingHeight",label:"Ceiling height",type:"number",cornerLabel:"m.",isRequired:!0},V),null==t?void 0:t.ceilingHeight),I({name:"numberOfWindows",label:"Windows",type:"number",isRequired:!0},null==t?void 0:t.numberOfWindows),I({name:"renovation.year",label:"Year of last renovation",type:"number",isRequired:!0},null==t?void 0:t.renovation.year),I({name:"renovation.type",label:"Type of renovation",variant:"select",options:r.RenovationTypeValues,isRequired:!0},null===(i=null==t?void 0:t.renovation)||void 0===i?void 0:i.type),I({name:"renovation.style",label:"Renovation style",variant:"select",options:r.RenovationStyleValues,isRequired:!0},null===(o=null==t?void 0:t.renovation)||void 0===o?void 0:o.style)],!1)},exports.getFillingInfoFields=function(e,n,t,o){return q(q(q(q(q(q(q([],i.addToArrayByCondition(e,I({label:"Filling type",name:"type",variant:"select",options:r.FillingTypeValues,handleChange:t,isRequired:!0},null==o?void 0:o.type)),!0),[I({label:"Name (tag)",name:"tag",type:n,variant:"custom",CustomInput:r.FillingTagsAutocomplete,isRequired:!0},null==o?void 0:o.tag)],!1),i.addToArrayByCondition("finish"!==n,I({label:"Model",name:"name",isRequired:!0},null==o?void 0:o.name)),!0),i.addToArrayByCondition("finish"!==n,I({label:"Serial code",name:"serialNumber",size:6},null==o?void 0:o.serialNumber)),!0),i.addToArrayByCondition("finish"!==n,I({label:"Amount",name:"numberOfSubjects",type:"number",size:6},null==o?void 0:o.numberOfSubjects)),!0),[I({label:"Description",name:"description",isTextArea:!0},null==o?void 0:o.description)],!1),i.addToArrayByCondition("finish"!==n,I({label:"Instruction",name:"instruction",variant:"custom",CustomInput:r.InputFileWithVisibility},null==o?void 0:o.instruction)),!0)},exports.getHouseInfoStep=function(e){return[I({name:"typeOfHouse",label:"Type houses",variant:"select",options:r.HouseTypesValues,isRequired:!0},null==e?void 0:e.typeOfHouse),I({name:"houseNumber",label:"House series"},null==e?void 0:e.houseNumber),I({name:"wallMaterial",label:"Wall material",variant:"select",options:r.WallMaterialsValues,isRequired:!0},null==e?void 0:e.wallMaterial),I({name:"overlapType",label:"Overlap type",variant:"select",options:r.SlabsTypesValues,isRequired:!0},null==e?void 0:e.overlapType),I({name:"gasLeads",label:"Gas",variant:"select",options:r.GasTypesValues,isRequired:!0},null==e?void 0:e.gasLeads),I({name:"withHotWater",label:"Hot water",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.withHotWater),I({name:"passengerElevatorsCount",label:"Passenger elevators",type:"number",isRequired:!0},null==e?void 0:e.passengerElevatorsCount),I({name:"serviceElevatorsCount",label:"Service elevators",type:"number",isRequired:!0},null==e?void 0:e.serviceElevatorsCount),I({name:"buildingYear",label:"Builded",isRequired:!0},null==e?void 0:e.buildingYear)]},exports.getHouseServicesInfoStep=function(e){return[I({name:"hasBarrier",label:"Barrier",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasBarrier),I({name:"barrierPhone",label:"Barrier code",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasBarrier",Input:s.InputPhoneWithForm},null==e?void 0:e.barrierPhone),I({name:"hasConcierge",label:"Concierge",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasConcierge),I({name:"conciergePhone",label:"Concierge",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasConcierge",Input:s.InputPhoneWithForm},null==e?void 0:e.conciergePhone),I({name:"hasSecurity",label:"Security",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasSecurity),I({name:"securityPhone",label:"Security",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasSecurity",Input:s.InputPhoneWithForm},null==e?void 0:e.securityPhone),I({name:"hasVideoControl",label:"Video surveillance",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasVideoControl),I({name:"videoControlPhone",label:"Video surveillance",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasVideoControl",Input:s.InputPhoneWithForm},null==e?void 0:e.videoControlPhone)]},exports.getInventoryDocumentsFields=function(e,n){return q([I({label:"Inventory inspection file",name:"inventoryAct",variant:"file"},null==n?void 0:n.transferAct)],i.addToArrayByCondition(!e,I({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==n?void 0:n.signedContract)),!0)},exports.getInventoryDocumentsSchema=function(e){return b.object().shape(I({inventoryAct:b.mixed()},e?{}:{signedContract:b.mixed().required(r.defaultRequiredMessage)}))},exports.getInventoryMeterFields=ae,exports.getMetersInfoStepFields=function(e){var n,t,r,i;return[I({name:"maxMeters.water",label:"Water",variant:"select",options:X,isRequired:!0},null===(n=null==e?void 0:e.maxMeters)||void 0===n?void 0:n.water),I({name:"maxMeters.electricity",label:"Electricity",variant:"select",options:X,isRequired:!0},null===(t=null==e?void 0:e.maxMeters)||void 0===t?void 0:t.electricity),I({name:"maxMeters.gas",label:"Gas",variant:"select",options:X,isRequired:!0},null===(r=null==e?void 0:e.maxMeters)||void 0===r?void 0:r.gas),I({name:"maxMeters.heating",label:"Heating",variant:"select",options:X,isRequired:!0},null===(i=null==e?void 0:e.maxMeters)||void 0===i?void 0:i.heating)]},exports.getPartialMeterInfoSchema=function(e,n){var t=e.filter((function(e){return e.maxIntegerPart})).map((function(e){return e.name})),r=t.map((function(e){var t;return(t={})[e]=b.number().when(["withDefaultValue","values.".concat(e)],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).when([],{is:function(){return n},then:function(e){return e.required("This field is required")}}).transform((function(e){return Number.isNaN(e)?void 0:e})),t}));return b.object().shape(I({number:b.string().trim().required("This field is required"),withDefaultValue:b.boolean(),values:b.object(I({},Object.fromEntries(t.map((function(e){return[e,b.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()]})))))},Object.assign.apply(Object,q([{}],r,!1))))},exports.getRoomsApartmentInfoFields=function(e,n){return[I({label:"Floor",name:"floor",type:"number",isRequired:!0},null==n?void 0:n.floor),I({label:"Floors",name:"floorCount",type:"number",isRequired:!0},null==n?void 0:n.floorCount),I({label:"Rooms",name:"roomsNumber",type:"number",isRequired:!0},null==n?void 0:n.roomsNumber),I({label:"Bedrooms",name:"bedroomsNumber",type:"number",isRequired:!0,disabled:0===e||"0"===e},null==n?void 0:n.bedroomsNumber),I({label:"Bathrooms",name:"bathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.bathroomsNumber),I({label:"Restrooms",name:"restroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.restroomsNumber),I({label:"Combined bathroom",name:"combinedBathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.combinedBathroomsNumber)]},exports.getRoomsImagesSteps=function(e,n,t){return q(q(q(q(q(q(q(q(q(q([I({type:"kitchen"},n.kitchen)],new Array(Number((null==t?void 0:t.bedroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"bedroom"},n.bedroom((null==t?void 0:t.bedroomsNumber)?"".concat(r+1," "):"",null==t?void 0:t.rooms[r]))})),!0),new Array(Math.max(Number((null==t?void 0:t.roomsNumber)||0)-Number((null==t?void 0:t.bedroomsNumber)||0),0)).fill(0).map((function(e,r){return I({type:"room"},n.room((null==t?void 0:t.roomsNumber)?"".concat(r+1+((null==t?void 0:t.bedroomsNumber)||0)," "):"",null==t?void 0:t.rooms[((null==t?void 0:t.bedroomsNumber)||0)+r]))})),!0),new Array(Number((null==t?void 0:t.bathroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"bathroom"},n.bathroom((null==t?void 0:t.bathroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.restroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"toilet"},n.toilet((null==t?void 0:t.restroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.combinedBathroomsNumber)||0)).fill(0).map((function(e,r){return I({type:"combined_bathroom"},n.combinedBathroom((null==t?void 0:t.combinedBathroomsNumber)?"".concat(r+1," "):""))})),!0),[I({type:"others"},n.others)],!1),i.addToArrayByCondition("initial"===e,I({type:"entrance"},n.entrance)),!0),i.addToArrayByCondition("initial"!==e,I({type:"keys"},n.keys)),!0),i.addToArrayByCondition(!("initial"!==e||!(null==t?void 0:t.parkingType)),I({type:"parking"},n.parking)),!0),[I({type:"additional"},n.additional)],!1)},exports.getRoomsInfoStepFields=function(e,n){return q([],(null==e?void 0:e.roomsNumber)?new Array(Number(e.roomsNumber)).fill(0).map((function(t,r){var i,o=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"Bedroom ".concat(r+1):"Room ".concat(r+1),a=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"bedrooms":"rooms";return[I({name:"rooms.".concat(r,".area"),label:"".concat(o," area"),type:"number",isRequired:!0},(null==n?void 0:n[a])?null===(i=n[a](r))||void 0===i?void 0:i.area:{})]})).flat():[],!0)},exports.getSecurityApartmentInfoFields=function(e){return[I({label:"Object type",name:"typeOfObject",variant:"select",options:r.RoomTypesValues,isRequired:!0},null==e?void 0:e.typeOfObject),I({label:"Entrance",name:"entrance",isRequired:!0},null==e?void 0:e.entrance),I({name:"hasIntercom",label:"Intercom",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasIntercom),I({name:"intercomCode",label:"Intercom code",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasIntercom"},null==e?void 0:e.intercomCode),I({name:"hasGate",label:"Gate",variant:"select",options:r.BooleanValues,isRequired:!0},null==e?void 0:e.hasGate),I({name:"gateCode",label:"Gate code",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"hasGate"},null==e?void 0:e.gateCode),I({name:"parkingType",label:"Parking",variant:"select",options:r.ParkingTypesValues},null==e?void 0:e.parkingType),I({name:"parkingNumber",label:"Parking number",variant:"custom",CustomInput:s.DependentInput,dependentInputName:"parkingType"},null==e?void 0:e.parkingNumber)]},exports.getTelecommunicationsInfoStepFields=function(e){var n,t,i,o,a;return[I({name:"wifi.name",label:"Name of network"},null===(n=null==e?void 0:e.wifi)||void 0===n?void 0:n.name),I({name:"wifi.password",label:"WiFi password"},null===(t=null==e?void 0:e.wifi)||void 0===t?void 0:t.password),I({name:"internetProvider.link",label:"Link to provider",size:12},null===(i=null==e?void 0:e.internetProvider)||void 0===i?void 0:i.link),I({name:"internetProvider.login",label:"Login"},null===(o=null==e?void 0:e.internetProvider)||void 0===o?void 0:o.login),I({name:"internetProvider.password",label:"Password"},null===(a=null==e?void 0:e.internetProvider)||void 0===a?void 0:a.password),I({name:"tvType",label:"Television",variant:"select",options:r.TVTypesValues},null==e?void 0:e.tvType),I({name:"homePhone",label:"Home phone",variant:"phone"},null==e?void 0:e.homePhone)]},exports.getTransferDocumentsFields=function(e,n,t){return q(q(q(q([I({label:"Transfer inspection file",name:"transferAct",variant:"file"},null==t?void 0:t.transferAct)],i.addToArrayByCondition("maroom_tenant"===e&&!n,I({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==t?void 0:t.signedContract)),!0),i.addToArrayByCondition("tenant_maroom"===e,I({label:"Contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),i.addToArrayByCondition("maroom_landlord"===e,I({label:"Contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),"tenant_landlord"===e?[I({label:"Rental contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.rcTerminationAgreement),I({label:"Service contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.scTerminationAgreement)]:[],!0)},exports.getTransferDocumentsSchema=function(e,n){return b.object().shape(I(I(I(I({transferAct:b.mixed()},"maroom_tenant"!==e||n?{}:{signedContract:b.mixed().required(r.defaultRequiredMessage)}),"tenant_maroom"===e?{rcTerminationAgreement:b.mixed().required(r.defaultRequiredMessage)}:{}),"maroom_landlord"===e?{scTerminationAgreement:b.mixed().required(r.defaultRequiredMessage)}:{}),"tenant_landlord"===e?{rcTerminationAgreement:b.mixed().required(r.defaultRequiredMessage),scTerminationAgreement:b.mixed().required(r.defaultRequiredMessage)}:{}))},exports.getWaterMeterFields=function(e,n,t,r,i){var o=r?"".concat(r,"."):"",a=!n||!(null==n?void 0:n.isFilled)&&e.length?null==e?void 0:e.map((function(e){return{value:e.number,label:"".concat(y.default.capitalize(e.type||"")," | #").concat(e.number)}})):[{value:n.number,label:"".concat(y.default.capitalize(n.type||"")," | #").concat(n.number)}];return[I({label:"Meter",name:"".concat(o,"number"),variant:"select",options:a,size:12,isRequired:!0,disabled:1===a.length},null==i?void 0:i.meter),{name:"".concat(o,"value"),variant:"custom",CustomInput:k,prefixName:o,meters:e,settings:i,withCheckValue:t,meter:n}]},exports.getWaterMeterFieldsSchema=function(e){return b.object().shape({number:b.string().trim().required("This field is required"),withDefaultValue:b.boolean(),values:b.object({value:b.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()}),value:b.number().when(["withDefaultValue","values.value"],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).when([],{is:function(){return e},then:function(e){return e.required("This field is required")}}).transform((function(e){return Number.isNaN(e)?void 0:e}))})},exports.inspectionsRequestBody=R,exports.inspectionsRequests=M,exports.onInspectionModalClose=function(e,n,t){var r=e.inspectionsStore,o=n.formStateName,a=n.formFieldsName;r.setCanUpdateDB(!1),r.creationForm.resetForm(),i.clearIndexStores(r.indexDB,[o,a]),t&&t()},exports.onInspectionModalOpen=function(e,n,t){var r=e.inspectionsStore,o=e.apartmentId,a=n.formStateName,s=n.formFieldsName,l=r.creationForm.fields;l&&l.apartmentId!==o&&i.clearIndexStores(r.indexDB,[a,s]),r.setCanUpdateDB(!0),t&&t()},exports.renderMetersSteps=function(e,n,r){return q(q(q(q([],new Array(Number((null==r?void 0:r.water)||0)).fill("water"),!0),new Array(Number((null==r?void 0:r.electricity)||0)).fill("electricity"),!0),new Array(Number((null==r?void 0:r.gas)||0)).fill("gas"),!0),new Array(Number((null==r?void 0:r.heating)||0)).fill("heating"),!0).map((function(r,i){return[t.jsx(e,{index:i,resource:r},"meter_info_".concat(i)),t.jsx(n,{index:i,resource:r},"meter_photo_".concat(i))]}))},exports.useFillingList=rn,exports.useInspectionData=function(e){var n,t=e.apartmentId,r=e.inspectionsStore,i=e.metersStore,o=e.fillingStore,a=l.useState(!1),s=a[0],u=a[1],d=l.useState(!1),c=d[0],m=d[1],p=r.creationForm,f=null===(n=p.fields)||void 0===n?void 0:n.type,v=f?"regular"===f||"transfer"===f:void 0,h=o.loader.isLoading,g=i.loader.isLoading;l.useEffect((function(){s&&c&&!h&&!g&&r.setCanLoadDB(!0)}),[s,c,h,g]),nn(p,i,v,(function(){return u(!0)})),rn(t||null,p,o,v,(function(){return m(!0)}))},exports.useInspectionIndexDB=function(e,n,t){var r=e.dbCreationTime,o=e.formFieldsName,s=e.formStateName,u=e.inspectionCreationFormName,d=n.inspectionsStore,c=n.apartmentId,m=d.creationForm,p=d.actionLoader,f=d.indexDB,v=d.setCanUpdateDB,h=d.canUpdateDB,g=u,b=function(e){i.addIndexDBStore(e,o),i.addIndexDBStore(e,s)};var y=function(){return C(void 0,void 0,void 0,(function(){return S(this,(function(e){return i.initIndexDB(g,b,p,(function(e){return C(void 0,void 0,void 0,(function(){var n;return S(this,(function(l){switch(l.label){case 0:return d.setIndexDB(e),v(!1),u=localStorage.getItem(r),f=Date.now(),u&&f-Number(u)>864e5&&(i.clearIndexStores(d.indexDB,[s,o]),localStorage.removeItem(r)),[4,i.readFromIndexDB(e,o,p)];case 1:return(n=l.sent())?(null==n?void 0:n.apartmentId)===c&&(m.updateFormFields(I(I({},n),{date:n.date?a.DateTime.fromISO(n.date):null})),t&&t()):v(!0),[2]}var u,f}))}))})),[2]}))}))};l.useEffect((function(){c&&y()}),[c]),l.useEffect((function(){d.canLoadDB&&f&&C(void 0,void 0,void 0,(function(){var e,n;return S(this,(function(t){switch(t.label){case 0:return[4,i.readFromIndexDB(f,s,p)];case 1:return e=t.sent(),[4,i.readFromIndexDB(f,o,p)];case 2:return n=t.sent(),e&&(null==n?void 0:n.apartmentId)===c&&m.setStep(Number(e.step)),v(!0),[2]}}))}))}),[d.canLoadDB,f]),l.useEffect((function(){if(h){var e={step:m.step};i.addToIndexDBWithQueue(f,s,e,p),i.addToIndexDBWithQueue(f,o,m.fields,p),localStorage.getItem(r)||localStorage.setItem(r,Date.now().toString())}}),[m.step])},exports.useMetersValues=nn;
|
package/index.d.ts
CHANGED
@@ -8,18 +8,18 @@ import { UseFormReturn } from 'react-hook-form';
|
|
8
8
|
import { ReactElement, ReactNode } from 'react';
|
9
9
|
import { GridSize } from 'kui-basic';
|
10
10
|
|
11
|
-
declare const getPartialMeterInfoSchema: (valuesFields: InputParams$1<any>[]) => yup.ObjectSchema<{
|
11
|
+
declare const getPartialMeterInfoSchema: (valuesFields: InputParams$1<any>[], required?: boolean | undefined) => yup.ObjectSchema<{
|
12
12
|
[x: string]: any;
|
13
13
|
}, yup.AnyObject, {
|
14
14
|
[x: string]: any;
|
15
15
|
}, "">;
|
16
|
-
declare const
|
16
|
+
declare const getWaterMeterFieldsSchema: (required?: boolean | undefined) => yup.ObjectSchema<{
|
17
17
|
number: string;
|
18
18
|
withDefaultValue: boolean | undefined;
|
19
19
|
values: {
|
20
20
|
value?: number | null | undefined;
|
21
21
|
};
|
22
|
-
value: number;
|
22
|
+
value: number | undefined;
|
23
23
|
}, yup.AnyObject, {
|
24
24
|
number: undefined;
|
25
25
|
withDefaultValue: undefined;
|
@@ -1195,4 +1195,4 @@ type ApartmentPointProps = {
|
|
1195
1195
|
|
1196
1196
|
declare const ObjectForMapPoint: (props: ApartmentPointProps) => JSX.Element;
|
1197
1197
|
|
1198
|
-
export { AddedMetersBlock, AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentInspectionModel, ApartmentInspectionParams, ApartmentLinkParams, ApartmentPaymentsFormFields, AvailableResourcesParams, AvailableResourcesStepFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingCheckParams, FillingInfoFieldsSchema, FillingInfoFormFields, FillingListInfoStepFields, FillingListStore, HouseInfoFieldsSchema, HouseInfoStepFields, HouseInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InspectionAppraisalLiteModel, _default as InspectionFeedback, InspectionFieldsSettings, InspectionFillingCard, InspectionFillingCardProps, InspectionFillingItemFields, InspectionFillingListFields, InspectionFillingParams, InspectionImpairmentLiteModel, InspectionMeterCommonFields, InspectionMeterFields, InspectionMeterValueModel, InspectionMetersStepFields, InspectionPartialMetersStepFields, InspectionRoomImagesParams, InspectionRoomParams, InspectionRoomPhotoRequest, InspectionRoomsImagesFields, InspectionTypesResponse, InventoryDocumentsFields, InventoryInspectionFieldsBody, InventoryInspectionFormFields, InventoryInspectionPostBody, InventoryMeterInfoFields, InventoryMeterModel, MeterInfoStepProps, MeterValueModel, MeterValuesFields, MetersInfoFieldsSchema, MetersInfoStepFields, MetersInfoStepSchema, MetroStationParams, ObjectForMapCard, ObjectForMapOverlay, ObjectForMapParams, ObjectForMapPoint, PartialMeterInfoFields, PartialMeterInfoStepProps, PartialMeterModel, PostApartmentInspectionRequest, RegularInspectionFormFields, RegularInspectionPostBody, RegularlyInspectionFieldsBody, RoomImagesParams, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepFields, RoomsApartmentInfoStepSchema, RoomsInfoFieldsSchema, RoomsInfoStepFields, RoomsInfoStepSchema, RoomsSettings, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepFields, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepFields, TelecommunicationsInfoStepSchema, TenantParams, TransferDocumentsFields, TransferInspectionFieldsBody, TransferInspectionFormFields, TransferInspectionPostBody, TransferInspectionTypes, TransferPostFiles, TransferTypesResponse, UsedResourcesModel,
|
1198
|
+
export { AddedMetersBlock, AdditionalInfoFieldsSchema, AdditionalInfoStepFields, AdditionalInfoStepSchema, ApartmentInspectionModel, ApartmentInspectionParams, ApartmentLinkParams, ApartmentPaymentsFormFields, AvailableResourcesParams, AvailableResourcesStepFields, BasicApartmentInfoFieldsSchema, BasicApartmentInfoStepFields, BasicApartmentInfoStepSchema, CommonInspectionFields, CommonInspectionFormFields, DetailApartmentInfoFieldsSchema, DetailApartmentInfoStepFields, DetailApartmentInfoStepSchema, FillingCheckParams, FillingInfoFieldsSchema, FillingInfoFormFields, FillingListInfoStepFields, FillingListStore, HouseInfoFieldsSchema, HouseInfoStepFields, HouseInfoStepSchema, HouseServicesInfoFieldsSchema, HouseServicesInfoStepFields, HouseServicesInfoStepSchema, InitialInspectionFieldsBody, InitialInspectionFormFields, InitialInspectionInfoFields, InitialInspectionPostBody, InspectionAppraisalLiteModel, _default as InspectionFeedback, InspectionFieldsSettings, InspectionFillingCard, InspectionFillingCardProps, InspectionFillingItemFields, InspectionFillingListFields, InspectionFillingParams, InspectionImpairmentLiteModel, InspectionMeterCommonFields, InspectionMeterFields, InspectionMeterValueModel, InspectionMetersStepFields, InspectionPartialMetersStepFields, InspectionRoomImagesParams, InspectionRoomParams, InspectionRoomPhotoRequest, InspectionRoomsImagesFields, InspectionTypesResponse, InventoryDocumentsFields, InventoryInspectionFieldsBody, InventoryInspectionFormFields, InventoryInspectionPostBody, InventoryMeterInfoFields, InventoryMeterModel, MeterInfoStepProps, MeterValueModel, MeterValuesFields, MetersInfoFieldsSchema, MetersInfoStepFields, MetersInfoStepSchema, MetroStationParams, ObjectForMapCard, ObjectForMapOverlay, ObjectForMapParams, ObjectForMapPoint, PartialMeterInfoFields, PartialMeterInfoStepProps, PartialMeterModel, PostApartmentInspectionRequest, RegularInspectionFormFields, RegularInspectionPostBody, RegularlyInspectionFieldsBody, RoomImagesParams, RoomsApartmentInfoFieldsSchema, RoomsApartmentInfoStepFields, RoomsApartmentInfoStepSchema, RoomsInfoFieldsSchema, RoomsInfoStepFields, RoomsInfoStepSchema, RoomsSettings, SecurityApartmentInfoFieldsSchema, SecurityApartmentInfoStepFields, SecurityApartmentInfoStepSchema, TelecommunicationsInfoFieldsSchema, TelecommunicationsInfoStepFields, TelecommunicationsInfoStepSchema, TenantParams, TransferDocumentsFields, TransferInspectionFieldsBody, TransferInspectionFormFields, TransferInspectionPostBody, TransferInspectionTypes, TransferPostFiles, TransferTypesResponse, UsedResourcesModel, apartmentFields, getAdditionalInfoStepFields, getAvailableResourcesFields, getBasicApartmentInfoFields, getDetailApartmentInfoFields, getFillingInfoFields, getHouseInfoStep, getHouseServicesInfoStep, getInventoryDocumentsFields, getInventoryDocumentsSchema, getInventoryMeterFields, getMetersInfoStepFields, getPartialMeterInfoSchema, getRoomsApartmentInfoFields, getRoomsImagesSteps, getRoomsInfoStepFields, getSecurityApartmentInfoFields, getTelecommunicationsInfoStepFields, getTransferDocumentsFields, getTransferDocumentsSchema, getWaterMeterFields, getWaterMeterFieldsSchema, inspectionsRequestBody, inspectionsRequests, onInspectionModalClose, onInspectionModalOpen, renderMetersSteps, useFillingList, useInspectionData, useInspectionIndexDB, useMetersValues };
|
package/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import*as e from"yup";import n from"lodash";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{NumberField as i,KUISettings as o,requests as a,uploadFilesWithoutFilter as l,uploadFiles as s,uploadNewFile as u,ImageStore as d,FileStore as c,matchesAPIFillingTypes as m,CountryAutocomplete as p,RegionAutocomplete as v,CityAutocomplete as f,InputWithAddressAutocomplete as b,HouseTypesValues as h,WallMaterialsValues as g,SlabsTypesValues as y,GasTypesValues as _,BooleanValues as x,positiveNumberSchema as w,defaultRequiredMessage as I,RenovationTypeValues as N,RenovationStyleValues as C,RoomTypeValues as q,RoomTypesValues as P,ParkingTypesValues as T,fieldWithConditionSchema as k,BigCheckbox as S,getApartmentPaymentFields as R,phoneWithConditionSchema as A,getNumbersValues as M,TVTypesValues as F,phoneNonRequiredSchema as j,InputFileWithVisibility as O,FillingTypeValues as L,FillingTagsAutocomplete as B,getMeterValuesFieldsSchema as D,basicFieldsOfNewResourceMeter as z,meterUnitLabel as V,FormWrapper as H,MeterTypeRadioGroup as E,InputByType as W,Tooltip as G,ApartmentsAgent as U,PreviewContent as Y,Link as K,UserBadge as Z,useMapCards as J,MapOverlay as Q}from"kui-crm";import{clearNotValidFields as X,getPhoneNumberFromPhoneParams as $,resHandler as ee,callPromises as ne,getPhoneParamsFromString as te,addToArrayByCondition as re,Loader as ie,clearIndexStores as oe,addToIndexDBWithQueue as ae,initIndexDB as le,readFromIndexDB as se,addIndexDBStore as ue}from"kui-utils";import de from"await-to-js";import{DateTime as ce}from"luxon";import{DependentInput as me,CheckboxWithController as pe,InputPhoneWithForm as ve,InputFile as fe}from"kui-complex";import{useState as be,useMemo as he,useEffect as ge}from"react";import{useForm as ye}from"react-hook-form";import{Caption as _e,theme as xe,Grid as we,Button as Ie}from"kui-basic";import{yupResolver as Ne}from"@hookform/resolvers/yup";import Ce from"@emotion/styled";import{WarningIcon as qe,CheckIcon as Pe,CancelIcon as Te,CommentIcon as ke,UpdateIcon as Se,PhoneIcon as Re,CloseIcon as Ae}from"kui-icon";import{observer as Me}from"mobx-react";import{makeAutoObservable as Fe}from"mobx";var je=function(){return je=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},je.apply(this,arguments)};function Oe(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}function Le(e,n,t,r){return new(t||(t=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(e){o(e)}}function l(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,l)}s((r=r.apply(e,n||[])).next())}))}function Be(e,n){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function De(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i<o;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return e.concat(r||Array.prototype.slice.call(n))}function ze(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e}var Ve,He,Ee,We,Ge=function(n){var t=n.filter((function(e){return e.maxIntegerPart})).map((function(e){return e.name})),r=t.map((function(n){var t;return(t={})[n]=e.number().when(["withDefaultValue","values.".concat(n)],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).required("This field is required").transform((function(e){return Number.isNaN(e)?void 0:e})),t}));return e.object().shape(je({number:e.string().trim().required("This field is required"),withDefaultValue:e.boolean(),values:e.object(je({},Object.fromEntries(t.map((function(n){return[n,e.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()]})))))},Object.assign.apply(Object,De([{}],r,!1))))},Ue=e.object().shape({number:e.string().trim().required("This field is required"),withDefaultValue:e.boolean(),values:e.object({value:e.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()}),value:e.number().when(["withDefaultValue","values.value"],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).required("This field is required").transform((function(e){return Number.isNaN(e)?void 0:e}))}),Ye=function(e){var n,r,o=e.form,a=e.prefixName,l=e.settings,s=e.meters,u=e.withCheckValue,d=e.meter,c=o.watch("".concat(a,"number")),m=(null==d?void 0:d.isFilled)?d:null==s?void 0:s.find((function(e){return e.number===c}));return t(i,je({isRequired:!0,label:"Value",name:"".concat(a,"value"),maxIntegerPart:7,maxDecimalPart:3,warningMessage:"There are deviations in meter readings. It should be no more than",form:o,maxValue:(null===(n=null==m?void 0:m.maxValue)||void 0===n?void 0:n.value)&&u?Number(m.maxValue.value):null,placeholder:null===(r=null==m?void 0:m.values)||void 0===r?void 0:r.value},null==l?void 0:l.value))},Ke=function(e,t,r,i,o){var a=i?"".concat(i,"."):"",l=!t||!(null==t?void 0:t.isFilled)&&e.length?null==e?void 0:e.map((function(e){return{value:e.number,label:"".concat(n.capitalize(e.type||"")," | #").concat(e.number)}})):[{value:t.number,label:"".concat(n.capitalize(t.type||"")," | #").concat(t.number)}];return[je({label:"Meter",name:"".concat(a,"number"),variant:"select",options:l,size:12,isRequired:!0,disabled:1===l.length},null==o?void 0:o.meter),{name:"".concat(a,"value"),variant:"custom",CustomInput:Ye,prefixName:a,meters:e,settings:o,withCheckValue:r,meter:t}]},Ze={getPostBodyInitialInspection:function(e,n){return{based_on:null,date:(e.date||ce.now()).toISODate(),inspection_type:"initial",dropbox_link:e.dropboxLink,photo_groups:n,initial:this.getInitialInspectionFields(e)}},getInitialInspectionFields:function(e){var n,t,r;return{city:e.city.id,address:e.apartment.address,apartment_number:e.apartmentNumber||"",post_index:e.zipCode,floor:e.floor,floor_count:e.floorCount,room_type:e.typeOfObject,num_entrance:e.entrance,has_intercom:e.hasIntercom,intercom_code:e.intercomCode,has_gate:e.hasGate,gate_code:e.gateCode,area:e.area,rooms_number:e.roomsNumber,bedrooms_number:e.bedroomsNumber,bathrooms_number:e.bathroomsNumber,restrooms_number:e.restroomsNumber,combined_bathrooms_number:e.combinedBathroomsNumber,number_of_windows:e.numberOfWindows,renovation_year:null===(n=e.renovation)||void 0===n?void 0:n.year,renovation_type:null===(t=e.renovation)||void 0===t?void 0:t.type,renovation_style:null===(r=e.renovation)||void 0===r?void 0:r.style,wall_type:e.wallMaterial,overlap_type:e.overlapType,passenger_elevators_number:e.passengerElevatorsCount,service_elevators_number:e.serviceElevatorsCount,ceiling_height:e.ceilingHeight,building_year:e.buildingYear,serial_number:e.houseNumber,type_gas:e.gasLeads,hot_water:e.withHotWater,type_houses:e.typeOfHouse,parking_type:e.parkingType,parking_number:e.parkingNumber,rooms:e.rooms.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n}})),used_resources:{electricity:e.availableResources.electricity,water:e.availableResources.water,gas:e.availableResources.gas,heating:e.availableResources.heating}}},getPostBodyRegularInspection:function(e,n){return{date:(e.date||ce.now()).toISODate(),inspection_type:"regular",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,regular:je(je({},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getPostBodyTransferInspection:function(e,n,t){return{date:(e.date||ce.now()).toISODate(),inspection_type:"transfer",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,transfer:je(je({inspection_document:t.transferAct||void 0,rental_contract_signed_document:t.rentalContractFile||void 0,rental_contract_termination_document:t.rentalTerminationAgreement||void 0,service_contract_termination_document:t.serviceTerminationAgreement||void 0,transfer_type:e.transferType},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getInspectionFilling:function(e){var n;return{filling:null===(n=null==e?void 0:e.filter((function(e){return e})))||void 0===n?void 0:n.map((function(e){return{apartment_feature_id:e.id,is_absent:!e.check}}))}},getPartialInspectionMeters:function(e){var n=this;return{meters:(null==e?void 0:e.map((function(e,t){return{id:e.id,resource_type:e.resource,meter_type:e.type,passport_number:e.number,photos:n.getFilesParams(e.images),values:X(n.getInspectionMeterValues(e))}})))||[]}},getPostBodyInventoryInspection:function(e,n,t,r,i,o){var a,l,s,u,d,c,m,p,v,f,b,h,g=this;return{date:(e.date||ce.now()).toISODate(),inspection_type:"inventory",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,inventory:je({inspection_document:i||void 0,service_contract_signed_document:o||void 0,allowed_children:e.withChildren,allowed_pets:e.withPets,allowed_smoking:e.withSmoking,additional_terms:e.additionalTerms,country_of_residence:(null===(a=e.countryOfResidence)||void 0===a?void 0:a.id)||null,administrative_company:(null===(l=e.company)||void 0===l?void 0:l.id)||null,tax_type:e.taxesType,financial_personal_account:e.communalServicesAccount,max_electricity_counters:null===(s=e.maxMeters)||void 0===s?void 0:s.electricity,max_gas_counters:null===(u=e.maxMeters)||void 0===u?void 0:u.gas,max_heating_counters:null===(d=e.maxMeters)||void 0===d?void 0:d.heating,max_water_counters:null===(c=e.maxMeters)||void 0===c?void 0:c.water,has_barrier:e.hasBarrier,has_concierge:e.hasConcierge,has_security:e.hasSecurity,has_video_surveillance:e.hasVideoControl,barrier_phone:e.barrierPhone?$(e.barrierPhone):null,concierge_phone:e.conciergePhone?$(e.conciergePhone):null,security_phone:e.securityPhone?$(e.securityPhone):null,video_surveillance_phone:e.videoControlPhone?$(e.videoControlPhone):null,home_phone:e.homePhone?$(e.homePhone):null,wifi_name:null===(m=e.wifi)||void 0===m?void 0:m.name,wifi_password:null===(p=e.wifi)||void 0===p?void 0:p.password,internet_provider_link:null===(v=e.internetProvider)||void 0===v?void 0:v.link,internet_provider_login:null===(f=e.internetProvider)||void 0===f?void 0:f.login,internet_provider_password:null===(b=e.internetProvider)||void 0===b?void 0:b.password,payer_code:e.payerCode,rooms:null===(h=e.rooms)||void 0===h?void 0:h.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n,area:e.area}})),filling:e.fillingList.map((function(e,n){var r;return{feature:(null===(r=e.tag)||void 0===r?void 0:r.id)||0,description:e.description,model:e.name,serial_code:e.serialNumber,amount:e.numberOfSubjects,photos:g.getFilesParams(e.images),instruction:t[n]}}))},this.getInventoryInspectionMeters(e.meters,r))}},getInventoryInspectionMeters:function(e,n,t){var r=this;return{meters:(null==e?void 0:e.map((function(e,i){return je(je({},r.getMeterCommonFields(e)),{passport:n[i],values:X(r.getInspectionMeterValues(e,"initialValue")),photos:t?t[i]:r.getFilesParams(e.images),no_tariff:e.noTariff,auto_sending:e.withAutoSending})})))||[]}},getInspectionMeterValues:function(e,n){var t;if("electricity"===e.resource){var r=n||"",i=e["".concat(r,"T1")],o=e["".concat(r,"T2")],a=e["".concat(r,"T3")];return{T1:i?Number(i):i,T2:o?Number(o):o,T3:a?Number(a):a}}var l=n||"value";if("water"===e.resource){if("cold"===e.type){var s=e[l];return{cold:s?Number(s):s}}var u=e[l];return{hot:u?Number(u):u}}var d=e[l];return(t={})[e.resource]=d?Number(d):d,t},getMeterCommonFields:function(e){var n;return{id:e.id,meter_type:e.type,passport_number:e.number,resource_type:e.resource,activation_date:(null===(n=e.startDate)||void 0===n?void 0:n.toISODate())||null}},getMeterValues:function(e,n){return X({initial_value:e,last_value:n})},getFilesParams:function(e){return(null==e?void 0:e.map((function(e){return e.uploadedData})).filter((function(e){return e})))||[]}},Je={createInspectionHandler:function(e,n,t,r){return Le(this,void 0,void 0,(function(){var i,a,l;return Be(this,(function(s){switch(s.label){case 0:if(!e)return[3,5];n.startLoading("inspection creation"),i=void 0,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r()];case 2:return i=s.sent(),[3,4];case 3:return a=s.sent(),(l=o.getSettings().Sentry).withScope((function(e){e.setExtras(t),l.captureException(new Error("Ошибка в генерации тела запроса при создании инспекции"))})),n.setError("Некорректное тело запроса",a),n.endLoading(),[3,4];case 4:return i?[2,this.createInspection(e,i,n)]:[2,null];case 5:return[2,null]}}))}))},getInspectionTypes:function(e){return Le(this,void 0,void 0,(function(){var n,t,r;return Be(this,(function(i){switch(i.label){case 0:return[4,de(a.get("/apartments/".concat(e,"/inspection-types")))];case 1:return n=i.sent(),t=n[0],r=n[1],t?[2,[t,void 0]]:[2,[null,null==r?void 0:r.inspection_types]]}}))}))},getTransferTypes:function(e){return Le(this,void 0,void 0,(function(){var n,t,r;return Be(this,(function(i){switch(i.label){case 0:return[4,de(a.get("/apartments/".concat(e,"/transfer-inspection-types")))];case 1:return n=i.sent(),t=n[0],r=n[1],t?[2,[t,void 0]]:[2,[null,null==r?void 0:r.transfer_inspection_types]]}}))}))},createInspection:function(e,n,t){var r;return Le(this,void 0,void 0,(function(){var i;return Be(this,(function(o){switch(o.label){case 0:return[4,de(a.post("/apartments/".concat(e,"/inspections"),n))];case 1:return i=o.sent(),ee(i,t),[2,null===(r=i[1])||void 0===r?void 0:r.id]}}))}))},createInitialInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n;return Be(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,Ze.getPostBodyInitialInspection(e,n)]}))}))}))]}))}))},createRegularInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n;return Be(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,Ze.getPostBodyRegularInspection(e,n)]}))}))}))]}))}))},createTransferInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n,r;return Be(this,(function(i){switch(i.label){case 0:return n=this.getRoomParams(e.roomsImages),[4,l(t,[e.transferAct,e.signedContract,e.rcTerminationAgreement,e.scTerminationAgreement])];case 1:return r=i.sent(),[2,Ze.getPostBodyTransferInspection(e,n,{transferAct:r[0],rentalContractFile:r[1],rentalTerminationAgreement:r[2],serviceTerminationAgreement:r[3]})]}}))}))}))]}))}))},createInventoryInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n,r,i,o,a;return Be(this,(function(l){switch(l.label){case 0:return n=e.fillingList.map((function(e){return e.instruction})),r=(null===(a=e.meters)||void 0===a?void 0:a.map((function(e){return e.passportFile})))||[],[4,ne([s(t,n),s(t,r),u(t,e.inventoryAct),u(t,e.signedContract)])];case 1:return i=l.sent(),o=this.getRoomParams(e.roomsImages),[2,Ze.getPostBodyInventoryInspection(e,o,i[0],i[1],i[2],i[3])]}}))}))}))]}))}))},getRoomParams:function(e){var n,t=-1;return(null===(n=null==e?void 0:e.map((function(e){var n="room"===e.type||"bedroom"===e.type;return n&&(t+=1),{purpose:null==e?void 0:e.type,comment:null==e?void 0:e.comment,photos:Ze.getFilesParams((null==e?void 0:e.files)||[]),room_order_number:n?t:void 0}})))||void 0===n?void 0:n.filter((function(e){return e.purpose})))||[]}},Qe={getApartmentDescriptionInfo:function(e){return je(je(je(je(je(je({},this.getApartmentMainInfo(e)),this.getApartmentSecurityInfo(e)),this.getApartmentDetailInfo(e)),this.getApartmentTelecommunicationInfo(e)),this.getApartmentHouseInfo(e)),this.getMaxMetersParams(e))},getApartmentMainInfo:function(e){return je(je({},e),{apartmentNumber:e.apartment_number,zipCode:e.post_index||"",floorCount:e.floor_count,entrance:e.num_entrance,geolocation:this.getGeolocationParams(e.geolocation),distanceToCenter:e.distance_to_center_kilometers||null,typeOfObject:e.room_type})},getApartmentSecurityInfo:function(e){var n,t,r,i,o,a;return{hasIntercom:null!==(n=e.has_intercom)&&void 0!==n?n:null,hasGate:null!==(t=e.has_gate)&&void 0!==t?t:null,hasBarrier:null!==(r=e.has_barrier)&&void 0!==r?r:null,hasSecurity:null!==(i=e.has_security)&&void 0!==i?i:null,hasConcierge:null!==(o=e.has_concierge)&&void 0!==o?o:null,hasVideoControl:null!==(a=e.has_video_surveillance)&&void 0!==a?a:null,intercomCode:e.intercom_code||"",gateCode:e.gate_code||"",barrierPhone:e.barrier_phone?te(e.barrier_phone):null,conciergePhone:e.concierge_phone?te(e.concierge_phone):null,securityPhone:e.security_phone?te(e.security_phone):null,videoControlPhone:e.video_surveillance_phone?te(e.video_surveillance_phone):null}},getApartmentDetailInfo:function(e){var n;return{area:e.area,livingArea:e.living_area,kitchenArea:e.kitchen_area,roomsNumber:e.rooms_number,bedroomsNumber:e.bedrooms_number,bathroomsNumber:e.bathrooms_number,restroomsNumber:e.restrooms_number,combinedBathroomsNumber:e.combined_bathrooms_number,ceilingHeight:e.ceiling_height,numberOfWindows:e.number_of_windows,renovation:{year:e.renovation_year||null,type:e.renovation_type||null,style:e.renovation_style||null},rooms:(null===(n=e.rooms)||void 0===n?void 0:n.map((function(e){return{id:e.id,area:e.area||null,type:e.room_type||null}})))||[]}},getApartmentTelecommunicationInfo:function(e){return{homePhone:e.home_phone?te(e.home_phone):null,wifi:{name:e.wifi_name,password:e.wifi_password},internetProvider:{link:e.internet_provider_link,login:e.internet_provider_login,password:e.internet_provider_password},tvType:e.tv_type}},getApartmentHouseInfo:function(e){return{typeOfHouse:e.type_houses,buildingYear:e.building_year,houseNumber:e.serial_number,wallMaterial:e.wall_type,overlapType:e.overlap_type,parkingType:e.parking_type,parkingNumber:e.parking_number,passengerElevatorsCount:e.passenger_elevators_number?Number(e.passenger_elevators_number):null,serviceElevatorsCount:e.service_elevators_number?Number(e.service_elevators_number):null,gasLeads:e.type_gas,withHotWater:e.hot_water}},getMaxMetersParams:function(e){return{maxMeters:{water:e.max_water_counters,electricity:e.max_electricity_counters,gas:e.max_gas_counters,heating:e.max_heating_counters}}},getGeolocationParams:function(e){return e?{lat:Number(e.lat),lng:Number(e.lon)}:null},getObjectRoomsImages:function(e){return e.map((function(e){return{id:e.id,type:e.purpose,comment:e.comment,images:e.photos.map((function(e){return d.initFromImageModel(e)})),roomNumber:"number"==typeof e.room_order_number?e.room_order_number+1:0}}))},getInspectionFillingParams:function(e,n){var t;return je({id:e.id,name:e.description||"",tag:{id:e.feature.id,name:e.feature.name},images:null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return d.initFromImageModel(e)})),serialNumber:e.serial_code,numberOfSubjects:Number(e.amount),instruction:e.instruction?c.initFromDocumentModel(e.instruction):null,type:m[e.feature.feature_type]},n&&"appliance"===e.feature.feature_type?{check:!e.is_absent,wasMissing:e.previously_absent}:{})},getApartmentDescriptionWithMetro:function(e){return je(je({},this.getApartmentDescriptionInfo(e)),{metroStations:this.getMetroStationsParams(null==e?void 0:e.metro_stations)})},getMetroStationsParams:function(e){return(null==e?void 0:e.map((function(e){return{id:e.metro_station_id,name:e.name,walkDistance:e.distance_walk_meters,carDistance:Number(e.distance_car_kilometers),carTime:e.time_car_minutes,walkTime:Math.round(e.distance_walk_meters/(5e3/60))}})))||[]},getMeterValues:function(e,n,t){var r,i,o,a,l,s;if("electricity"===n){var u=t||"";return je(je(((r={})["".concat(u,"T1")]=Number(e.values.T1),r),"T1"!==e.meter_type&&((i={})["".concat(u,"T2")]=Number(e.values.T2),i)),"T3"===e.meter_type&&((o={})["".concat(u,"T3")]=Number(e.values.T3),o))}var d=t||"value";return"water"===n?"cold"===e.meter_type?((a={})["".concat(d)]=Number(e.values.cold),a):((l={})["".concat(d)]=Number(e.values.hot),l):((s={})["".concat(d)]=Number(e.values[n]),s)},getTransferMetersInfo:function(e){var n=this;return{meters:e.map((function(e){var t;return je({id:e.id,type:e.meter_type,number:e.passport_number,resource:e.resource_type,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return d.initFromImageModel(e)})))||[],values:n.getMeterValues(e,e.resource_type)},n.getMeterValues(e,e.resource_type))}))}},getApartmentPaymentInfo:function(e){return{payerCode:e.payer_code,communalServicesAccount:e.financial_personal_account,managementCompany:e.administrative_company?je(je({},e.administrative_company),{operatingAccount:e.payer_code}):null}},getInspectionPaymentInfo:function(e){return je(je({},this.getApartmentPaymentInfo(e)),{countryOfResidence:e.country_of_residence,taxesType:e.tax_type})},getMeterInfo:function(e,n){var t;return{id:e.id,type:e.meter_type,number:e.passport_number,startDate:e.activation_date?ce.fromISO(e.activation_date):null,company:e.company,operationalAccountNumber:e.operating_account,resource:n,tariff:e.tariff?{id:e.tariff.id,name:e.tariff.code_name}:null,passportFile:e.passport?c.initFromFileModel(e.passport):null,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return d.initFromImageModel(e)})))||[]}},getInventoryMetersInfo:function(e){var n=this;return{meters:e.meters.map((function(e){return je(je({},n.getMeterInfo(e,e.resource_type)),n.getMeterValues(e,e.resource_type,"initialValue"))}))}}},Xe=function(e,n){return[je({name:"country",label:"Country",variant:"custom",CustomInput:p,size:12},null==n?void 0:n.country),je({name:"region",label:"Region",variant:"custom",CustomInput:v},null==n?void 0:n.region),je({name:"city",label:"City",variant:"custom",CustomInput:f,isRequired:!0},null==n?void 0:n.city),je({name:"apartment",variant:"custom",CustomInput:b,handlePlaceSelect:e,size:12,isRequired:!0},null==n?void 0:n.apartment),je({label:"Apartment",name:"apartmentNumber","data-testid":"apartment_number",isRequired:!0},null==n?void 0:n.apartmentNumber),je({label:"Zip code",name:"zipCode"},null==n?void 0:n.zipCode)]},$e={apartment:e.object({address:e.string().trim().required("This field is required")}),apartmentNumber:e.string().required("This field is required"),city:e.object({name:e.string().required("This field is required")})},en=e.object($e),nn=function(e){return[je({name:"typeOfHouse",label:"Type houses",variant:"select",options:h,isRequired:!0},null==e?void 0:e.typeOfHouse),je({name:"houseNumber",label:"House series"},null==e?void 0:e.houseNumber),je({name:"wallMaterial",label:"Wall material",variant:"select",options:g,isRequired:!0},null==e?void 0:e.wallMaterial),je({name:"overlapType",label:"Overlap type",variant:"select",options:y,isRequired:!0},null==e?void 0:e.overlapType),je({name:"gasLeads",label:"Gas",variant:"select",options:_,isRequired:!0},null==e?void 0:e.gasLeads),je({name:"withHotWater",label:"Hot water",variant:"select",options:x,isRequired:!0},null==e?void 0:e.withHotWater),je({name:"passengerElevatorsCount",label:"Passenger elevators",type:"number",isRequired:!0},null==e?void 0:e.passengerElevatorsCount),je({name:"serviceElevatorsCount",label:"Service elevators",type:"number",isRequired:!0},null==e?void 0:e.serviceElevatorsCount),je({name:"buildingYear",label:"Builded",isRequired:!0},null==e?void 0:e.buildingYear)]},tn={passengerElevatorsCount:w,serviceElevatorsCount:w,typeOfHouse:e.string().required(I),buildingYear:e.string().required(I),wallMaterial:e.string().required(I),overlapType:e.string().required(I),gasLeads:e.string().required(I),withHotWater:e.boolean().required(I)},rn=e.object(tn),on={step:.01},an=function(e,n,t){var r,i;return De(De([je(je({label:"Total area",name:"area",type:"number",isRequired:!0},on),null==t?void 0:t.area)],e?new Array(Number(e)).fill(0).map((function(e,r){var i,o=n&&r<n?"Bedroom ".concat(r+1):"Room ".concat(r+1),a=n&&r<n?"bedrooms":"rooms";return[je({name:"rooms.".concat(r,".type"),label:"".concat(o," type"),variant:"select",options:q,isRequired:!0},(null==t?void 0:t[a])?null===(i=t[a](r))||void 0===i?void 0:i.type:{})]})).flat():[],!0),[je(je({name:"ceilingHeight",label:"Ceiling height",type:"number",cornerLabel:"m.",isRequired:!0},on),null==t?void 0:t.ceilingHeight),je({name:"numberOfWindows",label:"Windows",type:"number",isRequired:!0},null==t?void 0:t.numberOfWindows),je({name:"renovation.year",label:"Year of last renovation",type:"number",isRequired:!0},null==t?void 0:t.renovation.year),je({name:"renovation.type",label:"Type of renovation",variant:"select",options:N,isRequired:!0},null===(r=null==t?void 0:t.renovation)||void 0===r?void 0:r.type),je({name:"renovation.style",label:"Renovation style",variant:"select",options:C,isRequired:!0},null===(i=null==t?void 0:t.renovation)||void 0===i?void 0:i.style)],!1)},ln={area:e.number().positive().required("This field is required"),rooms:e.array().of(e.object({type:e.string().required("This field is required")})),numberOfWindows:e.number().min(0).required("This field is required"),renovation:e.object({year:e.number().positive().required("This field is required"),type:e.string().required("This field is required"),style:e.string().required("This field is required")}),ceilingHeight:w},sn=e.object(ln),un=function(e,n){return[je({label:"Floor",name:"floor",type:"number",isRequired:!0},null==n?void 0:n.floor),je({label:"Floors",name:"floorCount",type:"number",isRequired:!0},null==n?void 0:n.floorCount),je({label:"Rooms",name:"roomsNumber",type:"number",isRequired:!0},null==n?void 0:n.roomsNumber),je({label:"Bedrooms",name:"bedroomsNumber",type:"number",isRequired:!0,disabled:0===e||"0"===e},null==n?void 0:n.bedroomsNumber),je({label:"Bathrooms",name:"bathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.bathroomsNumber),je({label:"Restrooms",name:"restroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.restroomsNumber),je({label:"Combined bathroom",name:"combinedBathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.combinedBathroomsNumber)]},dn={floor:e.number().integer().min(0).test("is less than floorCount","Too much",(function(e){return e<=this.parent.floorCount})),floorCount:e.number().integer().positive().required("This field is required"),roomsNumber:e.number().integer().min(0).required("This field is required"),bedroomsNumber:e.number().integer().min(0).required("This field is required"),bathroomsNumber:e.number().integer().min(0).required("This field is required"),restroomsNumber:e.number().integer().min(0).required("This field is required"),combinedBathroomsNumber:e.number().integer().min(0).required("This field is required")},cn=e.object(dn),mn=function(e){return[je({label:"Object type",name:"typeOfObject",variant:"select",options:P,isRequired:!0},null==e?void 0:e.typeOfObject),je({label:"Entrance",name:"entrance",isRequired:!0},null==e?void 0:e.entrance),je({name:"hasIntercom",label:"Intercom",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasIntercom),je({name:"intercomCode",label:"Intercom code",variant:"custom",CustomInput:me,dependentInputName:"hasIntercom"},null==e?void 0:e.intercomCode),je({name:"hasGate",label:"Gate",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasGate),je({name:"gateCode",label:"Gate code",variant:"custom",CustomInput:me,dependentInputName:"hasGate"},null==e?void 0:e.gateCode),je({name:"parkingType",label:"Parking",variant:"select",options:T},null==e?void 0:e.parkingType),je({name:"parkingNumber",label:"Parking number",variant:"custom",CustomInput:me,dependentInputName:"parkingType"},null==e?void 0:e.parkingNumber)]},pn={typeOfObject:e.string().required("This field is required"),entrance:e.string().required("This field is required"),hasIntercom:e.string().required("This field is required"),intercomCode:k("hasIntercom"),hasGate:e.string().required("This field is required"),gateCode:k("hasGate")},vn=e.object(pn),fn=function(e){return[je({label:"Water",name:"availableResources.water",variant:"custom",CustomInput:S},null==e?void 0:e.water),je({label:"Electricity",name:"availableResources.electricity",variant:"custom",CustomInput:S},null==e?void 0:e.electricity),je({label:"Gas",name:"availableResources.gas",variant:"custom",CustomInput:S},null==e?void 0:e.gas),je({label:"Heating",name:"availableResources.heating",variant:"custom",CustomInput:S},null==e?void 0:e.heating)]},bn={size:"s"},hn=function(e){return De([je({label:"Pets",name:"withPets",variant:"custom",CustomInput:pe,labelProps:bn},null==e?void 0:e.withPets),je({label:"Children",name:"withChildren",variant:"custom",CustomInput:pe,labelProps:bn},null==e?void 0:e.withChildren),je({label:"Smoking",name:"withSmoking",variant:"custom",CustomInput:pe,labelProps:bn},null==e?void 0:e.withSmoking),je({isTextArea:!0,placeholder:"other terms",name:"additionalTerms"},null==e?void 0:e.additionalTerms)],R(e),!0)},gn={taxesType:e.string().required(I),countryOfResidence:e.object({name:e.string().required(I)}),company:e.object({name:e.string().required(I)})},yn=e.object(gn),_n=function(e){return[je({name:"hasBarrier",label:"Barrier",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasBarrier),je({name:"barrierPhone",label:"Barrier code",variant:"custom",CustomInput:me,dependentInputName:"hasBarrier",Input:ve},null==e?void 0:e.barrierPhone),je({name:"hasConcierge",label:"Concierge",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasConcierge),je({name:"conciergePhone",label:"Concierge",variant:"custom",CustomInput:me,dependentInputName:"hasConcierge",Input:ve},null==e?void 0:e.conciergePhone),je({name:"hasSecurity",label:"Security",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasSecurity),je({name:"securityPhone",label:"Security",variant:"custom",CustomInput:me,dependentInputName:"hasSecurity",Input:ve},null==e?void 0:e.securityPhone),je({name:"hasVideoControl",label:"Video surveillance",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasVideoControl),je({name:"videoControlPhone",label:"Video surveillance",variant:"custom",CustomInput:me,dependentInputName:"hasVideoControl",Input:ve},null==e?void 0:e.videoControlPhone)]},xn={hasBarrier:e.string().required(I),barrierPhone:A("hasBarrier"),hasConcierge:e.string().required(I),conciergePhone:A("hasConcierge"),hasSecurity:e.string().required(I),securityPhone:A("hasSecurity"),hasVideoControl:e.string().required(I),videoControlPhone:A("hasVideoControl")},wn=e.object(xn),In=M(7),Nn=function(e){var n,t,r,i;return[je({name:"maxMeters.water",label:"Water",variant:"select",options:In,isRequired:!0},null===(n=null==e?void 0:e.maxMeters)||void 0===n?void 0:n.water),je({name:"maxMeters.electricity",label:"Electricity",variant:"select",options:In,isRequired:!0},null===(t=null==e?void 0:e.maxMeters)||void 0===t?void 0:t.electricity),je({name:"maxMeters.gas",label:"Gas",variant:"select",options:In,isRequired:!0},null===(r=null==e?void 0:e.maxMeters)||void 0===r?void 0:r.gas),je({name:"maxMeters.heating",label:"Heating",variant:"select",options:In,isRequired:!0},null===(i=null==e?void 0:e.maxMeters)||void 0===i?void 0:i.heating)]},Cn={maxMeters:e.object({water:w,electricity:w,gas:w,heating:w})},qn=e.object(Cn),Pn=function(e){var n,t,r,i,o;return[je({name:"wifi.name",label:"Name of network"},null===(n=null==e?void 0:e.wifi)||void 0===n?void 0:n.name),je({name:"wifi.password",label:"WiFi password"},null===(t=null==e?void 0:e.wifi)||void 0===t?void 0:t.password),je({name:"internetProvider.link",label:"Link to provider",size:12},null===(r=null==e?void 0:e.internetProvider)||void 0===r?void 0:r.link),je({name:"internetProvider.login",label:"Login"},null===(i=null==e?void 0:e.internetProvider)||void 0===i?void 0:i.login),je({name:"internetProvider.password",label:"Password"},null===(o=null==e?void 0:e.internetProvider)||void 0===o?void 0:o.password),je({name:"tvType",label:"Television",variant:"select",options:F},null==e?void 0:e.tvType),je({name:"homePhone",label:"Home phone",variant:"phone"},null==e?void 0:e.homePhone)]},Tn={homePhone:j("homePhone")},kn=e.object().shape(Tn,[["homePhone","homePhone"]]),Sn=function(e,n,t,r){return De(De(De(De(De(De(De([],re(e,je({label:"Filling type",name:"type",variant:"select",options:L,handleChange:t,isRequired:!0},null==r?void 0:r.type)),!0),[je({label:"Name (tag)",name:"tag",type:n,variant:"custom",CustomInput:B,isRequired:!0},null==r?void 0:r.tag)],!1),re("finish"!==n,je({label:"Model",name:"name",isRequired:!0},null==r?void 0:r.name)),!0),re("finish"!==n,je({label:"Serial code",name:"serialNumber",size:6},null==r?void 0:r.serialNumber)),!0),re("finish"!==n,je({label:"Amount",name:"numberOfSubjects",type:"number",size:6},null==r?void 0:r.numberOfSubjects)),!0),[je({label:"Description",name:"description",isTextArea:!0},null==r?void 0:r.description)],!1),re("finish"!==n,je({label:"Instruction",name:"instruction",variant:"custom",CustomInput:O},null==r?void 0:r.instruction)),!0)},Rn=e.object().shape({type:e.string(),tag:e.object({name:e.string().required(I)}),name:e.string().when("type",{is:function(e){return"electronics"===e},then:function(e){return e.required(I)}})}),An={number:e.string().required("This field is required")},Mn=function(n){var t=D(n);return e.object().shape(je(je({},An),Object.assign.apply(Object,De([{}],t,!1))))},Fn=function(e,n){return De(De([],z(e,n),!0),[je({label:"Activation date",name:"startDate",variant:"date",max:ce.now()},null==n?void 0:n.startDate),je({label:"Passport",name:"passportFile",variant:"custom",CustomInput:fe},null==n?void 0:n.passportFile)],!1)},jn=function(e){var t=e.meter,i=e.getMeterLabel,o=t.resource,a=t.type,l=t.number,s=[t.initialValue,t.initialValueT1,t.initialValueT2,t.initialValueT3].filter((function(e){return void 0!==e})).map((function(e){return e})).join(" / "),u=i?i(o,a):n.capitalize("".concat(a?"".concat(a," "):"").concat(o," meter"));return r(_e,je({"data-testid":"addedMeterLine",size:"s"},{children:["• ",u," #",l," -"," ",r(On,{children:[s," ",V[t.resource]]})]}))},On=Ce.span(Ve||(Ve=ze(["\n font-weight: 600;\n"],["\n font-weight: 600;\n"]))),Ln=function(e){var n,i,o=e.resource,a=e.formStore,l=e.label,s=e.getMeterLabel,u=null===(i=null===(n=a.fields)||void 0===n?void 0:n.meters)||void 0===i?void 0:i.filter((function(e){return e.resource===o}));return(null==u?void 0:u.length)?r(Bn,je({"data-testid":"addedMetersBlock"},{children:[r(zn,je({container:!0,alignItems:"center"},{children:[t(Dn,{}),t(_e,je({size:"s",color:"fiftyP"},{children:l||"In the previous steps were added:"}))]})),u.map((function(e){return t(jn,{getMeterLabel:s,meter:e},e.number)}))]})):null},Bn=Ce.div(He||(He=ze(["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"],["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"])),xe.palette.grey.fifteenB),Dn=Ce(qe)(Ee||(Ee=ze(["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"],["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"])),xe.palette.brand.main),zn=Ce(we)(We||(We=ze(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"])));function Vn(e){var n,i,o=e.resource,a=e.index,l=e.formStore,s=null===(i=null===(n=l.fields)||void 0===n?void 0:n.meters)||void 0===i?void 0:i[a],u="water"===o||"electricity"===o,d=u?"water"===o?"cold":"T1":null,c=be((null==s?void 0:s.type)||d),m=c[0],p=c[1],v=Fn({resource:o,meterType:m}),f=v.filter((function(e){return"number"===e.type})).map((function(e){return e.name})),b=Mn(f),h=he((function(){return ye({resolver:Ne(b),defaultValues:je({},s),values:s})}),[b]);return t(H,je({form:h,onSubmit:function(e){l.replaceFieldInArray("meters",je(je({},e),{resource:o}),a),l.nextStep()},label:"Next",variant:"next",withPrevStep:!0,handlePrevClick:l.prevStep},{children:r(we,je({container:!0,spacing:2},{children:[t(we,je({item:!0,xs:12},{children:t(Ln,{formStore:l,resource:o})})),u&&t(we,je({item:!0,xs:12},{children:t(E,{form:h,resource:o,handleChange:p})})),v.map((function(e){var n=e.size,r=Oe(e,["size"]);return t(we,je({item:!0,xs:n||6},{children:t(W,je({form:h},r))}),r.name)}))]}))}))}var Hn,En,Wn,Gn,Un,Yn,Kn,Zn,Jn,Qn,Xn,$n,et,nt,tt,rt,it,ot,at,lt,st,ut,dt,ct=function(e,n,r){return De(De(De(De([],new Array(Number((null==r?void 0:r.water)||0)).fill("water"),!0),new Array(Number((null==r?void 0:r.electricity)||0)).fill("electricity"),!0),new Array(Number((null==r?void 0:r.gas)||0)).fill("gas"),!0),new Array(Number((null==r?void 0:r.heating)||0)).fill("heating"),!0).map((function(r,i){return[t(e,{index:i,resource:r},"meter_info_".concat(i)),t(n,{index:i,resource:r},"meter_photo_".concat(i))]}))},mt=function(n){return e.object().shape(je({inventoryAct:e.mixed()},n?{}:{signedContract:e.mixed().required(I)}))},pt=function(e,n){return De([je({label:"Inventory inspection file",name:"inventoryAct",variant:"file"},null==n?void 0:n.transferAct)],re(!e,je({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==n?void 0:n.signedContract)),!0)},vt={rooms:e.array().of(e.object({area:e.number().positive().required(I).transform((function(e){return Number.isNaN(e)?void 0:e}))}))},ft=e.object(vt),bt=function(e,n){return De([],(null==e?void 0:e.roomsNumber)?new Array(Number(e.roomsNumber)).fill(0).map((function(t,r){var i,o=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"Bedroom ".concat(r+1):"Room ".concat(r+1),a=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"bedrooms":"rooms";return[je({name:"rooms.".concat(r,".area"),label:"".concat(o," area"),type:"number",isRequired:!0},(null==n?void 0:n[a])?null===(i=n[a](r))||void 0===i?void 0:i.area:{})]})).flat():[],!0)},ht=function(e,n,t){return De(De(De(De(De(De(De(De(De(De([je({type:"kitchen"},n.kitchen)],new Array(Number((null==t?void 0:t.bedroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"bedroom"},n.bedroom((null==t?void 0:t.bedroomsNumber)?"".concat(r+1," "):"",null==t?void 0:t.rooms[r]))})),!0),new Array(Math.max(Number((null==t?void 0:t.roomsNumber)||0)-Number((null==t?void 0:t.bedroomsNumber)||0),0)).fill(0).map((function(e,r){return je({type:"room"},n.room((null==t?void 0:t.roomsNumber)?"".concat(r+1+((null==t?void 0:t.bedroomsNumber)||0)," "):"",null==t?void 0:t.rooms[((null==t?void 0:t.bedroomsNumber)||0)+r]))})),!0),new Array(Number((null==t?void 0:t.bathroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"bathroom"},n.bathroom((null==t?void 0:t.bathroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.restroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"toilet"},n.toilet((null==t?void 0:t.restroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.combinedBathroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"combined_bathroom"},n.combinedBathroom((null==t?void 0:t.combinedBathroomsNumber)?"".concat(r+1," "):""))})),!0),[je({type:"others"},n.others)],!1),re("initial"===e,je({type:"entrance"},n.entrance)),!0),re("initial"!==e,je({type:"keys"},n.keys)),!0),re(!("initial"!==e||!(null==t?void 0:t.parkingType)),je({type:"parking"},n.parking)),!0),[je({type:"additional"},n.additional)],!1)},gt=function(e){var n=e.feedback,i=e.label;return t(yt,je({status:n.status},{children:r(we,je({container:!0,alignItems:"center"},{children:[t(_e,je({size:"s",weight:500,color:"fiftyP"},{children:i})),"notSigned"!==n.status&&r(_t,{children:["signed"===n.status?t(xt,{}):t(wt,{}),!!n.comment&&t(G,je({placement:"bottom",content:r("div",{children:[t(_e,je({size:"xs",color:"fiftyP"},{children:"Comment"})),t(It,je({size:"xs"},{children:n.comment}))]})},{children:t(Nt,{})}))]})]}))}))},yt=Ce.div(Hn||(Hn=ze(["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"],["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"])),(function(e){return"notSigned"===e.status?xe.palette.background.light1:xe.palette.grey.zero}),xe.palette.grey.fifteenB,xe.breakpoints.sm),_t=Ce.div(En||(En=ze(["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"],["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"]))),xt=Ce(Pe)(Wn||(Wn=ze(["\n path {\n fill: ",";\n }\n"],["\n path {\n fill: ",";\n }\n"])),xe.palette.green.fiftyP),wt=Ce(Te)(Gn||(Gn=ze(["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"],["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"])),xe.palette.red.fiftyP),It=Ce(_e)(Un||(Un=ze(["\n margin-top: 8px;\n"],["\n margin-top: 8px;\n"]))),Nt=Ce(ke)(Yn||(Yn=ze(["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"],["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"])),xe.palette.grey.zero,xe.palette.grey.thirty),Ct=Me((function(e){var n=e.feedback,i=e.label,o=e.resendLabel,a=e.resend;return n?t(we,je({item:!0},{children:r(we,je({container:!0,alignItems:"center"},{children:[t(gt,{feedback:n,label:i}),"rejected"===n.status&&t(qt,je({size:"xs",variant:"orange",onClick:a,endIcon:t(Se,{})},{children:o}))]}))})):null})),qt=Ce(Ie)(Kn||(Kn=ze(["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"],["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"])),xe.breakpoints.sm),Pt=Me((function(e){var n=e.tenantFeedback,i=e.landlordFeedback,o=e.resignInspection,a=e.resendLabel,l=e.tenantLabel,s=e.landlordLabel;return n||i?r(Tt,je({container:!0,spacing:2,alignItems:"center"},{children:[t(Ct,{resend:o,resendLabel:a,feedback:n,label:l}),t(Ct,{resend:o,resendLabel:a,feedback:i,label:s})]})):null})),Tt=Ce(we)(Zn||(Zn=ze(["\n padding-top: 8px;\n"],["\n padding-top: 8px;\n"]))),kt=function(e){var n=e.filling,i=e.warningLabel;return r(we,je({container:!0,alignItems:"center"},{children:[n.wasMissing&&t(G,je({content:t(_e,je({size:"xs"},{children:i}))},{children:t(St,{width:17,height:17})})),r(Rt,{children:[r(_e,je({size:"s"},{children:[n.tagName," ",n.name?" | ".concat(n.name):""]})),!(!n.numberOfSubjects&&!n.serialNumber)&&r(At,je({size:"xs",color:"fiftyP"},{children:[n.numberOfSubjects?"".concat(n.numberOfSubjects," pieces"):"",n.numberOfSubjects&&n.serialNumber?" • ":"",n.serialNumber]}))]})]}))},St=Ce(qe)(Jn||(Jn=ze(["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"],["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"])),xe.palette.red.fiftyP),Rt=Ce.div(Qn||(Qn=ze(["\n margin-left: 8px;\n"],["\n margin-left: 8px;\n"]))),At=Ce(_e)(Xn||(Xn=ze(["\n margin-top: 4px;\n"],["\n margin-top: 4px;\n"]))),Mt=function(e){var n=e.className,r=e.form,i=e.index,o=e.disabled,a=Oe(e,["className","form","index","disabled"]);return t(Ft,je({className:n},{children:t(jt,{form:r,name:"fillingList.".concat(i,".check"),label:t(kt,je({},a)),disabled:o})}))},Ft=Ce(we)($n||($n=ze(["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"],["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"]))),jt=Ce(pe)(et||(et=ze(["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"],["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"]))),Ot=function(e,n,t,r){var i,o=function(){r&&r(),n.loader.endLoading()};ge((function(){Le(void 0,void 0,void 0,(function(){var r,i;return Be(this,(function(a){switch(a.label){case 0:return t?(null===(i=null===(r=e.fields)||void 0===r?void 0:r.meters)||void 0===i?void 0:i.length)?[3,2]:[4,n.fetchMeters()]:[3,3];case 1:a.sent(),a.label=2;case 2:return o(),[3,4];case 3:!1===t&&o(),a.label=4;case 4:return[2]}}))}))}),[t]),ge((function(){var t,r;n.loader.isLoading||(null===(r=null===(t=e.fields)||void 0===t?void 0:t.meters)||void 0===r?void 0:r.length)||!n.meters.length||(e.updateFormFields({meters:n.meters}),e.updateFormFields({metersFromStore:n.meters}))}),[n.meters,n.loader.isLoading]),ge((function(){var t,r;n.loader.isLoading||!(null===(r=null===(t=e.fields)||void 0===t?void 0:t.metersFromStore)||void 0===r?void 0:r.length)||n.meters.length||n.updateMetersFromForm(e.fields.metersFromStore)}),[null===(i=e.fields)||void 0===i?void 0:i.metersFromStore,n.loader.isLoading])},Lt=function(){var e=this;this.fetchFillingList=function(n,t){return Le(e,void 0,void 0,(function(){var e;return Be(this,(function(r){switch(r.label){case 0:return this.loader.startLoading(),[4,de(U.getFillingList(n,t))];case 1:return e=r.sent(),ee(e,this.loader,this.updateFillingList),[2]}}))}))},this.updateFillingList=function(n){e.fillingList=(null==n?void 0:n.map((function(e){return{id:e.id,name:e.description,tagName:e.feature_name,serialNumber:e.serial_code,numberOfSubjects:e.amount,wasMissing:e.is_absent}})))||[]},this.fillingList=[],this.loader=new ie,Fe(this)},Bt=function(e,n,t,r,i){var o=function(){i&&i(),t.loader.endLoading()};ge((function(){Le(void 0,void 0,void 0,(function(){var i,a;return Be(this,(function(l){switch(l.label){case 0:return r&&e?(null===(a=null===(i=n.fields)||void 0===i?void 0:i.fillingList)||void 0===a?void 0:a.length)?[3,2]:[4,t.fetchFillingList(e,"appliance")]:[3,3];case 1:l.sent(),l.label=2;case 2:return o(),[3,4];case 3:!1===r&&o(),l.label=4;case 4:return[2]}}))}))}),[e,r]),ge((function(){var e,r;t.loader.isLoading||(null===(r=null===(e=n.fields)||void 0===e?void 0:e.fillingList)||void 0===r?void 0:r.length)||n.updateFormFields({fillingList:t.fillingList.map((function(e){return je(je({},e),{check:!1})}))})}),[t.fillingList,t.loader.isLoading])},Dt=function(n,t){return e.object().shape(je(je(je(je({transferAct:e.mixed()},"maroom_tenant"!==n||t?{}:{signedContract:e.mixed().required(I)}),"tenant_maroom"===n?{rcTerminationAgreement:e.mixed().required(I)}:{}),"maroom_landlord"===n?{scTerminationAgreement:e.mixed().required(I)}:{}),"tenant_landlord"===n?{rcTerminationAgreement:e.mixed().required(I),scTerminationAgreement:e.mixed().required(I)}:{}))},zt=function(e,n,t){return De(De(De(De([je({label:"Transfer inspection file",name:"transferAct",variant:"file"},null==t?void 0:t.transferAct)],re("maroom_tenant"===e&&!n,je({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==t?void 0:t.signedContract)),!0),re("tenant_maroom"===e,je({label:"Contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),re("maroom_landlord"===e,je({label:"Contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),"tenant_landlord"===e?[je({label:"Rental contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.rcTerminationAgreement),je({label:"Service contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.scTerminationAgreement)]:[],!0)},Vt=function(e,n,t){var r=e.inspectionsStore,i=e.apartmentId,o=n.formStateName,a=n.formFieldsName,l=r.creationForm.fields;l&&l.apartmentId!==i&&oe(r.indexDB,[o,a]),r.setCanUpdateDB(!0),t&&t()},Ht=function(e,n,t){var r=e.inspectionsStore,i=n.formStateName,o=n.formFieldsName;r.setCanUpdateDB(!1),r.creationForm.resetForm(),oe(r.indexDB,[i,o]),t&&t()},Et=function(e){var n,t=e.apartmentId,r=e.inspectionsStore,i=e.metersStore,o=e.fillingStore,a=be(!1),l=a[0],s=a[1],u=be(!1),d=u[0],c=u[1],m=r.creationForm,p=null===(n=m.fields)||void 0===n?void 0:n.type,v=p?"regular"===p||"transfer"===p:void 0,f=o.loader.isLoading,b=i.loader.isLoading;ge((function(){l&&d&&!f&&!b&&r.setCanLoadDB(!0)}),[l,d,f,b]),Ot(m,i,v,(function(){return s(!0)})),Bt(t||null,m,o,v,(function(){return c(!0)}))},Wt=function(e,n,t){var r=e.dbCreationTime,i=e.formFieldsName,o=e.formStateName,a=e.inspectionCreationFormName,l=n.inspectionsStore,s=n.apartmentId,u=l.creationForm,d=l.actionLoader,c=l.indexDB,m=l.setCanUpdateDB,p=l.canUpdateDB,v=a,f=function(e){ue(e,i),ue(e,o)};var b=function(){return Le(void 0,void 0,void 0,(function(){return Be(this,(function(e){return le(v,f,d,(function(e){return Le(void 0,void 0,void 0,(function(){var n;return Be(this,(function(a){switch(a.label){case 0:return l.setIndexDB(e),m(!1),c=localStorage.getItem(r),p=Date.now(),c&&p-Number(c)>864e5&&(oe(l.indexDB,[o,i]),localStorage.removeItem(r)),[4,se(e,i,d)];case 1:return(n=a.sent())?(null==n?void 0:n.apartmentId)===s&&(u.updateFormFields(je(je({},n),{date:n.date?ce.fromISO(n.date):null})),t&&t()):m(!0),[2]}var c,p}))}))})),[2]}))}))};ge((function(){s&&b()}),[s]),ge((function(){l.canLoadDB&&c&&Le(void 0,void 0,void 0,(function(){var e,n;return Be(this,(function(t){switch(t.label){case 0:return[4,se(c,o,d)];case 1:return e=t.sent(),[4,se(c,i,d)];case 2:return n=t.sent(),e&&(null==n?void 0:n.apartmentId)===s&&u.setStep(Number(e.step)),m(!0),[2]}}))}))}),[l.canLoadDB,c]),ge((function(){if(p){var e={step:u.step};ae(c,o,e,d),ae(c,i,u.fields,d),localStorage.getItem(r)||localStorage.setItem(r,Date.now().toString())}}),[u.step])},Gt=function(e){var n=e.label,r=e.onClick,i=e.isActive;return t(Ie,je({size:"xs",variant:i?"primary":"white",onClick:r},{children:n}))},Ut=function(e){var n=e.metroStation,i=n.color,o=n.name;return r(Yt,je({item:!0,container:!0,alignItems:"center"},{children:[t(Kt,{style:{background:i}}),t(_e,je({size:"s",color:"sixty"},{children:o}))]}))},Yt=Ce(we)(nt||(nt=ze(["\n width: auto;\n"],["\n width: auto;\n"]))),Kt=Ce.div(tt||(tt=ze(["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"],["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"]))),Zt=function(e){var n=e.phone,i=$(n," "),o=i.replace(/\d/g,"");return r(Jt,je({container:!0,alignItems:"center",wrap:"nowrap"},{children:[t(Qt,{width:14,height:14}),t("a",je({href:"tel:+".concat(o)},{children:t(_e,je({size:"s",weight:500,color:"sixty"},{children:i}))}))]}))},Jt=Ce(we)(rt||(rt=ze(["\n width: auto;\n"],["\n width: auto;\n"]))),Qt=Ce(Re)(it||(it=ze(["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"],["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"])),xe.palette.grey.sixty),Xt=function(e){var n=e.inspection,i=e.onClose,o=e.getClientLink,a=e.getInspectionLink,l=n.apartment,s=n.tenant,u=n.landlord,d=n.metroStations,c=s||u,m=o&&c?o(null==c?void 0:c.id):"",p=a(l.id,n.id);return r($t,{children:[t(K,je({href:p},{children:t(er,{imageSrc:l.previewImage,description:l.address})})),t(we,je({container:!0,spacing:2,alignItems:"center"},{children:d.map((function(e){return t(Ut,{metroStation:e},e.name)}))})),!!c&&r(nr,je({container:!0,alignItems:"center",justify:"space-between"},{children:[m?t(rr,je({href:m},{children:t(Z,{weight:500,user:c})})):t(Z,{weight:500,user:c}),!!(null==c?void 0:c.phoneNumber)&&t(Zt,{phone:null==c?void 0:c.phoneNumber})]})),t(tr,je({isCircle:!0,size:"xs",variant:"whiteWithGray",onClick:i},{children:t(Ae,{width:6,height:6})}))]})},$t=Ce.div(ot||(ot=ze(["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"],["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"])),xe.palette.grey.zero),er=Ce(Y)(at||(at=ze(["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"],["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"]))),nr=Ce(we)(lt||(lt=ze(["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"],["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"])),xe.palette.grey.fifteenB),tr=Ce(Ie)(st||(st=ze(["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"],["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"]))),rr=Ce(K)(ut||(ut=ze(["\n max-width: calc(100% - 140px);\n"],["\n max-width: calc(100% - 140px);\n"]))),ir=function(e){var n=e.inspection,i=e.map,o=e.label,a=Oe(e,["inspection","map","label"]),l=J(n.location,i),s=l.ref,u=l.isOpen,d=l.closeCard,c=l.toggleCard;return t(Q,je({map:i,position:n.location},{children:r(or,je({ref:s},{children:[t(Gt,{label:o,isActive:u,onClick:c}),u&&t(Xt,je({inspection:n,onClose:d},a))]}))}))},or=Ce.div(dt||(dt=ze(["\n position: relative;\n"],["\n position: relative;\n"])));export{Ln as AddedMetersBlock,gn as AdditionalInfoFieldsSchema,yn as AdditionalInfoStepSchema,$e as BasicApartmentInfoFieldsSchema,en as BasicApartmentInfoStepSchema,ln as DetailApartmentInfoFieldsSchema,sn as DetailApartmentInfoStepSchema,Rn as FillingInfoFieldsSchema,Lt as FillingListStore,tn as HouseInfoFieldsSchema,rn as HouseInfoStepSchema,xn as HouseServicesInfoFieldsSchema,wn as HouseServicesInfoStepSchema,Pt as InspectionFeedback,Mt as InspectionFillingCard,Vn as InventoryMeterInfoFields,Cn as MetersInfoFieldsSchema,qn as MetersInfoStepSchema,Xt as ObjectForMapCard,ir as ObjectForMapOverlay,Gt as ObjectForMapPoint,dn as RoomsApartmentInfoFieldsSchema,cn as RoomsApartmentInfoStepSchema,vt as RoomsInfoFieldsSchema,ft as RoomsInfoStepSchema,pn as SecurityApartmentInfoFieldsSchema,vn as SecurityApartmentInfoStepSchema,Tn as TelecommunicationsInfoFieldsSchema,kn as TelecommunicationsInfoStepSchema,Ue as WaterMeterFieldsSchema,Qe as apartmentFields,hn as getAdditionalInfoStepFields,fn as getAvailableResourcesFields,Xe as getBasicApartmentInfoFields,an as getDetailApartmentInfoFields,Sn as getFillingInfoFields,nn as getHouseInfoStep,_n as getHouseServicesInfoStep,pt as getInventoryDocumentsFields,mt as getInventoryDocumentsSchema,Fn as getInventoryMeterFields,Nn as getMetersInfoStepFields,Ge as getPartialMeterInfoSchema,un as getRoomsApartmentInfoFields,ht as getRoomsImagesSteps,bt as getRoomsInfoStepFields,mn as getSecurityApartmentInfoFields,Pn as getTelecommunicationsInfoStepFields,zt as getTransferDocumentsFields,Dt as getTransferDocumentsSchema,Ke as getWaterMeterFields,Ze as inspectionsRequestBody,Je as inspectionsRequests,Ht as onInspectionModalClose,Vt as onInspectionModalOpen,ct as renderMetersSteps,Bt as useFillingList,Et as useInspectionData,Wt as useInspectionIndexDB,Ot as useMetersValues};
|
1
|
+
import*as e from"yup";import n from"lodash";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{NumberField as i,KUISettings as o,requests as a,uploadFilesWithoutFilter as l,uploadFiles as u,uploadNewFile as s,ImageStore as c,FileStore as d,matchesAPIFillingTypes as m,CountryAutocomplete as p,RegionAutocomplete as v,CityAutocomplete as f,InputWithAddressAutocomplete as b,HouseTypesValues as h,WallMaterialsValues as g,SlabsTypesValues as y,GasTypesValues as _,BooleanValues as x,positiveNumberSchema as w,defaultRequiredMessage as I,RenovationTypeValues as N,RenovationStyleValues as C,RoomTypeValues as q,RoomTypesValues as P,ParkingTypesValues as T,fieldWithConditionSchema as k,BigCheckbox as S,getApartmentPaymentFields as R,phoneWithConditionSchema as A,getNumbersValues as M,TVTypesValues as F,phoneNonRequiredSchema as j,InputFileWithVisibility as O,FillingTypeValues as L,FillingTagsAutocomplete as B,getMeterValuesFieldsSchema as D,basicFieldsOfNewResourceMeter as z,meterUnitLabel as V,FormWrapper as H,MeterTypeRadioGroup as E,InputByType as W,Tooltip as G,ApartmentsAgent as U,PreviewContent as Y,Link as K,UserBadge as Z,useMapCards as J,MapOverlay as Q}from"kui-crm";import{clearNotValidFields as X,getPhoneNumberFromPhoneParams as $,resHandler as ee,callPromises as ne,getPhoneParamsFromString as te,addToArrayByCondition as re,Loader as ie,clearIndexStores as oe,addToIndexDBWithQueue as ae,initIndexDB as le,readFromIndexDB as ue,addIndexDBStore as se}from"kui-utils";import ce from"await-to-js";import{DateTime as de}from"luxon";import{DependentInput as me,CheckboxWithController as pe,InputPhoneWithForm as ve,InputFile as fe}from"kui-complex";import{useState as be,useMemo as he,useEffect as ge}from"react";import{useForm as ye}from"react-hook-form";import{Caption as _e,theme as xe,Grid as we,Button as Ie}from"kui-basic";import{yupResolver as Ne}from"@hookform/resolvers/yup";import Ce from"@emotion/styled";import{WarningIcon as qe,CheckIcon as Pe,CancelIcon as Te,CommentIcon as ke,UpdateIcon as Se,PhoneIcon as Re,CloseIcon as Ae}from"kui-icon";import{observer as Me}from"mobx-react";import{makeAutoObservable as Fe}from"mobx";var je=function(){return je=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},je.apply(this,arguments)};function Oe(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}function Le(e,n,t,r){return new(t||(t=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,l)}u((r=r.apply(e,n||[])).next())}))}function Be(e,n){var t,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e],r=0}finally{t=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}function De(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i<o;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return e.concat(r||Array.prototype.slice.call(n))}function ze(e,n){return Object.defineProperty?Object.defineProperty(e,"raw",{value:n}):e.raw=n,e}var Ve,He,Ee,We,Ge=function(n,t){var r=n.filter((function(e){return e.maxIntegerPart})).map((function(e){return e.name})),i=r.map((function(n){var r;return(r={})[n]=e.number().when(["withDefaultValue","values.".concat(n)],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).when([],{is:function(){return t},then:function(e){return e.required("This field is required")}}).transform((function(e){return Number.isNaN(e)?void 0:e})),r}));return e.object().shape(je({number:e.string().trim().required("This field is required"),withDefaultValue:e.boolean(),values:e.object(je({},Object.fromEntries(r.map((function(n){return[n,e.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()]})))))},Object.assign.apply(Object,De([{}],i,!1))))},Ue=function(n){return e.object().shape({number:e.string().trim().required("This field is required"),withDefaultValue:e.boolean(),values:e.object({value:e.number().transform((function(e){return Number.isNaN(e)?void 0:e})).nullable()}),value:e.number().when(["withDefaultValue","values.value"],(function(e,n){var t=e[0],r=e[1];return t&&r?n.min(r,"The meter readings are lower than in the previous transfer inspection"):n.min(0)})).when([],{is:function(){return n},then:function(e){return e.required("This field is required")}}).transform((function(e){return Number.isNaN(e)?void 0:e}))})},Ye=function(e){var n,r,o=e.form,a=e.prefixName,l=e.settings,u=e.meters,s=e.withCheckValue,c=e.meter,d=o.watch("".concat(a,"number")),m=(null==c?void 0:c.isFilled)?c:null==u?void 0:u.find((function(e){return e.number===d}));return t(i,je({isRequired:!s,label:"Value",name:"".concat(a,"value"),maxIntegerPart:7,maxDecimalPart:3,warningMessage:"There are deviations in meter readings. It should be no more than",form:o,maxValue:(null===(n=null==m?void 0:m.maxValue)||void 0===n?void 0:n.value)&&s?Number(m.maxValue.value):null,placeholder:null===(r=null==m?void 0:m.values)||void 0===r?void 0:r.value},null==l?void 0:l.value))},Ke=function(e,t,r,i,o){var a=i?"".concat(i,"."):"",l=!t||!(null==t?void 0:t.isFilled)&&e.length?null==e?void 0:e.map((function(e){return{value:e.number,label:"".concat(n.capitalize(e.type||"")," | #").concat(e.number)}})):[{value:t.number,label:"".concat(n.capitalize(t.type||"")," | #").concat(t.number)}];return[je({label:"Meter",name:"".concat(a,"number"),variant:"select",options:l,size:12,isRequired:!0,disabled:1===l.length},null==o?void 0:o.meter),{name:"".concat(a,"value"),variant:"custom",CustomInput:Ye,prefixName:a,meters:e,settings:o,withCheckValue:r,meter:t}]},Ze={getPostBodyInitialInspection:function(e,n){return{based_on:null,date:(e.date||de.now()).toISODate(),inspection_type:"initial",dropbox_link:e.dropboxLink,photo_groups:n,initial:this.getInitialInspectionFields(e)}},getInitialInspectionFields:function(e){var n,t,r;return{city:e.city.id,address:e.apartment.address,apartment_number:e.apartmentNumber||"",post_index:e.zipCode,floor:e.floor,floor_count:e.floorCount,room_type:e.typeOfObject,num_entrance:e.entrance,has_intercom:e.hasIntercom,intercom_code:e.intercomCode,has_gate:e.hasGate,gate_code:e.gateCode,area:e.area,rooms_number:e.roomsNumber,bedrooms_number:e.bedroomsNumber,bathrooms_number:e.bathroomsNumber,restrooms_number:e.restroomsNumber,combined_bathrooms_number:e.combinedBathroomsNumber,number_of_windows:e.numberOfWindows,renovation_year:null===(n=e.renovation)||void 0===n?void 0:n.year,renovation_type:null===(t=e.renovation)||void 0===t?void 0:t.type,renovation_style:null===(r=e.renovation)||void 0===r?void 0:r.style,wall_type:e.wallMaterial,overlap_type:e.overlapType,passenger_elevators_number:e.passengerElevatorsCount,service_elevators_number:e.serviceElevatorsCount,ceiling_height:e.ceilingHeight,building_year:e.buildingYear,serial_number:e.houseNumber,type_gas:e.gasLeads,hot_water:e.withHotWater,type_houses:e.typeOfHouse,parking_type:e.parkingType,parking_number:e.parkingNumber,rooms:e.rooms.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n}})),used_resources:{electricity:e.availableResources.electricity,water:e.availableResources.water,gas:e.availableResources.gas,heating:e.availableResources.heating}}},getPostBodyRegularInspection:function(e,n){return{date:(e.date||de.now()).toISODate(),inspection_type:"regular",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,regular:je(je({},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getPostBodyTransferInspection:function(e,n,t){return{date:(e.date||de.now()).toISODate(),inspection_type:"transfer",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,transfer:je(je({inspection_document:t.transferAct||void 0,rental_contract_signed_document:t.rentalContractFile||void 0,rental_contract_termination_document:t.rentalTerminationAgreement||void 0,service_contract_termination_document:t.serviceTerminationAgreement||void 0,transfer_type:e.transferType},this.getInspectionFilling(e.fillingList)),this.getPartialInspectionMeters(e.meters))}},getInspectionFilling:function(e){var n;return{filling:null===(n=null==e?void 0:e.filter((function(e){return e})))||void 0===n?void 0:n.map((function(e){return{apartment_feature_id:e.id,is_absent:!e.check}}))}},getPartialInspectionMeters:function(e){var n=this;return{meters:(null==e?void 0:e.map((function(e,t){return{id:e.id,resource_type:e.resource,meter_type:e.type,passport_number:e.number,photos:n.getFilesParams(e.images),values:X(n.getInspectionMeterValues(e))}})))||[]}},getPostBodyInventoryInspection:function(e,n,t,r,i,o){var a,l,u,s,c,d,m,p,v,f,b,h,g=this;return{date:(e.date||de.now()).toISODate(),inspection_type:"inventory",based_on:null,dropbox_link:e.dropboxLink,photo_groups:n,inventory:je({inspection_document:i||void 0,service_contract_signed_document:o||void 0,allowed_children:e.withChildren,allowed_pets:e.withPets,allowed_smoking:e.withSmoking,additional_terms:e.additionalTerms,country_of_residence:(null===(a=e.countryOfResidence)||void 0===a?void 0:a.id)||null,administrative_company:(null===(l=e.company)||void 0===l?void 0:l.id)||null,tax_type:e.taxesType,financial_personal_account:e.communalServicesAccount,max_electricity_counters:null===(u=e.maxMeters)||void 0===u?void 0:u.electricity,max_gas_counters:null===(s=e.maxMeters)||void 0===s?void 0:s.gas,max_heating_counters:null===(c=e.maxMeters)||void 0===c?void 0:c.heating,max_water_counters:null===(d=e.maxMeters)||void 0===d?void 0:d.water,has_barrier:e.hasBarrier,has_concierge:e.hasConcierge,has_security:e.hasSecurity,has_video_surveillance:e.hasVideoControl,barrier_phone:e.barrierPhone?$(e.barrierPhone):null,concierge_phone:e.conciergePhone?$(e.conciergePhone):null,security_phone:e.securityPhone?$(e.securityPhone):null,video_surveillance_phone:e.videoControlPhone?$(e.videoControlPhone):null,home_phone:e.homePhone?$(e.homePhone):null,wifi_name:null===(m=e.wifi)||void 0===m?void 0:m.name,wifi_password:null===(p=e.wifi)||void 0===p?void 0:p.password,internet_provider_link:null===(v=e.internetProvider)||void 0===v?void 0:v.link,internet_provider_login:null===(f=e.internetProvider)||void 0===f?void 0:f.login,internet_provider_password:null===(b=e.internetProvider)||void 0===b?void 0:b.password,payer_code:e.payerCode,rooms:null===(h=e.rooms)||void 0===h?void 0:h.map((function(e,n){return{id:e.id,room_type:e.type,order_number:n,area:e.area}})),filling:e.fillingList.map((function(e,n){var r;return{feature:(null===(r=e.tag)||void 0===r?void 0:r.id)||0,description:e.description,model:e.name,serial_code:e.serialNumber,amount:e.numberOfSubjects,photos:g.getFilesParams(e.images),instruction:t[n]}}))},this.getInventoryInspectionMeters(e.meters,r))}},getInventoryInspectionMeters:function(e,n,t){var r=this;return{meters:(null==e?void 0:e.map((function(e,i){return je(je({},r.getMeterCommonFields(e)),{passport:n[i],values:X(r.getInspectionMeterValues(e,"initialValue")),photos:t?t[i]:r.getFilesParams(e.images),no_tariff:e.noTariff,auto_sending:e.withAutoSending})})))||[]}},getInspectionMeterValues:function(e,n){var t;if("electricity"===e.resource){var r=n||"",i=e["".concat(r,"T1")],o=e["".concat(r,"T2")],a=e["".concat(r,"T3")];return{T1:i?Number(i):i,T2:o?Number(o):o,T3:a?Number(a):a}}var l=n||"value";if("water"===e.resource){if("cold"===e.type){var u=e[l];return{cold:u?Number(u):u}}var s=e[l];return{hot:s?Number(s):s}}var c=e[l];return(t={})[e.resource]=c?Number(c):c,t},getMeterCommonFields:function(e){var n;return{id:e.id,meter_type:e.type,passport_number:e.number,resource_type:e.resource,activation_date:(null===(n=e.startDate)||void 0===n?void 0:n.toISODate())||null}},getMeterValues:function(e,n){return X({initial_value:e,last_value:n})},getFilesParams:function(e){return(null==e?void 0:e.map((function(e){return e.uploadedData})).filter((function(e){return e})))||[]}},Je={createInspectionHandler:function(e,n,t,r){return Le(this,void 0,void 0,(function(){var i,a,l;return Be(this,(function(u){switch(u.label){case 0:if(!e)return[3,5];n.startLoading("inspection creation"),i=void 0,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r()];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),(l=o.getSettings().Sentry).withScope((function(e){e.setExtras(t),l.captureException(new Error("Ошибка в генерации тела запроса при создании инспекции"))})),n.setError("Некорректное тело запроса",a),n.endLoading(),[3,4];case 4:return i?[2,this.createInspection(e,i,n)]:[2,null];case 5:return[2,null]}}))}))},getInspectionTypes:function(e){return Le(this,void 0,void 0,(function(){var n,t,r;return Be(this,(function(i){switch(i.label){case 0:return[4,ce(a.get("/apartments/".concat(e,"/inspection-types")))];case 1:return n=i.sent(),t=n[0],r=n[1],t?[2,[t,void 0]]:[2,[null,null==r?void 0:r.inspection_types]]}}))}))},getTransferTypes:function(e){return Le(this,void 0,void 0,(function(){var n,t,r;return Be(this,(function(i){switch(i.label){case 0:return[4,ce(a.get("/apartments/".concat(e,"/transfer-inspection-types")))];case 1:return n=i.sent(),t=n[0],r=n[1],t?[2,[t,void 0]]:[2,[null,null==r?void 0:r.transfer_inspection_types]]}}))}))},createInspection:function(e,n,t){var r;return Le(this,void 0,void 0,(function(){var i;return Be(this,(function(o){switch(o.label){case 0:return[4,ce(a.post("/apartments/".concat(e,"/inspections"),n))];case 1:return i=o.sent(),ee(i,t),[2,null===(r=i[1])||void 0===r?void 0:r.id]}}))}))},createInitialInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n;return Be(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,Ze.getPostBodyInitialInspection(e,n)]}))}))}))]}))}))},createRegularInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n;return Be(this,(function(t){return n=this.getRoomParams(e.roomsImages),[2,Ze.getPostBodyRegularInspection(e,n)]}))}))}))]}))}))},createTransferInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n,r;return Be(this,(function(i){switch(i.label){case 0:return n=this.getRoomParams(e.roomsImages),[4,l(t,[e.transferAct,e.signedContract,e.rcTerminationAgreement,e.scTerminationAgreement])];case 1:return r=i.sent(),[2,Ze.getPostBodyTransferInspection(e,n,{transferAct:r[0],rentalContractFile:r[1],rentalTerminationAgreement:r[2],serviceTerminationAgreement:r[3]})]}}))}))}))]}))}))},createInventoryInspection:function(e,n,t){return Le(this,void 0,void 0,(function(){var r=this;return Be(this,(function(i){return[2,this.createInspectionHandler(n,t,e,(function(){return Le(r,void 0,void 0,(function(){var n,r,i,o,a;return Be(this,(function(l){switch(l.label){case 0:return n=e.fillingList.map((function(e){return e.instruction})),r=(null===(a=e.meters)||void 0===a?void 0:a.map((function(e){return e.passportFile})))||[],[4,ne([u(t,n),u(t,r),s(t,e.inventoryAct),s(t,e.signedContract)])];case 1:return i=l.sent(),o=this.getRoomParams(e.roomsImages),[2,Ze.getPostBodyInventoryInspection(e,o,i[0],i[1],i[2],i[3])]}}))}))}))]}))}))},getRoomParams:function(e){var n,t=-1;return(null===(n=null==e?void 0:e.map((function(e){var n="room"===e.type||"bedroom"===e.type;return n&&(t+=1),{purpose:null==e?void 0:e.type,comment:null==e?void 0:e.comment,photos:Ze.getFilesParams((null==e?void 0:e.files)||[]),room_order_number:n?t:void 0}})))||void 0===n?void 0:n.filter((function(e){return e.purpose})))||[]}},Qe={getApartmentDescriptionInfo:function(e){return je(je(je(je(je(je({},this.getApartmentMainInfo(e)),this.getApartmentSecurityInfo(e)),this.getApartmentDetailInfo(e)),this.getApartmentTelecommunicationInfo(e)),this.getApartmentHouseInfo(e)),this.getMaxMetersParams(e))},getApartmentMainInfo:function(e){return je(je({},e),{apartmentNumber:e.apartment_number,zipCode:e.post_index||"",floorCount:e.floor_count,entrance:e.num_entrance,geolocation:this.getGeolocationParams(e.geolocation),distanceToCenter:e.distance_to_center_kilometers||null,typeOfObject:e.room_type})},getApartmentSecurityInfo:function(e){var n,t,r,i,o,a;return{hasIntercom:null!==(n=e.has_intercom)&&void 0!==n?n:null,hasGate:null!==(t=e.has_gate)&&void 0!==t?t:null,hasBarrier:null!==(r=e.has_barrier)&&void 0!==r?r:null,hasSecurity:null!==(i=e.has_security)&&void 0!==i?i:null,hasConcierge:null!==(o=e.has_concierge)&&void 0!==o?o:null,hasVideoControl:null!==(a=e.has_video_surveillance)&&void 0!==a?a:null,intercomCode:e.intercom_code||"",gateCode:e.gate_code||"",barrierPhone:e.barrier_phone?te(e.barrier_phone):null,conciergePhone:e.concierge_phone?te(e.concierge_phone):null,securityPhone:e.security_phone?te(e.security_phone):null,videoControlPhone:e.video_surveillance_phone?te(e.video_surveillance_phone):null}},getApartmentDetailInfo:function(e){var n;return{area:e.area,livingArea:e.living_area,kitchenArea:e.kitchen_area,roomsNumber:e.rooms_number,bedroomsNumber:e.bedrooms_number,bathroomsNumber:e.bathrooms_number,restroomsNumber:e.restrooms_number,combinedBathroomsNumber:e.combined_bathrooms_number,ceilingHeight:e.ceiling_height,numberOfWindows:e.number_of_windows,renovation:{year:e.renovation_year||null,type:e.renovation_type||null,style:e.renovation_style||null},rooms:(null===(n=e.rooms)||void 0===n?void 0:n.map((function(e){return{id:e.id,area:e.area||null,type:e.room_type||null}})))||[]}},getApartmentTelecommunicationInfo:function(e){return{homePhone:e.home_phone?te(e.home_phone):null,wifi:{name:e.wifi_name,password:e.wifi_password},internetProvider:{link:e.internet_provider_link,login:e.internet_provider_login,password:e.internet_provider_password},tvType:e.tv_type}},getApartmentHouseInfo:function(e){return{typeOfHouse:e.type_houses,buildingYear:e.building_year,houseNumber:e.serial_number,wallMaterial:e.wall_type,overlapType:e.overlap_type,parkingType:e.parking_type,parkingNumber:e.parking_number,passengerElevatorsCount:e.passenger_elevators_number?Number(e.passenger_elevators_number):null,serviceElevatorsCount:e.service_elevators_number?Number(e.service_elevators_number):null,gasLeads:e.type_gas,withHotWater:e.hot_water}},getMaxMetersParams:function(e){return{maxMeters:{water:e.max_water_counters,electricity:e.max_electricity_counters,gas:e.max_gas_counters,heating:e.max_heating_counters}}},getGeolocationParams:function(e){return e?{lat:Number(e.lat),lng:Number(e.lon)}:null},getObjectRoomsImages:function(e){return e.map((function(e){return{id:e.id,type:e.purpose,comment:e.comment,images:e.photos.map((function(e){return c.initFromImageModel(e)})),roomNumber:"number"==typeof e.room_order_number?e.room_order_number+1:0}}))},getInspectionFillingParams:function(e,n){var t;return je({id:e.id,name:e.description||"",tag:{id:e.feature.id,name:e.feature.name},images:null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return c.initFromImageModel(e)})),serialNumber:e.serial_code,numberOfSubjects:Number(e.amount),instruction:e.instruction?d.initFromDocumentModel(e.instruction):null,type:m[e.feature.feature_type]},n&&"appliance"===e.feature.feature_type?{check:!e.is_absent,wasMissing:e.previously_absent}:{})},getApartmentDescriptionWithMetro:function(e){return je(je({},this.getApartmentDescriptionInfo(e)),{metroStations:this.getMetroStationsParams(null==e?void 0:e.metro_stations)})},getMetroStationsParams:function(e){return(null==e?void 0:e.map((function(e){return{id:e.metro_station_id,name:e.name,walkDistance:e.distance_walk_meters,carDistance:Number(e.distance_car_kilometers),carTime:e.time_car_minutes,walkTime:Math.round(e.distance_walk_meters/(5e3/60))}})))||[]},getMeterValues:function(e,n,t){var r,i,o,a,l,u;if("electricity"===n){var s=t||"";return je(je(((r={})["".concat(s,"T1")]=Number(e.values.T1),r),"T1"!==e.meter_type&&((i={})["".concat(s,"T2")]=Number(e.values.T2),i)),"T3"===e.meter_type&&((o={})["".concat(s,"T3")]=Number(e.values.T3),o))}var c=t||"value";return"water"===n?"cold"===e.meter_type?((a={})["".concat(c)]=Number(e.values.cold),a):((l={})["".concat(c)]=Number(e.values.hot),l):((u={})["".concat(c)]=Number(e.values[n]),u)},getTransferMetersInfo:function(e){var n=this;return{meters:e.map((function(e){var t;return je({id:e.id,type:e.meter_type,number:e.passport_number,resource:e.resource_type,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return c.initFromImageModel(e)})))||[],values:n.getMeterValues(e,e.resource_type)},n.getMeterValues(e,e.resource_type))}))}},getApartmentPaymentInfo:function(e){return{payerCode:e.payer_code,communalServicesAccount:e.financial_personal_account,managementCompany:e.administrative_company?je(je({},e.administrative_company),{operatingAccount:e.payer_code}):null}},getInspectionPaymentInfo:function(e){return je(je({},this.getApartmentPaymentInfo(e)),{countryOfResidence:e.country_of_residence,taxesType:e.tax_type})},getMeterInfo:function(e,n){var t;return{id:e.id,type:e.meter_type,number:e.passport_number,startDate:e.activation_date?de.fromISO(e.activation_date):null,company:e.company,operationalAccountNumber:e.operating_account,resource:n,tariff:e.tariff?{id:e.tariff.id,name:e.tariff.code_name}:null,passportFile:e.passport?d.initFromFileModel(e.passport):null,images:(null===(t=e.photos)||void 0===t?void 0:t.map((function(e){return c.initFromImageModel(e)})))||[]}},getInventoryMetersInfo:function(e){var n=this;return{meters:e.meters.map((function(e){return je(je({},n.getMeterInfo(e,e.resource_type)),n.getMeterValues(e,e.resource_type,"initialValue"))}))}}},Xe=function(e,n){return[je({name:"country",label:"Country",variant:"custom",CustomInput:p,size:12},null==n?void 0:n.country),je({name:"region",label:"Region",variant:"custom",CustomInput:v},null==n?void 0:n.region),je({name:"city",label:"City",variant:"custom",CustomInput:f,isRequired:!0},null==n?void 0:n.city),je({name:"apartment",variant:"custom",CustomInput:b,handlePlaceSelect:e,size:12,isRequired:!0},null==n?void 0:n.apartment),je({label:"Apartment",name:"apartmentNumber","data-testid":"apartment_number",isRequired:!0},null==n?void 0:n.apartmentNumber),je({label:"Zip code",name:"zipCode"},null==n?void 0:n.zipCode)]},$e={apartment:e.object({address:e.string().trim().required("This field is required")}),apartmentNumber:e.string().required("This field is required"),city:e.object({name:e.string().required("This field is required")})},en=e.object($e),nn=function(e){return[je({name:"typeOfHouse",label:"Type houses",variant:"select",options:h,isRequired:!0},null==e?void 0:e.typeOfHouse),je({name:"houseNumber",label:"House series"},null==e?void 0:e.houseNumber),je({name:"wallMaterial",label:"Wall material",variant:"select",options:g,isRequired:!0},null==e?void 0:e.wallMaterial),je({name:"overlapType",label:"Overlap type",variant:"select",options:y,isRequired:!0},null==e?void 0:e.overlapType),je({name:"gasLeads",label:"Gas",variant:"select",options:_,isRequired:!0},null==e?void 0:e.gasLeads),je({name:"withHotWater",label:"Hot water",variant:"select",options:x,isRequired:!0},null==e?void 0:e.withHotWater),je({name:"passengerElevatorsCount",label:"Passenger elevators",type:"number",isRequired:!0},null==e?void 0:e.passengerElevatorsCount),je({name:"serviceElevatorsCount",label:"Service elevators",type:"number",isRequired:!0},null==e?void 0:e.serviceElevatorsCount),je({name:"buildingYear",label:"Builded",isRequired:!0},null==e?void 0:e.buildingYear)]},tn={passengerElevatorsCount:w,serviceElevatorsCount:w,typeOfHouse:e.string().required(I),buildingYear:e.string().required(I),wallMaterial:e.string().required(I),overlapType:e.string().required(I),gasLeads:e.string().required(I),withHotWater:e.boolean().required(I)},rn=e.object(tn),on={step:.01},an=function(e,n,t){var r,i;return De(De([je(je({label:"Total area",name:"area",type:"number",isRequired:!0},on),null==t?void 0:t.area)],e?new Array(Number(e)).fill(0).map((function(e,r){var i,o=n&&r<n?"Bedroom ".concat(r+1):"Room ".concat(r+1),a=n&&r<n?"bedrooms":"rooms";return[je({name:"rooms.".concat(r,".type"),label:"".concat(o," type"),variant:"select",options:q,isRequired:!0},(null==t?void 0:t[a])?null===(i=t[a](r))||void 0===i?void 0:i.type:{})]})).flat():[],!0),[je(je({name:"ceilingHeight",label:"Ceiling height",type:"number",cornerLabel:"m.",isRequired:!0},on),null==t?void 0:t.ceilingHeight),je({name:"numberOfWindows",label:"Windows",type:"number",isRequired:!0},null==t?void 0:t.numberOfWindows),je({name:"renovation.year",label:"Year of last renovation",type:"number",isRequired:!0},null==t?void 0:t.renovation.year),je({name:"renovation.type",label:"Type of renovation",variant:"select",options:N,isRequired:!0},null===(r=null==t?void 0:t.renovation)||void 0===r?void 0:r.type),je({name:"renovation.style",label:"Renovation style",variant:"select",options:C,isRequired:!0},null===(i=null==t?void 0:t.renovation)||void 0===i?void 0:i.style)],!1)},ln={area:e.number().positive().required("This field is required"),rooms:e.array().of(e.object({type:e.string().required("This field is required")})),numberOfWindows:e.number().min(0).required("This field is required"),renovation:e.object({year:e.number().positive().required("This field is required"),type:e.string().required("This field is required"),style:e.string().required("This field is required")}),ceilingHeight:w},un=e.object(ln),sn=function(e,n){return[je({label:"Floor",name:"floor",type:"number",isRequired:!0},null==n?void 0:n.floor),je({label:"Floors",name:"floorCount",type:"number",isRequired:!0},null==n?void 0:n.floorCount),je({label:"Rooms",name:"roomsNumber",type:"number",isRequired:!0},null==n?void 0:n.roomsNumber),je({label:"Bedrooms",name:"bedroomsNumber",type:"number",isRequired:!0,disabled:0===e||"0"===e},null==n?void 0:n.bedroomsNumber),je({label:"Bathrooms",name:"bathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.bathroomsNumber),je({label:"Restrooms",name:"restroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.restroomsNumber),je({label:"Combined bathroom",name:"combinedBathroomsNumber",type:"number",isRequired:!0},null==n?void 0:n.combinedBathroomsNumber)]},cn={floor:e.number().integer().min(0).test("is less than floorCount","Too much",(function(e){return e<=this.parent.floorCount})),floorCount:e.number().integer().positive().required("This field is required"),roomsNumber:e.number().integer().min(0).required("This field is required"),bedroomsNumber:e.number().integer().min(0).required("This field is required"),bathroomsNumber:e.number().integer().min(0).required("This field is required"),restroomsNumber:e.number().integer().min(0).required("This field is required"),combinedBathroomsNumber:e.number().integer().min(0).required("This field is required")},dn=e.object(cn),mn=function(e){return[je({label:"Object type",name:"typeOfObject",variant:"select",options:P,isRequired:!0},null==e?void 0:e.typeOfObject),je({label:"Entrance",name:"entrance",isRequired:!0},null==e?void 0:e.entrance),je({name:"hasIntercom",label:"Intercom",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasIntercom),je({name:"intercomCode",label:"Intercom code",variant:"custom",CustomInput:me,dependentInputName:"hasIntercom"},null==e?void 0:e.intercomCode),je({name:"hasGate",label:"Gate",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasGate),je({name:"gateCode",label:"Gate code",variant:"custom",CustomInput:me,dependentInputName:"hasGate"},null==e?void 0:e.gateCode),je({name:"parkingType",label:"Parking",variant:"select",options:T},null==e?void 0:e.parkingType),je({name:"parkingNumber",label:"Parking number",variant:"custom",CustomInput:me,dependentInputName:"parkingType"},null==e?void 0:e.parkingNumber)]},pn={typeOfObject:e.string().required("This field is required"),entrance:e.string().required("This field is required"),hasIntercom:e.string().required("This field is required"),intercomCode:k("hasIntercom"),hasGate:e.string().required("This field is required"),gateCode:k("hasGate")},vn=e.object(pn),fn=function(e){return[je({label:"Water",name:"availableResources.water",variant:"custom",CustomInput:S},null==e?void 0:e.water),je({label:"Electricity",name:"availableResources.electricity",variant:"custom",CustomInput:S},null==e?void 0:e.electricity),je({label:"Gas",name:"availableResources.gas",variant:"custom",CustomInput:S},null==e?void 0:e.gas),je({label:"Heating",name:"availableResources.heating",variant:"custom",CustomInput:S},null==e?void 0:e.heating)]},bn={size:"s"},hn=function(e){return De([je({label:"Pets",name:"withPets",variant:"custom",CustomInput:pe,labelProps:bn},null==e?void 0:e.withPets),je({label:"Children",name:"withChildren",variant:"custom",CustomInput:pe,labelProps:bn},null==e?void 0:e.withChildren),je({label:"Smoking",name:"withSmoking",variant:"custom",CustomInput:pe,labelProps:bn},null==e?void 0:e.withSmoking),je({isTextArea:!0,placeholder:"other terms",name:"additionalTerms"},null==e?void 0:e.additionalTerms)],R(e),!0)},gn={taxesType:e.string().required(I),countryOfResidence:e.object({name:e.string().required(I)}),company:e.object({name:e.string().required(I)})},yn=e.object(gn),_n=function(e){return[je({name:"hasBarrier",label:"Barrier",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasBarrier),je({name:"barrierPhone",label:"Barrier code",variant:"custom",CustomInput:me,dependentInputName:"hasBarrier",Input:ve},null==e?void 0:e.barrierPhone),je({name:"hasConcierge",label:"Concierge",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasConcierge),je({name:"conciergePhone",label:"Concierge",variant:"custom",CustomInput:me,dependentInputName:"hasConcierge",Input:ve},null==e?void 0:e.conciergePhone),je({name:"hasSecurity",label:"Security",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasSecurity),je({name:"securityPhone",label:"Security",variant:"custom",CustomInput:me,dependentInputName:"hasSecurity",Input:ve},null==e?void 0:e.securityPhone),je({name:"hasVideoControl",label:"Video surveillance",variant:"select",options:x,isRequired:!0},null==e?void 0:e.hasVideoControl),je({name:"videoControlPhone",label:"Video surveillance",variant:"custom",CustomInput:me,dependentInputName:"hasVideoControl",Input:ve},null==e?void 0:e.videoControlPhone)]},xn={hasBarrier:e.string().required(I),barrierPhone:A("hasBarrier"),hasConcierge:e.string().required(I),conciergePhone:A("hasConcierge"),hasSecurity:e.string().required(I),securityPhone:A("hasSecurity"),hasVideoControl:e.string().required(I),videoControlPhone:A("hasVideoControl")},wn=e.object(xn),In=M(7),Nn=function(e){var n,t,r,i;return[je({name:"maxMeters.water",label:"Water",variant:"select",options:In,isRequired:!0},null===(n=null==e?void 0:e.maxMeters)||void 0===n?void 0:n.water),je({name:"maxMeters.electricity",label:"Electricity",variant:"select",options:In,isRequired:!0},null===(t=null==e?void 0:e.maxMeters)||void 0===t?void 0:t.electricity),je({name:"maxMeters.gas",label:"Gas",variant:"select",options:In,isRequired:!0},null===(r=null==e?void 0:e.maxMeters)||void 0===r?void 0:r.gas),je({name:"maxMeters.heating",label:"Heating",variant:"select",options:In,isRequired:!0},null===(i=null==e?void 0:e.maxMeters)||void 0===i?void 0:i.heating)]},Cn={maxMeters:e.object({water:w,electricity:w,gas:w,heating:w})},qn=e.object(Cn),Pn=function(e){var n,t,r,i,o;return[je({name:"wifi.name",label:"Name of network"},null===(n=null==e?void 0:e.wifi)||void 0===n?void 0:n.name),je({name:"wifi.password",label:"WiFi password"},null===(t=null==e?void 0:e.wifi)||void 0===t?void 0:t.password),je({name:"internetProvider.link",label:"Link to provider",size:12},null===(r=null==e?void 0:e.internetProvider)||void 0===r?void 0:r.link),je({name:"internetProvider.login",label:"Login"},null===(i=null==e?void 0:e.internetProvider)||void 0===i?void 0:i.login),je({name:"internetProvider.password",label:"Password"},null===(o=null==e?void 0:e.internetProvider)||void 0===o?void 0:o.password),je({name:"tvType",label:"Television",variant:"select",options:F},null==e?void 0:e.tvType),je({name:"homePhone",label:"Home phone",variant:"phone"},null==e?void 0:e.homePhone)]},Tn={homePhone:j("homePhone")},kn=e.object().shape(Tn,[["homePhone","homePhone"]]),Sn=function(e,n,t,r){return De(De(De(De(De(De(De([],re(e,je({label:"Filling type",name:"type",variant:"select",options:L,handleChange:t,isRequired:!0},null==r?void 0:r.type)),!0),[je({label:"Name (tag)",name:"tag",type:n,variant:"custom",CustomInput:B,isRequired:!0},null==r?void 0:r.tag)],!1),re("finish"!==n,je({label:"Model",name:"name",isRequired:!0},null==r?void 0:r.name)),!0),re("finish"!==n,je({label:"Serial code",name:"serialNumber",size:6},null==r?void 0:r.serialNumber)),!0),re("finish"!==n,je({label:"Amount",name:"numberOfSubjects",type:"number",size:6},null==r?void 0:r.numberOfSubjects)),!0),[je({label:"Description",name:"description",isTextArea:!0},null==r?void 0:r.description)],!1),re("finish"!==n,je({label:"Instruction",name:"instruction",variant:"custom",CustomInput:O},null==r?void 0:r.instruction)),!0)},Rn=e.object().shape({type:e.string(),tag:e.object({name:e.string().required(I)}),name:e.string().when("type",{is:function(e){return"electronics"===e},then:function(e){return e.required(I)}})}),An={number:e.string().required("This field is required")},Mn=function(n){var t=D(n);return e.object().shape(je(je({},An),Object.assign.apply(Object,De([{}],t,!1))))},Fn=function(e,n){return De(De([],z(e,n),!0),[je({label:"Activation date",name:"startDate",variant:"date",max:de.now()},null==n?void 0:n.startDate),je({label:"Passport",name:"passportFile",variant:"custom",CustomInput:fe},null==n?void 0:n.passportFile)],!1)},jn=function(e){var t=e.meter,i=e.getMeterLabel,o=t.resource,a=t.type,l=t.number,u=[t.initialValue,t.initialValueT1,t.initialValueT2,t.initialValueT3].filter((function(e){return void 0!==e})).map((function(e){return e})).join(" / "),s=i?i(o,a):n.capitalize("".concat(a?"".concat(a," "):"").concat(o," meter"));return r(_e,je({"data-testid":"addedMeterLine",size:"s"},{children:["• ",s," #",l," -"," ",r(On,{children:[u," ",V[t.resource]]})]}))},On=Ce.span(Ve||(Ve=ze(["\n font-weight: 600;\n"],["\n font-weight: 600;\n"]))),Ln=function(e){var n,i,o=e.resource,a=e.formStore,l=e.label,u=e.getMeterLabel,s=null===(i=null===(n=a.fields)||void 0===n?void 0:n.meters)||void 0===i?void 0:i.filter((function(e){return e.resource===o}));return(null==s?void 0:s.length)?r(Bn,je({"data-testid":"addedMetersBlock"},{children:[r(zn,je({container:!0,alignItems:"center"},{children:[t(Dn,{}),t(_e,je({size:"s",color:"fiftyP"},{children:l||"In the previous steps were added:"}))]})),s.map((function(e){return t(jn,{getMeterLabel:u,meter:e},e.number)}))]})):null},Bn=Ce.div(He||(He=ze(["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"],["\n border-radius: 8px;\n border: 1px solid ",";\n padding: 12px 16px;\n background: white;\n"])),xe.palette.grey.fifteenB),Dn=Ce(qe)(Ee||(Ee=ze(["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"],["\n margin-right: 8px;\n width: 16px;\n height: 16px;\n path {\n fill: ",";\n }\n"])),xe.palette.brand.main),zn=Ce(we)(We||(We=ze(["\n margin-bottom: 8px;\n"],["\n margin-bottom: 8px;\n"])));function Vn(e){var n,i,o=e.resource,a=e.index,l=e.formStore,u=null===(i=null===(n=l.fields)||void 0===n?void 0:n.meters)||void 0===i?void 0:i[a],s="water"===o||"electricity"===o,c=s?"water"===o?"cold":"T1":null,d=be((null==u?void 0:u.type)||c),m=d[0],p=d[1],v=Fn({resource:o,meterType:m}),f=v.filter((function(e){return"number"===e.type})).map((function(e){return e.name})),b=Mn(f),h=he((function(){return ye({resolver:Ne(b),defaultValues:je({},u),values:u})}),[b]);return t(H,je({form:h,onSubmit:function(e){l.replaceFieldInArray("meters",je(je({},e),{resource:o}),a),l.nextStep()},label:"Next",variant:"next",withPrevStep:!0,handlePrevClick:l.prevStep},{children:r(we,je({container:!0,spacing:2},{children:[t(we,je({item:!0,xs:12},{children:t(Ln,{formStore:l,resource:o})})),s&&t(we,je({item:!0,xs:12},{children:t(E,{form:h,resource:o,handleChange:p})})),v.map((function(e){var n=e.size,r=Oe(e,["size"]);return t(we,je({item:!0,xs:n||6},{children:t(W,je({form:h},r))}),r.name)}))]}))}))}var Hn,En,Wn,Gn,Un,Yn,Kn,Zn,Jn,Qn,Xn,$n,et,nt,tt,rt,it,ot,at,lt,ut,st,ct,dt=function(e,n,r){return De(De(De(De([],new Array(Number((null==r?void 0:r.water)||0)).fill("water"),!0),new Array(Number((null==r?void 0:r.electricity)||0)).fill("electricity"),!0),new Array(Number((null==r?void 0:r.gas)||0)).fill("gas"),!0),new Array(Number((null==r?void 0:r.heating)||0)).fill("heating"),!0).map((function(r,i){return[t(e,{index:i,resource:r},"meter_info_".concat(i)),t(n,{index:i,resource:r},"meter_photo_".concat(i))]}))},mt=function(n){return e.object().shape(je({inventoryAct:e.mixed()},n?{}:{signedContract:e.mixed().required(I)}))},pt=function(e,n){return De([je({label:"Inventory inspection file",name:"inventoryAct",variant:"file"},null==n?void 0:n.transferAct)],re(!e,je({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==n?void 0:n.signedContract)),!0)},vt={rooms:e.array().of(e.object({area:e.number().positive().required(I).transform((function(e){return Number.isNaN(e)?void 0:e}))}))},ft=e.object(vt),bt=function(e,n){return De([],(null==e?void 0:e.roomsNumber)?new Array(Number(e.roomsNumber)).fill(0).map((function(t,r){var i,o=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"Bedroom ".concat(r+1):"Room ".concat(r+1),a=(null==e?void 0:e.bedroomsNumber)&&r<(null==e?void 0:e.bedroomsNumber)?"bedrooms":"rooms";return[je({name:"rooms.".concat(r,".area"),label:"".concat(o," area"),type:"number",isRequired:!0},(null==n?void 0:n[a])?null===(i=n[a](r))||void 0===i?void 0:i.area:{})]})).flat():[],!0)},ht=function(e,n,t){return De(De(De(De(De(De(De(De(De(De([je({type:"kitchen"},n.kitchen)],new Array(Number((null==t?void 0:t.bedroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"bedroom"},n.bedroom((null==t?void 0:t.bedroomsNumber)?"".concat(r+1," "):"",null==t?void 0:t.rooms[r]))})),!0),new Array(Math.max(Number((null==t?void 0:t.roomsNumber)||0)-Number((null==t?void 0:t.bedroomsNumber)||0),0)).fill(0).map((function(e,r){return je({type:"room"},n.room((null==t?void 0:t.roomsNumber)?"".concat(r+1+((null==t?void 0:t.bedroomsNumber)||0)," "):"",null==t?void 0:t.rooms[((null==t?void 0:t.bedroomsNumber)||0)+r]))})),!0),new Array(Number((null==t?void 0:t.bathroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"bathroom"},n.bathroom((null==t?void 0:t.bathroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.restroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"toilet"},n.toilet((null==t?void 0:t.restroomsNumber)?"".concat(r+1," "):""))})),!0),new Array(Number((null==t?void 0:t.combinedBathroomsNumber)||0)).fill(0).map((function(e,r){return je({type:"combined_bathroom"},n.combinedBathroom((null==t?void 0:t.combinedBathroomsNumber)?"".concat(r+1," "):""))})),!0),[je({type:"others"},n.others)],!1),re("initial"===e,je({type:"entrance"},n.entrance)),!0),re("initial"!==e,je({type:"keys"},n.keys)),!0),re(!("initial"!==e||!(null==t?void 0:t.parkingType)),je({type:"parking"},n.parking)),!0),[je({type:"additional"},n.additional)],!1)},gt=function(e){var n=e.feedback,i=e.label;return t(yt,je({status:n.status},{children:r(we,je({container:!0,alignItems:"center"},{children:[t(_e,je({size:"s",weight:500,color:"fiftyP"},{children:i})),"notSigned"!==n.status&&r(_t,{children:["signed"===n.status?t(xt,{}):t(wt,{}),!!n.comment&&t(G,je({placement:"bottom",content:r("div",{children:[t(_e,je({size:"xs",color:"fiftyP"},{children:"Comment"})),t(It,je({size:"xs"},{children:n.comment}))]})},{children:t(Nt,{})}))]})]}))}))},yt=Ce.div(Hn||(Hn=ze(["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"],["\n background: ",";\n border-radius: 66px;\n border: 1px solid ",";\n padding: 6px 16px;\n width: fit-content;\n @media (max-width: ","px) {\n width: 100%;\n > div {\n justify-content: center;\n }\n }\n"])),(function(e){return"notSigned"===e.status?xe.palette.background.light1:xe.palette.grey.zero}),xe.palette.grey.fifteenB,xe.breakpoints.sm),_t=Ce.div(En||(En=ze(["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"],["\n display: flex;\n align-items: center;\n margin-left: 8px;\n > div {\n margin-left: 8px;\n }\n"]))),xt=Ce(Pe)(Wn||(Wn=ze(["\n path {\n fill: ",";\n }\n"],["\n path {\n fill: ",";\n }\n"])),xe.palette.green.fiftyP),wt=Ce(Te)(Gn||(Gn=ze(["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"],["\n width: 12px;\n height: 12px;\n path {\n fill: ",";\n }\n"])),xe.palette.red.fiftyP),It=Ce(_e)(Un||(Un=ze(["\n margin-top: 8px;\n"],["\n margin-top: 8px;\n"]))),Nt=Ce(ke)(Yn||(Yn=ze(["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"],["\n width: 13px;\n cursor: pointer;\n path {\n fill: ",";\n stroke: ",";\n }\n"])),xe.palette.grey.zero,xe.palette.grey.thirty),Ct=Me((function(e){var n=e.feedback,i=e.label,o=e.resendLabel,a=e.resend;return n?t(we,je({item:!0},{children:r(we,je({container:!0,alignItems:"center"},{children:[t(gt,{feedback:n,label:i}),"rejected"===n.status&&t(qt,je({size:"xs",variant:"orange",onClick:a,endIcon:t(Se,{})},{children:o}))]}))})):null})),qt=Ce(Ie)(Kn||(Kn=ze(["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"],["\n margin-left: 16px;\n @media (max-width: ","px) {\n width: 100%;\n margin-left: 0;\n margin-top: 8px;\n }\n"])),xe.breakpoints.sm),Pt=Me((function(e){var n=e.tenantFeedback,i=e.landlordFeedback,o=e.resignInspection,a=e.resendLabel,l=e.tenantLabel,u=e.landlordLabel;return n||i?r(Tt,je({container:!0,spacing:2,alignItems:"center"},{children:[t(Ct,{resend:o,resendLabel:a,feedback:n,label:l}),t(Ct,{resend:o,resendLabel:a,feedback:i,label:u})]})):null})),Tt=Ce(we)(Zn||(Zn=ze(["\n padding-top: 8px;\n"],["\n padding-top: 8px;\n"]))),kt=function(e){var n=e.filling,i=e.warningLabel;return r(we,je({container:!0,alignItems:"center"},{children:[n.wasMissing&&t(G,je({content:t(_e,je({size:"xs"},{children:i}))},{children:t(St,{width:17,height:17})})),r(Rt,{children:[r(_e,je({size:"s"},{children:[n.tagName," ",n.name?" | ".concat(n.name):""]})),!(!n.numberOfSubjects&&!n.serialNumber)&&r(At,je({size:"xs",color:"fiftyP"},{children:[n.numberOfSubjects?"".concat(n.numberOfSubjects," pieces"):"",n.numberOfSubjects&&n.serialNumber?" • ":"",n.serialNumber]}))]})]}))},St=Ce(qe)(Jn||(Jn=ze(["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"],["\n margin-left: 4px;\n path {\n fill: ",";\n }\n"])),xe.palette.red.fiftyP),Rt=Ce.div(Qn||(Qn=ze(["\n margin-left: 8px;\n"],["\n margin-left: 8px;\n"]))),At=Ce(_e)(Xn||(Xn=ze(["\n margin-top: 4px;\n"],["\n margin-top: 4px;\n"]))),Mt=function(e){var n=e.className,r=e.form,i=e.index,o=e.disabled,a=Oe(e,["className","form","index","disabled"]);return t(Ft,je({className:n},{children:t(jt,{form:r,name:"fillingList.".concat(i,".check"),label:t(kt,je({},a)),disabled:o})}))},Ft=Ce(we)($n||($n=ze(["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"],["\n padding: 8px 16px;\n border-radius: 12px;\n background: white;\n"]))),jt=Ce(pe)(et||(et=ze(["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"],["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"]))),Ot=function(e,n,t,r){var i,o=function(){r&&r(),n.loader.endLoading()};ge((function(){Le(void 0,void 0,void 0,(function(){var r,i;return Be(this,(function(a){switch(a.label){case 0:return t?(null===(i=null===(r=e.fields)||void 0===r?void 0:r.meters)||void 0===i?void 0:i.length)?[3,2]:[4,n.fetchMeters()]:[3,3];case 1:a.sent(),a.label=2;case 2:return o(),[3,4];case 3:!1===t&&o(),a.label=4;case 4:return[2]}}))}))}),[t]),ge((function(){var t,r;n.loader.isLoading||(null===(r=null===(t=e.fields)||void 0===t?void 0:t.meters)||void 0===r?void 0:r.length)||!n.meters.length||(e.updateFormFields({meters:n.meters}),e.updateFormFields({metersFromStore:n.meters}))}),[n.meters,n.loader.isLoading]),ge((function(){var t,r;n.loader.isLoading||!(null===(r=null===(t=e.fields)||void 0===t?void 0:t.metersFromStore)||void 0===r?void 0:r.length)||n.meters.length||n.updateMetersFromForm(e.fields.metersFromStore)}),[null===(i=e.fields)||void 0===i?void 0:i.metersFromStore,n.loader.isLoading])},Lt=function(){var e=this;this.fetchFillingList=function(n,t){return Le(e,void 0,void 0,(function(){var e;return Be(this,(function(r){switch(r.label){case 0:return this.loader.startLoading(),[4,ce(U.getFillingList(n,t))];case 1:return e=r.sent(),ee(e,this.loader,this.updateFillingList),[2]}}))}))},this.updateFillingList=function(n){e.fillingList=(null==n?void 0:n.map((function(e){return{id:e.id,name:e.description,tagName:e.feature_name,serialNumber:e.serial_code,numberOfSubjects:e.amount,wasMissing:e.is_absent}})))||[]},this.fillingList=[],this.loader=new ie,Fe(this)},Bt=function(e,n,t,r,i){var o=function(){i&&i(),t.loader.endLoading()};ge((function(){Le(void 0,void 0,void 0,(function(){var i,a;return Be(this,(function(l){switch(l.label){case 0:return r&&e?(null===(a=null===(i=n.fields)||void 0===i?void 0:i.fillingList)||void 0===a?void 0:a.length)?[3,2]:[4,t.fetchFillingList(e,"appliance")]:[3,3];case 1:l.sent(),l.label=2;case 2:return o(),[3,4];case 3:!1===r&&o(),l.label=4;case 4:return[2]}}))}))}),[e,r]),ge((function(){var e,r;t.loader.isLoading||(null===(r=null===(e=n.fields)||void 0===e?void 0:e.fillingList)||void 0===r?void 0:r.length)||n.updateFormFields({fillingList:t.fillingList.map((function(e){return je(je({},e),{check:!1})}))})}),[t.fillingList,t.loader.isLoading])},Dt=function(n,t){return e.object().shape(je(je(je(je({transferAct:e.mixed()},"maroom_tenant"!==n||t?{}:{signedContract:e.mixed().required(I)}),"tenant_maroom"===n?{rcTerminationAgreement:e.mixed().required(I)}:{}),"maroom_landlord"===n?{scTerminationAgreement:e.mixed().required(I)}:{}),"tenant_landlord"===n?{rcTerminationAgreement:e.mixed().required(I),scTerminationAgreement:e.mixed().required(I)}:{}))},zt=function(e,n,t){return De(De(De(De([je({label:"Transfer inspection file",name:"transferAct",variant:"file"},null==t?void 0:t.transferAct)],re("maroom_tenant"===e&&!n,je({label:"Signed contract file",name:"signedContract",variant:"file",isRequired:!0},null==t?void 0:t.signedContract)),!0),re("tenant_maroom"===e,je({label:"Contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),re("maroom_landlord"===e,je({label:"Contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.contractAgreement)),!0),"tenant_landlord"===e?[je({label:"Rental contract termination agreement",name:"rcTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.rcTerminationAgreement),je({label:"Service contract termination agreement",name:"scTerminationAgreement",variant:"file",isRequired:!0},null==t?void 0:t.scTerminationAgreement)]:[],!0)},Vt=function(e,n,t){var r=e.inspectionsStore,i=e.apartmentId,o=n.formStateName,a=n.formFieldsName,l=r.creationForm.fields;l&&l.apartmentId!==i&&oe(r.indexDB,[o,a]),r.setCanUpdateDB(!0),t&&t()},Ht=function(e,n,t){var r=e.inspectionsStore,i=n.formStateName,o=n.formFieldsName;r.setCanUpdateDB(!1),r.creationForm.resetForm(),oe(r.indexDB,[i,o]),t&&t()},Et=function(e){var n,t=e.apartmentId,r=e.inspectionsStore,i=e.metersStore,o=e.fillingStore,a=be(!1),l=a[0],u=a[1],s=be(!1),c=s[0],d=s[1],m=r.creationForm,p=null===(n=m.fields)||void 0===n?void 0:n.type,v=p?"regular"===p||"transfer"===p:void 0,f=o.loader.isLoading,b=i.loader.isLoading;ge((function(){l&&c&&!f&&!b&&r.setCanLoadDB(!0)}),[l,c,f,b]),Ot(m,i,v,(function(){return u(!0)})),Bt(t||null,m,o,v,(function(){return d(!0)}))},Wt=function(e,n,t){var r=e.dbCreationTime,i=e.formFieldsName,o=e.formStateName,a=e.inspectionCreationFormName,l=n.inspectionsStore,u=n.apartmentId,s=l.creationForm,c=l.actionLoader,d=l.indexDB,m=l.setCanUpdateDB,p=l.canUpdateDB,v=a,f=function(e){se(e,i),se(e,o)};var b=function(){return Le(void 0,void 0,void 0,(function(){return Be(this,(function(e){return le(v,f,c,(function(e){return Le(void 0,void 0,void 0,(function(){var n;return Be(this,(function(a){switch(a.label){case 0:return l.setIndexDB(e),m(!1),d=localStorage.getItem(r),p=Date.now(),d&&p-Number(d)>864e5&&(oe(l.indexDB,[o,i]),localStorage.removeItem(r)),[4,ue(e,i,c)];case 1:return(n=a.sent())?(null==n?void 0:n.apartmentId)===u&&(s.updateFormFields(je(je({},n),{date:n.date?de.fromISO(n.date):null})),t&&t()):m(!0),[2]}var d,p}))}))})),[2]}))}))};ge((function(){u&&b()}),[u]),ge((function(){l.canLoadDB&&d&&Le(void 0,void 0,void 0,(function(){var e,n;return Be(this,(function(t){switch(t.label){case 0:return[4,ue(d,o,c)];case 1:return e=t.sent(),[4,ue(d,i,c)];case 2:return n=t.sent(),e&&(null==n?void 0:n.apartmentId)===u&&s.setStep(Number(e.step)),m(!0),[2]}}))}))}),[l.canLoadDB,d]),ge((function(){if(p){var e={step:s.step};ae(d,o,e,c),ae(d,i,s.fields,c),localStorage.getItem(r)||localStorage.setItem(r,Date.now().toString())}}),[s.step])},Gt=function(e){var n=e.label,r=e.onClick,i=e.isActive;return t(Ie,je({size:"xs",variant:i?"primary":"white",onClick:r},{children:n}))},Ut=function(e){var n=e.metroStation,i=n.color,o=n.name;return r(Yt,je({item:!0,container:!0,alignItems:"center"},{children:[t(Kt,{style:{background:i}}),t(_e,je({size:"s",color:"sixty"},{children:o}))]}))},Yt=Ce(we)(nt||(nt=ze(["\n width: auto;\n"],["\n width: auto;\n"]))),Kt=Ce.div(tt||(tt=ze(["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"],["\n width: 6px;\n height: 6px;\n border-radius: 50%;\n margin-right: 6px;\n"]))),Zt=function(e){var n=e.phone,i=$(n," "),o=i.replace(/\d/g,"");return r(Jt,je({container:!0,alignItems:"center",wrap:"nowrap"},{children:[t(Qt,{width:14,height:14}),t("a",je({href:"tel:+".concat(o)},{children:t(_e,je({size:"s",weight:500,color:"sixty"},{children:i}))}))]}))},Jt=Ce(we)(rt||(rt=ze(["\n width: auto;\n"],["\n width: auto;\n"]))),Qt=Ce(Re)(it||(it=ze(["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"],["\n margin-right: 6px;\n transform: rotate(15deg);\n path {\n stroke: ",";\n }\n"])),xe.palette.grey.sixty),Xt=function(e){var n=e.inspection,i=e.onClose,o=e.getClientLink,a=e.getInspectionLink,l=n.apartment,u=n.tenant,s=n.landlord,c=n.metroStations,d=u||s,m=o&&d?o(null==d?void 0:d.id):"",p=a(l.id,n.id);return r($t,{children:[t(K,je({href:p},{children:t(er,{imageSrc:l.previewImage,description:l.address})})),t(we,je({container:!0,spacing:2,alignItems:"center"},{children:c.map((function(e){return t(Ut,{metroStation:e},e.name)}))})),!!d&&r(nr,je({container:!0,alignItems:"center",justify:"space-between"},{children:[m?t(rr,je({href:m},{children:t(Z,{weight:500,user:d})})):t(Z,{weight:500,user:d}),!!(null==d?void 0:d.phoneNumber)&&t(Zt,{phone:null==d?void 0:d.phoneNumber})]})),t(tr,je({isCircle:!0,size:"xs",variant:"whiteWithGray",onClick:i},{children:t(Ae,{width:6,height:6})}))]})},$t=Ce.div(ot||(ot=ze(["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"],["\n width: 330px;\n background: ",";\n border-radius: 8px;\n padding: 8px;\n position: absolute;\n bottom: 46px;\n left: -115px;\n z-index: 1;\n"])),xe.palette.grey.zero),er=Ce(Y)(at||(at=ze(["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"],["\n margin-bottom: 8px;\n p {\n font-size: 16px;\n line-height: 24px;\n font-weight: 600;\n }\n"]))),nr=Ce(we)(lt||(lt=ze(["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"],["\n padding-top: 8px;\n border-top: 1px solid ",";\n margin-top: 8px;\n"])),xe.palette.grey.fifteenB),tr=Ce(Ie)(ut||(ut=ze(["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"],["\n position: absolute;\n top: -10px;\n right: -10px;\n width: 24px;\n height: 24px;\n"]))),rr=Ce(K)(st||(st=ze(["\n max-width: calc(100% - 140px);\n"],["\n max-width: calc(100% - 140px);\n"]))),ir=function(e){var n=e.inspection,i=e.map,o=e.label,a=Oe(e,["inspection","map","label"]),l=J(n.location,i),u=l.ref,s=l.isOpen,c=l.closeCard,d=l.toggleCard;return t(Q,je({map:i,position:n.location},{children:r(or,je({ref:u},{children:[t(Gt,{label:o,isActive:s,onClick:d}),s&&t(Xt,je({inspection:n,onClose:c},a))]}))}))},or=Ce.div(ct||(ct=ze(["\n position: relative;\n"],["\n position: relative;\n"])));export{Ln as AddedMetersBlock,gn as AdditionalInfoFieldsSchema,yn as AdditionalInfoStepSchema,$e as BasicApartmentInfoFieldsSchema,en as BasicApartmentInfoStepSchema,ln as DetailApartmentInfoFieldsSchema,un as DetailApartmentInfoStepSchema,Rn as FillingInfoFieldsSchema,Lt as FillingListStore,tn as HouseInfoFieldsSchema,rn as HouseInfoStepSchema,xn as HouseServicesInfoFieldsSchema,wn as HouseServicesInfoStepSchema,Pt as InspectionFeedback,Mt as InspectionFillingCard,Vn as InventoryMeterInfoFields,Cn as MetersInfoFieldsSchema,qn as MetersInfoStepSchema,Xt as ObjectForMapCard,ir as ObjectForMapOverlay,Gt as ObjectForMapPoint,cn as RoomsApartmentInfoFieldsSchema,dn as RoomsApartmentInfoStepSchema,vt as RoomsInfoFieldsSchema,ft as RoomsInfoStepSchema,pn as SecurityApartmentInfoFieldsSchema,vn as SecurityApartmentInfoStepSchema,Tn as TelecommunicationsInfoFieldsSchema,kn as TelecommunicationsInfoStepSchema,Qe as apartmentFields,hn as getAdditionalInfoStepFields,fn as getAvailableResourcesFields,Xe as getBasicApartmentInfoFields,an as getDetailApartmentInfoFields,Sn as getFillingInfoFields,nn as getHouseInfoStep,_n as getHouseServicesInfoStep,pt as getInventoryDocumentsFields,mt as getInventoryDocumentsSchema,Fn as getInventoryMeterFields,Nn as getMetersInfoStepFields,Ge as getPartialMeterInfoSchema,sn as getRoomsApartmentInfoFields,ht as getRoomsImagesSteps,bt as getRoomsInfoStepFields,mn as getSecurityApartmentInfoFields,Pn as getTelecommunicationsInfoStepFields,zt as getTransferDocumentsFields,Dt as getTransferDocumentsSchema,Ke as getWaterMeterFields,Ue as getWaterMeterFieldsSchema,Ze as inspectionsRequestBody,Je as inspectionsRequests,Ht as onInspectionModalClose,Vt as onInspectionModalOpen,dt as renderMetersSteps,Bt as useFillingList,Et as useInspectionData,Wt as useInspectionIndexDB,Ot as useMetersValues};
|