kui-crm_actions 0.0.64 → 0.0.66

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 CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var yup = require('yup');
6
6
  var kuiCrm = require('kui-crm');
7
+ var _ = require('lodash');
7
8
  var kuiUtils = require('kui-utils');
8
9
  var to = require('await-to-js');
9
10
  var luxon = require('luxon');
@@ -35,6 +36,7 @@ function _interopNamespace(e) {
35
36
  }
36
37
 
37
38
  var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
39
+ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
38
40
  var to__default = /*#__PURE__*/_interopDefaultLegacy(to);
39
41
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
40
42
 
@@ -144,13 +146,33 @@ var getPartialMeterInfoSchema = function (valuesFields) {
144
146
  _a);
145
147
  });
146
148
  return yup__namespace.object().shape(__assign({ number: yup__namespace.string().trim().required("This field is required") }, Object.assign.apply(Object, __spreadArray([{}], valuesSchema, false))));
149
+ };
150
+ var WaterMeterFieldsSchema = yup__namespace.object().shape({
151
+ number: yup__namespace.string().trim().required("This field is required"),
152
+ value: yup__namespace
153
+ .number()
154
+ .min(0)
155
+ .required("This field is required")
156
+ .transform(function (value) { return (Number.isNaN(value) ? undefined : value); }),
157
+ });
158
+
159
+ var getWaterMeterFields = function (meters, name, settings) {
160
+ var prefixName = name ? "".concat(name, ".") : "";
161
+ var meterOptions = meters.map(function (meter) { return ({
162
+ value: meter.number,
163
+ label: "#".concat(meter.number, " | ").concat(___default["default"].capitalize(meter.type || "")),
164
+ }); });
165
+ return [
166
+ __assign({ label: "Meter", name: "".concat(prefixName, "number"), variant: "select", options: meterOptions, size: 12 }, settings === null || settings === void 0 ? void 0 : settings.meter),
167
+ __assign({ label: "Value", name: "".concat(prefixName, "value"), variant: "custom", CustomInput: kuiCrm.NumberField, maxIntegerPart: 7, maxDecimalPart: 3 }, settings === null || settings === void 0 ? void 0 : settings.value),
168
+ ];
147
169
  };
148
170
 
149
171
  var inspectionsRequestBody = {
150
172
  getPostBodyInitialInspection: function (inspection, roomsImages) {
151
173
  return {
152
174
  based_on: null,
153
- date: luxon.DateTime.now().toISODate(),
175
+ date: (inspection.date || luxon.DateTime.now()).toISODate(),
154
176
  inspection_type: "initial",
155
177
  dropbox_link: inspection.dropboxLink,
156
178
  photo_groups: roomsImages,
@@ -191,7 +213,7 @@ var inspectionsRequestBody = {
191
213
  },
192
214
  getPostBodyRegularInspection: function (inspection, roomsImages) {
193
215
  return {
194
- date: luxon.DateTime.now().toISODate(),
216
+ date: (inspection.date || luxon.DateTime.now()).toISODate(),
195
217
  inspection_type: "regular",
196
218
  based_on: null,
197
219
  dropbox_link: inspection.dropboxLink,
@@ -201,7 +223,7 @@ var inspectionsRequestBody = {
201
223
  },
202
224
  getPostBodyTransferInspection: function (inspection, roomsImages) {
203
225
  return {
204
- date: luxon.DateTime.now().toISODate(),
226
+ date: (inspection.date || luxon.DateTime.now()).toISODate(),
205
227
  inspection_type: "transfer",
206
228
  based_on: null,
207
229
  dropbox_link: inspection.dropboxLink,
@@ -226,7 +248,7 @@ var inspectionsRequestBody = {
226
248
  var _this = this;
227
249
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
228
250
  return {
229
- date: luxon.DateTime.now().toISODate(),
251
+ date: (inspection.date || luxon.DateTime.now()).toISODate(),
230
252
  inspection_type: "inventory",
231
253
  based_on: null,
232
254
  dropbox_link: inspection.dropboxLink,
@@ -756,6 +778,7 @@ exports.SecurityApartmentInfoFieldsSchema = SecurityApartmentInfoFieldsSchema;
756
778
  exports.SecurityApartmentInfoStepSchema = SecurityApartmentInfoStepSchema;
757
779
  exports.TelecommunicationsInfoFieldsSchema = TelecommunicationsInfoFieldsSchema;
758
780
  exports.TelecommunicationsInfoStepSchema = TelecommunicationsInfoStepSchema;
781
+ exports.WaterMeterFieldsSchema = WaterMeterFieldsSchema;
759
782
  exports.getAdditionalInfoStepFields = getAdditionalInfoStepFields;
760
783
  exports.getBasicApartmentInfoFields = getBasicApartmentInfoFields;
761
784
  exports.getDetailApartmentInfoFields = getDetailApartmentInfoFields;
@@ -767,6 +790,7 @@ exports.getRoomsApartmentInfoFields = getRoomsApartmentInfoFields;
767
790
  exports.getRoomsImagesSteps = getRoomsImagesSteps;
768
791
  exports.getSecurityApartmentInfoFields = getSecurityApartmentInfoFields;
769
792
  exports.getTelecommunicationsInfoStepFields = getTelecommunicationsInfoStepFields;
793
+ exports.getWaterMeterFields = getWaterMeterFields;
770
794
  exports.inspectionsRequestBody = inspectionsRequestBody;
771
795
  exports.inspectionsRequests = inspectionsRequests;
772
796
  exports.renderMetersSteps = renderMetersSteps;