@licklist/design 0.66.2 → 0.66.4
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/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/product-set/control/DateInput.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.d.ts.map +1 -1
- package/dist/report/ReportRunnerModal/ReportRunnerModal.js +1 -1
- package/package.json +3 -3
- package/src/date-time-button/DateTimeButton.stories.tsx +2 -1
- package/src/date-time-button/DateTimeButton.tsx +7 -5
- package/src/product-set/control/DateInput.tsx +2 -2
- package/src/product-set/product/ProductControl.tsx +5 -2
- package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +50 -21
- package/src/report/ReportRunnerModal/ReportRunnerModal.stories.tsx +307 -0
- package/src/report/ReportRunnerModal/ReportRunnerModal.tsx +24 -14
- package/src/static/switch/BooleanSwitch.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,a=e(require("react")),r=e(require("clsx")),i=require("luxon"),o=require("lodash"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t,a=e(require("react")),r=e(require("clsx")),i=require("luxon"),o=require("lodash"),n=require("../availability-indicator/AvailabilityIndicator.js"),s=require("./DateContent.js");(t=exports.Variant||(exports.Variant={})).week="week",t.month="month",t.time="time";var u=function(e){return i.DateTime.now()>e},l=function(e){return i.DateTime.now()>e.set({hour:23,minute:59,second:59})};exports.DateTimeButton=function(e){var t=e.date,i=e.isDisabled,c=e.isSelected,d=e.isSoldOut,m=e.onSelect,b=e.price,v=e.resources,p=e.showResources,x=e.shouldCalculateResources,f=void 0===x||x,h=e.variant,y=void 0===h?exports.Variant.week:h,w=d||f&&v&&v.bookedResources>=v.totalResources,D=y===exports.Variant.time,k=y===exports.Variant.time?u(t):l(t),q=f&&(!v||!o.has(v,"bookedResources")||!o.has(v,"totalResources")),R=i||w||k||q;return a.createElement("button",{type:"button",onClick:function(){return m(t)},disabled:R,className:r("date-time-button",R&&"disabled",c&&"selected",D&&"time-button",D&&"only-time-container",!D&&"today",y===exports.Variant.month&&"calendar-view")},a.createElement(s.DateContent,{date:t,isDisabled:R,isSelected:c,variant:y}),b&&!R&&a.createElement("div",{className:"price"},b),p&&v&&a.createElement(n.AvailabilityIndicator,{resources:v,isUnavailable:i||k,isSoldOut:w}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),n=e(t),i=require("react-i18next"),a=require("react-bootstrap"),u=require("../../static/Icon.js"),o=require("react-hook-form"),l=require("@react-aria/utils"),s=require("react-use"),c=require("luxon");require("../../static/index.js");var d=require("../../modals/confirmation/ConfirmModal.js"),m=require("rrule"),v=e(m),f=require("@licklist/core/dist/Config/Date"),p=require("../../recurring-date-picker-input/RecurringDatePickerInput.js"),g=require("../../zone/form/components/AvailableTimesControl.js"),T=require("../product/constants.js"),b=require("../../recurring-date-picker-input/DatePickerInput.js"),E=require("./ProductSetRecurrenceOverridesControl.js"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),n=e(t),i=require("react-i18next"),a=require("react-bootstrap"),u=require("../../static/Icon.js"),o=require("react-hook-form"),l=require("@react-aria/utils"),s=require("react-use"),c=require("luxon");require("../../static/index.js");var d=require("../../modals/confirmation/ConfirmModal.js"),m=require("rrule"),v=e(m),f=require("@licklist/core/dist/Config/Date"),p=require("../../recurring-date-picker-input/RecurringDatePickerInput.js"),g=require("../../zone/form/components/AvailableTimesControl.js"),T=require("../product/constants.js"),b=require("../../recurring-date-picker-input/DatePickerInput.js"),E=require("./ProductSetRecurrenceOverridesControl.js"),_={name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var r=e.state,t={width:"".concat(r.rects.reference.width+4,"px"),marginLeft:"-2px",maxWidth:"unset"};Object.assign(r.styles.popper,t)},effect:function(e){var r=e.state,t=r.elements.reference.getBoundingClientRect().width,n={width:"".concat(t,"px"),maxWidth:"unset"};Object.assign(r.elements.popper.style,n)}};exports.DateInput=function(e){var R,D,q,x,h=e.isEventEditProductSet,I=e.isLoading,C=e.workHours,y=e.providerHasBookingManagement,M=o.useFormContext(),O=M.control,k=M.register,w=M.formState.errors,A=M.getValues,N=M.setValue,S=M.clearErrors,j=o.useFieldArray({name:"menuRecurrences",control:O,keyName:"_id"}),F=j.fields,P=j.append,V=j.update,L=r.__read(t.useState([]),2),W=L[0],U=L[1],B=r.__read(t.useState(!1),2),H=B[0],z=B[1],Y=t.useRef(),G=r.__read(t.useState({index:null,values:null}),2),J=G[0],K=G[1],Q=function(){return K({index:null,values:null})},X=t.useRef();s.useClickAway(X,(function(e){var r,t,n;d.CONFIRM_MODAL_ACTIONS.includes(null===(n=null===(t=null===(r=e.target)||void 0===r?void 0:r.attributes)||void 0===t?void 0:t.getNamedItem("data-id"))||void 0===n?void 0:n.value)||(z(!1),Q())}));var Z=l.useId(),$=i.useTranslation("Design").t,ee=function(){F.length>=1||(Q(),z((function(e){return!e})))};return n.createElement(a.Form.Group,null,n.createElement(a.Form.Label,null,$(h?"whenOverridesAvailable":"productSetAvailable")),n.createElement(a.OverlayTrigger,{show:H,overlay:n.createElement(a.Popover,{id:Z,className:"rounded"},n.createElement(a.Popover.Content,{className:"shadow-lg rounded",ref:X},n.createElement(b.DatePickerInput,{defaultValues:J.values,onChange:function(e){return r.__awaiter(void 0,void 0,void 0,(function(){var t,n,i,a,u,o,l,s,d,g,T,b,E;return r.__generator(this,(function(r){switch(r.label){case 0:return[4,null===(d=Y.current)||void 0===d?void 0:d.trigger()];case 1:return t=r.sent(),(null==e?void 0:e.startTime)&&(null==e?void 0:e.endTime)&&t&&(n=c.DateTime.fromISO(e.startTime),i=c.DateTime.fromISO(e.endTime),a=Y.current.getValues().availableTimes,!a.every((function(e){var r=c.DateTime.fromFormat(e,f.TIME_FORMAT);return r.diff(n,"minutes").minutes>=0&&r.diff(i,"minutes").minutes<=0})))?(Y.current.setError("availableTimes",{message:$("Validation:fieldTimeBetween",{attribute:$("Design:startTimesSmall"),min:n.toFormat(f.TIME_FORMAT),max:i.toFormat(f.TIME_FORMAT)})}),[2]):(u=p.getDateTimeObject(e.startDate,e.endTime||"23:59:59"),o=v.optionsToString({until:u.toJSDate(),byweekday:[],freq:m.Frequency.DAILY,tzid:f.UTC_TIMEZONE,interval:1}).replace("RRULE:",""),l=(null===(T=null===(g=null==Y?void 0:Y.current)||void 0===g?void 0:g.getValues())||void 0===T?void 0:T.availableTimes)||null,s={rrule:o,startDate:e.startDate,endDate:e.startDate,startTime:e.startTime,endTime:e.endTime,availableTimes:l},(null===(b=J.values)||void 0===b?void 0:b.id)&&(s.id=null===(E=J.values)||void 0===E?void 0:E.id),null!==J.index?V(J.index,s):P(s),z((function(){return!1})),Q(),[2])}}))}))},onDelete:function(){var e=J.index;z(!1),Q(),setTimeout((function(){var r=A().menuRecurrences;N("menuRecurrences",(void 0===r?[]:r).filter((function(r,t){return t!==e})))}),100)}},y&&n.createElement(g.AvailableTimesControl,{workHours:C,isLoading:I,ref:Y,defaultValues:W,errorMessage:null===(q=null===(D=null===(R=null==w?void 0:w.menuRecurrences)||void 0===R?void 0:R["".concat(null==J?void 0:J.index)])||void 0===D?void 0:D.availableTimes)||void 0===q?void 0:q.message,clearErrorMessage:function(){return S("menuRecurrences.".concat(null==J?void 0:J.index,".availableTimes"))}})))),trigger:"click",placement:"bottom",popperConfig:{modifiers:[_]}},n.createElement("div",{className:"product-set-recurrences"},F.map((function(e,r){var t,i,a;return n.createElement(E.ProductSetRecurrenceOverridesControl,{key:e._id,menuRecurrence:e,onEdit:function(){return function(e,r){Q(),setTimeout((function(){K({index:r,values:e}),U(e.availableTimes||[]),z((function(){return!0}))}),100)}(e,r)},errorMessage:null===(a=null===(i=null===(t=null==w?void 0:w.menuRecurrences)||void 0===t?void 0:t["".concat(r)])||void 0===i?void 0:i.availableTimes)||void 0===a?void 0:a.message})})),F.length<T.MAX_QUANTITY_RECURRENCE_DATE_IN_OVERRIDE&&n.createElement("div",{className:"product-set-recurrence-icon-wrapper",role:"button",tabIndex:0,onClick:ee,onKeyDown:ee},n.createElement(u.default,{type:"plus-circle",height:"1rem",className:"product-set-recurrence-icon-add mr-2"}),$("addDates")),n.createElement(a.Form.Control,r.__assign({type:"hidden"},k("menuRecurrences",{required:{value:!0,message:$("Validation:fieldMinNumber",{attribute:$("dates"),min:1})}}))),n.createElement("div",{className:"manual-form-error"},null===(x=w.menuRecurrences)||void 0===x?void 0:x.message))))},exports.sameWidthPopperModifier=_;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"ProductControl.d.ts","sourceRoot":"","sources":["../../../src/product-set/product/ProductControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EAMb,MAAM,kEAAkE,CAAC;AAC1E,OAAO,EACL,WAAW,EAEZ,MAAM,0DAA0D,CAAC;AAElE,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAGtE,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAgBf,OAAO,EACL,KAAK,EAEN,MAAM,sDAAsD,CAAC;AAO9D,OAAO,EAEL,oCAAoC,EACpC,qCAAqC,EACtC,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,oBACf,SAAQ,UAAU,EAChB,2BAA2B,EAC3B,qCAAqC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,CACpC,SAAQ,gBAAgB,EACtB,mBAAmB,CAAC,CAAC,CAAC,EACtB,oCAAoC,CAAC,CAAC,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,EACnD,SAAiB,EACjB,eAAe,EACf,aAAqB,EACrB,oBAA4B,EAC5B,QAAa,EACb,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAmB,GACpB,EAAE,mBAAmB,CAAC,CAAC,CAAC,eAqlBxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EACL,eAAe,EAIhB,MAAM,iBAAiB,CAAC;AASzB,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CACnB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;IACF,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;CACH;AAWD,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,wCAAwC,eA6J1C;AAED,eAAe,mCAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/core/dist/Config"),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon");exports.default=function(e){var s,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/core/dist/Config"),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon"),s=require("@licklist/plugins/dist/utils/dateTime"),u=s.fromFormat(r.TIME_FORMAT),d=s.fromFormat(r.TIME_FULL_FORMAT),c=function(e){return u(e).isValid?u(e):d(e)};exports.default=function(e){var s,u,d,f,v=e.disabled,F=void 0!==v&&v,T=e.minDate,D=e.startDateLabel,E=e.startTimeLabel,g=e.endDateLabel,b=e.endTimeLabel,p=e.startTimeRules,_=e.endTimeRules,C=n.useTranslation(["Design","Notification","App"]).t,h=o.useFormContext(),q=h.formState.errors,y=h.register,L=h.trigger,M=h.control,x=o.useWatch({control:M,name:"startDate"}),I=o.useWatch({control:M,name:"endDate"}),R=o.useWatch({control:M,name:"startTime"}),A=R&&c(R).toFormat(r.TIME_FORMAT),O=o.useWatch({control:M,name:"endTime"}),k=O&&c(O).toFormat(r.TIME_FORMAT);return a.useEffect((function(){x&&I&&L("endDate")}),[x]),a.useEffect((function(){A&&k&&L("endTime")}),[A]),l.createElement(l.Fragment,null,l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=D?D:C("Design:fromDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},y("startDate",{required:!0}),{defaultValue:x,className:x&&"date-input-with-value",disabled:F,min:T,isInvalid:Boolean(q.startDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(s=q.startDate)||void 0===s?void 0:s.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=g?g:C("Design:toDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},y("endDate",{required:!0,validate:function(e){if(!x||!e)return!0;var t=m.DateTime.fromFormat(x,r.DATE_FORMAT);return m.DateTime.fromFormat(e,r.DATE_FORMAT).diff(t,["days"]).days>=0||"".concat(C("Validation:fieldLaterDate",{attribute:C("Design:endDateSmall"),min:C("Design:startDateSmall")}))}}),{defaultValue:I,className:I&&"date-input-with-value",disabled:F,min:x||void 0,isInvalid:Boolean(q.endDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(u=q.endDate)||void 0===u?void 0:u.message)))),l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=E?E:C("Design:availableFrom")),l.createElement(i.Form.Control,t.__assign({type:"time"},y("startTime",t.__assign({required:!1},p)),{placeholder:"hh:mm",defaultValue:A,disabled:F,isInvalid:Boolean(q.startTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(d=q.startTime)||void 0===d?void 0:d.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=b?b:C("Design:availableTo")),l.createElement(i.Form.Control,t.__assign({type:"time"},y("endTime",t.__assign(t.__assign({required:!1},_),{validate:{external:(null==_?void 0:_.validate)?null==_?void 0:_.validate:function(){return!0},time:function(e){var t;if(!A||!e)return!0;var a=m.DateTime.fromISO(A),l=m.DateTime.fromISO(e);return(null===(t=null==l?void 0:l.diff(a,["minutes"]))||void 0===t?void 0:t.minutes)>=0||"".concat(C("Validation:fieldLaterDate",{attribute:C("Design:endTimeSmall"),min:C("Design:startTimeSmall")}))}}})),{placeholder:"hh:mm",defaultValue:k,disabled:F,isInvalid:Boolean(q.endTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(f=q.endTime)||void 0===f?void 0:f.message)))))};
|
|
@@ -7,7 +7,7 @@ interface ReportField {
|
|
|
7
7
|
key: string;
|
|
8
8
|
title: string;
|
|
9
9
|
}
|
|
10
|
-
type ReportRunnerModalProps = {
|
|
10
|
+
export type ReportRunnerModalProps = {
|
|
11
11
|
reportId: Report["id"] | null;
|
|
12
12
|
show: boolean;
|
|
13
13
|
useShowReportFields: (reportType?: ReportType) => CachedHttpQueryResponse<ReportField[], unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReportRunnerModal.d.ts","sourceRoot":"","sources":["../../../src/report/ReportRunnerModal/ReportRunnerModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,MAAM,EAEN,UAAU,EACX,MAAM,uCAAuC,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAG9F,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,
|
|
1
|
+
{"version":3,"file":"ReportRunnerModal.d.ts","sourceRoot":"","sources":["../../../src/report/ReportRunnerModal/ReportRunnerModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,MAAM,EAEN,UAAU,EACX,MAAM,uCAAuC,CAAC;AAO/C,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAG9F,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,mBAAmB,EAAE,CACnB,UAAU,CAAC,EAAE,UAAU,KACpB,uBAAuB,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAC3B,CAAC;AASF,eAAO,MAAM,iBAAiB,0FAS3B,sBAAsB,gBA6KxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),a=(e=r)&&"object"==typeof e&&"default"in e?e.default:e;require("../../static/loader/LoaderIndicator.js");var o=require("../../static/loader/BlockLoader.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),r=require("react"),a=(e=r)&&"object"==typeof e&&"default"in e?e.default:e;require("../../static/loader/LoaderIndicator.js");var o=require("../../static/loader/BlockLoader.js"),i=require("react-i18next"),n=require("react-bootstrap"),l=require("react-hook-form");require("../../static/loader/ButtonLoader.js"),require("../../static/loader/SnippetLoader.js"),require("../../static/loader/PaymentLoader.js");var d,s=require("lodash"),c=require("@licklist/core/dist/DataMapper/Report"),u=require("@licklist/plugins/dist/utils/report"),m=((d={})[c.PERIOD_BY_CREATION_DATE]="Design:reportPeriodByCreationDate",d[c.PERIOD_BY_BOOKING_DATE]="Design:reportPeriodByBookingDate",d);exports.ReportRunnerModal=function(e){var r,d,p,v,E,g=e.reportId,f=e.show,_=e.onHide,y=e.useShowReportFields,b=e.reports,F=e.generate,q=e.download,D=e.onEdit,B=i.useTranslation(["App","Design"]).t,k=null==b?void 0:b.find((function(e){return e.id===g})),I=y(null==k?void 0:k.type),h=I.data,w=void 0===h?[]:h,C=I.isLoading,R=l.useForm({mode:"onChange"}),L=R.handleSubmit,N=R.register,T=R.formState.errors,j=R.reset,O=(0,R.watch)("dateFrom"),P=L((function(e){q.execute(t.__assign(t.__assign({},e),{reportId:g,type:null==k?void 0:k.type}))})),V=L((function(e){return t.__awaiter(void 0,void 0,void 0,(function(){var r;return t.__generator(this,(function(a){switch(a.label){case 0:return[4,F.execute(t.__assign(t.__assign({},e),{reportId:g}))];case 1:return r=a.sent(),k&&r&&!F.isError?(u.openOnlineViewer({type:k.type,dateFrom:e.dateFrom,dateTo:e.dateTo,data:r}),[2]):[2]}}))}))})),x=function(){j(),_()},A=F.isLoading||q.isLoading||C;return a.createElement(n.Modal,{show:f,onHide:x,className:"report-runner-modal",centered:!0},a.createElement("header",null,a.createElement("h5",null,B("generateReport")),a.createElement(n.Button,{variant:"","data-testid":"cancel-button",onClick:x},B("cancel"))),A&&a.createElement(o.BlockLoader,null),!A&&a.createElement("div",null,a.createElement("div",{className:"report-type-label"},s.capitalize(null==k?void 0:k.type)),a.createElement("div",null,null==k?void 0:k.name),a.createElement("div",{className:"data-fields"},null==k?void 0:k.reportFieldValues.map((function(e){var t=null==w?void 0:w.find((function(t){return t.id===e.reportFieldId}));return t?a.createElement("span",{key:e.id},t.title):null}))),a.createElement(n.Button,{className:"edit-button",type:"button",variant:"","data-testid":"edit-button",onClick:D},B("Design:edit")),a.createElement("form",{noValidate:!0},a.createElement("div",{className:"pl-1 ".concat((null===(r=T.periodBy)||void 0===r?void 0:r.message)&&"border-danger border rounded")},a.createElement("div",{className:"period-by"},c.PERIOD_BY_TYPES.map((function(e){return a.createElement("div",{key:e},a.createElement(n.Form.Check,t.__assign({inline:!0,label:B(m[e]),type:"radio",id:e,required:!0,value:e},N("periodBy",{required:"".concat(B("Validation:fieldRequired",{attribute:B("Design:period")}))}))))}))),(null===(d=T.periodBy)||void 0===d?void 0:d.message)&&a.createElement("div",{className:"iframe-event__message-error justify-content-start mb-1"},null===(p=T.periodBy)||void 0===p?void 0:p.message)),a.createElement("div",{className:"controls mt-4"},a.createElement(n.Form.Group,{controlId:"from-input"},a.createElement(n.Form.Label,null,B("Design:from")),a.createElement(n.Form.Control,t.__assign({type:"datetime-local","data-testid":"date-from-input",isInvalid:!!T.dateFrom},N("dateFrom",{required:{value:!0,message:"".concat(B("Validation:fieldRequired",{attribute:B("Design:from")}))}}))),a.createElement(n.Form.Control.Feedback,{type:"invalid"},null===(v=T.dateFrom)||void 0===v?void 0:v.message)),a.createElement(n.Form.Group,{controlId:"to-input"},a.createElement(n.Form.Label,null,B("Design:to")),a.createElement(n.Form.Control,t.__assign({type:"datetime-local","data-testid":"date-to-input",isInvalid:!!T.dateTo},N("dateTo",{required:"".concat(B("Validation:fieldRequired",{attribute:B("Design:to")})),validate:function(e){return!O||(e>O||B("toDateAfterFrom"))}}))),a.createElement(n.Form.Control.Feedback,{type:"invalid"},null===(E=T.dateTo)||void 0===E?void 0:E.message))),a.createElement("div",{className:"controls"},a.createElement(n.Button,{"data-testid":"download-button",onClick:P},B("generateDownload")),a.createElement(n.Button,{"data-testid":"view-button",onClick:V},B("generateView"))))))};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@licklist/design",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@fortawesome/free-brands-svg-icons": "5.15.2",
|
|
51
51
|
"@fortawesome/free-solid-svg-icons": "5.15.2",
|
|
52
52
|
"@fortawesome/react-fontawesome": "0.1.9",
|
|
53
|
-
"@licklist/core": "
|
|
53
|
+
"@licklist/core": "0.28.1",
|
|
54
54
|
"@licklist/eslint-config": "0.4.5",
|
|
55
|
-
"@licklist/plugins": "
|
|
55
|
+
"@licklist/plugins": "0.30.1",
|
|
56
56
|
"@mdx-js/react": "1.6.22",
|
|
57
57
|
"@popperjs/core": "2.11.8",
|
|
58
58
|
"@react-aria/utils": "3.9.0",
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
component: DateTimeButton,
|
|
9
9
|
} as Meta;
|
|
10
10
|
|
|
11
|
-
const date = DateTime.now();
|
|
11
|
+
const date = DateTime.now().plus({ hour: 1 });
|
|
12
12
|
|
|
13
13
|
export const Default: Story<DateTimeButtonProps> = (args) => {
|
|
14
14
|
return <DateTimeButton {...args} />;
|
|
@@ -19,6 +19,7 @@ Default.args = {
|
|
|
19
19
|
isSelected: false,
|
|
20
20
|
isDisabled: false,
|
|
21
21
|
onSelect: () => null,
|
|
22
|
+
shouldCalculateResources: false,
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export const Selected: Story<DateTimeButtonProps> = (args) => {
|
|
@@ -46,7 +46,7 @@ export const DateTimeButton = ({
|
|
|
46
46
|
|
|
47
47
|
const isTimeVariant = variant === Variant.time;
|
|
48
48
|
|
|
49
|
-
const
|
|
49
|
+
const isPast = variant === Variant.time ? isPastTime(date) : isPastDate(date);
|
|
50
50
|
|
|
51
51
|
const noResources =
|
|
52
52
|
shouldCalculateResources &&
|
|
@@ -55,7 +55,7 @@ export const DateTimeButton = ({
|
|
|
55
55
|
!has(resources, "bookedResources") ||
|
|
56
56
|
!has(resources, "totalResources"));
|
|
57
57
|
|
|
58
|
-
const isDisabled = _isDisabled || isSoldOut ||
|
|
58
|
+
const isDisabled = _isDisabled || isSoldOut || isPast || noResources;
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
61
|
<button
|
|
@@ -85,7 +85,7 @@ export const DateTimeButton = ({
|
|
|
85
85
|
{showResources && resources && (
|
|
86
86
|
<AvailabilityIndicator
|
|
87
87
|
resources={resources}
|
|
88
|
-
isUnavailable={_isDisabled ||
|
|
88
|
+
isUnavailable={_isDisabled || isPast}
|
|
89
89
|
isSoldOut={isSoldOut}
|
|
90
90
|
/>
|
|
91
91
|
)}
|
|
@@ -93,5 +93,7 @@ export const DateTimeButton = ({
|
|
|
93
93
|
);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
const
|
|
97
|
-
|
|
96
|
+
const isPastTime = (date: DateTime): boolean => DateTime.now() > date;
|
|
97
|
+
|
|
98
|
+
const isPastDate = (date: DateTime): boolean =>
|
|
99
|
+
DateTime.now() > date.set({ hour: 23, minute: 59, second: 59 });
|
|
@@ -5,7 +5,7 @@ import { Form, OverlayTrigger, Popover } from "react-bootstrap";
|
|
|
5
5
|
import { useFieldArray, useFormContext } from "react-hook-form";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
7
7
|
import { useClickAway } from "react-use";
|
|
8
|
-
import {
|
|
8
|
+
import { UTC_TIMEZONE, TIME_FORMAT } from "@licklist/core/dist/Config/Date";
|
|
9
9
|
import { ProductSetRecurrence } from "@licklist/core/dist/DataMapper/Product/ProductSetRecurrenceDataMapper";
|
|
10
10
|
import { DateTime } from "luxon";
|
|
11
11
|
import RRule, { Frequency } from "rrule";
|
|
@@ -136,7 +136,7 @@ export const DateInput = ({
|
|
|
136
136
|
until: (start as DateTime).toJSDate(),
|
|
137
137
|
byweekday: [],
|
|
138
138
|
freq: Frequency.DAILY,
|
|
139
|
-
tzid:
|
|
139
|
+
tzid: UTC_TIMEZONE,
|
|
140
140
|
interval: 1,
|
|
141
141
|
}).replace("RRULE:", "");
|
|
142
142
|
|
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
QUANTITY_TYPE_LIST_DTO,
|
|
8
8
|
QUANTITY_TYPE_RECHARGING,
|
|
9
9
|
} from "@licklist/core/dist/DataMapper/Product/ProductCategoryDataMapper";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ProductType,
|
|
12
|
+
PRODUCT_DEfAULT_COLORS,
|
|
13
|
+
} from "@licklist/core/dist/DataMapper/Product/ProductDataMapper";
|
|
11
14
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
12
15
|
import {
|
|
13
16
|
FieldNamePrefixPath,
|
|
@@ -36,7 +39,7 @@ import {
|
|
|
36
39
|
} from "react-hook-form";
|
|
37
40
|
import { useTranslation } from "react-i18next";
|
|
38
41
|
import { useImages } from "@licklist/plugins/dist/hooks/Media/useImages";
|
|
39
|
-
|
|
42
|
+
|
|
40
43
|
import {
|
|
41
44
|
Image,
|
|
42
45
|
IMAGE_TYPE_IMAGE,
|
|
@@ -2,8 +2,18 @@ import React, { useEffect } from "react";
|
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
import { Col, Form, Row } from "react-bootstrap";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
RegisterOptions,
|
|
7
|
+
useFormContext,
|
|
8
|
+
useWatch,
|
|
9
|
+
Validate,
|
|
10
|
+
} from "react-hook-form";
|
|
11
|
+
import {
|
|
12
|
+
DATE_FORMAT,
|
|
13
|
+
TIME_FORMAT,
|
|
14
|
+
TIME_FULL_FORMAT,
|
|
15
|
+
} from "@licklist/core/dist/Config";
|
|
16
|
+
import { fromFormat } from "@licklist/plugins/dist/utils/dateTime";
|
|
7
17
|
import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
|
|
8
18
|
|
|
9
19
|
interface RecurrenceIntervalAndFrequencyInputProps {
|
|
@@ -23,6 +33,15 @@ interface RecurrenceIntervalAndFrequencyInputProps {
|
|
|
23
33
|
>;
|
|
24
34
|
}
|
|
25
35
|
|
|
36
|
+
const fromTimeFormat = fromFormat(TIME_FORMAT);
|
|
37
|
+
const fromTimeFullFormat = fromFormat(TIME_FULL_FORMAT);
|
|
38
|
+
|
|
39
|
+
// default values and entered values are in different formats
|
|
40
|
+
const fromTimeFormats = (time: string) =>
|
|
41
|
+
fromTimeFormat(time).isValid
|
|
42
|
+
? fromTimeFormat(time)
|
|
43
|
+
: fromTimeFullFormat(time);
|
|
44
|
+
|
|
26
45
|
function RecurrenceIntervalAndFrequencyInput({
|
|
27
46
|
disabled = false,
|
|
28
47
|
minDate,
|
|
@@ -36,16 +55,21 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
36
55
|
const { t } = useTranslation(["Design", "Notification", "App"]);
|
|
37
56
|
|
|
38
57
|
const {
|
|
39
|
-
getValues,
|
|
40
58
|
formState: { errors },
|
|
41
59
|
register,
|
|
42
60
|
trigger,
|
|
61
|
+
control,
|
|
43
62
|
} = useFormContext<RecurringDatePickerInputValues>();
|
|
44
63
|
|
|
45
|
-
const startDate =
|
|
46
|
-
const endDate =
|
|
47
|
-
|
|
48
|
-
const
|
|
64
|
+
const startDate = useWatch({ control, name: "startDate" });
|
|
65
|
+
const endDate = useWatch({ control, name: "endDate" });
|
|
66
|
+
|
|
67
|
+
const _startTime = useWatch({ control, name: "startTime" });
|
|
68
|
+
const startTime =
|
|
69
|
+
_startTime && fromTimeFormats(_startTime).toFormat(TIME_FORMAT);
|
|
70
|
+
|
|
71
|
+
const _endTime = useWatch({ control, name: "endTime" });
|
|
72
|
+
const endTime = _endTime && fromTimeFormats(_endTime).toFormat(TIME_FORMAT);
|
|
49
73
|
|
|
50
74
|
useEffect(() => {
|
|
51
75
|
if (!startDate || !endDate) {
|
|
@@ -149,22 +173,27 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
149
173
|
type="time"
|
|
150
174
|
{...register("endTime", {
|
|
151
175
|
required: false,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
176
|
+
...endTimeRules,
|
|
177
|
+
validate: {
|
|
178
|
+
external: endTimeRules?.validate
|
|
179
|
+
? (endTimeRules?.validate as Validate<string>)
|
|
180
|
+
: () => true,
|
|
181
|
+
time: (time) => {
|
|
182
|
+
if (!startTime || !time) {
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
const currentStartTime = DateTime.fromISO(startTime);
|
|
186
|
+
const currentEndTime = DateTime.fromISO(time);
|
|
158
187
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
188
|
+
return currentEndTime?.diff(currentStartTime, ["minutes"])
|
|
189
|
+
?.minutes >= 0
|
|
190
|
+
? true
|
|
191
|
+
: `${t(`Validation:fieldLaterDate`, {
|
|
192
|
+
attribute: t("Design:endTimeSmall"),
|
|
193
|
+
min: t("Design:startTimeSmall"),
|
|
194
|
+
})}`;
|
|
195
|
+
},
|
|
166
196
|
},
|
|
167
|
-
...endTimeRules,
|
|
168
197
|
})}
|
|
169
198
|
placeholder="hh:mm"
|
|
170
199
|
defaultValue={endTime}
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Card } from "react-bootstrap";
|
|
4
|
+
import { ReportRunnerModal, ReportRunnerModalProps } from "./ReportRunnerModal";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Report/ReportRunnerModal",
|
|
8
|
+
component: ReportRunnerModal,
|
|
9
|
+
} as Meta;
|
|
10
|
+
|
|
11
|
+
export const Default: Story<ReportRunnerModalProps> = (args) => (
|
|
12
|
+
<Card style={{ maxWidth: "max-content" }}>
|
|
13
|
+
<Card.Body>
|
|
14
|
+
<ReportRunnerModal {...args} />
|
|
15
|
+
</Card.Body>
|
|
16
|
+
</Card>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
Default.args = {
|
|
20
|
+
reportId: 47,
|
|
21
|
+
show: true,
|
|
22
|
+
generate: { isLoading: false },
|
|
23
|
+
download: { isLoading: false },
|
|
24
|
+
useShowReportFields: (type) => ({ data: [], isLoading: false }),
|
|
25
|
+
onHide: () => {},
|
|
26
|
+
onEdit: () => {},
|
|
27
|
+
reports: [
|
|
28
|
+
{
|
|
29
|
+
id: 47,
|
|
30
|
+
providerId: null,
|
|
31
|
+
type: "payments",
|
|
32
|
+
name: "Test 1",
|
|
33
|
+
createdAt: "2024-04-26 08:16:59",
|
|
34
|
+
updatedAt: "2024-04-26 08:16:59",
|
|
35
|
+
deletedAt: null,
|
|
36
|
+
reportFieldValues: [
|
|
37
|
+
{
|
|
38
|
+
id: 580,
|
|
39
|
+
reportId: 47,
|
|
40
|
+
reportFieldId: 16,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 581,
|
|
44
|
+
reportId: 47,
|
|
45
|
+
reportFieldId: 17,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 582,
|
|
49
|
+
reportId: 47,
|
|
50
|
+
reportFieldId: 18,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 583,
|
|
54
|
+
reportId: 47,
|
|
55
|
+
reportFieldId: 19,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 584,
|
|
59
|
+
reportId: 47,
|
|
60
|
+
reportFieldId: 20,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 585,
|
|
64
|
+
reportId: 47,
|
|
65
|
+
reportFieldId: 21,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 586,
|
|
69
|
+
reportId: 47,
|
|
70
|
+
reportFieldId: 22,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 587,
|
|
74
|
+
reportId: 47,
|
|
75
|
+
reportFieldId: 23,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 588,
|
|
79
|
+
reportId: 47,
|
|
80
|
+
reportFieldId: 24,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 589,
|
|
84
|
+
reportId: 47,
|
|
85
|
+
reportFieldId: 26,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 590,
|
|
89
|
+
reportId: 47,
|
|
90
|
+
reportFieldId: 27,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 591,
|
|
94
|
+
reportId: 47,
|
|
95
|
+
reportFieldId: 28,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 592,
|
|
99
|
+
reportId: 47,
|
|
100
|
+
reportFieldId: 40,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 593,
|
|
104
|
+
reportId: 47,
|
|
105
|
+
reportFieldId: 41,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 594,
|
|
109
|
+
reportId: 47,
|
|
110
|
+
reportFieldId: 42,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 52,
|
|
116
|
+
providerId: null,
|
|
117
|
+
type: "bookings",
|
|
118
|
+
name: "new report",
|
|
119
|
+
createdAt: "2024-04-29 16:05:51",
|
|
120
|
+
updatedAt: "2024-04-29 16:08:39",
|
|
121
|
+
deletedAt: null,
|
|
122
|
+
reportFieldValues: [
|
|
123
|
+
{
|
|
124
|
+
id: 635,
|
|
125
|
+
reportId: 52,
|
|
126
|
+
reportFieldId: 1,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 636,
|
|
130
|
+
reportId: 52,
|
|
131
|
+
reportFieldId: 2,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: 637,
|
|
135
|
+
reportId: 52,
|
|
136
|
+
reportFieldId: 3,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 638,
|
|
140
|
+
reportId: 52,
|
|
141
|
+
reportFieldId: 4,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 639,
|
|
145
|
+
reportId: 52,
|
|
146
|
+
reportFieldId: 5,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: 640,
|
|
150
|
+
reportId: 52,
|
|
151
|
+
reportFieldId: 6,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 641,
|
|
155
|
+
reportId: 52,
|
|
156
|
+
reportFieldId: 7,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 642,
|
|
160
|
+
reportId: 52,
|
|
161
|
+
reportFieldId: 8,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 643,
|
|
165
|
+
reportId: 52,
|
|
166
|
+
reportFieldId: 9,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 644,
|
|
170
|
+
reportId: 52,
|
|
171
|
+
reportFieldId: 10,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 645,
|
|
175
|
+
reportId: 52,
|
|
176
|
+
reportFieldId: 11,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: 646,
|
|
180
|
+
reportId: 52,
|
|
181
|
+
reportFieldId: 12,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: 647,
|
|
185
|
+
reportId: 52,
|
|
186
|
+
reportFieldId: 13,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: 648,
|
|
190
|
+
reportId: 52,
|
|
191
|
+
reportFieldId: 14,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: 649,
|
|
195
|
+
reportId: 52,
|
|
196
|
+
reportFieldId: 15,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: 650,
|
|
200
|
+
reportId: 52,
|
|
201
|
+
reportFieldId: 36,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
id: 651,
|
|
205
|
+
reportId: 52,
|
|
206
|
+
reportFieldId: 37,
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 652,
|
|
210
|
+
reportId: 52,
|
|
211
|
+
reportFieldId: 38,
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
id: 653,
|
|
215
|
+
reportId: 52,
|
|
216
|
+
reportFieldId: 39,
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: 654,
|
|
220
|
+
reportId: 52,
|
|
221
|
+
reportFieldId: 47,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: 655,
|
|
225
|
+
reportId: 52,
|
|
226
|
+
reportFieldId: 48,
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: 53,
|
|
232
|
+
providerId: null,
|
|
233
|
+
type: "tickets",
|
|
234
|
+
name: "tickets",
|
|
235
|
+
createdAt: "2024-04-29 16:12:36",
|
|
236
|
+
updatedAt: "2024-04-29 16:12:36",
|
|
237
|
+
deletedAt: null,
|
|
238
|
+
reportFieldValues: [
|
|
239
|
+
{
|
|
240
|
+
id: 656,
|
|
241
|
+
reportId: 53,
|
|
242
|
+
reportFieldId: 29,
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: 657,
|
|
246
|
+
reportId: 53,
|
|
247
|
+
reportFieldId: 30,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: 658,
|
|
251
|
+
reportId: 53,
|
|
252
|
+
reportFieldId: 31,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: 659,
|
|
256
|
+
reportId: 53,
|
|
257
|
+
reportFieldId: 32,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: 660,
|
|
261
|
+
reportId: 53,
|
|
262
|
+
reportFieldId: 33,
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: 661,
|
|
266
|
+
reportId: 53,
|
|
267
|
+
reportFieldId: 34,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
id: 662,
|
|
271
|
+
reportId: 53,
|
|
272
|
+
reportFieldId: 35,
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: 663,
|
|
276
|
+
reportId: 53,
|
|
277
|
+
reportFieldId: 43,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
id: 664,
|
|
281
|
+
reportId: 53,
|
|
282
|
+
reportFieldId: 44,
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 665,
|
|
286
|
+
reportId: 53,
|
|
287
|
+
reportFieldId: 45,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: 666,
|
|
291
|
+
reportId: 53,
|
|
292
|
+
reportFieldId: 46,
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
id: 667,
|
|
296
|
+
reportId: 53,
|
|
297
|
+
reportFieldId: 51,
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: 668,
|
|
301
|
+
reportId: 53,
|
|
302
|
+
reportFieldId: 52,
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
};
|
|
@@ -23,7 +23,7 @@ interface ReportField {
|
|
|
23
23
|
title: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
type ReportRunnerModalProps = {
|
|
26
|
+
export type ReportRunnerModalProps = {
|
|
27
27
|
reportId: Report["id"] | null;
|
|
28
28
|
show: boolean;
|
|
29
29
|
useShowReportFields: (
|
|
@@ -136,28 +136,38 @@ export const ReportRunnerModal = ({
|
|
|
136
136
|
</Button>
|
|
137
137
|
|
|
138
138
|
<form noValidate>
|
|
139
|
-
<div
|
|
140
|
-
{
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
<div
|
|
140
|
+
className={`pl-1 ${
|
|
141
|
+
errors.periodBy?.message && "border-danger border rounded"
|
|
142
|
+
}`}
|
|
143
|
+
>
|
|
144
|
+
<div className="period-by">
|
|
145
|
+
{PERIOD_BY_TYPES.map((type) => (
|
|
146
|
+
<div key={type}>
|
|
143
147
|
<Form.Check
|
|
144
148
|
inline
|
|
145
|
-
isInvalid={!!errors.periodBy}
|
|
146
149
|
label={t(labelByPeriodType[type])}
|
|
147
150
|
type="radio"
|
|
148
151
|
id={type}
|
|
152
|
+
required
|
|
149
153
|
value={type}
|
|
150
|
-
{...register("periodBy"
|
|
154
|
+
{...register("periodBy", {
|
|
155
|
+
required: `${t("Validation:fieldRequired", {
|
|
156
|
+
attribute: t("Design:period"),
|
|
157
|
+
})}`,
|
|
158
|
+
})}
|
|
151
159
|
/>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
</div>
|
|
161
|
+
))}
|
|
162
|
+
</div>
|
|
163
|
+
{errors.periodBy?.message && (
|
|
164
|
+
<div className="iframe-event__message-error justify-content-start mb-1">
|
|
165
|
+
{errors.periodBy?.message}
|
|
156
166
|
</div>
|
|
157
|
-
)
|
|
167
|
+
)}
|
|
158
168
|
</div>
|
|
159
169
|
|
|
160
|
-
<div className="controls">
|
|
170
|
+
<div className="controls mt-4">
|
|
161
171
|
<Form.Group controlId="from-input">
|
|
162
172
|
<Form.Label>{t("Design:from")}</Form.Label>
|
|
163
173
|
<Form.Control
|
|
@@ -168,7 +178,7 @@ export const ReportRunnerModal = ({
|
|
|
168
178
|
required: {
|
|
169
179
|
value: true,
|
|
170
180
|
message: `${t("Validation:fieldRequired", {
|
|
171
|
-
attribute: t("Design:
|
|
181
|
+
attribute: t("Design:from"),
|
|
172
182
|
})}`,
|
|
173
183
|
},
|
|
174
184
|
})}
|
|
@@ -23,7 +23,7 @@ export function BooleanSwitch({
|
|
|
23
23
|
const { t } = useTranslation("Design");
|
|
24
24
|
|
|
25
25
|
const options: SelectItem[] = [
|
|
26
|
-
{ id: 1, value: firstValueTitle ??
|
|
26
|
+
{ id: 1, value: firstValueTitle ?? t("yes") },
|
|
27
27
|
{ id: 0, value: secondValueTitle ?? t("no") },
|
|
28
28
|
];
|
|
29
29
|
|