PageSourceSearch

https://royalcruiser.com/Scripts/JS/Feedback.jsx

js royalcruiser.com collected 2026-10-02 01:42:45 UTC 21,093 bytes, 695 lines download raw bytes

1// @hash v3-8F841A9468CC678E34F1615794CAD227D856F735
2// Automatically generated by ReactJS.NET. Do not edit, your changes will be overridden.
3// Version: 5.2.12 (build 29c76c8) with Babel 7.8.7
4// Generated at: 10/2/2026 7:12:44 AM
5///////////////////////////////////////////////////////////////////////////////
6function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
7
8function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
9
10function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
12function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
14const {
15  useEffect,
16  useState
17} = React;
18const {
19  TextField,
20  Autocomplete,
21  Box,
22  Snackbar,
23  Alert
24} = MaterialUI;
25const ErrorLog = React.lazy(() => import('/Scripts/JS/ErrorLog.jsx'));
26export default function Feedback(props) {
27  let [feedbackObj, setFeedbackObj] = useState({
28    Type: {
29      value: 0,
30      label: 'Select Type'
31    },
32    Subject: {
33      value: 0,
34      label: 'Select Subject'
35    },
36    Email: "",
37    ContactPerson: "",
38    CustPhone: "",
39    Comment: "",
40    captcha: "",
41    captchaurl: "",
42    PNRNo: ""
43  });
44  let [validate, setValidate] = useState({
45    Type: false,
46    Subject: false,
47    Email: false,
48    ValidEmail: false,
49    ContactPerson: false,
50    CustPhone: false,
51    ValidPhone: false,
52    Comment: false,
53    captcha: false,
54    PNRNo: false
55  });
56  useEffect(() => {
57    (async function () {
58      await CapchaImageRefresh();
59    })();
60  }, []);
61  const isCompany20 = props.compDetails?.companyData?.CompanyID === 20;
62  let TypeObj = [{
63    value: 0,
64    label: 'Select Type'
65  }, {
66    value: 1,
67    label: 'Suggestions'
68  }, {
69    value: 2,
70    label: 'Complaints'
71  }, {
72    value: 3,
73    label: 'Inquiry'
74  }, {
75    value: 4,
76    label: 'Compliments'
77  }];
78  let SubjectObj = [{
79    value: 0,
80    label: 'Select Subject'
81  }, {
82    value: 1,
83    label: 'Bus Service'
84  }, {
85    value: 2,
86    label: 'Web Site'
87  }, {
88    value: 3,
89    label: 'Schedule'
90  }];
91
92  const ddlChange = (e, n, name) => {
93    try {
94      feedbackObj[name] = n;
95      setFeedbackObj(feedbackObj => _objectSpread({}, feedbackObj));
96    } catch (error) {
97      insertError(error, "Ruturajsinh Jadeja");
98    }
99  }; //For Popup Msg
100
101
102  let [dlgMsg, setdlMsg] = useState({
103    open: false,
104    msg: '',
105    type: 0
106  }); //Close Event For Alert Box
107
108  const handleClose = () => {
109    try {
110      setdlMsg({
111        open: false,
112        msg: '',
113        type: 0
114      });
115    } catch (error) {
116      insertError(error, "Ruturajsinh Jadeja");
117    }
118  }; //Alert Box
119
120
121  const alertBox = (mesage, type) => {
122    try {
123      setdlMsg({
124        open: true,
125        msg: mesage,
126        type: type
127      });
128    } catch (error) {
129      insertError(error, "Ruturajsinh Jadeja");
130    }
131  };
132
133  const InsertFeedBackData = async () => {
134    try {
135      $(".isLoader").show();
136
137      const obj = _.cloneDeep(feedbackObj);
138
139      let flag = validation(obj);
140
141      if (flag) {
142        const data = {
143          Type: obj.Type.value,
144          Subject: obj.Subject.value,
145          CustEmail: obj.Email.trim(),
146          CustName: obj.ContactPerson.trim(),
147          CustPhone: obj.CustPhone.trim(),
148          Observation: obj.Comment.trim(),
149          captcha: obj.captcha,
150          captchaurl: "Captcha/CImage.aspx",
151          PNRNo: obj.PNRNo.trim()
152        };
153        await axios.post('/Web_Methods/OtherWebMethod.aspx/SubmitFeedBack', {
154          Feedback: data
155        }).then(async response => {
156          let data = await JSON.parse(response.data.d.data);
157
158          if (data.status == 2) {
159            //$("#spanValidCaptcha").show();
160            //CapchaImageRefresh();
161            alertBox("Enter Valid Captcha");
162          } else {
163            if (data.status == 1) {
164              setFeedbackObj({
165                Type: {
166                  value: 0,
167                  label: 'Select Type'
168                },
169                Subject: {
170                  value: 0,
171                  label: 'Select Subject'
172                },
173                Email: "",
174                ContactPerson: "",
175                CustPhone: "",
176                Comment: "",
177                captcha: "",
178                captchaurl: "Captcha/CImage.aspx",
179                PNRNo: ""
180              });
181              alertBox(data.msg);
182            } else {
183              if (data.status == 0) {
184                alertBox(data.msg);
185              }
186            }
187          }
188
189          CapchaImageRefresh();
190        }).catch(function (error) {
191          console.log(error);
192        });
193      }
194    } catch (error) {
195      insertError(error, "Ruturajsinh Jadeja");
196    } finally {
197      $(".isLoader").hide();
198    }
199  };
200
201  const feedbackDetailsChange = (e, cheackRegx) => {
202    let flag = true;
203
204    if (cheackRegx == 1) {
205      const re = /^[0-9\b]+$/;
206
207      if (e.target.value === '' || re.test(e.target.value)) {
208        flag = true;
209      } else {
210        flag = false;
211      }
212    }
213
214    if (flag) {
215      feedbackObj[e.target.name] = e.target.value;
216      setFeedbackObj(feedbackObj => _objectSpread({}, feedbackObj));
217    }
218  };
219
220  const isValidEmailAddress = emailAddress => {
221    try {
222      let pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
223      return pattern.test(emailAddress);
224    } catch (error) {
225      insertError(error, "Ruturajsinh Jadeja");
226    }
227  };
228
229  const CapchaImageRefresh = async () => {
230    try {
231      $(".isLoader").show();
232      await axios.post('/DataBinding.aspx/ChangeCapchaImage', {}).then(async response => {
233        let data = await response.data.d; //feedbackObj.captchaurl = data.toString();
234
235        setFeedbackObj(feedbackObj => _objectSpread({}, feedbackObj, {
236          captchaurl: data.toString()
237        }));
238      }).catch(function (error) {
239        console.log(error);
240      });
241    } catch (error) {
242      insertError(error, "Ruturajsinh Jadeja");
243    } finally {
244      $(".isLoader").hide();
245    }
246  };
247
248  const validation = data => {
249    let isFlag = true;
250    let {
251      Type,
252      Subject,
253      Email,
254      ContactPerson,
255      CustPhone,
256      PNRNo,
257      Comment,
258      captcha
259    } = data;
260
261    try {
262      //if (data.Type.value > 0) {
263      //    $("#spnType").hide();
264      //} else {
265      //    $("#spnType").show();
266      //    $("#Type").focus();
267      //    isFlag = false;
268      //}
269      //if (data.Subject.value > 0) {
270      //    $("#spnSubject").hide();
271      //} else {
272      //    $("#spnSubject").show();
273      //    $("#Subject").focus();
274      //    isFlag = false;
275      //}
276      //if (data.Email.trim() != "" && data.Email != undefined) {
277      //    $("#spnEmail").hide();
278      //    $("#spanValidEmail").hide();
279      //    if (isValidEmailAddress(data.Email.trim())) {
280      //        $("#spanValidEmail").hide();
281      //    }
282      //    else {
283      //        isFlag = false;
284      //        $("#spanValidEmail").show();
285      //        $("#txtEmail").focus();
286      //    }
287      //}
288      //else {
289      //    $("#spnEmail").show();
290      //    $("#spanValidEmail").hide();
291      //    $("#txtEmail").focus();
292      //    isFlag = false;
293      //}
294      //if (data.ContactPerson != "" && data.ContactPerson != undefined) {
295      //    $("#spnContactPerson").hide();
296      //} else {
297      //    $("#spnContactPerson").show();
298      //    $("#txtContactPerson").focus();
299      //    isFlag = false;
300      //}
301      //if (data.CustPhone.trim() != "" && data.CustPhone != undefined) {
302      //    $("#spnCustPhone").hide();
303      //    if (data.CustPhone.match(/^[6-9]\d{9}$/)) {
304      //        $("#spanValidspnCustPhone").hide();
305      //    } else {
306      //        isFlag = false;
307      //        $("#spanValidspnCustPhone").show();
308      //        $("#txtCustPhone").focus();
309      //    }
310      //}
311      //else {
312      //    $("#spnCustPhone").show();
313      //    $("#spanValidspnCustPhone").hide();
314      //    $("#txtCustPhone").focus();
315      //    isFlag = false;
316      //}
317      ////if (data.ContactPerson.trim() != "" && data.ContactPerson != undefined) {
318      ////    $("#spnContactPerson").hide();
319      ////} else {
320      ////    $("#spnContactPerson").show();
321      ////    $("#txtContactPerson").focus();
322      ////    isFlag = false;
323      ////}
324      //if (isCompany20) {
325      //    if (data.PNRNo != "" && data.PNRNo != undefined) {
326      //        $("#spnPNRNo").hide();
327      //    } else {
328      //        $("#spnPNRNo").show();
329      //        $("#spnPNRNo").focus();
330      //        isFlag = false;
331      //    }
332      //}
333      //if (data.Comment.trim() != "" && data.Comment != undefined) {
334      //    $("#spnComment").hide();
335      //} else {
336      //    $("#spnComment").show();
337      //    $("#txtComment").focus();
338      //    isFlag = false;
339      //}
340      //if (data.captcha.trim() != "" && data.captcha != undefined) {
341      //    $("#spanCaptcha").hide();
342      //} else {
343      //    $("#spanCaptcha").show();
344      //    $("#txtcaptcha").focus();
345      //    isFlag = false;
346      //}
347      //$("#spanValidCaptcha").hide();
348      // Define validation rules
349      const newValidate = {
350        Type: Type.value <= 0,
351        Subject: Subject.value <= 0,
352        Email: Email.trim() === "",
353        ValidEmail: Email.trim() !== "" && !isValidEmailAddress(Email.trim()),
354        ContactPerson: ContactPerson.trim() === "",
355        CustPhone: CustPhone.trim() === "",
356        ValidPhone: CustPhone.trim() !== "" && !/^[6-9]\d{9}$/.test(CustPhone.trim()),
357        PNRNo: isCompany20 && PNRNo === "",
358        Comment: Comment.trim() === "",
359        captcha: captcha.trim() === ""
360      };
361      setValidate(prev => _objectSpread({}, prev, {}, newValidate));
362
363      if (newValidate.Type) {
364        $("#Type").focus();
365        isFlag = false;
366      } else if (newValidate.Subject) {
367        $("#Subject").focus();
368        isFlag = false;
369      } else if (newValidate.Email) {
370        $("#txtEmail").focus();
371        isFlag = false;
372      } else if (newValidate.ValidEmail) {
373        $("#txtEmail").focus();
374        isFlag = false;
375      } else if (newValidate.ContactPerson) {
376        $("#txtContactPerson").focus();
377        isFlag = false;
378      } else if (newValidate.CustPhone) {
379        $("#txtCustPhone").focus();
380        isFlag = false;
381      } else if (newValidate.ValidPhone) {
382        $("#txtCustPhone").focus();
383        isFlag = false;
384      } else if (newValidate.PNRNo) {
385        $("#spnPNRNo").focus();
386        isFlag = false;
387      } else if (newValidate.Comment) {
388        $("#txtComment").focus();
389        isFlag = false;
390      } else if (newValidate.captcha) {
391        $("#txtcaptcha").focus();
392        isFlag = false;
393      }
394    } catch (error) {
395      insertError(error, "Ruturajsinh Jadeja");
396    } finally {
397      return isFlag;
398    }
399  };
400
401  const insertError = (error, dev_Name) => {
402    const id = CreateNewDiv();
403    const root1 = ReactDOM.createRoot(document.getElementById(id));
404    root1.render(React.createElement(Suspense, null, React.createElement(ErrorLog, {
405      CustomErrorObj: {
406        errorObj: error,
407        developerName: dev_Name
408      }
409    })));
410    RemoveDiv(id);
411  };
412
413  return React.createElement(React.Fragment, null, React.createElement("div", {
414    id: "wrapper"
415  }, React.createElement("div", {
416    className: "fix_contentwidth"
417  }, React.createElement("div", {
418    className: "feedback_wrapper"
419  }, React.createElement("div", {
420    className: "panel panel-primary"
421  }, React.createElement("div", {
422    className: "panel-heading"
423  }, "Feedback"), React.createElement("div", {
424    className: "panel-body"
425  }, React.createElement("div", {
426    className: "feedbkformgroup"
427  }, React.createElement("div", {
428    className: "feedbkinput"
429  }, React.createElement("div", {
430    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
431  }, React.createElement("label", null, "Feedback Type"), React.createElement(Autocomplete, {
432    id: "Type",
433    name: "Type",
434    autoHighlight: true,
435    value: feedbackObj.Type,
436    options: TypeObj,
437    onChange: (e, n) => {
438      ddlChange(e, n, 'Type');
439      setValidate(prev => _objectSpread({}, prev, {
440        Type: false
441      }));
442    },
443    error: "true",
444    renderOption: (props, option) => React.createElement(Box, _extends({
445      component: "li"
446    }, props, {
447      key: option.value
448    }), option.label),
449    renderInput: params => React.createElement(TextField, _extends({}, params, {
450      label: "",
451      variant: "standard"
452    }))
453  }), validate.Type && React.createElement("span", {
454    className: "redclr",
455    id: "spnType",
456    style: {
457      color: 'red'
458    }
459  }, "Please Enter Feedback Type")), React.createElement("div", {
460    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
461  }, React.createElement("label", null, "Subject"), React.createElement(Autocomplete, {
462    id: "Subject",
463    name: "Subject",
464    autoHighlight: true,
465    value: feedbackObj.Subject,
466    options: SubjectObj,
467    onChange: (e, n) => {
468      ddlChange(e, n, 'Subject');
469      setValidate(prev => _objectSpread({}, prev, {
470        Subject: false
471      }));
472    },
473    error: "true",
474    renderOption: (props, option) => React.createElement(Box, _extends({
475      component: "li"
476    }, props, {
477      key: option.value
478    }), option.label),
479    renderInput: params => React.createElement(TextField, _extends({}, params, {
480      label: "",
481      variant: "standard"
482    }))
483  }), validate.Subject && React.createElement("span", {
484    className: "redclr",
485    id: "spnSubject",
486    style: {
487      color: 'red'
488    }
489  }, "Please Enter Subject")), React.createElement("div", {
490    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
491  }, React.createElement("label", null, "Email"), React.createElement("input", {
492    type: "text",
493    className: "form-control",
494    placeholder: "Email",
495    name: "Email",
496    id: "txtEmail",
497    maxLength: "100",
498    value: feedbackObj.Email,
499    onChange: e => {
500      feedbackDetailsChange(e, 0);
501      setValidate(prev => _objectSpread({}, prev, {
502        Email: false,
503        ValidEmail: false
504      }));
505    },
506    autoComplete: "off"
507  }), validate.Email ? React.createElement("span", {
508    className: "redclr",
509    id: "spnEmail",
510    style: {
511      color: 'red'
512    }
513  }, "Please Enter Email") : validate.ValidEmail ? React.createElement("span", {
514    className: "redclr",
515    id: "spanValidEmail",
516    style: {
517      color: 'red'
518    }
519  }, "Please Enter Valid Email") : null), React.createElement("div", {
520    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
521  }, React.createElement("label", null, "Contact person"), React.createElement("input", {
522    type: "text",
523    className: "form-control",
524    placeholder: "Contact person",
525    name: "ContactPerson",
526    id: "txtContactPerson",
527    value: feedbackObj.ContactPerson,
528    onChange: e => {
529      feedbackDetailsChange(e, 0);
530      setValidate(prev => _objectSpread({}, prev, {
531        ContactPerson: false
532      }));
533    },
534    autoComplete: "off"
535  }), validate.ContactPerson && React.createElement("span", {
536    className: "redclr",
537    id: "spnContactPerson",
538    style: {
539      color: 'red'
540    }
541  }, "Please Enter Contact Person")), React.createElement("div", {
542    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
543  }, React.createElement("label", null, "Phone No."), React.createElement("input", {
544    type: "text",
545    maxLength: "10",
546    className: "form-control",
547    placeholder: "Phone No.",
548    name: "CustPhone",
549    id: "txtCustPhone",
550    value: feedbackObj.CustPhone,
551    onChange: e => {
552      feedbackDetailsChange(e, 1);
553      setValidate(prev => _objectSpread({}, prev, {
554        CustPhone: false,
555        ValidPhone: false
556      }));
557    },
558    autoComplete: "off"
559  }), validate.CustPhone ? React.createElement("span", {
560    className: "redclr",
561    id: "spnCustPhone",
562    style: {
563      color: 'red'
564    }
565  }, "Please Enter Phone No.") : validate.ValidPhone ? React.createElement("span", {
566    className: "redclr",
567    id: "spanValidspnCustPhone",
568    style: {
569      color: 'red'
570    }
571  }, "Please Enter Valid Phone No.") : null), isCompany20 && React.createElement("div", {
572    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
573  }, React.createElement("label", null, "PNR No."), React.createElement("input", {
574    type: "text",
575    className: "form-control",
576    placeholder: "PNRNo.",
577    name: "PNRNo",
578    id: "txtPNRNo",
579    value: feedbackObj.PNRNo,
580    onChange: e => {
581      feedbackDetailsChange(e, 0);
582      setValidate(prev => _objectSpread({}, prev, {
583        PNRNo: false
584      }));
585    },
586    autoComplete: "off"
587  }), validate.PNRNo && React.createElement("span", {
588    className: "redclr",
589    id: "spnPNRNo",
590    style: {
591      color: 'red'
592    }
593  }, "Please Enter PNR No")), React.createElement("div", {
594    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
595  }, React.createElement("label", null, "Comment"), React.createElement("textarea", {
596    name: "Comment",
597    id: "txtComment",
598    className: "form-control",
599    placeholder: "Comment",
600    spellCheck: "false",
601    value: feedbackObj.Comment,
602    onChange: e => {
603      feedbackDetailsChange(e, 0);
604      setValidate(prev => _objectSpread({}, prev, {
605        Comment: false
606      }));
607    }
608  }), validate.Comment && React.createElement("span", {
609    className: "redclr",
610    id: "spnComment",
611    style: {
612      color: 'red'
613    }
614  }, "Please Enter Comment"))), React.createElement("div", {
615    className: "agntpgcaptcha"
616  }, React.createElement("div", {
617    className: "col-lg-12 col-md-12 col-sm-12 col-xs-12 mrgbtm"
618  }, React.createElement("label", null, "Retype the characters from the picture:"), React.createElement("div", {
619    className: "captchin"
620  }, React.createElement("img", {
621    id: "ctl00_content_imgcaptcha",
622    src: feedbackObj.captchaurl,
623    style: {
624      Width: '200px',
625      borderWidth: '0'
626    }
627  }), React.createElement("a", {
628    onClick: CapchaImageRefresh,
629    className: "captcharefresh"
630  }, React.createElement("i", {
631    className: "fa fa-refresh"
632  })))), React.createElement("div", {
633    className: "col-lg-6 col-md-6 col-sm-12 col-xs-12 mrgbtm"
634  }, React.createElement("input", {
635    type: "text",
636    maxLength: "40",
637    className: "form-control cldr-inp",
638    name: "captcha",
639    id: "txtcaptcha",
640    value: feedbackObj.captcha,
641    onChange: e => {
642      feedbackDetailsChange(e, 0);
643      setValidate(prev => _objectSpread({}, prev, {
644        captcha: false
645      }));
646    }
647  }), validate.captcha && React.createElement("span", {
648    className: "redclr",
649    id: "spanCaptcha",
650    style: {
651      color: 'red'
652    }
653  }, "Please Enter Captcha"), React.createElement("span", {
654    className: "redclr",
655    id: "spanValidCaptcha",
656    style: {
657      display: 'none',
658      color: 'red'
659    }
660  }, "Please Enter Valid Captcha")), React.createElement("div", {
661    className: "col-lg-12 col-md-12 col-sm-12 col-xs-12 mrgbtm"
662  }, React.createElement("input", {
663    type: "button",
664    name: "",
665    value: "Submit",
666    id: "",
667    className: "btn btn-default btn-primary",
668    onClick: InsertFeedBackData
669  }))))))))), React.createElement("div", null, dlgMsg.open && React.createElement(Message, {
670    Msg: dlgMsg,
671    close: handleClose
672  })));
673}
674
675const Message = props => {
676  const {
677    Msg,
678    close
679  } = props;
680  return React.createElement(React.Fragment, null, React.createElement(Snackbar, {
681    open: Msg.open,
682    autoHideDuration: 4500,
683    onClose: close,
684    anchorOrigin: {
685      horizontal: "center",
686      vertical: "top"
687    }
688  }, React.createElement(Alert, {
689    onClose: close,
690    severity: "error",
691    sx: {
692      width: '100%'
693    }
694  }, Msg.msg)));
695};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.