add api to modal_setting_notify

このコミットが含まれているのは:
dragon1211 2021-11-15 18:59:25 -08:00
コミット 80e94c932c
3個のファイルの変更78行の追加79行の削除

ファイルの表示

@ -43518,6 +43518,11 @@ function ModalSettingNotify(_ref) {
_success = _useState8[0],
setSuccess = _useState8[1];
var _useState9 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(''),
_useState10 = _slicedToArray(_useState9, 2),
_400error = _useState10[0],
set400Error = _useState10[1];
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
axios__WEBPACK_IMPORTED_MODULE_1___default().get('/api/fathers/meeting/approvals/listChildrenOfApprovel', {
params: {
@ -43542,6 +43547,24 @@ function ModalSettingNotify(_ref) {
}
});
}, []);
var settingNotify = function settingNotify(tel) {
var formdata = new FormData();
formdata.append('tel', tel);
formdata.append('meeting_id', meetingId);
axios__WEBPACK_IMPORTED_MODULE_1___default().post('/api/fathers/approvalNotification', formdata).then(function (response) {
switch (response.data.status_code) {
case 200:
setSuccess('SMSの送信に成功しました!');
break;
case 400:
setSuccess('SMSの送信に失敗しました。');
break;
}
});
};
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)(_mui_material_Dialog__WEBPACK_IMPORTED_MODULE_5__.default, {
open: show,
TransitionComponent: Transition,
@ -43639,6 +43662,12 @@ function ModalSettingNotify(_ref) {
className: "text-center py-2 ft-xs-15",
children: "\u30C7\u30FC\u30BF\u306F\u3042\u308A\u307E\u305B\u3093\u3002"
})
}), _400error && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_component_alert__WEBPACK_IMPORTED_MODULE_2__.default, {
type: "fail",
children: _400error
}), _success && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(_component_alert__WEBPACK_IMPORTED_MODULE_2__.default, {
type: "success",
children: _success
})]
})]
});
@ -47795,69 +47824,38 @@ var MeetingDetail = function MeetingDetail(props) {
});
};
function handleAcceptNotify() {
return _handleAcceptNotify.apply(this, arguments);
}
function _handleAcceptNotify() {
_handleAcceptNotify = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee() {
var _props$match$params4;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
try {
axios__WEBPACK_IMPORTED_MODULE_3___default().post("/api/fathers/children/listOfMeetingNotifyUnapprovel/".concat((_props$match$params4 = props.match.params) === null || _props$match$params4 === void 0 ? void 0 : _props$match$params4.id)).then(function (response) {
if (response.data.status_code == 200) {
var _props$match$params5;
axios__WEBPACK_IMPORTED_MODULE_3___default().delete("/api/smss/register/".concat((_props$match$params5 = props.match.params) === null || _props$match$params5 === void 0 ? void 0 : _props$match$params5.id)).then(function (response) {});
}
});
setShowNotify(false);
} catch (error) {
console.log('error', error);
}
case 1:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _handleAcceptNotify.apply(this, arguments);
}
;
function handleFavorite(_x, _x2) {
return _handleFavorite.apply(this, arguments);
}
function _handleFavorite() {
_handleFavorite = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee2(meetingId, currentFavorite) {
var formdata, updatedItem;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee2$(_context2) {
_handleFavorite = _asyncToGenerator( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee(meetingId, currentFavorite) {
var formdata;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap(function _callee$(_context) {
while (1) {
switch (_context2.prev = _context2.next) {
switch (_context.prev = _context.next) {
case 0:
formdata = new FormData();
formdata.append('meeting_id', meetingId);
formdata.append('is_favorite', currentFavorite == 1 ? 0 : 1);
axios__WEBPACK_IMPORTED_MODULE_3___default().post('/api/meetings/registerFavorite', formdata).then(function (response) {});
updatedItem = _objectSpread(_objectSpread({}, meeting), {}, {
is_favorite: currentFavorite == 1 ? 0 : 1
});
setMeeting(updatedItem);
axios__WEBPACK_IMPORTED_MODULE_3___default().post('/api/fathers/meetings/registerFavorite', formdata).then(function (response) {
setNotice(response.data.notice);
case 6:
if (response.data.status_code == 200) {
var updatedItem = _objectSpread(_objectSpread({}, meeting), {}, {
is_favorite: currentFavorite == 1 ? 0 : 1
});
setMeeting(updatedItem);
}
});
case 4:
case "end":
return _context2.stop();
return _context.stop();
}
}
}, _callee2);
}, _callee);
}));
return _handleFavorite.apply(this, arguments);
}
@ -48050,8 +48048,7 @@ var MeetingDetail = function MeetingDetail(props) {
meetingId: meeting.id,
handleClose: function handleClose() {
return setShowSettingNotify(false);
} // handleAccept={handleAccept}
}
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_component_modal_memo__WEBPACK_IMPORTED_MODULE_5__.default, {
show: showMemo,
title: "メモ",
@ -48072,8 +48069,8 @@ var MeetingDetail = function MeetingDetail(props) {
message: "本当に再通知しても\nよろしいでしょうか?",
handleClose: function handleClose() {
return setShowNotify(false);
},
handleAccept: handleAcceptNotify
} // handleAccept={handleAcceptNotify}
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(_component_pdf_modal_pdf__WEBPACK_IMPORTED_MODULE_7__.default, {
show: showPdf,
pdfPath: (_meeting$pdf = meeting.pdf) !== null && _meeting$pdf !== void 0 ? _meeting$pdf : '/pdf/test.pdf',

ファイルの表示

@ -22,6 +22,7 @@ export default function ModalSettingNotify({show, handleClose, meetingId}){
const [approval, setApproval ] = useState([]);
const [isApproval, setIsApproval ] = useState(false);
const [_success, setSuccess] = useState('');
const [_400error, set400Error] = useState('');
useEffect(() => {
axios.get('/api/fathers/meeting/approvals/listChildrenOfApprovel', {params: { meeting_id: meetingId }})
@ -42,6 +43,19 @@ export default function ModalSettingNotify({show, handleClose, meetingId}){
}
});
}, []);
const settingNotify = (tel) => {
const formdata = new FormData();
formdata.append('tel', tel);
formdata.append('meeting_id', meetingId);
axios.post('/api/fathers/approvalNotification', formdata)
.then(response=>{
switch(response.data.status_code){
case 200: setSuccess('SMSの送信に成功しました!'); break;
case 400: setSuccess('SMSの送信に失敗しました。'); break;
}
})
}
return (
@ -101,6 +115,8 @@ export default function ModalSettingNotify({show, handleClose, meetingId}){
: <p className="text-center py-2 ft-xs-15">データはありません</p>
}
</div>
{ _400error && <Alert type="fail">{_400error}</Alert> }
{ _success && <Alert type="success">{_success}</Alert>}
</DialogContent>
</Dialog>
)

ファイルの表示

@ -70,34 +70,21 @@ const MeetingDetail = (props) => {
};
async function handleAcceptNotify() {
try {
axios.post(`/api/fathers/children/listOfMeetingNotifyUnapprovel/${props.match.params?.id}`)
.then(response => {
if(response.data.status_code == 200){
axios.delete(`/api/smss/register/${props.match.params?.id}`)
.then(response => {
});
}
});
setShowNotify(false);
} catch (error) {
console.log('error', error);
}
};
async function handleFavorite(meetingId, currentFavorite) {
const formdata = new FormData();
formdata.append('meeting_id', meetingId);
formdata.append('is_favorite', currentFavorite == 1 ? 0 : 1);
axios.post('/api/meetings/registerFavorite', formdata).then((response) => {})
const updatedItem = {
...meeting,
is_favorite: currentFavorite == 1 ? 0 : 1,
};
setMeeting(updatedItem);
axios.post('/api/fathers/meetings/registerFavorite', formdata)
.then(response => {
setNotice(response.data.notice);
if(response.data.status_code == 200){
const updatedItem = {
...meeting,
is_favorite: currentFavorite == 1 ? 0 : 1,
};
setMeeting(updatedItem);
}
})
};
return (
@ -213,7 +200,6 @@ const MeetingDetail = (props) => {
show={showSettingNotify}
meetingId={meeting.id}
handleClose={()=>setShowSettingNotify(false)}
// handleAccept={handleAccept}
/>
<ModalMemo
show={showMemo}
@ -232,7 +218,7 @@ const MeetingDetail = (props) => {
show={showNotify}
message={"本当に再通知しても\nよろしいでしょうか?"}
handleClose={()=>setShowNotify(false)}
handleAccept={handleAcceptNotify}
// handleAccept={handleAcceptNotify}
/>
<ModalPdf
show={showPdf}