diff --git a/apiserver/apiserver/api/serializers.py b/apiserver/apiserver/api/serializers.py index 6a2e948..540cf78 100644 --- a/apiserver/apiserver/api/serializers.py +++ b/apiserver/apiserver/api/serializers.py @@ -476,10 +476,8 @@ class CardSerializer(serializers.ModelSerializer): )]) member_id = serializers.SerializerMethodField() active_status = serializers.ChoiceField([ - 'card_blocked', + 'card_active', 'card_inactive', - 'card_member_blocked', - 'card_active' ]) class Meta: diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 41424bd..3898453 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -246,7 +246,7 @@ class MemberViewSet(Base, Retrieve, Update): return FileResponse(card_photo, filename='card.jpg') -class CardViewSet(Base, Create, Retrieve, Update, Destroy): +class CardViewSet(Base, Create, Retrieve, Update): permission_classes = [AllowMetadata | IsAdmin] queryset = models.Card.objects.all() serializer_class = serializers.CardSerializer diff --git a/webclient/src/AdminMembers.js b/webclient/src/AdminMembers.js index 267dbed..03714bb 100644 --- a/webclient/src/AdminMembers.js +++ b/webclient/src/AdminMembers.js @@ -12,7 +12,6 @@ function AdminCardDetail(props) { const [error, setError] = useState(false); const [loading, setLoading] = useState(false); const [success, setSuccess] = useState(false); - const [yousure, setYousure] = useState(false); const id = card.id; const handleValues = (e, v) => setInput({ ...input, [v.name]: v.value }); @@ -37,22 +36,6 @@ function AdminCardDetail(props) { }); }; - const handleDelete = (e) => { - e.preventDefault(); - - if (yousure) { - requester('/cards/'+id+'/', 'DELETE', token) - .then(res => { - setInput(false); - }) - .catch(err => { - console.log(err); - }); - } else { - setYousure(true); - } - }; - const makeProps = (name) => ({ name: name, onChange: handleChange, @@ -62,60 +45,44 @@ function AdminCardDetail(props) { const statusOptions = [ { key: '0', text: 'Card Active', value: 'card_active' }, - { key: '1', text: 'Card Blocked', value: 'card_blocked' }, - { key: '2', text: 'Card Inactive', value: 'card_inactive' }, - { key: '3', text: 'Card Member Blocked', value: 'card_member_blocked' }, + { key: '1', text: 'Card Inactive', value: 'card_inactive' }, ]; return ( - input ? - -
- - - + + + + + - - - {success ? 'Saved.' : 'Save'} - + + {success ? 'Saved.' : 'Save'} + + - - {yousure ? 'You Sure?' : 'Delete'} - - - - - Notes: {input.notes || 'None'}
- Last Seen:{' '} - {input.last_seen ? - input.last_seen > '2021-11-14T02:01:35.415685Z' ? - moment.utc(input.last_seen).tz('America/Edmonton').format('lll') - : - moment.utc(input.last_seen).tz('America/Edmonton').format('ll') + Notes: {input.notes || 'None'}
+ Last Seen:{' '} + {input.last_seen ? + input.last_seen > '2021-11-14T02:01:35.415685Z' ? + moment.utc(input.last_seen).tz('America/Edmonton').format('lll') : - 'Unknown' - } -
-
- : - - Deleted card: {card.card_number} - + moment.utc(input.last_seen).tz('America/Edmonton').format('ll') + : + 'Unknown' + } + + ); };