# nails-courses-admin-form

> Component for npm registry

Latest version **0.0.8** (published 2020-10-13) · 0 weekly downloads

## Install

```sh
npm install nails-courses-admin-form
pnpm add nails-courses-admin-form
yarn add nails-courses-admin-form
bun add nails-courses-admin-form
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2020-10-13 |
| First published | 2020-10-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 8.3 MB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| Author | vue-command |
| Maintainers | systanon |

## Links

- npm: https://www.npmjs.com/package/nails-courses-admin-form
- npm.io page: https://npm.io/package/nails-courses-admin-form

## Dependencies (6)

- [vue](https://npm.io/package/vue.md) ^2.6.11
- [core-js](https://npm.io/package/core-js.md) ^3.6.5
- [vuetify](https://npm.io/package/vuetify.md) ^2.2.11
- [nails-styles](https://npm.io/package/nails-styles.md) 0.0.3
- [nails-courses-card](https://npm.io/package/nails-courses-card.md) ^0.0.7
- [nails-courses-card-detail](https://npm.io/package/nails-courses-card-detail.md) ^0.1.2

## Recent versions

- 0.0.8 (latest) — 2020-10-13
- 0.0.7 — 2020-10-05
- 0.0.6 — 2020-10-04
- 0.0.5 — 2020-10-04
- 0.0.4 — 2020-10-04
- 0.0.3 — 2020-10-04
- 0.0.2 — 2020-10-04
- 0.0.1 — 2020-10-03

## README

# nails-courses-admin-form

____________________________________________

## install component
```
yarn add nails-courses-admin-form
yarn add nails-styles
```

### Load the component and it's styles

App.vue
```
import 'nails-courses-admin-form'
import 'nails-styles'
```

### Use the component

```
<CoursesForm
  :idCourse="editCourseID"
  :typeCourse="typeCourse"
  :getCourseID="getCourseID"
  :sendData="sendData"
  :back="backForm"
/>
```

### Example

###### App.vue
```
<template>
  <v-app>
    <div id="app">
      <v-btn @click="btnMethod">{{ method }}</v-btn>
      <v-btn @click="btnType">{{ typeCourse }}</v-btn>
      <v-text-field
        label="course id"
        v-model="editCourseID"
        :disabled="methodPost"
        outlined
        dark
        :counter="24"
        maxlength="24"
      />
      <CoursesForm
        :idCourse="editCourseID"
        :typeCourse="typeCourse"
        :getCourseID="getCourseID"
        :sendData="sendData"
        :back="backForm"
      />
    </div>
  </v-app>
</template>

<script>
import { VTextField, VBtn } from 'vuetify/lib'
import CoursesForm from './components/CoursesForm'
export default {
  name: 'App',
  components: {
    CoursesForm,
    VTextField,
    VBtn
  },
  data: () => ({
    typeCourse: 'offline',
    btnPress: false,
    editCourseID: '',
    methodPost: true,
    method: 'POST'
  }),
  methods: {
    btnMethod () {
      this.methodPost = !this.methodPost
      this.method = this.methodPost ? 'POST' : 'PUT'
    },
    btnType () {
      this.btnPress = !this.btnPress
      this.typeCourse = this.btnPress ? 'online' : 'offline'
    },
    async getCourseID (id) {
      const response = await (
        await fetch(
          `https://nails-australia-staging.herokuapp.com/course/${this.typeCourse}/${id}`
        )
      ).json()
      return response[`${this.typeCourse}Course`]
    },
    backForm () {
      console.log('hi')
    },
    async sendData (formData) {
      const offlineRequest = `https://nails-australia-staging.herokuapp.com/course/new/${this.typeCourse}`
      const url = this.methodPost
        ? offlineRequest
        : `${offlineRequest.replace(/[/]new/gi, '')}/${this.editCourseID}`


      const response = await (
        await fetch(url, {
          method: this.method,
          body: formData
        })
      ).json()

      if (response?.newOfflineCourse) {
        // Baner
        //  Course successfully created.
        this.$notify({
          group: 'foo',
          title: 'Important message',
          text: 'Course successfully created'
        })
      }
      if (response?.updatedOfflineCourse) {
        // Baner
        //  Course successfully updated.
        this.$notify({
          group: 'foo',
          title: 'Important message',
          text: 'Course successfully updated.'
        })
      }
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
  background-color: black;
}
.v-btn__content {
  justify-content: center !important;
}
</style>
```

---
_Source: https://npm.io/package/nails-courses-admin-form · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
