CHANGE_STAFF_CREATE : AADHAVAN
This commit is contained in:
parent
5bb3ef7735
commit
54e76f485b
4
.env
4
.env
@ -72,6 +72,6 @@ database.default.port = 3306
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
WAAI_INSTANCE = '666FEE6738696'
|
WAAI_INSTANCE = '66712908EB75A'
|
||||||
WAAI_TOKEN = '666fd862df687'
|
WAAI_TOKEN = '667128c844c48'
|
||||||
SEND_WAAI_URL = SEND_WAAI_URL
|
SEND_WAAI_URL = SEND_WAAI_URL
|
||||||
@ -120,7 +120,7 @@ class StaffController extends BaseController
|
|||||||
$staff = $this->StaffModel->where('email', $email)->first();
|
$staff = $this->StaffModel->where('email', $email)->first();
|
||||||
|
|
||||||
if($staff){
|
if($staff){
|
||||||
return;
|
return json_encode('mail_exists');
|
||||||
}else{
|
}else{
|
||||||
$staffData = $this->request->getVar();
|
$staffData = $this->request->getVar();
|
||||||
// print_r($staffData);die;
|
// print_r($staffData);die;
|
||||||
@ -129,7 +129,8 @@ class StaffController extends BaseController
|
|||||||
$insert = $this->StaffModel->save($staffData);
|
$insert = $this->StaffModel->save($staffData);
|
||||||
if($insert)
|
if($insert)
|
||||||
{
|
{
|
||||||
return redirect()->to(base_url()."staff_list");
|
return json_encode('staff_created');
|
||||||
|
// return redirect()->to(base_url()."staff_list");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +156,8 @@ class StaffController extends BaseController
|
|||||||
$staff_id = $this->request->getVar('id');
|
$staff_id = $this->request->getVar('id');
|
||||||
$this->StaffModel->where('staff_id', $staff_id )->set($staffData)->update();
|
$this->StaffModel->where('staff_id', $staff_id )->set($staffData)->update();
|
||||||
|
|
||||||
return redirect()->to(base_url()."staff_list");
|
return json_encode('edit_success');
|
||||||
|
// return redirect()->to(base_url()."staff_list");
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$data['staffData'] = $this->StaffModel->where('md5(staff.staff_id)', $this->request->getVar('staff_id') )->get()->getRow();
|
$data['staffData'] = $this->StaffModel->where('md5(staff.staff_id)', $this->request->getVar('staff_id') )->get()->getRow();
|
||||||
|
|||||||
@ -181,9 +181,8 @@ $(document).ready(function() {
|
|||||||
var formData = $(this).serialize(); // Serialize form data
|
var formData = $(this).serialize(); // Serialize form data
|
||||||
|
|
||||||
var staffData = <?php echo isset($staffData) ? json_encode($staffData) : '0'; ?>;
|
var staffData = <?php echo isset($staffData) ? json_encode($staffData) : '0'; ?>;
|
||||||
console.log(staffData);
|
|
||||||
|
|
||||||
var action = staffData ? '<?php echo base_url("staff_edit"); ?>' : '<?php echo base_url("staff_create"); ?>';
|
var action = staffData ? '<?php echo base_url("staff_edit"); ?>' : '<?php echo base_url("staff_create"); ?>';
|
||||||
|
console.log(action);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@ -192,6 +191,12 @@ $(document).ready(function() {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
if(response === 'staff_created' || response == 'edit_success'){
|
||||||
|
window.location.href = '<?php echo base_url("staff_list"); ?>';
|
||||||
|
}else if(response == 'mail_exists'){
|
||||||
|
toastr.warning('Mail Already Exists Please Choose Another Mail');
|
||||||
|
}
|
||||||
|
|
||||||
// Handle success response
|
// Handle success response
|
||||||
},
|
},
|
||||||
error: function(error) {
|
error: function(error) {
|
||||||
@ -205,17 +210,17 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
|
|
||||||
$('#staff_data_form_submit').click(function (event) {
|
$('#staff_data_form_submit').click(function (event) {
|
||||||
|
console.log("come");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if($('#business_id').val() == 0){
|
if($('#business_id').val() == 0){
|
||||||
toastr.warning('Select Business');
|
toastr.warning('Select Business');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if($('#branch_id').val() == 0){
|
if($('#branch_id').val() == 0){
|
||||||
console.log("branch");
|
|
||||||
toastr.warning('Select Branch');
|
toastr.warning('Select Branch');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// $('#staff_form').submit();
|
$('#staff_form').submit();
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user