94 lines
3.8 KiB
Plaintext
94 lines
3.8 KiB
Plaintext
|
|
@{
|
|
ViewData["Title"] = "Add Module";
|
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
|
}
|
|
|
|
<div class="row" id="app">
|
|
<div class="col-md-12 col-lg-12">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="col-md-12 col-lg-12">
|
|
<form v-on:submit.prevent="">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Settings</h5>
|
|
<div class="form-group row">
|
|
<label class="col-md-3 mt-3">Module Name</label>
|
|
<div class="col-md-6">
|
|
<input type="text" class="form-control" name="ModuleName" v-model="moduleData.ModuleName" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<label class="col-md-3 mt-3">Module Access</label>
|
|
<div class="col-md-6">
|
|
<select class="form-select shadow-none mt-3" name="AllowedUserType" v-model="moduleData.AllowedUserType" style="height: 36px; width: 100%">
|
|
<optgroup label="General">
|
|
<option value="Public">Public</option>
|
|
<option value="Registered User">Registered User</option>
|
|
</optgroup>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="border-top">
|
|
<div class="card-body">
|
|
<button type="button" class="btn btn-primary" v-on:click="saveData">
|
|
Add
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@section Scripts {
|
|
@{
|
|
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
|
}
|
|
<script>
|
|
</script>
|
|
<script>
|
|
const app = Vue.createApp({
|
|
data() {
|
|
return {
|
|
moduleData:{
|
|
ModuleName : null,
|
|
AllowedUserType : null,
|
|
MethodAllowedUserType : null,
|
|
ModuleStatus : "1",
|
|
Description : null,
|
|
}
|
|
};
|
|
},
|
|
methods: {
|
|
saveData() {
|
|
fetch('/ModuleAPI/AddModule', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify(this.moduleData)
|
|
})
|
|
.then(response => {
|
|
if (!response.ok) {
|
|
throw new Error('Name module already exist');
|
|
}
|
|
alert('Module information saved successfully');
|
|
})
|
|
.catch(error => {
|
|
console.error('There was a problem with the update operation:', error);
|
|
alert('Failed to save data: ' + error.message);
|
|
});
|
|
}
|
|
}
|
|
})
|
|
$(function () {
|
|
app.mount('#app');
|
|
});
|
|
</script>
|
|
}
|