Offers
This commit is contained in:
@@ -8,4 +8,9 @@ body{
|
||||
}
|
||||
.site-menubar{
|
||||
top:0;
|
||||
}
|
||||
}
|
||||
.ui-datepicker {
|
||||
position: relative;
|
||||
z-index:9999 !important;
|
||||
}
|
||||
|
||||
|
||||
+105
-45
@@ -1,90 +1,150 @@
|
||||
.redish{
|
||||
color:#F2353C;
|
||||
}
|
||||
.blueish{
|
||||
color:#247CF0;
|
||||
}
|
||||
.greenish{
|
||||
color:#5A9101;
|
||||
}
|
||||
.pointer{
|
||||
cursor:pointer;
|
||||
}
|
||||
.align-right{
|
||||
text-align:right;
|
||||
.redish {
|
||||
color: #F2353C;
|
||||
}
|
||||
|
||||
.site-menu-sub > li{
|
||||
margin-left:30px;
|
||||
padding-left:10px;
|
||||
.blueish {
|
||||
color: #247CF0;
|
||||
}
|
||||
.site-menu-sub > li :hover{
|
||||
background-color:#463238;
|
||||
color:gold;
|
||||
|
||||
.greenish {
|
||||
color: #5A9101;
|
||||
}
|
||||
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.site-menu-sub > li {
|
||||
margin-left: 30px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.site-menu-sub > li :hover {
|
||||
background-color: #463238;
|
||||
color: gold;
|
||||
}
|
||||
|
||||
/*********TABLES************/
|
||||
|
||||
.table-blueish-header{
|
||||
background-color:#247CF0;
|
||||
color:#fff !important;
|
||||
.table-blueish-header {
|
||||
background-color: #247CF0;
|
||||
color: #fff !important;
|
||||
}
|
||||
.table-blueish-header{
|
||||
background-color:#247CF0;
|
||||
color:#fff !important;
|
||||
|
||||
.table-blueish-header {
|
||||
background-color: #247CF0;
|
||||
color: #fff !important;
|
||||
}
|
||||
.table-tealish-header{
|
||||
background-color:#008577;
|
||||
color:#fff !important;
|
||||
|
||||
.table-tealish-header {
|
||||
background-color: #008577;
|
||||
color: #fff !important;
|
||||
}
|
||||
.table-tealish-light-header{
|
||||
background-color:#C3F7F2;
|
||||
color:#fff !important;
|
||||
|
||||
.table-tealish-light-header {
|
||||
background-color: #C3F7F2;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/*********SWITCH************/
|
||||
.onoffswitch {
|
||||
position: relative; width: 60px;
|
||||
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
|
||||
position: relative;
|
||||
width: 60px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
.onoffswitch-checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.onoffswitch-label {
|
||||
display: block; overflow: hidden; cursor: pointer;
|
||||
border: 2px solid #05A85C; border-radius: 16px;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border: 2px solid #05A85C;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.onoffswitch-inner {
|
||||
display: block; width: 200%; margin-left: -100%;
|
||||
display: block;
|
||||
width: 200%;
|
||||
margin-left: -100%;
|
||||
transition: margin 0.3s ease-in 0s;
|
||||
}
|
||||
|
||||
.onoffswitch-inner:before, .onoffswitch-inner:after {
|
||||
display: block; float: left; width: 50%; height: 23px; padding: 0; line-height: 23px;
|
||||
font-size: 11px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
|
||||
display: block;
|
||||
float: left;
|
||||
width: 50%;
|
||||
height: 23px;
|
||||
padding: 0;
|
||||
line-height: 23px;
|
||||
font-size: 11px;
|
||||
color: white;
|
||||
font-family: Trebuchet, Arial, sans-serif;
|
||||
font-weight: bold;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.onoffswitch-inner:before {
|
||||
content: "Ja";
|
||||
padding-left: 10px;
|
||||
background-color: #63BE62; color: #FFFFFF;
|
||||
background-color: #63BE62;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.onoffswitch-inner:after {
|
||||
content: "nee";
|
||||
padding-right: 10px;
|
||||
background-color: #EEEEEE; color: #999999;
|
||||
background-color: #EEEEEE;
|
||||
color: #999999;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.onoffswitch-switch {
|
||||
display: block; width: 25px; margin: 1.5px;
|
||||
display: block;
|
||||
width: 25px;
|
||||
margin: 1.5px;
|
||||
background: #FFFFFF;
|
||||
position: absolute; top: 0; bottom: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 33px;
|
||||
border: 2px solid #408C40; border-radius: 16px;
|
||||
border: 2px solid #408C40;
|
||||
border-radius: 16px;
|
||||
transition: all 0.3s ease-in 0s;
|
||||
}
|
||||
|
||||
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
|
||||
right: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
/**********percentage input***********/
|
||||
.percentage-input {
|
||||
text-align: right;
|
||||
padding-right: 25px;
|
||||
}
|
||||
|
||||
.percentage-sign {
|
||||
position: relative;
|
||||
right: 15px;
|
||||
z-index: 10;
|
||||
top: 7px;
|
||||
}
|
||||
/**********END: percentage input***********/
|
||||
|
||||
.pointer{
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,29 +8,21 @@
|
||||
dbo.offerDataService = {
|
||||
|
||||
getAllOffers: function ( archive = 'F', callback ) {
|
||||
$.getJSON( 'index.php/beheer/offersController/getAllOffers/' + archive )
|
||||
$.getJSON( 'index.php/projects/offersController/getAllOffers/' + archive )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
getOffer: function ( userID, callback ) {
|
||||
$.getJSON( 'index.php/beheer/offersController/getOffer/' + userID )
|
||||
$.getJSON( 'index.php/projects/offersController/getOffer/' + userID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
checkOffername: function ( username, callback ) {
|
||||
$.post( 'index.php/beheer/userController/checkOffername', 'json' )
|
||||
.done( function ( data ) {
|
||||
console.log( data );
|
||||
callback( data );
|
||||
} );
|
||||
},
|
||||
|
||||
saveOffer: function ( submitDATA, callback ) {
|
||||
$.post( 'index.php/beheer/offersController/saveOffer', submitDATA, function () {
|
||||
$.post( 'index.php/projects/offersController/saveOffer', submitDATA, function () {
|
||||
}, 'json' )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
@@ -38,14 +30,14 @@ dbo.offerDataService = {
|
||||
},
|
||||
|
||||
archiveOffer: function ( userID, status, callback ) {
|
||||
$.get( 'index.php/beheer/offersController/archiveOffer/' + userID + '/' + status )
|
||||
$.get( 'index.php/projects/offersController/archiveOffer/' + userID + '/' + status )
|
||||
.done( function () {
|
||||
callback();
|
||||
} );
|
||||
},
|
||||
|
||||
removeOffer: function ( userID, callback ) {
|
||||
$.getJSON( 'index.php/beheer/offersController/removeOffer/' + userID )
|
||||
$.getJSON( 'index.php/projects/offersController/removeOffer/' + userID )
|
||||
.done( function ( data ) {
|
||||
callback( data );
|
||||
} );
|
||||
|
||||
@@ -55,5 +55,15 @@ dbo.helpers = {
|
||||
string = string.toString();
|
||||
if ( string.length == 0 ) return '';
|
||||
return string.split( '' ).reverse().join( '' );
|
||||
},
|
||||
|
||||
mysql2date : function(date){
|
||||
if( date.length != 10 ) return null;
|
||||
|
||||
var dateParts = date.split("-");
|
||||
|
||||
var newDate = dateParts[2] + '-' + dateParts[1] + '-' + dateParts[0];
|
||||
|
||||
return newDate;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,7 @@ $( function () {
|
||||
vm[page]( true );
|
||||
|
||||
var func = page.toLowerCase() + 'Init';
|
||||
console.log( func );
|
||||
window.dbo[func]();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ $( function () {
|
||||
setCustomer: function ( customer ) {
|
||||
var vm = dbo.editCustomerModal;
|
||||
|
||||
vm.id = customer.id;
|
||||
vm.id = customer.id || 0;
|
||||
vm.name( customer.name || '' );
|
||||
vm.address( customer.address || '' );
|
||||
vm.postcode( customer.postcode || '' );
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* Offerte: Theo Weijmer
|
||||
* Offer: Theo Weijmer
|
||||
* Date: 25/12/2017
|
||||
* Time: 17:32
|
||||
*/
|
||||
|
||||
$( function () {
|
||||
dbo.editOfferteModal = {
|
||||
|
||||
dbo.editOfferModal = {
|
||||
id : null,
|
||||
offertes : ko.observableArray( [] ),
|
||||
projects : ko.observableArray( [] ),
|
||||
offerte_id : ko.observable(),
|
||||
project_id : ko.observable(),
|
||||
customers : ko.observableArray( [] ),
|
||||
startdate : ko.observable(),
|
||||
acceptance_chance: ko.observable(),
|
||||
accepteddate : ko.observable(),
|
||||
rejectdate : ko.observable(),
|
||||
customer_id : ko.observable(),
|
||||
project_id : ko.observable(),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.editOfferteModal;
|
||||
dbo.customerDataService.getAllCustomers( 'F', function ( data ) {
|
||||
vm.customers( data );
|
||||
} );
|
||||
var vm = dbo.editOfferModal;
|
||||
|
||||
dbo.editOfferModal.refreshCustomers();
|
||||
},
|
||||
|
||||
newEditOfferte: function ( offerte, callback ) {
|
||||
var vm = dbo.editOfferteModal;
|
||||
newEditOffer: function ( offer, callback ) {
|
||||
var vm = dbo.editOfferModal;
|
||||
vm.callback = typeof(callback) == 'function' ? callback : null;
|
||||
|
||||
vm.showOfferteModal();
|
||||
vm.showOfferModal();
|
||||
|
||||
vm.setOfferte( offerte );
|
||||
vm.setOffer( offer );
|
||||
},
|
||||
|
||||
saveOfferte: function () {
|
||||
var vm = dbo.editOfferteModal;
|
||||
getCustomerProjects: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
},
|
||||
|
||||
saveOffer: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
|
||||
if ( vm.formValid == false ) return;
|
||||
|
||||
var submitDATA = {
|
||||
id : vm.id,
|
||||
offertes : vm.offertes(),
|
||||
projects : vm.projects(),
|
||||
offerte_id : vm.offerte_id(),
|
||||
project_id : vm.project_id(),
|
||||
customer_id : vm.customer_id(),
|
||||
startdate : vm.startdate(),
|
||||
acceptance_chance: vm.acceptance_chance(),
|
||||
accepteddate : vm.accepteddate(),
|
||||
rejectdate : vm.rejectdate()
|
||||
rejectdate : vm.rejectdate(),
|
||||
}
|
||||
|
||||
dbo.offerteDataService.saveOfferte( submitDATA, function ( data ) {
|
||||
dbo.offerDataService.saveOffer( submitDATA, function ( data ) {
|
||||
if ( data.success ) {
|
||||
tellMe( {
|
||||
title : 'offerte aangemaakt',
|
||||
message : 'de offerte is succesvol opgeslagen',
|
||||
title : 'offer aangemaakt',
|
||||
message : 'de offer is succesvol opgeslagen',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.hideOfferteModal();
|
||||
vm.hideOfferModal();
|
||||
|
||||
if ( typeof(vm.callback) == 'function' ) vm.callback();
|
||||
} );
|
||||
@@ -74,38 +74,80 @@ $( function () {
|
||||
} );
|
||||
errorMessage += '</ul>';
|
||||
tellMe( {
|
||||
title : 'fout aanmaken offerte',
|
||||
title : 'fout aanmaken offer',
|
||||
message : errorMessage,
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
} );
|
||||
},
|
||||
|
||||
setOfferte: function ( offerte ) {
|
||||
var vm = dbo.editOfferteModal;
|
||||
setOffer: function ( offer ) {
|
||||
var vm = dbo.editOfferModal;
|
||||
|
||||
vm.id = offerte.id;
|
||||
vm.name( offerte.name || '' );
|
||||
vm.address( offerte.address || '' );
|
||||
vm.postcode( offerte.postcode || '' );
|
||||
vm.place( offerte.place || '' );
|
||||
vm.contactperson( offerte.contactperson || '' );
|
||||
vm.email( offerte.email || '' );
|
||||
vm.website( offerte.website || '' );
|
||||
vm.remarks( offerte.remarks || '' );
|
||||
vm.id = offer.id || 0;
|
||||
vm.customer_id( offer.customer_id || null );
|
||||
vm.project_id( offer.project_id || null );
|
||||
vm.startdate( offer.startdate || null );
|
||||
vm.acceptance_chance( offer.acceptance_chance || 0 );
|
||||
vm.accepteddate( offer.accepteddate || null );
|
||||
vm.rejectdate( offer.rejectdate || null );
|
||||
},
|
||||
|
||||
showOfferteModal: function () {
|
||||
$( "#offerte-modal" ).modal( 'show' );
|
||||
showOfferModal: function () {
|
||||
$( "#offer-modal" ).modal( 'show' );
|
||||
},
|
||||
|
||||
hideOfferteModal: function () {
|
||||
$( "#offerte-modal" ).modal( 'hide' );
|
||||
hideOfferModal: function () {
|
||||
$( "#offer-modal" ).modal( 'hide' );
|
||||
},
|
||||
|
||||
validateNumber: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
vm.acceptance_chance( dbo.helpers.validateNumber( vm.acceptance_chance(), false ) );
|
||||
},
|
||||
|
||||
addCustomer: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
dbo.editCustomerModal.newEditCustomer( false, function () {
|
||||
vm.refreshCustomers();
|
||||
} );
|
||||
},
|
||||
|
||||
refreshCustomers: function () {
|
||||
var vm = dbo.editOfferModal;
|
||||
dbo.customerDataService.getAllCustomers( 'F', function ( data ) {
|
||||
vm.customers( data );
|
||||
} );
|
||||
},
|
||||
|
||||
resetDate: function ( field ) {
|
||||
var vm = dbo.editOfferModal;
|
||||
|
||||
vm[field]( null );
|
||||
}
|
||||
};
|
||||
|
||||
dbo.editOfferteModal.init();
|
||||
dbo.editOfferModal.init();
|
||||
|
||||
ko.applyBindings( dbo.editOfferteModal, document.getElementById( 'offer-modal' ) );
|
||||
dbo.editOfferModal.offerDateValid = ko.pureComputed( function () {
|
||||
if ( !this.startdate() ) return false;
|
||||
if ( this.startdate().length != 10 ) return false;
|
||||
|
||||
return true;
|
||||
}, dbo.editOfferModal );
|
||||
|
||||
dbo.editOfferModal.chance = ko.pureComputed( function () {
|
||||
if ( this.acceptance_chance() < 0 ) return this.acceptance_chance( 0 );
|
||||
if ( this.acceptance_chance() > 100 ) return this.acceptance_chance( 100 );
|
||||
}, dbo.editOfferModal );
|
||||
|
||||
dbo.editOfferModal.formValid = ko.pureComputed( function () {
|
||||
if ( !this.customer_id() ) return false;
|
||||
if ( !this.offerDateValid() ) return false;
|
||||
|
||||
return true;
|
||||
}, dbo.editOfferModal )
|
||||
|
||||
ko.applyBindings( dbo.editOfferModal, document.getElementById( 'offer-modal' ) );
|
||||
|
||||
} );
|
||||
@@ -20,7 +20,7 @@ dbo.offersInit = function () {
|
||||
init: function () {
|
||||
var vm = dbo.offersModel;
|
||||
|
||||
// vm.refreshOffers();
|
||||
vm.refreshOffers();
|
||||
},
|
||||
|
||||
newOffer: function () {
|
||||
@@ -97,8 +97,24 @@ dbo.offersInit = function () {
|
||||
var vm = dbo.offersModel;
|
||||
|
||||
dbo.offerDataService.getAllOffers( vm.archive() ? 'T' : 'F', function ( data ) {
|
||||
vm.offers( data );
|
||||
vm.offers.removeAll();
|
||||
$.each( data, function ( i, p ) {
|
||||
vm.offers.push( new vm.Offer( p ) );
|
||||
} )
|
||||
} );
|
||||
},
|
||||
|
||||
Offer: function ( data ) {
|
||||
this.id = data.id;
|
||||
this.acceptance_chance = data.acceptance_chance;
|
||||
this.projectNumber = data.project ? data.project.projectnumber : null;
|
||||
this.customerName = data.customer ? data.customer.name : null;
|
||||
this.customer_id = data.customer_id;
|
||||
this.startdate = data.startdate ? dbo.helpers.mysql2date( data.startdate ) : null;
|
||||
this.rejectdate = data.rejectdate ? dbo.helpers.mysql2date( data.rejectdate ) : null;
|
||||
this.accepteddate = data.accepteddate ? dbo.helpers.mysql2date( data.accepteddate ) : null;
|
||||
this.acceptance_chance = data.acceptance_chance ? data.acceptance_chance : 0;
|
||||
this.archive = data.archive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user